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 */ 37enum cosm_msg_id { 38 COSM_MSG_SHUTDOWN, 39 COSM_MSG_SYNC_TIME, 40 COSM_MSG_HEARTBEAT, 41 COSM_MSG_SHUTDOWN_STATUS, 42}; 43 44struct cosm_msg { 45 u64 id; 46 union { 47 u64 shutdown_status; 48 struct timespec64 timespec; 49 }; 50}; 51 52extern const char * const cosm_state_string[]; 53extern const char * const cosm_shutdown_status_string[]; 54 55void cosm_sysfs_init(struct cosm_device *cdev); 56int cosm_start(struct cosm_device *cdev); 57void cosm_stop(struct cosm_device *cdev, bool force); 58int cosm_reset(struct cosm_device *cdev); 59int cosm_shutdown(struct cosm_device *cdev); 60void cosm_set_state(struct cosm_device *cdev, u8 state); 61void cosm_set_shutdown_status(struct cosm_device *cdev, u8 status); 62void cosm_init_debugfs(void); 63void cosm_exit_debugfs(void); 64void cosm_create_debug_dir(struct cosm_device *cdev); 65void cosm_delete_debug_dir(struct cosm_device *cdev); 66int cosm_scif_init(void); 67void cosm_scif_exit(void); 68void cosm_scif_work(struct work_struct *work); 69 70#endif 71