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.

393 lines
11 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. nic1394.h
  5. Abstract:
  6. This module defines the structures, macros, and manifests available
  7. to IEE1394-aware network components.
  8. Revision History:
  9. 09/14/1998 JosephJ Created.
  10. --*/
  11. #ifndef _NIC1394_H_
  12. #define _NIC1394_H_
  13. ///////////////////////////////////////////////////////////////////////////////////
  14. // ADDRESS FAMILY VERSION INFORMATION
  15. ///////////////////////////////////////////////////////////////////////////////////
  16. //
  17. // The current major and minor version, respectively, of the NIC1394 address family.
  18. //
  19. #define NIC1394_AF_CURRENT_MAJOR_VERSION 5
  20. #define NIC1394_AF_CURRENT_MINOR_VERSION 0
  21. ///////////////////////////////////////////////////////////////////////////////////
  22. // MEDIA PARAMETERS //
  23. ///////////////////////////////////////////////////////////////////////////////////
  24. //
  25. // 1394 FIFO Address, consisting of the 64-bit UniqueID and the
  26. // 48-bit address offset.
  27. //
  28. typedef struct _NIC1394_FIFO_ADDRESS
  29. {
  30. UINT64 UniqueID;
  31. ULONG Off_Low;
  32. USHORT Off_High;
  33. } NIC1394_FIFO_ADDRESS, *PNIC1394_FIFO_ADDRESS;
  34. // enum to identify which of the two modes of transmission on a 1394 is to be used
  35. //
  36. //
  37. typedef enum _NIC1394_ADDRESS_TYPE
  38. {
  39. NIC1394AddressType_Channel, // Indicates this is a channel address
  40. NIC1394AddressType_FIFO, // Indicates this is a FIFO address
  41. } NIC1394_ADDRESS_TYPE, *PNIC1394_ADDRESS_TYPE;
  42. //
  43. // General form of a 1394 destination, which can specify either a 1394 channel or
  44. // a FIFO address. This structure forms part of the 1394 media-specific
  45. // parameters.
  46. //
  47. typedef struct _NIC1394_DESTINATION
  48. {
  49. union
  50. {
  51. UINT Channel; // IEEE1394 channel number.
  52. NIC1394_FIFO_ADDRESS FifoAddress; // IEEE1394 NodeID and address offset.
  53. };
  54. NIC1394_ADDRESS_TYPE AddressType; // Address- asynch or isoch
  55. } NIC1394_DESTINATION, *PNIC1394_DESTINATION;
  56. //
  57. // Special channels values
  58. //
  59. #define NIC1394_ANY_CHANNEL ((UINT)-1) // miniport should pick channel.
  60. #define NIC1394_BROADCAST_CHANNEL ((UINT)-2) // special broadcast channel.
  61. //
  62. // This is the value of the ParamType field in the CO_SPECIFIC_PARAMETERS structure
  63. // when the Parameters[] field contains IEEE1394 media specific values in the
  64. // structure NIC1394_MEDIA_PARAMETERS.
  65. //
  66. #define NIC1394_MEDIA_SPECIFIC 0x13940000
  67. //
  68. // NOTE:
  69. // The CO_MEDIA_PARAMETERS.Flags field for FIFO vcs must specify either TRANSMIT_VC
  70. // or RECEIVE_VC, not both. If RECEIVE_VC is specified for a FIFO vc, this vc is
  71. // used to receive on a local FIFO. In this case, the Destination.RecvFIFO field
  72. // must be set to all-0s when creating the vc. On activation of the vc,
  73. // this field of the updated media parameters will contain the local nodes unique ID
  74. // and the allocated FIFO address.
  75. //
  76. //
  77. // 1394 Specific Media parameters - this is the Media specific structure for 1394
  78. // that goes into MediaParameters->MediaSpecific.Parameters.
  79. //
  80. typedef struct _NIC1394_MEDIA_PARAMETERS
  81. {
  82. //
  83. // Identifies destination type (channel or FIFO) and type-specific address.
  84. //
  85. NIC1394_DESTINATION Destination;
  86. //
  87. // Bitmap encoding characteristics of the vc. One or more NIC1394_VCFLAG_*
  88. // values.
  89. //
  90. ULONG Flags;
  91. //
  92. // Maximum size, in bytes, of blocks to be sent on this vc. Must be set to 0
  93. // if this is a recv-only VCs. The miniport will choose a block size that is a
  94. // minimum of this value and the value dictated by the bus speed map.
  95. // Special value (ULONG -1) indicates "maximum possible block size."
  96. UINT MaxSendBlockSize;
  97. //
  98. // One of the SCODE_* constants defined in 1394.h. Indicates
  99. // the maximum speed to be used for blocks sent on this vc. Must be set to 0
  100. // if this is a recv-only VC. The miniport will choose a speed that is a minimum
  101. // of this value and the value dicated by the bus speed map.
  102. // Special value (ULONG -1) indicates "maximum possible speed."
  103. //
  104. // TODO: change to ... MaxSendSpeedCode;
  105. //
  106. UINT MaxSendSpeed;
  107. //
  108. // Size, in bytes, of the largest packet that will be sent or received on
  109. // this VC. The miniport may use this information to set up internal buffers
  110. // for link-layer fragmentation and reassembly. The miniport will
  111. // fail attempts to send packets and will discard received packets if the
  112. // size of these packets is larger than the MTU.
  113. //
  114. UINT MTU;
  115. //
  116. // Amount of bandwidth to reserve, in units of bytes per isochronous frame.
  117. // Applies only for isochronous transmission, and must be set to 0 for
  118. // asynchronous transmission (i.e., if the NIC1394_VCFLAG_ISOCHRONOUS bit is 0).
  119. //
  120. UINT Bandwidth;
  121. //
  122. // One or more NIC1394_FRAMETYPE_* values. The miniport will attempt to send up
  123. // only pkts with these protocols. However it may send other pkts.
  124. // The client should be able to deal with this. Must be set to 0 if
  125. // no framing is used (i.e., if the NIC1394_VCFLAG_FRAMED bit is 0).
  126. //
  127. ULONG RecvFrameTypes;
  128. } NIC1394_MEDIA_PARAMETERS, *PNIC1394_MEDIA_PARAMETERS;
  129. //
  130. // NIC1394_MEDIA_PARAMETERS.Flags bitfield values
  131. //
  132. //
  133. // Indicates VC will be used for isochronous transmission.
  134. //
  135. #define NIC1394_VCFLAG_ISOCHRONOUS (0x1 << 1)
  136. //
  137. // Indicates that the vc is used for framed data. If set, the miniport will
  138. // implement link-level fragmentation and reassembly. If clear, the miniport
  139. // will treat data sent and received on this vc as raw data.
  140. //
  141. #define NIC1394_VCFLAG_FRAMED (0x1 << 2)
  142. //
  143. // Indicates the miniport should allocate the necessary bus resources.
  144. // Currently this only applies for non-broadcast channels, in which case
  145. // the bus resources consist of the network channel number and (for isochronous
  146. // vc's) the bandwidth specified in Bandwidth field.
  147. // This bit does not apply (and should be 0) when creating the broadcast channel
  148. // and either transmit or receive FIFO vcs.
  149. //
  150. #define NIC1394_VCFLAG_ALLOCATE (0x1 << 3)
  151. //
  152. // End of NIC1394_MEDIA_PARAMETERS.Flags bitfield values.
  153. //
  154. //
  155. // NIC1394_MEDIA_PARAMETERS.FrameType bitfield values
  156. //
  157. #define NIC1394_FRAMETYPE_ARP (0x1<<0) // Ethertype 0x806
  158. #define NIC1394_FRAMETYPE_IPV4 (0x1<<1) // Ethertype 0x800
  159. #define NIC1394_FRAMETYPE_IPV4MCAP (0x1<<2) // Ethertype 0x8861
  160. ///////////////////////////////////////////////////////////////////////////////////
  161. // INFORMATIONAL OIDs //
  162. ///////////////////////////////////////////////////////////////////////////////////
  163. //
  164. // the structure for returning basic information about the miniport
  165. // returned in response to OID_NIC1394_LOCAL_NODE_INFO. Associated with
  166. // the address family handle.
  167. //
  168. typedef struct _NIC1394_LOCAL_NODE_INFO
  169. {
  170. UINT64 UniqueID; // This node's 64-bit Unique ID.
  171. ULONG BusGeneration; // 1394 Bus generation ID.
  172. NODE_ADDRESS NodeAddress; // Local nodeID for the current bus
  173. // generation.
  174. USHORT Reserved; // Padding.
  175. UINT MaxRecvBlockSize; // Maximum size, in bytes, of blocks
  176. // that can be read.
  177. UINT MaxRecvSpeed; // Max speed which can be accepted
  178. // -- minimum
  179. // of the max local link speed and
  180. // the max local PHY speed.
  181. } NIC1394_LOCAL_NODE_INFO, *PNIC1394_LOCAL_NODE_INFO;
  182. //
  183. // The structure for returning basic information about the specified vc
  184. // returned in response to OID_NIC1394_VC_INFO. Associated with
  185. // a vc handle
  186. //
  187. typedef struct _NIC1394_VC_INFO
  188. {
  189. //
  190. // Channel or (unique-ID,offset). In the case of a recv (local) FIFO vc,
  191. // this will be set to the local node's unique ID and address offset.
  192. //
  193. NIC1394_DESTINATION Destination;
  194. } NIC1394_VC_INFO, *PNIC1394_VC_INFO;
  195. ///////////////////////////////////////////////////////////////////////////////////
  196. // INDICATIONS //
  197. ///////////////////////////////////////////////////////////////////////////////////
  198. // Bus Reset
  199. // Params: NIC1394_LOCAL_NODE_INFO
  200. ///////////////////////////////////////////////////////////////////////////////////
  201. // PACKET FORMATS //
  202. ///////////////////////////////////////////////////////////////////////////////////
  203. //
  204. // GASP Header, which prefixes all ip/1394 pkts sent over channels.
  205. // TODO: move this withing NIC1394, because it is not exposed to protocols.
  206. //
  207. typedef struct _NIC1394_GASP_HEADER
  208. {
  209. USHORT source_ID;
  210. USHORT specifier_ID_hi;
  211. UCHAR specifier_ID_lo;
  212. UCHAR version[3];
  213. } NIC1394_GASP_HEADER;
  214. //
  215. // Unfragmented encapsulation header.
  216. //
  217. typedef struct _NIC1394_ENCAPSULATION_HEADER
  218. {
  219. // The Reserved field must be set to 0.
  220. //
  221. USHORT Reserved;
  222. // The EtherType field is set to the byte-swapped version of one of the
  223. // constants defined immediately below.
  224. //
  225. USHORT EtherType;
  226. // Ethertypes in machine byte order. These values need to be byteswapped
  227. // before they are sent on the wire.
  228. //
  229. #define NIC1394_ETHERTYPE_IP 0x800
  230. #define NIC1394_ETHERTYPE_ARP 0x806
  231. #define NIC1394_ETHERTYPE_MCAP 0x8861
  232. } NIC1394_ENCAPSULATION_HEADER, *PNIC1394_ENCAPSULATION_HEADER;
  233. //
  234. // TODO: get rid of NIC1394_ENCAPSULATION_HEADER
  235. //
  236. typedef
  237. NIC1394_ENCAPSULATION_HEADER
  238. NIC1394_UNFRAGMENTED_HEADER, *PNIC1394_UNFRAGMENTED_HEADER;
  239. //
  240. // FRAGMENTED PACKET FORMATS
  241. //
  242. // TODO: move these to inside NIC1394, because they are only
  243. // used within NIC1394.
  244. //
  245. //
  246. // Fragmented Encapsulation header: first fragment
  247. //
  248. typedef struct _NIC1394_FIRST_FRAGMENT_HEADER
  249. {
  250. // Contains the 2-bit "lf" field and the 12-bit "buffer_size" field.
  251. // Use the macros immediately below to extract the above fields from
  252. // the lfbufsz. This field needs to be byteswapped before it is sent out
  253. // on the wire.
  254. //
  255. USHORT lfbufsz;
  256. #define NIC1394_LF_FROM_LFBUFSZ(_lfbufsz) \
  257. ((_lfbufz) >> 14)
  258. #define NIC1394_BUFFER_SIZE_FROM_LFBUFSZ(_lfbufsz) \
  259. ((_lfbufz) & 0xfff)
  260. #define NIC1394_MAX_FRAGMENT_BUFFER_SIZE 0xfff
  261. //
  262. // specifies what the packet is - an IPV4, ARP, or MCAP packet
  263. //
  264. USHORT EtherType;
  265. // Opaque datagram label. There is no need to byteswap this field before it
  266. // is sent out on the wire.
  267. //
  268. USHORT dgl;
  269. // Must be set to 0
  270. //
  271. USHORT reserved;
  272. } NIC1394_FIRST_FRAGMENT_HEADER, *PNIC1394_FIRST_FRAGMENT_HEADER;
  273. //
  274. // Fragmented Encapsulation header: second and subsequent fragments
  275. //
  276. typedef struct _NIC1394_FRAGMENT_HEADER
  277. {
  278. #if OBSOLETE
  279. ULONG lf:2; // Bits 0-1
  280. ULONG rsv0:2; // Bits 2-3
  281. ULONG buffer_size:12; // Bits 4-15
  282. ULONG rsv1:4; // Bits 16-19
  283. ULONG fragment_offset:12; // Bits 20-31
  284. ULONG dgl:16; // Bits 0-15
  285. ULONG reserved:16; // Bits 16-32
  286. #endif // OBSOLETE
  287. // Contains the 2-bit "lf" field and the 12-bit "buffer_size" field.
  288. // The format is the same as NIC1394_FIRST_FRAGMENT_HEADER.lfbufsz.
  289. //
  290. USHORT lfbufsz;
  291. // Opaque datagram label. There is no need to byteswap this field before it
  292. // is setn out on the wire.
  293. //
  294. USHORT dgl;
  295. // Fragment offset. Must be less than or equal to NIC1394_MAX_FRAGMENT_OFFSET.
  296. // This field needs to be byteswapped before it is sent out on the wire.
  297. //
  298. USHORT fragment_offset;
  299. #define NIC1394_MAX_FRAGMENT_OFFSET 0xfff
  300. } NIC1394_FRAGMENT_HEADER, *PNIC1394_FRAGMENT_HEADER;
  301. #define OID_1394_ISSUE_BUS_RESET 0x0C010201
  302. #endif // _NIC1394_H_