1 | /** @file
|
---|
2 | EFI_DEVICE_PATH_UTILITIES_PROTOCOL as defined in UEFI 2.0.
|
---|
3 | Use to create and manipulate device paths and device nodes.
|
---|
4 |
|
---|
5 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #ifndef __DEVICE_PATH_UTILITIES_PROTOCOL_H__
|
---|
11 | #define __DEVICE_PATH_UTILITIES_PROTOCOL_H__
|
---|
12 |
|
---|
13 | ///
|
---|
14 | /// Device Path Utilities protocol
|
---|
15 | ///
|
---|
16 | #define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \
|
---|
17 | { \
|
---|
18 | 0x379be4e, 0xd706, 0x437d, {0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } \
|
---|
19 | }
|
---|
20 |
|
---|
21 | /**
|
---|
22 | Returns the size of the device path, in bytes.
|
---|
23 |
|
---|
24 | @param DevicePath Points to the start of the EFI device path.
|
---|
25 |
|
---|
26 | @return Size Size of the specified device path, in bytes, including the end-of-path tag.
|
---|
27 | @retval 0 DevicePath is NULL
|
---|
28 |
|
---|
29 | **/
|
---|
30 | typedef
|
---|
31 | UINTN
|
---|
32 | (EFIAPI *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE)(
|
---|
33 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
---|
34 | );
|
---|
35 |
|
---|
36 | /**
|
---|
37 | Create a duplicate of the specified path.
|
---|
38 |
|
---|
39 | @param DevicePath Points to the source EFI device path.
|
---|
40 |
|
---|
41 | @retval Pointer A pointer to the duplicate device path.
|
---|
42 | @retval NULL insufficient memory or DevicePath is NULL
|
---|
43 |
|
---|
44 | **/
|
---|
45 | typedef
|
---|
46 | EFI_DEVICE_PATH_PROTOCOL *
|
---|
47 | (EFIAPI *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH)(
|
---|
48 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
---|
49 | );
|
---|
50 |
|
---|
51 | /**
|
---|
52 | Create a new path by appending the second device path to the first.
|
---|
53 | If Src1 is NULL and Src2 is non-NULL, then a duplicate of Src2 is returned.
|
---|
54 | If Src1 is non-NULL and Src2 is NULL, then a duplicate of Src1 is returned.
|
---|
55 | If Src1 and Src2 are both NULL, then a copy of an end-of-device-path is returned.
|
---|
56 |
|
---|
57 | @param Src1 Points to the first device path.
|
---|
58 | @param Src2 Points to the second device path.
|
---|
59 |
|
---|
60 | @retval Pointer A pointer to the newly created device path.
|
---|
61 | @retval NULL Memory could not be allocated
|
---|
62 |
|
---|
63 | **/
|
---|
64 | typedef
|
---|
65 | EFI_DEVICE_PATH_PROTOCOL *
|
---|
66 | (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_PATH)(
|
---|
67 | IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,
|
---|
68 | IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2
|
---|
69 | );
|
---|
70 |
|
---|
71 | /**
|
---|
72 | Creates a new path by appending the device node to the device path.
|
---|
73 | If DeviceNode is NULL then a copy of DevicePath is returned.
|
---|
74 | If DevicePath is NULL then a copy of DeviceNode, followed by an end-of-device path device node is returned.
|
---|
75 | If both DeviceNode and DevicePath are NULL then a copy of an end-of-device-path device node is returned.
|
---|
76 |
|
---|
77 | @param DevicePath Points to the device path.
|
---|
78 | @param DeviceNode Points to the device node.
|
---|
79 |
|
---|
80 | @retval Pointer A pointer to the allocated device node.
|
---|
81 | @retval NULL There was insufficient memory.
|
---|
82 |
|
---|
83 | **/
|
---|
84 | typedef
|
---|
85 | EFI_DEVICE_PATH_PROTOCOL *
|
---|
86 | (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_NODE)(
|
---|
87 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
---|
88 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
|
---|
89 | );
|
---|
90 |
|
---|
91 | /**
|
---|
92 | Creates a new path by appending the specified device path instance to the specified device path.
|
---|
93 |
|
---|
94 | @param DevicePath Points to the device path. If NULL, then ignored.
|
---|
95 | @param DevicePathInstance Points to the device path instance.
|
---|
96 |
|
---|
97 | @retval Pointer A pointer to the newly created device path
|
---|
98 | @retval NULL Memory could not be allocated or DevicePathInstance is NULL.
|
---|
99 |
|
---|
100 | **/
|
---|
101 | typedef
|
---|
102 | EFI_DEVICE_PATH_PROTOCOL *
|
---|
103 | (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE)(
|
---|
104 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
---|
105 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
|
---|
106 | );
|
---|
107 |
|
---|
108 | /**
|
---|
109 | Creates a copy of the current device path instance and returns a pointer to the next device path
|
---|
110 | instance.
|
---|
111 |
|
---|
112 | @param DevicePathInstance On input, this holds the pointer to the current device path
|
---|
113 | instance. On output, this holds the pointer to the next
|
---|
114 | device path instance or NULL if there are no more device
|
---|
115 | path instances in the device path.
|
---|
116 | @param DevicePathInstanceSize On output, this holds the size of the device path instance,
|
---|
117 | in bytes or zero, if DevicePathInstance is NULL.
|
---|
118 | If NULL, then the instance size is not output.
|
---|
119 |
|
---|
120 | @retval Pointer A pointer to the copy of the current device path instance.
|
---|
121 | @retval NULL DevicePathInstace was NULL on entry or there was insufficient memory.
|
---|
122 |
|
---|
123 | **/
|
---|
124 | typedef
|
---|
125 | EFI_DEVICE_PATH_PROTOCOL *
|
---|
126 | (EFIAPI *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE)(
|
---|
127 | IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
|
---|
128 | OUT UINTN *DevicePathInstanceSize
|
---|
129 | );
|
---|
130 |
|
---|
131 | /**
|
---|
132 | Creates a device node
|
---|
133 |
|
---|
134 | @param NodeType NodeType is the device node type (EFI_DEVICE_PATH.Type) for
|
---|
135 | the new device node.
|
---|
136 | @param NodeSubType NodeSubType is the device node sub-type
|
---|
137 | EFI_DEVICE_PATH.SubType) for the new device node.
|
---|
138 | @param NodeLength NodeLength is the length of the device node
|
---|
139 | (EFI_DEVICE_PATH.Length) for the new device node.
|
---|
140 |
|
---|
141 | @retval Pointer A pointer to the newly created device node.
|
---|
142 | @retval NULL NodeLength is less than
|
---|
143 | the size of the header or there was insufficient memory.
|
---|
144 |
|
---|
145 | **/
|
---|
146 | typedef
|
---|
147 | EFI_DEVICE_PATH_PROTOCOL *
|
---|
148 | (EFIAPI *EFI_DEVICE_PATH_UTILS_CREATE_NODE)(
|
---|
149 | IN UINT8 NodeType,
|
---|
150 | IN UINT8 NodeSubType,
|
---|
151 | IN UINT16 NodeLength
|
---|
152 | );
|
---|
153 |
|
---|
154 | /**
|
---|
155 | Returns whether a device path is multi-instance.
|
---|
156 |
|
---|
157 | @param DevicePath Points to the device path. If NULL, then ignored.
|
---|
158 |
|
---|
159 | @retval TRUE The device path has more than one instance
|
---|
160 | @retval FALSE The device path is empty or contains only a single instance.
|
---|
161 |
|
---|
162 | **/
|
---|
163 | typedef
|
---|
164 | BOOLEAN
|
---|
165 | (EFIAPI *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE)(
|
---|
166 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
---|
167 | );
|
---|
168 |
|
---|
169 | ///
|
---|
170 | /// This protocol is used to creates and manipulates device paths and device nodes.
|
---|
171 | ///
|
---|
172 | typedef struct {
|
---|
173 | EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;
|
---|
174 | EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath;
|
---|
175 | EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath;
|
---|
176 | EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode;
|
---|
177 | EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance;
|
---|
178 | EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance;
|
---|
179 | EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance;
|
---|
180 | EFI_DEVICE_PATH_UTILS_CREATE_NODE CreateDeviceNode;
|
---|
181 | } EFI_DEVICE_PATH_UTILITIES_PROTOCOL;
|
---|
182 |
|
---|
183 | extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid;
|
---|
184 |
|
---|
185 | #endif
|
---|