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