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