TianoCore EDK2 master
Loading...
Searching...
No Matches
UefiHandleParsingLib.c
Go to the documentation of this file.
1
14#include <PiDxe.h>
16
17EFI_HII_HANDLE mHandleParsingHiiHandle = NULL;
18HANDLE_INDEX_LIST mHandleList = {
19 {
20 { NULL, NULL }, 0, 0
21 }, 0
22};
23GUID_INFO_BLOCK *mGuidList;
24UINTN mGuidListCount;
25
34CHAR16 *
36 IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage
37 )
38{
39 EFI_GUID *NameGuid;
40 EFI_STATUS Status;
42 VOID *Buffer;
43 UINTN BufferSize;
44 UINT32 AuthenticationStatus;
45
46 if ((LoadedImage == NULL) || (LoadedImage->FilePath == NULL)) {
47 return NULL;
48 }
49
51
52 if (NameGuid == NULL) {
53 return NULL;
54 }
55
56 //
57 // Get the FirmwareVolume2Protocol of the device handle that this image was loaded from.
58 //
59 Status = gBS->HandleProtocol (LoadedImage->DeviceHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv);
60
61 //
62 // FirmwareVolume2Protocol is PI, and is not required to be available.
63 //
64 if (EFI_ERROR (Status)) {
65 return NULL;
66 }
67
68 //
69 // Read the user interface section of the image.
70 //
71 Buffer = NULL;
72 Status = Fv->ReadSection (Fv, NameGuid, EFI_SECTION_USER_INTERFACE, 0, &Buffer, &BufferSize, &AuthenticationStatus);
73
74 if (EFI_ERROR (Status)) {
75 return NULL;
76 }
77
78 //
79 // ReadSection returns just the section data, without any section header. For
80 // a user interface section, the only data is the file name.
81 //
82 return Buffer;
83}
84
92CHAR16 *
95 )
96{
97 CHAR16 *RetVal;
98
99 RetVal = NULL;
100
101 switch (Memory) {
102 case EfiReservedMemoryType: StrnCatGrow (&RetVal, NULL, L"EfiReservedMemoryType", 0);
103 break;
104 case EfiLoaderCode: StrnCatGrow (&RetVal, NULL, L"EfiLoaderCode", 0);
105 break;
106 case EfiLoaderData: StrnCatGrow (&RetVal, NULL, L"EfiLoaderData", 0);
107 break;
108 case EfiBootServicesCode: StrnCatGrow (&RetVal, NULL, L"EfiBootServicesCode", 0);
109 break;
110 case EfiBootServicesData: StrnCatGrow (&RetVal, NULL, L"EfiBootServicesData", 0);
111 break;
112 case EfiRuntimeServicesCode: StrnCatGrow (&RetVal, NULL, L"EfiRuntimeServicesCode", 0);
113 break;
114 case EfiRuntimeServicesData: StrnCatGrow (&RetVal, NULL, L"EfiRuntimeServicesData", 0);
115 break;
116 case EfiConventionalMemory: StrnCatGrow (&RetVal, NULL, L"EfiConventionalMemory", 0);
117 break;
118 case EfiUnusableMemory: StrnCatGrow (&RetVal, NULL, L"EfiUnusableMemory", 0);
119 break;
120 case EfiACPIReclaimMemory: StrnCatGrow (&RetVal, NULL, L"EfiACPIReclaimMemory", 0);
121 break;
122 case EfiACPIMemoryNVS: StrnCatGrow (&RetVal, NULL, L"EfiACPIMemoryNVS", 0);
123 break;
124 case EfiMemoryMappedIO: StrnCatGrow (&RetVal, NULL, L"EfiMemoryMappedIO", 0);
125 break;
126 case EfiMemoryMappedIOPortSpace: StrnCatGrow (&RetVal, NULL, L"EfiMemoryMappedIOPortSpace", 0);
127 break;
128 case EfiPalCode: StrnCatGrow (&RetVal, NULL, L"EfiPalCode", 0);
129 break;
130 case EfiMaxMemoryType: StrnCatGrow (&RetVal, NULL, L"EfiMaxMemoryType", 0);
131 break;
132 default: ASSERT (FALSE);
133 }
134
135 return (RetVal);
136}
137
145CHAR16 *
148 )
149{
150 CHAR16 *RetVal;
151
152 RetVal = NULL;
153
154 switch (Fmt) {
155 case PixelRedGreenBlueReserved8BitPerColor: StrnCatGrow (&RetVal, NULL, L"PixelRedGreenBlueReserved8BitPerColor", 0);
156 break;
157 case PixelBlueGreenRedReserved8BitPerColor: StrnCatGrow (&RetVal, NULL, L"PixelBlueGreenRedReserved8BitPerColor", 0);
158 break;
159 case PixelBitMask: StrnCatGrow (&RetVal, NULL, L"PixelBitMask", 0);
160 break;
161 case PixelBltOnly: StrnCatGrow (&RetVal, NULL, L"PixelBltOnly", 0);
162 break;
163 case PixelFormatMax: StrnCatGrow (&RetVal, NULL, L"PixelFormatMax", 0);
164 break;
165 default: ASSERT (FALSE);
166 }
167
168 return (RetVal);
169}
170
180EFIAPI
182 IN EFI_HANDLE ImageHandle,
183 IN EFI_SYSTEM_TABLE *SystemTable
184 )
185{
186 mGuidListCount = 0;
187 mGuidList = NULL;
188
189 //
190 // Do nothing with mHandleParsingHiiHandle. Initialize HII as needed.
191 //
192 return (EFI_SUCCESS);
193}
194
199VOID
201 VOID
202 )
203{
204 if (mHandleParsingHiiHandle == NULL) {
205 mHandleParsingHiiHandle = HiiAddPackages (&gHandleParsingHiiGuid, gImageHandle, UefiHandleParsingLibStrings, NULL);
206 ASSERT (mHandleParsingHiiHandle != NULL);
207 }
208}
209
219EFIAPI
221 IN EFI_HANDLE ImageHandle,
222 IN EFI_SYSTEM_TABLE *SystemTable
223 )
224{
225 UINTN LoopCount;
226
227 for (LoopCount = 0; mGuidList != NULL && LoopCount < mGuidListCount; LoopCount++) {
228 SHELL_FREE_NON_NULL (mGuidList[LoopCount].GuidId);
229 }
230
231 SHELL_FREE_NON_NULL (mGuidList);
232 if (mHandleParsingHiiHandle != NULL) {
233 HiiRemovePackages (mHandleParsingHiiHandle);
234 }
235
236 return (EFI_SUCCESS);
237}
238
249CHAR16 *
250EFIAPI
252 IN CONST EFI_HANDLE TheHandle,
253 IN CONST BOOLEAN Verbose
254 )
255{
256 EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
257 EFI_STATUS Status;
258 CHAR16 *RetVal;
259 CHAR16 *Temp;
260 CHAR16 *FileName;
261 CHAR8 *PdbFileName;
262 CHAR16 *FilePath;
263 CHAR16 *CodeType;
264 CHAR16 *DataType;
265
266 Status = gBS->OpenProtocol (
267 TheHandle,
268 &gEfiLoadedImageProtocolGuid,
269 (VOID **)&LoadedImage,
271 NULL,
272 EFI_OPEN_PROTOCOL_GET_PROTOCOL
273 );
274
275 if (EFI_ERROR (Status)) {
276 return NULL;
277 }
278
279 FileName = FindLoadedImageFileName (LoadedImage);
280 FilePath = ConvertDevicePathToText (LoadedImage->FilePath, TRUE, TRUE);
281 if (!Verbose) {
282 if (FileName == NULL) {
283 FileName = FilePath;
284 } else {
285 SHELL_FREE_NON_NULL (FilePath);
286 }
287
288 return FileName;
289 }
290
292 RetVal = NULL;
293 if (FileName != NULL) {
294 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_LI_DUMP_NAME), NULL);
295
296 if (Temp != NULL) {
297 RetVal = CatSPrint (NULL, Temp, FileName);
298 }
299
300 SHELL_FREE_NON_NULL (Temp);
301 SHELL_FREE_NON_NULL (FileName);
302 if (RetVal == NULL) {
303 return NULL;
304 }
305 }
306
307 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_LI_DUMP_MAIN), NULL);
308 if (Temp == NULL) {
309 return NULL;
310 }
311
312 PdbFileName = PeCoffLoaderGetPdbPointer (LoadedImage->ImageBase);
313 DataType = ConvertMemoryType (LoadedImage->ImageDataType);
314 CodeType = ConvertMemoryType (LoadedImage->ImageCodeType);
315 if ((PdbFileName != NULL) && (DataType != NULL) && (CodeType != NULL) && (FilePath != NULL)) {
316 RetVal = CatSPrint (
317 RetVal,
318 Temp,
319 LoadedImage->Revision,
320 LoadedImage->ParentHandle,
321 LoadedImage->SystemTable,
322 LoadedImage->DeviceHandle,
323 FilePath,
324 PdbFileName,
325 LoadedImage->LoadOptionsSize,
326 LoadedImage->LoadOptions,
327 LoadedImage->ImageBase,
328 LoadedImage->ImageSize,
329 CodeType,
330 DataType,
331 LoadedImage->Unload
332 );
333 }
334
335 SHELL_FREE_NON_NULL (Temp);
336 SHELL_FREE_NON_NULL (FilePath);
337 SHELL_FREE_NON_NULL (CodeType);
338 SHELL_FREE_NON_NULL (DataType);
339
340 return RetVal;
341}
342
353CHAR16 *
354EFIAPI
356 IN CONST EFI_HANDLE TheHandle,
357 IN CONST BOOLEAN Verbose
358 )
359{
360 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
361 EFI_STATUS Status;
362 CHAR16 *RetVal;
363 CHAR16 *Temp;
364 CHAR16 *Fmt;
365 CHAR16 *TempRetVal;
366 UINTN GopInfoSize;
367 UINT32 Mode;
369
370 if (!Verbose) {
371 return (CatSPrint (NULL, L"GraphicsOutput"));
372 }
373
375
376 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GOP_DUMP_MAIN), NULL);
377 if (Temp == NULL) {
378 return NULL;
379 }
380
381 Status = gBS->OpenProtocol (
382 TheHandle,
383 &gEfiGraphicsOutputProtocolGuid,
384 (VOID **)&GraphicsOutput,
386 NULL,
387 EFI_OPEN_PROTOCOL_GET_PROTOCOL
388 );
389
390 if (EFI_ERROR (Status)) {
391 SHELL_FREE_NON_NULL (Temp);
392 return NULL;
393 }
394
395 Fmt = ConvertPixelFormat (GraphicsOutput->Mode->Info->PixelFormat);
396 if (Fmt == NULL) {
397 SHELL_FREE_NON_NULL (Temp);
398 return NULL;
399 }
400
401 RetVal = CatSPrint (
402 NULL,
403 Temp,
404 GraphicsOutput->Mode->MaxMode,
405 GraphicsOutput->Mode->Mode,
406 GraphicsOutput->Mode->FrameBufferBase,
407 (UINT64)GraphicsOutput->Mode->FrameBufferSize,
408 (UINT64)GraphicsOutput->Mode->SizeOfInfo,
409 GraphicsOutput->Mode->Info->Version,
410 GraphicsOutput->Mode->Info->HorizontalResolution,
411 GraphicsOutput->Mode->Info->VerticalResolution,
412 Fmt,
413 GraphicsOutput->Mode->Info->PixelsPerScanLine,
414 GraphicsOutput->Mode->Info->PixelFormat != PixelBitMask ? 0 : GraphicsOutput->Mode->Info->PixelInformation.RedMask,
415 GraphicsOutput->Mode->Info->PixelFormat != PixelBitMask ? 0 : GraphicsOutput->Mode->Info->PixelInformation.GreenMask,
416 GraphicsOutput->Mode->Info->PixelFormat != PixelBitMask ? 0 : GraphicsOutput->Mode->Info->PixelInformation.BlueMask
417 );
418
419 SHELL_FREE_NON_NULL (Temp);
420 if (RetVal == NULL) {
421 goto EXIT;
422 }
423
424 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GOP_RES_LIST_MAIN), NULL);
425 if (Temp == NULL) {
426 SHELL_FREE_NON_NULL (RetVal);
427 goto EXIT;
428 }
429
430 TempRetVal = CatSPrint (RetVal, Temp);
431 SHELL_FREE_NON_NULL (RetVal);
432 if (TempRetVal == NULL) {
433 goto EXIT;
434 }
435
436 RetVal = TempRetVal;
437 SHELL_FREE_NON_NULL (Temp);
438
439 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GOP_RES_LIST_ENTRY), NULL);
440 if (Temp == NULL) {
441 SHELL_FREE_NON_NULL (RetVal);
442 goto EXIT;
443 }
444
445 for (Mode = 0; Mode < GraphicsOutput->Mode->MaxMode; Mode++) {
446 Status = GraphicsOutput->QueryMode (
447 GraphicsOutput,
448 Mode,
449 &GopInfoSize,
450 &GopInfo
451 );
452 if (EFI_ERROR (Status)) {
453 continue;
454 }
455
456 TempRetVal = CatSPrint (
457 RetVal,
458 Temp,
459 Mode,
460 GopInfo->HorizontalResolution,
461 GopInfo->VerticalResolution
462 );
463
464 SHELL_FREE_NON_NULL (GopInfo);
465 SHELL_FREE_NON_NULL (RetVal);
466 RetVal = TempRetVal;
467 }
468
469EXIT:
470 SHELL_FREE_NON_NULL (Temp);
471 SHELL_FREE_NON_NULL (Fmt);
472
473 return RetVal;
474}
475
486CHAR16 *
487EFIAPI
489 IN CONST EFI_HANDLE TheHandle,
490 IN CONST BOOLEAN Verbose
491 )
492{
493 EFI_EDID_DISCOVERED_PROTOCOL *EdidDiscovered;
494 EFI_STATUS Status;
495 CHAR16 *RetVal;
496 CHAR16 *Temp;
497 CHAR16 *TempRetVal;
498
499 if (!Verbose) {
500 return (CatSPrint (NULL, L"EDIDDiscovered"));
501 }
502
503 Status = gBS->OpenProtocol (
504 TheHandle,
505 &gEfiEdidDiscoveredProtocolGuid,
506 (VOID **)&EdidDiscovered,
507 NULL,
508 NULL,
509 EFI_OPEN_PROTOCOL_GET_PROTOCOL
510 );
511
512 if (EFI_ERROR (Status)) {
513 return NULL;
514 }
515
516 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_EDID_DISCOVERED_MAIN), NULL);
517 if (Temp == NULL) {
518 return NULL;
519 }
520
521 RetVal = CatSPrint (NULL, Temp, EdidDiscovered->SizeOfEdid);
522 SHELL_FREE_NON_NULL (Temp);
523 if (RetVal == NULL) {
524 return NULL;
525 }
526
527 if (EdidDiscovered->SizeOfEdid != 0) {
528 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_EDID_DISCOVERED_DATA), NULL);
529 if (Temp == NULL) {
530 SHELL_FREE_NON_NULL (RetVal);
531 return NULL;
532 }
533
534 TempRetVal = CatSPrint (RetVal, Temp);
535 SHELL_FREE_NON_NULL (RetVal);
536 RetVal = TempRetVal;
537
538 TempRetVal = CatSDumpHex (RetVal, 4, 0, EdidDiscovered->SizeOfEdid, EdidDiscovered->Edid);
539 RetVal = TempRetVal;
540 }
541
542 return RetVal;
543}
544
555CHAR16 *
556EFIAPI
558 IN CONST EFI_HANDLE TheHandle,
559 IN CONST BOOLEAN Verbose
560 )
561{
562 EFI_EDID_ACTIVE_PROTOCOL *EdidActive;
563 EFI_STATUS Status;
564 CHAR16 *RetVal;
565 CHAR16 *Temp;
566 CHAR16 *TempRetVal;
567
568 if (!Verbose) {
569 return (CatSPrint (NULL, L"EDIDActive"));
570 }
571
572 Status = gBS->OpenProtocol (
573 TheHandle,
574 &gEfiEdidActiveProtocolGuid,
575 (VOID **)&EdidActive,
576 NULL,
577 NULL,
578 EFI_OPEN_PROTOCOL_GET_PROTOCOL
579 );
580
581 if (EFI_ERROR (Status)) {
582 return NULL;
583 }
584
585 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_EDID_ACTIVE_MAIN), NULL);
586 if (Temp == NULL) {
587 return NULL;
588 }
589
590 RetVal = CatSPrint (NULL, Temp, EdidActive->SizeOfEdid);
591 SHELL_FREE_NON_NULL (Temp);
592 if (RetVal == NULL) {
593 return NULL;
594 }
595
596 if (EdidActive->SizeOfEdid != 0) {
597 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_EDID_ACTIVE_DATA), NULL);
598 if (Temp == NULL) {
599 SHELL_FREE_NON_NULL (RetVal);
600 return NULL;
601 }
602
603 TempRetVal = CatSPrint (RetVal, Temp);
604 SHELL_FREE_NON_NULL (RetVal);
605 RetVal = TempRetVal;
606
607 TempRetVal = CatSDumpHex (RetVal, 4, 0, EdidActive->SizeOfEdid, EdidActive->Edid);
608 RetVal = TempRetVal;
609 }
610
611 return RetVal;
612}
613
624CHAR16 *
625EFIAPI
627 IN CONST EFI_HANDLE TheHandle,
628 IN CONST BOOLEAN Verbose
629 )
630{
631 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
633 UINT64 Supports;
634 UINT64 Attributes;
635 CHAR16 *Temp;
636 CHAR16 *Temp2;
637 CHAR16 *RetVal;
638 EFI_STATUS Status;
639
640 RetVal = NULL;
641
642 if (!Verbose) {
643 return (CatSPrint (NULL, L"PciRootBridgeIo"));
644 }
645
647
648 Status = gBS->HandleProtocol (
649 TheHandle,
650 &gEfiPciRootBridgeIoProtocolGuid,
651 (VOID **)&PciRootBridgeIo
652 );
653
654 if (EFI_ERROR (Status)) {
655 return NULL;
656 }
657
658 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_PH), NULL);
659 if (Temp == NULL) {
660 return NULL;
661 }
662
663 Temp2 = CatSPrint (NULL, Temp, PciRootBridgeIo->ParentHandle);
664 FreePool (Temp);
665 RetVal = Temp2;
666 Temp2 = NULL;
667
668 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_SEG), NULL);
669 if (Temp == NULL) {
670 SHELL_FREE_NON_NULL (RetVal);
671 return NULL;
672 }
673
674 Temp2 = CatSPrint (RetVal, Temp, PciRootBridgeIo->SegmentNumber);
675 FreePool (Temp);
676 FreePool (RetVal);
677 RetVal = Temp2;
678 Temp2 = NULL;
679
680 Supports = 0;
681 Attributes = 0;
682 Status = PciRootBridgeIo->GetAttributes (PciRootBridgeIo, &Supports, &Attributes);
683 if (!EFI_ERROR (Status)) {
684 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_ATT), NULL);
685 if (Temp == NULL) {
686 SHELL_FREE_NON_NULL (RetVal);
687 return NULL;
688 }
689
690 Temp2 = CatSPrint (RetVal, Temp, Attributes);
691 FreePool (Temp);
692 FreePool (RetVal);
693 RetVal = Temp2;
694 Temp2 = NULL;
695
696 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_SUPPORTS), NULL);
697 if (Temp == NULL) {
698 SHELL_FREE_NON_NULL (RetVal);
699 return NULL;
700 }
701
702 Temp2 = CatSPrint (RetVal, Temp, Supports);
703 FreePool (Temp);
704 FreePool (RetVal);
705 RetVal = Temp2;
706 Temp2 = NULL;
707 }
708
709 Configuration = NULL;
710 Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **)&Configuration);
711 if (!EFI_ERROR (Status) && (Configuration != NULL)) {
712 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_TITLE), NULL);
713 if (Temp == NULL) {
714 SHELL_FREE_NON_NULL (RetVal);
715 return NULL;
716 }
717
718 Temp2 = CatSPrint (RetVal, Temp, Supports);
719 FreePool (Temp);
720 FreePool (RetVal);
721 RetVal = Temp2;
722 Temp2 = NULL;
723 while (Configuration->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) {
724 Temp = NULL;
725 switch (Configuration->ResType) {
726 case ACPI_ADDRESS_SPACE_TYPE_MEM:
727 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_MEM), NULL);
728 break;
729 case ACPI_ADDRESS_SPACE_TYPE_IO:
730 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_IO), NULL);
731 break;
732 case ACPI_ADDRESS_SPACE_TYPE_BUS:
733 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_BUS), NULL);
734 break;
735 }
736
737 if (Temp != NULL) {
738 Temp2 = CatSPrint (RetVal, L"\r\n%s", Temp);
739 FreePool (Temp);
740 FreePool (RetVal);
741 RetVal = Temp2;
742 Temp2 = NULL;
743 }
744
745 Temp2 = CatSPrint (
746 RetVal,
747 L"%%H%02x %016lx %016lx %02x%%N",
748 Configuration->SpecificFlag,
749 Configuration->AddrRangeMin,
750 Configuration->AddrRangeMax,
751 Configuration->AddrSpaceGranularity
752 );
753 FreePool (RetVal);
754 RetVal = Temp2;
755 Temp2 = NULL;
756 Configuration++;
757 }
758 }
759
760 return (RetVal);
761}
762
773CHAR16 *
774EFIAPI
776 IN CONST EFI_HANDLE TheHandle,
777 IN CONST BOOLEAN Verbose
778 )
779{
781 INTN Index;
782 UINTN Col;
783 UINTN Row;
784 EFI_STATUS Status;
785 CHAR16 *RetVal;
786 UINTN Size;
787 CHAR16 *Temp;
788 UINTN NewSize;
789
790 if (!Verbose) {
791 return (NULL);
792 }
793
795
796 RetVal = NULL;
797 Size = 0;
798
799 Status = gBS->HandleProtocol (
800 TheHandle,
801 &gEfiSimpleTextOutProtocolGuid,
802 (VOID **)&Dev
803 );
804
805 ASSERT_EFI_ERROR (Status);
806 ASSERT (Dev != NULL && Dev->Mode != NULL);
807
808 Size = (Dev->Mode->MaxMode + 1) * 80;
809 RetVal = AllocateZeroPool (Size);
810 if (RetVal == NULL) {
811 return NULL;
812 }
813
814 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_TXT_OUT_DUMP_HEADER), NULL);
815 if (Temp != NULL) {
816 UnicodeSPrint (RetVal, Size, Temp, Dev, Dev->Mode->Attribute);
817 FreePool (Temp);
818 }
819
820 //
821 // Dump TextOut Info
822 //
823 Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_TXT_OUT_DUMP_LINE), NULL);
824 if (Temp == NULL) {
825 FreePool (RetVal);
826 return NULL;
827 }
828
829 for (Index = 0; Index < Dev->Mode->MaxMode; Index++) {
830 Status = Dev->QueryMode (Dev, Index, &Col, &Row);
831 NewSize = Size - StrSize (RetVal);
833 RetVal + StrLen (RetVal),
834 NewSize,
835 Temp == NULL ? L"" : Temp,
836 Index == Dev->Mode->Mode ? L'*' : L' ',
837 Index,
838 !EFI_ERROR (Status) ? (INTN)Col : -1,
839 !EFI_ERROR (Status) ? (INTN)Row : -1
840 );
841 }
842
843 FreePool (Temp);
844 return (RetVal);
845}
846
847STATIC CONST UINTN VersionStringSize = 60;
848
859CHAR16 *
860EFIAPI
862 IN CONST EFI_HANDLE TheHandle,
863 IN CONST BOOLEAN Verbose
864 )
865{
867 EFI_STATUS Status;
868 CHAR16 *RetVal;
869
870 Status = gBS->HandleProtocol (
871 TheHandle,
872 &gEfiDriverSupportedEfiVersionProtocolGuid,
873 (VOID **)&DriverEfiVersion
874 );
875
876 ASSERT_EFI_ERROR (Status);
877
878 RetVal = AllocateZeroPool (VersionStringSize);
879 if (RetVal != NULL) {
880 UnicodeSPrint (RetVal, VersionStringSize, L"0x%08x", DriverEfiVersion->FirmwareVersion);
881 }
882
883 return (RetVal);
884}
885
897CHAR16 *
900 IN CONST BOOLEAN Verbose,
901 IN CONST UINTN Length
902 )
903{
904 CHAR16 *Temp;
905 CHAR16 *Temp2;
906 UINTN Size;
907
908 //
909 // I cannot decide whether to allow shortcuts here (the second BOOLEAN on the next line)
910 //
911 Temp = ConvertDevicePathToText (DevPath, TRUE, TRUE);
912 if (!Verbose && (Temp != NULL) && (StrLen (Temp) > Length)) {
913 Temp2 = NULL;
914 Size = 0;
915 Temp2 = StrnCatGrow (&Temp2, &Size, L"..", 0);
916 Temp2 = StrnCatGrow (&Temp2, &Size, Temp+(StrLen (Temp) - (Length - 2)), 0);
917 FreePool (Temp);
918 Temp = Temp2;
919 }
920
921 return (Temp);
922}
923
935STATIC CHAR16 *
936EFIAPI
938 IN CONST EFI_HANDLE TheHandle,
939 IN CONST BOOLEAN Verbose,
940 IN EFI_GUID *Protocol
941 )
942{
944 CHAR16 *DevPathStr;
945 CHAR16 *DevPathStrTemp;
946 UINTN Size;
947 EFI_STATUS Status;
948
949 DevPathStr = NULL;
950 DevPathStrTemp = NULL;
951 Status = gBS->OpenProtocol (TheHandle, Protocol, (VOID **)&DevPath, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
952 if (!EFI_ERROR (Status)) {
953 DevPathStr = ConvertDevicePathToShortText (DevPath, Verbose, 30);
954 if (Verbose) {
955 Size = StrSize (DevPathStr) + sizeof (CHAR16) * 2;
956 DevPathStrTemp = AllocateZeroPool (Size);
957 if (DevPathStrTemp != NULL) {
958 StrnCatS (DevPathStrTemp, Size/sizeof (CHAR16), L" ", 2);
959 StrnCatS (DevPathStrTemp, Size/sizeof (CHAR16), DevPathStr, StrLen (DevPathStr));
960 }
961
962 FreePool (DevPathStr);
963 DevPathStr = DevPathStrTemp;
964 }
965
966 gBS->CloseProtocol (TheHandle, Protocol, gImageHandle, NULL);
967 }
968
969 return DevPathStr;
970}
971
982CHAR16 *
983EFIAPI
985 IN CONST EFI_HANDLE TheHandle,
986 IN CONST BOOLEAN Verbose
987 )
988{
989 return DevicePathProtocolDumpInformationEx (TheHandle, Verbose, &gEfiDevicePathProtocolGuid);
990}
991
1002CHAR16 *
1003EFIAPI
1005 IN CONST EFI_HANDLE TheHandle,
1006 IN CONST BOOLEAN Verbose
1007 )
1008{
1009 return DevicePathProtocolDumpInformationEx (TheHandle, Verbose, &gEfiLoadedImageDevicePathProtocolGuid);
1010}
1011
1022CHAR16 *
1023EFIAPI
1025 IN CONST EFI_HANDLE TheHandle,
1026 IN CONST BOOLEAN Verbose
1027 )
1028{
1029 EFI_STATUS Status;
1030 CHAR16 *GetString;
1031 CHAR16 *RetVal;
1032 CHAR16 *TempRetVal;
1033 EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;
1034 EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
1035 EFI_HANDLE ImageHandle;
1036 UINTN Size;
1037
1038 if (!Verbose) {
1039 return NULL;
1040 }
1041
1042 Size = 0;
1043 GetString = NULL;
1044 RetVal = NULL;
1045 TempRetVal = NULL;
1046 ImageHandle = 0;
1047
1048 Status = gBS->OpenProtocol (
1049 TheHandle,
1050 &gEfiBusSpecificDriverOverrideProtocolGuid,
1051 (VOID **)&BusSpecificDriverOverride,
1053 NULL,
1054 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1055 );
1056 if (EFI_ERROR (Status)) {
1057 return NULL;
1058 }
1059
1061 GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_BSDO_DUMP_MAIN), NULL);
1062 if (GetString == NULL) {
1063 return NULL;
1064 }
1065
1066 do {
1067 Status = BusSpecificDriverOverride->GetDriver (
1068 BusSpecificDriverOverride,
1069 &ImageHandle
1070 );
1071 if (!EFI_ERROR (Status)) {
1072 Status = gBS->HandleProtocol (
1073 ImageHandle,
1074 &gEfiLoadedImageProtocolGuid,
1075 (VOID **)&LoadedImage
1076 );
1077 if (!EFI_ERROR (Status)) {
1078 TempRetVal = CatSPrint (
1079 TempRetVal,
1080 GetString,
1081 ConvertHandleToHandleIndex (ImageHandle),
1082 ConvertDevicePathToText (LoadedImage->FilePath, TRUE, TRUE)
1083 );
1084 if (TempRetVal == NULL) {
1085 break;
1086 }
1087
1088 StrnCatGrow (&RetVal, &Size, TempRetVal, 0);
1089 SHELL_FREE_NON_NULL (TempRetVal);
1090 }
1091 }
1092 } while (!EFI_ERROR (Status));
1093
1094 SHELL_FREE_NON_NULL (GetString);
1095 return RetVal;
1096}
1097
1108CHAR16 *
1109EFIAPI
1111 IN CONST EFI_HANDLE TheHandle,
1112 IN CONST BOOLEAN Verbose
1113 )
1114{
1115 EFI_STATUS Status;
1116 EFI_BLOCK_IO_PROTOCOL *BlockIo;
1117 EFI_BLOCK_IO_MEDIA *BlockMedia;
1118 CHAR16 *GetString;
1119 CHAR16 *RetVal;
1120
1121 if (!Verbose) {
1122 return NULL;
1123 }
1124
1125 GetString = NULL;
1126 RetVal = NULL;
1127
1128 Status = gBS->OpenProtocol (
1129 TheHandle,
1130 &gEfiBlockIoProtocolGuid,
1131 (VOID **)&BlockIo,
1133 NULL,
1134 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1135 );
1136 if (EFI_ERROR (Status)) {
1137 return NULL;
1138 }
1139
1140 BlockMedia = BlockIo->Media;
1141 //
1142 // Per spec:
1143 // The function (ReadBlocks) must return EFI_NO_MEDIA or
1144 // EFI_MEDIA_CHANGED even if LBA, BufferSize, or Buffer are invalid so the caller can probe
1145 // for changes in media state.
1146 //
1147 BlockIo->ReadBlocks (
1148 BlockIo,
1149 BlockIo->Media->MediaId,
1150 0,
1151 0,
1152 NULL
1153 );
1154
1156 GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_BLOCKIO_INFO), NULL);
1157 if (GetString == NULL) {
1158 return NULL;
1159 }
1160
1161 RetVal = CatSPrint (
1162 RetVal,
1163 GetString,
1164 BlockMedia->RemovableMedia ? L"Removable " : L"Fixed ",
1165 BlockMedia->MediaPresent ? L"" : L"not-present ",
1166 BlockMedia->MediaId,
1167 BlockMedia->BlockSize,
1168 BlockMedia->LastBlock,
1169 MultU64x32 (BlockMedia->LastBlock + 1, BlockMedia->BlockSize),
1170 BlockMedia->LogicalPartition ? L"partition" : L"raw",
1171 BlockMedia->ReadOnly ? L"ro" : L"rw",
1172 BlockMedia->WriteCaching ? L"cached" : L"!cached"
1173 );
1174
1175 SHELL_FREE_NON_NULL (GetString);
1176 return RetVal;
1177}
1178
1187CHAR16 *
1188EFIAPI
1190 IN CONST EFI_HANDLE TheHandle,
1191 IN CONST BOOLEAN Verbose
1192 )
1193{
1194 EFI_STATUS Status;
1195 EFI_DEBUG_SUPPORT_PROTOCOL *DebugSupport;
1196 CHAR16 *GetString;
1197 CHAR16 *RetVal;
1198
1199 if (!Verbose) {
1200 return NULL;
1201 }
1202
1203 GetString = NULL;
1204 RetVal = NULL;
1205 Status = gBS->OpenProtocol (
1206 TheHandle,
1207 &gEfiDebugSupportProtocolGuid,
1208 (VOID **)&DebugSupport,
1210 NULL,
1211 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1212 );
1213 if (EFI_ERROR (Status)) {
1214 return NULL;
1215 }
1216
1218 GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_DEBUGSUPPORT_INFO), NULL);
1219 if (GetString == NULL) {
1220 return NULL;
1221 }
1222
1223 //
1224 // Dump Debug support info
1225 //
1226 switch (DebugSupport->Isa) {
1227 case (IsaIa32):
1228 RetVal = CatSPrint (RetVal, GetString, L"IA-32");
1229 break;
1230 case (IsaIpf):
1231 RetVal = CatSPrint (RetVal, GetString, L"IPF");
1232 break;
1233 case (IsaEbc):
1234 RetVal = CatSPrint (RetVal, GetString, L"EBC");
1235 break;
1236 default:
1237 SHELL_FREE_NON_NULL (GetString);
1238 GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_DEBUGSUPPORT_UNKNOWN), NULL);
1239 RetVal = GetString != NULL ? CatSPrint (RetVal, GetString, DebugSupport->Isa) : NULL;
1240 break;
1241 }
1242
1243 SHELL_FREE_NON_NULL (GetString);
1244 return RetVal;
1245}
1246
1257CHAR16 *
1258EFIAPI
1260 IN CONST EFI_HANDLE TheHandle,
1261 IN CONST BOOLEAN Verbose
1262 )
1263{
1264 EFI_STATUS Status;
1265 EFI_PCI_IO_PROTOCOL *PciIo;
1266 PCI_TYPE00 Pci;
1267 UINTN Segment;
1268 UINTN Bus;
1269 UINTN Device;
1270 UINTN Function;
1271 UINTN Index;
1272 CHAR16 *GetString;
1273 CHAR16 *TempRetVal;
1274 CHAR16 *RetVal;
1275
1276 if (!Verbose) {
1277 return (NULL);
1278 }
1279
1280 RetVal = NULL;
1281 GetString = NULL;
1282 TempRetVal = NULL;
1283 Status = gBS->OpenProtocol (
1284 TheHandle,
1285 &gEfiPciIoProtocolGuid,
1286 (VOID **)&PciIo,
1288 NULL,
1289 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1290 );
1291
1292 if (EFI_ERROR (Status)) {
1293 return NULL;
1294 }
1295
1296 PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0, sizeof (Pci), &Pci);
1297 PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);
1299 GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIIO_DUMP_MAIN), NULL);
1300 if (GetString == NULL) {
1301 return NULL;
1302 }
1303
1304 RetVal = CatSPrint (
1305 NULL,
1306 GetString,
1307 Segment,
1308 Bus,
1309 Device,
1310 Function,
1311 PciIo->RomSize,
1312 PciIo->RomImage,
1313 Pci.Hdr.VendorId,
1314 Pci.Hdr.DeviceId,
1315 Pci.Hdr.ClassCode[0],
1316 Pci.Hdr.ClassCode[1],
1317 Pci.Hdr.ClassCode[2]
1318 );
1319 if (RetVal == NULL) {
1320 FreePool (GetString);
1321 return NULL;
1322 }
1323
1324 for (Index = 0; Index < sizeof (Pci); Index++) {
1325 if ((Index % 0x10) == 0) {
1326 TempRetVal = CatSPrint (RetVal, L"\r\n %02x", *((UINT8 *)(&Pci) + Index));
1327 } else {
1328 TempRetVal = CatSPrint (RetVal, L"%02x", *((UINT8 *)(&Pci) + Index));
1329 }
1330
1331 FreePool (RetVal);
1332 RetVal = TempRetVal;
1333 TempRetVal = NULL;
1334 }
1335
1336 FreePool (GetString);
1337 return RetVal;
1338}
1339
1350CHAR16 *
1351EFIAPI
1353 IN CONST EFI_HANDLE TheHandle,
1354 IN CONST BOOLEAN Verbose
1355 )
1356{
1357 EFI_STATUS Status;
1358 EFI_USB_IO_PROTOCOL *UsbIo;
1359 EFI_USB_INTERFACE_DESCRIPTOR InterfaceDesc;
1360 CHAR16 *GetString;
1361 CHAR16 *RetVal;
1362
1363 if (!Verbose) {
1364 return (NULL);
1365 }
1366
1367 RetVal = NULL;
1368 GetString = NULL;
1369 Status = gBS->OpenProtocol (
1370 TheHandle,
1371 &gEfiUsbIoProtocolGuid,
1372 (VOID **)&UsbIo,
1374 NULL,
1375 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1376 );
1377
1378 if (EFI_ERROR (Status)) {
1379 return NULL;
1380 }
1381
1382 UsbIo->UsbGetInterfaceDescriptor (UsbIo, &InterfaceDesc);
1384 GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_USBIO_DUMP_MAIN), NULL);
1385 if (GetString == NULL) {
1386 return NULL;
1387 }
1388
1389 RetVal = CatSPrint (
1390 NULL,
1391 GetString,
1392 InterfaceDesc.InterfaceNumber,
1393 InterfaceDesc.InterfaceClass,
1394 InterfaceDesc.InterfaceSubClass,
1395 InterfaceDesc.InterfaceProtocol
1396 );
1397
1398 FreePool (GetString);
1399 return RetVal;
1400}
1401
1410CHAR16 *
1411EFIAPI
1413 IN CONST EFI_HANDLE TheHandle,
1414 IN CONST BOOLEAN Verbose
1415 )
1416{
1417 EFI_STATUS Status;
1418 EFI_ADAPTER_INFORMATION_PROTOCOL *EfiAdptrInfoProtocol;
1419 UINTN InfoTypesBufferCount;
1420 UINTN GuidIndex;
1421 EFI_GUID *InfoTypesBuffer;
1422 CHAR16 *GuidStr;
1423 CHAR16 *TempStr;
1424 CHAR16 *RetVal;
1425 CHAR16 *TempRetVal;
1426 VOID *InformationBlock;
1427 UINTN InformationBlockSize;
1428
1429 if (!Verbose) {
1430 return (CatSPrint (NULL, L"AdapterInfo"));
1431 }
1432
1433 InfoTypesBuffer = NULL;
1434 InformationBlock = NULL;
1435
1436 Status = gBS->OpenProtocol (
1437 (EFI_HANDLE)(TheHandle),
1438 &gEfiAdapterInformationProtocolGuid,
1439 (VOID **)&EfiAdptrInfoProtocol,
1440 NULL,
1441 NULL,
1442 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1443 );
1444
1445 if (EFI_ERROR (Status)) {
1446 return NULL;
1447 }
1448
1449 //
1450 // Get a list of supported information types for this instance of the protocol.
1451 //
1452 Status = EfiAdptrInfoProtocol->GetSupportedTypes (
1453 EfiAdptrInfoProtocol,
1454 &InfoTypesBuffer,
1455 &InfoTypesBufferCount
1456 );
1457 RetVal = NULL;
1458 if (EFI_ERROR (Status)) {
1459 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GET_SUPP_TYPES_FAILED), NULL);
1460 if (TempStr != NULL) {
1461 RetVal = CatSPrint (NULL, TempStr, Status);
1462 } else {
1463 goto ERROR_EXIT;
1464 }
1465 } else {
1466 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_SUPP_TYPE_HEADER), NULL);
1467 if (TempStr == NULL) {
1468 goto ERROR_EXIT;
1469 }
1470
1471 RetVal = CatSPrint (NULL, TempStr);
1472 if (RetVal == NULL) {
1473 goto ERROR_EXIT;
1474 }
1475
1476 SHELL_FREE_NON_NULL (TempStr);
1477
1478 for (GuidIndex = 0; GuidIndex < InfoTypesBufferCount; GuidIndex++) {
1479 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GUID_NUMBER), NULL);
1480 if (TempStr == NULL) {
1481 goto ERROR_EXIT;
1482 }
1483
1484 TempRetVal = CatSPrint (RetVal, TempStr, (GuidIndex + 1), &InfoTypesBuffer[GuidIndex]);
1485 SHELL_FREE_NON_NULL (RetVal);
1486 RetVal = TempRetVal;
1487 SHELL_FREE_NON_NULL (TempStr);
1488
1489 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GUID_STRING), NULL);
1490 if (TempStr == NULL) {
1491 goto ERROR_EXIT;
1492 }
1493
1494 if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoMediaStateGuid)) {
1495 TempRetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoMediaStateGuid");
1496 SHELL_FREE_NON_NULL (RetVal);
1497 RetVal = TempRetVal;
1498 } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoNetworkBootGuid)) {
1499 TempRetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoNetworkBootGuid");
1500 SHELL_FREE_NON_NULL (RetVal);
1501 RetVal = TempRetVal;
1502 } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoSanMacAddressGuid)) {
1503 TempRetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoSanMacAddressGuid");
1504 SHELL_FREE_NON_NULL (RetVal);
1505 RetVal = TempRetVal;
1506 } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoUndiIpv6SupportGuid)) {
1507 TempRetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoUndiIpv6SupportGuid");
1508 SHELL_FREE_NON_NULL (RetVal);
1509 RetVal = TempRetVal;
1510 } else {
1511 GuidStr = GetStringNameFromGuid (&InfoTypesBuffer[GuidIndex], NULL);
1512 if (GuidStr == NULL) {
1513 TempRetVal = CatSPrint (RetVal, TempStr, L"UnknownInfoType");
1514 SHELL_FREE_NON_NULL (RetVal);
1515 RetVal = TempRetVal;
1516
1517 SHELL_FREE_NON_NULL (TempStr);
1518 SHELL_FREE_NON_NULL (GuidStr);
1519 //
1520 // So that we never have to pass this UnknownInfoType to the parsing function "GetInformation" service of AIP
1521 //
1522 continue;
1523 } else {
1524 TempRetVal = CatSPrint (RetVal, TempStr, GuidStr);
1525 SHELL_FREE_NON_NULL (RetVal);
1526 RetVal = TempRetVal;
1527 SHELL_FREE_NON_NULL (GuidStr);
1528 }
1529 }
1530
1531 SHELL_FREE_NON_NULL (TempStr);
1532
1533 Status = EfiAdptrInfoProtocol->GetInformation (
1534 EfiAdptrInfoProtocol,
1535 &InfoTypesBuffer[GuidIndex],
1536 &InformationBlock,
1537 &InformationBlockSize
1538 );
1539
1540 if (EFI_ERROR (Status)) {
1541 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GETINFO_FAILED), NULL);
1542 if (TempStr == NULL) {
1543 goto ERROR_EXIT;
1544 }
1545
1546 TempRetVal = CatSPrint (RetVal, TempStr, Status);
1547 SHELL_FREE_NON_NULL (RetVal);
1548 RetVal = TempRetVal;
1549 } else {
1550 if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoMediaStateGuid)) {
1551 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_MEDIA_STATE), NULL);
1552 if (TempStr == NULL) {
1553 goto ERROR_EXIT;
1554 }
1555
1556 TempRetVal = CatSPrint (
1557 RetVal,
1558 TempStr,
1559 ((EFI_ADAPTER_INFO_MEDIA_STATE *)InformationBlock)->MediaState,
1560 ((EFI_ADAPTER_INFO_MEDIA_STATE *)InformationBlock)->MediaState
1561 );
1562 SHELL_FREE_NON_NULL (RetVal);
1563 RetVal = TempRetVal;
1564 } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoNetworkBootGuid)) {
1565 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_NETWORK_BOOT_INFO), NULL);
1566 if (TempStr == NULL) {
1567 goto ERROR_EXIT;
1568 }
1569
1570 TempRetVal = CatSPrint (
1571 RetVal,
1572 TempStr,
1573 ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv4BootCapablity,
1574 ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv6BootCapablity,
1575 ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->FCoeBootCapablity,
1576 ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->OffloadCapability,
1577 ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiMpioCapability,
1578 ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv4Boot,
1579 ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv6Boot,
1580 ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->FCoeBoot
1581 );
1582 SHELL_FREE_NON_NULL (RetVal);
1583 RetVal = TempRetVal;
1584 } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoSanMacAddressGuid) == TRUE) {
1585 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_SAN_MAC_ADDRESS_INFO), NULL);
1586 if (TempStr == NULL) {
1587 goto ERROR_EXIT;
1588 }
1589
1590 TempRetVal = CatSPrint (
1591 RetVal,
1592 TempStr,
1593 ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[0],
1594 ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[1],
1595 ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[2],
1596 ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[3],
1597 ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[4],
1598 ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[5]
1599 );
1600 SHELL_FREE_NON_NULL (RetVal);
1601 RetVal = TempRetVal;
1602 } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoUndiIpv6SupportGuid) == TRUE) {
1603 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_UNDI_IPV6_INFO), NULL);
1604 if (TempStr == NULL) {
1605 goto ERROR_EXIT;
1606 }
1607
1608 TempRetVal = CatSPrint (
1609 RetVal,
1610 TempStr,
1611 ((EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT *)InformationBlock)->Ipv6Support
1612 );
1613 SHELL_FREE_NON_NULL (RetVal);
1614 RetVal = TempRetVal;
1615 } else {
1616 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_UNKNOWN_INFO_TYPE), NULL);
1617 if (TempStr == NULL) {
1618 goto ERROR_EXIT;
1619 }
1620
1621 TempRetVal = CatSPrint (RetVal, TempStr, &InfoTypesBuffer[GuidIndex]);
1622 SHELL_FREE_NON_NULL (RetVal);
1623 RetVal = TempRetVal;
1624 }
1625 }
1626
1627 SHELL_FREE_NON_NULL (TempStr);
1628 SHELL_FREE_NON_NULL (InformationBlock);
1629 }
1630 }
1631
1632 SHELL_FREE_NON_NULL (InfoTypesBuffer);
1633 return RetVal;
1634
1635ERROR_EXIT:
1636 SHELL_FREE_NON_NULL (RetVal);
1637 SHELL_FREE_NON_NULL (InfoTypesBuffer);
1638 SHELL_FREE_NON_NULL (InformationBlock);
1639 return NULL;
1640}
1641
1650CHAR16 *
1651EFIAPI
1653 IN CONST EFI_HANDLE TheHandle,
1654 IN CONST BOOLEAN Verbose
1655 )
1656{
1657 EFI_STATUS Status;
1658 EFI_FIRMWARE_MANAGEMENT_PROTOCOL *EfiFwMgmtProtocol;
1662 UINT64 AttributeSetting;
1663 UINTN ImageInfoSize;
1664 UINTN DescriptorSize;
1665 UINT32 DescriptorVersion;
1666 UINT32 PackageVersion;
1667 UINT8 DescriptorCount;
1668 UINT8 Index;
1669 UINT8 Index1;
1670 UINT8 ImageCount;
1671 CHAR16 *PackageVersionName;
1672 CHAR16 *TempStr;
1673 CHAR16 *RetVal;
1674 CHAR16 *TempRetVal;
1675 CHAR16 *AttributeSettingStr;
1676 BOOLEAN Found;
1677 BOOLEAN AttributeSupported;
1678
1679 //
1680 // Initialize local variables
1681 //
1682 ImageCount = 0;
1683 ImageInfoSize = 1;
1684 AttributeSetting = 0;
1685 Found = FALSE;
1686 AttributeSupported = FALSE;
1687 ImageInfo = NULL;
1688 ImageInfoV1 = NULL;
1689 ImageInfoV2 = NULL;
1690 PackageVersionName = NULL;
1691 RetVal = NULL;
1692 TempRetVal = NULL;
1693 TempStr = NULL;
1694 AttributeSettingStr = NULL;
1695
1696 if (!Verbose) {
1697 return (CatSPrint (NULL, L"FirmwareManagement"));
1698 }
1699
1700 Status = gBS->OpenProtocol (
1701 (EFI_HANDLE)(TheHandle),
1702 &gEfiFirmwareManagementProtocolGuid,
1703 (VOID **)&EfiFwMgmtProtocol,
1704 NULL,
1705 NULL,
1706 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1707 );
1708
1709 if (EFI_ERROR (Status)) {
1710 return NULL;
1711 }
1712
1713 Status = EfiFwMgmtProtocol->GetImageInfo (
1714 EfiFwMgmtProtocol,
1715 &ImageInfoSize,
1716 ImageInfo,
1717 &DescriptorVersion,
1718 &DescriptorCount,
1719 &DescriptorSize,
1720 &PackageVersion,
1721 &PackageVersionName
1722 );
1723
1724 if (Status == EFI_BUFFER_TOO_SMALL) {
1725 ImageInfo = AllocateZeroPool (ImageInfoSize);
1726
1727 if (ImageInfo == NULL) {
1728 Status = EFI_OUT_OF_RESOURCES;
1729 } else {
1730 Status = EfiFwMgmtProtocol->GetImageInfo (
1731 EfiFwMgmtProtocol,
1732 &ImageInfoSize,
1733 ImageInfo,
1734 &DescriptorVersion,
1735 &DescriptorCount,
1736 &DescriptorSize,
1737 &PackageVersion,
1738 &PackageVersionName
1739 );
1740 }
1741 }
1742
1743 if (EFI_ERROR (Status)) {
1744 goto ERROR_EXIT;
1745 }
1746
1747 //
1748 // Decode Image Descriptor data only if its version is supported
1749 //
1750 if (DescriptorVersion <= EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION) {
1751 if (ImageInfo == NULL) {
1752 goto ERROR_EXIT;
1753 }
1754
1755 ImageInfoV1 = (EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1 *)ImageInfo;
1756 ImageInfoV2 = (EFI_FIRMWARE_IMAGE_DESCRIPTOR_V2 *)ImageInfo;
1757
1758 //
1759 // Set ImageInfoSize in return buffer
1760 //
1761 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_IMAGE_INFO_SIZE), NULL);
1762 if (TempStr == NULL) {
1763 goto ERROR_EXIT;
1764 }
1765
1766 RetVal = CatSPrint (NULL, TempStr, ImageInfoSize);
1767 if (RetVal == NULL) {
1768 goto ERROR_EXIT;
1769 }
1770
1771 SHELL_FREE_NON_NULL (TempStr);
1772
1773 //
1774 // Set DescriptorVersion in return buffer
1775 //
1776 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_DESCRIPTOR_VERSION), NULL);
1777 if (TempStr == NULL) {
1778 goto ERROR_EXIT;
1779 }
1780
1781 TempRetVal = CatSPrint (RetVal, TempStr, DescriptorVersion);
1782 SHELL_FREE_NON_NULL (RetVal);
1783 RetVal = TempRetVal;
1784 SHELL_FREE_NON_NULL (TempStr);
1785
1786 //
1787 // Set DescriptorCount in return buffer
1788 //
1789 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_DESCRIPTOR_COUNT), NULL);
1790 if (TempStr == NULL) {
1791 goto ERROR_EXIT;
1792 }
1793
1794 TempRetVal = CatSPrint (RetVal, TempStr, DescriptorCount);
1795 SHELL_FREE_NON_NULL (RetVal);
1796 RetVal = TempRetVal;
1797 SHELL_FREE_NON_NULL (TempStr);
1798
1799 //
1800 // Set DescriptorSize in return buffer
1801 //
1802 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_DESCRIPTOR_SIZE), NULL);
1803 if (TempStr == NULL) {
1804 goto ERROR_EXIT;
1805 }
1806
1807 TempRetVal = CatSPrint (RetVal, TempStr, DescriptorSize);
1808 SHELL_FREE_NON_NULL (RetVal);
1809 RetVal = TempRetVal;
1810 SHELL_FREE_NON_NULL (TempStr);
1811
1812 //
1813 // Set PackageVersion in return buffer
1814 //
1815 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_PACKAGE_VERSION), NULL);
1816 if (TempStr == NULL) {
1817 goto ERROR_EXIT;
1818 }
1819
1820 TempRetVal = CatSPrint (RetVal, TempStr, PackageVersion);
1821 SHELL_FREE_NON_NULL (RetVal);
1822 RetVal = TempRetVal;
1823 SHELL_FREE_NON_NULL (TempStr);
1824
1825 //
1826 // Set PackageVersionName in return buffer
1827 //
1828 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_PACKAGE_VERSION_NAME), NULL);
1829 if (TempStr == NULL) {
1830 goto ERROR_EXIT;
1831 }
1832
1833 TempRetVal = CatSPrint (RetVal, TempStr, PackageVersionName);
1834 SHELL_FREE_NON_NULL (RetVal);
1835 RetVal = TempRetVal;
1836 SHELL_FREE_NON_NULL (TempStr);
1837
1838 for (Index = 0; Index < DescriptorCount; Index++) {
1839 //
1840 // First check if Attribute is supported
1841 // and generate a string for AttributeSetting field
1842 //
1843 SHELL_FREE_NON_NULL (AttributeSettingStr);
1844 AttributeSupported = FALSE;
1845 AttributeSetting = 0;
1846 if (DescriptorVersion == EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1) {
1847 if (ImageInfoV1[Index].AttributesSupported != 0x0) {
1848 AttributeSupported = TRUE;
1849 AttributeSetting = ImageInfoV1[Index].AttributesSetting;
1850 }
1851 } else if (DescriptorVersion == EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V2) {
1852 if (ImageInfoV2[Index].AttributesSupported != 0x0) {
1853 AttributeSupported = TRUE;
1854 AttributeSetting = ImageInfoV2[Index].AttributesSetting;
1855 }
1856 } else {
1857 if (ImageInfo[Index].AttributesSupported != 0x0) {
1858 AttributeSupported = TRUE;
1859 AttributeSetting = ImageInfo[Index].AttributesSetting;
1860 }
1861 }
1862
1863 if (!AttributeSupported) {
1864 AttributeSettingStr = CatSPrint (NULL, L"None");
1865 } else {
1866 AttributeSettingStr = CatSPrint (NULL, L"(");
1867
1868 if (AttributeSettingStr == NULL) {
1869 goto ERROR_EXIT;
1870 }
1871
1872 if ((AttributeSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != 0x0) {
1873 TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_IMAGE_UPDATABLE");
1874 if (TempRetVal == NULL) {
1875 goto ERROR_EXIT;
1876 }
1877
1878 SHELL_FREE_NON_NULL (AttributeSettingStr);
1879 AttributeSettingStr = TempRetVal;
1880 }
1881
1882 if ((AttributeSetting & IMAGE_ATTRIBUTE_RESET_REQUIRED) != 0x0) {
1883 TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_RESET_REQUIRED");
1884 if (TempRetVal == NULL) {
1885 goto ERROR_EXIT;
1886 }
1887
1888 SHELL_FREE_NON_NULL (AttributeSettingStr);
1889 AttributeSettingStr = TempRetVal;
1890 }
1891
1892 if ((AttributeSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != 0x0) {
1893 TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED");
1894 if (TempRetVal == NULL) {
1895 goto ERROR_EXIT;
1896 }
1897
1898 SHELL_FREE_NON_NULL (AttributeSettingStr);
1899 AttributeSettingStr = TempRetVal;
1900 }
1901
1902 if ((AttributeSetting & IMAGE_ATTRIBUTE_IN_USE) != 0x0) {
1903 TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_IN_USE");
1904 if (TempRetVal == NULL) {
1905 goto ERROR_EXIT;
1906 }
1907
1908 SHELL_FREE_NON_NULL (AttributeSettingStr);
1909 AttributeSettingStr = TempRetVal;
1910 }
1911
1912 if ((AttributeSetting & IMAGE_ATTRIBUTE_UEFI_IMAGE) != 0x0) {
1913 TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_UEFI_IMAGE");
1914 if (TempRetVal == NULL) {
1915 goto ERROR_EXIT;
1916 }
1917
1918 SHELL_FREE_NON_NULL (AttributeSettingStr);
1919 AttributeSettingStr = TempRetVal;
1920 }
1921
1922 TempRetVal = CatSPrint (AttributeSettingStr, L" )");
1923 if (TempRetVal == NULL) {
1924 goto ERROR_EXIT;
1925 }
1926
1927 SHELL_FREE_NON_NULL (AttributeSettingStr);
1928 AttributeSettingStr = TempRetVal;
1929 }
1930
1931 if (DescriptorVersion == EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1) {
1932 if (ImageInfoV1[Index].ImageIndex != 0x0) {
1933 ImageCount++;
1934 }
1935
1936 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_IMAGE_DESCRIPTOR_INFO_V1), NULL);
1937 if (TempStr == NULL) {
1938 goto ERROR_EXIT;
1939 }
1940
1941 TempRetVal = CatSPrint (
1942 RetVal,
1943 TempStr,
1944 Index,
1945 ImageInfoV1[Index].ImageIndex,
1946 &ImageInfoV1[Index].ImageTypeId,
1947 ImageInfoV1[Index].ImageId,
1948 ImageInfoV1[Index].ImageIdName,
1949 ImageInfoV1[Index].Version,
1950 ImageInfoV1[Index].VersionName,
1951 ImageInfoV1[Index].Size,
1952 ImageInfoV1[Index].AttributesSupported,
1953 AttributeSettingStr,
1954 ImageInfoV1[Index].Compatibilities
1955 );
1956 SHELL_FREE_NON_NULL (RetVal);
1957 RetVal = TempRetVal;
1958 SHELL_FREE_NON_NULL (TempStr);
1959 } else if (DescriptorVersion == EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V2) {
1960 if (ImageInfoV2[Index].ImageIndex != 0x0) {
1961 ImageCount++;
1962 }
1963
1964 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_IMAGE_DESCRIPTOR_INFO_V2), NULL);
1965 if (TempStr == NULL) {
1966 goto ERROR_EXIT;
1967 }
1968
1969 TempRetVal = CatSPrint (
1970 RetVal,
1971 TempStr,
1972 Index,
1973 ImageInfoV2[Index].ImageIndex,
1974 &ImageInfoV2[Index].ImageTypeId,
1975 ImageInfoV2[Index].ImageId,
1976 ImageInfoV2[Index].ImageIdName,
1977 ImageInfoV2[Index].Version,
1978 ImageInfoV2[Index].VersionName,
1979 ImageInfoV2[Index].Size,
1980 ImageInfoV2[Index].AttributesSupported,
1981 AttributeSettingStr,
1982 ImageInfoV2[Index].Compatibilities,
1983 ImageInfoV2[Index].LowestSupportedImageVersion
1984 );
1985 SHELL_FREE_NON_NULL (RetVal);
1986 RetVal = TempRetVal;
1987 SHELL_FREE_NON_NULL (TempStr);
1988 } else {
1989 if (ImageInfo[Index].ImageIndex != 0x0) {
1990 ImageCount++;
1991 }
1992
1993 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_IMAGE_DESCRIPTOR_INFO), NULL);
1994 if (TempStr == NULL) {
1995 goto ERROR_EXIT;
1996 }
1997
1998 TempRetVal = CatSPrint (
1999 RetVal,
2000 TempStr,
2001 Index,
2002 ImageInfo[Index].ImageIndex,
2003 &ImageInfo[Index].ImageTypeId,
2004 ImageInfo[Index].ImageId,
2005 ImageInfo[Index].ImageIdName,
2006 ImageInfo[Index].Version,
2007 ImageInfo[Index].VersionName,
2008 ImageInfo[Index].Size,
2009 ImageInfo[Index].AttributesSupported,
2010 AttributeSettingStr,
2011 ImageInfo[Index].Compatibilities,
2012 ImageInfo[Index].LowestSupportedImageVersion,
2013 ImageInfo[Index].LastAttemptVersion,
2014 ImageInfo[Index].LastAttemptStatus,
2015 ImageInfo[Index].HardwareInstance
2016 );
2017 SHELL_FREE_NON_NULL (RetVal);
2018 RetVal = TempRetVal;
2019 SHELL_FREE_NON_NULL (TempStr);
2020 }
2021 }
2022 }
2023
2024 if (ImageCount > 0) {
2025 for (Index = 0; Index < DescriptorCount; Index++) {
2026 for (Index1 = Index+1; Index1 < DescriptorCount; Index1++) {
2027 if (DescriptorVersion == EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1) {
2028 if (ImageInfoV1[Index].ImageId == ImageInfoV1[Index1].ImageId) {
2029 Found = TRUE;
2030 //
2031 // At least one match found indicating presense of non unique ImageId values so no more comparisons needed
2032 //
2033 goto ENDLOOP;
2034 }
2035 } else if (DescriptorVersion == EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V2) {
2036 if (ImageInfoV2[Index].ImageId == ImageInfoV2[Index1].ImageId) {
2037 Found = TRUE;
2038 //
2039 // At least one match found indicating presense of non unique ImageId values so no more comparisons needed
2040 //
2041 goto ENDLOOP;
2042 }
2043 } else {
2044 if (ImageInfo[Index].ImageId == ImageInfo[Index1].ImageId) {
2045 Found = TRUE;
2046 //
2047 // At least one match found indicating presense of non unique ImageId values so no more comparisons needed
2048 //
2049 goto ENDLOOP;
2050 }
2051 }
2052 }
2053 }
2054 }
2055
2056ENDLOOP:
2057 //
2058 // Check if ImageId with duplicate value was found
2059 //
2060 if (Found) {
2061 TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_IMAGEID_NON_UNIQUE), NULL);
2062 if (TempStr == NULL) {
2063 goto ERROR_EXIT;
2064 }
2065
2066 TempRetVal = CatSPrint (RetVal, TempStr);
2067 SHELL_FREE_NON_NULL (RetVal);
2068 RetVal = TempRetVal;
2069 SHELL_FREE_NON_NULL (TempStr);
2070 }
2071
2072 SHELL_FREE_NON_NULL (ImageInfo);
2073 SHELL_FREE_NON_NULL (PackageVersionName);
2074 SHELL_FREE_NON_NULL (AttributeSettingStr);
2075
2076 return RetVal;
2077
2078ERROR_EXIT:
2079 SHELL_FREE_NON_NULL (RetVal);
2080 SHELL_FREE_NON_NULL (ImageInfo);
2081 SHELL_FREE_NON_NULL (PackageVersionName);
2082 SHELL_FREE_NON_NULL (AttributeSettingStr);
2083
2084 return NULL;
2085}
2086
2097CHAR16 *
2098EFIAPI
2100 IN CONST EFI_HANDLE TheHandle,
2101 IN CONST BOOLEAN Verbose
2102 )
2103{
2104 EFI_STATUS Status;
2105 EFI_PARTITION_INFO_PROTOCOL *PartitionInfo;
2106 CHAR16 *PartitionType;
2107 CHAR16 *EfiSystemPartition;
2108 CHAR16 *RetVal;
2109
2110 if (!Verbose) {
2111 return NULL;
2112 }
2113
2114 Status = gBS->OpenProtocol (
2115 TheHandle,
2117 (VOID **)&PartitionInfo,
2119 NULL,
2120 EFI_OPEN_PROTOCOL_GET_PROTOCOL
2121 );
2122 if (EFI_ERROR (Status)) {
2123 return NULL;
2124 }
2125
2127
2128 switch (PartitionInfo->Type) {
2129 case PARTITION_TYPE_OTHER:
2130 PartitionType = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PARTINFO_DUMP_TYPE_OTHER), NULL);
2131 break;
2132 case PARTITION_TYPE_MBR:
2133 PartitionType = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PARTINFO_DUMP_TYPE_MBR), NULL);
2134 break;
2135 case PARTITION_TYPE_GPT:
2136 PartitionType = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PARTINFO_DUMP_TYPE_GPT), NULL);
2137 break;
2138 default:
2139 PartitionType = NULL;
2140 break;
2141 }
2142
2143 if (PartitionType == NULL) {
2144 return NULL;
2145 }
2146
2147 if (PartitionInfo->System == 1) {
2148 EfiSystemPartition = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PARTINFO_DUMP_EFI_SYS_PART), NULL);
2149 } else {
2150 EfiSystemPartition = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PARTINFO_DUMP_NOT_EFI_SYS_PART), NULL);
2151 }
2152
2153 if (EfiSystemPartition == NULL) {
2154 SHELL_FREE_NON_NULL (PartitionType);
2155 return NULL;
2156 }
2157
2158 RetVal = CatSPrint (
2159 NULL,
2160 L"%s\r\n%s",
2161 PartitionType,
2162 EfiSystemPartition
2163 );
2164
2165 SHELL_FREE_NON_NULL (EfiSystemPartition);
2166 SHELL_FREE_NON_NULL (PartitionType);
2167 return RetVal;
2168}
2169
2170//
2171// Put the information on the NT32 protocol GUIDs here so we are not dependant on the Nt32Pkg
2172//
2173#define LOCAL_EFI_WIN_NT_THUNK_PROTOCOL_GUID \
2174 { \
2175 0x58c518b1, 0x76f3, 0x11d4, { 0xbc, 0xea, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
2176 }
2177
2178#define LOCAL_EFI_WIN_NT_BUS_DRIVER_IO_PROTOCOL_GUID \
2179 { \
2180 0x96eb4ad6, 0xa32a, 0x11d4, { 0xbc, 0xfd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
2181 }
2182
2183#define LOCAL_EFI_WIN_NT_SERIAL_PORT_GUID \
2184 { \
2185 0xc95a93d, 0xa006, 0x11d4, { 0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
2186 }
2187STATIC CONST EFI_GUID WinNtThunkProtocolGuid = LOCAL_EFI_WIN_NT_THUNK_PROTOCOL_GUID;
2188STATIC CONST EFI_GUID WinNtIoProtocolGuid = LOCAL_EFI_WIN_NT_BUS_DRIVER_IO_PROTOCOL_GUID;
2189STATIC CONST EFI_GUID WinNtSerialPortGuid = LOCAL_EFI_WIN_NT_SERIAL_PORT_GUID;
2190
2191//
2192// Deprecated protocols we dont want to link from IntelFrameworkModulePkg
2193//
2194#define LOCAL_EFI_ISA_IO_PROTOCOL_GUID \
2195 { \
2196 0x7ee2bd44, 0x3da0, 0x11d4, { 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
2197 }
2198#define LOCAL_EFI_ISA_ACPI_PROTOCOL_GUID \
2199 { \
2200 0x64a892dc, 0x5561, 0x4536, { 0x92, 0xc7, 0x79, 0x9b, 0xfc, 0x18, 0x33, 0x55 } \
2201 }
2202STATIC CONST EFI_GUID EfiIsaIoProtocolGuid = LOCAL_EFI_ISA_IO_PROTOCOL_GUID;
2203STATIC CONST EFI_GUID EfiIsaAcpiProtocolGuid = LOCAL_EFI_ISA_ACPI_PROTOCOL_GUID;
2204
2205STATIC CONST GUID_INFO_BLOCK mGuidStringListNT[] = {
2206 { STRING_TOKEN (STR_WINNT_THUNK), (EFI_GUID *)&WinNtThunkProtocolGuid, NULL },
2207 { STRING_TOKEN (STR_WINNT_DRIVER_IO), (EFI_GUID *)&WinNtIoProtocolGuid, NULL },
2208 { STRING_TOKEN (STR_WINNT_SERIAL_PORT), (EFI_GUID *)&WinNtSerialPortGuid, NULL },
2209 { 0, NULL, NULL },
2210};
2211
2212STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
2213 { STRING_TOKEN (STR_LOADED_IMAGE), &gEfiLoadedImageProtocolGuid, LoadedImageProtocolDumpInformation },
2214 { STRING_TOKEN (STR_DEVICE_PATH), &gEfiDevicePathProtocolGuid, DevicePathProtocolDumpInformation },
2215 { STRING_TOKEN (STR_IMAGE_PATH), &gEfiLoadedImageDevicePathProtocolGuid, LoadedImageDevicePathProtocolDumpInformation },
2216 { STRING_TOKEN (STR_DEVICE_PATH_UTIL), &gEfiDevicePathUtilitiesProtocolGuid, NULL },
2217 { STRING_TOKEN (STR_DEVICE_PATH_TXT), &gEfiDevicePathToTextProtocolGuid, NULL },
2218 { STRING_TOKEN (STR_DEVICE_PATH_FTXT), &gEfiDevicePathFromTextProtocolGuid, NULL },
2219 { STRING_TOKEN (STR_DEVICE_PATH_PC), &gEfiPcAnsiGuid, NULL },
2220 { STRING_TOKEN (STR_DEVICE_PATH_VT100), &gEfiVT100Guid, NULL },
2221 { STRING_TOKEN (STR_DEVICE_PATH_VT100P), &gEfiVT100PlusGuid, NULL },
2222 { STRING_TOKEN (STR_DEVICE_PATH_VTUTF8), &gEfiVTUTF8Guid, NULL },
2223 { STRING_TOKEN (STR_DRIVER_BINDING), &gEfiDriverBindingProtocolGuid, NULL },
2224 { STRING_TOKEN (STR_PLATFORM_OVERRIDE), &gEfiPlatformDriverOverrideProtocolGuid, NULL },
2225 { STRING_TOKEN (STR_BUS_OVERRIDE), &gEfiBusSpecificDriverOverrideProtocolGuid, BusSpecificDriverOverrideProtocolDumpInformation },
2226 { STRING_TOKEN (STR_DRIVER_DIAG), &gEfiDriverDiagnosticsProtocolGuid, NULL },
2227 { STRING_TOKEN (STR_DRIVER_DIAG2), &gEfiDriverDiagnostics2ProtocolGuid, NULL },
2228 { STRING_TOKEN (STR_DRIVER_CN), &gEfiComponentNameProtocolGuid, NULL },
2229 { STRING_TOKEN (STR_DRIVER_CN2), &gEfiComponentName2ProtocolGuid, NULL },
2230 { STRING_TOKEN (STR_PLAT_DRV_CFG), &gEfiPlatformToDriverConfigurationProtocolGuid, NULL },
2231 { STRING_TOKEN (STR_DRIVER_VERSION), &gEfiDriverSupportedEfiVersionProtocolGuid, DriverEfiVersionProtocolDumpInformation },
2232 { STRING_TOKEN (STR_TXT_IN), &gEfiSimpleTextInProtocolGuid, NULL },
2233 { STRING_TOKEN (STR_TXT_IN_EX), &gEfiSimpleTextInputExProtocolGuid, NULL },
2234 { STRING_TOKEN (STR_TXT_OUT), &gEfiSimpleTextOutProtocolGuid, TxtOutProtocolDumpInformation },
2235 { STRING_TOKEN (STR_SIM_POINTER), &gEfiSimplePointerProtocolGuid, NULL },
2236 { STRING_TOKEN (STR_ABS_POINTER), &gEfiAbsolutePointerProtocolGuid, NULL },
2237 { STRING_TOKEN (STR_SERIAL_IO), &gEfiSerialIoProtocolGuid, NULL },
2238 { STRING_TOKEN (STR_GRAPHICS_OUTPUT), &gEfiGraphicsOutputProtocolGuid, GraphicsOutputProtocolDumpInformation },
2239 { STRING_TOKEN (STR_EDID_DISCOVERED), &gEfiEdidDiscoveredProtocolGuid, EdidDiscoveredProtocolDumpInformation },
2240 { STRING_TOKEN (STR_EDID_ACTIVE), &gEfiEdidActiveProtocolGuid, EdidActiveProtocolDumpInformation },
2241 { STRING_TOKEN (STR_EDID_OVERRIDE), &gEfiEdidOverrideProtocolGuid, NULL },
2242 { STRING_TOKEN (STR_CON_IN), &gEfiConsoleInDeviceGuid, NULL },
2243 { STRING_TOKEN (STR_CON_OUT), &gEfiConsoleOutDeviceGuid, NULL },
2244 { STRING_TOKEN (STR_STD_ERR), &gEfiStandardErrorDeviceGuid, NULL },
2245 { STRING_TOKEN (STR_LOAD_FILE), &gEfiLoadFileProtocolGuid, NULL },
2246 { STRING_TOKEN (STR_LOAD_FILE2), &gEfiLoadFile2ProtocolGuid, NULL },
2247 { STRING_TOKEN (STR_SIMPLE_FILE_SYS), &gEfiSimpleFileSystemProtocolGuid, NULL },
2248 { STRING_TOKEN (STR_TAPE_IO), &gEfiTapeIoProtocolGuid, NULL },
2249 { STRING_TOKEN (STR_DISK_IO), &gEfiDiskIoProtocolGuid, NULL },
2250 { STRING_TOKEN (STR_BLK_IO), &gEfiBlockIoProtocolGuid, BlockIoProtocolDumpInformation },
2251 { STRING_TOKEN (STR_UC), &gEfiUnicodeCollationProtocolGuid, NULL },
2252 { STRING_TOKEN (STR_UC2), &gEfiUnicodeCollation2ProtocolGuid, NULL },
2253 { STRING_TOKEN (STR_PCIRB_IO), &gEfiPciRootBridgeIoProtocolGuid, PciRootBridgeIoDumpInformation },
2254 { STRING_TOKEN (STR_PCI_IO), &gEfiPciIoProtocolGuid, PciIoProtocolDumpInformation },
2255 { STRING_TOKEN (STR_SCSI_PT), &gEfiScsiPassThruProtocolGuid, NULL },
2256 { STRING_TOKEN (STR_SCSI_IO), &gEfiScsiIoProtocolGuid, NULL },
2257 { STRING_TOKEN (STR_SCSI_PT_EXT), &gEfiExtScsiPassThruProtocolGuid, NULL },
2258 { STRING_TOKEN (STR_ISCSI), &gEfiIScsiInitiatorNameProtocolGuid, NULL },
2259 { STRING_TOKEN (STR_USB_IO), &gEfiUsbIoProtocolGuid, UsbIoProtocolDumpInformation },
2260 { STRING_TOKEN (STR_USB_HC), &gEfiUsbHcProtocolGuid, NULL },
2261 { STRING_TOKEN (STR_USB_HC2), &gEfiUsb2HcProtocolGuid, NULL },
2262 { STRING_TOKEN (STR_DEBUG_SUPPORT), &gEfiDebugSupportProtocolGuid, DebugSupportProtocolDumpInformation },
2263 { STRING_TOKEN (STR_DEBUG_PORT), &gEfiDebugPortProtocolGuid, NULL },
2264 { STRING_TOKEN (STR_DECOMPRESS), &gEfiDecompressProtocolGuid, NULL },
2265 { STRING_TOKEN (STR_ACPI_TABLE), &gEfiAcpiTableProtocolGuid, NULL },
2266 { STRING_TOKEN (STR_EBC_INTERPRETER), &gEfiEbcProtocolGuid, NULL },
2267 { STRING_TOKEN (STR_SNP), &gEfiSimpleNetworkProtocolGuid, NULL },
2268 { STRING_TOKEN (STR_NII), &gEfiNetworkInterfaceIdentifierProtocolGuid, NULL },
2269 { STRING_TOKEN (STR_NII_31), &gEfiNetworkInterfaceIdentifierProtocolGuid_31, NULL },
2270 { STRING_TOKEN (STR_PXE_BC), &gEfiPxeBaseCodeProtocolGuid, NULL },
2271 { STRING_TOKEN (STR_PXE_CB), &gEfiPxeBaseCodeCallbackProtocolGuid, NULL },
2272 { STRING_TOKEN (STR_BIS), &gEfiBisProtocolGuid, NULL },
2273 { STRING_TOKEN (STR_MNP_SB), &gEfiManagedNetworkServiceBindingProtocolGuid, NULL },
2274 { STRING_TOKEN (STR_MNP), &gEfiManagedNetworkProtocolGuid, NULL },
2275 { STRING_TOKEN (STR_ARP_SB), &gEfiArpServiceBindingProtocolGuid, NULL },
2276 { STRING_TOKEN (STR_ARP), &gEfiArpProtocolGuid, NULL },
2277 { STRING_TOKEN (STR_DHCPV4_SB), &gEfiDhcp4ServiceBindingProtocolGuid, NULL },
2278 { STRING_TOKEN (STR_DHCPV4), &gEfiDhcp4ProtocolGuid, NULL },
2279 { STRING_TOKEN (STR_TCPV4_SB), &gEfiTcp4ServiceBindingProtocolGuid, NULL },
2280 { STRING_TOKEN (STR_TCPV4), &gEfiTcp4ProtocolGuid, NULL },
2281 { STRING_TOKEN (STR_IPV4_SB), &gEfiIp4ServiceBindingProtocolGuid, NULL },
2282 { STRING_TOKEN (STR_IPV4), &gEfiIp4ProtocolGuid, NULL },
2283 { STRING_TOKEN (STR_IPV4_CFG), &gEfiIp4ConfigProtocolGuid, NULL },
2284 { STRING_TOKEN (STR_IPV4_CFG2), &gEfiIp4Config2ProtocolGuid, NULL },
2285 { STRING_TOKEN (STR_UDPV4_SB), &gEfiUdp4ServiceBindingProtocolGuid, NULL },
2286 { STRING_TOKEN (STR_UDPV4), &gEfiUdp4ProtocolGuid, NULL },
2287 { STRING_TOKEN (STR_MTFTPV4_SB), &gEfiMtftp4ServiceBindingProtocolGuid, NULL },
2288 { STRING_TOKEN (STR_MTFTPV4), &gEfiMtftp4ProtocolGuid, NULL },
2289 { STRING_TOKEN (STR_AUTH_INFO), &gEfiAuthenticationInfoProtocolGuid, NULL },
2290 { STRING_TOKEN (STR_HASH_SB), &gEfiHashServiceBindingProtocolGuid, NULL },
2291 { STRING_TOKEN (STR_HASH), &gEfiHashProtocolGuid, NULL },
2292 { STRING_TOKEN (STR_HII_FONT), &gEfiHiiFontProtocolGuid, NULL },
2293 { STRING_TOKEN (STR_HII_STRING), &gEfiHiiStringProtocolGuid, NULL },
2294 { STRING_TOKEN (STR_HII_IMAGE), &gEfiHiiImageProtocolGuid, NULL },
2295 { STRING_TOKEN (STR_HII_DATABASE), &gEfiHiiDatabaseProtocolGuid, NULL },
2296 { STRING_TOKEN (STR_HII_CONFIG_ROUT), &gEfiHiiConfigRoutingProtocolGuid, NULL },
2297 { STRING_TOKEN (STR_HII_CONFIG_ACC), &gEfiHiiConfigAccessProtocolGuid, NULL },
2298 { STRING_TOKEN (STR_HII_FORM_BROWSER2), &gEfiFormBrowser2ProtocolGuid, NULL },
2299 { STRING_TOKEN (STR_DRIVER_FAM_OVERRIDE), &gEfiDriverFamilyOverrideProtocolGuid, NULL },
2300 { STRING_TOKEN (STR_PCD), &gPcdProtocolGuid, NULL },
2301 { STRING_TOKEN (STR_TCG), &gEfiTcgProtocolGuid, NULL },
2302 { STRING_TOKEN (STR_HII_PACKAGE_LIST), &gEfiHiiPackageListProtocolGuid, NULL },
2303
2304 //
2305 // the ones under this are deprecated by the current UEFI Spec, but may be found anyways...
2306 //
2307 { STRING_TOKEN (STR_SHELL_INTERFACE), &gEfiShellInterfaceGuid, NULL },
2308 { STRING_TOKEN (STR_SHELL_ENV2), &gEfiShellEnvironment2Guid, NULL },
2309 { STRING_TOKEN (STR_SHELL_ENV), &gEfiShellEnvironment2Guid, NULL },
2310 { STRING_TOKEN (STR_DEVICE_IO), &gEfiDeviceIoProtocolGuid, NULL },
2311 { STRING_TOKEN (STR_UGA_DRAW), &gEfiUgaDrawProtocolGuid, NULL },
2312 { STRING_TOKEN (STR_UGA_IO), &gEfiUgaIoProtocolGuid, NULL },
2313 { STRING_TOKEN (STR_ESP), &gEfiPartTypeSystemPartGuid, NULL },
2314 { STRING_TOKEN (STR_GPT_NBR), &gEfiPartTypeLegacyMbrGuid, NULL },
2315 { STRING_TOKEN (STR_DRIVER_CONFIG), &gEfiDriverConfigurationProtocolGuid, NULL },
2316 { STRING_TOKEN (STR_DRIVER_CONFIG2), &gEfiDriverConfiguration2ProtocolGuid, NULL },
2317
2318 //
2319 // these are using local (non-global) definitions to reduce package dependancy.
2320 //
2321 { STRING_TOKEN (STR_ISA_IO), (EFI_GUID *)&EfiIsaIoProtocolGuid, NULL },
2322 { STRING_TOKEN (STR_ISA_ACPI), (EFI_GUID *)&EfiIsaAcpiProtocolGuid, NULL },
2323
2324 //
2325 // the ones under this are GUID identified structs, not protocols
2326 //
2327 { STRING_TOKEN (STR_FILE_INFO), &gEfiFileInfoGuid, NULL },
2328 { STRING_TOKEN (STR_FILE_SYS_INFO), &gEfiFileSystemInfoGuid, NULL },
2329
2330 //
2331 // the ones under this are misc GUIDS.
2332 //
2333 { STRING_TOKEN (STR_EFI_GLOBAL_VARIABLE), &gEfiGlobalVariableGuid, NULL },
2334
2335 //
2336 // UEFI 2.2
2337 //
2338 { STRING_TOKEN (STR_IP6_SB), &gEfiIp6ServiceBindingProtocolGuid, NULL },
2339 { STRING_TOKEN (STR_IP6), &gEfiIp6ProtocolGuid, NULL },
2340 { STRING_TOKEN (STR_IP6_CONFIG), &gEfiIp6ConfigProtocolGuid, NULL },
2341 { STRING_TOKEN (STR_MTFTP6_SB), &gEfiMtftp6ServiceBindingProtocolGuid, NULL },
2342 { STRING_TOKEN (STR_MTFTP6), &gEfiMtftp6ProtocolGuid, NULL },
2343 { STRING_TOKEN (STR_DHCP6_SB), &gEfiDhcp6ServiceBindingProtocolGuid, NULL },
2344 { STRING_TOKEN (STR_DHCP6), &gEfiDhcp6ProtocolGuid, NULL },
2345 { STRING_TOKEN (STR_UDP6_SB), &gEfiUdp6ServiceBindingProtocolGuid, NULL },
2346 { STRING_TOKEN (STR_UDP6), &gEfiUdp6ProtocolGuid, NULL },
2347 { STRING_TOKEN (STR_TCP6_SB), &gEfiTcp6ServiceBindingProtocolGuid, NULL },
2348 { STRING_TOKEN (STR_TCP6), &gEfiTcp6ProtocolGuid, NULL },
2349 { STRING_TOKEN (STR_VLAN_CONFIG), &gEfiVlanConfigProtocolGuid, NULL },
2350 { STRING_TOKEN (STR_EAP), &gEfiEapProtocolGuid, NULL },
2351 { STRING_TOKEN (STR_EAP_MGMT), &gEfiEapManagementProtocolGuid, NULL },
2352 { STRING_TOKEN (STR_FTP4_SB), &gEfiFtp4ServiceBindingProtocolGuid, NULL },
2353 { STRING_TOKEN (STR_FTP4), &gEfiFtp4ProtocolGuid, NULL },
2354 { STRING_TOKEN (STR_IP_SEC_CONFIG), &gEfiIpSecConfigProtocolGuid, NULL },
2355 { STRING_TOKEN (STR_DH), &gEfiDriverHealthProtocolGuid, NULL },
2356 { STRING_TOKEN (STR_DEF_IMG_LOAD), &gEfiDeferredImageLoadProtocolGuid, NULL },
2357 { STRING_TOKEN (STR_USER_CRED), &gEfiUserCredentialProtocolGuid, NULL },
2358 { STRING_TOKEN (STR_USER_MNGR), &gEfiUserManagerProtocolGuid, NULL },
2359 { STRING_TOKEN (STR_ATA_PASS_THRU), &gEfiAtaPassThruProtocolGuid, NULL },
2360
2361 //
2362 // UEFI 2.3
2363 //
2364 { STRING_TOKEN (STR_FW_MGMT), &gEfiFirmwareManagementProtocolGuid, FirmwareManagementDumpInformation },
2365 { STRING_TOKEN (STR_IP_SEC), &gEfiIpSecProtocolGuid, NULL },
2366 { STRING_TOKEN (STR_IP_SEC2), &gEfiIpSec2ProtocolGuid, NULL },
2367
2368 //
2369 // UEFI 2.3.1
2370 //
2371 { STRING_TOKEN (STR_KMS), &gEfiKmsProtocolGuid, NULL },
2372 { STRING_TOKEN (STR_BLK_IO2), &gEfiBlockIo2ProtocolGuid, NULL },
2373 { STRING_TOKEN (STR_SSC), &gEfiStorageSecurityCommandProtocolGuid, NULL },
2374 { STRING_TOKEN (STR_UCRED2), &gEfiUserCredential2ProtocolGuid, NULL },
2375
2376 //
2377 // UEFI 2.4
2378 //
2379 { STRING_TOKEN (STR_DISK_IO2), &gEfiDiskIo2ProtocolGuid, NULL },
2380 { STRING_TOKEN (STR_ADAPTER_INFO), &gEfiAdapterInformationProtocolGuid, AdapterInformationDumpInformation },
2381
2382 //
2383 // UEFI2.5
2384 //
2385 { STRING_TOKEN (STR_TLS_SB), &gEfiTlsServiceBindingProtocolGuid, NULL },
2386 { STRING_TOKEN (STR_TLS), &gEfiTlsProtocolGuid, NULL },
2387 { STRING_TOKEN (STR_TLS_CONFIG), &gEfiTlsConfigurationProtocolGuid, NULL },
2388 { STRING_TOKEN (STR_SUPPLICANT_SB), &gEfiSupplicantServiceBindingProtocolGuid, NULL },
2389 { STRING_TOKEN (STR_SUPPLICANT), &gEfiSupplicantProtocolGuid, NULL },
2390
2391 //
2392 // UEFI2.6
2393 //
2394 { STRING_TOKEN (STR_WIFI2), &gEfiWiFi2ProtocolGuid, NULL },
2395 { STRING_TOKEN (STR_RAMDISK), &gEfiRamDiskProtocolGuid, NULL },
2396 { STRING_TOKEN (STR_HII_ID), &gEfiHiiImageDecoderProtocolGuid, NULL },
2397 { STRING_TOKEN (STR_HII_IE), &gEfiHiiImageExProtocolGuid, NULL },
2398 { STRING_TOKEN (STR_SD_MPT), &gEfiSdMmcPassThruProtocolGuid, NULL },
2399 { STRING_TOKEN (STR_ERASE_BLOCK), &gEfiEraseBlockProtocolGuid, NULL },
2400
2401 //
2402 // UEFI2.7
2403 //
2404 { STRING_TOKEN (STR_BLUETOOTH_ATTR), &gEfiBluetoothAttributeProtocolGuid, NULL },
2405 { STRING_TOKEN (STR_BLUETOOTH_ATTR_SB), &gEfiBluetoothAttributeServiceBindingProtocolGuid, NULL },
2406 { STRING_TOKEN (STR_BLUETOOTH_LE_CONFIG), &gEfiBluetoothLeConfigProtocolGuid, NULL },
2407 { STRING_TOKEN (STR_UFS_DEV_CONFIG), &gEfiUfsDeviceConfigProtocolGuid, NULL },
2408 { STRING_TOKEN (STR_HTTP_BOOT_CALL), &gEfiHttpBootCallbackProtocolGuid, NULL },
2409 { STRING_TOKEN (STR_RESET_NOTI), &gEfiResetNotificationProtocolGuid, NULL },
2411 { STRING_TOKEN (STR_HII_POPUP), &gEfiHiiPopupProtocolGuid, NULL },
2412
2413 //
2414 // UEFI 2.8
2415 //
2416 { STRING_TOKEN (STR_REST_EX), &gEfiRestExProtocolGuid, NULL },
2417 { STRING_TOKEN (STR_REDFISH_DISCOVER), &gEfiRedfishDiscoverProtocolGuid, NULL },
2418
2419 //
2420 // PI Spec ones
2421 //
2422 { STRING_TOKEN (STR_IDE_CONT_INIT), &gEfiIdeControllerInitProtocolGuid, NULL },
2423 { STRING_TOKEN (STR_DISK_INFO), &gEfiDiskInfoProtocolGuid, NULL },
2424
2425 //
2426 // PI Spec 1.0
2427 //
2428 { STRING_TOKEN (STR_BDS_ARCH), &gEfiBdsArchProtocolGuid, NULL },
2429 { STRING_TOKEN (STR_CPU_ARCH), &gEfiCpuArchProtocolGuid, NULL },
2430 { STRING_TOKEN (STR_MET_ARCH), &gEfiMetronomeArchProtocolGuid, NULL },
2431 { STRING_TOKEN (STR_MON_ARCH), &gEfiMonotonicCounterArchProtocolGuid, NULL },
2432 { STRING_TOKEN (STR_RTC_ARCH), &gEfiRealTimeClockArchProtocolGuid, NULL },
2433 { STRING_TOKEN (STR_RESET_ARCH), &gEfiResetArchProtocolGuid, NULL },
2434 { STRING_TOKEN (STR_RT_ARCH), &gEfiRuntimeArchProtocolGuid, NULL },
2435 { STRING_TOKEN (STR_SEC_ARCH), &gEfiSecurityArchProtocolGuid, NULL },
2436 { STRING_TOKEN (STR_TIMER_ARCH), &gEfiTimerArchProtocolGuid, NULL },
2437 { STRING_TOKEN (STR_VAR_ARCH), &gEfiVariableWriteArchProtocolGuid, NULL },
2438 { STRING_TOKEN (STR_V_ARCH), &gEfiVariableArchProtocolGuid, NULL },
2439 { STRING_TOKEN (STR_SECP), &gEfiSecurityPolicyProtocolGuid, NULL },
2440 { STRING_TOKEN (STR_WDT_ARCH), &gEfiWatchdogTimerArchProtocolGuid, NULL },
2441 { STRING_TOKEN (STR_SCR), &gEfiStatusCodeRuntimeProtocolGuid, NULL },
2442 { STRING_TOKEN (STR_SMB_HC), &gEfiSmbusHcProtocolGuid, NULL },
2443 { STRING_TOKEN (STR_FV_2), &gEfiFirmwareVolume2ProtocolGuid, NULL },
2444 { STRING_TOKEN (STR_FV_BLOCK), &gEfiFirmwareVolumeBlockProtocolGuid, NULL },
2445 { STRING_TOKEN (STR_CAP_ARCH), &gEfiCapsuleArchProtocolGuid, NULL },
2446 { STRING_TOKEN (STR_MP_SERVICE), &gEfiMpServiceProtocolGuid, NULL },
2447 { STRING_TOKEN (STR_HBRAP), &gEfiPciHostBridgeResourceAllocationProtocolGuid, NULL },
2448 { STRING_TOKEN (STR_PCIP), &gEfiPciPlatformProtocolGuid, NULL },
2449 { STRING_TOKEN (STR_PCIO), &gEfiPciOverrideProtocolGuid, NULL },
2450 { STRING_TOKEN (STR_PCIE), &gEfiPciEnumerationCompleteProtocolGuid, NULL },
2451 { STRING_TOKEN (STR_IPCID), &gEfiIncompatiblePciDeviceSupportProtocolGuid, NULL },
2452 { STRING_TOKEN (STR_PCIHPI), &gEfiPciHotPlugInitProtocolGuid, NULL },
2453 { STRING_TOKEN (STR_PCIHPR), &gEfiPciHotPlugRequestProtocolGuid, NULL },
2454 { STRING_TOKEN (STR_SMBIOS), &gEfiSmbiosProtocolGuid, NULL },
2455 { STRING_TOKEN (STR_S3_SAVE), &gEfiS3SaveStateProtocolGuid, NULL },
2456 { STRING_TOKEN (STR_S3_S_SMM), &gEfiS3SmmSaveStateProtocolGuid, NULL },
2457 { STRING_TOKEN (STR_RSC), &gEfiRscHandlerProtocolGuid, NULL },
2458 { STRING_TOKEN (STR_S_RSC), &gEfiSmmRscHandlerProtocolGuid, NULL },
2459 { STRING_TOKEN (STR_ACPI_SDT), &gEfiAcpiSdtProtocolGuid, NULL },
2460 { STRING_TOKEN (STR_SIO), &gEfiSioProtocolGuid, NULL },
2461 { STRING_TOKEN (STR_S_CPU2), &gEfiSmmCpuIo2ProtocolGuid, NULL },
2462 { STRING_TOKEN (STR_S_BASE2), &gEfiSmmBase2ProtocolGuid, NULL },
2463 { STRING_TOKEN (STR_S_ACC_2), &gEfiSmmAccess2ProtocolGuid, NULL },
2464 { STRING_TOKEN (STR_S_CON_2), &gEfiSmmControl2ProtocolGuid, NULL },
2465 { STRING_TOKEN (STR_S_CONFIG), &gEfiSmmConfigurationProtocolGuid, NULL },
2466 { STRING_TOKEN (STR_S_RTL), &gEfiSmmReadyToLockProtocolGuid, NULL },
2467 { STRING_TOKEN (STR_DS_RTL), &gEfiDxeSmmReadyToLockProtocolGuid, NULL },
2468 { STRING_TOKEN (STR_S_COMM), &gEfiSmmCommunicationProtocolGuid, NULL },
2469 { STRING_TOKEN (STR_S_STAT), &gEfiSmmStatusCodeProtocolGuid, NULL },
2470 { STRING_TOKEN (STR_S_CPU), &gEfiSmmCpuProtocolGuid, NULL },
2471 { STRING_TOKEN (STR_S_PCIRBIO), &gEfiSmmPciRootBridgeIoProtocolGuid, NULL },
2472 { STRING_TOKEN (STR_S_SWD), &gEfiSmmSwDispatch2ProtocolGuid, NULL },
2473 { STRING_TOKEN (STR_S_SXD), &gEfiSmmSxDispatch2ProtocolGuid, NULL },
2474 { STRING_TOKEN (STR_S_PTD2), &gEfiSmmPeriodicTimerDispatch2ProtocolGuid, NULL },
2475 { STRING_TOKEN (STR_S_UD2), &gEfiSmmUsbDispatch2ProtocolGuid, NULL },
2476 { STRING_TOKEN (STR_S_GD2), &gEfiSmmGpiDispatch2ProtocolGuid, NULL },
2477 { STRING_TOKEN (STR_S_SBD2), &gEfiSmmStandbyButtonDispatch2ProtocolGuid, NULL },
2478 { STRING_TOKEN (STR_S_PBD2), &gEfiSmmPowerButtonDispatch2ProtocolGuid, NULL },
2479 { STRING_TOKEN (STR_S_ITD2), &gEfiSmmIoTrapDispatch2ProtocolGuid, NULL },
2480 { STRING_TOKEN (STR_PCD), &gEfiPcdProtocolGuid, NULL },
2481 { STRING_TOKEN (STR_FVB2), &gEfiFirmwareVolumeBlock2ProtocolGuid, NULL },
2482 { STRING_TOKEN (STR_CPUIO2), &gEfiCpuIo2ProtocolGuid, NULL },
2483 { STRING_TOKEN (STR_LEGACY_R2), &gEfiLegacyRegion2ProtocolGuid, NULL },
2484 { STRING_TOKEN (STR_S2ARCH), &gEfiSecurity2ArchProtocolGuid, NULL },
2485 { STRING_TOKEN (STR_EODXE), &gEfiSmmEndOfDxeProtocolGuid, NULL },
2486 { STRING_TOKEN (STR_ISAHC), &gEfiIsaHcProtocolGuid, NULL },
2487 { STRING_TOKEN (STR_ISAHC_B), &gEfiIsaHcServiceBindingProtocolGuid, NULL },
2488 { STRING_TOKEN (STR_SIO_C), &gEfiSioControlProtocolGuid, NULL },
2489 { STRING_TOKEN (STR_GET_PCD), &gEfiGetPcdInfoProtocolGuid, NULL },
2490 { STRING_TOKEN (STR_I2C_M), &gEfiI2cMasterProtocolGuid, NULL },
2491 { STRING_TOKEN (STR_I2CIO), &gEfiI2cIoProtocolGuid, NULL },
2493 { STRING_TOKEN (STR_I2C_H), &gEfiI2cHostProtocolGuid, NULL },
2495 { STRING_TOKEN (STR_TCG2), &gEfiTcg2ProtocolGuid, NULL },
2496 { STRING_TOKEN (STR_TIMESTAMP), &gEfiTimestampProtocolGuid, NULL },
2497 { STRING_TOKEN (STR_RNG), &gEfiRngProtocolGuid, NULL },
2498 { STRING_TOKEN (STR_NVMEPT), &gEfiNvmExpressPassThruProtocolGuid, NULL },
2499 { STRING_TOKEN (STR_H2_SB), &gEfiHash2ServiceBindingProtocolGuid, NULL },
2500 { STRING_TOKEN (STR_HASH2), &gEfiHash2ProtocolGuid, NULL },
2501 { STRING_TOKEN (STR_BIO_C), &gEfiBlockIoCryptoProtocolGuid, NULL },
2502 { STRING_TOKEN (STR_SCR), &gEfiSmartCardReaderProtocolGuid, NULL },
2503 { STRING_TOKEN (STR_SCE), &gEfiSmartCardEdgeProtocolGuid, NULL },
2504 { STRING_TOKEN (STR_USB_FIO), &gEfiUsbFunctionIoProtocolGuid, NULL },
2505 { STRING_TOKEN (STR_BC_HC), &gEfiBluetoothHcProtocolGuid, NULL },
2506 { STRING_TOKEN (STR_BC_IO_SB), &gEfiBluetoothIoServiceBindingProtocolGuid, NULL },
2507 { STRING_TOKEN (STR_BC_IO), &gEfiBluetoothIoProtocolGuid, NULL },
2508 { STRING_TOKEN (STR_BC_C), &gEfiBluetoothConfigProtocolGuid, NULL },
2509 { STRING_TOKEN (STR_REG_EXP), &gEfiRegularExpressionProtocolGuid, NULL },
2510 { STRING_TOKEN (STR_B_MGR_P), &gEfiBootManagerPolicyProtocolGuid, NULL },
2511 { STRING_TOKEN (STR_CKH), &gEfiConfigKeywordHandlerProtocolGuid, NULL },
2512 { STRING_TOKEN (STR_WIFI), &gEfiWiFiProtocolGuid, NULL },
2513 { STRING_TOKEN (STR_EAP_M), &gEfiEapManagement2ProtocolGuid, NULL },
2514 { STRING_TOKEN (STR_EAP_C), &gEfiEapConfigurationProtocolGuid, NULL },
2515 { STRING_TOKEN (STR_PKCS7), &gEfiPkcs7VerifyProtocolGuid, NULL },
2516 { STRING_TOKEN (STR_NET_DNS4_SB), &gEfiDns4ServiceBindingProtocolGuid, NULL },
2517 { STRING_TOKEN (STR_NET_DNS4), &gEfiDns4ProtocolGuid, NULL },
2518 { STRING_TOKEN (STR_NET_DNS6_SB), &gEfiDns6ServiceBindingProtocolGuid, NULL },
2519 { STRING_TOKEN (STR_NET_DNS6), &gEfiDns6ProtocolGuid, NULL },
2520 { STRING_TOKEN (STR_NET_HTTP_SB), &gEfiHttpServiceBindingProtocolGuid, NULL },
2521 { STRING_TOKEN (STR_NET_HTTP), &gEfiHttpProtocolGuid, NULL },
2522 { STRING_TOKEN (STR_NET_HTTP_U), &gEfiHttpUtilitiesProtocolGuid, NULL },
2523 { STRING_TOKEN (STR_REST), &gEfiRestProtocolGuid, NULL },
2524
2525 //
2526 // PI 1.5
2527 //
2528 { STRING_TOKEN (STR_MM_EOD), &gEfiMmEndOfDxeProtocolGuid, NULL },
2529 { STRING_TOKEN (STR_MM_ITD), &gEfiMmIoTrapDispatchProtocolGuid, NULL },
2530 { STRING_TOKEN (STR_MM_PBD), &gEfiMmPowerButtonDispatchProtocolGuid, NULL },
2531 { STRING_TOKEN (STR_MM_SBD), &gEfiMmStandbyButtonDispatchProtocolGuid, NULL },
2532 { STRING_TOKEN (STR_MM_GD), &gEfiMmGpiDispatchProtocolGuid, NULL },
2533 { STRING_TOKEN (STR_MM_UD), &gEfiMmUsbDispatchProtocolGuid, NULL },
2534 { STRING_TOKEN (STR_MM_PTD), &gEfiMmPeriodicTimerDispatchProtocolGuid, NULL },
2535 { STRING_TOKEN (STR_MM_SXD), &gEfiMmSxDispatchProtocolGuid, NULL },
2536 { STRING_TOKEN (STR_MM_SWD), &gEfiMmSwDispatchProtocolGuid, NULL },
2537 { STRING_TOKEN (STR_MM_PRBI), &gEfiMmPciRootBridgeIoProtocolGuid, NULL },
2538 { STRING_TOKEN (STR_MM_CPU), &gEfiMmCpuProtocolGuid, NULL },
2539 { STRING_TOKEN (STR_MM_STACODE), &gEfiMmStatusCodeProtocolGuid, NULL },
2540 { STRING_TOKEN (STR_DXEMM_RTL), &gEfiDxeMmReadyToLockProtocolGuid, NULL },
2541 { STRING_TOKEN (STR_MM_CONFIG), &gEfiMmConfigurationProtocolGuid, NULL },
2542 { STRING_TOKEN (STR_MM_RTL), &gEfiMmReadyToLockProtocolGuid, NULL },
2543 { STRING_TOKEN (STR_MM_CONTROL), &gEfiMmControlProtocolGuid, NULL },
2544 { STRING_TOKEN (STR_MM_ACCESS), &gEfiMmAccessProtocolGuid, NULL },
2545 { STRING_TOKEN (STR_MM_BASE), &gEfiMmBaseProtocolGuid, NULL },
2546 { STRING_TOKEN (STR_MM_CPUIO), &gEfiMmCpuIoProtocolGuid, NULL },
2547 { STRING_TOKEN (STR_MM_RH), &gEfiMmRscHandlerProtocolGuid, NULL },
2548 { STRING_TOKEN (STR_MM_COM), &gEfiMmCommunicationProtocolGuid, NULL },
2549
2550 //
2551 // UEFI Shell Spec 2.0
2552 //
2553 { STRING_TOKEN (STR_SHELL_PARAMETERS), &gEfiShellParametersProtocolGuid, NULL },
2554 { STRING_TOKEN (STR_SHELL), &gEfiShellProtocolGuid, NULL },
2555
2556 //
2557 // UEFI Shell Spec 2.1
2558 //
2559 { STRING_TOKEN (STR_SHELL_DYNAMIC), &gEfiShellDynamicCommandProtocolGuid, NULL },
2560
2561 //
2562 // Misc
2563 //
2564 { STRING_TOKEN (STR_PCDINFOPROT), &gGetPcdInfoProtocolGuid, NULL },
2565
2566 //
2567 // terminator
2568 //
2569 { 0, NULL, NULL },
2570};
2571
2583 IN CONST EFI_GUID *Guid
2584 )
2585{
2586 CONST GUID_INFO_BLOCK *ListWalker;
2587 UINTN LoopCount;
2588
2589 ASSERT (Guid != NULL);
2590
2591 for (LoopCount = 0, ListWalker = mGuidList; mGuidList != NULL && LoopCount < mGuidListCount; LoopCount++, ListWalker++) {
2592 if (CompareGuid (ListWalker->GuidId, Guid)) {
2593 return (ListWalker);
2594 }
2595 }
2596
2597 if (PcdGetBool (PcdShellIncludeNtGuids)) {
2598 for (ListWalker = mGuidStringListNT; ListWalker != NULL && ListWalker->GuidId != NULL; ListWalker++) {
2599 if (CompareGuid (ListWalker->GuidId, Guid)) {
2600 return (ListWalker);
2601 }
2602 }
2603 }
2604
2605 for (ListWalker = mGuidStringList; ListWalker != NULL && ListWalker->GuidId != NULL; ListWalker++) {
2606 if (CompareGuid (ListWalker->GuidId, Guid)) {
2607 return (ListWalker);
2608 }
2609 }
2610
2611 return (NULL);
2612}
2613
2628 IN CONST EFI_GUID *Guid,
2629 IN CONST EFI_STRING_ID NameID,
2630 IN CONST DUMP_PROTOCOL_INFO DumpFunc OPTIONAL
2631 )
2632{
2633 ASSERT (Guid != NULL);
2634 ASSERT (NameID != 0);
2635
2636 mGuidList = ReallocatePool (
2637 mGuidListCount * sizeof (GUID_INFO_BLOCK),
2638 (mGuidListCount + 1) * sizeof (GUID_INFO_BLOCK),
2639 mGuidList
2640 );
2641 if (mGuidList == NULL) {
2642 mGuidListCount = 0;
2643 return (EFI_OUT_OF_RESOURCES);
2644 }
2645
2646 mGuidListCount++;
2647
2648 mGuidList[mGuidListCount - 1].GuidId = AllocateCopyPool (sizeof (EFI_GUID), Guid);
2649 mGuidList[mGuidListCount - 1].StringId = NameID;
2650 mGuidList[mGuidListCount - 1].DumpInfo = DumpFunc;
2651
2652 if (mGuidList[mGuidListCount - 1].GuidId == NULL) {
2653 return (EFI_OUT_OF_RESOURCES);
2654 }
2655
2656 return (EFI_SUCCESS);
2657}
2658
2674EFIAPI
2676 IN CONST EFI_GUID *Guid,
2677 IN CONST CHAR16 *TheName,
2678 IN CONST CHAR8 *Lang OPTIONAL
2679 )
2680{
2681 EFI_STRING_ID NameID;
2682
2684
2685 if ((Guid == NULL) || (TheName == NULL)) {
2686 return (EFI_INVALID_PARAMETER);
2687 }
2688
2689 if ((InternalShellGetNodeFromGuid (Guid)) != NULL) {
2690 return (EFI_ACCESS_DENIED);
2691 }
2692
2693 NameID = HiiSetString (mHandleParsingHiiHandle, 0, (CHAR16 *)TheName, Lang);
2694 if (NameID == 0) {
2695 return (EFI_OUT_OF_RESOURCES);
2696 }
2697
2698 return (InsertNewGuidNameMapping (Guid, NameID, NULL));
2699}
2700
2712CHAR16 *
2713EFIAPI
2715 IN CONST EFI_GUID *Guid,
2716 IN CONST CHAR8 *Lang OPTIONAL
2717 )
2718{
2720
2722
2723 Id = InternalShellGetNodeFromGuid (Guid);
2724 if (Id == NULL) {
2725 return NULL;
2726 }
2727
2728 return HiiGetString (mHandleParsingHiiHandle, Id->StringId, Lang);
2729}
2730
2747CHAR16 *
2748EFIAPI
2750 IN CONST EFI_HANDLE TheHandle,
2751 IN CONST EFI_GUID *Guid,
2752 IN CONST BOOLEAN Verbose
2753 )
2754{
2756
2757 ASSERT (TheHandle != NULL);
2758 ASSERT (Guid != NULL);
2759
2760 if ((TheHandle == NULL) || (Guid == NULL)) {
2761 return (NULL);
2762 }
2763
2764 Id = InternalShellGetNodeFromGuid (Guid);
2765 if ((Id != NULL) && (Id->DumpInfo != NULL)) {
2766 return (Id->DumpInfo (TheHandle, Verbose));
2767 }
2768
2769 return (NULL);
2770}
2771
2784EFIAPI
2786 IN CONST CHAR16 *Name,
2787 IN CONST CHAR8 *Lang OPTIONAL,
2788 OUT EFI_GUID **Guid
2789 )
2790{
2791 CONST GUID_INFO_BLOCK *ListWalker;
2792 CHAR16 *String;
2793 UINTN LoopCount;
2794
2796
2797 ASSERT (Guid != NULL);
2798 if (Guid == NULL) {
2799 return (EFI_INVALID_PARAMETER);
2800 }
2801
2802 *Guid = NULL;
2803
2804 if (PcdGetBool (PcdShellIncludeNtGuids)) {
2805 for (ListWalker = mGuidStringListNT; ListWalker != NULL && ListWalker->GuidId != NULL; ListWalker++) {
2806 String = HiiGetString (mHandleParsingHiiHandle, ListWalker->StringId, Lang);
2807 if ((Name != NULL) && (String != NULL) && (StringNoCaseCompare (&Name, &String) == 0)) {
2808 *Guid = ListWalker->GuidId;
2809 }
2810
2811 SHELL_FREE_NON_NULL (String);
2812 if (*Guid != NULL) {
2813 return (EFI_SUCCESS);
2814 }
2815 }
2816 }
2817
2818 for (ListWalker = mGuidStringList; ListWalker != NULL && ListWalker->GuidId != NULL; ListWalker++) {
2819 String = HiiGetString (mHandleParsingHiiHandle, ListWalker->StringId, Lang);
2820 if ((Name != NULL) && (String != NULL) && (StringNoCaseCompare (&Name, &String) == 0)) {
2821 *Guid = ListWalker->GuidId;
2822 }
2823
2824 SHELL_FREE_NON_NULL (String);
2825 if (*Guid != NULL) {
2826 return (EFI_SUCCESS);
2827 }
2828 }
2829
2830 for (LoopCount = 0, ListWalker = mGuidList; mGuidList != NULL && LoopCount < mGuidListCount; LoopCount++, ListWalker++) {
2831 String = HiiGetString (mHandleParsingHiiHandle, ListWalker->StringId, Lang);
2832 if ((Name != NULL) && (String != NULL) && (StringNoCaseCompare (&Name, &String) == 0)) {
2833 *Guid = ListWalker->GuidId;
2834 }
2835
2836 SHELL_FREE_NON_NULL (String);
2837 if (*Guid != NULL) {
2838 return (EFI_SUCCESS);
2839 }
2840 }
2841
2842 return (EFI_NOT_FOUND);
2843}
2844
2858CHAR8 *
2859EFIAPI
2861 IN CONST CHAR8 *SupportedLanguages,
2862 IN CONST CHAR8 *InputLanguage,
2863 IN BOOLEAN Iso639Language
2864 )
2865{
2866 CHAR8 *LanguageVariable;
2867 CHAR8 *BestLanguage;
2868
2869 GetVariable2 (Iso639Language ? L"Lang" : L"PlatformLang", &gEfiGlobalVariableGuid, (VOID **)&LanguageVariable, NULL);
2870
2871 BestLanguage = GetBestLanguage (
2872 SupportedLanguages,
2873 Iso639Language,
2874 (InputLanguage != NULL) ? InputLanguage : "",
2875 (LanguageVariable != NULL) ? LanguageVariable : "",
2876 SupportedLanguages,
2877 NULL
2878 );
2879
2880 if (LanguageVariable != NULL) {
2881 FreePool (LanguageVariable);
2882 }
2883
2884 return BestLanguage;
2885}
2886
2897CONST CHAR16 *
2898EFIAPI
2900 IN CONST EFI_HANDLE TheHandle,
2901 IN CONST CHAR8 *Language
2902 )
2903{
2904 EFI_COMPONENT_NAME2_PROTOCOL *CompNameStruct;
2905 EFI_STATUS Status;
2906 CHAR16 *RetVal;
2907 CHAR8 *BestLang;
2908
2909 BestLang = NULL;
2910
2911 Status = gBS->OpenProtocol (
2912 TheHandle,
2913 &gEfiComponentName2ProtocolGuid,
2914 (VOID **)&CompNameStruct,
2916 NULL,
2917 EFI_OPEN_PROTOCOL_GET_PROTOCOL
2918 );
2919 if (!EFI_ERROR (Status)) {
2920 BestLang = GetBestLanguageForDriver (CompNameStruct->SupportedLanguages, Language, FALSE);
2921 if (BestLang == NULL) {
2922 return (NULL);
2923 }
2924
2925 Status = CompNameStruct->GetDriverName (CompNameStruct, BestLang, &RetVal);
2926 if (BestLang != NULL) {
2927 FreePool (BestLang);
2928 BestLang = NULL;
2929 }
2930
2931 if (!EFI_ERROR (Status)) {
2932 return (RetVal);
2933 }
2934 }
2935
2936 Status = gBS->OpenProtocol (
2937 TheHandle,
2938 &gEfiComponentNameProtocolGuid,
2939 (VOID **)&CompNameStruct,
2941 NULL,
2942 EFI_OPEN_PROTOCOL_GET_PROTOCOL
2943 );
2944 if (!EFI_ERROR (Status)) {
2945 BestLang = GetBestLanguageForDriver (CompNameStruct->SupportedLanguages, Language, FALSE);
2946 if (BestLang == NULL) {
2947 return (NULL);
2948 }
2949
2950 Status = CompNameStruct->GetDriverName (CompNameStruct, BestLang, &RetVal);
2951 if (BestLang != NULL) {
2952 FreePool (BestLang);
2953 }
2954
2955 if (!EFI_ERROR (Status)) {
2956 return (RetVal);
2957 }
2958 }
2959
2960 return (NULL);
2961}
2962
2971 VOID
2972 )
2973{
2974 EFI_STATUS Status;
2975 EFI_HANDLE *HandleBuffer;
2976 UINTN HandleCount;
2977 HANDLE_LIST *ListWalker;
2978
2979 if (mHandleList.NextIndex != 0) {
2980 return EFI_SUCCESS;
2981 }
2982
2983 InitializeListHead (&mHandleList.List.Link);
2984 mHandleList.NextIndex = 1;
2985 Status = gBS->LocateHandleBuffer (
2986 AllHandles,
2987 NULL,
2988 NULL,
2989 &HandleCount,
2990 &HandleBuffer
2991 );
2992 ASSERT_EFI_ERROR (Status);
2993 if (EFI_ERROR (Status)) {
2994 return (Status);
2995 }
2996
2997 for (mHandleList.NextIndex = 1; mHandleList.NextIndex <= HandleCount; mHandleList.NextIndex++) {
2998 ListWalker = AllocateZeroPool (sizeof (HANDLE_LIST));
2999 if (ListWalker != NULL) {
3000 ListWalker->TheHandle = HandleBuffer[mHandleList.NextIndex - 1];
3001 ListWalker->TheIndex = mHandleList.NextIndex;
3002 InsertTailList (&mHandleList.List.Link, &ListWalker->Link);
3003 }
3004 }
3005
3006 FreePool (HandleBuffer);
3007 return (EFI_SUCCESS);
3008}
3009
3021UINTN
3022EFIAPI
3024 IN CONST EFI_HANDLE TheHandle
3025 )
3026{
3027 EFI_STATUS Status;
3028 EFI_GUID **ProtocolBuffer;
3029 UINTN ProtocolCount;
3030 HANDLE_LIST *ListWalker;
3031
3032 if (TheHandle == NULL) {
3033 return 0;
3034 }
3035
3037
3038 for (ListWalker = (HANDLE_LIST *)GetFirstNode (&mHandleList.List.Link)
3039 ; !IsNull (&mHandleList.List.Link, &ListWalker->Link)
3040 ; ListWalker = (HANDLE_LIST *)GetNextNode (&mHandleList.List.Link, &ListWalker->Link)
3041 )
3042 {
3043 if (ListWalker->TheHandle == TheHandle) {
3044 //
3045 // Verify that TheHandle is still present in the Handle Database
3046 //
3047 Status = gBS->ProtocolsPerHandle (TheHandle, &ProtocolBuffer, &ProtocolCount);
3048 if (EFI_ERROR (Status)) {
3049 //
3050 // TheHandle is not present in the Handle Database, so delete from the handle list
3051 //
3052 RemoveEntryList (&ListWalker->Link);
3053 return 0;
3054 }
3055
3056 FreePool (ProtocolBuffer);
3057 return (ListWalker->TheIndex);
3058 }
3059 }
3060
3061 //
3062 // Verify that TheHandle is valid handle
3063 //
3064 Status = gBS->ProtocolsPerHandle (TheHandle, &ProtocolBuffer, &ProtocolCount);
3065 if (EFI_ERROR (Status)) {
3066 //
3067 // TheHandle is not valid, so do not add to handle list
3068 //
3069 return 0;
3070 }
3071
3072 FreePool (ProtocolBuffer);
3073
3074 ListWalker = AllocateZeroPool (sizeof (HANDLE_LIST));
3075 if (ListWalker == NULL) {
3076 return 0;
3077 }
3078
3079 ListWalker->TheHandle = TheHandle;
3080 ListWalker->TheIndex = mHandleList.NextIndex++;
3081 InsertTailList (&mHandleList.List.Link, &ListWalker->Link);
3082 return (ListWalker->TheIndex);
3083}
3084
3095EFIAPI
3097 IN CONST UINTN TheIndex
3098 )
3099{
3100 EFI_STATUS Status;
3101 EFI_GUID **ProtocolBuffer;
3102 UINTN ProtocolCount;
3103 HANDLE_LIST *ListWalker;
3104
3106
3107 if (TheIndex >= mHandleList.NextIndex) {
3108 return NULL;
3109 }
3110
3111 for (ListWalker = (HANDLE_LIST *)GetFirstNode (&mHandleList.List.Link)
3112 ; !IsNull (&mHandleList.List.Link, &ListWalker->Link)
3113 ; ListWalker = (HANDLE_LIST *)GetNextNode (&mHandleList.List.Link, &ListWalker->Link)
3114 )
3115 {
3116 if ((ListWalker->TheIndex == TheIndex) && (ListWalker->TheHandle != NULL)) {
3117 //
3118 // Verify that LinkWalker->TheHandle is valid handle
3119 //
3120 Status = gBS->ProtocolsPerHandle (ListWalker->TheHandle, &ProtocolBuffer, &ProtocolCount);
3121 if (!EFI_ERROR (Status)) {
3122 FreePool (ProtocolBuffer);
3123 } else {
3124 //
3125 // TheHandle is not valid, so do not add to handle list
3126 //
3127 ListWalker->TheHandle = NULL;
3128 }
3129
3130 return (ListWalker->TheHandle);
3131 }
3132 }
3133
3134 return NULL;
3135}
3136
3164EFIAPI
3166 IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
3167 IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
3168 IN UINTN *HandleCount,
3169 OUT EFI_HANDLE **HandleBuffer,
3170 OUT UINTN **HandleType
3171 )
3172{
3173 EFI_STATUS Status;
3174 UINTN HandleIndex;
3175 EFI_GUID **ProtocolGuidArray;
3176 UINTN ArrayCount;
3177 UINTN ProtocolIndex;
3179 UINTN OpenInfoCount;
3180 UINTN OpenInfoIndex;
3181 UINTN ChildIndex;
3182 INTN DriverBindingHandleIndex;
3183
3184 ASSERT (HandleCount != NULL);
3185 ASSERT (HandleBuffer != NULL);
3186 ASSERT (HandleType != NULL);
3187 ASSERT (DriverBindingHandle != NULL || ControllerHandle != NULL);
3188
3189 *HandleCount = 0;
3190 *HandleBuffer = NULL;
3191 *HandleType = NULL;
3192
3193 //
3194 // Retrieve the list of all handles from the handle database
3195 //
3196 Status = gBS->LocateHandleBuffer (
3197 AllHandles,
3198 NULL,
3199 NULL,
3200 HandleCount,
3201 HandleBuffer
3202 );
3203 if (EFI_ERROR (Status)) {
3204 return (Status);
3205 }
3206
3207 *HandleType = AllocateZeroPool (*HandleCount * sizeof (UINTN));
3208 if (*HandleType == NULL) {
3209 SHELL_FREE_NON_NULL (*HandleBuffer);
3210 *HandleCount = 0;
3211 return EFI_OUT_OF_RESOURCES;
3212 }
3213
3214 DriverBindingHandleIndex = -1;
3215 for (HandleIndex = 0; HandleIndex < *HandleCount; HandleIndex++) {
3216 if ((DriverBindingHandle != NULL) && ((*HandleBuffer)[HandleIndex] == DriverBindingHandle)) {
3217 DriverBindingHandleIndex = (INTN)HandleIndex;
3218 }
3219 }
3220
3221 for (HandleIndex = 0; HandleIndex < *HandleCount; HandleIndex++) {
3222 //
3223 // Retrieve the list of all the protocols on each handle
3224 //
3225 Status = gBS->ProtocolsPerHandle (
3226 (*HandleBuffer)[HandleIndex],
3227 &ProtocolGuidArray,
3228 &ArrayCount
3229 );
3230 if (EFI_ERROR (Status)) {
3231 continue;
3232 }
3233
3234 for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
3235 //
3236 // Set the bit describing what this handle has
3237 //
3238 if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiLoadedImageProtocolGuid)) {
3239 (*HandleType)[HandleIndex] |= (UINTN)HR_IMAGE_HANDLE;
3240 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverBindingProtocolGuid)) {
3241 (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_BINDING_HANDLE;
3242 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfiguration2ProtocolGuid)) {
3243 (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_CONFIGURATION_HANDLE;
3244 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfigurationProtocolGuid)) {
3245 (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_CONFIGURATION_HANDLE;
3246 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnostics2ProtocolGuid)) {
3247 (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_DIAGNOSTICS_HANDLE;
3248 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnosticsProtocolGuid)) {
3249 (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_DIAGNOSTICS_HANDLE;
3250 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentName2ProtocolGuid)) {
3251 (*HandleType)[HandleIndex] |= (UINTN)HR_COMPONENT_NAME_HANDLE;
3252 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentNameProtocolGuid)) {
3253 (*HandleType)[HandleIndex] |= (UINTN)HR_COMPONENT_NAME_HANDLE;
3254 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDevicePathProtocolGuid)) {
3255 (*HandleType)[HandleIndex] |= (UINTN)HR_DEVICE_HANDLE;
3256 }
3257
3258 //
3259 // Retrieve the list of agents that have opened each protocol
3260 //
3261 Status = gBS->OpenProtocolInformation (
3262 (*HandleBuffer)[HandleIndex],
3263 ProtocolGuidArray[ProtocolIndex],
3264 &OpenInfo,
3265 &OpenInfoCount
3266 );
3267 if (EFI_ERROR (Status)) {
3268 continue;
3269 }
3270
3271 if (ControllerHandle == NULL) {
3272 //
3273 // ControllerHandle == NULL and DriverBindingHandle != NULL.
3274 // Return information on all the controller handles that the driver specified by DriverBindingHandle is managing
3275 //
3276 for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
3277 if ((OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) && ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0)) {
3278 (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE);
3279 if (DriverBindingHandleIndex != -1) {
3280 (*HandleType)[DriverBindingHandleIndex] |= (UINTN)HR_DEVICE_DRIVER;
3281 }
3282 }
3283
3284 if ((OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) && ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0)) {
3285 (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE);
3286 if (DriverBindingHandleIndex != -1) {
3287 (*HandleType)[DriverBindingHandleIndex] |= (UINTN)(HR_BUS_DRIVER | HR_DEVICE_DRIVER);
3288 }
3289
3290 for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) {
3291 if (OpenInfo[OpenInfoIndex].ControllerHandle == (*HandleBuffer)[ChildIndex]) {
3292 (*HandleType)[ChildIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CHILD_HANDLE);
3293 }
3294 }
3295 }
3296 }
3297 }
3298
3299 if ((DriverBindingHandle == NULL) && (ControllerHandle != NULL)) {
3300 if (ControllerHandle == (*HandleBuffer)[HandleIndex]) {
3301 (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE);
3302 for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
3303 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
3304 for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) {
3305 if (OpenInfo[OpenInfoIndex].AgentHandle == (*HandleBuffer)[ChildIndex]) {
3306 (*HandleType)[ChildIndex] |= (UINTN)HR_DEVICE_DRIVER;
3307 }
3308 }
3309 }
3310
3311 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
3312 for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) {
3313 if (OpenInfo[OpenInfoIndex].AgentHandle == (*HandleBuffer)[ChildIndex]) {
3314 (*HandleType)[ChildIndex] |= (UINTN)(HR_BUS_DRIVER | HR_DEVICE_DRIVER);
3315 }
3316
3317 if (OpenInfo[OpenInfoIndex].ControllerHandle == (*HandleBuffer)[ChildIndex]) {
3318 (*HandleType)[ChildIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CHILD_HANDLE);
3319 }
3320 }
3321 }
3322 }
3323 } else {
3324 for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
3325 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
3326 if (OpenInfo[OpenInfoIndex].ControllerHandle == ControllerHandle) {
3327 (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_PARENT_HANDLE);
3328 }
3329 }
3330 }
3331 }
3332 }
3333
3334 if ((DriverBindingHandle != NULL) && (ControllerHandle != NULL)) {
3335 if (ControllerHandle == (*HandleBuffer)[HandleIndex]) {
3336 (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE);
3337 for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
3338 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
3339 if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) {
3340 if (DriverBindingHandleIndex != -1) {
3341 (*HandleType)[DriverBindingHandleIndex] |= (UINTN)HR_DEVICE_DRIVER;
3342 }
3343 }
3344 }
3345
3346 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
3347 if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) {
3348 for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) {
3349 if (OpenInfo[OpenInfoIndex].ControllerHandle == (*HandleBuffer)[ChildIndex]) {
3350 (*HandleType)[ChildIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CHILD_HANDLE);
3351 }
3352 }
3353 }
3354
3355 for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) {
3356 if (OpenInfo[OpenInfoIndex].AgentHandle == (*HandleBuffer)[ChildIndex]) {
3357 (*HandleType)[ChildIndex] |= (UINTN)(HR_BUS_DRIVER | HR_DEVICE_DRIVER);
3358 }
3359 }
3360 }
3361 }
3362 } else {
3363 for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
3364 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
3365 if (OpenInfo[OpenInfoIndex].ControllerHandle == ControllerHandle) {
3366 (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_PARENT_HANDLE);
3367 }
3368 }
3369 }
3370 }
3371 }
3372
3373 FreePool (OpenInfo);
3374 }
3375
3376 FreePool (ProtocolGuidArray);
3377 }
3378
3379 return EFI_SUCCESS;
3380}
3381
3411EFIAPI
3413 IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
3414 IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
3415 IN CONST UINTN Mask,
3416 IN UINTN *MatchingHandleCount,
3417 OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
3418 )
3419{
3420 EFI_STATUS Status;
3421 UINTN HandleCount;
3422 EFI_HANDLE *HandleBuffer;
3423 UINTN *HandleType;
3424 UINTN HandleIndex;
3425
3426 ASSERT (MatchingHandleCount != NULL);
3427 ASSERT (DriverBindingHandle != NULL || ControllerHandle != NULL);
3428
3429 if ((Mask & HR_VALID_MASK) != Mask) {
3430 return (EFI_INVALID_PARAMETER);
3431 }
3432
3433 if (((Mask & HR_CHILD_HANDLE) != 0) && (DriverBindingHandle == NULL)) {
3434 return (EFI_INVALID_PARAMETER);
3435 }
3436
3437 *MatchingHandleCount = 0;
3438 if (MatchingHandleBuffer != NULL) {
3439 *MatchingHandleBuffer = NULL;
3440 }
3441
3442 HandleBuffer = NULL;
3443 HandleType = NULL;
3444
3446 DriverBindingHandle,
3447 ControllerHandle,
3448 &HandleCount,
3449 &HandleBuffer,
3450 &HandleType
3451 );
3452 if (!EFI_ERROR (Status)) {
3453 //
3454 // Count the number of handles that match the attributes in Mask
3455 //
3456 for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
3457 if ((HandleType[HandleIndex] & Mask) == Mask) {
3458 (*MatchingHandleCount)++;
3459 }
3460 }
3461
3462 //
3463 // If no handles match the attributes in Mask then return EFI_NOT_FOUND
3464 //
3465 if (*MatchingHandleCount == 0) {
3466 Status = EFI_NOT_FOUND;
3467 } else {
3468 if (MatchingHandleBuffer == NULL) {
3469 //
3470 // Someone just wanted the count...
3471 //
3472 Status = EFI_SUCCESS;
3473 } else {
3474 //
3475 // Allocate a handle buffer for the number of handles that matched the attributes in Mask
3476 //
3477 *MatchingHandleBuffer = AllocateZeroPool ((*MatchingHandleCount +1)* sizeof (EFI_HANDLE));
3478 if (*MatchingHandleBuffer == NULL) {
3479 Status = EFI_OUT_OF_RESOURCES;
3480 } else {
3481 for (HandleIndex = 0, *MatchingHandleCount = 0
3482 ; HandleIndex < HandleCount
3483 ; HandleIndex++
3484 )
3485 {
3486 //
3487 // Fill the allocated buffer with the handles that matched the attributes in Mask
3488 //
3489 if ((HandleType[HandleIndex] & Mask) == Mask) {
3490 (*MatchingHandleBuffer)[(*MatchingHandleCount)++] = HandleBuffer[HandleIndex];
3491 }
3492 }
3493
3494 //
3495 // Make the last one NULL
3496 //
3497 (*MatchingHandleBuffer)[*MatchingHandleCount] = NULL;
3498
3499 Status = EFI_SUCCESS;
3500 } // *MatchingHandleBuffer == NULL (ELSE)
3501 } // MacthingHandleBuffer == NULL (ELSE)
3502 } // *MatchingHandleCount == 0 (ELSE)
3503 } // no error on ParseHandleDatabaseByRelationshipWithType
3504
3505 if (HandleBuffer != NULL) {
3506 FreePool (HandleBuffer);
3507 }
3508
3509 if (HandleType != NULL) {
3510 FreePool (HandleType);
3511 }
3512
3513 ASSERT (
3514 (MatchingHandleBuffer == NULL) ||
3515 (*MatchingHandleCount == 0 && *MatchingHandleBuffer == NULL) ||
3516 (*MatchingHandleCount != 0 && *MatchingHandleBuffer != NULL)
3517 );
3518 return Status;
3519}
3520
3534EFIAPI
3536 IN CONST EFI_HANDLE ControllerHandle,
3537 OUT UINTN *MatchingHandleCount,
3538 OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
3539 )
3540{
3541 EFI_STATUS Status;
3542 UINTN HandleIndex;
3543 UINTN DriverBindingHandleCount;
3544 EFI_HANDLE *DriverBindingHandleBuffer;
3545 UINTN DriverBindingHandleIndex;
3546 UINTN ChildControllerHandleCount;
3547 EFI_HANDLE *ChildControllerHandleBuffer;
3548 UINTN ChildControllerHandleIndex;
3549 EFI_HANDLE *HandleBufferForReturn;
3550
3551 if (MatchingHandleCount == NULL) {
3552 return (EFI_INVALID_PARAMETER);
3553 }
3554
3555 *MatchingHandleCount = 0;
3556
3558 ControllerHandle,
3559 &DriverBindingHandleCount,
3560 &DriverBindingHandleBuffer
3561 );
3562 if (EFI_ERROR (Status)) {
3563 return Status;
3564 }
3565
3566 //
3567 // Get a buffer big enough for all the controllers.
3568 //
3569 HandleBufferForReturn = GetHandleListByProtocol (NULL);
3570 if (HandleBufferForReturn == NULL) {
3571 FreePool (DriverBindingHandleBuffer);
3572 return (EFI_NOT_FOUND);
3573 }
3574
3575 for (DriverBindingHandleIndex = 0; DriverBindingHandleIndex < DriverBindingHandleCount; DriverBindingHandleIndex++) {
3577 DriverBindingHandleBuffer[DriverBindingHandleIndex],
3578 ControllerHandle,
3579 &ChildControllerHandleCount,
3580 &ChildControllerHandleBuffer
3581 );
3582 if (EFI_ERROR (Status)) {
3583 continue;
3584 }
3585
3586 for (ChildControllerHandleIndex = 0;
3587 ChildControllerHandleIndex < ChildControllerHandleCount;
3588 ChildControllerHandleIndex++
3589 )
3590 {
3591 for (HandleIndex = 0; HandleIndex < *MatchingHandleCount; HandleIndex++) {
3592 if (HandleBufferForReturn[HandleIndex] == ChildControllerHandleBuffer[ChildControllerHandleIndex]) {
3593 break;
3594 }
3595 }
3596
3597 if (HandleIndex >= *MatchingHandleCount) {
3598 HandleBufferForReturn[(*MatchingHandleCount)++] = ChildControllerHandleBuffer[ChildControllerHandleIndex];
3599 }
3600 }
3601
3602 FreePool (ChildControllerHandleBuffer);
3603 }
3604
3605 FreePool (DriverBindingHandleBuffer);
3606
3607 if ((MatchingHandleBuffer == NULL) || (*MatchingHandleCount == 0)) {
3608 //
3609 // The caller is not interested in the actual handles, or we've found none.
3610 //
3611 FreePool (HandleBufferForReturn);
3612 HandleBufferForReturn = NULL;
3613 }
3614
3615 if (MatchingHandleBuffer != NULL) {
3616 *MatchingHandleBuffer = HandleBufferForReturn;
3617 }
3618
3619 ASSERT (
3620 (MatchingHandleBuffer == NULL) ||
3621 (*MatchingHandleCount == 0 && *MatchingHandleBuffer == NULL) ||
3622 (*MatchingHandleCount != 0 && *MatchingHandleBuffer != NULL)
3623 );
3624
3625 return (EFI_SUCCESS);
3626}
3627
3643VOID *
3645 IN OUT VOID **DestinationBuffer,
3646 IN OUT UINTN *DestinationSize,
3647 IN VOID *SourceBuffer,
3648 IN UINTN SourceSize
3649 )
3650{
3651 UINTN LocalDestinationSize;
3652 UINTN LocalDestinationFinalSize;
3653
3654 ASSERT (DestinationBuffer != NULL);
3655
3656 if ((SourceSize == 0) || (SourceBuffer == NULL)) {
3657 return (*DestinationBuffer);
3658 }
3659
3660 if (DestinationSize == NULL) {
3661 LocalDestinationSize = 0;
3662 } else {
3663 LocalDestinationSize = *DestinationSize;
3664 }
3665
3666 LocalDestinationFinalSize = LocalDestinationSize + SourceSize;
3667
3668 if (DestinationSize != NULL) {
3669 *DestinationSize = LocalDestinationSize;
3670 }
3671
3672 if (LocalDestinationSize == 0) {
3673 // allcoate
3674 *DestinationBuffer = AllocateZeroPool (LocalDestinationFinalSize);
3675 } else {
3676 // reallocate
3677 *DestinationBuffer = ReallocatePool (LocalDestinationSize, LocalDestinationFinalSize, *DestinationBuffer);
3678 }
3679
3680 ASSERT (*DestinationBuffer != NULL);
3681
3682 // copy
3683 return (CopyMem (((UINT8 *)(*DestinationBuffer)) + LocalDestinationSize, SourceBuffer, SourceSize));
3684}
3685
3698EFIAPI
3700 IN CONST EFI_HANDLE DriverHandle,
3701 IN UINTN *MatchingHandleCount,
3702 OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
3703 )
3704{
3705 EFI_HANDLE *Buffer;
3706 EFI_HANDLE *Buffer2;
3707 UINTN Count1;
3708 UINTN Count2;
3709 UINTN HandleIndex;
3710 EFI_STATUS Status;
3711 UINTN HandleBufferSize;
3712
3713 ASSERT (MatchingHandleCount != NULL);
3714
3715 HandleBufferSize = 0;
3716 Buffer = NULL;
3717 Buffer2 = NULL;
3718 *MatchingHandleCount = 0;
3719
3721 DriverHandle,
3722 &Count1,
3723 &Buffer
3724 );
3725 if (!EFI_ERROR (Status)) {
3726 for (HandleIndex = 0; HandleIndex < Count1; HandleIndex++) {
3727 //
3728 // now find the children
3729 //
3731 DriverHandle,
3732 Buffer[HandleIndex],
3733 &Count2,
3734 &Buffer2
3735 );
3736 if (EFI_ERROR (Status)) {
3737 break;
3738 }
3739
3740 //
3741 // save out required and optional data elements
3742 //
3743 *MatchingHandleCount += Count2;
3744 if (MatchingHandleBuffer != NULL) {
3745 *MatchingHandleBuffer = BuffernCatGrow ((VOID **)MatchingHandleBuffer, &HandleBufferSize, Buffer2, Count2 * sizeof (Buffer2[0]));
3746 }
3747
3748 //
3749 // free the memory
3750 //
3751 if (Buffer2 != NULL) {
3752 FreePool (Buffer2);
3753 }
3754 }
3755 }
3756
3757 if (Buffer != NULL) {
3758 FreePool (Buffer);
3759 }
3760
3761 return (Status);
3762}
3763
3773EFI_HANDLE *
3774EFIAPI
3776 IN CONST EFI_GUID *ProtocolGuid OPTIONAL
3777 )
3778{
3779 EFI_HANDLE *HandleList;
3780 UINTN Size;
3781 EFI_STATUS Status;
3782
3783 Size = 0;
3784 HandleList = NULL;
3785
3786 //
3787 // We cannot use LocateHandleBuffer since we need that NULL item on the ends of the list!
3788 //
3789 if (ProtocolGuid == NULL) {
3790 Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, HandleList);
3791 if (Status == EFI_BUFFER_TOO_SMALL) {
3792 HandleList = AllocateZeroPool (Size + sizeof (EFI_HANDLE));
3793 if (HandleList == NULL) {
3794 return (NULL);
3795 }
3796
3797 Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, HandleList);
3798 HandleList[Size/sizeof (EFI_HANDLE)] = NULL;
3799 }
3800 } else {
3801 Status = gBS->LocateHandle (ByProtocol, (EFI_GUID *)ProtocolGuid, NULL, &Size, HandleList);
3802 if (Status == EFI_BUFFER_TOO_SMALL) {
3803 HandleList = AllocateZeroPool (Size + sizeof (EFI_HANDLE));
3804 if (HandleList == NULL) {
3805 return (NULL);
3806 }
3807
3808 Status = gBS->LocateHandle (ByProtocol, (EFI_GUID *)ProtocolGuid, NULL, &Size, HandleList);
3809 HandleList[Size/sizeof (EFI_HANDLE)] = NULL;
3810 }
3811 }
3812
3813 if (EFI_ERROR (Status)) {
3814 if (HandleList != NULL) {
3815 FreePool (HandleList);
3816 }
3817
3818 return (NULL);
3819 }
3820
3821 return (HandleList);
3822}
3823
3833EFI_HANDLE *
3834EFIAPI
3836 IN CONST EFI_GUID **ProtocolGuids
3837 )
3838{
3839 EFI_HANDLE *HandleList;
3840 UINTN Size;
3841 UINTN TotalSize;
3842 UINTN TempSize;
3843 EFI_STATUS Status;
3844 CONST EFI_GUID **GuidWalker;
3845 EFI_HANDLE *HandleWalker1;
3846 EFI_HANDLE *HandleWalker2;
3847
3848 Size = 0;
3849 HandleList = NULL;
3850 TotalSize = sizeof (EFI_HANDLE);
3851
3852 for (GuidWalker = ProtocolGuids; GuidWalker != NULL && *GuidWalker != NULL; GuidWalker++, Size = 0) {
3853 Status = gBS->LocateHandle (ByProtocol, (EFI_GUID *)(*GuidWalker), NULL, &Size, NULL);
3854 if (Status == EFI_BUFFER_TOO_SMALL) {
3855 TotalSize += Size;
3856 }
3857 }
3858
3859 //
3860 // No handles were found...
3861 //
3862 if (TotalSize == sizeof (EFI_HANDLE)) {
3863 return (NULL);
3864 }
3865
3866 HandleList = AllocateZeroPool (TotalSize);
3867 if (HandleList == NULL) {
3868 return (NULL);
3869 }
3870
3871 Size = 0;
3872 for (GuidWalker = ProtocolGuids; GuidWalker != NULL && *GuidWalker != NULL; GuidWalker++) {
3873 TempSize = TotalSize - Size;
3874 Status = gBS->LocateHandle (ByProtocol, (EFI_GUID *)(*GuidWalker), NULL, &TempSize, HandleList+(Size/sizeof (EFI_HANDLE)));
3875
3876 //
3877 // Allow for missing protocols... Only update the 'used' size upon success.
3878 //
3879 if (!EFI_ERROR (Status)) {
3880 Size += TempSize;
3881 }
3882 }
3883
3884 ASSERT (HandleList[(TotalSize/sizeof (EFI_HANDLE))-1] == NULL);
3885
3886 for (HandleWalker1 = HandleList; HandleWalker1 != NULL && *HandleWalker1 != NULL; HandleWalker1++) {
3887 for (HandleWalker2 = HandleWalker1 + 1; HandleWalker2 != NULL && *HandleWalker2 != NULL; HandleWalker2++) {
3888 if (*HandleWalker1 == *HandleWalker2) {
3889 //
3890 // copy memory back 1 handle width.
3891 //
3892 CopyMem (HandleWalker2, HandleWalker2 + 1, TotalSize - ((HandleWalker2-HandleList+1)*sizeof (EFI_HANDLE)));
3893 }
3894 }
3895 }
3896
3897 return (HandleList);
3898}
3899
3912EFIAPI
3914 OUT EFI_GUID *Guids,
3915 IN OUT UINTN *Count
3916 )
3917{
3918 UINTN GuidCount;
3919 UINTN NtGuidCount;
3920 UINTN Index;
3921
3922 if (Count == NULL) {
3923 return EFI_INVALID_PARAMETER;
3924 }
3925
3926 NtGuidCount = 0;
3927 if (PcdGetBool (PcdShellIncludeNtGuids)) {
3928 NtGuidCount = ARRAY_SIZE (mGuidStringListNT) - 1;
3929 }
3930
3931 GuidCount = ARRAY_SIZE (mGuidStringList) - 1;
3932
3933 if (*Count < NtGuidCount + GuidCount + mGuidListCount) {
3934 *Count = NtGuidCount + GuidCount + mGuidListCount;
3935 return EFI_BUFFER_TOO_SMALL;
3936 }
3937
3938 for (Index = 0; Index < NtGuidCount; Index++) {
3939 CopyGuid (&Guids[Index], mGuidStringListNT[Index].GuidId);
3940 }
3941
3942 for (Index = 0; Index < GuidCount; Index++) {
3943 CopyGuid (&Guids[NtGuidCount + Index], mGuidStringList[Index].GuidId);
3944 }
3945
3946 for (Index = 0; Index < mGuidListCount; Index++) {
3947 CopyGuid (&Guids[NtGuidCount + GuidCount + Index], mGuidList[Index].GuidId);
3948 }
3949
3950 return EFI_SUCCESS;
3951}
UINT64 UINTN
INT64 INTN
PACKED struct @89 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
Definition: LinkedList.c:443
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
Definition: String.c:72
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
Definition: LinkedList.c:333
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
Definition: LinkedList.c:298
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
Definition: LinkedList.c:590
UINT64 EFIAPI MultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier)
Definition: MultU64x32.c:27
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
Definition: LinkedList.c:182
RETURN_STATUS EFIAPI StrnCatS(IN OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source, IN UINTN Length)
Definition: SafeString.c:507
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
Definition: String.c:30
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
Definition: LinkedList.c:259
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
Definition: MemLibGuid.c:73
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
Definition: MemLibGuid.c:39
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
VOID *EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
#define IMAGE_ATTRIBUTE_UEFI_IMAGE
#define IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED
#define IMAGE_ATTRIBUTE_RESET_REQUIRED
#define IMAGE_ATTRIBUTE_IMAGE_UPDATABLE
#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION
#define IMAGE_ATTRIBUTE_IN_USE
#define PARSE_HANDLE_DATABASE_MANAGED_CHILDREN(DriverHandle, ControllerHandle, Count, Buffer)
#define PARSE_HANDLE_DATABASE_DEVICES(DriverHandle, Count, Buffer)
#define PARSE_HANDLE_DATABASE_UEFI_DRIVERS(ControllerHandle, Count, Buffer)
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
Definition: HiiLib.c:141
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
Definition: HiiString.c:211
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
Definition: HiiString.c:52
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
Definition: HiiLib.c:253
EFI_GUID gEfiI2cBusConfigurationManagementProtocolGuid
EFI_GUID gEfiI2cEnumerateProtocolGuid
EFI_GUID gEfiI2cHostProtocolGuid
EFI_GUID gEfiI2cIoProtocolGuid
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
Definition: PrintLib.c:408
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define STATIC
Definition: Base.h:264
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define ARRAY_SIZE(Array)
Definition: Base.h:1393
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
@ IsaIa32
0x014C
Definition: DebugSupport.h:837
@ IsaIpf
0x0200
Definition: DebugSupport.h:839
@ IsaEbc
0x0EBC
Definition: DebugSupport.h:840
EFI_GRAPHICS_PIXEL_FORMAT
@ PixelBitMask
@ PixelRedGreenBlueReserved8BitPerColor
@ PixelBlueGreenRedReserved8BitPerColor
@ PixelBltOnly
@ PixelFormatMax
EFI_GUID gEfiPartitionInfoProtocolGuid
#define PcdGetBool(TokenName)
Definition: PcdLib.h:401
EFI_GUID gEfiIsaHcProtocolGuid
EFI_GUID gEfiRamDiskProtocolGuid
CHAR16 *EFIAPI CatSDumpHex(IN CHAR16 *Buffer, IN UINTN Indent, IN UINTN Offset, IN UINTN DataSize, IN VOID *UserData)
CHAR16 *EFIAPI StrnCatGrow(IN OUT CHAR16 **Destination, IN OUT UINTN *CurrentSize, IN CONST CHAR16 *Source, IN UINTN Count)
INTN EFIAPI StringNoCaseCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
Definition: BaseSortLib.c:92
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_HANDLE gImageHandle
EFI_BOOT_SERVICES * gBS
EFI_STATUS EFIAPI GetAllMappingGuids(OUT EFI_GUID *Guids, IN OUT UINTN *Count)
CHAR16 *EFIAPI GetProtocolInformationDump(IN CONST EFI_HANDLE TheHandle, IN CONST EFI_GUID *Guid, IN CONST BOOLEAN Verbose)
CHAR16 *EFIAPI TxtOutProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
CHAR16 *EFIAPI DevicePathProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
CONST CHAR16 *EFIAPI GetStringNameFromHandle(IN CONST EFI_HANDLE TheHandle, IN CONST CHAR8 *Language)
VOID HandleParsingHiiInit(VOID)
CHAR16 *EFIAPI AdapterInformationDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
CHAR16 *EFIAPI DriverEfiVersionProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
CHAR16 *EFIAPI GetStringNameFromGuid(IN CONST EFI_GUID *Guid, IN CONST CHAR8 *Lang OPTIONAL)
CHAR16 * FindLoadedImageFileName(IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage)
CHAR8 *EFIAPI GetBestLanguageForDriver(IN CONST CHAR8 *SupportedLanguages, IN CONST CHAR8 *InputLanguage, IN BOOLEAN Iso639Language)
EFI_STATUS EFIAPI ParseHandleDatabaseByRelationshipWithType(IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL, IN CONST EFI_HANDLE ControllerHandle OPTIONAL, IN UINTN *HandleCount, OUT EFI_HANDLE **HandleBuffer, OUT UINTN **HandleType)
EFI_STATUS EFIAPI GetGuidFromStringName(IN CONST CHAR16 *Name, IN CONST CHAR8 *Lang OPTIONAL, OUT EFI_GUID **Guid)
EFI_HANDLE EFIAPI ConvertHandleIndexToHandle(IN CONST UINTN TheIndex)
EFI_STATUS EFIAPI ParseHandleDatabaseForChildDevices(IN CONST EFI_HANDLE DriverHandle, IN UINTN *MatchingHandleCount, OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL)
CONST GUID_INFO_BLOCK * InternalShellGetNodeFromGuid(IN CONST EFI_GUID *Guid)
EFI_STATUS EFIAPI HandleParsingLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
CHAR16 *EFIAPI EdidDiscoveredProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
CHAR16 *EFIAPI DebugSupportProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
CHAR16 *EFIAPI EdidActiveProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
VOID * BuffernCatGrow(IN OUT VOID **DestinationBuffer, IN OUT UINTN *DestinationSize, IN VOID *SourceBuffer, IN UINTN SourceSize)
CHAR16 *EFIAPI BlockIoProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
CHAR16 *EFIAPI LoadedImageDevicePathProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
CHAR16 * ConvertDevicePathToShortText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath, IN CONST BOOLEAN Verbose, IN CONST UINTN Length)
CHAR16 *EFIAPI PciIoProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
EFI_STATUS EFIAPI HandleParsingLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
CHAR16 *EFIAPI BusSpecificDriverOverrideProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
CHAR16 *EFIAPI GraphicsOutputProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
EFI_STATUS EFIAPI AddNewGuidNameMapping(IN CONST EFI_GUID *Guid, IN CONST CHAR16 *TheName, IN CONST CHAR8 *Lang OPTIONAL)
CHAR16 * ConvertPixelFormat(IN CONST EFI_GRAPHICS_PIXEL_FORMAT Fmt)
EFI_STATUS EFIAPI ParseHandleDatabaseByRelationship(IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL, IN CONST EFI_HANDLE ControllerHandle OPTIONAL, IN CONST UINTN Mask, IN UINTN *MatchingHandleCount, OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL)
CHAR16 *EFIAPI FirmwareManagementDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
EFI_STATUS InternalShellInitHandleList(VOID)
CHAR16 *EFIAPI UsbIoProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
STATIC CHAR16 *EFIAPI DevicePathProtocolDumpInformationEx(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose, IN EFI_GUID *Protocol)
EFI_STATUS InsertNewGuidNameMapping(IN CONST EFI_GUID *Guid, IN CONST EFI_STRING_ID NameID, IN CONST DUMP_PROTOCOL_INFO DumpFunc OPTIONAL)
CHAR16 *EFIAPI PartitionInfoProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
CHAR16 * ConvertMemoryType(IN CONST EFI_MEMORY_TYPE Memory)
UINTN EFIAPI ConvertHandleToHandleIndex(IN CONST EFI_HANDLE TheHandle)
CHAR16 *EFIAPI PciRootBridgeIoDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
EFI_HANDLE *EFIAPI GetHandleListByProtocolList(IN CONST EFI_GUID **ProtocolGuids)
EFI_STATUS EFIAPI ParseHandleDatabaseForChildControllers(IN CONST EFI_HANDLE ControllerHandle, OUT UINTN *MatchingHandleCount, OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL)
CHAR16 *EFIAPI LoadedImageProtocolDumpInformation(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose)
EFI_HANDLE *EFIAPI GetHandleListByProtocol(IN CONST EFI_GUID *ProtocolGuid OPTIONAL)
#define STRING_TOKEN(t)
VOID * EFI_HII_HANDLE
EFI_STATUS EFIAPI GetVariable2(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
Definition: UefiLib.c:1317
CHAR16 *EFIAPI CatSPrint(IN CHAR16 *String OPTIONAL, IN CONST CHAR16 *FormatString,...)
Definition: UefiLibPrint.c:827
CHAR8 *EFIAPI GetBestLanguage(IN CONST CHAR8 *SupportedLanguages, IN UINTN Iso639Language,...)
Definition: UefiLib.c:1522
EFI_GUID *EFIAPI EfiGetNameGuidFromFwVolDevicePathNode(IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode)
Definition: UefiNotTiano.c:292
EFI_MEMORY_TYPE
@ EfiUnusableMemory
@ EfiBootServicesData
@ EfiReservedMemoryType
@ EfiBootServicesCode
@ EfiConventionalMemory
@ EfiLoaderData
@ EfiACPIMemoryNVS
@ EfiMemoryMappedIOPortSpace
@ EfiACPIReclaimMemory
@ EfiLoaderCode
@ EfiMemoryMappedIO
@ EfiPalCode
@ EfiRuntimeServicesCode
@ EfiRuntimeServicesData
@ ByProtocol
Definition: UefiSpec.h:1518
@ AllHandles
Definition: UefiSpec.h:1509
EFI_GUID gEfiUfsDeviceConfigProtocolGuid
EFI_BLOCK_IO_MEDIA * Media
Definition: BlockIo.h:224
EFI_INSTRUCTION_SET_ARCHITECTURE Isa
Definition: DebugSupport.h:946
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE * Mode
EFI_SIMPLE_TEXT_OUTPUT_MODE * Mode
BOOLEAN RemovableMedia
Definition: BlockIo.h:137
BOOLEAN LogicalPartition
Definition: BlockIo.h:150
UINT32 BlockSize
Definition: BlockIo.h:167
EFI_LBA LastBlock
Definition: BlockIo.h:178
BOOLEAN WriteCaching
Definition: BlockIo.h:161
BOOLEAN MediaPresent
Definition: BlockIo.h:144
BOOLEAN ReadOnly
Definition: BlockIo.h:156
EFI_GRAPHICS_PIXEL_FORMAT PixelFormat
EFI_PHYSICAL_ADDRESS FrameBufferBase
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * Info
EFI_DEVICE_PATH_PROTOCOL * FilePath
Definition: LoadedImage.h:54
EFI_MEMORY_TYPE ImageDataType
The memory type that the data sections were loaded as.
Definition: LoadedImage.h:70
VOID * LoadOptions
A pointer to the image's binary load options.
Definition: LoadedImage.h:62
EFI_HANDLE DeviceHandle
The device handle that the EFI Image was loaded from.
Definition: LoadedImage.h:53
UINT32 LoadOptionsSize
The size in bytes of LoadOptions.
Definition: LoadedImage.h:61
EFI_MEMORY_TYPE ImageCodeType
The memory type that the code sections were loaded as.
Definition: LoadedImage.h:69
UINT64 ImageSize
The size in bytes of the loaded image.
Definition: LoadedImage.h:68
EFI_SYSTEM_TABLE * SystemTable
the image's EFI system table pointer.
Definition: LoadedImage.h:48
VOID * ImageBase
The base address at which the image was loaded.
Definition: LoadedImage.h:67
EFI_PCI_IO_PROTOCOL_CONFIG Read
Definition: PciIo.h:232
Definition: Base.h:213