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.

377 lines
13 KiB

  1. #ifndef _DEVPATH_H
  2. #define _DEVPATH_H
  3. /*++
  4. Copyright (c) 1998 Intel Corporation
  5. Module Name:
  6. devpath.h
  7. Abstract:
  8. Defines for parsing the EFI Device Path structures
  9. Revision History
  10. --*/
  11. /*
  12. * Device Path structures - Section C
  13. */
  14. typedef struct _EFI_DEVICE_PATH {
  15. UINT8 Type;
  16. UINT8 SubType;
  17. UINT8 Length[2];
  18. } EFI_DEVICE_PATH;
  19. #define EFI_DP_TYPE_MASK 0x7F
  20. #define EFI_DP_TYPE_UNPACKED 0x80
  21. /* #define END_DEVICE_PATH_TYPE 0xff */
  22. #define END_DEVICE_PATH_TYPE 0x7f
  23. /* #define END_DEVICE_PATH_TYPE_UNPACKED 0x7f */
  24. #define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff
  25. #define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01
  26. #define END_DEVICE_PATH_LENGTH (sizeof(EFI_DEVICE_PATH))
  27. #define DP_IS_END_TYPE(a)
  28. #define DP_IS_END_SUBTYPE(a) ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
  29. #define DevicePathType(a) ( ((a)->Type) & EFI_DP_TYPE_MASK )
  30. #define DevicePathSubType(a) ( (a)->SubType )
  31. #define DevicePathNodeLength(a) ( ((a)->Length[0]) | ((a)->Length[1] << 8) )
  32. #define NextDevicePathNode(a) ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a)))
  33. /* #define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE_UNPACKED ) */
  34. #define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE )
  35. #define IsDevicePathEndSubType(a) ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
  36. #define IsDevicePathEnd(a) ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) )
  37. #define IsDevicePathUnpacked(a) ( (a)->Type & EFI_DP_TYPE_UNPACKED )
  38. #define SetDevicePathNodeLength(a,l) { \
  39. (a)->Length[0] = (UINT8) (l); \
  40. (a)->Length[1] = (UINT8) ((l) >> 8); \
  41. }
  42. #define SetDevicePathEndNode(a) { \
  43. (a)->Type = END_DEVICE_PATH_TYPE; \
  44. (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \
  45. (a)->Length[0] = sizeof(EFI_DEVICE_PATH); \
  46. (a)->Length[1] = 0; \
  47. }
  48. /*
  49. *
  50. */
  51. #define HARDWARE_DEVICE_PATH 0x01
  52. #define HW_PCI_DP 0x01
  53. typedef struct _PCI_DEVICE_PATH {
  54. EFI_DEVICE_PATH Header;
  55. UINT8 Function;
  56. UINT8 Device;
  57. } PCI_DEVICE_PATH;
  58. #define HW_PCCARD_DP 0x02
  59. typedef struct _PCCARD_DEVICE_PATH {
  60. EFI_DEVICE_PATH Header;
  61. UINT8 SocketNumber;
  62. } PCCARD_DEVICE_PATH;
  63. #define HW_MEMMAP_DP 0x03
  64. typedef struct _MEMMAP_DEVICE_PATH {
  65. EFI_DEVICE_PATH Header;
  66. UINT32 MemoryType;
  67. EFI_PHYSICAL_ADDRESS StartingAddress;
  68. EFI_PHYSICAL_ADDRESS EndingAddress;
  69. } MEMMAP_DEVICE_PATH;
  70. #define HW_VENDOR_DP 0x04
  71. typedef struct _VENDOR_DEVICE_PATH {
  72. EFI_DEVICE_PATH Header;
  73. EFI_GUID Guid;
  74. } VENDOR_DEVICE_PATH;
  75. #define UNKNOWN_DEVICE_GUID \
  76. { 0xcf31fac5, 0xc24e, 0x11d2, 0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b }
  77. typedef struct _UKNOWN_DEVICE_VENDOR_DP {
  78. VENDOR_DEVICE_PATH DevicePath;
  79. UINT8 LegacyDriveLetter;
  80. } UNKNOWN_DEVICE_VENDOR_DEVICE_PATH;
  81. #define HW_CONTROLLER_DP 0x05
  82. typedef struct _CONTROLLER_DEVICE_PATH {
  83. EFI_DEVICE_PATH Header;
  84. UINT32 Controller;
  85. } CONTROLLER_DEVICE_PATH;
  86. /*
  87. *
  88. */
  89. #define ACPI_DEVICE_PATH 0x02
  90. #define ACPI_DP 0x01
  91. typedef struct _ACPI_HID_DEVICE_PATH {
  92. EFI_DEVICE_PATH Header;
  93. UINT32 HID;
  94. UINT32 UID;
  95. } ACPI_HID_DEVICE_PATH;
  96. /*
  97. * EISA ID Macro
  98. * EISA ID Definition 32-bits
  99. * bits[15:0] - three character compressed ASCII EISA ID.
  100. * bits[31:16] - binary number
  101. * Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
  102. */
  103. #define PNP_EISA_ID_CONST 0x41d0
  104. #define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16))
  105. #define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
  106. #define PNP_EISA_ID_MASK 0xffff
  107. #define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)
  108. /*
  109. *
  110. */
  111. #define MESSAGING_DEVICE_PATH 0x03
  112. #define MSG_ATAPI_DP 0x01
  113. typedef struct _ATAPI_DEVICE_PATH {
  114. EFI_DEVICE_PATH Header;
  115. UINT8 PrimarySecondary;
  116. UINT8 SlaveMaster;
  117. UINT16 Lun;
  118. } ATAPI_DEVICE_PATH;
  119. #define MSG_SCSI_DP 0x02
  120. typedef struct _SCSI_DEVICE_PATH {
  121. EFI_DEVICE_PATH Header;
  122. UINT16 Pun;
  123. UINT16 Lun;
  124. } SCSI_DEVICE_PATH;
  125. #define MSG_FIBRECHANNEL_DP 0x03
  126. typedef struct _FIBRECHANNEL_DEVICE_PATH {
  127. EFI_DEVICE_PATH Header;
  128. UINT32 Reserved;
  129. UINT64 WWN;
  130. UINT64 Lun;
  131. } FIBRECHANNEL_DEVICE_PATH;
  132. #define MSG_1394_DP 0x04
  133. typedef struct _F1394_DEVICE_PATH {
  134. EFI_DEVICE_PATH Header;
  135. UINT32 Reserved;
  136. UINT64 Guid;
  137. } F1394_DEVICE_PATH;
  138. #define MSG_USB_DP 0x05
  139. typedef struct _USB_DEVICE_PATH {
  140. EFI_DEVICE_PATH Header;
  141. UINT8 Port;
  142. UINT8 Reserved[3];
  143. UINT64 Guid;
  144. } USB_DEVICE_PATH;
  145. #define MSG_I2O_DP 0x06
  146. typedef struct _I2O_DEVICE_PATH {
  147. EFI_DEVICE_PATH Header;
  148. UINT32 Tid;
  149. } I2O_DEVICE_PATH;
  150. #define MSG_MAC_ADDR_DP 0x0b
  151. typedef struct _MAC_ADDR_DEVICE_PATH {
  152. EFI_DEVICE_PATH Header;
  153. EFI_MAC_ADDRESS MacAddress;
  154. UINT8 IfType;
  155. } MAC_ADDR_DEVICE_PATH;
  156. #define MSG_IPv4_DP 0x0c
  157. typedef struct _IPv4_DEVICE_PATH {
  158. EFI_DEVICE_PATH Header;
  159. EFI_IPv4_ADDRESS LocalIpAddress;
  160. EFI_IPv4_ADDRESS RemoteIpAddress;
  161. UINT16 LocalPort;
  162. UINT16 RemotePort;
  163. UINT16 Protocol;
  164. BOOLEAN StaticIpAddress;
  165. } IPv4_DEVICE_PATH;
  166. #define MSG_IPv6_DP 0x0d
  167. typedef struct _IPv6_DEVICE_PATH {
  168. EFI_DEVICE_PATH Header;
  169. EFI_IPv6_ADDRESS LocalIpAddress;
  170. EFI_IPv6_ADDRESS RemoteIpAddress;
  171. UINT16 LocalPort;
  172. UINT16 RemotePort;
  173. UINT16 Protocol;
  174. BOOLEAN StaticIpAddress;
  175. } IPv6_DEVICE_PATH;
  176. #define MSG_INFINIBAND_DP 0x09
  177. typedef struct _INFINIBAND_DEVICE_PATH {
  178. EFI_DEVICE_PATH Header;
  179. } INFINIBAND_DEVICE_PATH;
  180. #define MSG_UART_DP 0x0e
  181. typedef struct _UART_DEVICE_PATH {
  182. EFI_DEVICE_PATH Header;
  183. UINT64 BaudRate;
  184. UINT8 DataBits;
  185. UINT8 Parity;
  186. UINT8 StopBits;
  187. } UART_DEVICE_PATH;
  188. #define MSG_VENDOR_DP 0x0A
  189. /* Use VENDOR_DEVICE_PATH struct */
  190. #define DEVICE_PATH_MESSAGING_PC_ANSI \
  191. { 0xe0c14753, 0xf9be, 0x11d2, 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
  192. #define DEVICE_PATH_MESSAGING_VT_100 \
  193. { 0xdfa66065, 0xb419, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
  194. #define MEDIA_DEVICE_PATH 0x04
  195. #define MEDIA_HARDDRIVE_DP 0x01
  196. typedef struct _HARDDRIVE_DEVICE_PATH {
  197. EFI_DEVICE_PATH Header;
  198. UINT32 PartitionNumber;
  199. UINT64 PartitionStart;
  200. UINT64 PartitionSize;
  201. UINT8 Signature[16];
  202. UINT8 MBRType;
  203. UINT8 SignatureType;
  204. } HARDDRIVE_DEVICE_PATH;
  205. #define MBR_TYPE_PCAT 0x01
  206. #define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
  207. #define SIGNATURE_TYPE_MBR 0x01
  208. #define SIGNATURE_TYPE_GUID 0x02
  209. #define MEDIA_CDROM_DP 0x02
  210. typedef struct _CDROM_DEVICE_PATH {
  211. EFI_DEVICE_PATH Header;
  212. UINT32 BootEntry;
  213. UINT64 PartitionStart;
  214. UINT64 PartitionSize;
  215. } CDROM_DEVICE_PATH;
  216. #define MEDIA_VENDOR_DP 0x03
  217. /* Use VENDOR_DEVICE_PATH struct */
  218. #define MEDIA_FILEPATH_DP 0x04
  219. typedef struct _FILEPATH_DEVICE_PATH {
  220. EFI_DEVICE_PATH Header;
  221. CHAR16 PathName[1];
  222. } FILEPATH_DEVICE_PATH;
  223. #define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)
  224. #define MEDIA_PROTOCOL_DP 0x05
  225. typedef struct _MEDIA_PROTOCOL_DEVICE_PATH {
  226. EFI_DEVICE_PATH Header;
  227. EFI_GUID Protocol;
  228. } MEDIA_PROTOCOL_DEVICE_PATH;
  229. #define BBS_DEVICE_PATH 0x05
  230. #define BBS_BBS_DP 0x01
  231. typedef struct _BBS_BBS_DEVICE_PATH {
  232. EFI_DEVICE_PATH Header;
  233. UINT16 DeviceType;
  234. UINT16 StatusFlag;
  235. CHAR8 String[1];
  236. } BBS_BBS_DEVICE_PATH;
  237. /* DeviceType definitions - from BBS specification */
  238. #define BBS_TYPE_FLOPPY 0x01
  239. #define BBS_TYPE_HARDDRIVE 0x02
  240. #define BBS_TYPE_CDROM 0x03
  241. #define BBS_TYPE_PCMCIA 0x04
  242. #define BBS_TYPE_USB 0x05
  243. #define BBS_TYPE_EMBEDDED_NETWORK 0x06
  244. #define BBS_TYPE_DEV 0x80
  245. #define BBS_TYPE_UNKNOWN 0xFF
  246. typedef union {
  247. EFI_DEVICE_PATH DevPath;
  248. PCI_DEVICE_PATH Pci;
  249. PCCARD_DEVICE_PATH PcCard;
  250. MEMMAP_DEVICE_PATH MemMap;
  251. VENDOR_DEVICE_PATH Vendor;
  252. UNKNOWN_DEVICE_VENDOR_DEVICE_PATH UnknownVendor;
  253. CONTROLLER_DEVICE_PATH Controller;
  254. ACPI_HID_DEVICE_PATH Acpi;
  255. ATAPI_DEVICE_PATH Atapi;
  256. SCSI_DEVICE_PATH Scsi;
  257. FIBRECHANNEL_DEVICE_PATH FibreChannel;
  258. F1394_DEVICE_PATH F1394;
  259. USB_DEVICE_PATH Usb;
  260. I2O_DEVICE_PATH I2O;
  261. MAC_ADDR_DEVICE_PATH MacAddr;
  262. IPv4_DEVICE_PATH Ipv4;
  263. IPv6_DEVICE_PATH Ipv6;
  264. INFINIBAND_DEVICE_PATH InfiniBand;
  265. UART_DEVICE_PATH Uart;
  266. HARDDRIVE_DEVICE_PATH HardDrive;
  267. CDROM_DEVICE_PATH CD;
  268. FILEPATH_DEVICE_PATH FilePath;
  269. MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol;
  270. BBS_BBS_DEVICE_PATH Bbs;
  271. } EFI_DEV_PATH;
  272. typedef union {
  273. EFI_DEVICE_PATH *DevPath;
  274. PCI_DEVICE_PATH *Pci;
  275. PCCARD_DEVICE_PATH *PcCard;
  276. MEMMAP_DEVICE_PATH *MemMap;
  277. VENDOR_DEVICE_PATH *Vendor;
  278. UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownVendor;
  279. CONTROLLER_DEVICE_PATH *Controller;
  280. ACPI_HID_DEVICE_PATH *Acpi;
  281. ATAPI_DEVICE_PATH *Atapi;
  282. SCSI_DEVICE_PATH *Scsi;
  283. FIBRECHANNEL_DEVICE_PATH *FibreChannel;
  284. F1394_DEVICE_PATH *F1394;
  285. USB_DEVICE_PATH *Usb;
  286. I2O_DEVICE_PATH *I2O;
  287. MAC_ADDR_DEVICE_PATH *MacAddr;
  288. IPv4_DEVICE_PATH *Ipv4;
  289. IPv6_DEVICE_PATH *Ipv6;
  290. INFINIBAND_DEVICE_PATH *InfiniBand;
  291. UART_DEVICE_PATH *Uart;
  292. HARDDRIVE_DEVICE_PATH *HardDrive;
  293. FILEPATH_DEVICE_PATH *FilePath;
  294. MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol;
  295. CDROM_DEVICE_PATH *CD;
  296. BBS_BBS_DEVICE_PATH *Bbs;
  297. } EFI_DEV_PATH_PTR;
  298. #endif