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.

376 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. } FIBRECHANNEL_DEVICE_PATH;
  131. #define MSG_1394_DP 0x04
  132. typedef struct _F1394_DEVICE_PATH {
  133. EFI_DEVICE_PATH Header;
  134. UINT32 Reserved;
  135. UINT64 Guid;
  136. } F1394_DEVICE_PATH;
  137. #define MSG_USB_DP 0x05
  138. typedef struct _USB_DEVICE_PATH {
  139. EFI_DEVICE_PATH Header;
  140. UINT8 Port;
  141. UINT8 Reserved[3];
  142. UINT64 Guid;
  143. } USB_DEVICE_PATH;
  144. #define MSG_I2O_DP 0x06
  145. typedef struct _I2O_DEVICE_PATH {
  146. EFI_DEVICE_PATH Header;
  147. UINT32 Tid;
  148. } I2O_DEVICE_PATH;
  149. #define MSG_MAC_ADDR_DP 0x0b
  150. typedef struct _MAC_ADDR_DEVICE_PATH {
  151. EFI_DEVICE_PATH Header;
  152. EFI_MAC_ADDRESS MacAddress;
  153. UINT8 IfType;
  154. } MAC_ADDR_DEVICE_PATH;
  155. #define MSG_IPv4_DP 0x0c
  156. typedef struct _IPv4_DEVICE_PATH {
  157. EFI_DEVICE_PATH Header;
  158. EFI_IPv4_ADDRESS LocalIpAddress;
  159. EFI_IPv4_ADDRESS RemoteIpAddress;
  160. UINT16 LocalPort;
  161. UINT16 RemotePort;
  162. UINT16 Protocol;
  163. BOOLEAN StaticIpAddress;
  164. } IPv4_DEVICE_PATH;
  165. #define MSG_IPv6_DP 0x0d
  166. typedef struct _IPv6_DEVICE_PATH {
  167. EFI_DEVICE_PATH Header;
  168. EFI_IPv6_ADDRESS LocalIpAddress;
  169. EFI_IPv6_ADDRESS RemoteIpAddress;
  170. UINT16 LocalPort;
  171. UINT16 RemotePort;
  172. UINT16 Protocol;
  173. BOOLEAN StaticIpAddress;
  174. } IPv6_DEVICE_PATH;
  175. #define MSG_INFINIBAND_DP 0x09
  176. typedef struct _INFINIBAND_DEVICE_PATH {
  177. EFI_DEVICE_PATH Header;
  178. } INFINIBAND_DEVICE_PATH;
  179. #define MSG_UART_DP 0x0e
  180. typedef struct _UART_DEVICE_PATH {
  181. EFI_DEVICE_PATH Header;
  182. UINT64 BaudRate;
  183. UINT8 DataBits;
  184. UINT8 Parity;
  185. UINT8 StopBits;
  186. } UART_DEVICE_PATH;
  187. #define MSG_VENDOR_DP 0x0A
  188. /* Use VENDOR_DEVICE_PATH struct */
  189. #define DEVICE_PATH_MESSAGING_PC_ANSI \
  190. { 0xe0c14753, 0xf9be, 0x11d2, 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
  191. #define DEVICE_PATH_MESSAGING_VT_100 \
  192. { 0xdfa66065, 0xb419, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
  193. #define MEDIA_DEVICE_PATH 0x04
  194. #define MEDIA_HARDDRIVE_DP 0x01
  195. typedef struct _HARDDRIVE_DEVICE_PATH {
  196. EFI_DEVICE_PATH Header;
  197. UINT32 PartitionNumber;
  198. UINT64 PartitionStart;
  199. UINT64 PartitionSize;
  200. UINT8 Signature[16];
  201. UINT8 MBRType;
  202. UINT8 SignatureType;
  203. } HARDDRIVE_DEVICE_PATH;
  204. #define MBR_TYPE_PCAT 0x01
  205. #define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
  206. #define SIGNATURE_TYPE_MBR 0x01
  207. #define SIGNATURE_TYPE_GUID 0x02
  208. #define MEDIA_CDROM_DP 0x02
  209. typedef struct _CDROM_DEVICE_PATH {
  210. EFI_DEVICE_PATH Header;
  211. UINT32 BootEntry;
  212. UINT64 PartitionStart;
  213. UINT64 PartitionSize;
  214. } CDROM_DEVICE_PATH;
  215. #define MEDIA_VENDOR_DP 0x03
  216. /* Use VENDOR_DEVICE_PATH struct */
  217. #define MEDIA_FILEPATH_DP 0x04
  218. typedef struct _FILEPATH_DEVICE_PATH {
  219. EFI_DEVICE_PATH Header;
  220. CHAR16 PathName[1];
  221. } FILEPATH_DEVICE_PATH;
  222. #define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)
  223. #define MEDIA_PROTOCOL_DP 0x05
  224. typedef struct _MEDIA_PROTOCOL_DEVICE_PATH {
  225. EFI_DEVICE_PATH Header;
  226. EFI_GUID Protocol;
  227. } MEDIA_PROTOCOL_DEVICE_PATH;
  228. #define BBS_DEVICE_PATH 0x05
  229. #define BBS_BBS_DP 0x01
  230. typedef struct _BBS_BBS_DEVICE_PATH {
  231. EFI_DEVICE_PATH Header;
  232. UINT16 DeviceType;
  233. UINT16 StatusFlag;
  234. CHAR8 String[1];
  235. } BBS_BBS_DEVICE_PATH;
  236. /* DeviceType definitions - from BBS specification */
  237. #define BBS_TYPE_FLOPPY 0x01
  238. #define BBS_TYPE_HARDDRIVE 0x02
  239. #define BBS_TYPE_CDROM 0x03
  240. #define BBS_TYPE_PCMCIA 0x04
  241. #define BBS_TYPE_USB 0x05
  242. #define BBS_TYPE_EMBEDDED_NETWORK 0x06
  243. #define BBS_TYPE_DEV 0x80
  244. #define BBS_TYPE_UNKNOWN 0xFF
  245. typedef union {
  246. EFI_DEVICE_PATH DevPath;
  247. PCI_DEVICE_PATH Pci;
  248. PCCARD_DEVICE_PATH PcCard;
  249. MEMMAP_DEVICE_PATH MemMap;
  250. VENDOR_DEVICE_PATH Vendor;
  251. UNKNOWN_DEVICE_VENDOR_DEVICE_PATH UnknownVendor;
  252. CONTROLLER_DEVICE_PATH Controller;
  253. ACPI_HID_DEVICE_PATH Acpi;
  254. ATAPI_DEVICE_PATH Atapi;
  255. SCSI_DEVICE_PATH Scsi;
  256. FIBRECHANNEL_DEVICE_PATH FibreChannel;
  257. F1394_DEVICE_PATH F1394;
  258. USB_DEVICE_PATH Usb;
  259. I2O_DEVICE_PATH I2O;
  260. MAC_ADDR_DEVICE_PATH MacAddr;
  261. IPv4_DEVICE_PATH Ipv4;
  262. IPv6_DEVICE_PATH Ipv6;
  263. INFINIBAND_DEVICE_PATH InfiniBand;
  264. UART_DEVICE_PATH Uart;
  265. HARDDRIVE_DEVICE_PATH HardDrive;
  266. CDROM_DEVICE_PATH CD;
  267. FILEPATH_DEVICE_PATH FilePath;
  268. MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol;
  269. BBS_BBS_DEVICE_PATH Bbs;
  270. } EFI_DEV_PATH;
  271. typedef union {
  272. EFI_DEVICE_PATH *DevPath;
  273. PCI_DEVICE_PATH *Pci;
  274. PCCARD_DEVICE_PATH *PcCard;
  275. MEMMAP_DEVICE_PATH *MemMap;
  276. VENDOR_DEVICE_PATH *Vendor;
  277. UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownVendor;
  278. CONTROLLER_DEVICE_PATH *Controller;
  279. ACPI_HID_DEVICE_PATH *Acpi;
  280. ATAPI_DEVICE_PATH *Atapi;
  281. SCSI_DEVICE_PATH *Scsi;
  282. FIBRECHANNEL_DEVICE_PATH *FibreChannel;
  283. F1394_DEVICE_PATH *F1394;
  284. USB_DEVICE_PATH *Usb;
  285. I2O_DEVICE_PATH *I2O;
  286. MAC_ADDR_DEVICE_PATH *MacAddr;
  287. IPv4_DEVICE_PATH *Ipv4;
  288. IPv6_DEVICE_PATH *Ipv6;
  289. INFINIBAND_DEVICE_PATH *InfiniBand;
  290. UART_DEVICE_PATH *Uart;
  291. HARDDRIVE_DEVICE_PATH *HardDrive;
  292. FILEPATH_DEVICE_PATH *FilePath;
  293. MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol;
  294. CDROM_DEVICE_PATH *CD;
  295. BBS_BBS_DEVICE_PATH *Bbs;
  296. } EFI_DEV_PATH_PTR;
  297. #endif