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