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