Merge tag 'riscv/for-v5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv...
[linux-2.6-microblaze.git] / drivers / misc / mic / cosm / cosm_main.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Intel MIC Platform Software Stack (MPSS)
4  *
5  * Copyright(c) 2015 Intel Corporation.
6  *
7  * Intel MIC Coprocessor State Management (COSM) Driver
8  */
9 #ifndef _COSM_COSM_H_
10 #define _COSM_COSM_H_
11
12 #include <linux/scif.h>
13 #include "../bus/cosm_bus.h"
14
15 #define COSM_HEARTBEAT_SEND_SEC 30
16 #define SCIF_COSM_LISTEN_PORT  201
17
18 /**
19  * enum COSM msg id's
20  * @COSM_MSG_SHUTDOWN: host->card trigger shutdown
21  * @COSM_MSG_SYNC_TIME: host->card send host time to card to sync time
22  * @COSM_MSG_HEARTBEAT: card->host heartbeat
23  * @COSM_MSG_SHUTDOWN_STATUS: card->host with shutdown status as payload
24  */
25 enum cosm_msg_id {
26         COSM_MSG_SHUTDOWN,
27         COSM_MSG_SYNC_TIME,
28         COSM_MSG_HEARTBEAT,
29         COSM_MSG_SHUTDOWN_STATUS,
30 };
31
32 struct cosm_msg {
33         u64 id;
34         union {
35                 u64 shutdown_status;
36                 struct {
37                         u64 tv_sec;
38                         u64 tv_nsec;
39                 } timespec;
40         };
41 };
42
43 extern const char * const cosm_state_string[];
44 extern const char * const cosm_shutdown_status_string[];
45
46 void cosm_sysfs_init(struct cosm_device *cdev);
47 int cosm_start(struct cosm_device *cdev);
48 void cosm_stop(struct cosm_device *cdev, bool force);
49 int cosm_reset(struct cosm_device *cdev);
50 int cosm_shutdown(struct cosm_device *cdev);
51 void cosm_set_state(struct cosm_device *cdev, u8 state);
52 void cosm_set_shutdown_status(struct cosm_device *cdev, u8 status);
53 void cosm_init_debugfs(void);
54 void cosm_exit_debugfs(void);
55 void cosm_create_debug_dir(struct cosm_device *cdev);
56 void cosm_delete_debug_dir(struct cosm_device *cdev);
57 int cosm_scif_init(void);
58 void cosm_scif_exit(void);
59 void cosm_scif_work(struct work_struct *work);
60
61 #endif