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
22 #include "DevicePath.h"
25 GetDevicePathSizeProtocolInterface (
26 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
31 Returns the size of the device path, in bytes.
34 DevicePath - Points to the start of the EFI device path.
37 Size - Size of the specified device path, in bytes, including the end-of-path tag.
41 return GetDevicePathSize (DevicePath
);
44 EFI_DEVICE_PATH_PROTOCOL
*
45 DuplicateDevicePathProtocolInterface (
46 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
51 Create a duplicate of the specified path.
54 DevicePath - Points to the source EFI device path.
57 Pointer - A pointer to the duplicate device path.
58 NULL - Insufficient memory.
62 return DuplicateDevicePath (DevicePath
);
65 EFI_DEVICE_PATH_PROTOCOL
*
66 AppendDevicePathProtocolInterface (
67 IN CONST EFI_DEVICE_PATH_PROTOCOL
*Src1
,
68 IN CONST EFI_DEVICE_PATH_PROTOCOL
*Src2
73 Create a new path by appending the second device path to the first.
76 Src1 - Points to the first device path. If NULL, then it is ignored.
77 Src2 - Points to the second device path. If NULL, then it is ignored.
80 Pointer - A pointer to the newly created device path.
81 NULL - Memory could not be allocated
82 or either DevicePath or DeviceNode is NULL.
86 return AppendDevicePath (Src1
, Src2
);
89 EFI_DEVICE_PATH_PROTOCOL
*
90 AppendDeviceNodeProtocolInterface (
91 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
92 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
97 Creates a new path by appending the device node to the device path.
100 DevicePath - Points to the device path.
101 DeviceNode - Points to the device node.
104 Pointer - A pointer to the allocated device node.
105 NULL - Memory could not be allocated
106 or either DevicePath or DeviceNode is NULL.
110 return AppendDevicePathNode (DevicePath
, DeviceNode
);
113 EFI_DEVICE_PATH_PROTOCOL
*
114 AppendDevicePathInstanceProtocolInterface (
115 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
116 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePathInstance
121 Creates a new path by appending the specified device path instance to the specified device path.
124 DevicePath - Points to the device path. If NULL, then ignored.
125 DevicePathInstance - Points to the device path instance.
128 Pointer - A pointer to the newly created device path
129 NULL - Memory could not be allocated or DevicePathInstance is NULL.
133 return AppendDevicePathInstance (DevicePath
, DevicePathInstance
);
136 EFI_DEVICE_PATH_PROTOCOL
*
137 GetNextDevicePathInstanceProtocolInterface (
138 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePathInstance
,
139 OUT UINTN
*DevicePathInstanceSize
144 Creates a copy of the current device path instance and returns a pointer to the next device path instance.
147 DevicePathInstance - On input, this holds the pointer to the current device path
148 instance. On output, this holds the pointer to the next
149 device path instance or NULL if there are no more device
150 path instances in the device path.
151 DevicePathInstanceSize - On output, this holds the size of the device path instance,
152 in bytes or zero, if DevicePathInstance is zero.
155 Pointer - A pointer to the copy of the current device path instance.
156 NULL - DevicePathInstace was NULL on entry or there was insufficient memory.
160 return GetNextDevicePathInstance (DevicePathInstance
, DevicePathInstanceSize
);
164 IsDevicePathMultiInstanceProtocolInterface (
165 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
170 Returns whether a device path is multi-instance.
173 DevicePath - Points to the device path. If NULL, then ignored.
176 TRUE - The device path has more than one instance
177 FALSE - The device path is empty or contains only a single instance.
181 return IsDevicePathMultiInstance (DevicePath
);
184 EFI_DEVICE_PATH_PROTOCOL
*
185 CreateDeviceNodeProtocolInterface (
187 IN UINT8 NodeSubType
,
193 Creates a device node
196 NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for
198 NodeSubType - NodeSubType is the device node sub-type
199 EFI_DEVICE_PATH.SubType) for the new device node.
200 NodeLength - NodeLength is the length of the device node
201 (EFI_DEVICE_PATH.Length) for the new device node.
204 Pointer - A pointer to the newly created device node.
205 NULL - NodeLength is less than
206 the size of the header or there was insufficient memory.
210 return CreateDeviceNode (NodeType
, NodeSubType
, NodeLength
);