Leaked source code of windows server 2003
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.

854 lines
31 KiB

  1. /*++
  2. Copyright (c) 1998-2001 Microsoft Corporation
  3. Module Name:
  4. ohci1394.h
  5. Abstract:
  6. 1394 Kernel Debugger DLL
  7. Author:
  8. George Chrysanthakopoulos (georgioc) 31-October-1999
  9. Revision History:
  10. Date Who What
  11. ---------- --------- ------------------------------------------------------------
  12. 06/19/2001 pbinder cleanup
  13. --*/
  14. //
  15. // Various OHCI definitions
  16. //
  17. #define min(a,b) (((a) < (b)) ? (a) : (b))
  18. #define max(a,b) (((a) > (b)) ? (a) : (b))
  19. #define PHY_CABLE_POWER_STATUS 0x01 // CPS @ Address 0
  20. #define PHY_LOCAL_NODE_ROOT 0x02 // R @ Address 0
  21. #define PHY_PHYSICAL_ID_MASK 0xFC // Physical ID @ Address 0
  22. #define PHY_ROOT_HOLD_OFF_BIT 0x80 // RHB @ Address 1
  23. #define PHY_INITIATE_BUS_RESET 0x40 // IBR @ Address 1
  24. #define PHY_MAX_GAP_COUNT 0x3f // GC @ Address 1
  25. #define OHCI_REGISTER_MAP_SIZE 0x800
  26. #define OHCI_SELFID_BUFFER_SZ 2048
  27. #define OHCI_CONFIG_ROM_SIZE 1024
  28. #define OHCI_SELFID_DELAY 0
  29. #define OHCI_SELFID_POWER_CLASS 4
  30. //
  31. // IntEvent OHCI Register Bit Masks
  32. //
  33. #define MASTER_INT_ENABLE 0x80000000
  34. #define VENDOR_SPECIFIC_INT 0x40000000
  35. #define PHY_REG_RECEIVED_INT 0x04000000
  36. #define CYCLE_TOO_LONG_INT 0x02000000
  37. #define UNRECOVERABLE_ERROR_INT 0x01000000
  38. #define CYCLE_INCONSISTENT_INT 0x00800000
  39. #define CYCLE_LOST_INT 0x00400000
  40. #define CYCLE_64_SECS_INT 0x00200000
  41. #define CYCLE_SYNCH_INT 0x00100000
  42. #define PHY_INT 0x00080000
  43. #define PHY_BUS_RESET_INT 0x00020000
  44. #define SELF_ID_COMPLETE_INT 0x00010000
  45. #define LOCK_RESP_ERR_INT 0x00000200
  46. #define POSTED_WRITE_ERR_INT 0x00000100
  47. #define ISOCH_RX_INT 0x00000080
  48. #define ISOCH_TX_INT 0x00000040
  49. #define RSPKT_INT 0x00000020
  50. #define RQPKT_INT 0x00000010
  51. #define ARRS_INT 0x00000008
  52. #define ARRQ_INT 0x00000004
  53. #define RESP_TX_COMPLETE_INT 0x00000002
  54. #define REQ_TX_COMPLETE_INT 0x00000001
  55. #define USED_INT_MASK (RESP_TX_COMPLETE_INT | REQ_TX_COMPLETE_INT | RSPKT_INT | RQPKT_INT | \
  56. ISOCH_RX_INT | ISOCH_TX_INT | PHY_BUS_RESET_INT | SELF_ID_COMPLETE_INT | \
  57. MASTER_INT_ENABLE | CYCLE_TOO_LONG_INT | CYCLE_INCONSISTENT_INT)
  58. //
  59. // DMA Async Context numbers
  60. //
  61. #define AT_REQ_DMA_CONTEXT 0
  62. #define AT_RSP_DMA_CONTEXT 1
  63. #define AR_REQ_DMA_CONTEXT 2
  64. #define AR_RSP_DMA_CONTEXT 3
  65. #define NUM_DMA_CONTEXTS 4
  66. //
  67. // DMA Context Commands
  68. //
  69. #define OUTPUT_MORE_CMD 0
  70. #define OUTPUT_MORE_IMMEDIATE_CMD 0
  71. #define OUTPUT_LAST_CMD 1
  72. #define OUTPUT_LAST_IMMEDIATE_CMD 1
  73. #define INPUT_MORE_CMD 2
  74. #define INPUT_LAST_CMD 3
  75. #define STORE_VALUE_CMD 8
  76. //
  77. // DMA context descriptor header values
  78. //
  79. #define DESC_KEY 0
  80. #define DESC_IMMEDIATE_KEY 2
  81. #define DESC_INPUT_MORE_IMM_BRANCH_CONTROL 0
  82. #define DESC_OUT_MORE_BRANCH_CONTROL 0
  83. #define DESC_OUT_LAST_BRANCH_CONTROL 3
  84. #define DESC_INPUT_MORE_BRANCH_CONTROL 3
  85. #define DESC_INPUT_LAST_BRANCH_CONTROL 3
  86. #define DESC_WAIT_CONTROL_ON 3
  87. #define DESC_WAIT_CONTROL_OFF 0
  88. #define DESC_GENERATE_INT 3
  89. #define DESC_NO_INT 0
  90. //
  91. // command descriptors XfreStatus field masks
  92. //
  93. #define DESC_XFER_STATUS_ACTIVE 0x0400
  94. #define DESC_XFER_STATUS_DEAD 0x0800
  95. //
  96. // OHCI EVENT CODEs
  97. //
  98. #define OHCI_EVT_MISSING_ACK 0x03
  99. #define OHCI_EVT_UNDERRUN 0x04
  100. #define OHCI_EVT_OVERRUN 0x05
  101. #define OHCI_EVT_TIMEOUT 0x0a
  102. #define OHCI_EVT_FLUSHED 0x0F
  103. #define OHCI_EVT_BUS_RESET 0x09
  104. //
  105. // each packet must have up to 7 fragments ( including first and last descriptors)
  106. //
  107. #define MAX_OHCI_COMMAND_DESCRIPTOR_BLOCKS 8
  108. //
  109. // max buffer size one cmd descriptor can address
  110. //
  111. #define MAX_CMD_DESC_DATA_LENGTH 65535
  112. //
  113. // OHCI Register definitions
  114. //
  115. typedef struct _VERSION_REGISTER {
  116. ULONG Revision:8; // bits 0-7
  117. ULONG Reserved:8; // bits 8-15
  118. ULONG Version:8; // bits 16-23
  119. ULONG GUID_ROM:1; // bit 24
  120. ULONG Reserved1:7; // bits 25-31
  121. } VERSION_REGISTER, *PVERSION_REGISTER;
  122. typedef struct _VENDOR_ID_REGISTER {
  123. ULONG VendorCompanyId:24; // Bits 0-23
  124. ULONG VendorUnique:8; // Bits 24-31
  125. } VENDOR_ID_REGISTER, *PVENDOR_ID_REGISTER;
  126. typedef struct _GUID_ROM_REGISTER {
  127. ULONG Reserved0:16; // bits 0-15
  128. ULONG RdData:8; // bits 16-23
  129. ULONG Reserved1:1; // bit 24
  130. ULONG RdStart:1; // bit 25
  131. ULONG Reserved2:5; // bits 26-30
  132. ULONG AddrReset:1; // bits 31
  133. } GUID_ROM_REGISTER, *PGUID_ROM_REGISTER;
  134. typedef struct _AT_RETRIES_REGISTER {
  135. ULONG MaxATReqRetries:4; // bits 0-3
  136. ULONG MaxATRespRetries:4; // bits 4-7
  137. ULONG MaxPhysRespRetries:4; // bits 8-11
  138. ULONG Reserved:4; // bits 12-15
  139. ULONG CycleLimit:13; // bits 16-28
  140. ULONG SecondLimit:3; // bits 29-31
  141. } AT_RETRIES_REGISTER, *PAT_RETRIES_REGISTER;
  142. typedef struct _CSR_CONTROL_REGISTER {
  143. ULONG CsrSel:2; // bits 0-1
  144. ULONG Reserved:29; // bits 2-30;
  145. ULONG CsrDone:1; // bit 31
  146. } CSR_CONTROL_REGISTER, *PCSR_CONTROL_REGISTER;
  147. typedef struct _CONFIG_ROM_HEADER_REGISTER {
  148. ULONG Rom_crc_value:16; // bits 0-15
  149. ULONG Crc_length:8; // bits 16-23
  150. ULONG Info_length:8; // bits 24-31
  151. } CONFIG_ROM_HEADER_REGISTER, *PCONFIG_ROM_HEADER_REGISTER;
  152. typedef struct _BUS_OPTIONS_REGISTER {
  153. ULONG Link_spd:3; // bits 0-2
  154. ULONG Reserved0:3; // bits 3-5
  155. ULONG g:2; // bits 6-7
  156. ULONG Reserved1:4; // bits 8-11
  157. ULONG Max_rec:4; // bits 12-15
  158. ULONG Cyc_clk_acc:8; // bits 16-23
  159. ULONG Reserved2:3; // bits 24-26
  160. ULONG Pmc:1; // bit 27
  161. ULONG Bmc:1; // bit 28
  162. ULONG Isc:1; // bit 29
  163. ULONG Cmc:1; // bit 30
  164. ULONG Irmc:1; // bit 31
  165. } BUS_OPTIONS_REGISTER, *PBUS_OPTIONS_REGISTER;
  166. typedef struct _HC_CONTROL_REGISTER {
  167. ULONG Reserved:16; // Bit 0-15
  168. ULONG SoftReset:1; // Bit 16
  169. ULONG LinkEnable:1; // Bit 17
  170. ULONG PostedWriteEnable:1; // Bit 18
  171. ULONG Lps:1; // bit 19
  172. ULONG Reserved2:2; // Bits 20-21
  173. ULONG APhyEnhanceEnable:1; // bit 22
  174. ULONG ProgramPhyEnable:1; // bit 23
  175. ULONG Reserved3:6; // bits 24-29
  176. ULONG NoByteSwapData:1; // Bit 30
  177. ULONG Reserved4:1; // Bit 31
  178. } HC_CONTROL_REGISTER, *PHC_CONTROL_REGISTER;
  179. typedef struct _FAIRNESS_CONTROL_REGISTER {
  180. ULONG Pri_req:8; // Bits 0-7
  181. ULONG Reserved0:24; // Bit 8-31
  182. } FAIRNESS_CONTROL_REGISTER;
  183. typedef struct _LINK_CONTROL_REGISTER {
  184. ULONG Reserved0:4; // Bits 0-3
  185. ULONG CycleSyncLReqEnable:1; // Bit 4
  186. ULONG Reserved1:4; // Bits 5-8
  187. ULONG RcvSelfId:1; // Bit 9
  188. ULONG RcvPhyPkt:1; // Bit 10
  189. ULONG Reserved2:9; // Bits 11-19
  190. ULONG CycleTimerEnable:1; // Bit 20
  191. ULONG CycleMaster:1; // Bit 21
  192. ULONG CycleSource:1; // Bit 22
  193. ULONG Reserved3:9; // Bits 23-31
  194. } LINK_CONTROL_REGISTER, *PLINK_CONTROL_REGISTER;
  195. typedef struct _NODE_ID_REGISTER {
  196. ULONG NodeId:6; // Bits 0-5
  197. ULONG BusId:10; // Bits 6-15
  198. ULONG Reserved1:11; // Bits 16-26;
  199. ULONG Cps:1; // Bit 27;
  200. ULONG Reserved2:2; // Bits 28-29
  201. ULONG Root:1; // Bit 30
  202. ULONG IdValid:1; // Bit 31
  203. } NODE_ID_REGISTER, *PNODE_ID_REGISTER;
  204. typedef struct _SELF_ID_BUFFER_REGISTER {
  205. union {
  206. ULONG SelfIdBufferPointer;
  207. struct {
  208. ULONG Reserved0:11; // bits 0-10
  209. ULONG SelfIdBuffer:21; // Bits 11-32
  210. } bits;
  211. } u;
  212. } SELF_ID_BUFFER_REGISTER, *PSELF_ID_BUFFER_REGISTER;
  213. typedef struct _SELF_ID_COUNT_REGISTER {
  214. ULONG Reserved0:2; // bits 0-1
  215. ULONG SelfIdSize:11; // Bits 2-12
  216. ULONG Reserved1:3; // bits 13-15
  217. ULONG SelfIdGeneration:8; // bits 16-23
  218. ULONG Reserved2:7; // bits 24-30
  219. ULONG SelfIdError:1; // bit 31
  220. } SELF_ID_COUNT_REGISTER, *PSELF_ID_COUNT_REGISTER;
  221. typedef struct _PHY_CONTROL_REGISTER {
  222. ULONG WrData:8; // bits 0-7
  223. ULONG RegAddr:4; // bits 8-11
  224. ULONG Reserved0:2; // bits 12-13
  225. ULONG WrReg:1; // bit 14
  226. ULONG RdReg:1; // bit 15
  227. ULONG RdData:8; // bits 16-23
  228. ULONG RdAddr:4; // bits 24-27
  229. ULONG Reserved1:3; // bits 28-30
  230. ULONG RdDone:1; // bit 31
  231. } PHY_CONTROL_REGISTER, *PPHY_CONTROL_REGISTER;
  232. typedef struct _ISOCH_CYCLE_TIMER_REGISTER {
  233. ULONG CycleOffset:12; // bits 0-11
  234. ULONG CycleCount:13; // bits 12-24
  235. ULONG CycleSeconds:7; // bits 25-31
  236. } ISOCH_CYCLE_TIMER_REGISTER, *PISOCH_CYCLE_TIMER_REGISTER;
  237. typedef struct _INT_EVENT_MASK_REGISTER {
  238. ULONG ReqTxComplete:1; // Bit 0
  239. ULONG RspTxComplete:1; // Bit 1
  240. ULONG ARRQ:1; // Bit 2
  241. ULONG ARRS:1; // Bit 3
  242. ULONG RQPkt:1; // Bit 4
  243. ULONG RSPPkt:1; // Bit 5
  244. ULONG IsochTx:1; // Bit 6
  245. ULONG IsochRx:1; // Bit 7
  246. ULONG PostedWriteErr:1; // Bit 8
  247. ULONG LockRespErr:1; // Bit 9
  248. ULONG Reserved0:6; // Bits 10-15
  249. ULONG SelfIdComplete:1; // Bit 16
  250. ULONG BusReset:1; // Bit 17
  251. ULONG Reserved1:1; // Bit 18
  252. ULONG Phy:1; // Bit 19
  253. ULONG CycleSynch:1; // Bit 20
  254. ULONG Cycle64Secs:1; // Bit 21
  255. ULONG CycleLost:1; // Bit 22
  256. ULONG CycleInconsistent:1; // Bit 23
  257. ULONG UnrecoverableError:1; // Bit 24
  258. ULONG CycleTooLong:1; // Bit 25
  259. ULONG PhyRegRcvd:1; // Bit 26
  260. ULONG Reserved2:3; // Bits 27-29
  261. ULONG VendorSpecific:1; // Bit 30
  262. ULONG MasterIntEnable:1; // Bit 31
  263. } INT_EVENT_MASK_REGISTER, *PINT_EVENT_MASK_REGISTER;
  264. typedef struct COMMAND_POINTER_REGISTER {
  265. ULONG Z:4; // bits 0-3
  266. ULONG DescriptorAddr:28; // bits 4-31
  267. } COMMAND_POINTER_REGISTER, *PCOMMAND_POINTER_REGISTER;
  268. typedef struct CONTEXT_CONTROL_REGISTER {
  269. ULONG EventCode:5; // bits 0-4
  270. ULONG Spd:3; // bits 5-7
  271. ULONG Reserved0:2; // bits 8-9
  272. ULONG Active:1; // bit 10
  273. ULONG Dead:1; // bit 11
  274. ULONG Wake:1; // bit 12
  275. ULONG Reserved1:2; // bits 13-14
  276. ULONG Run:1; // bit 15
  277. ULONG Reserved2:16; // bits 16-31
  278. } CONTEXT_CONTROL_REGISTER, *PCONTEXT_CONTROL_REGISTER;
  279. typedef struct IT_CONTEXT_CONTROL_REGISTER {
  280. ULONG EventCode:5; // bits 0-4
  281. ULONG Spd:3; // bits 5-7
  282. ULONG Reserved0:2; // bits 8-9
  283. ULONG Active:1; // bit 10
  284. ULONG Dead:1; // bit 11
  285. ULONG Wake:1; // bit 12
  286. ULONG Reserved1:2; // bits 13-14
  287. ULONG Run:1; // bit 15
  288. ULONG CycleMatch:15; // bits 16-30
  289. ULONG CycleMatchEnable:1; // bit 31
  290. } IT_CONTEXT_CONTROL_REGISTER, *PIT_CONTEXT_CONTROL_REGISTER;
  291. typedef struct IR_CONTEXT_CONTROL_REGISTER {
  292. ULONG EventCode:5; // bits 0-4
  293. ULONG Spd:3; // bits 5-7
  294. ULONG Reserved0:2; // bits 8-9
  295. ULONG Active:1; // bit 10
  296. ULONG Dead:1; // bit 11
  297. ULONG Wake:1; // bit 12
  298. ULONG Reserved1:2; // bits 13-14
  299. ULONG Run:1; // bit 15
  300. ULONG CycleMatch:12; // bits 16-27
  301. ULONG MultiChanMode:1; // bit 28
  302. ULONG CycleMatchEnable:1; // bit 29
  303. ULONG IsochHeader:1; // bit 30
  304. ULONG BufferFill:1; // bit 31
  305. } IR_CONTEXT_CONTROL_REGISTER, *PIR_CONTEXT_CONTROL_REGISTER;
  306. typedef struct _CONTEXT_MATCH_REGISTER {
  307. ULONG ChannelNumber:6; // bits 0-5
  308. ULONG Reserved:1; // bit 6
  309. ULONG Tag1SyncFilter:1; // bit 7
  310. ULONG Sync:4; // bits 8-11
  311. ULONG CycleMatch:13; // bits 12-24
  312. ULONG Reserved1:3; // bits 25-27
  313. ULONG Tag:4; // bit 28-31
  314. } CONTEXT_MATCH_REGISTER, *PCONTEXT_MATCH_REGISTER;
  315. typedef struct _DMA_CONTEXT_REGISTERS {
  316. CONTEXT_CONTROL_REGISTER ContextControlSet;
  317. CONTEXT_CONTROL_REGISTER ContextControlClear;
  318. ULONG Reserved0[1];
  319. COMMAND_POINTER_REGISTER CommandPtr;
  320. ULONG Reserved1[4];
  321. } DMA_CONTEXT_REGISTERS, *PDMA_CONTEXT_REGISTERS;
  322. typedef struct _DMA_ISOCH_RCV_CONTEXT_REGISTERS {
  323. IR_CONTEXT_CONTROL_REGISTER ContextControlSet;
  324. IR_CONTEXT_CONTROL_REGISTER ContextControlClear;
  325. ULONG Reserved0[1];
  326. COMMAND_POINTER_REGISTER CommandPtr;
  327. CONTEXT_MATCH_REGISTER ContextMatch;
  328. ULONG Reserved1[3];
  329. } DMA_ISOCH_RCV_CONTEXT_REGISTERS, *PDMA_ISOCH_RCV_CONTEXT_REGISTERS;
  330. typedef struct _DMA_ISOCH_XMIT_CONTEXT_REGISTERS {
  331. IT_CONTEXT_CONTROL_REGISTER ContextControlSet;
  332. IT_CONTEXT_CONTROL_REGISTER ContextControlClear;
  333. ULONG Reserved0[1];
  334. COMMAND_POINTER_REGISTER CommandPtr;
  335. } DMA_ISOCH_XMIT_CONTEXT_REGISTERS, *PDMA_ISOCH_XMIT_CONTEXT_REGISTERS;
  336. typedef struct _OHCI_REGISTER_MAP {
  337. VERSION_REGISTER Version; // @ 0
  338. GUID_ROM_REGISTER GUID_ROM; // @ 4
  339. AT_RETRIES_REGISTER ATRetries; // @ 8
  340. ULONG CsrData; // @ C
  341. ULONG CsrCompare; // @ 10
  342. CSR_CONTROL_REGISTER CsrControl; // @ 14
  343. CONFIG_ROM_HEADER_REGISTER ConfigRomHeader; // @ 18
  344. ULONG BusId; // @ 1C
  345. BUS_OPTIONS_REGISTER BusOptions; // @ 20
  346. ULONG GuidHi; // @ 24
  347. ULONG GuidLo; // @ 28
  348. ULONG Reserved0[2]; // @ 2C
  349. ULONG ConfigRomMap; // @ 34
  350. ULONG PostedWriteAddressLo; // @ 38
  351. ULONG PostedWriteAddressHi; // @ 3C
  352. VENDOR_ID_REGISTER VendorId; // @ 40
  353. ULONG Reserved1[3]; // @ 44
  354. HC_CONTROL_REGISTER HCControlSet; // @ 50
  355. HC_CONTROL_REGISTER HCControlClear; // @ 54
  356. ULONG Reserved2[3]; // @ 58
  357. SELF_ID_BUFFER_REGISTER SelfIdBufferPtr; // @ 64
  358. SELF_ID_COUNT_REGISTER SelfIdCount; // @ 68
  359. ULONG Reserved3[1]; // @ 6C
  360. ULONG IRChannelMaskHiSet; // @ 70
  361. ULONG IRChannelMaskHiClear; // @ 74
  362. ULONG IRChannelMaskLoSet; // @ 78
  363. ULONG IRChannelMaskLoClear; // @ 7C
  364. INT_EVENT_MASK_REGISTER IntEventSet; // @ 80
  365. INT_EVENT_MASK_REGISTER IntEventClear; // @ 84
  366. INT_EVENT_MASK_REGISTER IntMaskSet; // @ 88
  367. INT_EVENT_MASK_REGISTER IntMaskClear; // @ 8C
  368. ULONG IsoXmitIntEventSet; // @ 90
  369. ULONG IsoXmitIntEventClear; // @ 94
  370. ULONG IsoXmitIntMaskSet; // @ 98
  371. ULONG IsoXmitIntMaskClear; // @ 9C
  372. ULONG IsoRecvIntEventSet; // @ A0
  373. ULONG IsoRecvIntEventClear; // @ A4
  374. ULONG IsoRecvIntMaskSet; // @ A8
  375. ULONG IsoRecvIntMaskClear; // @ AC
  376. ULONG Reserved4[11]; // @ B0
  377. FAIRNESS_CONTROL_REGISTER FairnessControl; // @ DC
  378. LINK_CONTROL_REGISTER LinkControlSet; // @ E0
  379. LINK_CONTROL_REGISTER LinkControlClear; // @ E4
  380. NODE_ID_REGISTER NodeId; // @ E8
  381. PHY_CONTROL_REGISTER PhyControl; // @ EC
  382. ISOCH_CYCLE_TIMER_REGISTER IsochCycleTimer; // @ F0
  383. ULONG Reserved5[3]; // @ F4
  384. ULONG AsynchReqFilterHiSet; // @ 100
  385. ULONG AsynchReqFilterHiClear; // @ 104
  386. ULONG AsynchReqFilterLoSet; // @ 108
  387. ULONG AsynchReqFilterLoClear; // @ 10C
  388. ULONG PhyReqFilterHiSet; // @ 110
  389. ULONG PhyReqFilterHiClear; // @ 114
  390. ULONG PhyReqFilterLoSet; // @ 118
  391. ULONG PhyReqFilterLoClear; // @ 11C
  392. ULONG PhysicalUpperBound; // @ 120
  393. ULONG Reserved6[23]; // @ 124
  394. DMA_CONTEXT_REGISTERS AsynchContext[4]; // @ 180
  395. // ATRsp_Context; // @ 1A0
  396. // ARReq_Context; // @ 1C0
  397. // ARRsp_Context; // @ 1E0
  398. DMA_ISOCH_XMIT_CONTEXT_REGISTERS IT_Context[32]; // @ 200
  399. DMA_ISOCH_RCV_CONTEXT_REGISTERS IR_Context[32]; // @ 400
  400. } OHCI_REGISTER_MAP, *POHCI_REGISTER_MAP;
  401. typedef struct _OHCI1394_PHY_REGISTER_MAP {
  402. UCHAR Cable_Power_Status:1; // @ reg 0
  403. UCHAR Root:1;
  404. UCHAR Physical_ID:6;
  405. UCHAR Gap_Count:6; // @ reg 1
  406. UCHAR Initiate_BusReset:1;
  407. UCHAR Root_Hold_Off:1;
  408. UCHAR Number_Ports:4; // @ reg 2
  409. UCHAR Reserved:2;
  410. UCHAR Speed:2;
  411. UCHAR Reserved1:2; // @ reg 3
  412. UCHAR Connected1:1;
  413. UCHAR Child1:1;
  414. UCHAR BStat1:2;
  415. UCHAR AStat1:2;
  416. UCHAR Reserved2:2; // @ reg 4
  417. UCHAR Connected2:1;
  418. UCHAR Child2:1;
  419. UCHAR BStat2:2;
  420. UCHAR AStat2:2; // in 1394A, bit 0 of Astat, is the contender bit
  421. UCHAR Reserved3:2; // @ reg 5
  422. UCHAR Connected3:1;
  423. UCHAR Child3:1;
  424. UCHAR BStat3:2;
  425. UCHAR AStat3:2;
  426. UCHAR Manager_Capable:1; // @ reg 6
  427. UCHAR Reserved4:3;
  428. UCHAR Initiated_Reset:1;
  429. UCHAR Cable_Power_Stat:1;
  430. UCHAR Cable_Power_Status_Int:1;
  431. UCHAR Loop_Int:1;
  432. } OHCI1394_PHY_REGISTER_MAP, *POHCI1394_PHY_REGISTER_MAP;
  433. typedef struct _OHCI1394A_PHY_REGISTER_MAP {
  434. UCHAR Cable_Power_Status:1; // @ reg 0
  435. UCHAR Root:1;
  436. UCHAR Physical_ID:6;
  437. UCHAR Gap_Count:6; // @ reg 1
  438. UCHAR Initiate_BusReset:1;
  439. UCHAR Root_Hold_Off:1;
  440. UCHAR Number_Ports:4; // @ reg 2
  441. UCHAR Reserved1:1;
  442. UCHAR Extended:3;
  443. UCHAR Delay:4; // @ reg 3
  444. UCHAR Reserved2:1;
  445. UCHAR Max_Speed:3;
  446. UCHAR Pwr:3; // @ reg 4
  447. UCHAR Jitter:3;
  448. UCHAR Contender:1;
  449. UCHAR Link_Active:1;
  450. UCHAR Enab_Multi:1; // @ reg 5
  451. UCHAR Enab_Accel:1;
  452. UCHAR Port_event:1;
  453. UCHAR Timeout:1;
  454. UCHAR Pwr_Fail:1;
  455. UCHAR Loop:1;
  456. UCHAR ISBR:1;
  457. UCHAR Resume_int:1;
  458. UCHAR Reg6Reserved:8; // @ reg 6
  459. UCHAR PortSelect:4; // @ reg 7
  460. UCHAR Reserved3:1;
  461. UCHAR PageSelect:3;
  462. UCHAR Register0:8;
  463. UCHAR Register1:8;
  464. UCHAR Register2:8;
  465. UCHAR Register3:8;
  466. UCHAR Register4:8;
  467. UCHAR Register5:8;
  468. UCHAR Register6:8;
  469. UCHAR Register7:8;
  470. } OHCI1394A_PHY_REGISTER_MAP, *POHCI1394A_PHY_REGISTER_MAP;
  471. typedef struct _OHCI_SELF_ID_PACKET_HEADER {
  472. ULONG TimeStamp:16; // bits 0-15
  473. ULONG SelfIdGeneration:8; // bits 16-23
  474. ULONG Reserved:8; // bits 24-31
  475. } OHCI_SELF_ID_PACKET_HEADER, *POHCI_SELF_ID_PACKET_HEADER;
  476. typedef struct _OHCI_IT_ISOCH_HEADER {
  477. ULONG OHCI_Sy:4; // bits 0-3
  478. ULONG OHCI_Tcode:4; // bits 4-7
  479. ULONG OHCI_ChanNum:6; // bits 8-13
  480. ULONG OHCI_Tag:2; // bits 14-15
  481. ULONG OHCI_Spd:3; // bits 16-18
  482. ULONG OHCI_Reserved:13; // bits 19-31
  483. USHORT OHCI_Reserved1;
  484. USHORT OHCI_DataLength;
  485. } OHCI_IT_ISOCH_HEADER, *POHCI_IT_ISOCH_HEADER;
  486. typedef struct _BUS1394_NODE_ADDRESS {
  487. USHORT NA_Node_Number:6; // Bits 10-15
  488. USHORT NA_Bus_Number:10; // Bits 0-9
  489. } BUS1394_NODE_ADDRESS, *PBUS1394_NODE_ADDRESS;
  490. //
  491. // Definition of Command Descriptor Lists (CDL's)
  492. //
  493. typedef struct _COMMAND_DESCRIPTOR {
  494. struct {
  495. ULONG ReqCount:16; // bits 0-15
  496. ULONG w:2; // bits 16-17
  497. ULONG b:2; // bits 18-19
  498. ULONG i:2; // bits 20-21
  499. ULONG Reserved1:1; // bit 22
  500. ULONG p:1; // bit 23
  501. ULONG Key:3; // bits 24-26
  502. ULONG Status:1; // bit 27
  503. ULONG Cmd:4; // bits 28-31
  504. } Header;
  505. ULONG DataAddress;
  506. union {
  507. ULONG BranchAddress;
  508. struct {
  509. ULONG Z:4; // bits 0-3
  510. ULONG Reserved:28; // bits 4-31
  511. } z;
  512. } u;
  513. struct {
  514. union {
  515. USHORT TimeStamp:16; // bits 0-15
  516. USHORT ResCount:16; // bits 0-15
  517. } u;
  518. USHORT XferStatus; // bits 16-31
  519. } Status;
  520. } COMMAND_DESCRIPTOR, *PCOMMAND_DESCRIPTOR;
  521. typedef struct _OHCI_ASYNC_PACKET {
  522. USHORT OHCI_Reserved3:4;
  523. USHORT OHCI_tCode:4;
  524. USHORT OHCI_rt:2;
  525. USHORT OHCI_tLabel:6;
  526. union {
  527. struct {
  528. BUS1394_NODE_ADDRESS OHCI_Destination_ID; // 1st quadlet
  529. } Rx;
  530. struct {
  531. USHORT OHCI_spd:3; // 1st quadlet
  532. USHORT OHCI_Reserved2:4;
  533. USHORT OHCI_srcBusId:1;
  534. USHORT OHCI_Reserved:8;
  535. } Tx;
  536. } u;
  537. union {
  538. USHORT OHCI_Offset_High;
  539. struct {
  540. USHORT OHCI_Reserved2:8;
  541. USHORT OHCI_Reserved1:4;
  542. USHORT OHCI_Rcode:4;
  543. } Response;
  544. } u2;
  545. union {
  546. struct {
  547. BUS1394_NODE_ADDRESS OHCI_Destination_ID; // 2nd quadlet
  548. } Tx;
  549. struct {
  550. BUS1394_NODE_ADDRESS OHCI_Source_ID; // 2nd quadlet
  551. } Rx;
  552. } u1;
  553. ULONG OHCI_Offset_Low; // 3rd quadlet
  554. union {
  555. struct {
  556. USHORT OHCI_Extended_tCode;
  557. USHORT OHCI_Data_Length; // 4th quadlet
  558. } Block;
  559. ULONG OHCI_Quadlet_Data; // 4th quadlet
  560. } u3;
  561. } OHCI_ASYNC_PACKET, *POHCI_ASYNC_PACKET;
  562. typedef struct _DESCRIPTOR_BLOCK {
  563. union {
  564. COMMAND_DESCRIPTOR CdArray[MAX_OHCI_COMMAND_DESCRIPTOR_BLOCKS];
  565. struct {
  566. COMMAND_DESCRIPTOR Cd;
  567. OHCI_ASYNC_PACKET Pkt;
  568. } Imm;
  569. }u;
  570. } DESCRIPTOR_BLOCK, *PDESCRIPTOR_BLOCK;
  571. //
  572. // phy access operations
  573. //
  574. #define OHCI_PHY_ACCESS_SET_CONTENDER 0x01000000
  575. #define OHCI_PHY_ACCESS_SET_GAP_COUNT 0x02000000
  576. #define OHCI_PHY_ACCESS_RAW_READ 0x10000000
  577. #define OHCI_PHY_ACCESS_RAW_WRITE 0x20000000
  578. //
  579. // 1394 Speed codes
  580. //
  581. #define SCODE_100_RATE 0
  582. #define SCODE_200_RATE 1
  583. #define SCODE_400_RATE 2
  584. #define SCODE_800_RATE 3
  585. #define SCODE_1600_RATE 4
  586. #define SCODE_3200_RATE 5
  587. #define TCODE_WRITE_REQUEST_QUADLET 0 // 0000b
  588. #define TCODE_WRITE_REQUEST_BLOCK 1 // 0001b
  589. #define TCODE_WRITE_RESPONSE 2 // 0010b
  590. #define TCODE_RESERVED1 3
  591. #define TCODE_READ_REQUEST_QUADLET 4 // 0100b
  592. #define TCODE_READ_REQUEST_BLOCK 5 // 0101b
  593. #define TCODE_READ_RESPONSE_QUADLET 6 // 0110b
  594. #define TCODE_READ_RESPONSE_BLOCK 7 // 0111b
  595. #define TCODE_CYCLE_START 8 // 1000b
  596. #define TCODE_LOCK_REQUEST 9 // 1001b
  597. #define TCODE_ISOCH_DATA_BLOCK 10 // 1010b
  598. #define TCODE_LOCK_RESPONSE 11 // 1011b
  599. #define TCODE_RESERVED2 12
  600. #define TCODE_RESERVED3 13
  601. #define TCODE_SELFID 14
  602. #define TCODE_RESERVED4 15
  603. //
  604. // IEEE 1212 Configuration Rom header definition
  605. //
  606. typedef struct _CONFIG_ROM_INFO {
  607. union {
  608. USHORT CRI_CRC_Value:16;
  609. struct {
  610. UCHAR CRI_Saved_Info_Length;
  611. UCHAR CRI_Saved_CRC_Length;
  612. } Saved;
  613. } u;
  614. UCHAR CRI_CRC_Length;
  615. UCHAR CRI_Info_Length;
  616. } CONFIG_ROM_INFO, *PCONFIG_ROM_INFO;
  617. //
  618. // IEEE 1212 Immediate entry definition
  619. //
  620. typedef struct _IMMEDIATE_ENTRY {
  621. ULONG IE_Value:24;
  622. ULONG IE_Key:8;
  623. } IMMEDIATE_ENTRY, *PIMMEDIATE_ENTRY;
  624. //
  625. // IEEE 1212 Directory definition
  626. //
  627. typedef struct _DIRECTORY_INFO {
  628. union {
  629. USHORT DI_CRC;
  630. USHORT DI_Saved_Length;
  631. } u;
  632. USHORT DI_Length;
  633. } DIRECTORY_INFO, *PDIRECTORY_INFO;
  634. //
  635. // IEEE 1212 Node Capabilities entry definition
  636. //
  637. typedef struct _NODE_CAPABILITES {
  638. ULONG NC_Init:1; // These can be found
  639. ULONG NC_Ded:1; // in the IEEE 1212 doc
  640. ULONG NC_Off:1;
  641. ULONG NC_Atn:1;
  642. ULONG NC_Elo:1;
  643. ULONG NC_Reserved1:1;
  644. ULONG NC_Drq:1;
  645. ULONG NC_Lst:1;
  646. ULONG NC_Fix:1;
  647. ULONG NC_64:1;
  648. ULONG NC_Prv:1;
  649. ULONG NC_Bas:1;
  650. ULONG NC_Ext:1;
  651. ULONG NC_Int:1;
  652. ULONG NC_Ms:1;
  653. ULONG NC_Spt:1;
  654. ULONG NC_Reserved2:8;
  655. ULONG NC_Key:8;
  656. } NODE_CAPABILITIES, *PNODE_CAPABILITIES;
  657.