xhci.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. #pragma once
  2. #include <driver/usb/usb.h>
  3. #include <driver/pci/pci.h>
  4. #include <driver/pci/msi.h>
  5. // #pragma GCC optimize("O0")
  6. #define XHCI_MAX_HOST_CONTROLLERS 4 // 本驱动程序最大支持4个xhci root hub controller
  7. #define XHCI_MAX_ROOT_HUB_PORTS 128 // 本驱动程序最大支持127个root hub 端口(第0个保留)
  8. // ========== irq BEGIN ===========
  9. #define XHCI_IRQ_DONE (1<<31) // 当command trb 的status的第31位被驱动程序置位时,表明该trb已经执行完成(这是由于xhci规定,第31位可以由驱动程序自行决定用途)
  10. /**
  11. * @brief 每个xhci控制器的中断向量号
  12. *
  13. */
  14. const uint8_t xhci_controller_irq_num[XHCI_MAX_HOST_CONTROLLERS] = {157, 158, 159, 160};
  15. /**
  16. * @brief 通过irq号寻找对应的主机控制器id
  17. *
  18. */
  19. #define xhci_find_hcid_by_irq_num(irq_num) ({ \
  20. int retval = -1; \
  21. for (int i = 0; i < XHCI_MAX_HOST_CONTROLLERS; ++i) \
  22. if (xhci_controller_irq_num[i] == irq_num) \
  23. retval = i; \
  24. retval; \
  25. })
  26. struct xhci_hc_irq_install_info_t
  27. {
  28. int processor; // 中断目标处理器
  29. int8_t edge_trigger; // 是否边缘触发
  30. int8_t assert; // 是否高电平触发
  31. };
  32. // ========== irq END ===========
  33. // ======== Capability Register Set BEGIN ============
  34. // xhci Capability Registers offset
  35. #define XHCI_CAPS_CAPLENGTH 0x00 // Cap 寄存器组的长度
  36. #define XHCI_CAPS_RESERVED 0x01
  37. #define XHCI_CAPS_HCIVERSION 0x02 // 接口版本号
  38. #define XHCI_CAPS_HCSPARAMS1 0x04
  39. #define XHCI_CAPS_HCSPARAMS2 0x08
  40. #define XHCI_CAPS_HCSPARAMS3 0x0c
  41. #define XHCI_CAPS_HCCPARAMS1 0x10 // capability params 1
  42. #define XHCI_CAPS_DBOFF 0x14 // Doorbell offset
  43. #define XHCI_CAPS_RTSOFF 0x18 // Runtime register space offset
  44. #define XHCI_CAPS_HCCPARAMS2 0x1c // capability params 2
  45. struct xhci_caps_HCSPARAMS1_reg_t
  46. {
  47. unsigned max_slots : 8; // 最大插槽数
  48. unsigned max_intrs : 11; // 最大中断数
  49. unsigned reserved : 5;
  50. unsigned max_ports : 8; // 最大端口数
  51. } __attribute__((packed));
  52. struct xhci_caps_HCSPARAMS2_reg_t
  53. {
  54. unsigned ist : 4; // 同步调度阈值
  55. unsigned ERST_Max : 4; // Event Ring Segment Table: Max segs
  56. unsigned Reserved : 13;
  57. unsigned max_scratchpad_buf_HI5 : 5; // 草稿行buffer地址(高5bit)
  58. unsigned spr : 1; // scratchpad restore
  59. unsigned max_scratchpad_buf_LO5 : 5; // 草稿行buffer地址(低5bit)
  60. } __attribute__((packed));
  61. struct xhci_caps_HCSPARAMS3_reg_t
  62. {
  63. uint8_t u1_device_exit_latency; // 0~10ms
  64. uint8_t Reserved;
  65. uint16_t u2_device_exit_latency; // 0~2047ms
  66. } __attribute__((packed));
  67. struct xhci_caps_HCCPARAMS1_reg_t
  68. {
  69. unsigned int ac64 : 1; // 64-bit addressing capability
  70. unsigned int bnc : 1; // bw negotiation capability
  71. unsigned int csz : 1; // context size
  72. unsigned int ppc : 1; // 端口电源控制
  73. unsigned int pind : 1; // port indicators
  74. unsigned int lhrc : 1; // Light HC reset capability
  75. unsigned int ltc : 1; // latency tolerance messaging capability
  76. unsigned int nss : 1; // no secondary SID support
  77. unsigned int pae : 1; // parse all event data
  78. unsigned int spc : 1; // Stopped - Short packet capability
  79. unsigned int sec : 1; // Stopped EDTLA capability
  80. unsigned int cfc : 1; // Continuous Frame ID capability
  81. unsigned int MaxPSASize : 4; // Max Primary Stream Array Size
  82. uint16_t xECP; // xhci extended capabilities pointer
  83. } __attribute__((packed));
  84. struct xhci_caps_HCCPARAMS2_reg_t
  85. {
  86. unsigned u3c : 1; // U3 Entry Capability
  87. unsigned cmc : 1; // ConfigEP command Max exit latency too large
  88. unsigned fsc : 1; // Force Save Context Capability
  89. unsigned ctc : 1; // Compliance Transition Capability
  90. unsigned lec : 1; // large ESIT payload capability
  91. unsigned cic : 1; // configuration information capability
  92. unsigned Reserved : 26;
  93. } __attribute__((packed));
  94. // ======== Capability Register Set END ============
  95. // ======== Operational Register Set BEGIN =========
  96. // xhci operational registers offset
  97. #define XHCI_OPS_USBCMD 0x00 // USB Command
  98. #define XHCI_OPS_USBSTS 0x04 // USB status
  99. #define XHCI_OPS_PAGESIZE 0x08 // Page size
  100. #define XHCI_OPS_DNCTRL 0x14 // Device notification control
  101. #define XHCI_OPS_CRCR 0x18 // Command ring control
  102. #define XHCI_OPS_DCBAAP 0x30 // Device context base address array pointer
  103. #define XHCI_OPS_CONFIG 0x38 // configuire
  104. #define XHCI_OPS_PRS 0x400 // Port register sets
  105. struct xhci_ops_usbcmd_reg_t
  106. {
  107. unsigned rs : 1; // Run/Stop
  108. unsigned hcrst : 1; // host controller reset
  109. unsigned inte : 1; // Interrupt enable
  110. unsigned hsee : 1; // Host system error enable
  111. unsigned rsvd_psvd1 : 3; // Reserved and preserved
  112. unsigned lhcrst : 1; // light host controller reset
  113. unsigned css : 1; // controller save state
  114. unsigned crs : 1; // controller restore state
  115. unsigned ewe : 1; // enable wrap event
  116. unsigned ue3s : 1; // enable U3 MFINDEX Stop
  117. unsigned spe : 1; // stopped short packet enable
  118. unsigned cme : 1; // CEM Enable
  119. unsigned rsvd_psvd2 : 18; // Reserved and preserved
  120. } __attribute__((packed));
  121. struct xhci_ops_usbsts_reg_t
  122. {
  123. unsigned HCHalted : 1;
  124. unsigned rsvd_psvd1 : 1; // Reserved and preserved
  125. unsigned hse : 1; // Host system error
  126. unsigned eint : 1; // event interrupt
  127. unsigned pcd : 1; // Port change detected
  128. unsigned rsvd_zerod : 3; // Reserved and Zero'd
  129. unsigned sss : 1; // Save State Status
  130. unsigned rss : 1; // restore state status
  131. unsigned sre : 1; // save/restore error
  132. unsigned cnr : 1; // controller not ready
  133. unsigned hce : 1; // host controller error
  134. unsigned rsvd_psvd2 : 19; // Reserved and Preserved
  135. } __attribute__((packed));
  136. struct xhci_ops_pagesize_reg_t
  137. {
  138. uint16_t page_size; // The actual pagesize is ((this field)<<12)
  139. uint16_t reserved;
  140. } __attribute__((packed));
  141. struct xhci_ops_dnctrl_reg_t
  142. {
  143. uint16_t value;
  144. uint16_t reserved;
  145. } __attribute__((packed));
  146. struct xhci_ops_config_reg_t
  147. {
  148. uint8_t MaxSlotsEn; // Max slots enabled
  149. unsigned u3e : 1; // U3 Entry Enable
  150. unsigned cie : 1; // Configuration information enable
  151. unsigned rsvd_psvd : 22; // Reserved and Preserved
  152. } __attribute__((packed));
  153. // ======== Operational Register Set END =========
  154. // ========= TRB begin ===========
  155. // TRB的Transfer Type可用值定义
  156. #define XHCI_TRB_TRT_NO_DATA 0
  157. #define XHCI_TRB_TRT_RESERVED 1
  158. #define XHCI_TRB_TRT_OUT_DATA 2
  159. #define XHCI_TRB_TRT_IN_DATA 3
  160. #define XHCI_CMND_RING_TRBS 128 // TRB num of command ring, not more than 4096
  161. #define XHCI_TRBS_PER_RING 256
  162. #define XHCI_TRB_CYCLE_OFF 0
  163. #define XHCI_TRB_CYCLE_ON 1
  164. /**
  165. * @brief xhci通用TRB结构
  166. *
  167. */
  168. struct xhci_TRB_t
  169. {
  170. uint64_t param; // 参数
  171. uint32_t status;
  172. uint32_t command;
  173. } __attribute__((packed));
  174. struct xhci_TRB_normal_t
  175. {
  176. uint64_t buf_paddr; // 数据缓冲区物理地址
  177. unsigned transfer_length : 17; // 传输数据长度
  178. unsigned TD_size : 5; // 传输描述符中剩余的数据包的数量
  179. unsigned intr_target : 10; // 中断目标 [0:MaxIntrs-1]
  180. unsigned cycle : 1; // used to mark the enqueue pointer of transfer ring
  181. unsigned ent : 1; // evaluate next TRB before updating the endpoint's state
  182. unsigned isp : 1; // Interrupt on short packet bit
  183. unsigned ns : 1; // No snoop
  184. unsigned chain : 1; // The chain bit is used to tell the controller that this
  185. // TRB is associated with the next TRB in the TD
  186. unsigned ioc : 1; // 完成时发起中断
  187. unsigned idt : 1; // Immediate Data
  188. unsigned resv : 2; // Reserved and zero'd
  189. unsigned bei : 1; // Block event interrupt
  190. unsigned TRB_type : 6; // TRB类型
  191. uint16_t Reserved; // 保留且置为0
  192. } __attribute__((packed));
  193. struct xhci_TRB_setup_state_t
  194. {
  195. uint8_t bmRequestType;
  196. uint8_t bRequest;
  197. uint16_t wValue;
  198. uint16_t wIndex;
  199. uint16_t wLength;
  200. unsigned transfer_legth : 17;
  201. unsigned resv1 : 5; // Reserved and zero'd
  202. unsigned intr_target : 10;
  203. unsigned cycle : 1;
  204. unsigned resv2 : 4; // Reserved and zero'd
  205. unsigned ioc : 1;
  206. unsigned idt : 1;
  207. unsigned resv3 : 3; // Reserved and zero'd
  208. unsigned TRB_type : 6;
  209. unsigned trt : 2; // Transfer type
  210. unsigned resv4 : 14; // Reserved and zero'd
  211. } __attribute__((packed));
  212. struct xhci_TRB_data_stage_t
  213. {
  214. uint64_t buf_paddr; // 数据缓冲区物理地址
  215. unsigned transfer_length : 17; // 传输数据长度
  216. unsigned TD_size : 5; // 传输描述符中剩余的数据包的数量
  217. unsigned intr_target : 10; // 中断目标 [0:MaxIntrs-1]
  218. unsigned cycle : 1; // used to mark the enqueue pointer of transfer ring
  219. unsigned ent : 1; // evaluate next TRB before updating the endpoint's state
  220. unsigned isp : 1; // Interrupt on short packet bit
  221. unsigned ns : 1; // No snoop
  222. unsigned chain : 1; // The chain bit is used to tell the controller that this
  223. // TRB is associated with the next TRB in the TD
  224. unsigned ioc : 1; // 完成时发起中断
  225. unsigned idt : 1; // Immediate Data
  226. unsigned resv : 3; // Reserved and zero'd
  227. unsigned TRB_type : 6; // TRB类型
  228. unsigned dir : 1; // 0 -> out packet
  229. // 1 -> in packet
  230. unsigned Reserved : 15; // 保留且置为0
  231. } __attribute__((packed));
  232. struct xhci_TRB_status_stage_t
  233. {
  234. uint64_t resv1; // Reserved and zero'd
  235. unsigned resv2 : 22; // Reserved and zero'd
  236. unsigned intr_target : 10; // 中断目标 [0:MaxIntrs-1]
  237. unsigned cycle : 1; // used to mark the enqueue pointer of transfer ring
  238. unsigned ent : 1; // evaluate next TRB before updating the endpoint's state
  239. unsigned resv3 : 2; // Reserved and zero'd
  240. unsigned chain : 1; // The chain bit is used to tell the controller that this
  241. // TRB is associated with the next TRB in the TD
  242. unsigned ioc : 1; // 完成时发起中断
  243. unsigned resv4 : 4; // Reserved and zero'd
  244. unsigned TRB_type : 6; // TRB类型
  245. unsigned dir : 1; // 0 -> out packet
  246. // 1 -> in packet
  247. unsigned Reserved : 15; // 保留且置为0
  248. } __attribute__((packed));
  249. struct xhci_TRB_cmd_complete_t
  250. {
  251. uint64_t cmd_trb_pointer_paddr; // 指向生成当前Event TRB的TRB的物理地址(16bytes对齐)
  252. unsigned resv1 : 24; // Reserved and zero'd
  253. uint8_t code; // Completion code
  254. unsigned cycle : 1; // cycle bit
  255. unsigned resv2 : 9; // Reserved and zero'd
  256. unsigned TRB_type : 6; // TRB类型
  257. uint8_t VF_ID;
  258. uint8_t slot_id; // the id of the slot associated with the
  259. // command that generated the event
  260. } __attribute__((packed));
  261. // ========= TRB end ===========
  262. // ======== Runtime Register Set Begin =========
  263. #define XHCI_RT_IR0 0x20 // 中断寄存器组0距离runtime Register set起始位置的偏移量
  264. #define XHCI_IR_SIZE 32 // 中断寄存器组大小
  265. // 中断寄存器组内的偏移量
  266. #define XHCI_IR_MAN 0x00 // Interrupter Management Register
  267. #define XHCI_IR_MOD 0x04 // Interrupter Moderation
  268. #define XHCI_IR_TABLE_SIZE 0x08 // Event Ring Segment Table size (count of segments)
  269. #define XHCI_IR_TABLE_ADDR 0x10 // Event Ring Segment Table Base Address
  270. #define XHCI_IR_DEQUEUE 0x18 // Event Ring Dequeue Pointer
  271. // MAN寄存器内的bit的含义
  272. #define XHCI_IR_IMR_PENDING (1 << 0) // Interrupt pending bit in Management Register
  273. #define XHCI_IR_IMR_ENABLE (1 << 1) // Interrupt enable bit in Management Register
  274. struct xhci_intr_moderation_t
  275. {
  276. uint16_t interval; // 产生一个中断的时间,是interval*250ns (wait before next interrupt)
  277. uint16_t counter;
  278. } __attribute__((packed));
  279. // ======== Runtime Register Set END =========
  280. // ======= xhci Extended Capabilities List BEGIN========
  281. // ID 部分的含义定义
  282. #define XHCI_XECP_ID_RESERVED 0
  283. #define XHCI_XECP_ID_LEGACY 1 // USB Legacy Support
  284. #define XHCI_XECP_ID_PROTOCOL 2 // Supported protocol
  285. #define XHCI_XECP_ID_POWER 3 // Extended power management
  286. #define XHCI_XECP_ID_IOVIRT 4 // I/0 virtualization
  287. #define XHCI_XECP_ID_MSG 5 // Message interrupt
  288. #define XHCI_XECP_ID_LOCAL_MEM 6 // local memory
  289. #define XHCI_XECP_ID_DEBUG 10 // USB Debug capability
  290. #define XHCI_XECP_ID_EXTMSG 17 // Extended message interrupt
  291. #define XHCI_XECP_LEGACY_TIMEOUT 10 // 设置legacy状态的等待时间
  292. #define XHCI_XECP_LEGACY_BIOS_OWNED (1 << 16) // 当bios控制着该hc时,该位被置位
  293. #define XHCI_XECP_LEGACY_OS_OWNED (1 << 24) // 当系统控制着该hc时,该位被置位
  294. #define XHCI_XECP_LEGACY_OWNING_MASK (XHCI_XECP_LEGACY_BIOS_OWNED | XHCI_XECP_LEGACY_OS_OWNED)
  295. // ======= xhci Extended Capabilities List END ========
  296. // ======= Port status and control registers BEGIN ====
  297. #define XHCI_PORT_PORTSC 0x00 // Port status and control
  298. #define XHCI_PORT_PORTPMSC 0x04 // Port power management status and control
  299. #define XHCI_PORT_PORTLI 0x08 // Port Link info
  300. #define XHCI_PORT_PORTHLMPC 0x0c // Port hardware LPM control (version 1.10 only
  301. #define XHCI_PORTUSB_CHANGE_BITS ((1 << 17) | (1 << 18) | (1 << 20) | (1 << 21) | (1 << 22))
  302. // ======= Port status and control registers END ====
  303. // 端口信息标志位
  304. #define XHCI_PROTOCOL_USB2 0
  305. #define XHCI_PROTOCOL_USB3 1
  306. #define XHCI_PROTOCOL_INFO (1 << 0) // 1->usb3, 0->usb2
  307. #define XHCI_PROTOCOL_HSO (1 << 1) // 1-> usb2 high speed only
  308. #define XHCI_PROTOCOL_HAS_PAIR (1 << 2) // 当前位被置位,意味着当前端口具有一个与之配对的端口
  309. #define XHCI_PROTOCOL_ACTIVE (1 << 3) // 当前端口是这个配对中,被激活的端口
  310. /**
  311. * @brief xhci端口信息
  312. *
  313. */
  314. struct xhci_port_info_t
  315. {
  316. uint8_t flags; // port flags
  317. uint8_t paired_port_num; // 与当前端口所配对的另一个端口(相同物理接口的不同速度的port)
  318. uint8_t offset; // offset of this port within this protocal
  319. uint8_t reserved;
  320. } __attribute__((packed));
  321. struct xhci_host_controller_t
  322. {
  323. struct pci_device_structure_general_device_t *pci_dev_hdr; // 指向pci header结构体的指针
  324. int controller_id; // 操作系统给controller的编号
  325. uint64_t vbase; // 虚拟地址base(bar0映射到的虚拟地址)
  326. uint64_t vbase_op; // Operational registers 起始虚拟地址
  327. uint32_t rts_offset; // Runtime Register Space offset
  328. uint32_t db_offset; // Doorbell offset
  329. uint32_t ext_caps_off; // 扩展能力寄存器偏移量
  330. uint8_t context_size; // 上下文大小
  331. uint16_t port_num; // 总的端口数量
  332. uint8_t port_num_u2; // usb 2.0端口数量
  333. uint8_t port_num_u3; // usb 3端口数量
  334. uint32_t page_size; // page size
  335. uint64_t dcbaap_vaddr; // Device Context Base Address Array Pointer的虚拟地址
  336. uint64_t cmd_ring_vaddr; // command ring的虚拟地址
  337. uint64_t cmd_trb_vaddr; // 下一个要写入的trb的虚拟地址
  338. uint64_t event_ring_vaddr; // event ring的虚拟地址
  339. uint64_t event_ring_table_vaddr; // event ring table的虚拟地址
  340. uint64_t current_event_ring_vaddr; // 下一个要读取的event TRB的虚拟地址
  341. uint8_t cmd_trb_cycle; // 当前command ring cycle
  342. uint8_t current_event_ring_cycle; // 当前event ring cycle
  343. struct xhci_port_info_t ports[XHCI_MAX_ROOT_HUB_PORTS]; // 指向端口信息数组的指针(由于端口offset是从1开始的,因此该数组第0项为空)
  344. };
  345. // Common TRB types
  346. enum
  347. {
  348. TRB_TYPE_NORMAL = 1,
  349. TRB_TYPE_SETUP_STAGE,
  350. TRB_TYPE_DATA_STAGE,
  351. TRB_TYPE_STATUS_STAGE,
  352. TRB_TYPE_ISOCH,
  353. TRB_TYPE_LINK,
  354. TRB_TYPE_EVENT_DATA,
  355. TRB_TYPE_NO_OP,
  356. TRB_TYPE_ENABLE_SLOT,
  357. TRB_TYPE_DISABLE_SLOT = 10,
  358. TRB_TYPE_ADDRESS_DEVICE = 11,
  359. TRB_TYPE_CONFIG_EP,
  360. TRB_TYPE_EVALUATE_CONTEXT,
  361. TRB_TYPE_RESET_EP,
  362. TRB_TYPE_STOP_EP = 15,
  363. TRB_TYPE_SET_TR_DEQUEUE,
  364. TRB_TYPE_RESET_DEVICE,
  365. TRB_TYPE_FORCE_EVENT,
  366. TRB_TYPE_DEG_BANDWIDTH,
  367. TRB_TYPE_SET_LAT_TOLERANCE = 20,
  368. TRB_TYPE_GET_PORT_BAND = 21,
  369. TRB_TYPE_FORCE_HEADER,
  370. TRB_TYPE_NO_OP_CMD, // 24 - 31 = reserved
  371. TRB_TYPE_TRANS_EVENT = 32,
  372. TRB_TYPE_COMMAND_COMPLETION,
  373. TRB_TYPE_PORT_STATUS_CHANGE,
  374. TRB_TYPE_BANDWIDTH_REQUEST,
  375. TRB_TYPE_DOORBELL_EVENT,
  376. TRB_TYPE_HOST_CONTROLLER_EVENT = 37,
  377. TRB_TYPE_DEVICE_NOTIFICATION,
  378. TRB_TYPE_MFINDEX_WRAP,
  379. // 40 - 47 = reserved
  380. // 48 - 63 = Vendor Defined
  381. };
  382. // event ring trb的完成码
  383. enum
  384. {
  385. TRB_COMP_TRB_SUCCESS = 1,
  386. TRB_COMP_DATA_BUFFER_ERROR,
  387. TRB_COMP_BABBLE_DETECTION,
  388. TRB_COMP_TRANSACTION_ERROR,
  389. TRB_COMP_TRB_ERROR,
  390. TRB_COMP_STALL_ERROR,
  391. TRB_COMP_RESOURCE_ERROR = 7,
  392. TRB_COMP_BANDWIDTH_ERROR,
  393. TRB_COMP_NO_SLOTS_ERROR,
  394. TRB_COMP_INVALID_STREAM_TYPE,
  395. TRB_COMP_SLOT_NOT_ENABLED,
  396. TRB_COMP_EP_NOT_ENABLED,
  397. TRB_COMP_SHORT_PACKET = 13,
  398. TRB_COMP_RING_UNDERRUN,
  399. TRB_COMP_RUNG_OVERRUN,
  400. TRB_COMP_VF_EVENT_RING_FULL,
  401. TRB_COMP_PARAMETER_ERROR,
  402. TRB_COMP_BANDWITDH_OVERRUN,
  403. TRB_COMP_CONTEXT_STATE_ERROR = 19,
  404. TRB_COMP_NO_PING_RESPONSE,
  405. TRB_COMP_EVENT_RING_FULL,
  406. TRB_COMP_INCOMPATIBLE_DEVICE,
  407. TRB_COMP_MISSED_SERVICE,
  408. TRB_COMP_COMMAND_RING_STOPPED = 24,
  409. TRB_COMP_COMMAND_ABORTED,
  410. TRB_COMP_STOPPED,
  411. TRB_COMP_STOPPER_LENGTH_ERROR,
  412. TRB_COMP_RESERVED,
  413. TRB_COMP_ISOCH_BUFFER_OVERRUN,
  414. TRB_COMP_EVERN_LOST = 32,
  415. TRB_COMP_UNDEFINED,
  416. TRB_COMP_INVALID_STREAM_ID,
  417. TRB_COMP_SECONDARY_BANDWIDTH,
  418. TRB_COMP_SPLIT_TRANSACTION
  419. /* 37 - 191 reserved */
  420. /* 192 - 223 vender defined errors */
  421. /* 224 - 225 vendor defined info */
  422. };
  423. /**
  424. * @brief 初始化xhci控制器
  425. *
  426. * @param header 指定控制器的pci device头部
  427. */
  428. void xhci_init(struct pci_device_structure_general_device_t *header);