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