Linux 5.10-rc1
[linux-block.git] / drivers / misc / mic / cosm / cosm_main.h
CommitLineData
4e43d779 1/* SPDX-License-Identifier: GPL-2.0-only */
f8487a26
AD
2/*
3 * Intel MIC Platform Software Stack (MPSS)
4 *
5 * Copyright(c) 2015 Intel Corporation.
6 *
f8487a26 7 * Intel MIC Coprocessor State Management (COSM) Driver
f8487a26
AD
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 */
25enum cosm_msg_id {
26 COSM_MSG_SHUTDOWN,
27 COSM_MSG_SYNC_TIME,
28 COSM_MSG_HEARTBEAT,
29 COSM_MSG_SHUTDOWN_STATUS,
30};
31
32struct cosm_msg {
33 u64 id;
34 union {
35 u64 shutdown_status;
6051e79b
AB
36 struct {
37 u64 tv_sec;
38 u64 tv_nsec;
39 } timespec;
f8487a26
AD
40 };
41};
42
43extern const char * const cosm_state_string[];
44extern const char * const cosm_shutdown_status_string[];
45
46void cosm_sysfs_init(struct cosm_device *cdev);
47int cosm_start(struct cosm_device *cdev);
48void cosm_stop(struct cosm_device *cdev, bool force);
49int cosm_reset(struct cosm_device *cdev);
50int cosm_shutdown(struct cosm_device *cdev);
51void cosm_set_state(struct cosm_device *cdev, u8 state);
52void cosm_set_shutdown_status(struct cosm_device *cdev, u8 status);
53void cosm_init_debugfs(void);
54void cosm_exit_debugfs(void);
55void cosm_create_debug_dir(struct cosm_device *cdev);
56void cosm_delete_debug_dir(struct cosm_device *cdev);
57int cosm_scif_init(void);
58void cosm_scif_exit(void);
59void cosm_scif_work(struct work_struct *work);
60
61#endif