]> git.proxmox.com Git - mirror_edk2.git/blob - OldMdePkg/Include/Protocol/DevicePathUtilities.h
Moved the MdePkg to OldMdePkg so that new code in MdePkg does not break existing...
[mirror_edk2.git] / OldMdePkg / Include / Protocol / DevicePathUtilities.h
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, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
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 Module Name: DevicePathUtilities.h
15
16 **/
17
18 #ifndef __DEVICE_PATH_UTILITIES_PROTOCOL_H__
19 #define __DEVICE_PATH_UTILITIES_PROTOCOL_H__
20
21 //
22 // Device Path Utilities protocol
23 //
24 #define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \
25 { \
26 0x379be4e, 0xd706, 0x437d, {0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } \
27 }
28
29 /**
30 Returns the size of the device path, in bytes.
31
32 @param DevicePath Points to the start of the EFI device path.
33
34 @revtal Size Size of the specified device path, in bytes, including the end-of-path tag.
35
36 **/
37 typedef
38 UINTN
39 (EFIAPI *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE) (
40 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
41 )
42 ;
43
44
45 /**
46 Create a duplicate of the specified path.
47
48 @param DevicePath Points to the source EFI device path.
49
50 @retval Pointer A pointer to the duplicate device path.
51 @retval NULL insufficient memory
52
53 **/
54 typedef
55 EFI_DEVICE_PATH_PROTOCOL*
56 (EFIAPI *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH) (
57 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
58 )
59 ;
60
61 /**
62 Create a new path by appending the second device path to the first.
63
64 @param Src1 Points to the first device path. If NULL, then it is ignored.
65 @param Src2 Points to the second device path. If NULL, then it is ignored.
66
67 @retval Pointer A pointer to the newly created device path.
68 @retval 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 *EFI_DEVICE_PATH_UTILS_APPEND_PATH) (
75 IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,
76 IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2
77 )
78 ;
79
80 /**
81 Creates a new path by appending the device node to the device path.
82
83 @param DevicePath Points to the device path.
84 @param DeviceNode Points to the device node.
85
86 @retval Pointer A pointer to the allocated device node.
87 @retval 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 *EFI_DEVICE_PATH_UTILS_APPEND_NODE) (
94 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
95 IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
96 )
97 ;
98
99 /**
100 Creates a new path by appending the specified device path instance to the specified device path.
101
102 @param DevicePath Points to the device path. If NULL, then ignored.
103 @param DevicePathInstance Points to the device path instance.
104
105 @retval Pointer A pointer to the newly created device path
106 @retval NULL Memory could not be allocated or DevicePathInstance is NULL.
107
108 **/
109 typedef
110 EFI_DEVICE_PATH_PROTOCOL*
111 (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE) (
112 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
113 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
114 )
115 ;
116
117 /**
118 Creates a copy of the current device path instance and returns a pointer to the next device path
119 instance.
120
121 @param DevicePathInstance On input, this holds the pointer to the current device path
122 instance. On output, this holds the pointer to the next
123 device path instance or NULL if there are no more device
124 path instances in the device path.
125 @param DevicePathInstanceSize On output, this holds the size of the device path instance,
126 in bytes or zero, if DevicePathInstance is zero.
127
128 @retval Pointer A pointer to the copy of the current device path instance.
129 @retval NULL DevicePathInstace was NULL on entry or there was insufficient memory.
130
131 **/
132 typedef
133 EFI_DEVICE_PATH_PROTOCOL*
134 (EFIAPI *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE) (
135 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
136 OUT UINTN *DevicePathInstanceSize
137 )
138 ;
139
140 /**
141 Creates a device node
142
143 @param NodeType NodeType is the device node type (EFI_DEVICE_PATH.Type) for
144 the new device node.
145 @param NodeSubType NodeSubType is the device node sub-type
146 EFI_DEVICE_PATH.SubType) for the new device node.
147 @param NodeLength NodeLength is the length of the device node
148 (EFI_DEVICE_PATH.Length) for the new device node.
149
150 @retval Pointer A pointer to the newly created device node.
151 @retval NULL NodeLength is less than
152 the size of the header or there was insufficient memory.
153
154 **/
155 typedef
156 EFI_DEVICE_PATH_PROTOCOL*
157 (EFIAPI *EFI_DEVICE_PATH_CREATE_NODE) (
158 IN UINT8 NodeType,
159 IN UINT8 NodeSubType,
160 IN UINT16 NodeLength
161 )
162 ;
163
164 /**
165 Returns whether a device path is multi-instance.
166
167 @param DevicePath Points to the device path. If NULL, then ignored.
168
169 @retval TRUE The device path has more than one instance
170 @retval FALSE The device path is empty or contains only a single instance.
171
172 **/
173 typedef
174 BOOLEAN
175 (EFIAPI *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE) (
176 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
177 )
178 ;
179
180
181 typedef struct {
182 EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;
183 EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath;
184 EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath;
185 EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode;
186 EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance;
187 EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance;
188 EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance;
189 EFI_DEVICE_PATH_CREATE_NODE CreateDeviceNode;
190 } EFI_DEVICE_PATH_UTILITIES_PROTOCOL;
191
192 extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid;
193
194 #endif