You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

377 lines
14 KiB

2 years ago
  1. /*===========================================================================
  2. M P Q C T L. H
  3. DESCRIPTION:
  4. This module contains QMI QCTL module.
  5. INITIALIZATION AND SEQUENCING REQUIREMENTS:
  6. Copyright (C) 2011 by Qualcomm Technologies, Incorporated. All Rights Reserved.
  7. ===========================================================================*/
  8. #ifndef MPQCTL_H
  9. #define MPQCTL_H
  10. #include "MPQMI.h"
  11. #pragma pack(push, 1)
  12. // ================= QMICTL ==================
  13. // QMICTL Control Flags
  14. #define QMICTL_CTL_FLAG_CMD 0x00
  15. #define QMICTL_CTL_FLAG_RSP 0x01
  16. #define QMICTL_CTL_FLAG_IND 0x02
  17. #if 0
  18. typedef struct _QMICTL_TRANSACTION_ITEM
  19. {
  20. LIST_ENTRY List;
  21. UCHAR TransactionId; // QMICTL transaction id
  22. PVOID Context; // Adapter or IocDev
  23. PIRP Irp;
  24. } QMICTL_TRANSACTION_ITEM, *PQMICTL_TRANSACTION_ITEM;
  25. #endif
  26. typedef struct _QCQMICTL_MSG_HDR
  27. {
  28. UCHAR CtlFlags; // 00-cmd, 01-rsp, 10-ind
  29. UCHAR TransactionId;
  30. USHORT QMICTLType;
  31. USHORT Length;
  32. } __attribute__ ((packed)) QCQMICTL_MSG_HDR, *PQCQMICTL_MSG_HDR;
  33. #define QCQMICTL_MSG_HDR_SIZE sizeof(QCQMICTL_MSG_HDR)
  34. typedef struct _QCQMICTL_MSG_HDR_RESP
  35. {
  36. UCHAR CtlFlags; // 00-cmd, 01-rsp, 10-ind
  37. UCHAR TransactionId;
  38. USHORT QMICTLType;
  39. USHORT Length;
  40. UCHAR TLVType; // 0x02 - result code
  41. USHORT TLVLength; // 4
  42. USHORT QMUXResult; // QMI_RESULT_SUCCESS
  43. // QMI_RESULT_FAILURE
  44. USHORT QMUXError; // QMI_ERR_INVALID_ARG
  45. // QMI_ERR_NO_MEMORY
  46. // QMI_ERR_INTERNAL
  47. // QMI_ERR_FAULT
  48. } __attribute__ ((packed)) QCQMICTL_MSG_HDR_RESP, *PQCQMICTL_MSG_HDR_RESP;
  49. typedef struct _QCQMICTL_MSG
  50. {
  51. UCHAR CtlFlags; // 00-cmd, 01-rsp, 10-ind
  52. UCHAR TransactionId;
  53. USHORT QMICTLType;
  54. USHORT Length;
  55. UCHAR Payload;
  56. } __attribute__ ((packed)) QCQMICTL_MSG, *PQCQMICTL_MSG;
  57. // TLV Header
  58. typedef struct _QCQMICTL_TLV_HDR
  59. {
  60. UCHAR TLVType;
  61. USHORT TLVLength;
  62. } __attribute__ ((packed)) QCQMICTL_TLV_HDR, *PQCQMICTL_TLV_HDR;
  63. #define QCQMICTL_TLV_HDR_SIZE sizeof(QCQMICTL_TLV_HDR)
  64. // QMICTL Type
  65. #define QMICTL_SET_INSTANCE_ID_REQ 0x0020
  66. #define QMICTL_SET_INSTANCE_ID_RESP 0x0020
  67. #define QMICTL_GET_VERSION_REQ 0x0021
  68. #define QMICTL_GET_VERSION_RESP 0x0021
  69. #define QMICTL_GET_CLIENT_ID_REQ 0x0022
  70. #define QMICTL_GET_CLIENT_ID_RESP 0x0022
  71. #define QMICTL_RELEASE_CLIENT_ID_REQ 0x0023
  72. #define QMICTL_RELEASE_CLIENT_ID_RESP 0x0023
  73. #define QMICTL_REVOKE_CLIENT_ID_IND 0x0024
  74. #define QMICTL_INVALID_CLIENT_ID_IND 0x0025
  75. #define QMICTL_SET_DATA_FORMAT_REQ 0x0026
  76. #define QMICTL_SET_DATA_FORMAT_RESP 0x0026
  77. #define QMICTL_SYNC_REQ 0x0027
  78. #define QMICTL_SYNC_RESP 0x0027
  79. #define QMICTL_SYNC_IND 0x0027
  80. #define QMICTL_FLAG_REQUEST 0x00
  81. #define QMICTL_FLAG_RESPONSE 0x01
  82. #define QMICTL_FLAG_INDICATION 0x02
  83. // QMICTL Message Definitions
  84. typedef struct _QMICTL_SET_INSTANCE_ID_REQ_MSG
  85. {
  86. UCHAR CtlFlags; // QMICTL_FLAG_REQUEST
  87. UCHAR TransactionId;
  88. USHORT QMICTLType; // QMICTL_SET_INSTANCE_ID_REQ
  89. USHORT Length; // 4
  90. UCHAR TLVType; // QCTLV_TYPE_REQUIRED_PARAMETER
  91. USHORT TLVLength; // 1
  92. UCHAR Value; // Host-unique QMI instance for this device driver
  93. } __attribute__ ((packed)) QMICTL_SET_INSTANCE_ID_REQ_MSG, *PQMICTL_SET_INSTANCE_ID_REQ_MSG;
  94. typedef struct _QMICTL_SET_INSTANCE_ID_RESP_MSG
  95. {
  96. UCHAR CtlFlags; // QMICTL_FLAG_RESPONSE
  97. UCHAR TransactionId;
  98. USHORT QMICTLType; // QMICTL_SET_INSTANCE_ID_RESP
  99. USHORT Length;
  100. UCHAR TLVType; // QCTLV_TYPE_RESULT_CODE
  101. USHORT TLVLength; // 0x0004
  102. USHORT QMIResult;
  103. USHORT QMIError;
  104. UCHAR TLV2Type; // QCTLV_TYPE_REQUIRED_PARAMETER
  105. USHORT TLV2Length; // 0x0002
  106. USHORT QMI_ID; // Upper byte is assigned by MSM,
  107. // lower assigned by host
  108. } __attribute__ ((packed)) QMICTL_SET_INSTANCE_ID_RESP_MSG, *PQMICTL_SET_INSTANCE_ID_RESP_MSG;
  109. typedef struct _QMICTL_GET_VERSION_REQ_MSG
  110. {
  111. UCHAR CtlFlags; // QMICTL_FLAG_REQUEST
  112. UCHAR TransactionId;
  113. USHORT QMICTLType; // QMICTL_GET_VERSION_REQ
  114. USHORT Length; // 0
  115. UCHAR TLVType; // QCTLV_TYPE_REQUIRED_PARAMETER
  116. USHORT TLVLength; // var
  117. UCHAR QMUXTypes; // List of one byte QMUX_TYPE values
  118. // 0xFF returns a list of versions for all
  119. // QMUX_TYPEs implemented on the device
  120. } __attribute__ ((packed)) QMICTL_GET_VERSION_REQ_MSG, *PQMICTL_GET_VERSION_REQ_MSG;
  121. typedef struct _QMUX_TYPE_VERSION_STRUCT
  122. {
  123. UCHAR QMUXType;
  124. USHORT MajorVersion;
  125. USHORT MinorVersion;
  126. } __attribute__ ((packed)) QMUX_TYPE_VERSION_STRUCT, *PQMUX_TYPE_VERSION_STRUCT;
  127. typedef struct _ADDENDUM_VERSION_PREAMBLE
  128. {
  129. UCHAR LabelLength;
  130. UCHAR Label;
  131. } __attribute__ ((packed)) ADDENDUM_VERSION_PREAMBLE, *PADDENDUM_VERSION_PREAMBLE;
  132. #define QMICTL_GET_VERSION_RSP_TLV_TYPE_VERSION 0x01
  133. #define QMICTL_GET_VERSION_RSP_TLV_TYPE_ADD_VERSION 0x10
  134. typedef struct _QMICTL_GET_VERSION_RESP_MSG
  135. {
  136. UCHAR CtlFlags; // QMICTL_FLAG_RESPONSE
  137. UCHAR TransactionId;
  138. USHORT QMICTLType; // QMICTL_GET_VERSION_RESP
  139. USHORT Length;
  140. UCHAR TLVType; // QCTLV_TYPE_RESULT_CODE
  141. USHORT TLVLength; // 0x0004
  142. USHORT QMIResult;
  143. USHORT QMIError;
  144. UCHAR TLV2Type; // QCTLV_TYPE_REQUIRED_PARAMETER
  145. USHORT TLV2Length; // var
  146. UCHAR NumElements; // Num of QMUX_TYPE_VERSION_STRUCT
  147. QMUX_TYPE_VERSION_STRUCT TypeVersion[0];
  148. } __attribute__ ((packed)) QMICTL_GET_VERSION_RESP_MSG, *PQMICTL_GET_VERSION_RESP_MSG;
  149. typedef struct _QMICTL_GET_CLIENT_ID_REQ_MSG
  150. {
  151. UCHAR CtlFlags; // QMICTL_FLAG_REQUEST
  152. UCHAR TransactionId;
  153. USHORT QMICTLType; // QMICTL_GET_CLIENT_ID_REQ
  154. USHORT Length;
  155. UCHAR TLVType; // QCTLV_TYPE_REQUIRED_PARAMETER
  156. USHORT TLVLength; // 1
  157. UCHAR QMIType; // QMUX type
  158. } __attribute__ ((packed)) QMICTL_GET_CLIENT_ID_REQ_MSG, *PQMICTL_GET_CLIENT_ID_REQ_MSG;
  159. typedef struct _QMICTL_GET_CLIENT_ID_RESP_MSG
  160. {
  161. UCHAR CtlFlags; // QMICTL_FLAG_RESPONSE
  162. UCHAR TransactionId;
  163. USHORT QMICTLType; // QMICTL_GET_CLIENT_ID_RESP
  164. USHORT Length;
  165. UCHAR TLVType; // QCTLV_TYPE_RESULT_CODE
  166. USHORT TLVLength; // 0x0004
  167. USHORT QMIResult; // result code
  168. USHORT QMIError; // error code
  169. UCHAR TLV2Type; // QCTLV_TYPE_REQUIRED_PARAMETER
  170. USHORT TLV2Length; // 2
  171. UCHAR QMIType;
  172. UCHAR ClientId;
  173. } __attribute__ ((packed)) QMICTL_GET_CLIENT_ID_RESP_MSG, *PQMICTL_GET_CLIENT_ID_RESP_MSG;
  174. typedef struct _QMICTL_RELEASE_CLIENT_ID_REQ_MSG
  175. {
  176. UCHAR CtlFlags; // QMICTL_FLAG_REQUEST
  177. UCHAR TransactionId;
  178. USHORT QMICTLType; // QMICTL_RELEASE_CLIENT_ID_REQ
  179. USHORT Length;
  180. UCHAR TLVType; // QCTLV_TYPE_REQUIRED_PARAMETER
  181. USHORT TLVLength; // 0x0002
  182. UCHAR QMIType;
  183. UCHAR ClientId;
  184. } __attribute__ ((packed)) QMICTL_RELEASE_CLIENT_ID_REQ_MSG, *PQMICTL_RELEASE_CLIENT_ID_REQ_MSG;
  185. typedef struct _QMICTL_RELEASE_CLIENT_ID_RESP_MSG
  186. {
  187. UCHAR CtlFlags; // QMICTL_FLAG_RESPONSE
  188. UCHAR TransactionId;
  189. USHORT QMICTLType; // QMICTL_RELEASE_CLIENT_ID_RESP
  190. USHORT Length;
  191. UCHAR TLVType; // QCTLV_TYPE_RESULT_CODE
  192. USHORT TLVLength; // 0x0004
  193. USHORT QMIResult; // result code
  194. USHORT QMIError; // error code
  195. UCHAR TLV2Type; // QCTLV_TYPE_REQUIRED_PARAMETER
  196. USHORT TLV2Length; // 2
  197. UCHAR QMIType;
  198. UCHAR ClientId;
  199. } __attribute__ ((packed)) QMICTL_RELEASE_CLIENT_ID_RESP_MSG, *PQMICTL_RELEASE_CLIENT_ID_RESP_MSG;
  200. typedef struct _QMICTL_REVOKE_CLIENT_ID_IND_MSG
  201. {
  202. UCHAR CtlFlags; // QMICTL_FLAG_INDICATION
  203. UCHAR TransactionId;
  204. USHORT QMICTLType; // QMICTL_REVOKE_CLIENT_ID_IND
  205. USHORT Length;
  206. UCHAR TLVType; // QCTLV_TYPE_REQUIRED_PARAMETER
  207. USHORT TLVLength; // 0x0002
  208. UCHAR QMIType;
  209. UCHAR ClientId;
  210. } __attribute__ ((packed)) QMICTL_REVOKE_CLIENT_ID_IND_MSG, *PQMICTL_REVOKE_CLIENT_ID_IND_MSG;
  211. typedef struct _QMICTL_INVALID_CLIENT_ID_IND_MSG
  212. {
  213. UCHAR CtlFlags; // QMICTL_FLAG_INDICATION
  214. UCHAR TransactionId;
  215. USHORT QMICTLType; // QMICTL_REVOKE_CLIENT_ID_IND
  216. USHORT Length;
  217. UCHAR TLVType; // QCTLV_TYPE_REQUIRED_PARAMETER
  218. USHORT TLVLength; // 0x0002
  219. UCHAR QMIType;
  220. UCHAR ClientId;
  221. } __attribute__ ((packed)) QMICTL_INVALID_CLIENT_ID_IND_MSG, *PQMICTL_INVALID_CLIENT_ID_IND_MSG;
  222. typedef struct _QMICTL_SET_DATA_FORMAT_REQ_MSG
  223. {
  224. UCHAR CtlFlags; // QMICTL_FLAG_REQUEST
  225. UCHAR TransactionId;
  226. USHORT QMICTLType; // QMICTL_SET_DATA_FORMAT_REQ
  227. USHORT Length;
  228. UCHAR TLVType; // QCTLV_TYPE_REQUIRED_PARAMETER
  229. USHORT TLVLength; // 1
  230. UCHAR DataFormat; // 0-default; 1-QoS hdr present
  231. } __attribute__ ((packed)) QMICTL_SET_DATA_FORMAT_REQ_MSG, *PQMICTL_SET_DATA_FORMAT_REQ_MSG;
  232. #ifdef QC_IP_MODE
  233. #define SET_DATA_FORMAT_TLV_TYPE_LINK_PROTO 0x10
  234. #define SET_DATA_FORMAT_LINK_PROTO_ETH 0x0001
  235. #define SET_DATA_FORMAT_LINK_PROTO_IP 0x0002
  236. typedef struct _QMICTL_SET_DATA_FORMAT_TLV_LINK_PROT
  237. {
  238. UCHAR TLVType; // Link-Layer Protocol
  239. USHORT TLVLength; // 2
  240. USHORT LinkProt; // 0x1: ETH; 0x2: IP
  241. } QMICTL_SET_DATA_FORMAT_TLV_LINK_PROT, *PQMICTL_SET_DATA_FORMAT_TLV_LINK_PROT;
  242. #ifdef QCMP_UL_TLP
  243. #define SET_DATA_FORMAT_TLV_TYPE_UL_TLP 0x11
  244. typedef struct _QMICTL_SET_DATA_FORMAT_TLV_UL_TLP
  245. {
  246. UCHAR TLVType; // 0x11, Uplink TLP Setting
  247. USHORT TLVLength; // 1
  248. UCHAR UlTlpSetting; // 0x0: Disable; 0x01: Enable
  249. } QMICTL_SET_DATA_FORMAT_TLV_UL_TLP, *PQMICTL_SET_DATA_FORMAT_TLV_UL_TLP;
  250. #endif // QCMP_UL_TLP
  251. #ifdef QCMP_DL_TLP
  252. #define SET_DATA_FORMAT_TLV_TYPE_DL_TLP 0x13
  253. typedef struct _QMICTL_SET_DATA_FORMAT_TLV_DL_TLP
  254. {
  255. UCHAR TLVType; // 0x11, Uplink TLP Setting
  256. USHORT TLVLength; // 1
  257. UCHAR DlTlpSetting; // 0x0: Disable; 0x01: Enable
  258. } QMICTL_SET_DATA_FORMAT_TLV_DL_TLP, *PQMICTL_SET_DATA_FORMAT_TLV_DL_TLP;
  259. #endif // QCMP_DL_TLP
  260. #endif // QC_IP_MODE
  261. #ifdef MP_QCQOS_ENABLED
  262. #define SET_DATA_FORMAT_TLV_TYPE_QOS_SETTING 0x12
  263. typedef struct _QMICTL_SET_DATA_FORMAT_TLV_QOS_SETTING
  264. {
  265. UCHAR TLVType; // 0x12, QoS setting
  266. USHORT TLVLength; // 1
  267. UCHAR QosSetting; // 0x0: Disable; 0x01: Enable
  268. } QMICTL_SET_DATA_FORMAT_TLV_QOS_SETTING, *PQMICTL_SET_DATA_FORMAT_TLV_QOS_SETTING;
  269. #endif // MP_QCQOS_ENABLED
  270. typedef struct _QMICTL_SET_DATA_FORMAT_RESP_MSG
  271. {
  272. UCHAR CtlFlags; // QMICTL_FLAG_RESPONSE
  273. UCHAR TransactionId;
  274. USHORT QMICTLType; // QMICTL_SET_DATA_FORMAT_RESP
  275. USHORT Length;
  276. UCHAR TLVType; // QCTLV_TYPE_RESULT_CODE
  277. USHORT TLVLength; // 0x0004
  278. USHORT QMIResult; // result code
  279. USHORT QMIError; // error code
  280. } __attribute__ ((packed)) QMICTL_SET_DATA_FORMAT_RESP_MSG, *PQMICTL_SET_DATA_FORMAT_RESP_MSG;
  281. typedef struct _QMICTL_SYNC_REQ_MSG
  282. {
  283. UCHAR CtlFlags; // QMICTL_FLAG_REQUEST
  284. UCHAR TransactionId;
  285. USHORT QMICTLType; // QMICTL_CTL_SYNC_REQ
  286. USHORT Length; // 0
  287. } __attribute__ ((packed)) QMICTL_SYNC_REQ_MSG, *PQMICTL_SYNC_REQ_MSG;
  288. typedef struct _QMICTL_SYNC_RESP_MSG
  289. {
  290. UCHAR CtlFlags; // QMICTL_FLAG_RESPONSE
  291. UCHAR TransactionId;
  292. USHORT QMICTLType; // QMICTL_CTL_SYNC_RESP
  293. USHORT Length;
  294. UCHAR TLVType; // QCTLV_TYPE_RESULT_CODE
  295. USHORT TLVLength; // 0x0004
  296. USHORT QMIResult;
  297. USHORT QMIError;
  298. } __attribute__ ((packed)) QMICTL_SYNC_RESP_MSG, *PQMICTL_SYNC_RESP_MSG;
  299. typedef struct _QMICTL_SYNC_IND_MSG
  300. {
  301. UCHAR CtlFlags; // QMICTL_FLAG_INDICATION
  302. UCHAR TransactionId;
  303. USHORT QMICTLType; // QMICTL_REVOKE_CLIENT_ID_IND
  304. USHORT Length;
  305. } __attribute__ ((packed)) QMICTL_SYNC_IND_MSG, *PQMICTL_SYNC_IND_MSG;
  306. typedef struct _QMICTL_MSG
  307. {
  308. union
  309. {
  310. // Message Header
  311. QCQMICTL_MSG_HDR QMICTLMsgHdr;
  312. QCQMICTL_MSG_HDR_RESP QMICTLMsgHdrRsp;
  313. // QMICTL Message
  314. QMICTL_SET_INSTANCE_ID_REQ_MSG SetInstanceIdReq;
  315. QMICTL_SET_INSTANCE_ID_RESP_MSG SetInstanceIdRsp;
  316. QMICTL_GET_VERSION_REQ_MSG GetVersionReq;
  317. QMICTL_GET_VERSION_RESP_MSG GetVersionRsp;
  318. QMICTL_GET_CLIENT_ID_REQ_MSG GetClientIdReq;
  319. QMICTL_GET_CLIENT_ID_RESP_MSG GetClientIdRsp;
  320. QMICTL_RELEASE_CLIENT_ID_REQ_MSG ReleaseClientIdReq;
  321. QMICTL_RELEASE_CLIENT_ID_RESP_MSG ReleaseClientIdRsp;
  322. QMICTL_REVOKE_CLIENT_ID_IND_MSG RevokeClientIdInd;
  323. QMICTL_INVALID_CLIENT_ID_IND_MSG InvalidClientIdInd;
  324. QMICTL_SET_DATA_FORMAT_REQ_MSG SetDataFormatReq;
  325. QMICTL_SET_DATA_FORMAT_RESP_MSG SetDataFormatRsp;
  326. QMICTL_SYNC_REQ_MSG SyncReq;
  327. QMICTL_SYNC_RESP_MSG SyncRsp;
  328. QMICTL_SYNC_IND_MSG SyncInd;
  329. };
  330. } __attribute__ ((packed)) QMICTL_MSG, *PQMICTL_MSG;
  331. #pragma pack(pop)
  332. #endif // MPQCTL_H