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