PageRenderTime 45ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/EfiLib/DevicePathUtilities.h

https://github.com/sbutler/rEFInd
C Header | 233 lines | 80 code | 13 blank | 140 comment | 0 complexity | f7894206b24fc76e022198b1e7258068 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0
  1. /*++
  2. Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>
  3. This program and the accompanying materials
  4. are licensed and made available under the terms and conditions of the BSD License
  5. which accompanies this distribution. The full text of the license may be found at
  6. http://opensource.org/licenses/bsd-license.php
  7. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  9. Module Name:
  10. DevicePathUtilities.h
  11. Abstract:
  12. --*/
  13. #ifndef _DEVICE_PATH_UTILITIES_PROTOCOL_H_
  14. #define _DEVICE_PATH_UTILITIES_PROTOCOL_H_
  15. //
  16. // Device Path Utilities protocol
  17. //
  18. #define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \
  19. { \
  20. 0x379be4e, 0xd706, 0x437d, {0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4} \
  21. }
  22. typedef
  23. UINTN
  24. EFIAPI
  25. (EFIAPI *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE) (
  26. IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
  27. )
  28. /*++
  29. Routine Description:
  30. Returns the size of the device path, in bytes.
  31. Arguments:
  32. DevicePath - Points to the start of the EFI device path.
  33. Returns:
  34. Size - Size of the specified device path, in bytes, including the end-of-path tag.
  35. --*/
  36. ;
  37. typedef
  38. EFI_DEVICE_PATH_PROTOCOL*
  39. EFIAPI
  40. (EFIAPI *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH) (
  41. IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
  42. )
  43. /*++
  44. Routine Description:
  45. Create a duplicate of the specified path.
  46. Arguments:
  47. DevicePath - Points to the source EFI device path.
  48. Returns:
  49. Pointer - A pointer to the duplicate device path.
  50. NULL - Insufficient memory.
  51. --*/
  52. ;
  53. typedef
  54. EFI_DEVICE_PATH_PROTOCOL*
  55. EFIAPI
  56. (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_PATH) (
  57. IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,
  58. IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2
  59. )
  60. /*++
  61. Routine Description:
  62. Create a new path by appending the second device path to the first.
  63. Arguments:
  64. Src1 - Points to the first device path. If NULL, then it is ignored.
  65. Src2 - Points to the second device path. If NULL, then it is ignored.
  66. Returns:
  67. Pointer - A pointer to the newly created device path.
  68. NULL - Memory could not be allocated
  69. or either DevicePath or DeviceNode is NULL.
  70. --*/
  71. ;
  72. typedef
  73. EFI_DEVICE_PATH_PROTOCOL*
  74. EFIAPI
  75. (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_NODE) (
  76. IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
  77. IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
  78. )
  79. /*++
  80. Routine Description:
  81. Creates a new path by appending the device node to the device path.
  82. Arguments:
  83. DevicePath - Points to the device path.
  84. DeviceNode - Points to the device node.
  85. Returns:
  86. Pointer - A pointer to the allocated device node.
  87. NULL - Memory could not be allocated
  88. or either DevicePath or DeviceNode is NULL.
  89. --*/
  90. ;
  91. typedef
  92. EFI_DEVICE_PATH_PROTOCOL*
  93. EFIAPI
  94. (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE) (
  95. IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
  96. IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
  97. )
  98. /*++
  99. Routine Description:
  100. Creates a new path by appending the specified device path instance to the specified device path.
  101. Arguments:
  102. DevicePath - Points to the device path. If NULL, then ignored.
  103. DevicePathInstance - Points to the device path instance.
  104. Returns:
  105. Pointer - A pointer to the newly created device path
  106. NULL - Memory could not be allocated or DevicePathInstance is NULL.
  107. --*/
  108. ;
  109. typedef
  110. EFI_DEVICE_PATH_PROTOCOL*
  111. EFIAPI
  112. (EFIAPI *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE) (
  113. IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
  114. OUT UINTN *DevicePathInstanceSize
  115. )
  116. /*++
  117. Routine Description:
  118. Creates a copy of the current device path instance and returns a pointer to the next device path instance.
  119. Arguments:
  120. DevicePathInstance - On input, this holds the pointer to the current device path
  121. instance. On output, this holds the pointer to the next
  122. device path instance or NULL if there are no more device
  123. path instances in the device path.
  124. DevicePathInstanceSize - On output, this holds the size of the device path instance,
  125. in bytes or zero, if DevicePathInstance is zero.
  126. Returns:
  127. Pointer - A pointer to the copy of the current device path instance.
  128. NULL - DevicePathInstace was NULL on entry or there was insufficient memory.
  129. --*/
  130. ;
  131. typedef
  132. BOOLEAN
  133. EFIAPI
  134. (EFIAPI *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE) (
  135. IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
  136. )
  137. /*++
  138. Routine Description:
  139. Returns whether a device path is multi-instance.
  140. Arguments:
  141. DevicePath - Points to the device path. If NULL, then ignored.
  142. Returns:
  143. TRUE - The device path has more than one instance
  144. FALSE - The device path is empty or contains only a single instance.
  145. --*/
  146. ;
  147. typedef
  148. EFI_DEVICE_PATH_PROTOCOL*
  149. EFIAPI
  150. (EFIAPI *EFI_DEVICE_PATH_UTILS_CREATE_NODE) (
  151. IN UINT8 NodeType,
  152. IN UINT8 NodeSubType,
  153. IN UINT16 NodeLength
  154. )
  155. /*++
  156. Routine Description:
  157. Creates a device node
  158. Arguments:
  159. NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for
  160. the new device node.
  161. NodeSubType - NodeSubType is the device node sub-type
  162. EFI_DEVICE_PATH.SubType) for the new device node.
  163. NodeLength - NodeLength is the length of the device node
  164. (EFI_DEVICE_PATH.Length) for the new device node.
  165. Returns:
  166. Pointer - A pointer to the newly created device node.
  167. NULL - NodeLength is less than
  168. the size of the header or there was insufficient memory.
  169. --*/
  170. ;
  171. typedef struct {
  172. EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;
  173. EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath;
  174. EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath;
  175. EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode;
  176. EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance;
  177. EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance;
  178. EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance;
  179. EFI_DEVICE_PATH_UTILS_CREATE_NODE CreateDeviceNode;
  180. } EFI_DEVICE_PATH_UTILITIES_PROTOCOL;
  181. extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid;
  182. #endif