Source code of Windows XP (NT5)
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.

2027 lines
68 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. 1394.h
  5. Abstract:
  6. Definitions for 1394 bus and/or port drivers
  7. Author:
  8. Shaun Pierce (shaunp) 5-Sep-95
  9. Environment:
  10. Kernel mode only
  11. Revision History:
  12. George Chrysanthakopoulos (georgioc) 1998 - 1999
  13. Added new apis, revised old ones, removed legacy
  14. --*/
  15. #ifndef _1394_H_
  16. #define _1394_H_
  17. #if (_MSC_VER >= 1020)
  18. #pragma once
  19. #endif
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. #define BUS1394_CURRENT_DDI_VERSION 2
  24. //
  25. // 1394 Additional NT DDK definitions
  26. //
  27. #define IRP_MN_BUS_RESET 0x87
  28. #define RCODE ULONG
  29. #define BASE_DEVICE_NAME L"\\Device\\1394BUS"
  30. #define BASE_SYMBOLIC_LINK_NAME L"\\DosDevices\\1394BUS"
  31. #define MAX_SUFFIX_SIZE 4*sizeof(WCHAR)
  32. //
  33. // 1394 Node Address format
  34. //
  35. typedef struct _NODE_ADDRESS {
  36. USHORT NA_Node_Number:6; // Bits 10-15
  37. USHORT NA_Bus_Number:10; // Bits 0-9
  38. } NODE_ADDRESS, *PNODE_ADDRESS;
  39. //
  40. // 1394 Address Offset format (48 bit addressing)
  41. //
  42. typedef struct _ADDRESS_OFFSET {
  43. USHORT Off_High;
  44. ULONG Off_Low;
  45. } ADDRESS_OFFSET, *PADDRESS_OFFSET;
  46. //
  47. // 1394 I/O Address format
  48. //
  49. typedef struct _IO_ADDRESS {
  50. NODE_ADDRESS IA_Destination_ID;
  51. ADDRESS_OFFSET IA_Destination_Offset;
  52. } IO_ADDRESS, *PIO_ADDRESS;
  53. //
  54. // 1394 Allocated Address Range format
  55. //
  56. typedef struct _ADDRESS_RANGE {
  57. USHORT AR_Off_High;
  58. USHORT AR_Length;
  59. ULONG AR_Off_Low;
  60. } ADDRESS_RANGE, *PADDRESS_RANGE;
  61. //
  62. // 1394 Self ID packet format
  63. //
  64. typedef struct _SELF_ID {
  65. ULONG SID_Phys_ID:6; // Byte 0 - Bits 0-5
  66. ULONG SID_Packet_ID:2; // Byte 0 - Bits 6-7
  67. ULONG SID_Gap_Count:6; // Byte 1 - Bits 0-5
  68. ULONG SID_Link_Active:1; // Byte 1 - Bit 6
  69. ULONG SID_Zero:1; // Byte 1 - Bit 7
  70. ULONG SID_Power_Class:3; // Byte 2 - Bits 0-2
  71. ULONG SID_Contender:1; // Byte 2 - Bit 3
  72. ULONG SID_Delay:2; // Byte 2 - Bits 4-5
  73. ULONG SID_Speed:2; // Byte 2 - Bits 6-7
  74. ULONG SID_More_Packets:1; // Byte 3 - Bit 0
  75. ULONG SID_Initiated_Rst:1; // Byte 3 - Bit 1
  76. ULONG SID_Port3:2; // Byte 3 - Bits 2-3
  77. ULONG SID_Port2:2; // Byte 3 - Bits 4-5
  78. ULONG SID_Port1:2; // Byte 3 - Bits 6-7
  79. } SELF_ID, *PSELF_ID;
  80. //
  81. // Additional 1394 Self ID packet format (only used when More bit is on)
  82. //
  83. typedef struct _SELF_ID_MORE {
  84. ULONG SID_Phys_ID:6; // Byte 0 - Bits 0-5
  85. ULONG SID_Packet_ID:2; // Byte 0 - Bits 6-7
  86. ULONG SID_PortA:2; // Byte 1 - Bits 0-1
  87. ULONG SID_Reserved2:2; // Byte 1 - Bits 2-3
  88. ULONG SID_Sequence:3; // Byte 1 - Bits 4-6
  89. ULONG SID_One:1; // Byte 1 - Bit 7
  90. ULONG SID_PortE:2; // Byte 2 - Bits 0-1
  91. ULONG SID_PortD:2; // Byte 2 - Bits 2-3
  92. ULONG SID_PortC:2; // Byte 2 - Bits 4-5
  93. ULONG SID_PortB:2; // Byte 2 - Bits 6-7
  94. ULONG SID_More_Packets:1; // Byte 3 - Bit 0
  95. ULONG SID_Reserved3:1; // Byte 3 - Bit 1
  96. ULONG SID_PortH:2; // Byte 3 - Bits 2-3
  97. ULONG SID_PortG:2; // Byte 3 - Bits 4-5
  98. ULONG SID_PortF:2; // Byte 3 - Bits 6-7
  99. } SELF_ID_MORE, *PSELF_ID_MORE;
  100. //
  101. // 1394 Phy Configuration packet format
  102. //
  103. typedef struct _PHY_CONFIGURATION_PACKET {
  104. ULONG PCP_Phys_ID:6; // Byte 0 - Bits 0-5
  105. ULONG PCP_Packet_ID:2; // Byte 0 - Bits 6-7
  106. ULONG PCP_Gap_Count:6; // Byte 1 - Bits 0-5
  107. ULONG PCP_Set_Gap_Count:1; // Byte 1 - Bit 6
  108. ULONG PCP_Force_Root:1; // Byte 1 - Bit 7
  109. ULONG PCP_Reserved1:8; // Byte 2 - Bits 0-7
  110. ULONG PCP_Reserved2:8; // Byte 3 - Bits 0-7
  111. ULONG PCP_Inverse; // Inverse quadlet
  112. } PHY_CONFIGURATION_PACKET, *PPHY_CONFIGURATION_PACKET;
  113. //
  114. // 1394 Asynchronous packet format
  115. //
  116. typedef struct _ASYNC_PACKET {
  117. USHORT AP_Priority:4; // Bits 0-3 1st quadlet
  118. USHORT AP_tCode:4; // Bits 4-7
  119. USHORT AP_rt:2; // Bits 8-9
  120. USHORT AP_tLabel:6; // Bits 10-15
  121. NODE_ADDRESS AP_Destination_ID; // Bits 16-31
  122. union { // 2nd quadlet
  123. struct {
  124. USHORT AP_Reserved:12; // Bits 0-11
  125. USHORT AP_Rcode:4; // Bits 12-15
  126. } Response;
  127. USHORT AP_Offset_High; // Bits 0-15
  128. } u;
  129. NODE_ADDRESS AP_Source_ID; // Bits 16-31
  130. ULONG AP_Offset_Low; // Bits 0-31 3rd quadlet
  131. union { // 4th quadlet
  132. struct {
  133. USHORT AP_Extended_tCode; // Bits 0-15
  134. USHORT AP_Data_Length; // Bits 16-31
  135. } Block;
  136. ULONG AP_Quadlet_Data; // Bits 0-31
  137. } u1;
  138. } ASYNC_PACKET, *PASYNC_PACKET;
  139. //
  140. // 1394 Isochronous packet header
  141. //
  142. typedef struct _ISOCH_HEADER {
  143. ULONG IH_Sy:4; // Bits 0-3
  144. ULONG IH_tCode:4; // Bits 4-7
  145. ULONG IH_Channel:6; // Bits 8-13
  146. ULONG IH_Tag:2; // Bits 14-15
  147. ULONG IH_Data_Length:16; // Bits 16-31
  148. } ISOCH_HEADER, *PISOCH_HEADER;
  149. //
  150. // 1394 Topology Map format
  151. //
  152. typedef struct _TOPOLOGY_MAP {
  153. USHORT TOP_Length; // number of quadlets in map
  154. USHORT TOP_CRC; // 16 bit CRC defined by 1212
  155. ULONG TOP_Generation; // Generation number
  156. USHORT TOP_Node_Count; // Node count
  157. USHORT TOP_Self_ID_Count; // Number of Self IDs
  158. SELF_ID TOP_Self_ID_Array[1]; // Array of Self IDs
  159. } TOPOLOGY_MAP, *PTOPOLOGY_MAP;
  160. //
  161. // 1394 Speed Map format
  162. //
  163. typedef struct _SPEED_MAP {
  164. USHORT SPD_Length; // number of quadlets in map
  165. USHORT SPD_CRC; // 16 bit CRC defined by 1212
  166. ULONG SPD_Generation; // Generation number
  167. UCHAR SPD_Speed_Code[4032];
  168. } SPEED_MAP, *PSPEED_MAP;
  169. //
  170. // 1394 Config Rom format (always at 0xffff f0000400 : IEEE 1212)
  171. //
  172. typedef struct _CONFIG_ROM {
  173. ULONG CR_Info; // 0x0
  174. ULONG CR_Signiture; // 0x4 // bus info block
  175. ULONG CR_BusInfoBlockCaps; // 0x8 // "
  176. ULONG CR_Node_UniqueID[2]; // 0xC // "
  177. ULONG CR_Root_Info; // 0x14
  178. //
  179. // the rest is the root directory which has variable definition and length
  180. //
  181. } CONFIG_ROM, *PCONFIG_ROM;
  182. //
  183. // 1394A Network channels register format
  184. //
  185. typedef struct _NETWORK_CHANNELS {
  186. ULONG NC_Channel:6; // bits 0-5
  187. ULONG NC_Reserved:18; // bits 6-23
  188. ULONG NC_Npm_ID:6; // bits 24-29
  189. ULONG NC_Valid:1; // bit 30
  190. ULONG NC_One:1; // bit 31
  191. } NETWORK_CHANNELSR, *PNETWORK_CHANNELS;
  192. //
  193. // 1394 Textual Leaf format
  194. //
  195. typedef struct _TEXTUAL_LEAF {
  196. USHORT TL_CRC; // using 1994 CRC algorithm
  197. USHORT TL_Length; // length of leaf in quads
  198. ULONG TL_Spec_Id; // vendor defined
  199. ULONG TL_Language_Id; // language Id
  200. UCHAR TL_Data; // variable length data
  201. } TEXTUAL_LEAF, *PTEXTUAL_LEAF;
  202. //
  203. // 1394 Cycle Time format
  204. //
  205. typedef struct _CYCLE_TIME {
  206. ULONG CL_CycleOffset:12; // Bits 0-11
  207. ULONG CL_CycleCount:13; // Bits 12-24
  208. ULONG CL_SecondCount:7; // Bits 25-31
  209. } CYCLE_TIME, *PCYCLE_TIME;
  210. // @@BEGIN_DDKSPLIT
  211. //
  212. // Information block the port driver passes to the bus driver when a
  213. // bus reset occurs
  214. //
  215. typedef struct _BUS_RESET_INFO {
  216. ULONG BusResetFlags; // State of the bus reset
  217. NODE_ADDRESS LocalNodeAddress; // Port driver's node Id
  218. NODE_ADDRESS IsochMgrNodeAddress; // Isoch mgr node id
  219. ULONG BusResetGeneration; // current generation number
  220. } BUS_RESET_INFO, *PBUS_RESET_INFO;
  221. //
  222. // Information block the port driver passes to the bus driver when the
  223. // indication handler is called
  224. //
  225. typedef struct _INDICATION_INFO {
  226. ULONG IndicationFlags; // Used by Port and Bus
  227. PVOID IndicationContext; // Bus returns this
  228. ULONG RequesttCode; // Port provides this
  229. PASYNC_PACKET RequestPacket; // Port provides this
  230. ULONG RequestPacketLength; // Port provides this
  231. PMDL ResponseMdl; // Port provides, Bus fills in
  232. PVOID ResponseData; // Bus returns this
  233. ULONG ResponseLength; // Bus returns this
  234. } INDICATION_INFO, *PINDICATION_INFO;
  235. // @@END_DDKSPLIT
  236. //
  237. // Definition of an Address Mapping FIFO element
  238. //
  239. typedef struct _ADDRESS_FIFO {
  240. SINGLE_LIST_ENTRY FifoList; // Singly linked list
  241. PMDL FifoMdl; // Mdl for this FIFO element
  242. } ADDRESS_FIFO, *PADDRESS_FIFO;
  243. //
  244. // Information block the bus driver passes to the higher device drivers
  245. // when the notification handler is called
  246. //
  247. typedef struct _NOTIFICATION_INFO {
  248. PMDL Mdl; // Supplied by device driver
  249. ULONG ulOffset; // Where in buffer
  250. ULONG nLength; // How big is the operation
  251. ULONG fulNotificationOptions; // Which option occurred
  252. PVOID Context; // Device driver supplied
  253. PADDRESS_FIFO Fifo; // FIFO that completed
  254. PVOID RequestPacket; // Pointer to request packet
  255. PMDL ResponseMdl; // Pointer to response MDL
  256. PVOID * ResponsePacket; // Pointer to pointer to response packet
  257. PULONG ResponseLength; // Pointer to length of response
  258. PKEVENT * ResponseEvent; // Event to be signaled
  259. RCODE ResponseCode; // RCode to be returned for request
  260. } NOTIFICATION_INFO, *PNOTIFICATION_INFO;
  261. //
  262. // Various definitions
  263. //
  264. #include <initguid.h>
  265. DEFINE_GUID( BUS1394_CLASS_GUID, 0x6BDD1FC1, 0x810F, 0x11d0, 0xBE, 0xC7, 0x08, 0x00, 0x2B, 0xE2, 0x09, 0x2F);
  266. #define IOCTL_1394_CLASS CTL_CODE( \
  267. FILE_DEVICE_UNKNOWN, \
  268. 0x87, \
  269. METHOD_IN_DIRECT, \
  270. FILE_ANY_ACCESS \
  271. )
  272. //
  273. // these guys are meant to be called from a ring 3 app
  274. // call through the port device object
  275. //
  276. #define IOCTL_1394_TOGGLE_ENUM_TEST_ON CTL_CODE( \
  277. FILE_DEVICE_UNKNOWN, \
  278. 0x88, \
  279. METHOD_BUFFERED, \
  280. FILE_ANY_ACCESS \
  281. )
  282. #define IOCTL_1394_TOGGLE_ENUM_TEST_OFF CTL_CODE( \
  283. FILE_DEVICE_UNKNOWN, \
  284. 0x89, \
  285. METHOD_BUFFERED, \
  286. FILE_ANY_ACCESS \
  287. )
  288. //
  289. // 1394 ByteSwap definitions
  290. //
  291. #define bswap(value) RtlUlongByteSwap(value)
  292. #define bswapw(value) RtlUshortByteSwap(value)
  293. //
  294. // 1394 Transaction codes
  295. //
  296. #define TCODE_WRITE_REQUEST_QUADLET 0 // 0000b
  297. #define TCODE_WRITE_REQUEST_BLOCK 1 // 0001b
  298. #define TCODE_WRITE_RESPONSE 2 // 0010b
  299. #define TCODE_RESERVED1 3
  300. #define TCODE_READ_REQUEST_QUADLET 4 // 0100b
  301. #define TCODE_READ_REQUEST_BLOCK 5 // 0101b
  302. #define TCODE_READ_RESPONSE_QUADLET 6 // 0110b
  303. #define TCODE_READ_RESPONSE_BLOCK 7 // 0111b
  304. #define TCODE_CYCLE_START 8 // 1000b
  305. #define TCODE_LOCK_REQUEST 9 // 1001b
  306. #define TCODE_ISOCH_DATA_BLOCK 10 // 1010b
  307. #define TCODE_LOCK_RESPONSE 11 // 1011b
  308. #define TCODE_RESERVED2 12
  309. #define TCODE_RESERVED3 13
  310. #define TCODE_SELFID 14
  311. #define TCODE_RESERVED4 15
  312. #define TCODE_REQUEST_BLOCK_MASK 1
  313. #define TCODE_RESPONSE_MASK 2
  314. //
  315. // 1394 Extended Transaction codes
  316. //
  317. #define EXT_TCODE_RESERVED0 0
  318. #define EXT_TCODE_MASK_SWAP 1
  319. #define EXT_TCODE_COMPARE_SWAP 2
  320. #define EXT_TCODE_FETCH_ADD 3
  321. #define EXT_TCODE_LITTLE_ADD 4
  322. #define EXT_TCODE_BOUNDED_ADD 5
  323. #define EXT_TCODE_WRAP_ADD 6
  324. //
  325. // 1394 Acknowledgement codes
  326. //
  327. #define ACODE_RESERVED_0 0
  328. #define ACODE_ACK_COMPLETE 1
  329. #define ACODE_ACK_PENDING 2
  330. #define ACODE_RESERVED_3 3
  331. #define ACODE_ACK_BUSY_X 4
  332. #define ACODE_ACK_BUSY_A 5
  333. #define ACODE_ACK_BUSY_B 6
  334. #define ACODE_RESERVED_7 7
  335. #define ACODE_RESERVED_8 8
  336. #define ACODE_RESERVED_9 9
  337. #define ACODE_RESERVED_10 10
  338. #define ACODE_RESERVED_11 11
  339. #define ACODE_RESERVED_12 12
  340. #define ACODE_ACK_DATA_ERROR 13
  341. #define ACODE_ACK_TYPE_ERROR 14
  342. #define ACODE_RESERVED_15 15
  343. //
  344. // 1394 Ack code to NT status mask (to be OR'd in when completing IRPs)
  345. //
  346. #define ACODE_STATUS_MASK ((NTSTATUS)0xC0120070L)
  347. //
  348. // 1394 Response codes
  349. //
  350. #define RCODE_RESPONSE_COMPLETE 0
  351. #define RCODE_RESERVED1 1
  352. #define RCODE_RESERVED2 2
  353. #define RCODE_RESERVED3 3
  354. #define RCODE_CONFLICT_ERROR 4
  355. #define RCODE_DATA_ERROR 5
  356. #define RCODE_TYPE_ERROR 6
  357. #define RCODE_ADDRESS_ERROR 7
  358. #define RCODE_TIMED_OUT 15
  359. //
  360. // 1394 Response code to NT status mask (to be OR'd in when completing IRPs)
  361. //
  362. #define RCODE_STATUS_MASK ((NTSTATUS)0xC0120080L)
  363. #define STATUS_INVALID_GENERATION ((NTSTATUS)0xC0120090L)
  364. //
  365. // 1394 Speed codes
  366. //
  367. #define SCODE_100_RATE 0
  368. #define SCODE_200_RATE 1
  369. #define SCODE_400_RATE 2
  370. #define SCODE_800_RATE 3
  371. #define SCODE_1600_RATE 4
  372. #define SCODE_3200_RATE 5
  373. //
  374. // 1394 Self ID definitions
  375. //
  376. #define SELF_ID_CONNECTED_TO_CHILD 3
  377. #define SELF_ID_CONNECTED_TO_PARENT 2
  378. #define SELF_ID_NOT_CONNECTED 1
  379. #define SELF_ID_NOT_PRESENT 0
  380. //
  381. // 1394 Self ID Power Class definitions
  382. //
  383. #define POWER_CLASS_NOT_NEED_NOT_REPEAT 0
  384. #define POWER_CLASS_SELF_POWER_PROVIDE_15W 1
  385. #define POWER_CLASS_SELF_POWER_PROVIDE_30W 2
  386. #define POWER_CLASS_SELF_POWER_PROVIDE_45W 3
  387. #define POWER_CLASS_MAYBE_POWERED_UPTO_1W 4
  388. #define POWER_CLASS_IS_POWERED_UPTO_1W_NEEDS_2W 5
  389. #define POWER_CLASS_IS_POWERED_UPTO_1W_NEEDS_5W 6
  390. #define POWER_CLASS_IS_POWERED_UPTO_1W_NEEDS_9W 7
  391. //
  392. // 1394 Phy Packet Ids
  393. //
  394. #define PHY_PACKET_ID_CONFIGURATION 0
  395. #define PHY_PACKET_ID_LINK_ON 1
  396. #define PHY_PACKET_ID_SELF_ID 2
  397. //
  398. // Various Interesting 1394 IEEE 1212 locations
  399. //
  400. #define INITIAL_REGISTER_SPACE_HI 0xffff
  401. #define INITIAL_REGISTER_SPACE_LO 0xf0000000
  402. #define STATE_CLEAR_LOCATION 0x000
  403. #define STATE_SET_LOCATION 0x004
  404. #define NODE_IDS_LOCATION 0x008
  405. #define RESET_START_LOCATION 0x00C
  406. #define SPLIT_TIMEOUT_HI_LOCATION 0x018
  407. #define SPLIT_TIMEOUT_LO_LOCATION 0x01C
  408. #define INTERRUPT_TARGET_LOCATION 0x050
  409. #define INTERRUPT_MASK_LOCATION 0x054
  410. #define CYCLE_TIME_LOCATION 0x200
  411. #define BUS_TIME_LOCATION 0x204
  412. #define POWER_FAIL_IMMINENT_LOCATION 0x208
  413. #define POWER_SOURCE_LOCATION 0x20C
  414. #define BUSY_TIMEOUT_LOCATION 0x210
  415. #define BUS_MANAGER_ID_LOCATION 0x21C
  416. #define BANDWIDTH_AVAILABLE_LOCATION 0x220
  417. #define CHANNELS_AVAILABLE_LOCATION 0x224
  418. #define NETWORK_CHANNELS_LOCATION 0x234
  419. #define CONFIG_ROM_LOCATION 0x400
  420. #define TOPOLOGY_MAP_LOCATION 0x1000
  421. #define SPEED_MAP_LOCATION 0x2000
  422. //
  423. // 1394 Configuration key values and masks
  424. //
  425. #define CONFIG_ROM_KEY_MASK 0x000000ff
  426. #define CONFIG_ROM_OFFSET_MASK 0xffffff00
  427. #define MODULE_VENDOR_ID_KEY_SIGNATURE 0x03
  428. #define NODE_CAPABILITIES_KEY_SIGNATURE 0x0c
  429. #define SPEC_ID_KEY_SIGNATURE 0x12
  430. #define SOFTWARE_VERSION_KEY_SIGNATURE 0x13
  431. #define MODEL_ID_KEY_SIGNATURE 0x17
  432. #define COMMAND_BASE_KEY_SIGNATURE 0x40
  433. #define VENDOR_KEY_SIGNATURE 0x81
  434. #define TEXTUAL_LEAF_INDIRECT_KEY_SIGNATURE 0x81
  435. #define MODEL_KEY_SIGNATURE 0x82
  436. #define UNIT_DIRECTORY_KEY_SIGNATURE 0xd1
  437. #define UNIT_DEP_DIR_KEY_SIGNATURE 0xd4
  438. //
  439. // 1394 Async Data Payload Sizes
  440. //
  441. #define ASYNC_PAYLOAD_100_RATE 512
  442. #define ASYNC_PAYLOAD_200_RATE 1024
  443. #define ASYNC_PAYLOAD_400_RATE 2048
  444. //
  445. // 1394 Isoch Data Payload Sizes
  446. //
  447. #define ISOCH_PAYLOAD_50_RATE 512
  448. #define ISOCH_PAYLOAD_100_RATE 1024
  449. #define ISOCH_PAYLOAD_200_RATE 2048
  450. #define ISOCH_PAYLOAD_400_RATE 4096
  451. #define ISOCH_PAYLOAD_800_RATE 8192
  452. #define ISOCH_PAYLOAD_1600_RATE 16384
  453. //
  454. // Various definitions
  455. //
  456. #define S100_BW_UNITS_PER_QUADLET 19 // Per quad per frame
  457. #define S200_BW_UNITS_PER_QUADLET 9 // Per quad per frame
  458. #define S400_BW_UNITS_PER_QUADLET 4 // Per quad per frame
  459. #define S800_BW_UNITS_PER_QUADLET 2 // Per quad per frame
  460. #define S1600_BW_UNITS_PER_QUADLET 1 // Per quad per frame
  461. #define INITIAL_BANDWIDTH_UNITS 4915 // Initial bandwidth units
  462. #define MAX_REC_100_RATE 0x08 // 1000b
  463. #define MAX_REC_200_RATE 0x09 // 1001b
  464. #define MAX_REC_400_RATE 0x0a // 1010b
  465. #define LOCAL_BUS 0x3ff
  466. #define MAX_LOCAL_NODES 64
  467. #define SELFID_PACKET_SIGNITURE 2
  468. #define NOMINAL_CYCLE_TIME 125 // Microseconds
  469. #define NO_BUS_MANAGER 0x3f
  470. #define SPEED_MAP_LENGTH 0x3f1
  471. #define DEVICE_EXTENSION_TAG 0xdeadbeef
  472. #define VIRTUAL_DEVICE_EXTENSION_TAG 0xdeafbeef
  473. #define PORT_EXTENSION_TAG 0xdeafcafe
  474. #define BUS_EXTENSION_TAG 0xabacadab
  475. #define ISOCH_RESOURCE_TAG 0xbabeface
  476. #define BANDWIDTH_ALLOCATE_TAG 0xfeedbead
  477. #define CONFIG_ROM_SIGNATURE 0x31333934
  478. //
  479. // IRB function number definitions.
  480. //
  481. #define REQUEST_ASYNC_READ 0
  482. #define REQUEST_ASYNC_WRITE 1
  483. #define REQUEST_ASYNC_LOCK 2
  484. #define REQUEST_ISOCH_ALLOCATE_BANDWIDTH 3
  485. #define REQUEST_ISOCH_ALLOCATE_CHANNEL 4
  486. #define REQUEST_ISOCH_ALLOCATE_RESOURCES 5
  487. #define REQUEST_ISOCH_ATTACH_BUFFERS 6
  488. #define REQUEST_ISOCH_DETACH_BUFFERS 7
  489. #define REQUEST_ISOCH_FREE_BANDWIDTH 8
  490. #define REQUEST_ISOCH_FREE_CHANNEL 9
  491. #define REQUEST_ISOCH_FREE_RESOURCES 10
  492. #define REQUEST_ISOCH_LISTEN 11
  493. #define REQUEST_ISOCH_STOP 12
  494. #define REQUEST_ISOCH_TALK 13
  495. #define REQUEST_ISOCH_QUERY_CYCLE_TIME 14
  496. #define REQUEST_ISOCH_QUERY_RESOURCES 15
  497. #define REQUEST_ISOCH_SET_CHANNEL_BANDWIDTH 16
  498. #define REQUEST_ALLOCATE_ADDRESS_RANGE 17
  499. #define REQUEST_FREE_ADDRESS_RANGE 18
  500. #define REQUEST_GET_LOCAL_HOST_INFO 19
  501. #define REQUEST_GET_ADDR_FROM_DEVICE_OBJECT 20
  502. #define REQUEST_CONTROL 21
  503. #define REQUEST_GET_SPEED_BETWEEN_DEVICES 22
  504. #define REQUEST_SET_DEVICE_XMIT_PROPERTIES 23
  505. #define REQUEST_GET_CONFIGURATION_INFO 24
  506. #define REQUEST_BUS_RESET 25
  507. #define REQUEST_GET_GENERATION_COUNT 26
  508. #define REQUEST_SEND_PHY_CONFIG_PACKET 27
  509. #define REQUEST_GET_SPEED_TOPOLOGY_MAPS 28
  510. #define REQUEST_BUS_RESET_NOTIFICATION 29
  511. #define REQUEST_ASYNC_STREAM 30
  512. #define REQUEST_SET_LOCAL_HOST_PROPERTIES 31
  513. #define REQUEST_ISOCH_MODIFY_STREAM_PROPERTIES 32
  514. #define IRB_BUS_RESERVED_SZ 8
  515. #define IRB_PORT_RESERVED_SZ 8
  516. // @@BEGIN_DDKSPLIT
  517. //
  518. // Definition of 1394 bus/port routines
  519. //
  520. typedef
  521. NTSTATUS
  522. (*PPORT_PNP_ROUTINE) (
  523. IN PDEVICE_OBJECT DeviceObject,
  524. IN PIRP Irp
  525. );
  526. typedef
  527. NTSTATUS
  528. (*PPORT_POWER_ROUTINE) (
  529. IN PDEVICE_OBJECT DeviceObject,
  530. IN PIRP Irp
  531. );
  532. typedef
  533. NTSTATUS
  534. (*PPORT_SYSTEM_CONTROL_ROUTINE) (
  535. IN PDEVICE_OBJECT DeviceObject,
  536. IN PIRP Irp
  537. );
  538. typedef
  539. NTSTATUS
  540. (*PBUS_OPEN_ROUTINE) (
  541. IN PDEVICE_OBJECT DeviceObject,
  542. IN PIRP Irp
  543. );
  544. typedef
  545. NTSTATUS
  546. (*PBUS_IOCTL_ROUTINE) (
  547. IN PDEVICE_OBJECT DeviceObject,
  548. IN PIRP Irp
  549. );
  550. typedef
  551. NTSTATUS
  552. (*PBUS_CLOSE_ROUTINE) (
  553. IN PDEVICE_OBJECT DeviceObject,
  554. IN PIRP Irp
  555. );
  556. typedef
  557. NTSTATUS
  558. (*PBUS_PNP_ROUTINE) (
  559. IN PDEVICE_OBJECT DeviceObject,
  560. IN PIRP Irp
  561. );
  562. typedef
  563. NTSTATUS
  564. (*PBUS_POWER_ROUTINE) (
  565. IN PDEVICE_OBJECT DeviceObject,
  566. IN PIRP Irp
  567. );
  568. typedef
  569. NTSTATUS
  570. (*PBUS_SYSTEM_CONTROL_ROUTINE) (
  571. IN PDEVICE_OBJECT DeviceObject,
  572. IN PIRP Irp
  573. );
  574. typedef
  575. VOID
  576. (*PBUS_BUS_RESET_ROUTINE) ( // Must be called at
  577. IN PDEVICE_OBJECT PortDeviceObject, // DISPATCH_LEVEL
  578. IN PBUS_RESET_INFO BusResetInfo
  579. );
  580. typedef
  581. RCODE
  582. (*PBUS_INDICATION_ROUTINE) ( // Must be called at
  583. IN PDEVICE_OBJECT PortDeviceObject, // DISPATCH_LEVEL
  584. IN PINDICATION_INFO IndicationInfo
  585. );
  586. typedef
  587. VOID
  588. (*PBUS_INDICATION_COMPLETE_ROUTINE) ( // Must be called at
  589. IN PDEVICE_OBJECT PortDeviceObject, // DISPATCH_LEVEL
  590. IN PVOID IndicationContext
  591. );
  592. //
  593. // Definition of port driver initialization data
  594. //
  595. typedef struct _PORT_INITIALIZATION_DATA {
  596. //
  597. // Holds the sizeof this structure, this is effectively a version check
  598. //
  599. ULONG PortInitDataSize;
  600. //
  601. // Driver Object of the port driver
  602. //
  603. PDRIVER_OBJECT PortDriverObject;
  604. //
  605. // Device Object of the port driver
  606. //
  607. PDEVICE_OBJECT PortDeviceObject;
  608. //
  609. // The physical device object that was handed to port driver by PnP
  610. //
  611. PDEVICE_OBJECT PhysicalDeviceObject;
  612. //
  613. // Device Extension of the port driver
  614. //
  615. PVOID PortDeviceExtension;
  616. //
  617. // Capabilities of the port driver
  618. //
  619. ULONG PortCapabilities;
  620. //
  621. // Holds the speed flags that the port driver supports
  622. //
  623. ULONG PortSpeed;
  624. //
  625. // Holds the Id number of the port/bus DeviceObject name, i.e. 0 if
  626. // the name was 1394BUS0, 1 if the name was 1394BUS1, etc.
  627. //
  628. ULONG PortId;
  629. //
  630. // Holds the maximum Async Read request the port driver supports
  631. //
  632. ULONG PortMaxAsyncReadRequest;
  633. //
  634. // Holds the maximum Async Write request the port driver supports
  635. //
  636. ULONG PortMaxAsyncWriteRequest;
  637. //
  638. // Pointer to 1394 Port driver's PnP routine
  639. //
  640. PPORT_PNP_ROUTINE PortPnP;
  641. //
  642. // Pointer to 1394 Port driver's Power routine
  643. //
  644. PPORT_POWER_ROUTINE PortPower;
  645. //
  646. // Pointer to 1394 Bus driver's Open routine
  647. //
  648. PBUS_OPEN_ROUTINE BusOpen;
  649. //
  650. // Pointer to 1394 Bus driver's IOCtl routine
  651. //
  652. PBUS_IOCTL_ROUTINE BusIOCtl;
  653. //
  654. // Pointer to 1394 Bus driver's Close routine
  655. //
  656. PBUS_CLOSE_ROUTINE BusClose;
  657. //
  658. // Pointer to 1394 Bus driver's PnP routine
  659. //
  660. PBUS_PNP_ROUTINE BusPnP;
  661. //
  662. // Pointer to 1394 Bus driver's Power routine
  663. //
  664. PBUS_POWER_ROUTINE BusPower;
  665. //
  666. // Pointer to 1394 Bus driver's Bus Reset routine
  667. //
  668. PBUS_BUS_RESET_ROUTINE BusReset;
  669. //
  670. // Pointer to 1394 Bus driver's Asynchronous Indication routine
  671. //
  672. PBUS_INDICATION_ROUTINE BusIndication;
  673. //
  674. // Pointer to 1394 Bus driver's Asynchronous Indication complete routine
  675. //
  676. PBUS_INDICATION_COMPLETE_ROUTINE BusIndicationComplete;
  677. //
  678. // Pointer to 1394 Bus driver's Topology Map
  679. //
  680. PTOPOLOGY_MAP BusTopologyMap;
  681. // WMI
  682. //
  683. // Pointer to 1394 Bus driver's Power routine
  684. //
  685. PBUS_SYSTEM_CONTROL_ROUTINE BusSystemControl;
  686. //
  687. // Pointer to 1394 Port driver's Power routine
  688. //
  689. PPORT_SYSTEM_CONTROL_ROUTINE PortSystemControl;
  690. //
  691. // number of port proprietery WMI GUIDS
  692. //
  693. ULONG PortMaxWmiGuidsSupported;
  694. //
  695. // PORT driver registry path
  696. //
  697. PUNICODE_STRING PortRegistryPath;
  698. } PORT_INITIALIZATION_DATA, *PPORT_INITIALIZATION_DATA;
  699. NTSTATUS
  700. Bus1394RegisterPortDriver(
  701. IN PPORT_INITIALIZATION_DATA PortInitData
  702. );
  703. //
  704. // Device Extension common of the 1394 Port drivers. The first two fields
  705. // of a port driver's DeviceExtension shall always be the Tag and the Bus
  706. // driver's DeviceExtension. What follows these two fields is up to writer
  707. // of the individual Port driver. The Tag field must be initialized to
  708. // PORT_EXTENSION_TAG (above), and the BusExtension field pointer must be
  709. // initialized to BUS_EXTENSION_TAG (above).
  710. //
  711. typedef struct _PORT_EXTENSION {
  712. //
  713. // Holds Tag to determine if this is really a "Port" Device Extension
  714. //
  715. ULONG Tag;
  716. //
  717. // Holds the Pointer to the Bus Driver's context
  718. //
  719. PVOID BusExtension;
  720. //
  721. // The rest off this struct is TBD per each individual port driver
  722. //
  723. } PORT_EXTENSION, *PPORT_EXTENSION;
  724. // @@END_DDKSPLIT
  725. typedef
  726. VOID
  727. (*PBUS_NOTIFICATION_ROUTINE) ( // We will call this routine
  728. IN PNOTIFICATION_INFO NotificationInfo // at DISPATCH_LEVEL
  729. );
  730. typedef
  731. VOID
  732. (*PBUS_ISOCH_DESCRIPTOR_ROUTINE) ( // We will call this routine
  733. IN PVOID Context1, // at DISPATCH_LEVEL
  734. IN PVOID Context2
  735. );
  736. typedef
  737. VOID
  738. (*PBUS_BUS_RESET_NOTIFICATION) ( // We will call this routine
  739. IN PVOID Context // at DISPATCH_LEVEL
  740. );
  741. //
  742. // Device Extension common to all nodes that the 1394 Bus driver
  743. // created when it enumerated the bus and found a new unique node
  744. //
  745. typedef struct _NODE_DEVICE_EXTENSION {
  746. //
  747. // Holds Tag to determine if this is really a "Node" Device Extension
  748. //
  749. ULONG Tag;
  750. //
  751. // Holds the flag as to whether or not we've read the configuration
  752. // information out of this device.
  753. //
  754. BOOLEAN bConfigurationInformationValid;
  755. //
  756. // Holds the Configuration Rom for this device. Multi-functional
  757. // devices (i.e. many units) will share this same Config Rom
  758. // structure, but they are represented as a different Device Object.
  759. // This is not the entire Config Rom, but does contain the root directory
  760. // as well as everything in front of it.
  761. //
  762. PCONFIG_ROM ConfigRom;
  763. //
  764. // Holds the length of the UnitDirectory pointer.
  765. //
  766. ULONG UnitDirectoryLength;
  767. //
  768. // Holds the Unit Directory for this device. Even on multi-functional
  769. // devices (i.e. many units) this should be unique to each Device Object.
  770. //
  771. PVOID UnitDirectory;
  772. //
  773. // Holds the Unit Directory location for this device. Only the lower 48
  774. // bits are valid in this IO_ADDRESS. Useful for computing offsets from
  775. // within the UnitDirectory as all offsets are relative.
  776. //
  777. IO_ADDRESS UnitDirectoryLocation;
  778. //
  779. // Holds the length of the UnitDependentDirectory pointer.
  780. //
  781. ULONG UnitDependentDirectoryLength;
  782. //
  783. // Holds the Unit Dependent directory for this device.
  784. //
  785. PVOID UnitDependentDirectory;
  786. //
  787. // Holds the Unit Dependent Directory location for this device. Only the
  788. // lower 48 bits are valid in this IO_ADDRESS. Useful for computing
  789. // offsets from within the UnitDependentDirectory as offsets are relative.
  790. //
  791. IO_ADDRESS UnitDependentDirectoryLocation;
  792. //
  793. // Holds the length of the VendorLeaf pointer.
  794. //
  795. ULONG VendorLeafLength;
  796. //
  797. // Holds the pointer to the Vendor Leaf information
  798. //
  799. PTEXTUAL_LEAF VendorLeaf;
  800. //
  801. // Holds the length of the VendorLeaf pointer.
  802. //
  803. ULONG ModelLeafLength;
  804. //
  805. // Holds the pointer to the Model Leaf information
  806. //
  807. PTEXTUAL_LEAF ModelLeaf;
  808. //
  809. // Holds the 1394 10 bit BusId / 6 bit NodeId structure
  810. //
  811. NODE_ADDRESS NodeAddress;
  812. //
  813. // Holds the speed to be used in reaching this device
  814. //
  815. UCHAR Speed;
  816. //
  817. // Holds the priority at which to send packets
  818. //
  819. UCHAR Priority;
  820. //
  821. // Holds the Irp used to notify this device object about events
  822. //
  823. PIRP Irp;
  824. //
  825. // Holds the Device Object that this Device Extension hangs off of
  826. //
  827. PDEVICE_OBJECT DeviceObject;
  828. //
  829. // Holds the Port Device Object that this Device hangs off of
  830. //
  831. PDEVICE_OBJECT PortDeviceObject;
  832. //
  833. // Holds the pointer to corresponding information about this deivce
  834. // in the bus driver's head.
  835. //
  836. PVOID DeviceInformation;
  837. //
  838. // Holds the pointer to the bus reset notification routine (if any)
  839. //
  840. PBUS_BUS_RESET_NOTIFICATION ResetRoutine;
  841. //
  842. // Holds the pointer to the context the client wanted when bus reset occurs
  843. //
  844. PVOID ResetContext;
  845. } NODE_DEVICE_EXTENSION, *PNODE_DEVICE_EXTENSION;
  846. //
  847. // Definition of Isoch descriptor
  848. //
  849. typedef struct _ISOCH_DESCRIPTOR {
  850. //
  851. // Flags (used in synchronization)
  852. //
  853. ULONG fulFlags;
  854. //
  855. // Mdl pointing to buffer
  856. //
  857. PMDL Mdl;
  858. //
  859. // Length of combined buffer(s) as represented by the Mdl
  860. //
  861. ULONG ulLength;
  862. //
  863. // Payload size of each Isoch packet to be used in this descriptor
  864. //
  865. ULONG nMaxBytesPerFrame;
  866. //
  867. // Synchronization field; equivalent to Sy in the Isoch packet
  868. //
  869. ULONG ulSynch;
  870. //
  871. // Synchronization field; equivalent to Tag in the Isoch packet
  872. //
  873. ULONG ulTag;
  874. //
  875. // Cycle time field; returns time to be sent/received or when finished
  876. //
  877. CYCLE_TIME CycleTime;
  878. //
  879. // Callback routine (if any) to be called when this descriptor completes
  880. //
  881. PBUS_ISOCH_DESCRIPTOR_ROUTINE Callback;
  882. //
  883. // First context (if any) parameter to be passed when doing callbacks
  884. //
  885. PVOID Context1;
  886. //
  887. // Second context (if any) parameter to be passed when doing callbacks
  888. //
  889. PVOID Context2;
  890. //
  891. // Holds the final status of this descriptor
  892. //
  893. NTSTATUS status;
  894. //
  895. // Reserved for the device driver who submitted this descriptor to
  896. // stomp in.
  897. //
  898. ULONG_PTR DeviceReserved[8];
  899. //
  900. // Reserved for the bus driver to stomp in
  901. //
  902. ULONG_PTR BusReserved[8];
  903. //
  904. // Reserved for the port driver to stomp in
  905. //
  906. ULONG_PTR PortReserved[16];
  907. } ISOCH_DESCRIPTOR, *PISOCH_DESCRIPTOR;
  908. //
  909. // definition of header element for scatter/gather support
  910. //
  911. typedef struct _IEEE1394_SCATTER_GATHER_HEADER{
  912. USHORT HeaderLength;
  913. USHORT DataLength;
  914. UCHAR HeaderData;
  915. } IEEE1394_SCATTER_GATHER_HEADER, *PIEEE1394_SCATTER_GATHER_HEADER;
  916. //
  917. // Definition of Bandwidth allocation structure
  918. //
  919. typedef struct _BANDWIDTH_ALLOCATION {
  920. //
  921. // Holds the list of allocation entries
  922. //
  923. LIST_ENTRY AllocationList;
  924. //
  925. // Holds the tag of this structure
  926. //
  927. ULONG Tag;
  928. //
  929. // Holds the Bandwidth units that this allocation owns
  930. //
  931. ULONG OwnedUnits;
  932. //
  933. // Holds the speed at which this bandwidth was allocated
  934. //
  935. ULONG fulSpeed;
  936. //
  937. // Holds whether or not this was a local or remote allocation
  938. //
  939. BOOLEAN bRemoteAllocation;
  940. //
  941. // Holds the generation of the bus when this bandwidth was secured
  942. //
  943. ULONG Generation;
  944. //
  945. // Holds the owner of this allocation
  946. //
  947. PNODE_DEVICE_EXTENSION DeviceExtension;
  948. } BANDWIDTH_ALLOCATION, *PBANDWIDTH_ALLOCATION;
  949. //
  950. // IEEE 1394 Request Block definition (IRB). IRBs are the basis of how other
  951. // device drivers communicate with the 1394 Bus driver.
  952. //
  953. typedef struct _IRB {
  954. //
  955. // Holds the zero based Function number that corresponds to the request
  956. // that device drivers are asking the 1394 Bus driver to carry out.
  957. //
  958. ULONG FunctionNumber;
  959. //
  960. // Holds Flags that may be unique to this particular operation
  961. //
  962. ULONG Flags;
  963. //
  964. // Reserved for internal bus driver use and/or future expansion
  965. //
  966. ULONG_PTR BusReserved[IRB_BUS_RESERVED_SZ];
  967. //
  968. // Reserved for internal port driver usage
  969. //
  970. ULONG_PTR PortReserved[IRB_PORT_RESERVED_SZ];
  971. //
  972. // Holds the structures used in performing the various 1394 APIs
  973. //
  974. union {
  975. //
  976. // Fields necessary in order for the 1394 stack to carry out an
  977. // AsyncRead request.
  978. //
  979. struct {
  980. IO_ADDRESS DestinationAddress; // Address to read from
  981. ULONG nNumberOfBytesToRead; // Bytes to read
  982. ULONG nBlockSize; // Block size of read
  983. ULONG fulFlags; // Flags pertinent to read
  984. PMDL Mdl; // Destination buffer
  985. ULONG ulGeneration; // Generation as known by driver
  986. UCHAR chPriority; // Priority to send
  987. UCHAR nSpeed; // Speed at which to send
  988. UCHAR tCode; // Type of Read to do
  989. UCHAR Reserved; // Used to determine medium delay
  990. ULONG ElapsedTime; // Only valid for flag ASYNC_FLAGS_PING
  991. // units in nano secs..
  992. } AsyncRead;
  993. //
  994. // Fields necessary in order for the 1394 stack to carry out an
  995. // AsyncWrite request.
  996. //
  997. struct {
  998. IO_ADDRESS DestinationAddress; // Address to write to
  999. ULONG nNumberOfBytesToWrite; // Bytes to write
  1000. ULONG nBlockSize; // Block size of write
  1001. ULONG fulFlags; // Flags pertinent to write
  1002. PMDL Mdl; // Destination buffer
  1003. ULONG ulGeneration; // Generation as known by driver
  1004. UCHAR chPriority; // Priority to send
  1005. UCHAR nSpeed; // Speed at which to send
  1006. UCHAR tCode; // Type of Write to do
  1007. UCHAR Reserved; // Reserved for future use
  1008. ULONG ElapsedTime; // Only valid for flag ASYNC_FLAGS_PING
  1009. } AsyncWrite;
  1010. //
  1011. // Fields necessary in order for the 1394 stack to carry out an
  1012. // AsyncLock request.
  1013. //
  1014. struct {
  1015. IO_ADDRESS DestinationAddress; // Address to lock to
  1016. ULONG nNumberOfArgBytes; // Bytes in Arguments
  1017. ULONG nNumberOfDataBytes; // Bytes in DataValues
  1018. ULONG fulTransactionType; // Lock transaction type
  1019. ULONG fulFlags; // Flags pertinent to lock
  1020. ULONG Arguments[2]; // Arguments used in Lock
  1021. ULONG DataValues[2]; // Data values
  1022. PVOID pBuffer; // Destination buffer (virtual address)
  1023. ULONG ulGeneration; // Generation as known by driver
  1024. UCHAR chPriority; // Priority to send
  1025. UCHAR nSpeed; // Speed at which to send
  1026. UCHAR tCode; // Type of Lock to do
  1027. UCHAR Reserved; // Reserved for future use
  1028. } AsyncLock;
  1029. //
  1030. // Fields necessary in order for the Bus driver to carry out an
  1031. // IsochAllocateBandwidth request
  1032. //
  1033. struct {
  1034. ULONG nMaxBytesPerFrameRequested; // Bytes per Isoch frame
  1035. ULONG fulSpeed; // Speed flags
  1036. HANDLE hBandwidth; // bandwidth handle returned
  1037. ULONG BytesPerFrameAvailable; // Available bytes per frame
  1038. ULONG SpeedSelected; // Speed to be used
  1039. ULONG nBandwidthUnitsRequired; // pre-calculated value
  1040. } IsochAllocateBandwidth;
  1041. //
  1042. // Fields necessary in order for the Bus driver to carry out a
  1043. // IsochAllocateChannel request.
  1044. //
  1045. struct {
  1046. ULONG nRequestedChannel; // Need a specific channel
  1047. ULONG Channel; // Returned channel
  1048. LARGE_INTEGER ChannelsAvailable; // Channels available
  1049. } IsochAllocateChannel;
  1050. //
  1051. // Fields necessary in order for the Bus driver to carry out a
  1052. // IsochAllocateResources request
  1053. // Instructions:
  1054. // Receive alloc:
  1055. // fulSpeed - should be the max speed the tx side is expected to stream
  1056. // The payload size in nMaxBytesPerFram cannot exceed the max payload for
  1057. // for this speed.
  1058. // fulFlags - For receive, wtih the standard header stripped, the field should
  1059. // be = (RESOURCE_USED_IN_LISTEN | RESOURCES_STRIP_ADDITIONAL_QUADLETS)
  1060. // Also nQuadletsToStrip = 1
  1061. // For no stripping set nQuadsTostrip to 0 and dont specify the stripping flag.
  1062. // nMaxBytesPerframe - If not stripping it should include the 8 bytes for header/trailer
  1063. // expected to be recieved for each packet.
  1064. // nNumberOfBuffer - see below
  1065. // nMaxBufferSize - This should be always such mode(nMaxBufferSize,nMaxBytesPerFrame) == 0
  1066. // (integer product of number of bytes per packet).
  1067. // nQuadletsTostrip - If stripping only one quadlet (standrd iso header) this is set to 1
  1068. // if zero, the isoch header will be included AND the trailer. So 8 bytes extra will be recieved
  1069. // hResource - see below
  1070. struct {
  1071. ULONG fulSpeed; // Speed flags
  1072. ULONG fulFlags; // Flags
  1073. ULONG nChannel; // Channel to be used
  1074. ULONG nMaxBytesPerFrame; // Expected size of Isoch frame
  1075. ULONG nNumberOfBuffers; // Number of buffer(s) that will be attached
  1076. ULONG nMaxBufferSize; // Max size of buffer(s)
  1077. ULONG nQuadletsToStrip; // Number striped from start of every packet
  1078. HANDLE hResource; // handle to Resource
  1079. ULARGE_INTEGER ChannelMask; // channel mask for multi-channel recv
  1080. } IsochAllocateResources;
  1081. //
  1082. // Fields necessary in order for the Bus driver to carry out a
  1083. // IsochAttachBuffers request
  1084. // Note that pIsochDescriptor->UlLength must be an integer product of
  1085. // pIsochDescriptor->nBytesMaxPerFrame
  1086. //
  1087. struct {
  1088. HANDLE hResource; // Resource handle
  1089. ULONG nNumberOfDescriptors; // Number to attach
  1090. PISOCH_DESCRIPTOR pIsochDescriptor; // Pointer to start of Isoch descriptors
  1091. } IsochAttachBuffers;
  1092. //
  1093. // Fields necessary in order for the Bus driver to carry out a
  1094. // IsochDetachBuffers request
  1095. //
  1096. struct {
  1097. HANDLE hResource; // Resource handle
  1098. ULONG nNumberOfDescriptors; // Number to detach
  1099. PISOCH_DESCRIPTOR pIsochDescriptor; // Pointer to Isoch descriptors
  1100. } IsochDetachBuffers;
  1101. //
  1102. // Fields necessary in order for the Bus driver to carry out a
  1103. // IsochFreeBandwidth request
  1104. //
  1105. struct {
  1106. HANDLE hBandwidth; // Bandwidth handle to release
  1107. ULONG nMaxBytesPerFrameRequested; // Bytes per Isoch frame
  1108. ULONG fulSpeed; // Speed flags
  1109. ULONG BytesPerFrameAvailable; // Available bytes per frame
  1110. ULONG SpeedSelected; // Speed to be used
  1111. ULONG nBandwidthUnitsRequired; // pre-calculated value
  1112. } IsochFreeBandwidth;
  1113. //
  1114. // Fields necessary in order for the Bus driver to carry out a
  1115. // IsochFreeChannel request
  1116. //
  1117. struct {
  1118. ULONG nChannel; // Channel to release
  1119. } IsochFreeChannel;
  1120. //
  1121. // Fields necessary in order for the Bus driver to carry out a
  1122. // IsochFreeResources request
  1123. //
  1124. struct {
  1125. HANDLE hResource; // Resource handle
  1126. } IsochFreeResources;
  1127. //
  1128. // Fields necessary in order for the Bus driver to carry out a
  1129. // IsochListen request.
  1130. //
  1131. struct {
  1132. HANDLE hResource; // Resource handle to listen on
  1133. ULONG fulFlags; // Flags
  1134. CYCLE_TIME StartTime; // Cycle time to start
  1135. } IsochListen;
  1136. //
  1137. // Fields necessary in order for the Bus driver to carry out a
  1138. // IsochQueryCurrentCycleTime request.
  1139. //
  1140. struct {
  1141. CYCLE_TIME CycleTime; // Current cycle time returned
  1142. } IsochQueryCurrentCycleTime;
  1143. //
  1144. // Fields necessary in order for the Bus driver to carry out a
  1145. // IsochQueryResources request.
  1146. //
  1147. struct {
  1148. ULONG fulSpeed; // Speed flags
  1149. ULONG BytesPerFrameAvailable; // Per Isoch Frame
  1150. LARGE_INTEGER ChannelsAvailable; // Available channels
  1151. } IsochQueryResources;
  1152. //
  1153. // Fields necessary in order for the Bus driver to carry out a
  1154. // IsochSetChannelBandwidth request.
  1155. //
  1156. struct {
  1157. HANDLE hBandwidth; // Bandwidth handle
  1158. ULONG nMaxBytesPerFrame; // bytes per Isoch frame
  1159. ULONG nBandwidthUnitsRequired; // pre-calculated value
  1160. } IsochSetChannelBandwidth;
  1161. //
  1162. // Fields necessary in order for the Bus driver to carry out a
  1163. // IsochStop request.
  1164. //
  1165. struct {
  1166. HANDLE hResource; // Resource handle to stop on
  1167. ULONG fulFlags; // Flags
  1168. } IsochStop;
  1169. //
  1170. // Fields necessary in order for the Bus driver to carry out a
  1171. // IsochTalk request.
  1172. //
  1173. struct {
  1174. HANDLE hResource; // Resource handle to talk on
  1175. ULONG fulFlags; // Flags
  1176. CYCLE_TIME StartTime; // Cycle time to start
  1177. } IsochTalk;
  1178. //
  1179. // Fields necessary in order for the Bus driver to carry out a
  1180. // IsochModifyStreamProperties request.
  1181. // This request is used to dynamicaly change the properties of an allocated
  1182. // resource, without the need to free and re-allocate the resource.
  1183. // The resource must NOT be streaming when this is issued. The caller should
  1184. // issue an ISOCH_STOP first and then an isoch start. Also no buffer can be
  1185. // pending after the ISOCH_STOP and before this call is made
  1186. //
  1187. struct {
  1188. HANDLE hResource; // Resource handle
  1189. ULARGE_INTEGER ChannelMask; // New channels to tx/rx on
  1190. ULONG fulSpeed; // New speed
  1191. } IsochModifyStreamProperties;
  1192. //
  1193. // Fields necessary in order for the 1394 stack to carry out an
  1194. // AllocateAddressRange request.
  1195. // Note:
  1196. // if the allocation is specified with no notification options and no RequiredOffset
  1197. // the returned address will ALWAYS be a physical address (on ohci).
  1198. // As a result these rules apply:
  1199. // Allocation - If Callback and Context is specified, since no notification is used
  1200. // the callback will be used to notify the caller that the allocation is complete.
  1201. // This way the issuer of the alloc doe snot have have to block but instead his callback
  1202. // routine will be called asynchronously when this is complete
  1203. // The caller must create this irb as usual but instead use the physical mapping routine
  1204. // provided by the por driver, in order to usee this request. If it uses IoCallDriver
  1205. // the caller cannot specif Context/Callback for a physical address, and he/she has to block
  1206. //
  1207. struct {
  1208. PMDL Mdl; // Address to map to 1394 space
  1209. ULONG fulFlags; // Flags for this operation
  1210. ULONG nLength; // Length of 1394 space desired
  1211. ULONG MaxSegmentSize; // Maximum segment size for a single address element
  1212. ULONG fulAccessType; // Desired access: R, W, L
  1213. ULONG fulNotificationOptions; // Notify options on Async access
  1214. PVOID Callback; // Pointer to callback routine
  1215. PVOID Context; // Pointer to driver supplied data
  1216. ADDRESS_OFFSET Required1394Offset; // Offset that must be returned
  1217. PSLIST_HEADER FifoSListHead; // Pointer to SList FIFO head
  1218. PKSPIN_LOCK FifoSpinLock; // Pointer to SList Spin Lock
  1219. ULONG AddressesReturned; // Number of addresses returned
  1220. PADDRESS_RANGE p1394AddressRange; // Pointer to returned 1394 Address Ranges
  1221. HANDLE hAddressRange; // Handle to address range
  1222. PVOID DeviceExtension; // Device Extension who created this mapping
  1223. } AllocateAddressRange;
  1224. //
  1225. // Fields necessary in order for the 1394 stack to carry out a
  1226. // FreeAddressRange request.
  1227. //
  1228. struct {
  1229. ULONG nAddressesToFree; // Number of Addresses to free
  1230. PADDRESS_RANGE p1394AddressRange; // Array of 1394 Address Ranges to Free
  1231. PHANDLE pAddressRange; // Array of Handles to address range
  1232. PVOID DeviceExtension; // Device Extension who created this mapping
  1233. } FreeAddressRange;
  1234. //
  1235. // Fields necessary in order for the Bus driver to carry out a
  1236. // GetLocalHostInformation request.
  1237. // All levels ans structures are descrived below
  1238. //
  1239. struct {
  1240. ULONG nLevel; // level of info requested
  1241. PVOID Information; // returned information
  1242. } GetLocalHostInformation;
  1243. //
  1244. // Fields necessary in order for the Bus driver to carry out a
  1245. // Get1394AddressFromDeviceObject request.
  1246. //
  1247. struct {
  1248. ULONG fulFlags; // Flags
  1249. NODE_ADDRESS NodeAddress; // Returned Node address
  1250. } Get1394AddressFromDeviceObject;
  1251. //
  1252. // Fields necessary in order for the Bus driver to carry out a
  1253. // Control request.
  1254. //
  1255. struct {
  1256. ULONG ulIoControlCode; // Control code
  1257. PMDL pInBuffer; // Input buffer
  1258. ULONG ulInBufferLength; // Input buffer length
  1259. PMDL pOutBuffer; // Output buffer
  1260. ULONG ulOutBufferLength; // Output buffer length
  1261. ULONG BytesReturned; // Bytes returned
  1262. } Control;
  1263. //
  1264. // Fields necessary in order for the Bus driver to carry out a
  1265. // GetMaxSpeedBetweenDevices request.
  1266. //
  1267. struct {
  1268. ULONG fulFlags; // Flags
  1269. ULONG ulNumberOfDestinations; // Number of destinations
  1270. PDEVICE_OBJECT hDestinationDeviceObjects[64]; // Destinations
  1271. ULONG fulSpeed; // Max speed returned
  1272. } GetMaxSpeedBetweenDevices;
  1273. //
  1274. // Fields necessary in order for the Bus driver to carry out a
  1275. // SetDeviceXmitProperties request.
  1276. //
  1277. struct {
  1278. ULONG fulSpeed; // Speed
  1279. ULONG fulPriority; // Priority
  1280. } SetDeviceXmitProperties;
  1281. //
  1282. // Fields necessary in order for the Bus driver to carry out a
  1283. // SetPortProperties request.
  1284. //
  1285. struct {
  1286. ULONG nLevel;
  1287. PVOID Information;
  1288. } SetLocalHostProperties;
  1289. //
  1290. // Fields necessary in order for the Bus driver to carry out a
  1291. // GetConfigurationInformation request.
  1292. //
  1293. struct {
  1294. PCONFIG_ROM ConfigRom; // Pointer to config rom
  1295. ULONG UnitDirectoryBufferSize;
  1296. PVOID UnitDirectory; // Pointer to unit directory
  1297. IO_ADDRESS UnitDirectoryLocation; // Starting Location of Unit Directory
  1298. ULONG UnitDependentDirectoryBufferSize;
  1299. PVOID UnitDependentDirectory;
  1300. IO_ADDRESS UnitDependentDirectoryLocation;
  1301. ULONG VendorLeafBufferSize; // Size available to get vendor leafs
  1302. PTEXTUAL_LEAF VendorLeaf; // Pointer to vendor leafs
  1303. ULONG ModelLeafBufferSize; // Size available to get model leafs
  1304. PTEXTUAL_LEAF ModelLeaf; // Pointer to model leafs
  1305. } GetConfigurationInformation;
  1306. //
  1307. // Fields necessary in order for the Bus driver to carry out a
  1308. // BusReset request
  1309. //
  1310. struct {
  1311. ULONG fulFlags; // Flags for Bus Reset
  1312. } BusReset;
  1313. //
  1314. // Fields necessary in order for the Bus driver to carry out a
  1315. // GetGenerationCount request.
  1316. //
  1317. struct {
  1318. ULONG GenerationCount; // generation count
  1319. } GetGenerationCount;
  1320. //
  1321. // Fields necessary in order for the Bus driver to carry out a
  1322. // SendPhyConfigurationPacket request.
  1323. //
  1324. struct {
  1325. PHY_CONFIGURATION_PACKET PhyConfigurationPacket; // Phy packet
  1326. } SendPhyConfigurationPacket;
  1327. //
  1328. // Fields necessary in order for the Bus driver to carry out a
  1329. // GetSpeedTopologyMaps request.
  1330. // The topology map and speed map are in big endian
  1331. //
  1332. struct {
  1333. PSPEED_MAP SpeedMap;
  1334. PTOPOLOGY_MAP TopologyMap;
  1335. } GetSpeedTopologyMaps;
  1336. //
  1337. // Fields necessary in order for the Bus driver to carry out a
  1338. // BusResetNotification request.
  1339. // This is the suggested method for a client driver on top of 1394bus, to get notified
  1340. // about 1394 bus resets. The client register by using this IRB, in its START_DEVICE
  1341. // routine and de-registers using the same IRB (but different flags) in its REMOVE routine
  1342. // This notification will ONLY be issued if after th ebus reset, the target device is
  1343. // STILL present on the bus. This way the caller does not have to verify its existence
  1344. //
  1345. struct {
  1346. ULONG fulFlags;
  1347. PBUS_BUS_RESET_NOTIFICATION ResetRoutine;
  1348. PVOID ResetContext;
  1349. } BusResetNotification;
  1350. //
  1351. // Fields necessary in order for the Bus driver to carry out a
  1352. // AsyncStream request.
  1353. //
  1354. struct {
  1355. ULONG nNumberOfBytesToStream; // Bytes to stream
  1356. ULONG fulFlags; // Flags pertinent to stream
  1357. PMDL Mdl; // Source buffer
  1358. ULONG ulTag; // Tag
  1359. ULONG nChannel; // Channel
  1360. ULONG ulSynch; // Sy
  1361. ULONG Reserved; // Reserved for future use
  1362. UCHAR nSpeed;
  1363. } AsyncStream;
  1364. } u;
  1365. } IRB, *PIRB;
  1366. #define IRB_FLAG_USE_PRE_CALCULATED_VALUE 1
  1367. #define IRB_FLAG_ALLOW_REMOTE_FREE 2
  1368. //
  1369. // Definition of minidriver capability bits
  1370. //
  1371. //
  1372. // Specifies port driver has no special capabilities.
  1373. //
  1374. #define PORT_SUPPORTS_NOTHING 0
  1375. //
  1376. // Specifies port driver implements the core 1394 CSRs internally. These
  1377. // may be implemented in software/hardware. When this bit is ON, all
  1378. // local read/write requests to the core CSRs are passed down to the
  1379. // port driver, and the 1394 Bus driver does not issue "listens" for
  1380. // the virtual CSR locations. If this bit is OFF, the 1394 Bus driver
  1381. // mimicks the core 1394 CSRs. The core CSRs are defined as
  1382. // Bandwidth Units, Channels Available and the entire 1k of ConfigROM.
  1383. //
  1384. #define PORT_SUPPORTS_CSRS 1
  1385. //
  1386. // Specifies port driver implements large Async Read/Write requests.
  1387. // If this bit is ON, the 1394 Bus driver will NOT chop up Async requests
  1388. // based on speed constraints (i.e. 512 bytes at 100Mbps, 1024 bytes at
  1389. // 200Mbps, etc.). Otherwise the 1394 Bus driver WILL chop up large
  1390. // requests into speed constrained sizes before handing them to the port
  1391. // driver.
  1392. //
  1393. #define PORT_SUPPORTS_LARGE_ASYNC 2
  1394. //
  1395. // Specifies port driver indicates packet headers to the bus driver in the
  1396. // native format of the bus driver (as defined by the structs in this file.
  1397. // If this capability bit is turned on, the bus driver will not need to byte
  1398. // swap headers to get the packet headers in the right format before acting
  1399. // on them. This bit is used on indication or reception of packets only, as
  1400. // the bus driver doesn't try to assemble packet headers on transmission.
  1401. //
  1402. #define PORT_SUPPORTS_NATIVE_ENDIAN 4
  1403. //
  1404. // if present port driver supports WMI.
  1405. //
  1406. #define PORT_SUPPORTS_WMI 8
  1407. //
  1408. // flags for the SetPortProperties request
  1409. //
  1410. #define SET_LOCAL_HOST_PROPERTIES_NO_CYCLE_STARTS 0x00000001
  1411. #define SET_LOCAL_HOST_PROPERTIES_CYCLE_START_CONTROL 0x00000001
  1412. #define SET_LOCAL_HOST_PROPERTIES_GAP_COUNT 0x00000002
  1413. #define SET_LOCAL_HOST_PROPERTIES_MODIFY_CROM 0x00000003
  1414. #define SET_LOCAL_HOST_PROPERTIES_MAX_PAYLOAD 0x00000004
  1415. //
  1416. // Definitions of the structures that correspond to the Host info levels
  1417. //
  1418. typedef struct _SET_LOCAL_HOST_PROPS1 {
  1419. ULONG fulFlags;
  1420. } SET_LOCAL_HOST_PROPS1, *PSET_LOCAL_HOST_PROPS1;
  1421. typedef struct _SET_LOCAL_HOST_PROPS2 {
  1422. ULONG GapCountLowerBound;
  1423. } SET_LOCAL_HOST_PROPS2, *PSET_LOCAL_HOST_PROPS2;
  1424. //
  1425. // Definition for appending a properly formated Config Rom subsection, to
  1426. // the core config rom exposed by the PC.
  1427. // The first element of the submitted buffer must be a unit directory and any
  1428. // offset to other leafs/dir following it, must be indirect offsets from the
  1429. // beginning of the submitted buffer.
  1430. // The bus driver will then add a pointer to this unit dir, in our root directory.
  1431. // The entire supplied buffer must be in big endian with CRCs pre-calculated..
  1432. // If a driver fails to remove its added crom data, when it gets removed, the bus driver
  1433. // will do so automatically, restoring the crom image prior to this modification
  1434. //
  1435. typedef struct _SET_LOCAL_HOST_PROPS3 {
  1436. ULONG fulFlags;
  1437. HANDLE hCromData;
  1438. ULONG nLength;
  1439. PMDL Mdl;
  1440. } SET_LOCAL_HOST_PROPS3, *PSET_LOCAL_HOST_PROPS3;
  1441. //
  1442. // Params for setting max payload size to less than the port driver
  1443. // default to assuage ill-behaved legacy devices. Valid values
  1444. // for the MaxAsyncPayloadRequested field are those corresponding
  1445. // to the ASYNC_PAYLOAD_###_RATE constants and zero (which will
  1446. // restore the port driver default values). On successful completion
  1447. // of this request the MaxAsyncPayloadResult will contain the
  1448. // updated max async payload value in use.
  1449. //
  1450. // On successful completion of this request it is the caller's
  1451. // responsibility to request a bus reset in order to propagate
  1452. // these new values to other device stacks.
  1453. //
  1454. // Failure to restore default port driver values as appropriate
  1455. // (e.g. on legacy device removal) may result in degraded bus
  1456. // performance.
  1457. //
  1458. typedef struct _SET_LOCAL_HOST_PROPS4 {
  1459. ULONG MaxAsyncPayloadRequested;
  1460. ULONG MaxAsyncPayloadResult;
  1461. } SET_LOCAL_HOST_PROPS4, *PSET_LOCAL_HOST_PROPS4;
  1462. //
  1463. // definition of Flags for SET_LOCAL_HOST_PROPERTIES_MODIFY_CROM
  1464. //
  1465. #define SLHP_FLAG_ADD_CROM_DATA 0x01
  1466. #define SLHP_FLAG_REMOVE_CROM_DATA 0x02
  1467. //
  1468. // Definition of fulFlags in Async Read/Write/Lock requests
  1469. //
  1470. #define ASYNC_FLAGS_NONINCREMENTING 0x00000001
  1471. #define ASYNC_FLAGS_PARTIAL_REQUEST 0x80000000
  1472. //
  1473. // flag instucts the port driver to NOT take an int for checking the status
  1474. // of this transaction. Always return success...
  1475. //
  1476. #define ASYNC_FLAGS_NO_STATUS 0x00000002
  1477. //
  1478. // if this flag is set the read packet is going to be used as a PING packet also.
  1479. // we are going to determine, in units of micro secs, the delay
  1480. // between Tx of the async packet and reception of ACK_PENDING or ACK_COMPLETE
  1481. //
  1482. #define ASYNC_FLAGS_PING 0x00000004
  1483. //
  1484. // when this flag is set, the bus driver will use 63 as the node id, so this message
  1485. // is broadcast to all nodes
  1486. //
  1487. #define ASYNC_FLAGS_BROADCAST 0x00000008
  1488. //
  1489. // Definition of fulAccessType for AllocateAddressRange
  1490. //
  1491. #define ACCESS_FLAGS_TYPE_READ 1
  1492. #define ACCESS_FLAGS_TYPE_WRITE 2
  1493. #define ACCESS_FLAGS_TYPE_LOCK 4
  1494. #define ACCESS_FLAGS_TYPE_BROADCAST 8
  1495. //
  1496. // Definition of fulNotificationOptions for AllocateAddressRange
  1497. //
  1498. #define NOTIFY_FLAGS_NEVER 0
  1499. #define NOTIFY_FLAGS_AFTER_READ 1
  1500. #define NOTIFY_FLAGS_AFTER_WRITE 2
  1501. #define NOTIFY_FLAGS_AFTER_LOCK 4
  1502. //
  1503. // Definitions of Speed flags used throughout 1394 Bus APIs
  1504. //
  1505. #define SPEED_FLAGS_100 0x01
  1506. #define SPEED_FLAGS_200 0x02
  1507. #define SPEED_FLAGS_400 0x04
  1508. #define SPEED_FLAGS_800 0x08
  1509. #define SPEED_FLAGS_1600 0x10
  1510. #define SPEED_FLAGS_3200 0x20
  1511. #define SPEED_FLAGS_FASTEST 0x80000000
  1512. //
  1513. // Definitions of Channel flags
  1514. //
  1515. #define ISOCH_ANY_CHANNEL 0xffffffff
  1516. #define ISOCH_MAX_CHANNEL 63
  1517. //
  1518. // Definitions of Bus Reset flags (used when Bus driver asks Port driver
  1519. // to perform a bus reset)
  1520. //
  1521. #define BUS_RESET_FLAGS_PERFORM_RESET 1
  1522. #define BUS_RESET_FLAGS_FORCE_ROOT 2
  1523. //
  1524. // Definitions of Bus Reset informative states.
  1525. //
  1526. #define BUS_RESET_BEGINNING 0x00000001
  1527. #define BUS_RESET_FINISHED 0x00000002
  1528. #define BUS_RESET_LOCAL_NODE_IS_ROOT 0x00000004
  1529. #define BUS_RESET_LOCAL_NODE_IS_ISOCH_MANAGER 0x00000008
  1530. #define BUS_RESET_LOCAL_NODE_IS_BUS_MANAGER 0x00000010
  1531. #define BUS_RESET_SELFID_ENUMERATION_ERROR 0x00000020
  1532. #define BUS_RESET_STORM_ERROR 0x00000040
  1533. #define BUS_RESET_ABSENT_ON_POWER_UP 0x00000080
  1534. //
  1535. // Definitions of Lock transaction types
  1536. //
  1537. #define LOCK_TRANSACTION_MASK_SWAP 1
  1538. #define LOCK_TRANSACTION_COMPARE_SWAP 2
  1539. #define LOCK_TRANSACTION_FETCH_ADD 3
  1540. #define LOCK_TRANSACTION_LITTLE_ADD 4
  1541. #define LOCK_TRANSACTION_BOUNDED_ADD 5
  1542. #define LOCK_TRANSACTION_WRAP_ADD 6
  1543. //
  1544. // Definitions of Isoch Allocate Resources flags
  1545. //
  1546. #define RESOURCE_USED_IN_LISTENING 0x00000001
  1547. #define RESOURCE_USED_IN_TALKING 0x00000002
  1548. #define RESOURCE_BUFFERS_CIRCULAR 0x00000004
  1549. #define RESOURCE_STRIP_ADDITIONAL_QUADLETS 0x00000008
  1550. #define RESOURCE_TIME_STAMP_ON_COMPLETION 0x00000010
  1551. #define RESOURCE_SYNCH_ON_TIME 0x00000020
  1552. #define RESOURCE_USE_PACKET_BASED 0x00000040
  1553. #define RESOURCE_VARIABLE_ISOCH_PAYLOAD 0x00000080
  1554. #define RESOURCE_USE_MULTICHANNEL 0x00000100
  1555. //
  1556. // Definitions of Isoch Descriptor flags
  1557. //
  1558. #define DESCRIPTOR_SYNCH_ON_SY 0x00000001
  1559. #define DESCRIPTOR_SYNCH_ON_TAG 0x00000002
  1560. #define DESCRIPTOR_SYNCH_ON_TIME 0x00000004
  1561. #define DESCRIPTOR_USE_SY_TAG_IN_FIRST 0x00000008
  1562. #define DESCRIPTOR_TIME_STAMP_ON_COMPLETION 0x00000010
  1563. #define DESCRIPTOR_PRIORITY_TIME_DELIVERY 0x00000020
  1564. #define DESCRIPTOR_HEADER_SCATTER_GATHER 0x00000040
  1565. #define DESCRIPTOR_SYNCH_ON_ALL_TAGS 0x00000080
  1566. //
  1567. // Definitions of Isoch synchronization flags
  1568. //
  1569. #define SYNCH_ON_SY DESCRIPTOR_SYNCH_ON_SY
  1570. #define SYNCH_ON_TAG DESCRIPTOR_SYNCH_ON_TAG
  1571. #define SYNCH_ON_TIME DESCRIPTOR_SYNCH_ON_TIME
  1572. //
  1573. // Definitions of levels of Host controller information
  1574. //
  1575. #define GET_HOST_UNIQUE_ID 1
  1576. #define GET_HOST_CAPABILITIES 2
  1577. #define GET_POWER_SUPPLIED 3
  1578. #define GET_PHYS_ADDR_ROUTINE 4
  1579. #define GET_HOST_CONFIG_ROM 5
  1580. #define GET_HOST_CSR_CONTENTS 6
  1581. #define GET_HOST_DMA_CAPABILITIES 7
  1582. //
  1583. // Definitions of the structures that correspond to the Host info levels
  1584. //
  1585. typedef struct _GET_LOCAL_HOST_INFO1 {
  1586. LARGE_INTEGER UniqueId;
  1587. } GET_LOCAL_HOST_INFO1, *PGET_LOCAL_HOST_INFO1;
  1588. typedef struct _GET_LOCAL_HOST_INFO2 {
  1589. ULONG HostCapabilities;
  1590. ULONG MaxAsyncReadRequest;
  1591. ULONG MaxAsyncWriteRequest;
  1592. } GET_LOCAL_HOST_INFO2, *PGET_LOCAL_HOST_INFO2;
  1593. typedef struct _GET_LOCAL_HOST_INFO3 {
  1594. ULONG deciWattsSupplied;
  1595. ULONG Voltage; // x10 -> +3.3 == 33
  1596. // +5.0 == 50,+12.0 == 120
  1597. // etc.
  1598. } GET_LOCAL_HOST_INFO3, *PGET_LOCAL_HOST_INFO3;
  1599. // l
  1600. // physical mapping routine
  1601. //
  1602. typedef
  1603. NTSTATUS
  1604. (*PPORT_PHYS_ADDR_ROUTINE) ( // We will call this routine
  1605. IN PVOID Context, // at DISPATCH_LEVEL
  1606. IN OUT PIRB Irb
  1607. );
  1608. //
  1609. // callback from Physical Mapping routine, indicating its done...
  1610. //
  1611. typedef
  1612. VOID
  1613. (*PPORT_ALLOC_COMPLETE_NOTIFICATION) ( // We will call this routine
  1614. IN PVOID Context // at DISPATCH_LEVEL
  1615. );
  1616. typedef struct _GET_LOCAL_HOST_INFO4 {
  1617. PPORT_PHYS_ADDR_ROUTINE PhysAddrMappingRoutine;
  1618. PVOID Context;
  1619. } GET_LOCAL_HOST_INFO4, *PGET_LOCAL_HOST_INFO4;
  1620. //
  1621. // the caller can set ConfigRomLength to zero, issue the request, which will
  1622. // be failed with STATUS_INVALID_BUFFER_SIZE and the ConfigRomLength will be set
  1623. // by the port driver to the proper length. The caller can then re-issue the request
  1624. // after it has allocated a buffer for the configrom with the correct length
  1625. // Same is tru for the GET_LOCAL_HOST_INFO6 call
  1626. //
  1627. typedef struct _GET_LOCAL_HOST_INFO5 {
  1628. PVOID ConfigRom;
  1629. ULONG ConfigRomLength;
  1630. } GET_LOCAL_HOST_INFO5, *PGET_LOCAL_HOST_INFO5;
  1631. typedef struct _GET_LOCAL_HOST_INFO6 {
  1632. ADDRESS_OFFSET CsrBaseAddress;
  1633. ULONG CsrDataLength;
  1634. PVOID CsrDataBuffer;
  1635. } GET_LOCAL_HOST_INFO6, *PGET_LOCAL_HOST_INFO6;
  1636. typedef struct _GET_LOCAL_HOST_INFO7 {
  1637. ULONG HostDmaCapabilities;
  1638. ULARGE_INTEGER MaxDmaBufferSize;
  1639. } GET_LOCAL_HOST_INFO7, *PGET_LOCAL_HOST_INFO7;
  1640. //
  1641. // Definitions of capabilities in Host info level 2
  1642. //
  1643. #define HOST_INFO_PACKET_BASED 0x00000001
  1644. #define HOST_INFO_STREAM_BASED 0x00000002
  1645. #define HOST_INFO_SUPPORTS_ISOCH_STRIPPING 0x00000004
  1646. #define HOST_INFO_SUPPORTS_START_ON_CYCLE 0x00000008
  1647. #define HOST_INFO_SUPPORTS_RETURNING_ISO_HDR 0x00000010
  1648. #define HOST_INFO_SUPPORTS_ISO_HDR_INSERTION 0x00000020
  1649. #define HOST_INFO_SUPPORTS_ISO_DUAL_BUFFER_RX 0x00000040
  1650. #define HOST_INFO_DMA_DOUBLE_BUFFERING_ENABLED 0x00000080
  1651. //
  1652. // Definitions of flags for GetMaxSpeedBetweenDevices and
  1653. // Get1394AddressFromDeviceObject
  1654. //
  1655. #define USE_LOCAL_NODE 1
  1656. //
  1657. // Definitions of flags for IndicationFlags in INDICATION_INFO struct
  1658. //
  1659. #define BUS_RESPONSE_IS_RAW 1
  1660. //
  1661. // Definition of flags for BusResetNotification Irb
  1662. //
  1663. #define REGISTER_NOTIFICATION_ROUTINE 1
  1664. #define DEREGISTER_NOTIFICATION_ROUTINE 2
  1665. //
  1666. // Definition of flags for AllocateAddressRange Irb
  1667. //
  1668. #define ALLOCATE_ADDRESS_FLAGS_USE_BIG_ENDIAN 1
  1669. #define ALLOCATE_ADDRESS_FLAGS_USE_COMMON_BUFFER 2
  1670. #ifdef __cplusplus
  1671. }
  1672. #endif
  1673. #endif // _1394_H_