24 &gEfiDriverBindingProtocolGuid,
25 &gEfiPlatformDriverOverrideProtocolGuid,
26 &gEfiBusSpecificDriverOverrideProtocolGuid,
27 &gEfiDriverDiagnosticsProtocolGuid,
28 &gEfiDriverDiagnostics2ProtocolGuid,
29 &gEfiComponentNameProtocolGuid,
30 &gEfiComponentName2ProtocolGuid,
31 &gEfiPlatformToDriverConfigurationProtocolGuid,
32 &gEfiDriverSupportedEfiVersionProtocolGuid,
33 &gEfiDriverFamilyOverrideProtocolGuid,
34 &gEfiDriverHealthProtocolGuid,
35 &gEfiLoadedImageProtocolGuid,
39UINTN mGuidDataLen[] = { 8, 4, 4, 4, 12 };
56 CONST CHAR16 *PrevWalker;
67 while (Walker !=
NULL && *Walker != CHAR_NULL) {
68 if (((*Walker >=
'0') && (*Walker <=
'9')) ||
69 ((*Walker >=
'a') && (*Walker <=
'f')) ||
70 ((*Walker >=
'A') && (*Walker <=
'F'))
75 if ((*Walker == L
'-') && ((((
UINTN)Walker - (
UINTN)PrevWalker) /
sizeof (CHAR16)) == mGuidDataLen[Index])) {
85 if ((((
UINTN)Walker - (
UINTN)PrevWalker) /
sizeof (CHAR16)) == mGuidDataLen[Index]) {
109 if ((Char >=
'0') && (Char <=
'9')) {
111 }
else if ((Char >=
'a') && (Char <=
'f')) {
112 return Char - L
'a' + 10;
114 return Char - L
'A' + 10;
133 CONST CHAR16 *Walker;
138 return EFI_UNSUPPORTED;
153 while (Walker !=
NULL && *Walker != CHAR_NULL) {
154 if (*Walker == L
'-') {
158 TempValue = (UINT8)
LShiftU64 (TempValue, 4);
164 Guid->Data4[Index] = TempValue;
187 IN CHAR16 **NameFound
193 CHAR16 *NameToReturn;
198 Status =
gBS->OpenProtocol (
200 &gEfiComponentName2ProtocolGuid,
204 EFI_OPEN_PROTOCOL_GET_PROTOCOL
206 if (EFI_ERROR (Status)) {
207 Status =
gBS->OpenProtocol (
209 &gEfiComponentNameProtocolGuid,
213 EFI_OPEN_PROTOCOL_GET_PROTOCOL
217 if (EFI_ERROR (Status)) {
218 return (EFI_NOT_FOUND);
223 return (EFI_NOT_FOUND);
226 Status = CompName2->GetDriverName (CompName2, Lang, &NameToReturn);
229 if (!EFI_ERROR (Status) && (NameToReturn !=
NULL)) {
254 for (GuidWalker = UefiDriverModelProtocolsGuidArray
255 ; GuidWalker !=
NULL && *GuidWalker !=
NULL
298 CHAR16 InstanceStr[17];
300 ProtocolGuidArray =
NULL;
304 Status =
gBS->ProtocolsPerHandle (
309 if (!EFI_ERROR (Status)) {
310 for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
312 ASSERT ((RetVal ==
NULL && Size == 0) || (RetVal !=
NULL));
319 UnicodeSPrint (GuidStr,
sizeof (GuidStr), L
"%g", ProtocolGuidArray[ProtocolIndex]);
329 Status =
gBS->HandleProtocol (TheHandle, ProtocolGuidArray[ProtocolIndex], &Instance);
330 if (!EFI_ERROR (Status)) {
332 UnicodeSPrint (InstanceStr,
sizeof (InstanceStr), L
"%p", Instance);
341 ASSERT ((RetVal ==
NULL && Size == 0) || (RetVal !=
NULL));
357 SHELL_FREE_NON_NULL (ProtocolGuidArray);
359 if (RetVal ==
NULL) {
363 ASSERT ((RetVal ==
NULL && Size == 0) || (RetVal !=
NULL));
387 if ((TheHandle ==
NULL) || (Name ==
NULL)) {
388 return (EFI_INVALID_PARAMETER);
391 Status =
gBS->OpenProtocol (
393 &gEfiLoadedImageProtocolGuid,
394 (VOID **)&LoadedImage,
397 EFI_OPEN_PROTOCOL_GET_PROTOCOL
399 if (EFI_ERROR (Status)) {
419 IN CONST CHAR8 *Language OPTIONAL
423 BOOLEAN ConfigurationStatus;
424 BOOLEAN DiagnosticsStatus;
425 UINTN DriverBindingHandleCount;
427 UINTN ParentControllerHandleCount;
429 UINTN ChildControllerHandleCount;
431 CHAR16 *TempStringPointer;
436 UINTN NumberOfChildren;
438 UINTN ControllerHandleCount;
448 DriverBindingHandleBuffer =
NULL;
451 &DriverBindingHandleCount,
452 &DriverBindingHandleBuffer
455 ParentControllerHandleBuffer =
NULL;
458 &ParentControllerHandleCount,
459 &ParentControllerHandleBuffer
462 ChildControllerHandleBuffer =
NULL;
465 &ChildControllerHandleCount,
466 &ChildControllerHandleBuffer
469 DiagnosticsStatus =
FALSE;
470 ConfigurationStatus =
FALSE;
472 if (!EFI_ERROR (
gBS->OpenProtocol (Handle, &gEfiDriverConfigurationProtocolGuid,
NULL,
NULL,
gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
473 ConfigurationStatus =
TRUE;
476 if (!EFI_ERROR (
gBS->OpenProtocol (Handle, &gEfiDriverConfiguration2ProtocolGuid,
NULL,
NULL,
gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
477 ConfigurationStatus =
TRUE;
480 if (!EFI_ERROR (
gBS->OpenProtocol (Handle, &gEfiDriverDiagnosticsProtocolGuid,
NULL,
NULL,
gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
481 DiagnosticsStatus =
TRUE;
484 if (!EFI_ERROR (
gBS->OpenProtocol (Handle, &gEfiDriverDiagnostics2ProtocolGuid,
NULL,
NULL,
gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
485 DiagnosticsStatus =
TRUE;
490 if ((DriverBindingHandleCount > 0) || (ParentControllerHandleCount > 0) || (ChildControllerHandleCount > 0)) {
492 TempStringPointer =
NULL;
493 Status =
gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **)&DevicePath);
495 Status = gEfiShellProtocol->GetDeviceName (Handle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8 *)Language, &TempStringPointer);
497 SHELL_FREE_NON_NULL (TempStringPointer);
505 gShellDriver1HiiHandle,
506 TempStringPointer !=
NULL ? TempStringPointer : L
"<None>",
507 ParentControllerHandleCount == 0 ? L
"ROOT" : (ChildControllerHandleCount > 0) ? L
"BUS" : L
"DEVICE",
508 ConfigurationStatus ? L
"YES" : L
"NO",
509 DiagnosticsStatus ? L
"YES" : L
"NO"
512 SHELL_FREE_NON_NULL (TempStringPointer);
514 if (DriverBindingHandleCount == 0) {
520 gShellDriver1HiiHandle,
529 gShellDriver1HiiHandle,
532 for (Index = 0; Index < DriverBindingHandleCount; Index++) {
535 DriverBindingHandleBuffer[Index],
539 if (EFI_ERROR (Status)) {
541 DriverBindingHandleBuffer[Index],
544 if (EFI_ERROR (Status)) {
555 gShellDriver1HiiHandle,
557 DriverName !=
NULL ? DriverName : L
"<Unknown>"
565 gShellDriver1HiiHandle,
567 DriverName !=
NULL ? DriverName : L
"<Unknown>"
571 SHELL_FREE_NON_NULL (DriverName);
575 if (ParentControllerHandleCount == 0) {
581 gShellDriver1HiiHandle,
590 gShellDriver1HiiHandle,
593 for (Index = 0; Index < ParentControllerHandleCount; Index++) {
594 Status = gEfiShellProtocol->GetDeviceName (ParentControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8 *)Language, &TempStringPointer);
600 gShellDriver1HiiHandle,
602 TempStringPointer !=
NULL ? TempStringPointer : L
"<Unknown>"
604 SHELL_FREE_NON_NULL (TempStringPointer);
608 if (ChildControllerHandleCount == 0) {
614 gShellDriver1HiiHandle,
623 gShellDriver1HiiHandle,
626 for (Index = 0; Index < ChildControllerHandleCount; Index++) {
627 Status = gEfiShellProtocol->GetDeviceName (ChildControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8 *)Language, &TempStringPointer);
633 gShellDriver1HiiHandle,
635 TempStringPointer !=
NULL ? TempStringPointer : L
"<Unknown>"
637 SHELL_FREE_NON_NULL (TempStringPointer);
642 SHELL_FREE_NON_NULL (DriverBindingHandleBuffer);
644 SHELL_FREE_NON_NULL (ParentControllerHandleBuffer);
646 SHELL_FREE_NON_NULL (ChildControllerHandleBuffer);
648 if (EFI_ERROR (Status)) {
655 Status =
gBS->OpenProtocol (
657 &gEfiDriverBindingProtocolGuid,
658 (VOID **)&DriverBinding,
661 EFI_OPEN_PROTOCOL_GET_PROTOCOL
663 if (EFI_ERROR (Status)) {
667 NumberOfChildren = 0;
668 ControllerHandleBuffer =
NULL;
671 &ControllerHandleCount,
672 &ControllerHandleBuffer
674 if (ControllerHandleCount > 0) {
675 for (HandleIndex = 0; HandleIndex < ControllerHandleCount; HandleIndex++) {
678 ControllerHandleBuffer[HandleIndex],
679 &ChildControllerHandleCount,
682 NumberOfChildren += ChildControllerHandleCount;
687 if (EFI_ERROR (Status)) {
696 gShellDriver1HiiHandle,
698 DriverName !=
NULL ? DriverName : L
"<Unknown>"
700 SHELL_FREE_NON_NULL (DriverName);
705 if (EFI_ERROR (Status)) {
714 gShellDriver1HiiHandle,
715 DriverName !=
NULL ? DriverName : L
"<Unknown>"
717 SHELL_FREE_NON_NULL (DriverName);
724 gShellDriver1HiiHandle,
726 NumberOfChildren > 0 ? L
"Bus" : ControllerHandleCount > 0 ? L
"Device" : L
"<Unknown>",
727 ConfigurationStatus ? L
"YES" : L
"NO",
728 DiagnosticsStatus ? L
"YES" : L
"NO"
731 if (ControllerHandleCount == 0) {
737 gShellDriver1HiiHandle,
746 gShellDriver1HiiHandle,
749 for (HandleIndex = 0; HandleIndex < ControllerHandleCount; HandleIndex++) {
750 Status = gEfiShellProtocol->GetDeviceName (ControllerHandleBuffer[HandleIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8 *)Language, &TempStringPointer);
757 gShellDriver1HiiHandle,
759 TempStringPointer !=
NULL ? TempStringPointer : L
"<Unknown>"
761 SHELL_FREE_NON_NULL (TempStringPointer);
765 ControllerHandleBuffer[HandleIndex],
766 &ChildControllerHandleCount,
767 &ChildControllerHandleBuffer
769 if (!EFI_ERROR (Status)) {
770 for (ChildIndex = 0; ChildIndex < ChildControllerHandleCount; ChildIndex++) {
771 Status = gEfiShellProtocol->GetDeviceName (ChildControllerHandleBuffer[ChildIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8 *)Language, &TempStringPointer);
778 gShellDriver1HiiHandle,
780 TempStringPointer !=
NULL ? TempStringPointer : L
"<Unknown>"
782 SHELL_FREE_NON_NULL (TempStringPointer);
785 SHELL_FREE_NON_NULL (ChildControllerHandleBuffer);
789 SHELL_FREE_NON_NULL (ControllerHandleBuffer);
816 CHAR16 *ProtocolInfoString;
818 ProtocolInfoString =
NULL;
828 gShellDriver1HiiHandle,
830 ProtocolInfoString ==
NULL ? L
"" : ProtocolInfoString
840 gShellDriver1HiiHandle,
843 ProtocolInfoString ==
NULL ? L
"" : ProtocolInfoString
851 gShellDriver1HiiHandle,
853 ProtocolInfoString ==
NULL ? L
"" : ProtocolInfoString
868 gShellDriver1HiiHandle,
869 Multiple ? L
"HandlesInfo" : L
"HandleInfo",
874 ProtocolInfoString ==
NULL ? L
"" : ProtocolInfoString
878 if (ProtocolInfoString !=
NULL) {
908 for (HandleWalker = HandleList; HandleWalker !=
NULL && *HandleWalker !=
NULL; HandleWalker++) {
916 return (ShellStatus);
959 ShellStatus =
DoDhForHandleList (HandleList, Verbose, Sfo, Language, DriverInfo);
960 SHELL_FREE_NON_NULL (HandleList);
992 if (Protocol ==
NULL) {
996 if (!EFI_ERROR (Status)) {
1003 if (EFI_ERROR (Status)) {
1038 if (Protocol ==
NULL) {
1041 if (Status == EFI_BUFFER_TOO_SMALL) {
1043 if (Guids ==
NULL) {
1049 for (Index = 0; Index < Counts; Index++) {
1057 SHELL_FREE_NON_NULL (Name);
1072 SHELL_FREE_NON_NULL (Name);
1101 CHAR16 *ProblemParam;
1105 CONST CHAR16 *RawValue;
1106 CONST CHAR16 *ProtocolVal;
1109 BOOLEAN VerboseFlag;
1110 UINT64 Intermediate;
1130 if (EFI_ERROR (Status)) {
1131 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
1149 if (Language ==
NULL) {
1157 ASSERT (Language ==
NULL);
1164 if (Language ==
NULL) {
1179 if (RawValue ==
NULL) {
1187 ShellStatus =
DoDhByProtocol (ProtocolVal, VerboseFlag, SfoFlag, Language, DriverFlag);
1189 }
else if ((RawValue !=
NULL) &&
1190 (gUnicodeCollation->StriColl (gUnicodeCollation, L
"decode", (CHAR16 *)RawValue) == 0))
1207 if (EFI_ERROR (Status)) {
1212 if (Handle ==
NULL) {
1226 SHELL_FREE_NON_NULL (Language);
1229 return (ShellStatus);
UINT64 EFIAPI StrHexToUint64(IN CONST CHAR16 *String)
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
SHELL_STATUS DoDhByProtocolGuid(IN CONST GUID *Guid, IN CONST BOOLEAN Verbose, IN CONST BOOLEAN Sfo, IN CONST CHAR8 *Language, IN CONST BOOLEAN DriverInfo)
EFI_STATUS DisplayDriverModelHandle(IN EFI_HANDLE Handle, IN BOOLEAN BestName, IN CONST CHAR8 *Language OPTIONAL)
SHELL_STATUS DoDhForHandleList(IN CONST EFI_HANDLE *HandleList, IN CONST BOOLEAN Verbose, IN CONST BOOLEAN Sfo, IN CONST CHAR8 *Language, IN CONST BOOLEAN DriverInfo)
SHELL_STATUS DoDecodeByProtocol(IN CONST CHAR16 *Protocol, IN CONST CHAR8 *Language)
SHELL_STATUS EFIAPI ShellCommandRunDh(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
BOOLEAN IsValidGuidString(IN CONST CHAR16 *String)
EFI_STATUS ConvertStrToGuid(IN CONST CHAR16 *String, OUT GUID *Guid)
VOID DoDhByHandle(IN CONST EFI_HANDLE TheHandle, IN CONST BOOLEAN Verbose, IN CONST BOOLEAN Sfo, IN CONST CHAR8 *Language, IN CONST BOOLEAN DriverInfo, IN CONST BOOLEAN Multiple)
BOOLEAN IsDriverProt(IN CONST EFI_GUID *Guid)
EFI_STATUS GetDriverImageName(IN EFI_HANDLE TheHandle, OUT CHAR16 **Name)
CHAR16 * GetProtocolInfoString(IN CONST EFI_HANDLE TheHandle, IN CONST CHAR8 *Language, IN CONST CHAR16 *Separator, IN CONST BOOLEAN Verbose, IN CONST BOOLEAN ExtraInfo)
SHELL_STATUS DoDhByProtocol(IN CONST CHAR16 *Protocol, IN CONST BOOLEAN Verbose, IN CONST BOOLEAN Sfo, IN CONST CHAR8 *Language, IN CONST BOOLEAN DriverInfo)
UINTN HexCharToDecimal(IN CHAR16 Char)
EFI_STATUS GetDriverName(IN EFI_HANDLE TheHandle, IN CONST CHAR8 *Language, IN CHAR16 **NameFound)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
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)
#define PARSE_HANDLE_DATABASE_MANAGED_CHILDREN(DriverHandle, ControllerHandle, Count, Buffer)
CHAR16 *EFIAPI GetStringNameFromGuid(IN CONST EFI_GUID *Guid, IN CONST CHAR8 *Lang OPTIONAL)
CHAR8 *EFIAPI GetBestLanguageForDriver(IN CONST CHAR8 *SupportedLanguages, IN CONST CHAR8 *InputLanguage, IN BOOLEAN Iso639Language)
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)
#define PARSE_HANDLE_DATABASE_DEVICES(DriverHandle, Count, Buffer)
#define PARSE_HANDLE_DATABASE_PARENTS(ControllerHandle, Count, Buffer)
#define PARSE_HANDLE_DATABASE_UEFI_DRIVERS(ControllerHandle, Count, Buffer)
UINTN EFIAPI ConvertHandleToHandleIndex(IN CONST EFI_HANDLE TheHandle)
EFI_STATUS EFIAPI ParseHandleDatabaseForChildControllers(IN CONST EFI_HANDLE ControllerHandle, OUT UINTN *MatchingHandleCount, OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL)
EFI_HANDLE *EFIAPI GetHandleListByProtocol(IN CONST EFI_GUID *ProtocolGuid OPTIONAL)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
UINTN EFIAPI AsciiSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...)
#define ASSERT_EFI_ERROR(StatusParameter)
@ SHELL_INVALID_PARAMETER
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI CommandInit(VOID)
CONST CHAR16 *EFIAPI ShellCommandLineGetValue(IN CONST LIST_ENTRY *CheckPackage, IN CHAR16 *KeyString)
BOOLEAN EFIAPI ShellGetExecutionBreakFlag(VOID)
#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak)
Make it easy to upgrade from older versions of the shell library.
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
BOOLEAN EFIAPI ShellCommandLineGetFlag(IN CONST LIST_ENTRY *CONST CheckPackage, IN CONST CHAR16 *CONST KeyString)
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
@ TypeFlag
A flag that is present or not present only (IE "-a").
CHAR16 *EFIAPI StrnCatGrow(IN OUT CHAR16 **Destination, IN OUT UINTN *CurrentSize, IN CONST CHAR16 *Source, IN UINTN Count)
VOID EFIAPI ShellCommandLineFreeVarList(IN LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellInitialize(VOID)
CONST CHAR16 *EFIAPI ShellCommandLineGetRawValue(IN CONST LIST_ENTRY *CONST CheckPackage, IN UINTN Position)
UINTN EFIAPI ShellCommandLineGetCount(IN CONST LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellConvertStringToUint64(IN CONST CHAR16 *String, OUT UINT64 *Value, IN CONST BOOLEAN ForceHex, IN CONST BOOLEAN StopAtSpace)
CHAR8 * SupportedLanguages
EFI_DEVICE_PATH_PROTOCOL * FilePath