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.

DevicePath.h 30KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  1. /** @file
  2. The device path protocol as defined in UEFI 2.0.
  3. The device path represents a programmatic path to a device,
  4. from a software point of view. The path must persist from boot to boot, so
  5. it can not contain things like PCI bus numbers that change from boot to boot.
  6. Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
  7. This program and the accompanying materials are licensed and made available under
  8. the terms and conditions of the BSD License that accompanies this distribution.
  9. The full text of the license may be found at
  10. http://opensource.org/licenses/bsd-license.php.
  11. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  13. **/
  14. #ifndef __EFI_DEVICE_PATH_PROTOCOL_H__
  15. #define __EFI_DEVICE_PATH_PROTOCOL_H__
  16. #include <ipxe/efi/Guid/PcAnsi.h>
  17. ///
  18. /// Device Path protocol.
  19. ///
  20. #define EFI_DEVICE_PATH_PROTOCOL_GUID \
  21. { \
  22. 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
  23. }
  24. ///
  25. /// Device Path guid definition for backward-compatible with EFI1.1.
  26. ///
  27. #define DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH_PROTOCOL_GUID
  28. #pragma pack(1)
  29. /**
  30. This protocol can be used on any device handle to obtain generic path/location
  31. information concerning the physical device or logical device. If the handle does
  32. not logically map to a physical device, the handle may not necessarily support
  33. the device path protocol. The device path describes the location of the device
  34. the handle is for. The size of the Device Path can be determined from the structures
  35. that make up the Device Path.
  36. **/
  37. typedef struct {
  38. UINT8 Type; ///< 0x01 Hardware Device Path.
  39. ///< 0x02 ACPI Device Path.
  40. ///< 0x03 Messaging Device Path.
  41. ///< 0x04 Media Device Path.
  42. ///< 0x05 BIOS Boot Specification Device Path.
  43. ///< 0x7F End of Hardware Device Path.
  44. UINT8 SubType; ///< Varies by Type
  45. ///< 0xFF End Entire Device Path, or
  46. ///< 0x01 End This Instance of a Device Path and start a new
  47. ///< Device Path.
  48. UINT8 Length[2]; ///< Specific Device Path data. Type and Sub-Type define
  49. ///< type of data. Size of data is included in Length.
  50. } EFI_DEVICE_PATH_PROTOCOL;
  51. ///
  52. /// Device Path protocol definition for backward-compatible with EFI1.1.
  53. ///
  54. typedef EFI_DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH;
  55. ///
  56. /// Hardware Device Paths.
  57. ///
  58. #define HARDWARE_DEVICE_PATH 0x01
  59. ///
  60. /// PCI Device Path SubType.
  61. ///
  62. #define HW_PCI_DP 0x01
  63. ///
  64. /// PCI Device Path.
  65. ///
  66. typedef struct {
  67. EFI_DEVICE_PATH_PROTOCOL Header;
  68. ///
  69. /// PCI Function Number.
  70. ///
  71. UINT8 Function;
  72. ///
  73. /// PCI Device Number.
  74. ///
  75. UINT8 Device;
  76. } PCI_DEVICE_PATH;
  77. ///
  78. /// PCCARD Device Path SubType.
  79. ///
  80. #define HW_PCCARD_DP 0x02
  81. ///
  82. /// PCCARD Device Path.
  83. ///
  84. typedef struct {
  85. EFI_DEVICE_PATH_PROTOCOL Header;
  86. ///
  87. /// Function Number (0 = First Function).
  88. ///
  89. UINT8 FunctionNumber;
  90. } PCCARD_DEVICE_PATH;
  91. ///
  92. /// Memory Mapped Device Path SubType.
  93. ///
  94. #define HW_MEMMAP_DP 0x03
  95. ///
  96. /// Memory Mapped Device Path.
  97. ///
  98. typedef struct {
  99. EFI_DEVICE_PATH_PROTOCOL Header;
  100. ///
  101. /// EFI_MEMORY_TYPE
  102. ///
  103. UINT32 MemoryType;
  104. ///
  105. /// Starting Memory Address.
  106. ///
  107. EFI_PHYSICAL_ADDRESS StartingAddress;
  108. ///
  109. /// Ending Memory Address.
  110. ///
  111. EFI_PHYSICAL_ADDRESS EndingAddress;
  112. } MEMMAP_DEVICE_PATH;
  113. ///
  114. /// Hardware Vendor Device Path SubType.
  115. ///
  116. #define HW_VENDOR_DP 0x04
  117. ///
  118. /// The Vendor Device Path allows the creation of vendor-defined Device Paths. A vendor must
  119. /// allocate a Vendor GUID for a Device Path. The Vendor GUID can then be used to define the
  120. /// contents on the n bytes that follow in the Vendor Device Path node.
  121. ///
  122. typedef struct {
  123. EFI_DEVICE_PATH_PROTOCOL Header;
  124. ///
  125. /// Vendor-assigned GUID that defines the data that follows.
  126. ///
  127. EFI_GUID Guid;
  128. ///
  129. /// Vendor-defined variable size data.
  130. ///
  131. } VENDOR_DEVICE_PATH;
  132. ///
  133. /// Controller Device Path SubType.
  134. ///
  135. #define HW_CONTROLLER_DP 0x05
  136. ///
  137. /// Controller Device Path.
  138. ///
  139. typedef struct {
  140. EFI_DEVICE_PATH_PROTOCOL Header;
  141. ///
  142. /// Controller number.
  143. ///
  144. UINT32 ControllerNumber;
  145. } CONTROLLER_DEVICE_PATH;
  146. ///
  147. /// ACPI Device Paths.
  148. ///
  149. #define ACPI_DEVICE_PATH 0x02
  150. ///
  151. /// ACPI Device Path SubType.
  152. ///
  153. #define ACPI_DP 0x01
  154. typedef struct {
  155. EFI_DEVICE_PATH_PROTOCOL Header;
  156. ///
  157. /// Device's PnP hardware ID stored in a numeric 32-bit
  158. /// compressed EISA-type ID. This value must match the
  159. /// corresponding _HID in the ACPI name space.
  160. ///
  161. UINT32 HID;
  162. ///
  163. /// Unique ID that is required by ACPI if two devices have the
  164. /// same _HID. This value must also match the corresponding
  165. /// _UID/_HID pair in the ACPI name space. Only the 32-bit
  166. /// numeric value type of _UID is supported. Thus, strings must
  167. /// not be used for the _UID in the ACPI name space.
  168. ///
  169. UINT32 UID;
  170. } ACPI_HID_DEVICE_PATH;
  171. ///
  172. /// Expanded ACPI Device Path SubType.
  173. ///
  174. #define ACPI_EXTENDED_DP 0x02
  175. typedef struct {
  176. EFI_DEVICE_PATH_PROTOCOL Header;
  177. ///
  178. /// Device's PnP hardware ID stored in a numeric 32-bit
  179. /// compressed EISA-type ID. This value must match the
  180. /// corresponding _HID in the ACPI name space.
  181. ///
  182. UINT32 HID;
  183. ///
  184. /// Unique ID that is required by ACPI if two devices have the
  185. /// same _HID. This value must also match the corresponding
  186. /// _UID/_HID pair in the ACPI name space.
  187. ///
  188. UINT32 UID;
  189. ///
  190. /// Device's compatible PnP hardware ID stored in a numeric
  191. /// 32-bit compressed EISA-type ID. This value must match at
  192. /// least one of the compatible device IDs returned by the
  193. /// corresponding _CID in the ACPI name space.
  194. ///
  195. UINT32 CID;
  196. ///
  197. /// Optional variable length _HIDSTR.
  198. /// Optional variable length _UIDSTR.
  199. /// Optional variable length _CIDSTR.
  200. ///
  201. } ACPI_EXTENDED_HID_DEVICE_PATH;
  202. //
  203. // EISA ID Macro
  204. // EISA ID Definition 32-bits
  205. // bits[15:0] - three character compressed ASCII EISA ID.
  206. // bits[31:16] - binary number
  207. // Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
  208. //
  209. #define PNP_EISA_ID_CONST 0x41d0
  210. #define EISA_ID(_Name, _Num) ((UINT32)((_Name) | (_Num) << 16))
  211. #define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
  212. #define EFI_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
  213. #define PNP_EISA_ID_MASK 0xffff
  214. #define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)
  215. ///
  216. /// ACPI _ADR Device Path SubType.
  217. ///
  218. #define ACPI_ADR_DP 0x03
  219. ///
  220. /// The _ADR device path is used to contain video output device attributes to support the Graphics
  221. /// Output Protocol. The device path can contain multiple _ADR entries if multiple video output
  222. /// devices are displaying the same output.
  223. ///
  224. typedef struct {
  225. EFI_DEVICE_PATH_PROTOCOL Header;
  226. ///
  227. /// _ADR value. For video output devices the value of this
  228. /// field comes from Table B-2 of the ACPI 3.0 specification. At
  229. /// least one _ADR value is required.
  230. ///
  231. UINT32 ADR;
  232. //
  233. // This device path may optionally contain more than one _ADR entry.
  234. //
  235. } ACPI_ADR_DEVICE_PATH;
  236. #define ACPI_ADR_DISPLAY_TYPE_OTHER 0
  237. #define ACPI_ADR_DISPLAY_TYPE_VGA 1
  238. #define ACPI_ADR_DISPLAY_TYPE_TV 2
  239. #define ACPI_ADR_DISPLAY_TYPE_EXTERNAL_DIGITAL 3
  240. #define ACPI_ADR_DISPLAY_TYPE_INTERNAL_DIGITAL 4
  241. #define ACPI_DISPLAY_ADR(_DeviceIdScheme, _HeadId, _NonVgaOutput, _BiosCanDetect, _VendorInfo, _Type, _Port, _Index) \
  242. ((UINT32)( (((_DeviceIdScheme) & 0x1) << 31) | \
  243. (((_HeadId) & 0x7) << 18) | \
  244. (((_NonVgaOutput) & 0x1) << 17) | \
  245. (((_BiosCanDetect) & 0x1) << 16) | \
  246. (((_VendorInfo) & 0xf) << 12) | \
  247. (((_Type) & 0xf) << 8) | \
  248. (((_Port) & 0xf) << 4) | \
  249. ((_Index) & 0xf) ))
  250. ///
  251. /// Messaging Device Paths.
  252. /// This Device Path is used to describe the connection of devices outside the resource domain of the
  253. /// system. This Device Path can describe physical messaging information like SCSI ID, or abstract
  254. /// information like networking protocol IP addresses.
  255. ///
  256. #define MESSAGING_DEVICE_PATH 0x03
  257. ///
  258. /// ATAPI Device Path SubType
  259. ///
  260. #define MSG_ATAPI_DP 0x01
  261. typedef struct {
  262. EFI_DEVICE_PATH_PROTOCOL Header;
  263. ///
  264. /// Set to zero for primary, or one for secondary.
  265. ///
  266. UINT8 PrimarySecondary;
  267. ///
  268. /// Set to zero for master, or one for slave mode.
  269. ///
  270. UINT8 SlaveMaster;
  271. ///
  272. /// Logical Unit Number.
  273. ///
  274. UINT16 Lun;
  275. } ATAPI_DEVICE_PATH;
  276. ///
  277. /// SCSI Device Path SubType.
  278. ///
  279. #define MSG_SCSI_DP 0x02
  280. typedef struct {
  281. EFI_DEVICE_PATH_PROTOCOL Header;
  282. ///
  283. /// Target ID on the SCSI bus (PUN).
  284. ///
  285. UINT16 Pun;
  286. ///
  287. /// Logical Unit Number (LUN).
  288. ///
  289. UINT16 Lun;
  290. } SCSI_DEVICE_PATH;
  291. ///
  292. /// Fibre Channel SubType.
  293. ///
  294. #define MSG_FIBRECHANNEL_DP 0x03
  295. typedef struct {
  296. EFI_DEVICE_PATH_PROTOCOL Header;
  297. ///
  298. /// Reserved for the future.
  299. ///
  300. UINT32 Reserved;
  301. ///
  302. /// Fibre Channel World Wide Number.
  303. ///
  304. UINT64 WWN;
  305. ///
  306. /// Fibre Channel Logical Unit Number.
  307. ///
  308. UINT64 Lun;
  309. } FIBRECHANNEL_DEVICE_PATH;
  310. ///
  311. /// 1394 Device Path SubType
  312. ///
  313. #define MSG_1394_DP 0x04
  314. typedef struct {
  315. EFI_DEVICE_PATH_PROTOCOL Header;
  316. ///
  317. /// Reserved for the future.
  318. ///
  319. UINT32 Reserved;
  320. ///
  321. /// 1394 Global Unique ID (GUID).
  322. ///
  323. UINT64 Guid;
  324. } F1394_DEVICE_PATH;
  325. ///
  326. /// USB Device Path SubType.
  327. ///
  328. #define MSG_USB_DP 0x05
  329. typedef struct {
  330. EFI_DEVICE_PATH_PROTOCOL Header;
  331. ///
  332. /// USB Parent Port Number.
  333. ///
  334. UINT8 ParentPortNumber;
  335. ///
  336. /// USB Interface Number.
  337. ///
  338. UINT8 InterfaceNumber;
  339. } USB_DEVICE_PATH;
  340. ///
  341. /// USB Class Device Path SubType.
  342. ///
  343. #define MSG_USB_CLASS_DP 0x0f
  344. typedef struct {
  345. EFI_DEVICE_PATH_PROTOCOL Header;
  346. ///
  347. /// Vendor ID assigned by USB-IF. A value of 0xFFFF will
  348. /// match any Vendor ID.
  349. ///
  350. UINT16 VendorId;
  351. ///
  352. /// Product ID assigned by USB-IF. A value of 0xFFFF will
  353. /// match any Product ID.
  354. ///
  355. UINT16 ProductId;
  356. ///
  357. /// The class code assigned by the USB-IF. A value of 0xFF
  358. /// will match any class code.
  359. ///
  360. UINT8 DeviceClass;
  361. ///
  362. /// The subclass code assigned by the USB-IF. A value of
  363. /// 0xFF will match any subclass code.
  364. ///
  365. UINT8 DeviceSubClass;
  366. ///
  367. /// The protocol code assigned by the USB-IF. A value of
  368. /// 0xFF will match any protocol code.
  369. ///
  370. UINT8 DeviceProtocol;
  371. } USB_CLASS_DEVICE_PATH;
  372. ///
  373. /// USB WWID Device Path SubType.
  374. ///
  375. #define MSG_USB_WWID_DP 0x10
  376. ///
  377. /// This device path describes a USB device using its serial number.
  378. ///
  379. typedef struct {
  380. EFI_DEVICE_PATH_PROTOCOL Header;
  381. ///
  382. /// USB interface number.
  383. ///
  384. UINT16 InterfaceNumber;
  385. ///
  386. /// USB vendor id of the device.
  387. ///
  388. UINT16 VendorId;
  389. ///
  390. /// USB product id of the device.
  391. ///
  392. UINT16 ProductId;
  393. ///
  394. /// Last 64-or-fewer UTF-16 characters of the USB
  395. /// serial number. The length of the string is
  396. /// determined by the Length field less the offset of the
  397. /// Serial Number field (10)
  398. ///
  399. /// CHAR16 SerialNumber[...];
  400. } USB_WWID_DEVICE_PATH;
  401. ///
  402. /// Device Logical Unit SubType.
  403. ///
  404. #define MSG_DEVICE_LOGICAL_UNIT_DP 0x11
  405. typedef struct {
  406. EFI_DEVICE_PATH_PROTOCOL Header;
  407. ///
  408. /// Logical Unit Number for the interface.
  409. ///
  410. UINT8 Lun;
  411. } DEVICE_LOGICAL_UNIT_DEVICE_PATH;
  412. ///
  413. /// SATA Device Path SubType.
  414. ///
  415. #define MSG_SATA_DP 0x12
  416. typedef struct {
  417. EFI_DEVICE_PATH_PROTOCOL Header;
  418. ///
  419. /// The HBA port number that facilitates the connection to the
  420. /// device or a port multiplier. The value 0xFFFF is reserved.
  421. ///
  422. UINT16 HBAPortNumber;
  423. ///
  424. /// The Port multiplier port number that facilitates the connection
  425. /// to the device. Bit 15 should be set if the device is directly
  426. /// connected to the HBA.
  427. ///
  428. UINT16 PortMultiplierPortNumber;
  429. ///
  430. /// Logical Unit Number.
  431. ///
  432. UINT16 Lun;
  433. } SATA_DEVICE_PATH;
  434. ///
  435. /// Flag for if the device is directly connected to the HBA.
  436. ///
  437. #define SATA_HBA_DIRECT_CONNECT_FLAG 0x8000
  438. ///
  439. /// I2O Device Path SubType.
  440. ///
  441. #define MSG_I2O_DP 0x06
  442. typedef struct {
  443. EFI_DEVICE_PATH_PROTOCOL Header;
  444. ///
  445. /// Target ID (TID) for a device.
  446. ///
  447. UINT32 Tid;
  448. } I2O_DEVICE_PATH;
  449. ///
  450. /// MAC Address Device Path SubType.
  451. ///
  452. #define MSG_MAC_ADDR_DP 0x0b
  453. typedef struct {
  454. EFI_DEVICE_PATH_PROTOCOL Header;
  455. ///
  456. /// The MAC address for a network interface padded with 0s.
  457. ///
  458. EFI_MAC_ADDRESS MacAddress;
  459. ///
  460. /// Network interface type(i.e. 802.3, FDDI).
  461. ///
  462. UINT8 IfType;
  463. } MAC_ADDR_DEVICE_PATH;
  464. ///
  465. /// IPv4 Device Path SubType
  466. ///
  467. #define MSG_IPv4_DP 0x0c
  468. typedef struct {
  469. EFI_DEVICE_PATH_PROTOCOL Header;
  470. ///
  471. /// The local IPv4 address.
  472. ///
  473. EFI_IPv4_ADDRESS LocalIpAddress;
  474. ///
  475. /// The remote IPv4 address.
  476. ///
  477. EFI_IPv4_ADDRESS RemoteIpAddress;
  478. ///
  479. /// The local port number.
  480. ///
  481. UINT16 LocalPort;
  482. ///
  483. /// The remote port number.
  484. ///
  485. UINT16 RemotePort;
  486. ///
  487. /// The network protocol(i.e. UDP, TCP).
  488. ///
  489. UINT16 Protocol;
  490. ///
  491. /// 0x00 - The Source IP Address was assigned though DHCP.
  492. /// 0x01 - The Source IP Address is statically bound.
  493. ///
  494. BOOLEAN StaticIpAddress;
  495. } IPv4_DEVICE_PATH;
  496. ///
  497. /// IPv6 Device Path SubType.
  498. ///
  499. #define MSG_IPv6_DP 0x0d
  500. typedef struct {
  501. EFI_DEVICE_PATH_PROTOCOL Header;
  502. ///
  503. /// The local IPv6 address.
  504. ///
  505. EFI_IPv6_ADDRESS LocalIpAddress;
  506. ///
  507. /// The remote IPv6 address.
  508. ///
  509. EFI_IPv6_ADDRESS RemoteIpAddress;
  510. ///
  511. /// The local port number.
  512. ///
  513. UINT16 LocalPort;
  514. ///
  515. /// The remote port number.
  516. ///
  517. UINT16 RemotePort;
  518. ///
  519. /// The network protocol(i.e. UDP, TCP).
  520. ///
  521. UINT16 Protocol;
  522. ///
  523. /// 0x00 - The Source IP Address was assigned though DHCP.
  524. /// 0x01 - The Source IP Address is statically bound.
  525. ///
  526. BOOLEAN StaticIpAddress;
  527. } IPv6_DEVICE_PATH;
  528. ///
  529. /// InfiniBand Device Path SubType.
  530. ///
  531. #define MSG_INFINIBAND_DP 0x09
  532. typedef struct {
  533. EFI_DEVICE_PATH_PROTOCOL Header;
  534. ///
  535. /// Flags to help identify/manage InfiniBand device path elements:
  536. /// Bit 0 - IOC/Service (0b = IOC, 1b = Service).
  537. /// Bit 1 - Extend Boot Environment.
  538. /// Bit 2 - Console Protocol.
  539. /// Bit 3 - Storage Protocol.
  540. /// Bit 4 - Network Protocol.
  541. /// All other bits are reserved.
  542. ///
  543. UINT32 ResourceFlags;
  544. ///
  545. /// 128-bit Global Identifier for remote fabric port.
  546. ///
  547. UINT8 PortGid[16];
  548. ///
  549. /// 64-bit unique identifier to remote IOC or server process.
  550. /// Interpretation of field specified by Resource Flags (bit 0).
  551. ///
  552. UINT64 ServiceId;
  553. ///
  554. /// 64-bit persistent ID of remote IOC port.
  555. ///
  556. UINT64 TargetPortId;
  557. ///
  558. /// 64-bit persistent ID of remote device.
  559. ///
  560. UINT64 DeviceId;
  561. } INFINIBAND_DEVICE_PATH;
  562. #define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE 0x01
  563. #define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT 0x02
  564. #define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL 0x04
  565. #define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL 0x08
  566. #define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL 0x10
  567. ///
  568. /// UART Device Path SubType.
  569. ///
  570. #define MSG_UART_DP 0x0e
  571. typedef struct {
  572. EFI_DEVICE_PATH_PROTOCOL Header;
  573. ///
  574. /// Reserved.
  575. ///
  576. UINT32 Reserved;
  577. ///
  578. /// The baud rate setting for the UART style device. A value of 0
  579. /// means that the device's default baud rate will be used.
  580. ///
  581. UINT64 BaudRate;
  582. ///
  583. /// The number of data bits for the UART style device. A value
  584. /// of 0 means that the device's default number of data bits will be used.
  585. ///
  586. UINT8 DataBits;
  587. ///
  588. /// The parity setting for the UART style device.
  589. /// Parity 0x00 - Default Parity.
  590. /// Parity 0x01 - No Parity.
  591. /// Parity 0x02 - Even Parity.
  592. /// Parity 0x03 - Odd Parity.
  593. /// Parity 0x04 - Mark Parity.
  594. /// Parity 0x05 - Space Parity.
  595. ///
  596. UINT8 Parity;
  597. ///
  598. /// The number of stop bits for the UART style device.
  599. /// Stop Bits 0x00 - Default Stop Bits.
  600. /// Stop Bits 0x01 - 1 Stop Bit.
  601. /// Stop Bits 0x02 - 1.5 Stop Bits.
  602. /// Stop Bits 0x03 - 2 Stop Bits.
  603. ///
  604. UINT8 StopBits;
  605. } UART_DEVICE_PATH;
  606. //
  607. // Use VENDOR_DEVICE_PATH struct
  608. //
  609. #define MSG_VENDOR_DP 0x0a
  610. typedef VENDOR_DEVICE_PATH VENDOR_DEFINED_DEVICE_PATH;
  611. #define DEVICE_PATH_MESSAGING_PC_ANSI EFI_PC_ANSI_GUID
  612. #define DEVICE_PATH_MESSAGING_VT_100 EFI_VT_100_GUID
  613. #define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID
  614. #define DEVICE_PATH_MESSAGING_VT_UTF8 EFI_VT_UTF8_GUID
  615. ///
  616. /// A new device path node is defined to declare flow control characteristics.
  617. /// UART Flow Control Messaging Device Path
  618. ///
  619. typedef struct {
  620. EFI_DEVICE_PATH_PROTOCOL Header;
  621. ///
  622. /// DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL GUID.
  623. ///
  624. EFI_GUID Guid;
  625. ///
  626. /// Bitmap of supported flow control types.
  627. /// Bit 0 set indicates hardware flow control.
  628. /// Bit 1 set indicates Xon/Xoff flow control.
  629. /// All other bits are reserved and are clear.
  630. ///
  631. UINT32 FlowControlMap;
  632. } UART_FLOW_CONTROL_DEVICE_PATH;
  633. #define UART_FLOW_CONTROL_HARDWARE 0x00000001
  634. #define UART_FLOW_CONTROL_XON_XOFF 0x00000010
  635. #define DEVICE_PATH_MESSAGING_SAS EFI_SAS_DEVICE_PATH_GUID
  636. ///
  637. /// Serial Attached SCSI (SAS) devices.
  638. ///
  639. typedef struct {
  640. EFI_DEVICE_PATH_PROTOCOL Header;
  641. ///
  642. /// DEVICE_PATH_MESSAGING_SAS GUID.
  643. ///
  644. EFI_GUID Guid;
  645. ///
  646. /// Reserved for future use.
  647. ///
  648. UINT32 Reserved;
  649. ///
  650. /// SAS Address for Serial Attached SCSI Target.
  651. ///
  652. UINT64 SasAddress;
  653. ///
  654. /// SAS Logical Unit Number.
  655. ///
  656. UINT64 Lun;
  657. ///
  658. /// More Information about the device and its interconnect.
  659. ///
  660. UINT16 DeviceTopology;
  661. ///
  662. /// Relative Target Port (RTP).
  663. ///
  664. UINT16 RelativeTargetPort;
  665. } SAS_DEVICE_PATH;
  666. ///
  667. /// iSCSI Device Path SubType
  668. ///
  669. #define MSG_ISCSI_DP 0x13
  670. typedef struct {
  671. EFI_DEVICE_PATH_PROTOCOL Header;
  672. ///
  673. /// Network Protocol (0 = TCP, 1+ = reserved).
  674. ///
  675. UINT16 NetworkProtocol;
  676. ///
  677. /// iSCSI Login Options.
  678. ///
  679. UINT16 LoginOption;
  680. ///
  681. /// iSCSI Logical Unit Number.
  682. ///
  683. UINT64 Lun;
  684. ///
  685. /// iSCSI Target Portal group tag the initiator intends
  686. /// to establish a session with.
  687. ///
  688. UINT16 TargetPortalGroupTag;
  689. ///
  690. /// iSCSI NodeTarget Name. The length of the name
  691. /// is determined by subtracting the offset of this field from Length.
  692. ///
  693. /// CHAR8 iSCSI Target Name.
  694. } ISCSI_DEVICE_PATH;
  695. #define ISCSI_LOGIN_OPTION_NO_HEADER_DIGEST 0x0000
  696. #define ISCSI_LOGIN_OPTION_HEADER_DIGEST_USING_CRC32C 0x0002
  697. #define ISCSI_LOGIN_OPTION_NO_DATA_DIGEST 0x0000
  698. #define ISCSI_LOGIN_OPTION_DATA_DIGEST_USING_CRC32C 0x0008
  699. #define ISCSI_LOGIN_OPTION_AUTHMETHOD_CHAP 0x0000
  700. #define ISCSI_LOGIN_OPTION_AUTHMETHOD_NON 0x1000
  701. #define ISCSI_LOGIN_OPTION_CHAP_BI 0x0000
  702. #define ISCSI_LOGIN_OPTION_CHAP_UNI 0x2000
  703. ///
  704. /// VLAN Device Path SubType.
  705. ///
  706. #define MSG_VLAN_DP 0x14
  707. typedef struct {
  708. EFI_DEVICE_PATH_PROTOCOL Header;
  709. ///
  710. /// VLAN identifier (0-4094).
  711. ///
  712. UINT16 VlanId;
  713. } VLAN_DEVICE_PATH;
  714. //
  715. // Media Device Path
  716. //
  717. #define MEDIA_DEVICE_PATH 0x04
  718. ///
  719. /// Hard Drive Media Device Path SubType.
  720. ///
  721. #define MEDIA_HARDDRIVE_DP 0x01
  722. ///
  723. /// The Hard Drive Media Device Path is used to represent a partition on a hard drive.
  724. ///
  725. typedef struct {
  726. EFI_DEVICE_PATH_PROTOCOL Header;
  727. ///
  728. /// Describes the entry in a partition table, starting with entry 1.
  729. /// Partition number zero represents the entire device. Valid
  730. /// partition numbers for a MBR partition are [1, 4]. Valid
  731. /// partition numbers for a GPT partition are [1, NumberOfPartitionEntries].
  732. ///
  733. UINT32 PartitionNumber;
  734. ///
  735. /// Starting LBA of the partition on the hard drive.
  736. ///
  737. UINT64 PartitionStart;
  738. ///
  739. /// Size of the partition in units of Logical Blocks.
  740. ///
  741. UINT64 PartitionSize;
  742. ///
  743. /// Signature unique to this partition:
  744. /// If SignatureType is 0, this field has to be initialized with 16 zeros.
  745. /// If SignatureType is 1, the MBR signature is stored in the first 4 bytes of this field.
  746. /// The other 12 bytes are initialized with zeros.
  747. /// If SignatureType is 2, this field contains a 16 byte signature.
  748. ///
  749. UINT8 Signature[16];
  750. ///
  751. /// Partition Format: (Unused values reserved).
  752. /// 0x01 - PC-AT compatible legacy MBR.
  753. /// 0x02 - GUID Partition Table.
  754. ///
  755. UINT8 MBRType;
  756. ///
  757. /// Type of Disk Signature: (Unused values reserved).
  758. /// 0x00 - No Disk Signature.
  759. /// 0x01 - 32-bit signature from address 0x1b8 of the type 0x01 MBR.
  760. /// 0x02 - GUID signature.
  761. ///
  762. UINT8 SignatureType;
  763. } HARDDRIVE_DEVICE_PATH;
  764. #define MBR_TYPE_PCAT 0x01
  765. #define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
  766. #define NO_DISK_SIGNATURE 0x00
  767. #define SIGNATURE_TYPE_MBR 0x01
  768. #define SIGNATURE_TYPE_GUID 0x02
  769. ///
  770. /// CD-ROM Media Device Path SubType.
  771. ///
  772. #define MEDIA_CDROM_DP 0x02
  773. ///
  774. /// The CD-ROM Media Device Path is used to define a system partition that exists on a CD-ROM.
  775. ///
  776. typedef struct {
  777. EFI_DEVICE_PATH_PROTOCOL Header;
  778. ///
  779. /// Boot Entry number from the Boot Catalog. The Initial/Default entry is defined as zero.
  780. ///
  781. UINT32 BootEntry;
  782. ///
  783. /// Starting RBA of the partition on the medium. CD-ROMs use Relative logical Block Addressing.
  784. ///
  785. UINT64 PartitionStart;
  786. ///
  787. /// Size of the partition in units of Blocks, also called Sectors.
  788. ///
  789. UINT64 PartitionSize;
  790. } CDROM_DEVICE_PATH;
  791. //
  792. // Use VENDOR_DEVICE_PATH struct
  793. //
  794. #define MEDIA_VENDOR_DP 0x03 ///< Media vendor device path subtype.
  795. ///
  796. /// File Path Media Device Path SubType
  797. ///
  798. #define MEDIA_FILEPATH_DP 0x04
  799. typedef struct {
  800. EFI_DEVICE_PATH_PROTOCOL Header;
  801. ///
  802. /// A NULL-terminated Path string including directory and file names.
  803. ///
  804. CHAR16 PathName[1];
  805. } FILEPATH_DEVICE_PATH;
  806. #define SIZE_OF_FILEPATH_DEVICE_PATH OFFSET_OF(FILEPATH_DEVICE_PATH,PathName)
  807. ///
  808. /// Media Protocol Device Path SubType.
  809. ///
  810. #define MEDIA_PROTOCOL_DP 0x05
  811. ///
  812. /// The Media Protocol Device Path is used to denote the protocol that is being
  813. /// used in a device path at the location of the path specified.
  814. /// Many protocols are inherent to the style of device path.
  815. ///
  816. typedef struct {
  817. EFI_DEVICE_PATH_PROTOCOL Header;
  818. ///
  819. /// The ID of the protocol.
  820. ///
  821. EFI_GUID Protocol;
  822. } MEDIA_PROTOCOL_DEVICE_PATH;
  823. ///
  824. /// PIWG Firmware Volume Device Path SubType.
  825. ///
  826. #define MEDIA_PIWG_FW_FILE_DP 0x06
  827. ///
  828. /// This device path is used by systems implementing the UEFI PI Specification 1.0 to describe a firmware file.
  829. ///
  830. typedef struct {
  831. EFI_DEVICE_PATH_PROTOCOL Header;
  832. ///
  833. /// Firmware file name
  834. ///
  835. EFI_GUID FvFileName;
  836. } MEDIA_FW_VOL_FILEPATH_DEVICE_PATH;
  837. ///
  838. /// PIWG Firmware Volume Device Path SubType.
  839. ///
  840. #define MEDIA_PIWG_FW_VOL_DP 0x07
  841. ///
  842. /// This device path is used by systems implementing the UEFI PI Specification 1.0 to describe a firmware volume.
  843. ///
  844. typedef struct {
  845. EFI_DEVICE_PATH_PROTOCOL Header;
  846. ///
  847. /// Firmware volume name.
  848. ///
  849. EFI_GUID FvName;
  850. } MEDIA_FW_VOL_DEVICE_PATH;
  851. ///
  852. /// Media relative offset range device path.
  853. ///
  854. #define MEDIA_RELATIVE_OFFSET_RANGE_DP 0x08
  855. ///
  856. /// Used to describe the offset range of media relative.
  857. ///
  858. typedef struct {
  859. EFI_DEVICE_PATH_PROTOCOL Header;
  860. UINT32 Reserved;
  861. UINT64 StartingOffset;
  862. UINT64 EndingOffset;
  863. } MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH;
  864. ///
  865. /// BIOS Boot Specification Device Path.
  866. ///
  867. #define BBS_DEVICE_PATH 0x05
  868. ///
  869. /// BIOS Boot Specification Device Path SubType.
  870. ///
  871. #define BBS_BBS_DP 0x01
  872. ///
  873. /// This Device Path is used to describe the booting of non-EFI-aware operating systems.
  874. ///
  875. typedef struct {
  876. EFI_DEVICE_PATH_PROTOCOL Header;
  877. ///
  878. /// Device Type as defined by the BIOS Boot Specification.
  879. ///
  880. UINT16 DeviceType;
  881. ///
  882. /// Status Flags as defined by the BIOS Boot Specification.
  883. ///
  884. UINT16 StatusFlag;
  885. ///
  886. /// ASCIIZ string that describes the boot device to a user.
  887. ///
  888. CHAR8 String[1];
  889. } BBS_BBS_DEVICE_PATH;
  890. //
  891. // DeviceType definitions - from BBS specification
  892. //
  893. #define BBS_TYPE_FLOPPY 0x01
  894. #define BBS_TYPE_HARDDRIVE 0x02
  895. #define BBS_TYPE_CDROM 0x03
  896. #define BBS_TYPE_PCMCIA 0x04
  897. #define BBS_TYPE_USB 0x05
  898. #define BBS_TYPE_EMBEDDED_NETWORK 0x06
  899. #define BBS_TYPE_BEV 0x80
  900. #define BBS_TYPE_UNKNOWN 0xFF
  901. ///
  902. /// Union of all possible Device Paths and pointers to Device Paths.
  903. ///
  904. typedef union {
  905. EFI_DEVICE_PATH_PROTOCOL DevPath;
  906. PCI_DEVICE_PATH Pci;
  907. PCCARD_DEVICE_PATH PcCard;
  908. MEMMAP_DEVICE_PATH MemMap;
  909. VENDOR_DEVICE_PATH Vendor;
  910. CONTROLLER_DEVICE_PATH Controller;
  911. ACPI_HID_DEVICE_PATH Acpi;
  912. ATAPI_DEVICE_PATH Atapi;
  913. SCSI_DEVICE_PATH Scsi;
  914. ISCSI_DEVICE_PATH Iscsi;
  915. FIBRECHANNEL_DEVICE_PATH FibreChannel;
  916. F1394_DEVICE_PATH F1394;
  917. USB_DEVICE_PATH Usb;
  918. SATA_DEVICE_PATH Sata;
  919. USB_CLASS_DEVICE_PATH UsbClass;
  920. I2O_DEVICE_PATH I2O;
  921. MAC_ADDR_DEVICE_PATH MacAddr;
  922. IPv4_DEVICE_PATH Ipv4;
  923. IPv6_DEVICE_PATH Ipv6;
  924. INFINIBAND_DEVICE_PATH InfiniBand;
  925. UART_DEVICE_PATH Uart;
  926. HARDDRIVE_DEVICE_PATH HardDrive;
  927. CDROM_DEVICE_PATH CD;
  928. FILEPATH_DEVICE_PATH FilePath;
  929. MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol;
  930. MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH Offset;
  931. BBS_BBS_DEVICE_PATH Bbs;
  932. } EFI_DEV_PATH;
  933. typedef union {
  934. EFI_DEVICE_PATH_PROTOCOL *DevPath;
  935. PCI_DEVICE_PATH *Pci;
  936. PCCARD_DEVICE_PATH *PcCard;
  937. MEMMAP_DEVICE_PATH *MemMap;
  938. VENDOR_DEVICE_PATH *Vendor;
  939. CONTROLLER_DEVICE_PATH *Controller;
  940. ACPI_HID_DEVICE_PATH *Acpi;
  941. ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi;
  942. ATAPI_DEVICE_PATH *Atapi;
  943. SCSI_DEVICE_PATH *Scsi;
  944. FIBRECHANNEL_DEVICE_PATH *FibreChannel;
  945. F1394_DEVICE_PATH *F1394;
  946. USB_DEVICE_PATH *Usb;
  947. SATA_DEVICE_PATH *Sata;
  948. USB_CLASS_DEVICE_PATH *UsbClass;
  949. I2O_DEVICE_PATH *I2O;
  950. MAC_ADDR_DEVICE_PATH *MacAddr;
  951. IPv4_DEVICE_PATH *Ipv4;
  952. IPv6_DEVICE_PATH *Ipv6;
  953. INFINIBAND_DEVICE_PATH *InfiniBand;
  954. UART_DEVICE_PATH *Uart;
  955. HARDDRIVE_DEVICE_PATH *HardDrive;
  956. CDROM_DEVICE_PATH *CD;
  957. FILEPATH_DEVICE_PATH *FilePath;
  958. MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol;
  959. MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;
  960. BBS_BBS_DEVICE_PATH *Bbs;
  961. UINT8 *Raw;
  962. } EFI_DEV_PATH_PTR;
  963. #pragma pack()
  964. #define END_DEVICE_PATH_TYPE 0x7f
  965. #define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xFF
  966. #define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01
  967. extern EFI_GUID gEfiDevicePathProtocolGuid;
  968. #endif