]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/DevicePathDxe/DevicePathUtilities.c
Removed CommonHeader.h from MdePkg & MdeModulePkg
[mirror_edk2.git] / MdeModulePkg / Universal / DevicePathDxe / DevicePathUtilities.c
CommitLineData
95276127 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 DevicePathUtilities.c\r
15\r
16Abstract:\r
17\r
18 Implementation file for Device Path Utilities Protocol\r
19\r
20--*/\r
21\r
95276127 22#include "DevicePath.h"\r
23\r
24UINTN\r
25GetDevicePathSizeProtocolInterface (\r
26 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
27 )\r
28/*++\r
29\r
30 Routine Description:\r
31 Returns the size of the device path, in bytes.\r
32\r
33 Arguments:\r
34 DevicePath - Points to the start of the EFI device path.\r
35\r
36 Returns:\r
37 Size - Size of the specified device path, in bytes, including the end-of-path tag.\r
38\r
39--*/\r
40{\r
41 return GetDevicePathSize (DevicePath);\r
42}\r
43\r
44EFI_DEVICE_PATH_PROTOCOL *\r
45DuplicateDevicePathProtocolInterface (\r
46 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
47 )\r
48/*++\r
49\r
50 Routine Description:\r
51 Create a duplicate of the specified path.\r
52\r
53 Arguments:\r
54 DevicePath - Points to the source EFI device path.\r
55\r
56 Returns:\r
57 Pointer - A pointer to the duplicate device path.\r
58 NULL - Insufficient memory.\r
59\r
60--*/\r
61{\r
62 return DuplicateDevicePath (DevicePath);\r
63}\r
64\r
65EFI_DEVICE_PATH_PROTOCOL *\r
66AppendDevicePathProtocolInterface (\r
67 IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,\r
68 IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2\r
69 )\r
70/*++\r
71\r
72 Routine Description:\r
73 Create a new path by appending the second device path to the first.\r
74\r
75 Arguments:\r
76 Src1 - Points to the first device path. If NULL, then it is ignored.\r
77 Src2 - Points to the second device path. If NULL, then it is ignored.\r
78\r
79 Returns:\r
80 Pointer - A pointer to the newly created device path.\r
81 NULL - Memory could not be allocated\r
82 or either DevicePath or DeviceNode is NULL.\r
83\r
84--*/\r
85{\r
86 return AppendDevicePath (Src1, Src2);\r
87}\r
88\r
89EFI_DEVICE_PATH_PROTOCOL *\r
90AppendDeviceNodeProtocolInterface (\r
91 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
92 IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode\r
93 )\r
94/*++\r
95\r
96 Routine Description:\r
97 Creates a new path by appending the device node to the device path.\r
98\r
99 Arguments:\r
100 DevicePath - Points to the device path.\r
101 DeviceNode - Points to the device node.\r
102\r
103 Returns:\r
104 Pointer - A pointer to the allocated device node.\r
105 NULL - Memory could not be allocated\r
106 or either DevicePath or DeviceNode is NULL.\r
107\r
108--*/\r
109{\r
110 return AppendDevicePathNode (DevicePath, DeviceNode);\r
111}\r
112\r
113EFI_DEVICE_PATH_PROTOCOL *\r
114AppendDevicePathInstanceProtocolInterface (\r
115 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
116 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance\r
117 )\r
118/*++\r
119\r
120 Routine Description:\r
121 Creates a new path by appending the specified device path instance to the specified device path.\r
122\r
123 Arguments:\r
124 DevicePath - Points to the device path. If NULL, then ignored.\r
125 DevicePathInstance - Points to the device path instance.\r
126\r
127 Returns:\r
128 Pointer - A pointer to the newly created device path\r
129 NULL - Memory could not be allocated or DevicePathInstance is NULL.\r
130\r
131--*/\r
132{\r
133 return AppendDevicePathInstance (DevicePath, DevicePathInstance);\r
134}\r
135\r
136EFI_DEVICE_PATH_PROTOCOL *\r
137GetNextDevicePathInstanceProtocolInterface (\r
138 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,\r
139 OUT UINTN *DevicePathInstanceSize\r
140 )\r
141/*++\r
142\r
143 Routine Description:\r
144 Creates a copy of the current device path instance and returns a pointer to the next device path instance.\r
145\r
146 Arguments:\r
147 DevicePathInstance - On input, this holds the pointer to the current device path\r
148 instance. On output, this holds the pointer to the next\r
149 device path instance or NULL if there are no more device\r
150 path instances in the device path.\r
151 DevicePathInstanceSize - On output, this holds the size of the device path instance,\r
152 in bytes or zero, if DevicePathInstance is zero.\r
153\r
154 Returns:\r
155 Pointer - A pointer to the copy of the current device path instance.\r
156 NULL - DevicePathInstace was NULL on entry or there was insufficient memory.\r
157\r
158--*/\r
159{\r
160 return GetNextDevicePathInstance (DevicePathInstance, DevicePathInstanceSize);\r
161}\r
162\r
163BOOLEAN\r
164IsDevicePathMultiInstanceProtocolInterface (\r
165 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
166 )\r
167/*++\r
168\r
169 Routine Description:\r
170 Returns whether a device path is multi-instance.\r
171\r
172 Arguments:\r
173 DevicePath - Points to the device path. If NULL, then ignored.\r
174\r
175 Returns:\r
176 TRUE - The device path has more than one instance\r
177 FALSE - The device path is empty or contains only a single instance.\r
178\r
179--*/\r
180{\r
181 return IsDevicePathMultiInstance (DevicePath);\r
182}\r
183\r
184EFI_DEVICE_PATH_PROTOCOL *\r
185CreateDeviceNodeProtocolInterface (\r
186 IN UINT8 NodeType,\r
187 IN UINT8 NodeSubType,\r
188 IN UINT16 NodeLength\r
189 )\r
190/*++\r
191\r
192 Routine Description:\r
193 Creates a device node\r
194\r
195 Arguments:\r
196 NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for\r
197 the new device node.\r
198 NodeSubType - NodeSubType is the device node sub-type\r
199 EFI_DEVICE_PATH.SubType) for the new device node.\r
200 NodeLength - NodeLength is the length of the device node\r
201 (EFI_DEVICE_PATH.Length) for the new device node.\r
202\r
203 Returns:\r
204 Pointer - A pointer to the newly created device node.\r
205 NULL - NodeLength is less than\r
206 the size of the header or there was insufficient memory.\r
207\r
208--*/\r
209{\r
210 return CreateDeviceNode (NodeType, NodeSubType, NodeLength);\r
211}\r