cosm_main.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 timespec64 timespec;
  45. };
  46. };
  47. extern const char * const cosm_state_string[];
  48. extern const char * const cosm_shutdown_status_string[];
  49. void cosm_sysfs_init(struct cosm_device *cdev);
  50. int cosm_start(struct cosm_device *cdev);
  51. void cosm_stop(struct cosm_device *cdev, bool force);
  52. int cosm_reset(struct cosm_device *cdev);
  53. int cosm_shutdown(struct cosm_device *cdev);
  54. void cosm_set_state(struct cosm_device *cdev, u8 state);
  55. void cosm_set_shutdown_status(struct cosm_device *cdev, u8 status);
  56. void cosm_init_debugfs(void);
  57. void cosm_exit_debugfs(void);
  58. void cosm_create_debug_dir(struct cosm_device *cdev);
  59. void cosm_delete_debug_dir(struct cosm_device *cdev);
  60. int cosm_scif_init(void);
  61. void cosm_scif_exit(void);
  62. void cosm_scif_work(struct work_struct *work);
  63. #endif