]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/DevicePathUtilities.h
Update comments for Protocol definitions to match UEFI spec.
[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 - 2008, 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 @retval 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 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 Create a new path by appending the second device path to the first.
62
63 @param Src1 Points to the first device path. If NULL, then it is ignored.
64 @param Src2 Points to the second device path. If NULL, then it is ignored.
65
66 @retval Pointer A pointer to the newly created device path.
67 @retval NULL Memory could not be allocated
68 or either DevicePath or DeviceNode is NULL.
69
70 **/
71 typedef
72 EFI_DEVICE_PATH_PROTOCOL*
73 (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_PATH)(
74 IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,
75 IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2
76 );
77
78 /**
79 Creates a new path by appending the device node to the device path.
80
81 @param DevicePath Points to the device path.
82 @param DeviceNode Points to the device node.
83
84 @retval Pointer A pointer to the allocated device node.
85 @retval NULL Memory could not be allocated
86 or either DevicePath or DeviceNode is NULL.
87
88 **/
89 typedef
90 EFI_DEVICE_PATH_PROTOCOL*
91 (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_NODE)(
92 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
93 IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
94 );
95
96 /**
97 Creates a new path by appending the specified device path instance to the specified device path.
98
99 @param DevicePath Points to the device path. If NULL, then ignored.
100 @param DevicePathInstance Points to the device path instance.
101
102 @retval Pointer A pointer to the newly created device path
103 @retval NULL Memory could not be allocated or DevicePathInstance is NULL.
104
105 **/
106 typedef
107 EFI_DEVICE_PATH_PROTOCOL*
108 (EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE)(
109 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
110 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
111 );
112
113 /**
114 Creates a copy of the current device path instance and returns a pointer to the next device path
115 instance.
116
117 @param DevicePathInstance On input, this holds the pointer to the current device path
118 instance. On output, this holds the pointer to the next
119 device path instance or NULL if there are no more device
120 path instances in the device path.
121 @param DevicePathInstanceSize On output, this holds the size of the device path instance,
122 in bytes or zero, if DevicePathInstance is zero.
123
124 @retval Pointer A pointer to the copy of the current device path instance.
125 @retval NULL DevicePathInstace was NULL on entry or there was insufficient memory.
126
127 **/
128 typedef
129 EFI_DEVICE_PATH_PROTOCOL*
130 (EFIAPI *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE)(
131 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
132 OUT UINTN *DevicePathInstanceSize
133 );
134
135 /**
136 Creates a device node
137
138 @param NodeType NodeType is the device node type (EFI_DEVICE_PATH.Type) for
139 the new device node.
140 @param NodeSubType NodeSubType is the device node sub-type
141 EFI_DEVICE_PATH.SubType) for the new device node.
142 @param NodeLength NodeLength is the length of the device node
143 (EFI_DEVICE_PATH.Length) for the new device node.
144
145 @retval Pointer A pointer to the newly created device node.
146 @retval NULL NodeLength is less than
147 the size of the header or there was insufficient memory.
148
149 **/
150 typedef
151 EFI_DEVICE_PATH_PROTOCOL*
152 (EFIAPI *EFI_DEVICE_PATH_CREATE_NODE)(
153 IN UINT8 NodeType,
154 IN UINT8 NodeSubType,
155 IN UINT16 NodeLength
156 );
157
158 /**
159 Returns whether a device path is multi-instance.
160
161 @param DevicePath Points to the device path. If NULL, then ignored.
162
163 @retval TRUE The device path has more than one instance
164 @retval FALSE The device path is empty or contains only a single instance.
165
166 **/
167 typedef
168 BOOLEAN
169 (EFIAPI *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE)(
170 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
171 );
172
173 ///
174 /// This protocol is used to creates and manipulates device paths and device nodes.
175 ///
176 typedef struct {
177 EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;
178 EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath;
179 EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath;
180 EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode;
181 EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance;
182 EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance;
183 EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance;
184 EFI_DEVICE_PATH_CREATE_NODE CreateDeviceNode;
185 } EFI_DEVICE_PATH_UTILITIES_PROTOCOL;
186
187 extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid;
188
189 #endif