2 Implementation file for Device Path Utilities Protocol
4 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "DevicePath.h"
18 GetDevicePathSizeProtocolInterface (
19 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
24 Returns the size of the device path, in bytes.
27 DevicePath - Points to the start of the EFI device path.
30 Size - Size of the specified device path, in bytes, including the end-of-path tag.
34 return GetDevicePathSize (DevicePath
);
37 EFI_DEVICE_PATH_PROTOCOL
*
38 DuplicateDevicePathProtocolInterface (
39 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
44 Create a duplicate of the specified path.
47 DevicePath - Points to the source EFI device path.
50 Pointer - A pointer to the duplicate device path.
51 NULL - Insufficient memory.
55 return DuplicateDevicePath (DevicePath
);
58 EFI_DEVICE_PATH_PROTOCOL
*
59 AppendDevicePathProtocolInterface (
60 IN CONST EFI_DEVICE_PATH_PROTOCOL
*Src1
,
61 IN CONST EFI_DEVICE_PATH_PROTOCOL
*Src2
66 Create a new path by appending the second device path to the first.
69 Src1 - Points to the first device path. If NULL, then it is ignored.
70 Src2 - Points to the second device path. If NULL, then it is ignored.
73 Pointer - A pointer to the newly created device path.
74 NULL - Memory could not be allocated
75 or either DevicePath or DeviceNode is NULL.
79 return AppendDevicePath (Src1
, Src2
);
82 EFI_DEVICE_PATH_PROTOCOL
*
83 AppendDeviceNodeProtocolInterface (
84 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
85 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
90 Creates a new path by appending the device node to the device path.
93 DevicePath - Points to the device path.
94 DeviceNode - Points to the device node.
97 Pointer - A pointer to the allocated device node.
98 NULL - Memory could not be allocated
99 or either DevicePath or DeviceNode is NULL.
103 return AppendDevicePathNode (DevicePath
, DeviceNode
);
106 EFI_DEVICE_PATH_PROTOCOL
*
107 AppendDevicePathInstanceProtocolInterface (
108 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
109 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePathInstance
114 Creates a new path by appending the specified device path instance to the specified device path.
117 DevicePath - Points to the device path. If NULL, then ignored.
118 DevicePathInstance - Points to the device path instance.
121 Pointer - A pointer to the newly created device path
122 NULL - Memory could not be allocated or DevicePathInstance is NULL.
126 return AppendDevicePathInstance (DevicePath
, DevicePathInstance
);
129 EFI_DEVICE_PATH_PROTOCOL
*
130 GetNextDevicePathInstanceProtocolInterface (
131 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePathInstance
,
132 OUT UINTN
*DevicePathInstanceSize
137 Creates a copy of the current device path instance and returns a pointer to the next device path instance.
140 DevicePathInstance - On input, this holds the pointer to the current device path
141 instance. On output, this holds the pointer to the next
142 device path instance or NULL if there are no more device
143 path instances in the device path.
144 DevicePathInstanceSize - On output, this holds the size of the device path instance,
145 in bytes or zero, if DevicePathInstance is zero.
148 Pointer - A pointer to the copy of the current device path instance.
149 NULL - DevicePathInstace was NULL on entry or there was insufficient memory.
153 return GetNextDevicePathInstance (DevicePathInstance
, DevicePathInstanceSize
);
157 IsDevicePathMultiInstanceProtocolInterface (
158 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
163 Returns whether a device path is multi-instance.
166 DevicePath - Points to the device path. If NULL, then ignored.
169 TRUE - The device path has more than one instance
170 FALSE - The device path is empty or contains only a single instance.
174 return IsDevicePathMultiInstance (DevicePath
);
177 EFI_DEVICE_PATH_PROTOCOL
*
178 CreateDeviceNodeProtocolInterface (
180 IN UINT8 NodeSubType
,
186 Creates a device node
189 NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for
191 NodeSubType - NodeSubType is the device node sub-type
192 EFI_DEVICE_PATH.SubType) for the new device node.
193 NodeLength - NodeLength is the length of the device node
194 (EFI_DEVICE_PATH.Length) for the new device node.
197 Pointer - A pointer to the newly created device node.
198 NULL - NodeLength is less than
199 the size of the header or there was insufficient memory.
203 return CreateDeviceNode (NodeType
, NodeSubType
, NodeLength
);