port_ipc.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #ifndef __PORT_IPC_H__
  2. #define __PORT_IPC_H__
  3. #include <linux/wait.h>
  4. #include "ccci_core.h"
  5. #define MAX_NUM_IPC_TASKS 10
  6. #define CCCI_TASK_PENDING 0x01
  7. #define IPC_MSGSVC_RVC_DONE 0x12344321
  8. #define CCCI_IPC_MINOR_BASE 100
  9. /* MD <-> AP Msg_id mapping enum */
  10. typedef enum {
  11. IPC_L4C_MSG_ID_BEGIN = 0x80000000,
  12. #if defined(IPC_L4C_MSG_ID_LEN)
  13. IPC_L4C_MSG_ID_RANGE = IPC_L4C_MSG_ID_LEN,
  14. #else
  15. IPC_L4C_MSG_ID_RANGE = 0x80,
  16. #endif
  17. IPC_EL1_MSG_ID_BEGIN = IPC_L4C_MSG_ID_BEGIN + IPC_L4C_MSG_ID_RANGE,
  18. IPC_EL1_MSG_ID_RANGE = 0x20,
  19. IPC_CCCIIPC_MSG_ID_BEGIN = IPC_L4C_MSG_ID_BEGIN + IPC_L4C_MSG_ID_RANGE + IPC_EL1_MSG_ID_RANGE,
  20. IPC_CCCIIPC_MSG_ID_RANGE = 0x10,
  21. IPC_IPCORE_MSG_ID_BEGIN = IPC_CCCIIPC_MSG_ID_BEGIN + IPC_CCCIIPC_MSG_ID_RANGE,
  22. IPC_IPCORE_MSG_ID_RANGE = 0x8,
  23. } CCCI_IPC_MSG_ID_RANGE;
  24. struct ccci_ipc_ctrl {
  25. unsigned char task_id;
  26. unsigned char md_is_ready;
  27. unsigned long flag;
  28. wait_queue_head_t tx_wq;
  29. wait_queue_head_t md_rdy_wq;
  30. struct ccci_port *port;
  31. };
  32. /* IPC MD/AP id map table */
  33. struct ipc_task_id_map {
  34. u32 extq_id; /* IPC universal mapping external queue */
  35. u32 task_id; /* IPC processor internal task id */
  36. };
  37. typedef struct local_para {
  38. u8 ref_count;
  39. u8 _stub; /* MD complier will align ref_count to 16bit */
  40. u16 msg_len;
  41. u8 data[0];
  42. } __packed local_para_struct;
  43. typedef struct peer_buff {
  44. u16 pdu_len;
  45. u8 ref_count;
  46. u8 pb_resvered;
  47. u16 free_header_space;
  48. u16 free_tail_space;
  49. u8 data[0];
  50. } __packed peer_buff_struct;
  51. typedef struct {
  52. u32 src_mod_id;
  53. u32 dest_mod_id;
  54. u32 sap_id;
  55. u32 msg_id;
  56. struct local_para *local_para_ptr;
  57. struct peer_buff *peer_buff_ptr;
  58. } ipc_ilm_t; /* for conn_md */
  59. struct ccci_ipc_ilm {
  60. u32 src_mod_id;
  61. u32 dest_mod_id;
  62. u32 sap_id;
  63. u32 msg_id;
  64. u32 local_para_ptr;
  65. u32 peer_buff_ptr;
  66. } __packed; /* for MD */
  67. struct garbage_filter_header {
  68. u32 filter_set_id;
  69. u32 filter_cnt;
  70. u32 uplink;
  71. } __packed;
  72. struct garbage_filter_item {
  73. u32 filter_id;
  74. u8 ip_type;
  75. u8 protocol;
  76. u16 dst_port;
  77. u32 magic_code;
  78. } __packed;
  79. typedef enum {
  80. GF_IPV4V6 = 0,
  81. GF_IPV4,
  82. GF_IPV6
  83. } GF_IP_TYPE;
  84. typedef enum {
  85. GF_TCP = 6,
  86. GF_UDP = 17
  87. } GF_PROTOCOL_TYPE;
  88. int port_ipc_init(struct ccci_port *port);
  89. int port_ipc_req_match(struct ccci_port *port, struct ccci_request *req);
  90. int port_ipc_tx_wait(struct ccci_port *port);
  91. int port_ipc_rx_ack(struct ccci_port *port);
  92. int port_ipc_ioctl(struct ccci_port *port, unsigned int cmd, unsigned long arg);
  93. void port_ipc_md_state_notice(struct ccci_port *port, MD_STATE state);
  94. int port_ipc_write_check_id(struct ccci_port *port, struct ccci_request *req);
  95. unsigned int port_ipc_poll(struct file *fp, struct poll_table_struct *poll);
  96. void port_ipc_kernel_read(struct ccci_port *port);
  97. #endif /* __PORT_IPC_H__ */