1 /* 2 * Intel MIC Platform Software Stack (MPSS) 3 * 4 * Copyright(c) 2015 Intel Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License, version 2, as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * General Public License for more details. 14 * 15 * The full GNU General Public License is included in this distribution in 16 * the file called "COPYING". 17 * 18 * Intel MIC Coprocessor State Management (COSM) Driver 19 * 20 */ 21 #ifndef _COSM_COSM_H_ 22 #define _COSM_COSM_H_ 23 24 #include <linux/scif.h> 25 #include "../bus/cosm_bus.h" 26 27 #define COSM_HEARTBEAT_SEND_SEC 30 28 #define SCIF_COSM_LISTEN_PORT 201 29 30 /** 31 * enum COSM msg id's 32 * @COSM_MSG_SHUTDOWN: host->card trigger shutdown 33 * @COSM_MSG_SYNC_TIME: host->card send host time to card to sync time 34 * @COSM_MSG_HEARTBEAT: card->host heartbeat 35 * @COSM_MSG_SHUTDOWN_STATUS: card->host with shutdown status as payload 36 */ 37 enum cosm_msg_id { 38 COSM_MSG_SHUTDOWN, 39 COSM_MSG_SYNC_TIME, 40 COSM_MSG_HEARTBEAT, 41 COSM_MSG_SHUTDOWN_STATUS, 42 }; 43 44 struct cosm_msg { 45 u64 id; 46 union { 47 u64 shutdown_status; 48 struct { 49 u64 tv_sec; 50 u64 tv_nsec; 51 } timespec; 52 }; 53 }; 54 55 extern const char * const cosm_state_string[]; 56 extern const char * const cosm_shutdown_status_string[]; 57 58 void cosm_sysfs_init(struct cosm_device *cdev); 59 int cosm_start(struct cosm_device *cdev); 60 void cosm_stop(struct cosm_device *cdev, bool force); 61 int cosm_reset(struct cosm_device *cdev); 62 int cosm_shutdown(struct cosm_device *cdev); 63 void cosm_set_state(struct cosm_device *cdev, u8 state); 64 void cosm_set_shutdown_status(struct cosm_device *cdev, u8 status); 65 void cosm_init_debugfs(void); 66 void cosm_exit_debugfs(void); 67 void cosm_create_debug_dir(struct cosm_device *cdev); 68 void cosm_delete_debug_dir(struct cosm_device *cdev); 69 int cosm_scif_init(void); 70 void cosm_scif_exit(void); 71 void cosm_scif_work(struct work_struct *work); 72 73 #endif 74