22EFI_GUID mDriverHealthManagerForm = DRIVER_HEALTH_MANAGER_FORMSET_GUID;
38 END_ENTIRE_DEVICE_PATH_SUBTYPE,
40 (UINT8)(END_DEVICE_PATH_LENGTH),
41 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
48UINTN mDriverHealthManagerHealthInfoCount = 0;
51extern UINT8 DriverHealthManagerVfrBin[];
52extern UINT8 DriverHealthConfigureVfrBin[];
81 OUT EFI_STRING *Progress,
82 OUT EFI_STRING *Results
85 if ((Progress ==
NULL) || (Results ==
NULL)) {
86 return EFI_INVALID_PARAMETER;
113 IN CONST EFI_STRING Configuration,
114 OUT EFI_STRING *Progress
117 if ((Configuration ==
NULL) || (Progress ==
NULL)) {
118 return EFI_INVALID_PARAMETER;
121 *Progress = Configuration;
123 return EFI_NOT_FOUND;
149 Status =
gBS->LocateProtocol (
150 &gEfiHiiDatabaseProtocolGuid,
152 (VOID **)&mDriverHealthManagerDatabase
157 Status =
gBS->InstallMultipleProtocolInterfaces (
159 &gEfiDevicePathProtocolGuid,
160 &mDriverHealthManagerFormDevicePath,
161 &gEfiHiiConfigAccessProtocolGuid,
162 &mDriverHealthManagerConfigAccess,
173 DriverHealthManagerVfrBin,
174 DriverHealthConfigureVfrBin,
178 ASSERT (mDriverHealthManagerHiiHandle !=
NULL);
205 IN CHAR8 *SupportedLanguages,
206 IN BOOLEAN Iso639Language
209 CHAR8 *LanguageVariable;
217 (LanguageVariable !=
NULL) ? LanguageVariable :
"",
218 Iso639Language ?
"eng" :
"en-US",
221 if (LanguageVariable !=
NULL) {
251 OUT CHAR8 **SupportedLanguage
259 Status =
gBS->OpenProtocol (
262 (VOID **)ComponentName,
265 EFI_OPEN_PROTOCOL_GET_PROTOCOL
267 if (EFI_ERROR (Status)) {
275 (*ComponentName)->SupportedLanguages,
276 (BOOLEAN)(ProtocolGuid == &gEfiComponentNameProtocolGuid)
278 if (*SupportedLanguage ==
NULL) {
279 Status = EFI_UNSUPPORTED;
304 OUT CHAR16 **DriverName
321 if (EFI_ERROR (Status)) {
328 Status = ComponentName->GetDriverName (
363 if (EFI_ERROR (Status)) {
371 if (!EFI_ERROR (Status)) {
407 OUT CHAR16 **ControllerName
424 if (EFI_ERROR (Status)) {
431 Status = ComponentName->GetControllerName (
470 CHAR16 *ControllerName;
476 &gEfiComponentName2ProtocolGuid,
482 if (EFI_ERROR (Status)) {
488 &gEfiComponentNameProtocolGuid,
496 if (!EFI_ERROR (Status)) {
521 DEBUG ((DEBUG_INFO,
"[DriverHealthManagement]RepairNotify: %d/%d\n", Value, Limit));
549 UINT8 NumberOfClassGuid;
556 HiiPackageList =
NULL;
557 Status = mDriverHealthManagerDatabase->ExportPackageLists (mDriverHealthManagerDatabase, Handle, &BufferSize, HiiPackageList);
558 if (Status == EFI_BUFFER_TOO_SMALL) {
560 ASSERT (HiiPackageList !=
NULL);
562 Status = mDriverHealthManagerDatabase->ExportPackageLists (mDriverHealthManagerDatabase, Handle, &BufferSize, HiiPackageList);
565 if (EFI_ERROR (Status)) {
569 ASSERT (HiiPackageList !=
NULL);
575 Package = ((UINT8 *)HiiPackageList) + Offset;
578 if (PackageHeader.Type == EFI_HII_PACKAGE_FORMS) {
584 OpCodeData = Package + Offset2;
594 for (Index = 0; Index < NumberOfClassGuid; Index++) {
595 if (
CompareGuid (&gEfiHiiDriverHealthFormsetGuid, &ClassGuid[Index])) {
610 return EFI_NOT_FOUND;
640 ASSERT (HealthStatus != EfiDriverHealthStatusConfigurationRequired);
646 switch (HealthStatus) {
647 case EfiDriverHealthStatusRepairRequired:
648 Status = DriverHealth->Repair (
656 case EfiDriverHealthStatusRebootRequired:
660 case EfiDriverHealthStatusReconnectRequired:
661 Status =
gBS->DisconnectController (ControllerHandle,
NULL,
NULL);
662 if (EFI_ERROR (Status)) {
686 BOOLEAN ConfigureOnly
692 VOID *StartOpCodeHandle;
693 VOID *EndOpCodeHandle;
695 EFI_STRING_ID Prompt;
699 EFI_STRING TmpString;
700 EFI_STRING DriverName;
701 EFI_STRING ControllerName;
704 EFI_STRING_ID DevicePath;
714 ASSERT (StartOpCodeHandle !=
NULL);
717 ASSERT (EndOpCodeHandle !=
NULL);
724 StartLabel->
Number = LABEL_BEGIN;
731 EndLabel->
Number = LABEL_END;
733 for (Index = 0; Index < mDriverHealthManagerHealthInfoCount; Index++) {
734 if (ConfigureOnly && (mDriverHealthManagerHealthInfo[Index].HealthStatus != EfiDriverHealthStatusConfigurationRequired)) {
739 ASSERT (DriverName !=
NULL);
741 if (mDriverHealthManagerHealthInfo[Index].ControllerHandle ==
NULL) {
746 ASSERT (mDriverHealthManagerHealthInfo[Index].HealthStatus == EfiDriverHealthStatusHealthy);
750 mDriverHealthManagerHealthInfo[Index].DriverHealthHandle,
751 mDriverHealthManagerHealthInfo[Index].ControllerHandle,
752 mDriverHealthManagerHealthInfo[Index].ChildHandle
754 ASSERT (ControllerName !=
NULL);
755 UnicodeSPrint (String,
sizeof (String), L
"%s %s", DriverName, ControllerName);
763 switch (mDriverHealthManagerHealthInfo[Index].HealthStatus) {
764 case EfiDriverHealthStatusRepairRequired:
767 case EfiDriverHealthStatusConfigurationRequired:
770 case EfiDriverHealthStatusFailed:
773 case EfiDriverHealthStatusReconnectRequired:
776 case EfiDriverHealthStatusRebootRequired:
780 ASSERT (mDriverHealthManagerHealthInfo[Index].HealthStatus == EfiDriverHealthStatusHealthy);
785 StringCount =
UnicodeSPrint (String,
sizeof (String), L
"%s\n", TmpString);
791 if (mDriverHealthManagerHealthInfo[Index].MessageList !=
NULL) {
792 for (MessageIndex = 0; mDriverHealthManagerHealthInfo[Index].
MessageList[MessageIndex].HiiHandle !=
NULL; MessageIndex++) {
794 mDriverHealthManagerHealthInfo[Index].MessageList[MessageIndex].HiiHandle,
795 mDriverHealthManagerHealthInfo[Index].MessageList[MessageIndex].StringId,
798 StringCount +=
UnicodeSPrint (String + StringCount,
sizeof (String) -
sizeof (String[0]) * StringCount, L
"\n%s", TmpString);
805 switch (mDriverHealthManagerHealthInfo[Index].HealthStatus) {
806 case EfiDriverHealthStatusConfigurationRequired:
807 Status = mDriverHealthManagerDatabase->GetPackageListHandle (
808 mDriverHealthManagerDatabase,
809 mDriverHealthManagerHealthInfo[Index].HiiHandle,
814 DevicePath =
HiiSetString (mDriverHealthManagerHiiHandle, 0, TmpString,
NULL);
833 case EfiDriverHealthStatusRepairRequired:
834 case EfiDriverHealthStatusReconnectRequired:
835 case EfiDriverHealthStatusRebootRequired:
838 (EFI_QUESTION_ID)(Index + QUESTION_ID_DRIVER_HEALTH_BASE),
841 EFI_IFR_FLAG_CALLBACK,
848 mDriverHealthManagerHealthInfo[Index].HealthStatus == EfiDriverHealthStatusHealthy ||
849 mDriverHealthManagerHealthInfo[Index].HealthStatus == EfiDriverHealthStatusFailed
862 mDriverHealthManagerHiiHandle,
863 ConfigureOnly ?
PcdGetPtr (PcdDriverHealthConfigureForm) : &mDriverHealthManagerForm,
864 DRIVER_HEALTH_FORM_ID,
886 UINT32 FixedStringSize;
888 FixedStringSize = *(UINT32 *)&STRING_ARRAY_NAME -
sizeof (UINT32);
891 ASSERT (HiiPackageList !=
NULL);
893 HiiPackageList->PackageLength = (UINT32)BufferSize;
894 CopyMem (&HiiPackageList->PackageListGuid, &gEfiCallerIdGuid, sizeof (
EFI_GUID));
897 CopyMem (PackageHeader, STRING_ARRAY_NAME +
sizeof (UINT32), FixedStringSize);
900 PackageHeader->Type = EFI_HII_PACKAGE_END;
903 Status = mDriverHealthManagerDatabase->UpdatePackageList (
904 mDriverHealthManagerDatabase,
905 mDriverHealthManagerHiiHandle,
936 IN EFI_BROWSER_ACTION Action,
937 IN EFI_QUESTION_ID QuestionId,
940 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
945 if ((QuestionId == QUESTION_ID_REFRESH_MANAGER) || (QuestionId == QUESTION_ID_REFRESH_CONFIGURE)) {
946 if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
948 }
else if (Action == EFI_BROWSER_ACTION_FORM_CLOSE) {
955 if (Action != EFI_BROWSER_ACTION_CHANGED) {
959 return EFI_UNSUPPORTED;
962 if ((Value ==
NULL) || (ActionRequest ==
NULL)) {
963 return EFI_INVALID_PARAMETER;
966 DEBUG ((DEBUG_ERROR,
"QuestionId = %x\n", QuestionId));
973 Index = QuestionId - QUESTION_ID_DRIVER_HEALTH_BASE;
974 ASSERT (Index < mDriverHealthManagerHealthInfoCount);
979 mDriverHealthManagerHealthInfo[Index].DriverHealth,
980 mDriverHealthManagerHealthInfo[Index].ControllerHandle,
981 mDriverHealthManagerHealthInfo[Index].ChildHandle,
982 mDriverHealthManagerHealthInfo[Index].HealthStatus,
983 &(mDriverHealthManagerHealthInfo[Index].MessageList),
984 mDriverHealthManagerHealthInfo[Index].HiiHandle
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
UINT32 EFIAPI ReadUnaligned32(IN CONST UINT32 *Buffer)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
#define HARDWARE_DEVICE_PATH
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DevicePathFromHandle(IN EFI_HANDLE Handle)
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
CHAR8 * DriverHealthManagerSelectBestLanguage(IN CHAR8 *SupportedLanguages, IN BOOLEAN Iso639Language)
EFI_STATUS DriverHealthManagerGetDriverNameWorker(IN EFI_GUID *ProtocolGuid, IN EFI_HANDLE DriverBindingHandle, OUT CHAR16 **DriverName)
VOID DriverHealthManagerCleanDynamicString(VOID)
EFI_STATUS EFIAPI DriverHealthManagerRepairNotify(IN UINTN Value, IN UINTN Limit)
EFI_STATUS DriverHealthManagerGetComponentNameWorker(IN EFI_GUID *ProtocolGuid, IN EFI_HANDLE DriverBindingHandle, OUT EFI_COMPONENT_NAME_PROTOCOL **ComponentName, OUT CHAR8 **SupportedLanguage)
VOID DriverHealthManagerUpdateForm(BOOLEAN ConfigureOnly)
VOID DriverHealthManagerProcessSingleControllerHealth(IN EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth, IN EFI_HANDLE ControllerHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_DRIVER_HEALTH_STATUS HealthStatus, IN EFI_DRIVER_HEALTH_HII_MESSAGE **MessageList OPTIONAL, IN EFI_HII_HANDLE FormHiiHandle)
EFI_STATUS EFIAPI DriverHealthManagerFakeRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
EFI_STATUS EFIAPI DriverHealthManagerFakeExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
EFI_STATUS DriverHealthManagerGetControllerNameWorker(IN EFI_GUID *ProtocolGuid, IN EFI_HANDLE DriverBindingHandle, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle, OUT CHAR16 **ControllerName)
EFI_STATUS EFIAPI DriverHealthManagerCallback(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest)
CHAR16 * DriverHealthManagerGetDriverName(IN EFI_HANDLE DriverBindingHandle)
EFI_STATUS DriverHealthManagerGetFormsetId(IN EFI_HII_HANDLE Handle, OUT EFI_GUID *FormsetGuid)
EFI_STATUS EFIAPI InitializeDriverHealthManager(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
CHAR16 * DriverHealthManagerGetControllerName(IN EFI_HANDLE DriverBindingHandle, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
VOID *EFIAPI HiiAllocateOpCodeHandle(VOID)
VOID EFIAPI HiiFreeOpCodeHandle(VOID *OpCodeHandle)
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
UINT8 *EFIAPI HiiCreateGuidOpCode(IN VOID *OpCodeHandle, IN CONST EFI_GUID *Guid, IN CONST VOID *GuidOpCode OPTIONAL, IN UINTN OpCodeSize)
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
EFI_STATUS EFIAPI HiiUpdateForm(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid OPTIONAL, IN EFI_FORM_ID FormId, IN VOID *StartOpCodeHandle, IN VOID *EndOpCodeHandle OPTIONAL)
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)
UINT8 *EFIAPI HiiCreateGotoExOpCode(IN VOID *OpCodeHandle, IN EFI_FORM_ID RefFormId, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN EFI_QUESTION_ID QuestionId, IN EFI_QUESTION_ID RefQuestionId, IN EFI_GUID *RefFormSetId OPTIONAL, IN EFI_STRING_ID RefDevicePath)
UINT8 *EFIAPI HiiCreateActionOpCode(IN VOID *OpCodeHandle, IN EFI_QUESTION_ID QuestionId, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN EFI_STRING_ID QuestionConfig)
UINT8 *EFIAPI HiiCreateTextOpCode(IN VOID *OpCodeHandle, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN EFI_STRING_ID TextTwo)
#define EFI_IFR_EXTEND_OP_LABEL
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
EFI_RUNTIME_SERVICES * gRT
#define OFFSET_OF(TYPE, Field)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define PcdGetPtr(TokenName)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI EfiBootManagerFreeDriverHealthInfo(EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *DriverHealthInfo, UINTN Count)
EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *EFIAPI EfiBootManagerGetDriverHealthInfo(UINTN *Count)
EFI_STATUS EFIAPI GetEfiGlobalVariable2(IN CONST CHAR16 *Name, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
CHAR8 *EFIAPI GetBestLanguage(IN CONST CHAR8 *SupportedLanguages, IN UINTN Iso639Language,...)
EFI_DRIVER_HEALTH_HII_MESSAGE * MessageList