cosm_main.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #include <linux/scif.h>
  24. #include "../bus/cosm_bus.h"
  25. #define COSM_HEARTBEAT_SEND_SEC 30
  26. #define SCIF_COSM_LISTEN_PORT 201
  27. /**
  28. * enum COSM msg id's
  29. * @COSM_MSG_SHUTDOWN: host->card trigger shutdown
  30. * @COSM_MSG_SYNC_TIME: host->card send host time to card to sync time
  31. * @COSM_MSG_HEARTBEAT: card->host heartbeat
  32. * @COSM_MSG_SHUTDOWN_STATUS: card->host with shutdown status as payload
  33. */
  34. enum cosm_msg_id {
  35. COSM_MSG_SHUTDOWN,
  36. COSM_MSG_SYNC_TIME,
  37. COSM_MSG_HEARTBEAT,
  38. COSM_MSG_SHUTDOWN_STATUS,
  39. };
  40. struct cosm_msg {
  41. u64 id;
  42. union {
  43. u64 shutdown_status;
  44. struct {
  45. u64 tv_sec;
  46. u64 tv_nsec;
  47. } timespec;
  48. };
  49. };
  50. extern const char * const cosm_state_string[];
  51. extern const char * const cosm_shutdown_status_string[];
  52. void cosm_sysfs_init(struct cosm_device *cdev);
  53. int cosm_start(struct cosm_device *cdev);
  54. void cosm_stop(struct cosm_device *cdev, bool force);
  55. int cosm_reset(struct cosm_device *cdev);
  56. int cosm_shutdown(struct cosm_device *cdev);
  57. void cosm_set_state(struct cosm_device *cdev, u8 state);
  58. void cosm_set_shutdown_status(struct cosm_device *cdev, u8 status);
  59. void cosm_init_debugfs(void);
  60. void cosm_exit_debugfs(void);
  61. void cosm_create_debug_dir(struct cosm_device *cdev);
  62. void cosm_delete_debug_dir(struct cosm_device *cdev);
  63. int cosm_scif_init(void);
  64. void cosm_scif_exit(void);
  65. void cosm_scif_work(struct work_struct *work);
  66. #endif