devpathu.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. /*++
  2. Copyright (c) 2014 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. devpathu.h
  5. Abstract:
  6. This header contains definitions for the UEFI Device Path Utilities
  7. Protocol.
  8. Author:
  9. Evan Green 5-Mar-2014
  10. --*/
  11. //
  12. // ------------------------------------------------------------------- Includes
  13. //
  14. //
  15. // ---------------------------------------------------------------- Definitions
  16. //
  17. #define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \
  18. { \
  19. 0x379BE4E, 0xD706, 0x437D, \
  20. {0xB0, 0x37, 0xED, 0xB8, 0x2F, 0xB7, 0x72, 0xA4} \
  21. }
  22. //
  23. // ------------------------------------------------------ Data Type Definitions
  24. //
  25. typedef
  26. UINTN
  27. (EFIAPI *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE) (
  28. CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
  29. );
  30. /*++
  31. Routine Description:
  32. This routine returns the size of the device path in bytes.
  33. Arguments:
  34. DevicePath - Supplies a pointer to the device path instance.
  35. Return Value:
  36. Returns the size of the device path in bytes including the end of path tag.
  37. 0 if the device path is NULL.
  38. --*/
  39. typedef
  40. EFI_DEVICE_PATH_PROTOCOL *
  41. (EFIAPI *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH) (
  42. CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
  43. );
  44. /*++
  45. Routine Description:
  46. This routine creates a duplicate of the specified path.
  47. Arguments:
  48. DevicePath - Supplies a pointer to the device path instance.
  49. Return Value:
  50. Returns a pointer to the duplicate device path on success.
  51. NULL on allocation failure or if the input device path was null.
  52. --*/
  53. typedef
  54. EFI_DEVICE_PATH_PROTOCOL *
  55. (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_PATH) (
  56. CONST EFI_DEVICE_PATH_PROTOCOL *First,
  57. CONST EFI_DEVICE_PATH_PROTOCOL *Second
  58. );
  59. /*++
  60. Routine Description:
  61. This routine creates a new path by appending the second device path to the
  62. first. If the first source is NULL and the second is not, then a duplicate
  63. of the second is returned. If the first is not NULL and the second is, a
  64. duplicate of the first is made. If both are NULL, then a copy of an
  65. end-of-device-path is returned.
  66. Arguments:
  67. First - Supplies an optional pointer to the first device path instance.
  68. Second - Supplies an optional pointer to the second device path instance.
  69. Return Value:
  70. Returns a pointer to the duplicate appended device path on success.
  71. NULL on allocation failure.
  72. --*/
  73. typedef
  74. EFI_DEVICE_PATH_PROTOCOL *
  75. (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_NODE) (
  76. CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
  77. CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
  78. );
  79. /*++
  80. Routine Description:
  81. This routine creates a new path by appending the device node to the path.
  82. If the path is NULL and the node is not, then a duplicate of the node is
  83. returned. If the path is not NULL and the node is, a duplicate of the path
  84. is made with an end tag appended. If both are NULL, then a copy of an
  85. end-of-device-path is returned.
  86. Arguments:
  87. DevicePath - Supplies an optional pointer to the device path instance.
  88. DeviceNode - Supplies an optional pointer to the device node instance.
  89. Return Value:
  90. Returns a pointer to the duplicate appended device path on success.
  91. NULL on allocation failure.
  92. --*/
  93. typedef
  94. EFI_DEVICE_PATH_PROTOCOL *
  95. (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE) (
  96. CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
  97. CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
  98. );
  99. /*++
  100. Routine Description:
  101. This routine creates a new path by appending the device path instance to a
  102. device path.
  103. Arguments:
  104. DevicePath - Supplies an optional pointer to the device path.
  105. DevicePathInstance - Supplies a pointer to the device path instance.
  106. Return Value:
  107. Returns a pointer to the duplicate appended device path on success.
  108. NULL on allocation failure or if the device path instance was NULL.
  109. --*/
  110. typedef
  111. EFI_DEVICE_PATH_PROTOCOL *
  112. (EFIAPI *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE) (
  113. EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
  114. UINTN *DevicePathInstanceSize
  115. );
  116. /*++
  117. Routine Description:
  118. This routine creates a copy of the current device path instance and returns
  119. a pointer to the next device path instance.
  120. Arguments:
  121. DevicePathInstance - Supplies a pointer that on input contains the
  122. pointer to the current device path instance. On output, this contains
  123. the pointer to the next device path instance, or NULL if there are no
  124. more device path instances on the device path.
  125. DevicePathInstanceSize - Supplies a pointer where the size of the
  126. returned device path instance in bytes will be returned.
  127. Return Value:
  128. Returns a pointer to the duplicate device path on success.
  129. NULL on allocation failure or if the device path instance was NULL.
  130. --*/
  131. typedef
  132. EFI_DEVICE_PATH_PROTOCOL *
  133. (EFIAPI *EFI_DEVICE_PATH_UTILS_CREATE_NODE) (
  134. UINT8 NodeType,
  135. UINT8 NodeSubType,
  136. UINT16 NodeLength
  137. );
  138. /*++
  139. Routine Description:
  140. This routine creates a device node.
  141. Arguments:
  142. NodeType - Suppiles the device node type.
  143. NodeSubType - Supplies the node subtype.
  144. NodeLength - Supplies the length of the device node.
  145. Return Value:
  146. Returns a pointer to the newly allocated node on success.
  147. NULL if the node length is less than the size of the header or on
  148. allocation failure.
  149. --*/
  150. typedef
  151. BOOLEAN
  152. (EFIAPI *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE) (
  153. CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
  154. );
  155. /*++
  156. Routine Description:
  157. This routine returns a boolean indicating whether or not the given device
  158. path is a multi-instance device path.
  159. Arguments:
  160. DevicePath - Supplies a pointer to the device path to query.
  161. Return Value:
  162. TRUE if the devie path has more than one instance.
  163. FALSE if the device path is empty or contains only a single instance.
  164. --*/
  165. /*++
  166. Structure Description:
  167. This structure describes the Device Path Utilities Protocol, which is used
  168. to create and manipulate device paths and device nodes.
  169. Members:
  170. GetDevicePathSize - Stores a pointer to a function used to determine the
  171. size in bytes of a device path.
  172. DuplicateDevicePath - Stores a pointer to a function used to copy a device
  173. path.
  174. AppendDevicePath - Stores a pointer to a function used to append one
  175. device path to another.
  176. AppendDeviceNode - Stores a pointer to a function used to append a device
  177. node to a device path.
  178. AppendDevicePathInstance - Stores a pointer to a function used to append
  179. a device path instance to a device path.
  180. GetNextDevicePathInstance - Stores a pointer to a function used to get
  181. the next device path instance.
  182. IsDevicePathMultiInstance - Stores a pointer to a function used to
  183. determine if a device path contains multiple instances.
  184. CreateDeviceNode - Stores a pointer to a function used to create a new
  185. device node.
  186. --*/
  187. typedef struct {
  188. EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;
  189. EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath;
  190. EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath;
  191. EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode;
  192. EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance;
  193. EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance;
  194. EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance;
  195. EFI_DEVICE_PATH_UTILS_CREATE_NODE CreateDeviceNode;
  196. } EFI_DEVICE_PATH_UTILITIES_PROTOCOL;
  197. //
  198. // -------------------------------------------------------------------- Globals
  199. //
  200. //
  201. // -------------------------------------------------------- Function Prototypes
  202. //