3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Implementation file for Device Path Utilities Protocol
23 // Include common header file for this module.
25 #include "CommonHeader.h"
27 #include "DevicePath.h"
30 GetDevicePathSizeProtocolInterface (
31 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
36 Returns the size of the device path, in bytes.
39 DevicePath - Points to the start of the EFI device path.
42 Size - Size of the specified device path, in bytes, including the end-of-path tag.
46 return GetDevicePathSize (DevicePath
);
49 EFI_DEVICE_PATH_PROTOCOL
*
50 DuplicateDevicePathProtocolInterface (
51 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
56 Create a duplicate of the specified path.
59 DevicePath - Points to the source EFI device path.
62 Pointer - A pointer to the duplicate device path.
63 NULL - Insufficient memory.
67 return DuplicateDevicePath (DevicePath
);
70 EFI_DEVICE_PATH_PROTOCOL
*
71 AppendDevicePathProtocolInterface (
72 IN CONST EFI_DEVICE_PATH_PROTOCOL
*Src1
,
73 IN CONST EFI_DEVICE_PATH_PROTOCOL
*Src2
78 Create a new path by appending the second device path to the first.
81 Src1 - Points to the first device path. If NULL, then it is ignored.
82 Src2 - Points to the second device path. If NULL, then it is ignored.
85 Pointer - A pointer to the newly created device path.
86 NULL - Memory could not be allocated
87 or either DevicePath or DeviceNode is NULL.
91 return AppendDevicePath (Src1
, Src2
);
94 EFI_DEVICE_PATH_PROTOCOL
*
95 AppendDeviceNodeProtocolInterface (
96 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
97 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
102 Creates a new path by appending the device node to the device path.
105 DevicePath - Points to the device path.
106 DeviceNode - Points to the device node.
109 Pointer - A pointer to the allocated device node.
110 NULL - Memory could not be allocated
111 or either DevicePath or DeviceNode is NULL.
115 return AppendDevicePathNode (DevicePath
, DeviceNode
);
118 EFI_DEVICE_PATH_PROTOCOL
*
119 AppendDevicePathInstanceProtocolInterface (
120 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
121 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePathInstance
126 Creates a new path by appending the specified device path instance to the specified device path.
129 DevicePath - Points to the device path. If NULL, then ignored.
130 DevicePathInstance - Points to the device path instance.
133 Pointer - A pointer to the newly created device path
134 NULL - Memory could not be allocated or DevicePathInstance is NULL.
138 return AppendDevicePathInstance (DevicePath
, DevicePathInstance
);
141 EFI_DEVICE_PATH_PROTOCOL
*
142 GetNextDevicePathInstanceProtocolInterface (
143 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePathInstance
,
144 OUT UINTN
*DevicePathInstanceSize
149 Creates a copy of the current device path instance and returns a pointer to the next device path instance.
152 DevicePathInstance - On input, this holds the pointer to the current device path
153 instance. On output, this holds the pointer to the next
154 device path instance or NULL if there are no more device
155 path instances in the device path.
156 DevicePathInstanceSize - On output, this holds the size of the device path instance,
157 in bytes or zero, if DevicePathInstance is zero.
160 Pointer - A pointer to the copy of the current device path instance.
161 NULL - DevicePathInstace was NULL on entry or there was insufficient memory.
165 return GetNextDevicePathInstance (DevicePathInstance
, DevicePathInstanceSize
);
169 IsDevicePathMultiInstanceProtocolInterface (
170 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
175 Returns whether a device path is multi-instance.
178 DevicePath - Points to the device path. If NULL, then ignored.
181 TRUE - The device path has more than one instance
182 FALSE - The device path is empty or contains only a single instance.
186 return IsDevicePathMultiInstance (DevicePath
);
189 EFI_DEVICE_PATH_PROTOCOL
*
190 CreateDeviceNodeProtocolInterface (
192 IN UINT8 NodeSubType
,
198 Creates a device node
201 NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for
203 NodeSubType - NodeSubType is the device node sub-type
204 EFI_DEVICE_PATH.SubType) for the new device node.
205 NodeLength - NodeLength is the length of the device node
206 (EFI_DEVICE_PATH.Length) for the new device node.
209 Pointer - A pointer to the newly created device node.
210 NULL - NodeLength is less than
211 the size of the header or there was insufficient memory.
215 return CreateDeviceNode (NodeType
, NodeSubType
, NodeLength
);