]>
Commit | Line | Data |
---|---|---|
13d40edd | 1 | /** @file\r |
2 | DevicePathToText protocol as defined in the UEFI 2.0 specification.\r | |
95276127 | 3 | \r |
7795c8f9 | 4 | Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\r |
e5eed7d3 | 5 | This program and the accompanying materials\r |
13d40edd | 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 |
4d0a30a4 | 15 | #include "UefiDevicePathLib.h"\r |
95276127 | 16 | \r |
572f5d8a | 17 | /**\r |
18 | Concatenates a formatted unicode string to allocated pool. The caller must\r | |
19 | free the resulting buffer.\r | |
20 | \r | |
21 | @param Str Tracks the allocated pool, size in use, and\r | |
22 | amount of pool allocated.\r | |
23 | @param Fmt The format string\r | |
24 | @param ... Variable arguments based on the format string.\r | |
25 | \r | |
26 | @return Allocated buffer with the formatted string printed in it.\r | |
27 | The caller must free the allocated buffer. The buffer\r | |
28 | allocation is not packed.\r | |
29 | \r | |
30 | **/\r | |
95276127 | 31 | CHAR16 *\r |
eed8d676 | 32 | EFIAPI\r |
4d0a30a4 | 33 | UefiDevicePathLibCatPrint (\r |
95276127 | 34 | IN OUT POOL_PRINT *Str,\r |
35 | IN CHAR16 *Fmt,\r | |
36 | ...\r | |
37 | )\r | |
95276127 | 38 | {\r |
4d0a30a4 | 39 | UINTN Count;\r |
95276127 | 40 | VA_LIST Args;\r |
95276127 | 41 | \r |
95276127 | 42 | VA_START (Args, Fmt);\r |
4d0a30a4 | 43 | Count = SPrintLength (Fmt, Args);\r |
e9b3cd55 | 44 | \r |
4d0a30a4 RN |
45 | if ((Str->Count + (Count + 1)) * sizeof (CHAR16) > Str->Capacity) {\r |
46 | Str->Capacity = (Str->Count + (Count + 1) * 2) * sizeof (CHAR16);\r | |
95276127 | 47 | Str->Str = ReallocatePool (\r |
4d0a30a4 | 48 | Str->Count * sizeof (CHAR16),\r |
e9b3cd55 | 49 | Str->Capacity,\r |
48557c65 | 50 | Str->Str\r |
51 | );\r | |
95276127 | 52 | ASSERT (Str->Str != NULL);\r |
53 | }\r | |
4d0a30a4 RN |
54 | UnicodeVSPrint (&Str->Str[Str->Count], Str->Capacity - Str->Count * sizeof (CHAR16), Fmt, Args);\r |
55 | Str->Count += Count;\r | |
56 | \r | |
57 | VA_END (Args);\r | |
95276127 | 58 | return Str->Str;\r |
59 | }\r | |
60 | \r | |
572f5d8a | 61 | /**\r |
48557c65 | 62 | Converts a PCI device path structure to its string representative.\r |
572f5d8a | 63 | \r |
48557c65 | 64 | @param Str The string representative of input device.\r |
572f5d8a | 65 | @param DevPath The input device path structure.\r |
66 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
67 | of the display node is used, where applicable. If DisplayOnly\r | |
68 | is FALSE, then the longer text representation of the display node\r | |
69 | is used.\r | |
70 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
71 | representation for a device node can be used, where applicable.\r | |
72 | \r | |
73 | **/\r | |
95276127 | 74 | VOID\r |
75 | DevPathToTextPci (\r | |
76 | IN OUT POOL_PRINT *Str,\r | |
77 | IN VOID *DevPath,\r | |
78 | IN BOOLEAN DisplayOnly,\r | |
79 | IN BOOLEAN AllowShortcuts\r | |
80 | )\r | |
81 | {\r | |
82 | PCI_DEVICE_PATH *Pci;\r | |
83 | \r | |
84 | Pci = DevPath;\r | |
4d0a30a4 | 85 | UefiDevicePathLibCatPrint (Str, L"Pci(0x%x,0x%x)", Pci->Device, Pci->Function);\r |
95276127 | 86 | }\r |
87 | \r | |
572f5d8a | 88 | /**\r |
48557c65 | 89 | Converts a PC Card device path structure to its string representative.\r |
572f5d8a | 90 | \r |
48557c65 | 91 | @param Str The string representative of input device.\r |
572f5d8a | 92 | @param DevPath The input device path structure.\r |
93 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
94 | of the display node is used, where applicable. If DisplayOnly\r | |
95 | is FALSE, then the longer text representation of the display node\r | |
96 | is used.\r | |
97 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
98 | representation for a device node can be used, where applicable.\r | |
99 | \r | |
100 | **/\r | |
95276127 | 101 | VOID\r |
102 | DevPathToTextPccard (\r | |
103 | IN OUT POOL_PRINT *Str,\r | |
104 | IN VOID *DevPath,\r | |
105 | IN BOOLEAN DisplayOnly,\r | |
106 | IN BOOLEAN AllowShortcuts\r | |
107 | )\r | |
108 | {\r | |
109 | PCCARD_DEVICE_PATH *Pccard;\r | |
110 | \r | |
111 | Pccard = DevPath;\r | |
4d0a30a4 | 112 | UefiDevicePathLibCatPrint (Str, L"PcCard(0x%x)", Pccard->FunctionNumber);\r |
95276127 | 113 | }\r |
114 | \r | |
572f5d8a | 115 | /**\r |
48557c65 | 116 | Converts a Memory Map device path structure to its string representative.\r |
572f5d8a | 117 | \r |
48557c65 | 118 | @param Str The string representative of input device.\r |
572f5d8a | 119 | @param DevPath The input device path structure.\r |
120 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
121 | of the display node is used, where applicable. If DisplayOnly\r | |
122 | is FALSE, then the longer text representation of the display node\r | |
123 | is used.\r | |
124 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
125 | representation for a device node can be used, where applicable.\r | |
126 | \r | |
127 | **/\r | |
95276127 | 128 | VOID\r |
129 | DevPathToTextMemMap (\r | |
130 | IN OUT POOL_PRINT *Str,\r | |
131 | IN VOID *DevPath,\r | |
132 | IN BOOLEAN DisplayOnly,\r | |
133 | IN BOOLEAN AllowShortcuts\r | |
134 | )\r | |
135 | {\r | |
136 | MEMMAP_DEVICE_PATH *MemMap;\r | |
137 | \r | |
138 | MemMap = DevPath;\r | |
4d0a30a4 | 139 | UefiDevicePathLibCatPrint (\r |
95276127 | 140 | Str,\r |
cf40f28a | 141 | L"MemoryMapped(0x%x,0x%lx,0x%lx)",\r |
e9b3cd55 | 142 | MemMap->MemoryType,\r |
95276127 | 143 | MemMap->StartingAddress,\r |
144 | MemMap->EndingAddress\r | |
145 | );\r | |
146 | }\r | |
147 | \r | |
572f5d8a | 148 | /**\r |
48557c65 | 149 | Converts a Vendor device path structure to its string representative.\r |
572f5d8a | 150 | \r |
48557c65 | 151 | @param Str The string representative of input device.\r |
572f5d8a | 152 | @param DevPath The input device path structure.\r |
153 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
154 | of the display node is used, where applicable. If DisplayOnly\r | |
155 | is FALSE, then the longer text representation of the display node\r | |
156 | is used.\r | |
157 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
158 | representation for a device node can be used, where applicable.\r | |
159 | \r | |
160 | **/\r | |
95276127 | 161 | VOID\r |
162 | DevPathToTextVendor (\r | |
163 | IN OUT POOL_PRINT *Str,\r | |
164 | IN VOID *DevPath,\r | |
165 | IN BOOLEAN DisplayOnly,\r | |
166 | IN BOOLEAN AllowShortcuts\r | |
167 | )\r | |
168 | {\r | |
169 | VENDOR_DEVICE_PATH *Vendor;\r | |
170 | CHAR16 *Type;\r | |
171 | UINTN Index;\r | |
cf40f28a | 172 | UINTN DataLength;\r |
95276127 | 173 | UINT32 FlowControlMap;\r |
174 | UINT16 Info;\r | |
175 | \r | |
176 | Vendor = (VENDOR_DEVICE_PATH *) DevPath;\r | |
177 | switch (DevicePathType (&Vendor->Header)) {\r | |
178 | case HARDWARE_DEVICE_PATH:\r | |
179 | Type = L"Hw";\r | |
180 | break;\r | |
181 | \r | |
182 | case MESSAGING_DEVICE_PATH:\r | |
183 | Type = L"Msg";\r | |
184 | if (AllowShortcuts) {\r | |
185 | if (CompareGuid (&Vendor->Guid, &gEfiPcAnsiGuid)) {\r | |
4d0a30a4 | 186 | UefiDevicePathLibCatPrint (Str, L"VenPcAnsi()");\r |
95276127 | 187 | return ;\r |
188 | } else if (CompareGuid (&Vendor->Guid, &gEfiVT100Guid)) {\r | |
4d0a30a4 | 189 | UefiDevicePathLibCatPrint (Str, L"VenVt100()");\r |
95276127 | 190 | return ;\r |
191 | } else if (CompareGuid (&Vendor->Guid, &gEfiVT100PlusGuid)) {\r | |
4d0a30a4 | 192 | UefiDevicePathLibCatPrint (Str, L"VenVt100Plus()");\r |
95276127 | 193 | return ;\r |
194 | } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {\r | |
4d0a30a4 | 195 | UefiDevicePathLibCatPrint (Str, L"VenUft8()");\r |
95276127 | 196 | return ;\r |
48557c65 | 197 | } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) {\r |
95276127 | 198 | FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap);\r |
199 | switch (FlowControlMap & 0x00000003) {\r | |
200 | case 0:\r | |
4d0a30a4 | 201 | UefiDevicePathLibCatPrint (Str, L"UartFlowCtrl(%s)", L"None");\r |
95276127 | 202 | break;\r |
203 | \r | |
204 | case 1:\r | |
4d0a30a4 | 205 | UefiDevicePathLibCatPrint (Str, L"UartFlowCtrl(%s)", L"Hardware");\r |
95276127 | 206 | break;\r |
207 | \r | |
208 | case 2:\r | |
4d0a30a4 | 209 | UefiDevicePathLibCatPrint (Str, L"UartFlowCtrl(%s)", L"XonXoff");\r |
95276127 | 210 | break;\r |
211 | \r | |
212 | default:\r | |
213 | break;\r | |
214 | }\r | |
215 | \r | |
216 | return ;\r | |
48557c65 | 217 | } else if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) {\r |
4d0a30a4 | 218 | UefiDevicePathLibCatPrint (\r |
95276127 | 219 | Str,\r |
cf40f28a | 220 | L"SAS(0x%lx,0x%lx,0x%x,",\r |
95276127 | 221 | ((SAS_DEVICE_PATH *) Vendor)->SasAddress,\r |
222 | ((SAS_DEVICE_PATH *) Vendor)->Lun,\r | |
e9b3cd55 | 223 | ((SAS_DEVICE_PATH *) Vendor)->RelativeTargetPort\r |
95276127 | 224 | );\r |
225 | Info = (((SAS_DEVICE_PATH *) Vendor)->DeviceTopology);\r | |
562fce0b | 226 | if (((Info & 0x0f) == 0) && ((Info & BIT7) == 0)) {\r |
4d0a30a4 | 227 | UefiDevicePathLibCatPrint (Str, L"NoTopology,0,0,0,");\r |
562fce0b | 228 | } else if (((Info & 0x0f) <= 2) && ((Info & BIT7) == 0)) {\r |
4d0a30a4 | 229 | UefiDevicePathLibCatPrint (\r |
95276127 | 230 | Str,\r |
231 | L"%s,%s,%s,",\r | |
562fce0b RN |
232 | ((Info & BIT4) != 0) ? L"SATA" : L"SAS",\r |
233 | ((Info & BIT5) != 0) ? L"External" : L"Internal",\r | |
234 | ((Info & BIT6) != 0) ? L"Expanded" : L"Direct"\r | |
95276127 | 235 | );\r |
236 | if ((Info & 0x0f) == 1) {\r | |
4d0a30a4 | 237 | UefiDevicePathLibCatPrint (Str, L"0,");\r |
95276127 | 238 | } else {\r |
562fce0b RN |
239 | //\r |
240 | // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256\r | |
241 | //\r | |
4d0a30a4 | 242 | UefiDevicePathLibCatPrint (Str, L"0x%x,", ((Info >> 8) & 0xff) + 1);\r |
95276127 | 243 | }\r |
244 | } else {\r | |
4d0a30a4 | 245 | UefiDevicePathLibCatPrint (Str, L"0x%x,0,0,0,", Info);\r |
95276127 | 246 | }\r |
247 | \r | |
4d0a30a4 | 248 | UefiDevicePathLibCatPrint (Str, L"0x%x)", ((SAS_DEVICE_PATH *) Vendor)->Reserved);\r |
95276127 | 249 | return ;\r |
250 | } else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) {\r | |
4d0a30a4 | 251 | UefiDevicePathLibCatPrint (Str, L"DebugPort()");\r |
95276127 | 252 | return ;\r |
95276127 | 253 | }\r |
254 | }\r | |
255 | break;\r | |
256 | \r | |
257 | case MEDIA_DEVICE_PATH:\r | |
258 | Type = L"Media";\r | |
259 | break;\r | |
260 | \r | |
261 | default:\r | |
262 | Type = L"?";\r | |
263 | break;\r | |
264 | }\r | |
265 | \r | |
cf40f28a | 266 | DataLength = DevicePathNodeLength (&Vendor->Header) - sizeof (VENDOR_DEVICE_PATH);\r |
4d0a30a4 | 267 | UefiDevicePathLibCatPrint (Str, L"Ven%s(%g", Type, &Vendor->Guid);\r |
cf40f28a | 268 | if (DataLength != 0) {\r |
4d0a30a4 | 269 | UefiDevicePathLibCatPrint (Str, L",");\r |
cf40f28a | 270 | for (Index = 0; Index < DataLength; Index++) {\r |
4d0a30a4 | 271 | UefiDevicePathLibCatPrint (Str, L"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]);\r |
cf40f28a | 272 | }\r |
95276127 | 273 | }\r |
274 | \r | |
4d0a30a4 | 275 | UefiDevicePathLibCatPrint (Str, L")");\r |
95276127 | 276 | }\r |
277 | \r | |
572f5d8a | 278 | /**\r |
48557c65 | 279 | Converts a Controller device path structure to its string representative.\r |
572f5d8a | 280 | \r |
48557c65 | 281 | @param Str The string representative of input device.\r |
572f5d8a | 282 | @param DevPath The input device path structure.\r |
283 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
284 | of the display node is used, where applicable. If DisplayOnly\r | |
285 | is FALSE, then the longer text representation of the display node\r | |
286 | is used.\r | |
287 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
288 | representation for a device node can be used, where applicable.\r | |
289 | \r | |
290 | **/\r | |
95276127 | 291 | VOID\r |
292 | DevPathToTextController (\r | |
293 | IN OUT POOL_PRINT *Str,\r | |
294 | IN VOID *DevPath,\r | |
295 | IN BOOLEAN DisplayOnly,\r | |
296 | IN BOOLEAN AllowShortcuts\r | |
297 | )\r | |
298 | {\r | |
299 | CONTROLLER_DEVICE_PATH *Controller;\r | |
300 | \r | |
301 | Controller = DevPath;\r | |
4d0a30a4 | 302 | UefiDevicePathLibCatPrint (\r |
95276127 | 303 | Str,\r |
cf40f28a | 304 | L"Ctrl(0x%x)",\r |
e9b3cd55 | 305 | Controller->ControllerNumber\r |
95276127 | 306 | );\r |
307 | }\r | |
308 | \r | |
624f017e HW |
309 | /**\r |
310 | Converts a BMC device path structure to its string representative.\r | |
311 | \r | |
312 | @param Str The string representative of input device.\r | |
313 | @param DevPath The input device path structure.\r | |
314 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
315 | of the display node is used, where applicable. If DisplayOnly\r | |
316 | is FALSE, then the longer text representation of the display node\r | |
317 | is used.\r | |
318 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
319 | representation for a device node can be used, where applicable.\r | |
320 | \r | |
321 | **/\r | |
322 | VOID\r | |
323 | DevPathToTextBmc (\r | |
324 | IN OUT POOL_PRINT *Str,\r | |
325 | IN VOID *DevPath,\r | |
326 | IN BOOLEAN DisplayOnly,\r | |
327 | IN BOOLEAN AllowShortcuts\r | |
328 | )\r | |
329 | {\r | |
330 | BMC_DEVICE_PATH *Bmc;\r | |
331 | \r | |
332 | Bmc = DevPath;\r | |
333 | UefiDevicePathLibCatPrint (\r | |
334 | Str,\r | |
335 | L"Bmc(0x%x,0x%lx)",\r | |
336 | Bmc->InterfaceType,\r | |
337 | ReadUnaligned64 ((UINT64 *) (&Bmc->BaseAddress))\r | |
338 | );\r | |
339 | }\r | |
340 | \r | |
572f5d8a | 341 | /**\r |
48557c65 | 342 | Converts a ACPI device path structure to its string representative.\r |
572f5d8a | 343 | \r |
48557c65 | 344 | @param Str The string representative of input device.\r |
572f5d8a | 345 | @param DevPath The input device path structure.\r |
346 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
347 | of the display node is used, where applicable. If DisplayOnly\r | |
348 | is FALSE, then the longer text representation of the display node\r | |
349 | is used.\r | |
350 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
351 | representation for a device node can be used, where applicable.\r | |
352 | \r | |
353 | **/\r | |
95276127 | 354 | VOID\r |
355 | DevPathToTextAcpi (\r | |
356 | IN OUT POOL_PRINT *Str,\r | |
357 | IN VOID *DevPath,\r | |
358 | IN BOOLEAN DisplayOnly,\r | |
359 | IN BOOLEAN AllowShortcuts\r | |
360 | )\r | |
361 | {\r | |
362 | ACPI_HID_DEVICE_PATH *Acpi;\r | |
363 | \r | |
364 | Acpi = DevPath;\r | |
365 | if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r | |
cf40f28a | 366 | switch (EISA_ID_TO_NUM (Acpi->HID)) {\r |
367 | case 0x0a03:\r | |
4d0a30a4 | 368 | UefiDevicePathLibCatPrint (Str, L"PciRoot(0x%x)", Acpi->UID);\r |
e9b3cd55 RN |
369 | break;\r |
370 | \r | |
371 | case 0x0a08:\r | |
4d0a30a4 | 372 | UefiDevicePathLibCatPrint (Str, L"PcieRoot(0x%x)", Acpi->UID);\r |
cf40f28a | 373 | break;\r |
95276127 | 374 | \r |
cf40f28a | 375 | case 0x0604:\r |
4d0a30a4 | 376 | UefiDevicePathLibCatPrint (Str, L"Floppy(0x%x)", Acpi->UID);\r |
cf40f28a | 377 | break;\r |
95276127 | 378 | \r |
cf40f28a | 379 | case 0x0301:\r |
4d0a30a4 | 380 | UefiDevicePathLibCatPrint (Str, L"Keyboard(0x%x)", Acpi->UID);\r |
cf40f28a | 381 | break;\r |
95276127 | 382 | \r |
cf40f28a | 383 | case 0x0501:\r |
4d0a30a4 | 384 | UefiDevicePathLibCatPrint (Str, L"Serial(0x%x)", Acpi->UID);\r |
cf40f28a | 385 | break;\r |
95276127 | 386 | \r |
cf40f28a | 387 | case 0x0401:\r |
4d0a30a4 | 388 | UefiDevicePathLibCatPrint (Str, L"ParallelPort(0x%x)", Acpi->UID);\r |
cf40f28a | 389 | break;\r |
95276127 | 390 | \r |
cf40f28a | 391 | default:\r |
4d0a30a4 | 392 | UefiDevicePathLibCatPrint (Str, L"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);\r |
cf40f28a | 393 | break;\r |
95276127 | 394 | }\r |
95276127 | 395 | } else {\r |
4d0a30a4 | 396 | UefiDevicePathLibCatPrint (Str, L"Acpi(0x%08x,0x%x)", Acpi->HID, Acpi->UID);\r |
95276127 | 397 | }\r |
398 | }\r | |
399 | \r | |
572f5d8a | 400 | /**\r |
48557c65 | 401 | Converts a ACPI extended HID device path structure to its string representative.\r |
572f5d8a | 402 | \r |
48557c65 | 403 | @param Str The string representative of input device.\r |
572f5d8a | 404 | @param DevPath The input device path structure.\r |
405 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
406 | of the display node is used, where applicable. If DisplayOnly\r | |
407 | is FALSE, then the longer text representation of the display node\r | |
408 | is used.\r | |
409 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
410 | representation for a device node can be used, where applicable.\r | |
411 | \r | |
412 | **/\r | |
95276127 | 413 | VOID\r |
cf40f28a | 414 | DevPathToTextAcpiEx (\r |
95276127 | 415 | IN OUT POOL_PRINT *Str,\r |
416 | IN VOID *DevPath,\r | |
417 | IN BOOLEAN DisplayOnly,\r | |
418 | IN BOOLEAN AllowShortcuts\r | |
419 | )\r | |
420 | {\r | |
cf40f28a | 421 | ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx;\r |
422 | CHAR8 *HIDStr;\r | |
423 | CHAR8 *UIDStr;\r | |
424 | CHAR8 *CIDStr;\r | |
425 | CHAR16 HIDText[11];\r | |
426 | CHAR16 CIDText[11];\r | |
427 | \r | |
428 | AcpiEx = DevPath;\r | |
429 | HIDStr = (CHAR8 *) (((UINT8 *) AcpiEx) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));\r | |
430 | UIDStr = HIDStr + AsciiStrLen (HIDStr) + 1;\r | |
431 | CIDStr = UIDStr + AsciiStrLen (UIDStr) + 1;\r | |
432 | \r | |
4d0a30a4 RN |
433 | //\r |
434 | // Converts EISA identification to string.\r | |
435 | // \r | |
436 | UnicodeSPrint (\r | |
437 | HIDText,\r | |
438 | sizeof (HIDText),\r | |
439 | L"%c%c%c%04X",\r | |
440 | ((AcpiEx->HID >> 10) & 0x1f) + 'A' - 1,\r | |
441 | ((AcpiEx->HID >> 5) & 0x1f) + 'A' - 1,\r | |
442 | ((AcpiEx->HID >> 0) & 0x1f) + 'A' - 1,\r | |
443 | (AcpiEx->HID >> 16) & 0xFFFF\r | |
444 | );\r | |
445 | UnicodeSPrint (\r | |
446 | CIDText,\r | |
447 | sizeof (CIDText),\r | |
448 | L"%c%c%c%04X",\r | |
449 | ((AcpiEx->CID >> 10) & 0x1f) + 'A' - 1,\r | |
450 | ((AcpiEx->CID >> 5) & 0x1f) + 'A' - 1,\r | |
451 | ((AcpiEx->CID >> 0) & 0x1f) + 'A' - 1,\r | |
452 | (AcpiEx->CID >> 16) & 0xFFFF\r | |
453 | );\r | |
cf40f28a | 454 | \r |
455 | if ((*HIDStr == '\0') && (*CIDStr == '\0') && (AcpiEx->UID == 0)) {\r | |
456 | //\r | |
457 | // use AcpiExp()\r | |
458 | //\r | |
4d0a30a4 | 459 | UefiDevicePathLibCatPrint (\r |
cf40f28a | 460 | Str,\r |
461 | L"AcpiExp(%s,%s,%a)",\r | |
462 | HIDText,\r | |
463 | CIDText,\r | |
464 | UIDStr\r | |
465 | );\r | |
466 | } else {\r | |
467 | if (AllowShortcuts) {\r | |
468 | //\r | |
469 | // display only\r | |
470 | //\r | |
471 | if (AcpiEx->HID == 0) {\r | |
4d0a30a4 | 472 | UefiDevicePathLibCatPrint (Str, L"AcpiEx(%a,", HIDStr);\r |
cf40f28a | 473 | } else {\r |
4d0a30a4 | 474 | UefiDevicePathLibCatPrint (Str, L"AcpiEx(%s,", HIDText);\r |
cf40f28a | 475 | }\r |
95276127 | 476 | \r |
cf40f28a | 477 | if (AcpiEx->UID == 0) {\r |
4d0a30a4 | 478 | UefiDevicePathLibCatPrint (Str, L"%a,", UIDStr);\r |
cf40f28a | 479 | } else {\r |
4d0a30a4 | 480 | UefiDevicePathLibCatPrint (Str, L"0x%x,", AcpiEx->UID);\r |
cf40f28a | 481 | }\r |
95276127 | 482 | \r |
cf40f28a | 483 | if (AcpiEx->CID == 0) {\r |
4d0a30a4 | 484 | UefiDevicePathLibCatPrint (Str, L"%a)", CIDStr);\r |
95276127 | 485 | } else {\r |
4d0a30a4 | 486 | UefiDevicePathLibCatPrint (Str, L"%s)", CIDText);\r |
95276127 | 487 | }\r |
cf40f28a | 488 | } else {\r |
4d0a30a4 | 489 | UefiDevicePathLibCatPrint (\r |
cf40f28a | 490 | Str,\r |
491 | L"AcpiEx(%s,%s,0x%x,%a,%a,%a)",\r | |
492 | HIDText,\r | |
493 | CIDText,\r | |
e9b3cd55 | 494 | AcpiEx->UID,\r |
cf40f28a | 495 | HIDStr,\r |
496 | CIDStr,\r | |
497 | UIDStr\r | |
498 | );\r | |
95276127 | 499 | }\r |
95276127 | 500 | }\r |
cf40f28a | 501 | }\r |
95276127 | 502 | \r |
572f5d8a | 503 | /**\r |
48557c65 | 504 | Converts a ACPI address device path structure to its string representative.\r |
572f5d8a | 505 | \r |
48557c65 | 506 | @param Str The string representative of input device.\r |
572f5d8a | 507 | @param DevPath The input device path structure.\r |
508 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
509 | of the display node is used, where applicable. If DisplayOnly\r | |
510 | is FALSE, then the longer text representation of the display node\r | |
511 | is used.\r | |
512 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
513 | representation for a device node can be used, where applicable.\r | |
514 | \r | |
515 | **/\r | |
cf40f28a | 516 | VOID\r |
517 | DevPathToTextAcpiAdr (\r | |
518 | IN OUT POOL_PRINT *Str,\r | |
519 | IN VOID *DevPath,\r | |
520 | IN BOOLEAN DisplayOnly,\r | |
521 | IN BOOLEAN AllowShortcuts\r | |
522 | )\r | |
523 | {\r | |
524 | ACPI_ADR_DEVICE_PATH *AcpiAdr;\r | |
525 | UINT16 Index;\r | |
526 | UINT16 Length;\r | |
527 | UINT16 AdditionalAdrCount;\r | |
528 | \r | |
529 | AcpiAdr = DevPath;\r | |
530 | Length = (UINT16) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr);\r | |
531 | AdditionalAdrCount = (UINT16) ((Length - 8) / 4);\r | |
532 | \r | |
4d0a30a4 | 533 | UefiDevicePathLibCatPrint (Str, L"AcpiAdr(0x%x", AcpiAdr->ADR);\r |
cf40f28a | 534 | for (Index = 0; Index < AdditionalAdrCount; Index++) {\r |
4d0a30a4 | 535 | UefiDevicePathLibCatPrint (Str, L",0x%x", *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4));\r |
95276127 | 536 | }\r |
4d0a30a4 | 537 | UefiDevicePathLibCatPrint (Str, L")");\r |
95276127 | 538 | }\r |
539 | \r | |
572f5d8a | 540 | /**\r |
48557c65 | 541 | Converts a ATAPI device path structure to its string representative.\r |
572f5d8a | 542 | \r |
48557c65 | 543 | @param Str The string representative of input device.\r |
572f5d8a | 544 | @param DevPath The input device path structure.\r |
545 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
546 | of the display node is used, where applicable. If DisplayOnly\r | |
547 | is FALSE, then the longer text representation of the display node\r | |
548 | is used.\r | |
549 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
550 | representation for a device node can be used, where applicable.\r | |
551 | \r | |
552 | **/\r | |
95276127 | 553 | VOID\r |
554 | DevPathToTextAtapi (\r | |
555 | IN OUT POOL_PRINT *Str,\r | |
556 | IN VOID *DevPath,\r | |
557 | IN BOOLEAN DisplayOnly,\r | |
558 | IN BOOLEAN AllowShortcuts\r | |
559 | )\r | |
560 | {\r | |
561 | ATAPI_DEVICE_PATH *Atapi;\r | |
562 | \r | |
563 | Atapi = DevPath;\r | |
564 | \r | |
565 | if (DisplayOnly) {\r | |
4d0a30a4 | 566 | UefiDevicePathLibCatPrint (Str, L"Ata(0x%x)", Atapi->Lun);\r |
95276127 | 567 | } else {\r |
4d0a30a4 | 568 | UefiDevicePathLibCatPrint (\r |
95276127 | 569 | Str,\r |
cf40f28a | 570 | L"Ata(%s,%s,0x%x)",\r |
7ae9c1ce | 571 | (Atapi->PrimarySecondary == 1) ? L"Secondary" : L"Primary",\r |
572 | (Atapi->SlaveMaster == 1) ? L"Slave" : L"Master",\r | |
e9b3cd55 | 573 | Atapi->Lun\r |
95276127 | 574 | );\r |
575 | }\r | |
576 | }\r | |
577 | \r | |
572f5d8a | 578 | /**\r |
48557c65 | 579 | Converts a SCSI device path structure to its string representative.\r |
572f5d8a | 580 | \r |
48557c65 | 581 | @param Str The string representative of input device.\r |
572f5d8a | 582 | @param DevPath The input device path structure.\r |
583 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
584 | of the display node is used, where applicable. If DisplayOnly\r | |
585 | is FALSE, then the longer text representation of the display node\r | |
586 | is used.\r | |
587 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
588 | representation for a device node can be used, where applicable.\r | |
589 | \r | |
590 | **/\r | |
95276127 | 591 | VOID\r |
592 | DevPathToTextScsi (\r | |
593 | IN OUT POOL_PRINT *Str,\r | |
594 | IN VOID *DevPath,\r | |
595 | IN BOOLEAN DisplayOnly,\r | |
596 | IN BOOLEAN AllowShortcuts\r | |
597 | )\r | |
598 | {\r | |
599 | SCSI_DEVICE_PATH *Scsi;\r | |
600 | \r | |
601 | Scsi = DevPath;\r | |
4d0a30a4 | 602 | UefiDevicePathLibCatPrint (Str, L"Scsi(0x%x,0x%x)", Scsi->Pun, Scsi->Lun);\r |
95276127 | 603 | }\r |
604 | \r | |
572f5d8a | 605 | /**\r |
48557c65 | 606 | Converts a Fibre device path structure to its string representative.\r |
572f5d8a | 607 | \r |
48557c65 | 608 | @param Str The string representative of input device.\r |
572f5d8a | 609 | @param DevPath The input device path structure.\r |
610 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
611 | of the display node is used, where applicable. If DisplayOnly\r | |
612 | is FALSE, then the longer text representation of the display node\r | |
613 | is used.\r | |
614 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
615 | representation for a device node can be used, where applicable.\r | |
616 | \r | |
617 | **/\r | |
95276127 | 618 | VOID\r |
619 | DevPathToTextFibre (\r | |
620 | IN OUT POOL_PRINT *Str,\r | |
621 | IN VOID *DevPath,\r | |
622 | IN BOOLEAN DisplayOnly,\r | |
623 | IN BOOLEAN AllowShortcuts\r | |
624 | )\r | |
625 | {\r | |
626 | FIBRECHANNEL_DEVICE_PATH *Fibre;\r | |
627 | \r | |
628 | Fibre = DevPath;\r | |
4d0a30a4 | 629 | UefiDevicePathLibCatPrint (Str, L"Fibre(0x%lx,0x%lx)", Fibre->WWN, Fibre->Lun);\r |
95276127 | 630 | }\r |
631 | \r | |
e9b3cd55 RN |
632 | /**\r |
633 | Converts a FibreEx device path structure to its string representative.\r | |
634 | \r | |
635 | @param Str The string representative of input device.\r | |
636 | @param DevPath The input device path structure.\r | |
637 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
638 | of the display node is used, where applicable. If DisplayOnly\r | |
639 | is FALSE, then the longer text representation of the display node\r | |
640 | is used.\r | |
641 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
642 | representation for a device node can be used, where applicable.\r | |
643 | \r | |
644 | **/\r | |
645 | VOID\r | |
646 | DevPathToTextFibreEx (\r | |
647 | IN OUT POOL_PRINT *Str,\r | |
648 | IN VOID *DevPath,\r | |
649 | IN BOOLEAN DisplayOnly,\r | |
650 | IN BOOLEAN AllowShortcuts\r | |
651 | )\r | |
652 | {\r | |
653 | FIBRECHANNELEX_DEVICE_PATH *FibreEx;\r | |
654 | UINTN Index;\r | |
655 | \r | |
656 | FibreEx = DevPath;\r | |
4d0a30a4 | 657 | UefiDevicePathLibCatPrint (Str, L"FibreEx(0x");\r |
e9b3cd55 | 658 | for (Index = 0; Index < sizeof (FibreEx->WWN) / sizeof (FibreEx->WWN[0]); Index++) {\r |
4d0a30a4 | 659 | UefiDevicePathLibCatPrint (Str, L"%02x", FibreEx->WWN[Index]);\r |
e9b3cd55 | 660 | }\r |
4d0a30a4 | 661 | UefiDevicePathLibCatPrint (Str, L",0x");\r |
e9b3cd55 | 662 | for (Index = 0; Index < sizeof (FibreEx->Lun) / sizeof (FibreEx->Lun[0]); Index++) {\r |
4d0a30a4 | 663 | UefiDevicePathLibCatPrint (Str, L"%02x", FibreEx->Lun[Index]);\r |
e9b3cd55 | 664 | }\r |
4d0a30a4 | 665 | UefiDevicePathLibCatPrint (Str, L")");\r |
e9b3cd55 RN |
666 | }\r |
667 | \r | |
501793fa RN |
668 | /**\r |
669 | Converts a Sas Ex device path structure to its string representative.\r | |
670 | \r | |
671 | @param Str The string representative of input device.\r | |
672 | @param DevPath The input device path structure.\r | |
673 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
674 | of the display node is used, where applicable. If DisplayOnly\r | |
675 | is FALSE, then the longer text representation of the display node\r | |
676 | is used.\r | |
677 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
678 | representation for a device node can be used, where applicable.\r | |
679 | \r | |
680 | **/\r | |
681 | VOID\r | |
682 | DevPathToTextSasEx (\r | |
683 | IN OUT POOL_PRINT *Str,\r | |
684 | IN VOID *DevPath,\r | |
685 | IN BOOLEAN DisplayOnly,\r | |
686 | IN BOOLEAN AllowShortcuts\r | |
687 | )\r | |
688 | {\r | |
689 | SASEX_DEVICE_PATH *SasEx;\r | |
690 | UINTN Index;\r | |
691 | \r | |
692 | SasEx = DevPath;\r | |
4d0a30a4 | 693 | UefiDevicePathLibCatPrint (Str, L"SasEx(0x");\r |
501793fa RN |
694 | \r |
695 | for (Index = 0; Index < sizeof (SasEx->SasAddress) / sizeof (SasEx->SasAddress[0]); Index++) {\r | |
4d0a30a4 | 696 | UefiDevicePathLibCatPrint (Str, L"%02x", SasEx->SasAddress[Index]);\r |
501793fa | 697 | }\r |
4d0a30a4 | 698 | UefiDevicePathLibCatPrint (Str, L",0x");\r |
501793fa | 699 | for (Index = 0; Index < sizeof (SasEx->Lun) / sizeof (SasEx->Lun[0]); Index++) {\r |
4d0a30a4 | 700 | UefiDevicePathLibCatPrint (Str, L"%02x", SasEx->Lun[Index]);\r |
501793fa | 701 | }\r |
4d0a30a4 | 702 | UefiDevicePathLibCatPrint (Str, L",0x%x,", SasEx->RelativeTargetPort);\r |
501793fa | 703 | \r |
562fce0b | 704 | if (((SasEx->DeviceTopology & 0x0f) == 0) && ((SasEx->DeviceTopology & BIT7) == 0)) {\r |
4d0a30a4 | 705 | UefiDevicePathLibCatPrint (Str, L"NoTopology,0,0,0");\r |
562fce0b | 706 | } else if (((SasEx->DeviceTopology & 0x0f) <= 2) && ((SasEx->DeviceTopology & BIT7) == 0)) {\r |
4d0a30a4 | 707 | UefiDevicePathLibCatPrint (\r |
501793fa RN |
708 | Str,\r |
709 | L"%s,%s,%s,",\r | |
562fce0b RN |
710 | ((SasEx->DeviceTopology & BIT4) != 0) ? L"SATA" : L"SAS",\r |
711 | ((SasEx->DeviceTopology & BIT5) != 0) ? L"External" : L"Internal",\r | |
712 | ((SasEx->DeviceTopology & BIT6) != 0) ? L"Expanded" : L"Direct"\r | |
501793fa RN |
713 | );\r |
714 | if ((SasEx->DeviceTopology & 0x0f) == 1) {\r | |
4d0a30a4 | 715 | UefiDevicePathLibCatPrint (Str, L"0");\r |
501793fa | 716 | } else {\r |
562fce0b RN |
717 | //\r |
718 | // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256\r | |
719 | //\r | |
4d0a30a4 | 720 | UefiDevicePathLibCatPrint (Str, L"0x%x", ((SasEx->DeviceTopology >> 8) & 0xff) + 1);\r |
501793fa RN |
721 | }\r |
722 | } else {\r | |
4d0a30a4 | 723 | UefiDevicePathLibCatPrint (Str, L"0x%x,0,0,0", SasEx->DeviceTopology);\r |
501793fa RN |
724 | }\r |
725 | \r | |
4d0a30a4 | 726 | UefiDevicePathLibCatPrint (Str, L")");\r |
501793fa RN |
727 | return ;\r |
728 | \r | |
729 | }\r | |
730 | \r | |
a06ec3e2 RN |
731 | /**\r |
732 | Converts a NVM Express Namespace device path structure to its string representative.\r | |
733 | \r | |
734 | @param Str The string representative of input device.\r | |
735 | @param DevPath The input device path structure.\r | |
736 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
737 | of the display node is used, where applicable. If DisplayOnly\r | |
738 | is FALSE, then the longer text representation of the display node\r | |
739 | is used.\r | |
740 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
741 | representation for a device node can be used, where applicable.\r | |
742 | \r | |
743 | **/\r | |
744 | VOID\r | |
745 | DevPathToTextNVMe (\r | |
746 | IN OUT POOL_PRINT *Str,\r | |
747 | IN VOID *DevPath,\r | |
748 | IN BOOLEAN DisplayOnly,\r | |
749 | IN BOOLEAN AllowShortcuts\r | |
750 | )\r | |
751 | {\r | |
752 | NVME_NAMESPACE_DEVICE_PATH *Nvme;\r | |
753 | UINT8 *Uuid;\r | |
754 | \r | |
755 | Nvme = DevPath;\r | |
756 | Uuid = (UINT8 *) &Nvme->NamespaceUuid;\r | |
757 | UefiDevicePathLibCatPrint (\r | |
758 | Str,\r | |
759 | L"NVMe(0x%x,%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)",\r | |
760 | Nvme->NamespaceId,\r | |
761 | Uuid[7], Uuid[6], Uuid[5], Uuid[4],\r | |
762 | Uuid[3], Uuid[2], Uuid[1], Uuid[0]\r | |
763 | );\r | |
764 | }\r | |
765 | \r | |
52306166 FT |
766 | /**\r |
767 | Converts a UFS device path structure to its string representative.\r | |
768 | \r | |
769 | @param Str The string representative of input device.\r | |
770 | @param DevPath The input device path structure.\r | |
771 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
772 | of the display node is used, where applicable. If DisplayOnly\r | |
773 | is FALSE, then the longer text representation of the display node\r | |
774 | is used.\r | |
775 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
776 | representation for a device node can be used, where applicable.\r | |
777 | \r | |
778 | **/\r | |
779 | VOID\r | |
780 | DevPathToTextUfs (\r | |
781 | IN OUT POOL_PRINT *Str,\r | |
782 | IN VOID *DevPath,\r | |
783 | IN BOOLEAN DisplayOnly,\r | |
784 | IN BOOLEAN AllowShortcuts\r | |
785 | )\r | |
786 | {\r | |
787 | UFS_DEVICE_PATH *Ufs;\r | |
788 | \r | |
789 | Ufs = DevPath;\r | |
790 | UefiDevicePathLibCatPrint (Str, L"UFS(0x%x,0x%x)", Ufs->Pun, Ufs->Lun);\r | |
791 | }\r | |
792 | \r | |
ab8686b8 FT |
793 | /**\r |
794 | Converts a SD (Secure Digital) device path structure to its string representative.\r | |
795 | \r | |
796 | @param Str The string representative of input device.\r | |
797 | @param DevPath The input device path structure.\r | |
798 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
799 | of the display node is used, where applicable. If DisplayOnly\r | |
800 | is FALSE, then the longer text representation of the display node\r | |
801 | is used.\r | |
802 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
803 | representation for a device node can be used, where applicable.\r | |
804 | \r | |
805 | **/\r | |
806 | VOID\r | |
807 | DevPathToTextSd (\r | |
808 | IN OUT POOL_PRINT *Str,\r | |
809 | IN VOID *DevPath,\r | |
810 | IN BOOLEAN DisplayOnly,\r | |
811 | IN BOOLEAN AllowShortcuts\r | |
812 | )\r | |
813 | {\r | |
814 | SD_DEVICE_PATH *Sd;\r | |
815 | \r | |
816 | Sd = DevPath;\r | |
817 | UefiDevicePathLibCatPrint (\r | |
818 | Str,\r | |
819 | L"SD(0x%x)",\r | |
820 | Sd->SlotNumber\r | |
821 | );\r | |
822 | }\r | |
823 | \r | |
572f5d8a | 824 | /**\r |
48557c65 | 825 | Converts a 1394 device path structure to its string representative.\r |
572f5d8a | 826 | \r |
48557c65 | 827 | @param Str The string representative of input device.\r |
572f5d8a | 828 | @param DevPath The input device path structure.\r |
829 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
830 | of the display node is used, where applicable. If DisplayOnly\r | |
831 | is FALSE, then the longer text representation of the display node\r | |
832 | is used.\r | |
833 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
834 | representation for a device node can be used, where applicable.\r | |
835 | \r | |
836 | **/\r | |
95276127 | 837 | VOID\r |
838 | DevPathToText1394 (\r | |
839 | IN OUT POOL_PRINT *Str,\r | |
840 | IN VOID *DevPath,\r | |
841 | IN BOOLEAN DisplayOnly,\r | |
842 | IN BOOLEAN AllowShortcuts\r | |
843 | )\r | |
844 | {\r | |
572f5d8a | 845 | F1394_DEVICE_PATH *F1394DevPath;\r |
95276127 | 846 | \r |
572f5d8a | 847 | F1394DevPath = DevPath;\r |
cf40f28a | 848 | //\r |
849 | // Guid has format of IEEE-EUI64\r | |
850 | //\r | |
4d0a30a4 | 851 | UefiDevicePathLibCatPrint (Str, L"I1394(%016lx)", F1394DevPath->Guid);\r |
95276127 | 852 | }\r |
853 | \r | |
572f5d8a | 854 | /**\r |
48557c65 | 855 | Converts a USB device path structure to its string representative.\r |
572f5d8a | 856 | \r |
48557c65 | 857 | @param Str The string representative of input device.\r |
572f5d8a | 858 | @param DevPath The input device path structure.\r |
859 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
860 | of the display node is used, where applicable. If DisplayOnly\r | |
861 | is FALSE, then the longer text representation of the display node\r | |
862 | is used.\r | |
863 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
864 | representation for a device node can be used, where applicable.\r | |
865 | \r | |
866 | **/\r | |
95276127 | 867 | VOID\r |
868 | DevPathToTextUsb (\r | |
869 | IN OUT POOL_PRINT *Str,\r | |
870 | IN VOID *DevPath,\r | |
871 | IN BOOLEAN DisplayOnly,\r | |
872 | IN BOOLEAN AllowShortcuts\r | |
873 | )\r | |
874 | {\r | |
875 | USB_DEVICE_PATH *Usb;\r | |
876 | \r | |
877 | Usb = DevPath;\r | |
4d0a30a4 | 878 | UefiDevicePathLibCatPrint (Str, L"USB(0x%x,0x%x)", Usb->ParentPortNumber, Usb->InterfaceNumber);\r |
95276127 | 879 | }\r |
880 | \r | |
572f5d8a | 881 | /**\r |
48557c65 | 882 | Converts a USB WWID device path structure to its string representative.\r |
572f5d8a | 883 | \r |
48557c65 | 884 | @param Str The string representative of input device.\r |
572f5d8a | 885 | @param DevPath The input device path structure.\r |
886 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
887 | of the display node is used, where applicable. If DisplayOnly\r | |
888 | is FALSE, then the longer text representation of the display node\r | |
889 | is used.\r | |
890 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
891 | representation for a device node can be used, where applicable.\r | |
892 | \r | |
893 | **/\r | |
95276127 | 894 | VOID\r |
895 | DevPathToTextUsbWWID (\r | |
896 | IN OUT POOL_PRINT *Str,\r | |
897 | IN VOID *DevPath,\r | |
898 | IN BOOLEAN DisplayOnly,\r | |
899 | IN BOOLEAN AllowShortcuts\r | |
900 | )\r | |
901 | {\r | |
902 | USB_WWID_DEVICE_PATH *UsbWWId;\r | |
cf40f28a | 903 | CHAR16 *SerialNumberStr;\r |
904 | CHAR16 *NewStr;\r | |
905 | UINT16 Length;\r | |
95276127 | 906 | \r |
907 | UsbWWId = DevPath;\r | |
cf40f28a | 908 | \r |
909 | SerialNumberStr = (CHAR16 *) ((UINT8 *) UsbWWId + sizeof (USB_WWID_DEVICE_PATH));\r | |
910 | Length = (UINT16) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) UsbWWId) - sizeof (USB_WWID_DEVICE_PATH)) / sizeof (CHAR16));\r | |
911 | if (SerialNumberStr [Length - 1] != 0) {\r | |
912 | //\r | |
913 | // In case no NULL terminator in SerialNumber, create a new one with NULL terminator\r | |
914 | //\r | |
915 | NewStr = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), SerialNumberStr);\r | |
3069bc19 | 916 | ASSERT (NewStr != NULL);\r |
cf40f28a | 917 | NewStr [Length] = 0;\r |
918 | SerialNumberStr = NewStr;\r | |
919 | }\r | |
920 | \r | |
4d0a30a4 | 921 | UefiDevicePathLibCatPrint (\r |
95276127 | 922 | Str,\r |
cf40f28a | 923 | L"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",\r |
e9b3cd55 RN |
924 | UsbWWId->VendorId,\r |
925 | UsbWWId->ProductId,\r | |
926 | UsbWWId->InterfaceNumber,\r | |
cf40f28a | 927 | SerialNumberStr\r |
95276127 | 928 | );\r |
929 | }\r | |
930 | \r | |
572f5d8a | 931 | /**\r |
48557c65 | 932 | Converts a Logic Unit device path structure to its string representative.\r |
572f5d8a | 933 | \r |
48557c65 | 934 | @param Str The string representative of input device.\r |
572f5d8a | 935 | @param DevPath The input device path structure.\r |
936 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
937 | of the display node is used, where applicable. If DisplayOnly\r | |
938 | is FALSE, then the longer text representation of the display node\r | |
939 | is used.\r | |
940 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
941 | representation for a device node can be used, where applicable.\r | |
942 | \r | |
943 | **/\r | |
95276127 | 944 | VOID\r |
945 | DevPathToTextLogicalUnit (\r | |
946 | IN OUT POOL_PRINT *Str,\r | |
947 | IN VOID *DevPath,\r | |
948 | IN BOOLEAN DisplayOnly,\r | |
949 | IN BOOLEAN AllowShortcuts\r | |
950 | )\r | |
951 | {\r | |
952 | DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;\r | |
953 | \r | |
954 | LogicalUnit = DevPath;\r | |
4d0a30a4 | 955 | UefiDevicePathLibCatPrint (Str, L"Unit(0x%x)", LogicalUnit->Lun);\r |
95276127 | 956 | }\r |
957 | \r | |
572f5d8a | 958 | /**\r |
48557c65 | 959 | Converts a USB class device path structure to its string representative.\r |
572f5d8a | 960 | \r |
48557c65 | 961 | @param Str The string representative of input device.\r |
572f5d8a | 962 | @param DevPath The input device path structure.\r |
963 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
964 | of the display node is used, where applicable. If DisplayOnly\r | |
965 | is FALSE, then the longer text representation of the display node\r | |
966 | is used.\r | |
967 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
968 | representation for a device node can be used, where applicable.\r | |
969 | \r | |
970 | **/\r | |
95276127 | 971 | VOID\r |
972 | DevPathToTextUsbClass (\r | |
973 | IN OUT POOL_PRINT *Str,\r | |
974 | IN VOID *DevPath,\r | |
975 | IN BOOLEAN DisplayOnly,\r | |
976 | IN BOOLEAN AllowShortcuts\r | |
977 | )\r | |
978 | {\r | |
979 | USB_CLASS_DEVICE_PATH *UsbClass;\r | |
cf40f28a | 980 | BOOLEAN IsKnownSubClass;\r |
981 | \r | |
95276127 | 982 | \r |
983 | UsbClass = DevPath;\r | |
984 | \r | |
cf40f28a | 985 | IsKnownSubClass = TRUE;\r |
986 | switch (UsbClass->DeviceClass) {\r | |
987 | case USB_CLASS_AUDIO:\r | |
4d0a30a4 | 988 | UefiDevicePathLibCatPrint (Str, L"UsbAudio");\r |
cf40f28a | 989 | break;\r |
95276127 | 990 | \r |
cf40f28a | 991 | case USB_CLASS_CDCCONTROL:\r |
4d0a30a4 | 992 | UefiDevicePathLibCatPrint (Str, L"UsbCDCControl");\r |
cf40f28a | 993 | break;\r |
95276127 | 994 | \r |
cf40f28a | 995 | case USB_CLASS_HID:\r |
4d0a30a4 | 996 | UefiDevicePathLibCatPrint (Str, L"UsbHID");\r |
cf40f28a | 997 | break;\r |
95276127 | 998 | \r |
cf40f28a | 999 | case USB_CLASS_IMAGE:\r |
4d0a30a4 | 1000 | UefiDevicePathLibCatPrint (Str, L"UsbImage");\r |
cf40f28a | 1001 | break;\r |
95276127 | 1002 | \r |
cf40f28a | 1003 | case USB_CLASS_PRINTER:\r |
4d0a30a4 | 1004 | UefiDevicePathLibCatPrint (Str, L"UsbPrinter");\r |
cf40f28a | 1005 | break;\r |
95276127 | 1006 | \r |
cf40f28a | 1007 | case USB_CLASS_MASS_STORAGE:\r |
4d0a30a4 | 1008 | UefiDevicePathLibCatPrint (Str, L"UsbMassStorage");\r |
cf40f28a | 1009 | break;\r |
95276127 | 1010 | \r |
cf40f28a | 1011 | case USB_CLASS_HUB:\r |
4d0a30a4 | 1012 | UefiDevicePathLibCatPrint (Str, L"UsbHub");\r |
cf40f28a | 1013 | break;\r |
95276127 | 1014 | \r |
cf40f28a | 1015 | case USB_CLASS_CDCDATA:\r |
4d0a30a4 | 1016 | UefiDevicePathLibCatPrint (Str, L"UsbCDCData");\r |
cf40f28a | 1017 | break;\r |
95276127 | 1018 | \r |
cf40f28a | 1019 | case USB_CLASS_SMART_CARD:\r |
4d0a30a4 | 1020 | UefiDevicePathLibCatPrint (Str, L"UsbSmartCard");\r |
cf40f28a | 1021 | break;\r |
95276127 | 1022 | \r |
cf40f28a | 1023 | case USB_CLASS_VIDEO:\r |
4d0a30a4 | 1024 | UefiDevicePathLibCatPrint (Str, L"UsbVideo");\r |
cf40f28a | 1025 | break;\r |
1026 | \r | |
1027 | case USB_CLASS_DIAGNOSTIC:\r | |
4d0a30a4 | 1028 | UefiDevicePathLibCatPrint (Str, L"UsbDiagnostic");\r |
cf40f28a | 1029 | break;\r |
1030 | \r | |
1031 | case USB_CLASS_WIRELESS:\r | |
4d0a30a4 | 1032 | UefiDevicePathLibCatPrint (Str, L"UsbWireless");\r |
cf40f28a | 1033 | break;\r |
1034 | \r | |
1035 | default:\r | |
1036 | IsKnownSubClass = FALSE;\r | |
1037 | break;\r | |
1038 | }\r | |
1039 | \r | |
1040 | if (IsKnownSubClass) {\r | |
4d0a30a4 | 1041 | UefiDevicePathLibCatPrint (\r |
cf40f28a | 1042 | Str,\r |
1043 | L"(0x%x,0x%x,0x%x,0x%x)",\r | |
e9b3cd55 RN |
1044 | UsbClass->VendorId,\r |
1045 | UsbClass->ProductId,\r | |
1046 | UsbClass->DeviceSubClass,\r | |
1047 | UsbClass->DeviceProtocol\r | |
cf40f28a | 1048 | );\r |
1049 | return;\r | |
1050 | }\r | |
1051 | \r | |
1052 | if (UsbClass->DeviceClass == USB_CLASS_RESERVE) {\r | |
1053 | if (UsbClass->DeviceSubClass == USB_SUBCLASS_FW_UPDATE) {\r | |
4d0a30a4 | 1054 | UefiDevicePathLibCatPrint (\r |
95276127 | 1055 | Str,\r |
cf40f28a | 1056 | L"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",\r |
e9b3cd55 RN |
1057 | UsbClass->VendorId,\r |
1058 | UsbClass->ProductId,\r | |
1059 | UsbClass->DeviceProtocol\r | |
95276127 | 1060 | );\r |
cf40f28a | 1061 | return;\r |
1062 | } else if (UsbClass->DeviceSubClass == USB_SUBCLASS_IRDA_BRIDGE) {\r | |
4d0a30a4 | 1063 | UefiDevicePathLibCatPrint (\r |
95276127 | 1064 | Str,\r |
cf40f28a | 1065 | L"UsbIrdaBridge(0x%x,0x%x,0x%x)",\r |
e9b3cd55 RN |
1066 | UsbClass->VendorId,\r |
1067 | UsbClass->ProductId,\r | |
1068 | UsbClass->DeviceProtocol\r | |
95276127 | 1069 | );\r |
cf40f28a | 1070 | return;\r |
1071 | } else if (UsbClass->DeviceSubClass == USB_SUBCLASS_TEST) {\r | |
4d0a30a4 | 1072 | UefiDevicePathLibCatPrint (\r |
95276127 | 1073 | Str,\r |
cf40f28a | 1074 | L"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",\r |
e9b3cd55 RN |
1075 | UsbClass->VendorId,\r |
1076 | UsbClass->ProductId,\r | |
1077 | UsbClass->DeviceProtocol\r | |
95276127 | 1078 | );\r |
cf40f28a | 1079 | return;\r |
95276127 | 1080 | }\r |
95276127 | 1081 | }\r |
1082 | \r | |
4d0a30a4 | 1083 | UefiDevicePathLibCatPrint (\r |
95276127 | 1084 | Str,\r |
cf40f28a | 1085 | L"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",\r |
e9b3cd55 RN |
1086 | UsbClass->VendorId,\r |
1087 | UsbClass->ProductId,\r | |
1088 | UsbClass->DeviceClass,\r | |
1089 | UsbClass->DeviceSubClass,\r | |
1090 | UsbClass->DeviceProtocol\r | |
95276127 | 1091 | );\r |
1092 | }\r | |
1093 | \r | |
572f5d8a | 1094 | /**\r |
48557c65 | 1095 | Converts a SATA device path structure to its string representative.\r |
572f5d8a | 1096 | \r |
48557c65 | 1097 | @param Str The string representative of input device.\r |
572f5d8a | 1098 | @param DevPath The input device path structure.\r |
1099 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1100 | of the display node is used, where applicable. If DisplayOnly\r | |
1101 | is FALSE, then the longer text representation of the display node\r | |
1102 | is used.\r | |
1103 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1104 | representation for a device node can be used, where applicable.\r | |
1105 | \r | |
1106 | **/\r | |
cf40f28a | 1107 | VOID\r |
1108 | DevPathToTextSata (\r | |
1109 | IN OUT POOL_PRINT *Str,\r | |
1110 | IN VOID *DevPath,\r | |
1111 | IN BOOLEAN DisplayOnly,\r | |
1112 | IN BOOLEAN AllowShortcuts\r | |
1113 | )\r | |
1114 | {\r | |
1115 | SATA_DEVICE_PATH *Sata;\r | |
1116 | \r | |
1117 | Sata = DevPath;\r | |
9da38884 RN |
1118 | UefiDevicePathLibCatPrint (\r |
1119 | Str,\r | |
1120 | L"Sata(0x%x,0x%x,0x%x)",\r | |
1121 | Sata->HBAPortNumber,\r | |
1122 | Sata->PortMultiplierPortNumber,\r | |
1123 | Sata->Lun\r | |
1124 | );\r | |
cf40f28a | 1125 | }\r |
1126 | \r | |
572f5d8a | 1127 | /**\r |
48557c65 | 1128 | Converts a I20 device path structure to its string representative.\r |
572f5d8a | 1129 | \r |
48557c65 | 1130 | @param Str The string representative of input device.\r |
572f5d8a | 1131 | @param DevPath The input device path structure.\r |
1132 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1133 | of the display node is used, where applicable. If DisplayOnly\r | |
1134 | is FALSE, then the longer text representation of the display node\r | |
1135 | is used.\r | |
1136 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1137 | representation for a device node can be used, where applicable.\r | |
1138 | \r | |
1139 | **/\r | |
95276127 | 1140 | VOID\r |
1141 | DevPathToTextI2O (\r | |
1142 | IN OUT POOL_PRINT *Str,\r | |
1143 | IN VOID *DevPath,\r | |
1144 | IN BOOLEAN DisplayOnly,\r | |
1145 | IN BOOLEAN AllowShortcuts\r | |
1146 | )\r | |
1147 | {\r | |
572f5d8a | 1148 | I2O_DEVICE_PATH *I2ODevPath;\r |
95276127 | 1149 | \r |
572f5d8a | 1150 | I2ODevPath = DevPath;\r |
4d0a30a4 | 1151 | UefiDevicePathLibCatPrint (Str, L"I2O(0x%x)", I2ODevPath->Tid);\r |
95276127 | 1152 | }\r |
1153 | \r | |
572f5d8a | 1154 | /**\r |
48557c65 | 1155 | Converts a MAC address device path structure to its string representative.\r |
572f5d8a | 1156 | \r |
48557c65 | 1157 | @param Str The string representative of input device.\r |
572f5d8a | 1158 | @param DevPath The input device path structure.\r |
1159 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1160 | of the display node is used, where applicable. If DisplayOnly\r | |
1161 | is FALSE, then the longer text representation of the display node\r | |
1162 | is used.\r | |
1163 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1164 | representation for a device node can be used, where applicable.\r | |
1165 | \r | |
1166 | **/\r | |
95276127 | 1167 | VOID\r |
1168 | DevPathToTextMacAddr (\r | |
1169 | IN OUT POOL_PRINT *Str,\r | |
1170 | IN VOID *DevPath,\r | |
1171 | IN BOOLEAN DisplayOnly,\r | |
1172 | IN BOOLEAN AllowShortcuts\r | |
1173 | )\r | |
1174 | {\r | |
572f5d8a | 1175 | MAC_ADDR_DEVICE_PATH *MacDevPath;\r |
95276127 | 1176 | UINTN HwAddressSize;\r |
1177 | UINTN Index;\r | |
1178 | \r | |
572f5d8a | 1179 | MacDevPath = DevPath;\r |
95276127 | 1180 | \r |
1181 | HwAddressSize = sizeof (EFI_MAC_ADDRESS);\r | |
572f5d8a | 1182 | if (MacDevPath->IfType == 0x01 || MacDevPath->IfType == 0x00) {\r |
95276127 | 1183 | HwAddressSize = 6;\r |
1184 | }\r | |
1185 | \r | |
4d0a30a4 | 1186 | UefiDevicePathLibCatPrint (Str, L"MAC(");\r |
95276127 | 1187 | \r |
1188 | for (Index = 0; Index < HwAddressSize; Index++) {\r | |
4d0a30a4 | 1189 | UefiDevicePathLibCatPrint (Str, L"%02x", MacDevPath->MacAddress.Addr[Index]);\r |
95276127 | 1190 | }\r |
1191 | \r | |
4d0a30a4 | 1192 | UefiDevicePathLibCatPrint (Str, L",0x%x)", MacDevPath->IfType);\r |
95276127 | 1193 | }\r |
1194 | \r | |
052019e1 | 1195 | /**\r |
1196 | Converts network protocol string to its text representation.\r | |
1197 | \r | |
1198 | @param Str The string representative of input device.\r | |
1199 | @param Protocol The network protocol ID.\r | |
1200 | \r | |
1201 | **/\r | |
1202 | VOID\r | |
1203 | CatNetworkProtocol (\r | |
1204 | IN OUT POOL_PRINT *Str,\r | |
1205 | IN UINT16 Protocol\r | |
1206 | )\r | |
1207 | {\r | |
1208 | if (Protocol == RFC_1700_TCP_PROTOCOL) {\r | |
4d0a30a4 | 1209 | UefiDevicePathLibCatPrint (Str, L"TCP");\r |
052019e1 | 1210 | } else if (Protocol == RFC_1700_UDP_PROTOCOL) {\r |
4d0a30a4 | 1211 | UefiDevicePathLibCatPrint (Str, L"UDP");\r |
052019e1 | 1212 | } else {\r |
4d0a30a4 | 1213 | UefiDevicePathLibCatPrint (Str, L"0x%x", Protocol);\r |
052019e1 | 1214 | }\r |
1215 | }\r | |
1216 | \r | |
4d0a30a4 RN |
1217 | /**\r |
1218 | Converts IP v4 address to its text representation.\r | |
1219 | \r | |
1220 | @param Str The string representative of input device.\r | |
1221 | @param Address The IP v4 address.\r | |
1222 | **/\r | |
1223 | VOID\r | |
1224 | CatIPv4Address (\r | |
1225 | IN OUT POOL_PRINT *Str,\r | |
1226 | IN EFI_IPv4_ADDRESS *Address\r | |
1227 | )\r | |
1228 | {\r | |
1229 | UefiDevicePathLibCatPrint (Str, L"%d.%d.%d.%d", Address->Addr[0], Address->Addr[1], Address->Addr[2], Address->Addr[3]);\r | |
1230 | }\r | |
1231 | \r | |
1232 | /**\r | |
1233 | Converts IP v6 address to its text representation.\r | |
1234 | \r | |
1235 | @param Str The string representative of input device.\r | |
1236 | @param Address The IP v6 address.\r | |
1237 | **/\r | |
1238 | VOID\r | |
1239 | CatIPv6Address (\r | |
1240 | IN OUT POOL_PRINT *Str,\r | |
1241 | IN EFI_IPv6_ADDRESS *Address\r | |
1242 | )\r | |
1243 | {\r | |
1244 | UefiDevicePathLibCatPrint (\r | |
1245 | Str, L"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",\r | |
1246 | Address->Addr[0], Address->Addr[1],\r | |
1247 | Address->Addr[2], Address->Addr[3],\r | |
1248 | Address->Addr[4], Address->Addr[5],\r | |
1249 | Address->Addr[6], Address->Addr[7],\r | |
1250 | Address->Addr[8], Address->Addr[9],\r | |
1251 | Address->Addr[10], Address->Addr[11],\r | |
1252 | Address->Addr[12], Address->Addr[13],\r | |
1253 | Address->Addr[14], Address->Addr[15]\r | |
1254 | );\r | |
1255 | }\r | |
1256 | \r | |
572f5d8a | 1257 | /**\r |
48557c65 | 1258 | Converts a IPv4 device path structure to its string representative.\r |
572f5d8a | 1259 | \r |
48557c65 | 1260 | @param Str The string representative of input device.\r |
572f5d8a | 1261 | @param DevPath The input device path structure.\r |
1262 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1263 | of the display node is used, where applicable. If DisplayOnly\r | |
1264 | is FALSE, then the longer text representation of the display node\r | |
1265 | is used.\r | |
1266 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1267 | representation for a device node can be used, where applicable.\r | |
1268 | \r | |
1269 | **/\r | |
95276127 | 1270 | VOID\r |
1271 | DevPathToTextIPv4 (\r | |
1272 | IN OUT POOL_PRINT *Str,\r | |
1273 | IN VOID *DevPath,\r | |
1274 | IN BOOLEAN DisplayOnly,\r | |
1275 | IN BOOLEAN AllowShortcuts\r | |
1276 | )\r | |
1277 | {\r | |
572f5d8a | 1278 | IPv4_DEVICE_PATH *IPDevPath;\r |
95276127 | 1279 | \r |
572f5d8a | 1280 | IPDevPath = DevPath;\r |
4d0a30a4 RN |
1281 | UefiDevicePathLibCatPrint (Str, L"IPv4(");\r |
1282 | CatIPv4Address (Str, &IPDevPath->RemoteIpAddress);\r | |
1283 | \r | |
572f5d8a | 1284 | if (DisplayOnly) {\r |
4d0a30a4 | 1285 | UefiDevicePathLibCatPrint (Str, L")");\r |
95276127 | 1286 | return ;\r |
1287 | }\r | |
1288 | \r | |
4d0a30a4 RN |
1289 | UefiDevicePathLibCatPrint (Str, L",");\r |
1290 | CatNetworkProtocol (Str, IPDevPath->Protocol);\r | |
052019e1 | 1291 | \r |
4d0a30a4 RN |
1292 | UefiDevicePathLibCatPrint (Str, L",%s,", IPDevPath->StaticIpAddress ? L"Static" : L"DHCP");\r |
1293 | CatIPv4Address (Str, &IPDevPath->LocalIpAddress);\r | |
e9b3cd55 | 1294 | if (DevicePathNodeLength (IPDevPath) == sizeof (IPv4_DEVICE_PATH)) {\r |
4d0a30a4 RN |
1295 | UefiDevicePathLibCatPrint (Str, L",");\r |
1296 | CatIPv4Address (Str, &IPDevPath->GatewayIpAddress);\r | |
1297 | UefiDevicePathLibCatPrint (Str, L",");\r | |
1298 | CatIPv4Address (Str, &IPDevPath->SubnetMask);\r | |
e9b3cd55 | 1299 | }\r |
4d0a30a4 | 1300 | UefiDevicePathLibCatPrint (Str, L")");\r |
95276127 | 1301 | }\r |
1302 | \r | |
572f5d8a | 1303 | /**\r |
48557c65 | 1304 | Converts a IPv6 device path structure to its string representative.\r |
572f5d8a | 1305 | \r |
48557c65 | 1306 | @param Str The string representative of input device.\r |
572f5d8a | 1307 | @param DevPath The input device path structure.\r |
1308 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1309 | of the display node is used, where applicable. If DisplayOnly\r | |
1310 | is FALSE, then the longer text representation of the display node\r | |
1311 | is used.\r | |
1312 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1313 | representation for a device node can be used, where applicable.\r | |
1314 | \r | |
1315 | **/\r | |
95276127 | 1316 | VOID\r |
1317 | DevPathToTextIPv6 (\r | |
1318 | IN OUT POOL_PRINT *Str,\r | |
1319 | IN VOID *DevPath,\r | |
1320 | IN BOOLEAN DisplayOnly,\r | |
1321 | IN BOOLEAN AllowShortcuts\r | |
1322 | )\r | |
1323 | {\r | |
572f5d8a | 1324 | IPv6_DEVICE_PATH *IPDevPath;\r |
95276127 | 1325 | \r |
572f5d8a | 1326 | IPDevPath = DevPath;\r |
4d0a30a4 RN |
1327 | UefiDevicePathLibCatPrint (Str, L"IPv6(");\r |
1328 | CatIPv6Address (Str, &IPDevPath->RemoteIpAddress);\r | |
572f5d8a | 1329 | if (DisplayOnly) {\r |
4d0a30a4 | 1330 | UefiDevicePathLibCatPrint (Str, L")");\r |
95276127 | 1331 | return ;\r |
1332 | }\r | |
4d0a30a4 RN |
1333 | \r |
1334 | UefiDevicePathLibCatPrint (Str, L",");\r | |
1335 | CatNetworkProtocol (Str, IPDevPath->Protocol);\r | |
052019e1 | 1336 | \r |
501793fa RN |
1337 | switch (IPDevPath->IpAddressOrigin) {\r |
1338 | case 0:\r | |
4d0a30a4 | 1339 | UefiDevicePathLibCatPrint (Str, L",Static,");\r |
501793fa RN |
1340 | break;\r |
1341 | case 1:\r | |
4d0a30a4 | 1342 | UefiDevicePathLibCatPrint (Str, L",StatelessAutoConfigure,");\r |
501793fa RN |
1343 | break;\r |
1344 | default:\r | |
4d0a30a4 | 1345 | UefiDevicePathLibCatPrint (Str, L",StatefulAutoConfigure,");\r |
501793fa RN |
1346 | break;\r |
1347 | }\r | |
1348 | \r | |
4d0a30a4 | 1349 | CatIPv6Address (Str, &IPDevPath->LocalIpAddress);\r |
501793fa RN |
1350 | \r |
1351 | if (DevicePathNodeLength (IPDevPath) == sizeof (IPv6_DEVICE_PATH)) {\r | |
4d0a30a4 RN |
1352 | UefiDevicePathLibCatPrint (Str, L",0x%x,", IPDevPath->PrefixLength);\r |
1353 | CatIPv6Address (Str, &IPDevPath->GatewayIpAddress);\r | |
501793fa | 1354 | }\r |
4d0a30a4 | 1355 | UefiDevicePathLibCatPrint (Str, L")");\r |
95276127 | 1356 | }\r |
1357 | \r | |
572f5d8a | 1358 | /**\r |
48557c65 | 1359 | Converts an Infini Band device path structure to its string representative.\r |
572f5d8a | 1360 | \r |
48557c65 | 1361 | @param Str The string representative of input device.\r |
572f5d8a | 1362 | @param DevPath The input device path structure.\r |
1363 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1364 | of the display node is used, where applicable. If DisplayOnly\r | |
1365 | is FALSE, then the longer text representation of the display node\r | |
1366 | is used.\r | |
1367 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1368 | representation for a device node can be used, where applicable.\r | |
1369 | \r | |
1370 | **/\r | |
95276127 | 1371 | VOID\r |
1372 | DevPathToTextInfiniBand (\r | |
1373 | IN OUT POOL_PRINT *Str,\r | |
1374 | IN VOID *DevPath,\r | |
1375 | IN BOOLEAN DisplayOnly,\r | |
1376 | IN BOOLEAN AllowShortcuts\r | |
1377 | )\r | |
1378 | {\r | |
1379 | INFINIBAND_DEVICE_PATH *InfiniBand;\r | |
1380 | \r | |
1381 | InfiniBand = DevPath;\r | |
4d0a30a4 | 1382 | UefiDevicePathLibCatPrint (\r |
95276127 | 1383 | Str,\r |
cf40f28a | 1384 | L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",\r |
e9b3cd55 | 1385 | InfiniBand->ResourceFlags,\r |
95276127 | 1386 | InfiniBand->PortGid,\r |
1387 | InfiniBand->ServiceId,\r | |
1388 | InfiniBand->TargetPortId,\r | |
1389 | InfiniBand->DeviceId\r | |
1390 | );\r | |
1391 | }\r | |
1392 | \r | |
572f5d8a | 1393 | /**\r |
48557c65 | 1394 | Converts a UART device path structure to its string representative.\r |
572f5d8a | 1395 | \r |
48557c65 | 1396 | @param Str The string representative of input device.\r |
572f5d8a | 1397 | @param DevPath The input device path structure.\r |
1398 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1399 | of the display node is used, where applicable. If DisplayOnly\r | |
1400 | is FALSE, then the longer text representation of the display node\r | |
1401 | is used.\r | |
1402 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1403 | representation for a device node can be used, where applicable.\r | |
1404 | \r | |
1405 | **/\r | |
95276127 | 1406 | VOID\r |
1407 | DevPathToTextUart (\r | |
1408 | IN OUT POOL_PRINT *Str,\r | |
1409 | IN VOID *DevPath,\r | |
1410 | IN BOOLEAN DisplayOnly,\r | |
1411 | IN BOOLEAN AllowShortcuts\r | |
1412 | )\r | |
1413 | {\r | |
1414 | UART_DEVICE_PATH *Uart;\r | |
1415 | CHAR8 Parity;\r | |
1416 | \r | |
1417 | Uart = DevPath;\r | |
1418 | switch (Uart->Parity) {\r | |
1419 | case 0:\r | |
1420 | Parity = 'D';\r | |
1421 | break;\r | |
1422 | \r | |
1423 | case 1:\r | |
1424 | Parity = 'N';\r | |
1425 | break;\r | |
1426 | \r | |
1427 | case 2:\r | |
1428 | Parity = 'E';\r | |
1429 | break;\r | |
1430 | \r | |
1431 | case 3:\r | |
1432 | Parity = 'O';\r | |
1433 | break;\r | |
1434 | \r | |
1435 | case 4:\r | |
1436 | Parity = 'M';\r | |
1437 | break;\r | |
1438 | \r | |
1439 | case 5:\r | |
1440 | Parity = 'S';\r | |
1441 | break;\r | |
1442 | \r | |
1443 | default:\r | |
1444 | Parity = 'x';\r | |
1445 | break;\r | |
1446 | }\r | |
1447 | \r | |
1448 | if (Uart->BaudRate == 0) {\r | |
4d0a30a4 | 1449 | UefiDevicePathLibCatPrint (Str, L"Uart(DEFAULT,");\r |
95276127 | 1450 | } else {\r |
4d0a30a4 | 1451 | UefiDevicePathLibCatPrint (Str, L"Uart(%ld,", Uart->BaudRate);\r |
95276127 | 1452 | }\r |
1453 | \r | |
1454 | if (Uart->DataBits == 0) {\r | |
4d0a30a4 | 1455 | UefiDevicePathLibCatPrint (Str, L"DEFAULT,");\r |
95276127 | 1456 | } else {\r |
4d0a30a4 | 1457 | UefiDevicePathLibCatPrint (Str, L"%d,", Uart->DataBits);\r |
95276127 | 1458 | }\r |
1459 | \r | |
4d0a30a4 | 1460 | UefiDevicePathLibCatPrint (Str, L"%c,", Parity);\r |
95276127 | 1461 | \r |
1462 | switch (Uart->StopBits) {\r | |
1463 | case 0:\r | |
4d0a30a4 | 1464 | UefiDevicePathLibCatPrint (Str, L"D)");\r |
95276127 | 1465 | break;\r |
1466 | \r | |
1467 | case 1:\r | |
4d0a30a4 | 1468 | UefiDevicePathLibCatPrint (Str, L"1)");\r |
95276127 | 1469 | break;\r |
1470 | \r | |
1471 | case 2:\r | |
4d0a30a4 | 1472 | UefiDevicePathLibCatPrint (Str, L"1.5)");\r |
95276127 | 1473 | break;\r |
1474 | \r | |
1475 | case 3:\r | |
4d0a30a4 | 1476 | UefiDevicePathLibCatPrint (Str, L"2)");\r |
95276127 | 1477 | break;\r |
1478 | \r | |
1479 | default:\r | |
4d0a30a4 | 1480 | UefiDevicePathLibCatPrint (Str, L"x)");\r |
95276127 | 1481 | break;\r |
1482 | }\r | |
1483 | }\r | |
1484 | \r | |
572f5d8a | 1485 | /**\r |
48557c65 | 1486 | Converts an iSCSI device path structure to its string representative.\r |
572f5d8a | 1487 | \r |
48557c65 | 1488 | @param Str The string representative of input device.\r |
572f5d8a | 1489 | @param DevPath The input device path structure.\r |
1490 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1491 | of the display node is used, where applicable. If DisplayOnly\r | |
1492 | is FALSE, then the longer text representation of the display node\r | |
1493 | is used.\r | |
1494 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1495 | representation for a device node can be used, where applicable.\r | |
1496 | \r | |
1497 | **/\r | |
95276127 | 1498 | VOID\r |
1499 | DevPathToTextiSCSI (\r | |
1500 | IN OUT POOL_PRINT *Str,\r | |
1501 | IN VOID *DevPath,\r | |
1502 | IN BOOLEAN DisplayOnly,\r | |
1503 | IN BOOLEAN AllowShortcuts\r | |
1504 | )\r | |
1505 | {\r | |
572f5d8a | 1506 | ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;\r |
95276127 | 1507 | UINT16 Options;\r |
1508 | \r | |
572f5d8a | 1509 | ISCSIDevPath = DevPath;\r |
4d0a30a4 | 1510 | UefiDevicePathLibCatPrint (\r |
95276127 | 1511 | Str,\r |
cf40f28a | 1512 | L"iSCSI(%a,0x%x,0x%lx,",\r |
184f7d83 | 1513 | ISCSIDevPath->TargetName,\r |
e9b3cd55 | 1514 | ISCSIDevPath->TargetPortalGroupTag,\r |
572f5d8a | 1515 | ISCSIDevPath->Lun\r |
95276127 | 1516 | );\r |
1517 | \r | |
572f5d8a | 1518 | Options = ISCSIDevPath->LoginOption;\r |
4d0a30a4 RN |
1519 | UefiDevicePathLibCatPrint (Str, L"%s,", (((Options >> 1) & 0x0001) != 0) ? L"CRC32C" : L"None");\r |
1520 | UefiDevicePathLibCatPrint (Str, L"%s,", (((Options >> 3) & 0x0001) != 0) ? L"CRC32C" : L"None");\r | |
572f5d8a | 1521 | if (((Options >> 11) & 0x0001) != 0) {\r |
4d0a30a4 | 1522 | UefiDevicePathLibCatPrint (Str, L"%s,", L"None");\r |
572f5d8a | 1523 | } else if (((Options >> 12) & 0x0001) != 0) {\r |
4d0a30a4 | 1524 | UefiDevicePathLibCatPrint (Str, L"%s,", L"CHAP_UNI");\r |
95276127 | 1525 | } else {\r |
4d0a30a4 | 1526 | UefiDevicePathLibCatPrint (Str, L"%s,", L"CHAP_BI");\r |
95276127 | 1527 | \r |
1528 | }\r | |
1529 | \r | |
4d0a30a4 | 1530 | UefiDevicePathLibCatPrint (Str, L"%s)", (ISCSIDevPath->NetworkProtocol == 0) ? L"TCP" : L"reserved");\r |
95276127 | 1531 | }\r |
1532 | \r | |
8f97f911 | 1533 | /**\r |
1534 | Converts a VLAN device path structure to its string representative.\r | |
1535 | \r | |
1536 | @param Str The string representative of input device.\r | |
1537 | @param DevPath The input device path structure.\r | |
1538 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1539 | of the display node is used, where applicable. If DisplayOnly\r | |
1540 | is FALSE, then the longer text representation of the display node\r | |
1541 | is used.\r | |
1542 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1543 | representation for a device node can be used, where applicable.\r | |
1544 | \r | |
1545 | **/\r | |
1546 | VOID\r | |
1547 | DevPathToTextVlan (\r | |
1548 | IN OUT POOL_PRINT *Str,\r | |
1549 | IN VOID *DevPath,\r | |
1550 | IN BOOLEAN DisplayOnly,\r | |
1551 | IN BOOLEAN AllowShortcuts\r | |
1552 | )\r | |
1553 | {\r | |
1554 | VLAN_DEVICE_PATH *Vlan;\r | |
1555 | \r | |
1556 | Vlan = DevPath;\r | |
4d0a30a4 | 1557 | UefiDevicePathLibCatPrint (Str, L"Vlan(%d)", Vlan->VlanId);\r |
8f97f911 | 1558 | }\r |
1559 | \r | |
7795c8f9 QS |
1560 | /**\r |
1561 | Converts a Bluetooth device path structure to its string representative.\r | |
1562 | \r | |
1563 | @param Str The string representative of input device.\r | |
1564 | @param DevPath The input device path structure.\r | |
1565 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1566 | of the display node is used, where applicable. If DisplayOnly\r | |
1567 | is FALSE, then the longer text representation of the display node\r | |
1568 | is used.\r | |
1569 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1570 | representation for a device node can be used, where applicable.\r | |
1571 | \r | |
1572 | **/\r | |
1573 | VOID\r | |
1574 | DevPathToTextBluetooth (\r | |
1575 | IN OUT POOL_PRINT *Str,\r | |
1576 | IN VOID *DevPath,\r | |
1577 | IN BOOLEAN DisplayOnly,\r | |
1578 | IN BOOLEAN AllowShortcuts\r | |
1579 | )\r | |
1580 | {\r | |
1581 | BLUETOOTH_DEVICE_PATH *Bluetooth;\r | |
1582 | \r | |
1583 | Bluetooth = DevPath;\r | |
1584 | UefiDevicePathLibCatPrint (\r | |
1585 | Str,\r | |
1586 | L"Bluetooth(%02x:%02x:%02x:%02x:%02x:%02x)",\r | |
1587 | Bluetooth->BD_ADDR.Address[5],\r | |
1588 | Bluetooth->BD_ADDR.Address[4],\r | |
1589 | Bluetooth->BD_ADDR.Address[3],\r | |
1590 | Bluetooth->BD_ADDR.Address[2],\r | |
1591 | Bluetooth->BD_ADDR.Address[1],\r | |
1592 | Bluetooth->BD_ADDR.Address[0]\r | |
1593 | );\r | |
1594 | }\r | |
1595 | \r | |
3bafd562 HW |
1596 | /**\r |
1597 | Converts a Wi-Fi device path structure to its string representative.\r | |
1598 | \r | |
1599 | @param Str The string representative of input device.\r | |
1600 | @param DevPath The input device path structure.\r | |
1601 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1602 | of the display node is used, where applicable. If DisplayOnly\r | |
1603 | is FALSE, then the longer text representation of the display node\r | |
1604 | is used.\r | |
1605 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1606 | representation for a device node can be used, where applicable.\r | |
1607 | \r | |
1608 | **/\r | |
1609 | VOID\r | |
1610 | DevPathToTextWiFi (\r | |
1611 | IN OUT POOL_PRINT *Str,\r | |
1612 | IN VOID *DevPath,\r | |
1613 | IN BOOLEAN DisplayOnly,\r | |
1614 | IN BOOLEAN AllowShortcuts\r | |
1615 | )\r | |
1616 | {\r | |
1617 | WIFI_DEVICE_PATH *WiFi;\r | |
1618 | \r | |
1619 | WiFi = DevPath;\r | |
1620 | UefiDevicePathLibCatPrint (Str, L"WiFi(%a)", WiFi->SSId);\r | |
1621 | }\r | |
1622 | \r | |
c808ac7b RN |
1623 | /**\r |
1624 | Converts a URI device path structure to its string representative.\r | |
1625 | \r | |
1626 | @param Str The string representative of input device.\r | |
1627 | @param DevPath The input device path structure.\r | |
1628 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1629 | of the display node is used, where applicable. If DisplayOnly\r | |
1630 | is FALSE, then the longer text representation of the display node\r | |
1631 | is used.\r | |
1632 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1633 | representation for a device node can be used, where applicable.\r | |
1634 | \r | |
1635 | **/\r | |
1636 | VOID\r | |
1637 | DevPathToTextUri (\r | |
1638 | IN OUT POOL_PRINT *Str,\r | |
1639 | IN VOID *DevPath,\r | |
1640 | IN BOOLEAN DisplayOnly,\r | |
1641 | IN BOOLEAN AllowShortcuts\r | |
1642 | )\r | |
1643 | {\r | |
1644 | URI_DEVICE_PATH *Uri;\r | |
1645 | UINTN UriLength;\r | |
1646 | CHAR8 *UriStr;\r | |
1647 | \r | |
1648 | //\r | |
1649 | // Uri in the device path may not be null terminated.\r | |
1650 | //\r | |
1651 | Uri = DevPath;\r | |
1652 | UriLength = DevicePathNodeLength (Uri) - sizeof (URI_DEVICE_PATH);\r | |
1653 | UriStr = AllocatePool (UriLength + 1);\r | |
1654 | ASSERT (UriStr != NULL);\r | |
1655 | \r | |
1656 | CopyMem (UriStr, Uri->Uri, UriLength);\r | |
1657 | UriStr[UriLength] = '\0';\r | |
1658 | UefiDevicePathLibCatPrint (Str, L"Uri(%a)", UriStr);\r | |
1659 | FreePool (UriStr);\r | |
1660 | }\r | |
1661 | \r | |
572f5d8a | 1662 | /**\r |
48557c65 | 1663 | Converts a Hard drive device path structure to its string representative.\r |
572f5d8a | 1664 | \r |
48557c65 | 1665 | @param Str The string representative of input device.\r |
572f5d8a | 1666 | @param DevPath The input device path structure.\r |
1667 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1668 | of the display node is used, where applicable. If DisplayOnly\r | |
1669 | is FALSE, then the longer text representation of the display node\r | |
1670 | is used.\r | |
1671 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1672 | representation for a device node can be used, where applicable.\r | |
1673 | \r | |
1674 | **/\r | |
95276127 | 1675 | VOID\r |
1676 | DevPathToTextHardDrive (\r | |
1677 | IN OUT POOL_PRINT *Str,\r | |
1678 | IN VOID *DevPath,\r | |
1679 | IN BOOLEAN DisplayOnly,\r | |
1680 | IN BOOLEAN AllowShortcuts\r | |
1681 | )\r | |
1682 | {\r | |
1683 | HARDDRIVE_DEVICE_PATH *Hd;\r | |
1684 | \r | |
1685 | Hd = DevPath;\r | |
1686 | switch (Hd->SignatureType) {\r | |
95276127 | 1687 | case SIGNATURE_TYPE_MBR:\r |
4d0a30a4 | 1688 | UefiDevicePathLibCatPrint (\r |
95276127 | 1689 | Str,\r |
cf40f28a | 1690 | L"HD(%d,%s,0x%08x,",\r |
e9b3cd55 | 1691 | Hd->PartitionNumber,\r |
95276127 | 1692 | L"MBR",\r |
e9b3cd55 | 1693 | *((UINT32 *) (&(Hd->Signature[0])))\r |
95276127 | 1694 | );\r |
1695 | break;\r | |
1696 | \r | |
1697 | case SIGNATURE_TYPE_GUID:\r | |
4d0a30a4 | 1698 | UefiDevicePathLibCatPrint (\r |
95276127 | 1699 | Str,\r |
1700 | L"HD(%d,%s,%g,",\r | |
e9b3cd55 | 1701 | Hd->PartitionNumber,\r |
cf40f28a | 1702 | L"GPT",\r |
95276127 | 1703 | (EFI_GUID *) &(Hd->Signature[0])\r |
1704 | );\r | |
1705 | break;\r | |
1706 | \r | |
1707 | default:\r | |
4d0a30a4 | 1708 | UefiDevicePathLibCatPrint (\r |
cf40f28a | 1709 | Str,\r |
1710 | L"HD(%d,%d,0,",\r | |
e9b3cd55 RN |
1711 | Hd->PartitionNumber,\r |
1712 | Hd->SignatureType\r | |
cf40f28a | 1713 | );\r |
95276127 | 1714 | break;\r |
1715 | }\r | |
1716 | \r | |
4d0a30a4 | 1717 | UefiDevicePathLibCatPrint (Str, L"0x%lx,0x%lx)", Hd->PartitionStart, Hd->PartitionSize);\r |
95276127 | 1718 | }\r |
1719 | \r | |
572f5d8a | 1720 | /**\r |
48557c65 | 1721 | Converts a CDROM device path structure to its string representative.\r |
572f5d8a | 1722 | \r |
48557c65 | 1723 | @param Str The string representative of input device.\r |
572f5d8a | 1724 | @param DevPath The input device path structure.\r |
1725 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1726 | of the display node is used, where applicable. If DisplayOnly\r | |
1727 | is FALSE, then the longer text representation of the display node\r | |
1728 | is used.\r | |
1729 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1730 | representation for a device node can be used, where applicable.\r | |
1731 | \r | |
1732 | **/\r | |
95276127 | 1733 | VOID\r |
1734 | DevPathToTextCDROM (\r | |
1735 | IN OUT POOL_PRINT *Str,\r | |
1736 | IN VOID *DevPath,\r | |
1737 | IN BOOLEAN DisplayOnly,\r | |
1738 | IN BOOLEAN AllowShortcuts\r | |
1739 | )\r | |
1740 | {\r | |
1741 | CDROM_DEVICE_PATH *Cd;\r | |
1742 | \r | |
1743 | Cd = DevPath;\r | |
572f5d8a | 1744 | if (DisplayOnly) {\r |
4d0a30a4 | 1745 | UefiDevicePathLibCatPrint (Str, L"CDROM(0x%x)", Cd->BootEntry);\r |
95276127 | 1746 | return ;\r |
1747 | }\r | |
1748 | \r | |
4d0a30a4 | 1749 | UefiDevicePathLibCatPrint (Str, L"CDROM(0x%x,0x%lx,0x%lx)", Cd->BootEntry, Cd->PartitionStart, Cd->PartitionSize);\r |
95276127 | 1750 | }\r |
1751 | \r | |
572f5d8a | 1752 | /**\r |
48557c65 | 1753 | Converts a File device path structure to its string representative.\r |
572f5d8a | 1754 | \r |
48557c65 | 1755 | @param Str The string representative of input device.\r |
572f5d8a | 1756 | @param DevPath The input device path structure.\r |
1757 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1758 | of the display node is used, where applicable. If DisplayOnly\r | |
1759 | is FALSE, then the longer text representation of the display node\r | |
1760 | is used.\r | |
1761 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1762 | representation for a device node can be used, where applicable.\r | |
1763 | \r | |
1764 | **/\r | |
95276127 | 1765 | VOID\r |
1766 | DevPathToTextFilePath (\r | |
1767 | IN OUT POOL_PRINT *Str,\r | |
1768 | IN VOID *DevPath,\r | |
1769 | IN BOOLEAN DisplayOnly,\r | |
1770 | IN BOOLEAN AllowShortcuts\r | |
1771 | )\r | |
1772 | {\r | |
1773 | FILEPATH_DEVICE_PATH *Fp;\r | |
1774 | \r | |
1775 | Fp = DevPath;\r | |
4d0a30a4 | 1776 | UefiDevicePathLibCatPrint (Str, L"%s", Fp->PathName);\r |
95276127 | 1777 | }\r |
1778 | \r | |
572f5d8a | 1779 | /**\r |
48557c65 | 1780 | Converts a Media protocol device path structure to its string representative.\r |
572f5d8a | 1781 | \r |
48557c65 | 1782 | @param Str The string representative of input device.\r |
572f5d8a | 1783 | @param DevPath The input device path structure.\r |
1784 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1785 | of the display node is used, where applicable. If DisplayOnly\r | |
1786 | is FALSE, then the longer text representation of the display node\r | |
1787 | is used.\r | |
1788 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1789 | representation for a device node can be used, where applicable.\r | |
1790 | \r | |
1791 | **/\r | |
95276127 | 1792 | VOID\r |
1793 | DevPathToTextMediaProtocol (\r | |
1794 | IN OUT POOL_PRINT *Str,\r | |
1795 | IN VOID *DevPath,\r | |
1796 | IN BOOLEAN DisplayOnly,\r | |
1797 | IN BOOLEAN AllowShortcuts\r | |
1798 | )\r | |
1799 | {\r | |
1800 | MEDIA_PROTOCOL_DEVICE_PATH *MediaProt;\r | |
1801 | \r | |
1802 | MediaProt = DevPath;\r | |
4d0a30a4 | 1803 | UefiDevicePathLibCatPrint (Str, L"Media(%g)", &MediaProt->Protocol);\r |
95276127 | 1804 | }\r |
1805 | \r | |
572f5d8a | 1806 | /**\r |
48557c65 | 1807 | Converts a Firmware Volume device path structure to its string representative.\r |
572f5d8a | 1808 | \r |
48557c65 | 1809 | @param Str The string representative of input device.\r |
572f5d8a | 1810 | @param DevPath The input device path structure.\r |
1811 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1812 | of the display node is used, where applicable. If DisplayOnly\r | |
1813 | is FALSE, then the longer text representation of the display node\r | |
1814 | is used.\r | |
1815 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1816 | representation for a device node can be used, where applicable.\r | |
1817 | \r | |
1818 | **/\r | |
cf40f28a | 1819 | VOID\r |
1820 | DevPathToTextFv (\r | |
1821 | IN OUT POOL_PRINT *Str,\r | |
1822 | IN VOID *DevPath,\r | |
1823 | IN BOOLEAN DisplayOnly,\r | |
1824 | IN BOOLEAN AllowShortcuts\r | |
1825 | )\r | |
1826 | {\r | |
1827 | MEDIA_FW_VOL_DEVICE_PATH *Fv;\r | |
1828 | \r | |
1829 | Fv = DevPath;\r | |
4d0a30a4 | 1830 | UefiDevicePathLibCatPrint (Str, L"Fv(%g)", &Fv->FvName);\r |
cf40f28a | 1831 | }\r |
1832 | \r | |
572f5d8a | 1833 | /**\r |
48557c65 | 1834 | Converts a Firmware Volume File device path structure to its string representative.\r |
572f5d8a | 1835 | \r |
48557c65 | 1836 | @param Str The string representative of input device.\r |
572f5d8a | 1837 | @param DevPath The input device path structure.\r |
1838 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1839 | of the display node is used, where applicable. If DisplayOnly\r | |
1840 | is FALSE, then the longer text representation of the display node\r | |
1841 | is used.\r | |
1842 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1843 | representation for a device node can be used, where applicable.\r | |
1844 | \r | |
1845 | **/\r | |
cf40f28a | 1846 | VOID\r |
1847 | DevPathToTextFvFile (\r | |
1848 | IN OUT POOL_PRINT *Str,\r | |
1849 | IN VOID *DevPath,\r | |
1850 | IN BOOLEAN DisplayOnly,\r | |
1851 | IN BOOLEAN AllowShortcuts\r | |
1852 | )\r | |
1853 | {\r | |
1854 | MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFile;\r | |
1855 | \r | |
1856 | FvFile = DevPath;\r | |
4d0a30a4 | 1857 | UefiDevicePathLibCatPrint (Str, L"FvFile(%g)", &FvFile->FvFileName);\r |
cf40f28a | 1858 | }\r |
1859 | \r | |
09e15613 | 1860 | /**\r |
1861 | Converts a Relative Offset device path structure to its string representative.\r | |
1862 | \r | |
1863 | @param Str The string representative of input device.\r | |
1864 | @param DevPath The input device path structure.\r | |
1865 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1866 | of the display node is used, where applicable. If DisplayOnly\r | |
1867 | is FALSE, then the longer text representation of the display node\r | |
1868 | is used.\r | |
1869 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1870 | representation for a device node can be used, where applicable.\r | |
1871 | \r | |
1872 | **/\r | |
1873 | VOID\r | |
1874 | DevPathRelativeOffsetRange (\r | |
1875 | IN OUT POOL_PRINT *Str,\r | |
1876 | IN VOID *DevPath,\r | |
1877 | IN BOOLEAN DisplayOnly,\r | |
1878 | IN BOOLEAN AllowShortcuts\r | |
1879 | )\r | |
1880 | {\r | |
1881 | MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;\r | |
1882 | \r | |
1883 | Offset = DevPath;\r | |
4d0a30a4 | 1884 | UefiDevicePathLibCatPrint (\r |
09e15613 | 1885 | Str,\r |
7748eb28 | 1886 | L"Offset(0x%lx,0x%lx)",\r |
09e15613 | 1887 | Offset->StartingOffset,\r |
1888 | Offset->EndingOffset\r | |
1889 | );\r | |
1890 | }\r | |
1891 | \r | |
6a46c1a2 FT |
1892 | /**\r |
1893 | Converts a Ram Disk device path structure to its string representative.\r | |
1894 | \r | |
1895 | @param Str The string representative of input device.\r | |
1896 | @param DevPath The input device path structure.\r | |
1897 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1898 | of the display node is used, where applicable. If DisplayOnly\r | |
1899 | is FALSE, then the longer text representation of the display node\r | |
1900 | is used.\r | |
1901 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1902 | representation for a device node can be used, where applicable.\r | |
1903 | \r | |
1904 | **/\r | |
1905 | VOID\r | |
1906 | DevPathToTextRamDisk (\r | |
1907 | IN OUT POOL_PRINT *Str,\r | |
1908 | IN VOID *DevPath,\r | |
1909 | IN BOOLEAN DisplayOnly,\r | |
1910 | IN BOOLEAN AllowShortcuts\r | |
1911 | )\r | |
1912 | {\r | |
1913 | MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;\r | |
1914 | \r | |
1915 | RamDisk = DevPath;\r | |
1916 | \r | |
1917 | if (CompareGuid (&RamDisk->TypeGuid, &gEfiVirtualDiskGuid)) {\r | |
1918 | UefiDevicePathLibCatPrint (\r | |
1919 | Str,\r | |
1920 | L"VirtualDisk(0x%lx,0x%lx,%d)",\r | |
1921 | RShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],\r | |
1922 | RShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],\r | |
1923 | RamDisk->Instance\r | |
1924 | );\r | |
1925 | } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiVirtualCdGuid)) {\r | |
1926 | UefiDevicePathLibCatPrint (\r | |
1927 | Str,\r | |
1928 | L"VirtualCD(0x%lx,0x%lx,%d)",\r | |
1929 | RShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],\r | |
1930 | RShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],\r | |
1931 | RamDisk->Instance\r | |
1932 | );\r | |
1933 | } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualDiskGuid)) {\r | |
1934 | UefiDevicePathLibCatPrint (\r | |
1935 | Str,\r | |
1936 | L"PersistentVirtualDisk(0x%lx,0x%lx,%d)",\r | |
1937 | RShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],\r | |
1938 | RShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],\r | |
1939 | RamDisk->Instance\r | |
1940 | );\r | |
1941 | } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualCdGuid)) {\r | |
1942 | UefiDevicePathLibCatPrint (\r | |
1943 | Str,\r | |
1944 | L"PersistentVirtualCD(0x%lx,0x%lx,%d)",\r | |
1945 | RShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],\r | |
1946 | RShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],\r | |
1947 | RamDisk->Instance\r | |
1948 | );\r | |
1949 | } else {\r | |
1950 | UefiDevicePathLibCatPrint (\r | |
1951 | Str,\r | |
1952 | L"RamDisk(0x%lx,0x%lx,%d,%g)",\r | |
1953 | RShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],\r | |
1954 | RShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],\r | |
1955 | RamDisk->Instance,\r | |
1956 | &RamDisk->TypeGuid\r | |
1957 | );\r | |
1958 | }\r | |
1959 | }\r | |
1960 | \r | |
572f5d8a | 1961 | /**\r |
48557c65 | 1962 | Converts a BIOS Boot Specification device path structure to its string representative.\r |
572f5d8a | 1963 | \r |
48557c65 | 1964 | @param Str The string representative of input device.\r |
572f5d8a | 1965 | @param DevPath The input device path structure.\r |
1966 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
1967 | of the display node is used, where applicable. If DisplayOnly\r | |
1968 | is FALSE, then the longer text representation of the display node\r | |
1969 | is used.\r | |
1970 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
1971 | representation for a device node can be used, where applicable.\r | |
1972 | \r | |
1973 | **/\r | |
95276127 | 1974 | VOID\r |
1975 | DevPathToTextBBS (\r | |
1976 | IN OUT POOL_PRINT *Str,\r | |
1977 | IN VOID *DevPath,\r | |
1978 | IN BOOLEAN DisplayOnly,\r | |
1979 | IN BOOLEAN AllowShortcuts\r | |
1980 | )\r | |
1981 | {\r | |
1982 | BBS_BBS_DEVICE_PATH *Bbs;\r | |
1983 | CHAR16 *Type;\r | |
1984 | \r | |
1985 | Bbs = DevPath;\r | |
1986 | switch (Bbs->DeviceType) {\r | |
1987 | case BBS_TYPE_FLOPPY:\r | |
1988 | Type = L"Floppy";\r | |
1989 | break;\r | |
1990 | \r | |
1991 | case BBS_TYPE_HARDDRIVE:\r | |
1992 | Type = L"HD";\r | |
1993 | break;\r | |
1994 | \r | |
1995 | case BBS_TYPE_CDROM:\r | |
1996 | Type = L"CDROM";\r | |
1997 | break;\r | |
1998 | \r | |
1999 | case BBS_TYPE_PCMCIA:\r | |
2000 | Type = L"PCMCIA";\r | |
2001 | break;\r | |
2002 | \r | |
2003 | case BBS_TYPE_USB:\r | |
2004 | Type = L"USB";\r | |
2005 | break;\r | |
2006 | \r | |
2007 | case BBS_TYPE_EMBEDDED_NETWORK:\r | |
2008 | Type = L"Network";\r | |
2009 | break;\r | |
2010 | \r | |
2011 | default:\r | |
cf40f28a | 2012 | Type = NULL;\r |
95276127 | 2013 | break;\r |
2014 | }\r | |
2015 | \r | |
cf40f28a | 2016 | if (Type != NULL) {\r |
4d0a30a4 | 2017 | UefiDevicePathLibCatPrint (Str, L"BBS(%s,%a", Type, Bbs->String);\r |
cf40f28a | 2018 | } else {\r |
4d0a30a4 | 2019 | UefiDevicePathLibCatPrint (Str, L"BBS(0x%x,%a", Bbs->DeviceType, Bbs->String);\r |
cf40f28a | 2020 | }\r |
95276127 | 2021 | \r |
572f5d8a | 2022 | if (DisplayOnly) {\r |
4d0a30a4 | 2023 | UefiDevicePathLibCatPrint (Str, L")");\r |
95276127 | 2024 | return ;\r |
2025 | }\r | |
2026 | \r | |
4d0a30a4 | 2027 | UefiDevicePathLibCatPrint (Str, L",0x%x)", Bbs->StatusFlag);\r |
95276127 | 2028 | }\r |
2029 | \r | |
572f5d8a | 2030 | /**\r |
48557c65 | 2031 | Converts an End-of-Device-Path structure to its string representative.\r |
572f5d8a | 2032 | \r |
48557c65 | 2033 | @param Str The string representative of input device.\r |
572f5d8a | 2034 | @param DevPath The input device path structure.\r |
2035 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
2036 | of the display node is used, where applicable. If DisplayOnly\r | |
2037 | is FALSE, then the longer text representation of the display node\r | |
2038 | is used.\r | |
2039 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
2040 | representation for a device node can be used, where applicable.\r | |
2041 | \r | |
2042 | **/\r | |
95276127 | 2043 | VOID\r |
2044 | DevPathToTextEndInstance (\r | |
2045 | IN OUT POOL_PRINT *Str,\r | |
2046 | IN VOID *DevPath,\r | |
2047 | IN BOOLEAN DisplayOnly,\r | |
2048 | IN BOOLEAN AllowShortcuts\r | |
2049 | )\r | |
2050 | {\r | |
4d0a30a4 | 2051 | UefiDevicePathLibCatPrint (Str, L",");\r |
95276127 | 2052 | }\r |
2053 | \r | |
5d6a5aee RN |
2054 | GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric[] = {\r |
2055 | {HARDWARE_DEVICE_PATH, L"HardwarePath" },\r | |
2056 | {ACPI_DEVICE_PATH, L"AcpiPath" },\r | |
2057 | {MESSAGING_DEVICE_PATH, L"Msg" },\r | |
2058 | {MEDIA_DEVICE_PATH, L"MediaPath" },\r | |
2059 | {BBS_DEVICE_PATH, L"BbsPath" },\r | |
2060 | {0, NULL}\r | |
2061 | };\r | |
2062 | \r | |
572f5d8a | 2063 | /**\r |
48557c65 | 2064 | Converts an unknown device path structure to its string representative.\r |
572f5d8a | 2065 | \r |
48557c65 | 2066 | @param Str The string representative of input device.\r |
572f5d8a | 2067 | @param DevPath The input device path structure.\r |
2068 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
2069 | of the display node is used, where applicable. If DisplayOnly\r | |
2070 | is FALSE, then the longer text representation of the display node\r | |
2071 | is used.\r | |
2072 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
2073 | representation for a device node can be used, where applicable.\r | |
2074 | \r | |
2075 | **/\r | |
95276127 | 2076 | VOID\r |
5d6a5aee | 2077 | DevPathToTextNodeGeneric (\r |
95276127 | 2078 | IN OUT POOL_PRINT *Str,\r |
2079 | IN VOID *DevPath,\r | |
2080 | IN BOOLEAN DisplayOnly,\r | |
2081 | IN BOOLEAN AllowShortcuts\r | |
2082 | )\r | |
2083 | {\r | |
5d6a5aee RN |
2084 | EFI_DEVICE_PATH_PROTOCOL *Node;\r |
2085 | UINTN Index;\r | |
2086 | \r | |
2087 | Node = DevPath;\r | |
2088 | \r | |
2089 | for (Index = 0; mUefiDevicePathLibToTextTableGeneric[Index].Text != NULL; Index++) {\r | |
2090 | if (DevicePathType (Node) == mUefiDevicePathLibToTextTableGeneric[Index].Type) {\r | |
2091 | break;\r | |
2092 | }\r | |
2093 | }\r | |
2094 | \r | |
2095 | if (mUefiDevicePathLibToTextTableGeneric[Index].Text == NULL) {\r | |
2096 | //\r | |
2097 | // It's a node whose type cannot be recognized\r | |
2098 | //\r | |
2099 | UefiDevicePathLibCatPrint (Str, L"Path(%d,%d", DevicePathType (Node), DevicePathSubType (Node));\r | |
2100 | } else {\r | |
2101 | //\r | |
2102 | // It's a node whose type can be recognized\r | |
2103 | //\r | |
2104 | UefiDevicePathLibCatPrint (Str, L"%s(%d", mUefiDevicePathLibToTextTableGeneric[Index].Text, DevicePathSubType (Node));\r | |
2105 | }\r | |
2106 | \r | |
2107 | Index = sizeof (EFI_DEVICE_PATH_PROTOCOL);\r | |
2108 | if (Index < DevicePathNodeLength (Node)) {\r | |
2109 | UefiDevicePathLibCatPrint (Str, L",");\r | |
2110 | for (; Index < DevicePathNodeLength (Node); Index++) {\r | |
2111 | UefiDevicePathLibCatPrint (Str, L"%02x", ((UINT8 *) Node)[Index]);\r | |
2112 | }\r | |
2113 | }\r | |
2114 | \r | |
2115 | UefiDevicePathLibCatPrint (Str, L")");\r | |
95276127 | 2116 | }\r |
2117 | \r | |
5d6a5aee | 2118 | GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable[] = {\r |
4d0a30a4 RN |
2119 | {HARDWARE_DEVICE_PATH, HW_PCI_DP, DevPathToTextPci },\r |
2120 | {HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard },\r | |
2121 | {HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap },\r | |
2122 | {HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DevPathToTextVendor },\r | |
2123 | {HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, DevPathToTextController },\r | |
624f017e | 2124 | {HARDWARE_DEVICE_PATH, HW_BMC_DP, DevPathToTextBmc },\r |
4d0a30a4 RN |
2125 | {ACPI_DEVICE_PATH, ACPI_DP, DevPathToTextAcpi },\r |
2126 | {ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextAcpiEx },\r | |
2127 | {ACPI_DEVICE_PATH, ACPI_ADR_DP, DevPathToTextAcpiAdr },\r | |
2128 | {MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, DevPathToTextAtapi },\r | |
2129 | {MESSAGING_DEVICE_PATH, MSG_SCSI_DP, DevPathToTextScsi },\r | |
2130 | {MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre },\r | |
2131 | {MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP, DevPathToTextFibreEx },\r | |
2132 | {MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextSasEx },\r | |
a06ec3e2 | 2133 | {MESSAGING_DEVICE_PATH, MSG_NVME_NAMESPACE_DP, DevPathToTextNVMe },\r |
52306166 | 2134 | {MESSAGING_DEVICE_PATH, MSG_UFS_DP, DevPathToTextUfs },\r |
ab8686b8 | 2135 | {MESSAGING_DEVICE_PATH, MSG_SD_DP, DevPathToTextSd },\r |
4d0a30a4 RN |
2136 | {MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394 },\r |
2137 | {MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb },\r | |
2138 | {MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID },\r | |
2139 | {MESSAGING_DEVICE_PATH, MSG_DEVICE_LOGICAL_UNIT_DP, DevPathToTextLogicalUnit },\r | |
2140 | {MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP, DevPathToTextUsbClass },\r | |
2141 | {MESSAGING_DEVICE_PATH, MSG_SATA_DP, DevPathToTextSata },\r | |
2142 | {MESSAGING_DEVICE_PATH, MSG_I2O_DP, DevPathToTextI2O },\r | |
2143 | {MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, DevPathToTextMacAddr },\r | |
2144 | {MESSAGING_DEVICE_PATH, MSG_IPv4_DP, DevPathToTextIPv4 },\r | |
2145 | {MESSAGING_DEVICE_PATH, MSG_IPv6_DP, DevPathToTextIPv6 },\r | |
2146 | {MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, DevPathToTextInfiniBand },\r | |
2147 | {MESSAGING_DEVICE_PATH, MSG_UART_DP, DevPathToTextUart },\r | |
2148 | {MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, DevPathToTextVendor },\r | |
2149 | {MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, DevPathToTextiSCSI },\r | |
2150 | {MESSAGING_DEVICE_PATH, MSG_VLAN_DP, DevPathToTextVlan },\r | |
c808ac7b | 2151 | {MESSAGING_DEVICE_PATH, MSG_URI_DP, DevPathToTextUri },\r |
7795c8f9 | 2152 | {MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_DP, DevPathToTextBluetooth },\r |
3bafd562 | 2153 | {MESSAGING_DEVICE_PATH, MSG_WIFI_DP, DevPathToTextWiFi },\r |
4d0a30a4 RN |
2154 | {MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, DevPathToTextHardDrive },\r |
2155 | {MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, DevPathToTextCDROM },\r | |
2156 | {MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, DevPathToTextVendor },\r | |
2157 | {MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, DevPathToTextMediaProtocol },\r | |
2158 | {MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath },\r | |
2159 | {MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_VOL_DP, DevPathToTextFv },\r | |
2160 | {MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP, DevPathToTextFvFile },\r | |
2161 | {MEDIA_DEVICE_PATH, MEDIA_RELATIVE_OFFSET_RANGE_DP, DevPathRelativeOffsetRange },\r | |
6a46c1a2 | 2162 | {MEDIA_DEVICE_PATH, MEDIA_RAM_DISK_DP, DevPathToTextRamDisk },\r |
4d0a30a4 RN |
2163 | {BBS_DEVICE_PATH, BBS_BBS_DP, DevPathToTextBBS },\r |
2164 | {END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance },\r | |
95276127 | 2165 | {0, 0, NULL}\r |
2166 | };\r | |
2167 | \r | |
572f5d8a | 2168 | /**\r |
2169 | Converts a device node to its string representation.\r | |
2170 | \r | |
2171 | @param DeviceNode A Pointer to the device node to be converted.\r | |
2172 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
2173 | of the display node is used, where applicable. If DisplayOnly\r | |
2174 | is FALSE, then the longer text representation of the display node\r | |
2175 | is used.\r | |
2176 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
2177 | representation for a device node can be used, where applicable.\r | |
2178 | \r | |
2179 | @return A pointer to the allocated text representation of the device node or NULL if DeviceNode\r | |
2180 | is NULL or there was insufficient memory.\r | |
2181 | \r | |
2182 | **/\r | |
95276127 | 2183 | CHAR16 *\r |
572f5d8a | 2184 | EFIAPI\r |
4d0a30a4 | 2185 | UefiDevicePathLibConvertDeviceNodeToText (\r |
95276127 | 2186 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,\r |
2187 | IN BOOLEAN DisplayOnly,\r | |
2188 | IN BOOLEAN AllowShortcuts\r | |
2189 | )\r | |
95276127 | 2190 | {\r |
4d0a30a4 RN |
2191 | POOL_PRINT Str;\r |
2192 | UINTN Index;\r | |
2193 | DEVICE_PATH_TO_TEXT ToText;\r | |
95276127 | 2194 | \r |
2195 | if (DeviceNode == NULL) {\r | |
2196 | return NULL;\r | |
2197 | }\r | |
2198 | \r | |
2199 | ZeroMem (&Str, sizeof (Str));\r | |
2200 | \r | |
2201 | //\r | |
2202 | // Process the device path node\r | |
4d0a30a4 | 2203 | // If not found, use a generic function\r |
95276127 | 2204 | //\r |
5d6a5aee RN |
2205 | ToText = DevPathToTextNodeGeneric;\r |
2206 | for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index++) {\r | |
2207 | if (DevicePathType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].Type &&\r | |
2208 | DevicePathSubType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].SubType\r | |
95276127 | 2209 | ) {\r |
5d6a5aee | 2210 | ToText = mUefiDevicePathLibToTextTable[Index].Function;\r |
95276127 | 2211 | break;\r |
2212 | }\r | |
2213 | }\r | |
95276127 | 2214 | \r |
2215 | //\r | |
2216 | // Print this node\r | |
2217 | //\r | |
4d0a30a4 | 2218 | ToText (&Str, (VOID *) DeviceNode, DisplayOnly, AllowShortcuts);\r |
95276127 | 2219 | \r |
9d4af8fc | 2220 | ASSERT (Str.Str != NULL);\r |
95276127 | 2221 | return Str.Str;\r |
2222 | }\r | |
2223 | \r | |
572f5d8a | 2224 | /**\r |
2225 | Converts a device path to its text representation.\r | |
95276127 | 2226 | \r |
572f5d8a | 2227 | @param DevicePath A Pointer to the device to be converted.\r |
2228 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
95276127 | 2229 | of the display node is used, where applicable. If DisplayOnly\r |
2230 | is FALSE, then the longer text representation of the display node\r | |
2231 | is used.\r | |
572f5d8a | 2232 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r |
95276127 | 2233 | representation for a device node can be used, where applicable.\r |
2234 | \r | |
572f5d8a | 2235 | @return A pointer to the allocated text representation of the device path or\r |
2236 | NULL if DeviceNode is NULL or there was insufficient memory.\r | |
95276127 | 2237 | \r |
572f5d8a | 2238 | **/\r |
2239 | CHAR16 *\r | |
2240 | EFIAPI\r | |
4d0a30a4 | 2241 | UefiDevicePathLibConvertDevicePathToText (\r |
572f5d8a | 2242 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r |
2243 | IN BOOLEAN DisplayOnly,\r | |
2244 | IN BOOLEAN AllowShortcuts\r | |
2245 | )\r | |
95276127 | 2246 | {\r |
4d0a30a4 RN |
2247 | POOL_PRINT Str;\r |
2248 | EFI_DEVICE_PATH_PROTOCOL *Node;\r | |
2249 | EFI_DEVICE_PATH_PROTOCOL *AlignedNode;\r | |
2250 | UINTN Index;\r | |
2251 | DEVICE_PATH_TO_TEXT ToText;\r | |
95276127 | 2252 | \r |
2253 | if (DevicePath == NULL) {\r | |
2254 | return NULL;\r | |
2255 | }\r | |
2256 | \r | |
2257 | ZeroMem (&Str, sizeof (Str));\r | |
2258 | \r | |
95276127 | 2259 | //\r |
2260 | // Process each device path node\r | |
2261 | //\r | |
4d0a30a4 RN |
2262 | Node = (EFI_DEVICE_PATH_PROTOCOL *) DevicePath;\r |
2263 | while (!IsDevicePathEnd (Node)) {\r | |
95276127 | 2264 | //\r |
2265 | // Find the handler to dump this device path node\r | |
4d0a30a4 | 2266 | // If not found, use a generic function\r |
95276127 | 2267 | //\r |
5d6a5aee RN |
2268 | ToText = DevPathToTextNodeGeneric;\r |
2269 | for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index += 1) {\r | |
95276127 | 2270 | \r |
5d6a5aee RN |
2271 | if (DevicePathType (Node) == mUefiDevicePathLibToTextTable[Index].Type &&\r |
2272 | DevicePathSubType (Node) == mUefiDevicePathLibToTextTable[Index].SubType\r | |
95276127 | 2273 | ) {\r |
5d6a5aee | 2274 | ToText = mUefiDevicePathLibToTextTable[Index].Function;\r |
95276127 | 2275 | break;\r |
2276 | }\r | |
2277 | }\r | |
2278 | //\r | |
5755841f | 2279 | // Put a path separator in if needed\r |
95276127 | 2280 | //\r |
4d0a30a4 RN |
2281 | if ((Str.Count != 0) && (ToText != DevPathToTextEndInstance)) {\r |
2282 | if (Str.Str[Str.Count] != L',') {\r | |
2283 | UefiDevicePathLibCatPrint (&Str, L"/");\r | |
cf40f28a | 2284 | }\r |
95276127 | 2285 | }\r |
1232b214 | 2286 | \r |
4d0a30a4 | 2287 | AlignedNode = AllocateCopyPool (DevicePathNodeLength (Node), Node);\r |
95276127 | 2288 | //\r |
2289 | // Print this node of the device path\r | |
2290 | //\r | |
4d0a30a4 RN |
2291 | ToText (&Str, AlignedNode, DisplayOnly, AllowShortcuts);\r |
2292 | FreePool (AlignedNode);\r | |
1232b214 | 2293 | \r |
95276127 | 2294 | //\r |
2295 | // Next device path node\r | |
2296 | //\r | |
4d0a30a4 | 2297 | Node = NextDevicePathNode (Node);\r |
95276127 | 2298 | }\r |
95276127 | 2299 | \r |
9d4af8fc RN |
2300 | if (Str.Str == NULL) {\r |
2301 | return AllocateZeroPool (sizeof (CHAR16));\r | |
2302 | } else {\r | |
2303 | return Str.Str;\r | |
2304 | }\r | |
95276127 | 2305 | }\r |