TianoCore EDK2 master
Loading...
Searching...
No Matches
DriverHealthManagerDxe.c
Go to the documentation of this file.
1
15
16EFI_HII_CONFIG_ACCESS_PROTOCOL mDriverHealthManagerConfigAccess = {
20};
21
22EFI_GUID mDriverHealthManagerForm = DRIVER_HEALTH_MANAGER_FORMSET_GUID;
23
24FORM_DEVICE_PATH mDriverHealthManagerFormDevicePath = {
25 {
26 {
29 {
30 (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
31 (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
32 }
33 },
34 EFI_CALLER_ID_GUID
35 },
36 {
37 END_DEVICE_PATH_TYPE,
38 END_ENTIRE_DEVICE_PATH_SUBTYPE,
39 {
40 (UINT8)(END_DEVICE_PATH_LENGTH),
41 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
42 }
43 }
44};
45
46EFI_HII_HANDLE mDriverHealthManagerHiiHandle;
47EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *mDriverHealthManagerHealthInfo = NULL;
48UINTN mDriverHealthManagerHealthInfoCount = 0;
49EFI_HII_DATABASE_PROTOCOL *mDriverHealthManagerDatabase;
50
51extern UINT8 DriverHealthManagerVfrBin[];
52extern UINT8 DriverHealthConfigureVfrBin[];
53
77EFIAPI
80 IN CONST EFI_STRING Request,
81 OUT EFI_STRING *Progress,
82 OUT EFI_STRING *Results
83 )
84{
85 if ((Progress == NULL) || (Results == NULL)) {
86 return EFI_INVALID_PARAMETER;
87 }
88
89 *Progress = Request;
90 return EFI_NOT_FOUND;
91}
92
110EFIAPI
113 IN CONST EFI_STRING Configuration,
114 OUT EFI_STRING *Progress
115 )
116{
117 if ((Configuration == NULL) || (Progress == NULL)) {
118 return EFI_INVALID_PARAMETER;
119 }
120
121 *Progress = Configuration;
122
123 return EFI_NOT_FOUND;
124}
125
140EFIAPI
142 EFI_HANDLE ImageHandle,
143 EFI_SYSTEM_TABLE *SystemTable
144 )
145{
146 EFI_STATUS Status;
147 EFI_HANDLE Handle;
148
149 Status = gBS->LocateProtocol (
150 &gEfiHiiDatabaseProtocolGuid,
151 NULL,
152 (VOID **)&mDriverHealthManagerDatabase
153 );
154 ASSERT_EFI_ERROR (Status);
155
156 Handle = NULL;
157 Status = gBS->InstallMultipleProtocolInterfaces (
158 &Handle,
159 &gEfiDevicePathProtocolGuid,
160 &mDriverHealthManagerFormDevicePath,
161 &gEfiHiiConfigAccessProtocolGuid,
162 &mDriverHealthManagerConfigAccess,
163 NULL
164 );
165 ASSERT_EFI_ERROR (Status);
166
167 //
168 // Publish Driver Health HII data.
169 //
170 mDriverHealthManagerHiiHandle = HiiAddPackages (
171 &gEfiCallerIdGuid,
172 Handle,
173 DriverHealthManagerVfrBin,
174 DriverHealthConfigureVfrBin,
175 STRING_ARRAY_NAME,
176 NULL
177 );
178 ASSERT (mDriverHealthManagerHiiHandle != NULL);
179
180 return EFI_SUCCESS;
181}
182
203CHAR8 *
205 IN CHAR8 *SupportedLanguages,
206 IN BOOLEAN Iso639Language
207 )
208{
209 CHAR8 *LanguageVariable;
210 CHAR8 *BestLanguage;
211
212 GetEfiGlobalVariable2 (Iso639Language ? L"Lang" : L"PlatformLang", (VOID **)&LanguageVariable, NULL);
213
214 BestLanguage = GetBestLanguage (
215 SupportedLanguages,
216 Iso639Language,
217 (LanguageVariable != NULL) ? LanguageVariable : "",
218 Iso639Language ? "eng" : "en-US",
219 NULL
220 );
221 if (LanguageVariable != NULL) {
222 FreePool (LanguageVariable);
223 }
224
225 return BestLanguage;
226}
227
248 IN EFI_GUID *ProtocolGuid,
249 IN EFI_HANDLE DriverBindingHandle,
250 OUT EFI_COMPONENT_NAME_PROTOCOL **ComponentName,
251 OUT CHAR8 **SupportedLanguage
252 )
253{
254 EFI_STATUS Status;
255
256 //
257 // Locate Component Name (2) protocol on the driver binging handle.
258 //
259 Status = gBS->OpenProtocol (
260 DriverBindingHandle,
261 ProtocolGuid,
262 (VOID **)ComponentName,
263 NULL,
264 NULL,
265 EFI_OPEN_PROTOCOL_GET_PROTOCOL
266 );
267 if (EFI_ERROR (Status)) {
268 return Status;
269 }
270
271 //
272 // Apply shell policy to select the best language.
273 //
274 *SupportedLanguage = DriverHealthManagerSelectBestLanguage (
275 (*ComponentName)->SupportedLanguages,
276 (BOOLEAN)(ProtocolGuid == &gEfiComponentNameProtocolGuid)
277 );
278 if (*SupportedLanguage == NULL) {
279 Status = EFI_UNSUPPORTED;
280 }
281
282 return Status;
283}
284
302 IN EFI_GUID *ProtocolGuid,
303 IN EFI_HANDLE DriverBindingHandle,
304 OUT CHAR16 **DriverName
305 )
306{
307 EFI_STATUS Status;
308 CHAR8 *BestLanguage;
309 EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
310
311 //
312 // Retrieve Component Name (2) protocol instance on the driver binding handle and
313 // find the best language this instance supports.
314 //
316 ProtocolGuid,
317 DriverBindingHandle,
318 &ComponentName,
319 &BestLanguage
320 );
321 if (EFI_ERROR (Status)) {
322 return Status;
323 }
324
325 //
326 // Get the driver name from Component Name (2) protocol instance on the driver binging handle.
327 //
328 Status = ComponentName->GetDriverName (
329 ComponentName,
330 BestLanguage,
331 DriverName
332 );
333 FreePool (BestLanguage);
334
335 return Status;
336}
337
351CHAR16 *
353 IN EFI_HANDLE DriverBindingHandle
354 )
355{
356 EFI_STATUS Status;
357 CHAR16 *DriverName;
358
359 //
360 // Get driver name from UEFI 2.0 Component Name 2 protocol interface.
361 //
362 Status = DriverHealthManagerGetDriverNameWorker (&gEfiComponentName2ProtocolGuid, DriverBindingHandle, &DriverName);
363 if (EFI_ERROR (Status)) {
364 //
365 // If it fails to get the driver name from Component Name protocol interface, we should fall back on
366 // EFI 1.1 Component Name protocol interface.
367 //
368 Status = DriverHealthManagerGetDriverNameWorker (&gEfiComponentNameProtocolGuid, DriverBindingHandle, &DriverName);
369 }
370
371 if (!EFI_ERROR (Status)) {
372 return AllocateCopyPool (StrSize (DriverName), DriverName);
373 } else {
374 return ConvertDevicePathToText (DevicePathFromHandle (DriverBindingHandle), FALSE, TRUE);
375 }
376}
377
403 IN EFI_GUID *ProtocolGuid,
404 IN EFI_HANDLE DriverBindingHandle,
405 IN EFI_HANDLE ControllerHandle,
406 IN EFI_HANDLE ChildHandle,
407 OUT CHAR16 **ControllerName
408 )
409{
410 EFI_STATUS Status;
411 CHAR8 *BestLanguage;
412 EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
413
414 //
415 // Retrieve Component Name (2) protocol instance on the driver binding handle and
416 // find the best language this instance supports.
417 //
419 ProtocolGuid,
420 DriverBindingHandle,
421 &ComponentName,
422 &BestLanguage
423 );
424 if (EFI_ERROR (Status)) {
425 return Status;
426 }
427
428 //
429 // Get the controller name from Component Name (2) protocol instance on the driver binging handle.
430 //
431 Status = ComponentName->GetControllerName (
432 ComponentName,
433 ControllerHandle,
434 ChildHandle,
435 BestLanguage,
436 ControllerName
437 );
438 FreePool (BestLanguage);
439
440 return Status;
441}
442
462CHAR16 *
464 IN EFI_HANDLE DriverBindingHandle,
465 IN EFI_HANDLE ControllerHandle,
466 IN EFI_HANDLE ChildHandle
467 )
468{
469 EFI_STATUS Status;
470 CHAR16 *ControllerName;
471
472 //
473 // Get controller name from UEFI 2.0 Component Name 2 protocol interface.
474 //
476 &gEfiComponentName2ProtocolGuid,
477 DriverBindingHandle,
478 ControllerHandle,
479 ChildHandle,
480 &ControllerName
481 );
482 if (EFI_ERROR (Status)) {
483 //
484 // If it fails to get the controller name from Component Name protocol interface, we should fall back on
485 // EFI 1.1 Component Name protocol interface.
486 //
488 &gEfiComponentNameProtocolGuid,
489 DriverBindingHandle,
490 ControllerHandle,
491 ChildHandle,
492 &ControllerName
493 );
494 }
495
496 if (!EFI_ERROR (Status)) {
497 return AllocateCopyPool (StrSize (ControllerName), ControllerName);
498 } else {
499 return ConvertDevicePathToText (DevicePathFromHandle (ChildHandle != NULL ? ChildHandle : ControllerHandle), FALSE, TRUE);
500 }
501}
502
515EFIAPI
517 IN UINTN Value,
518 IN UINTN Limit
519 )
520{
521 DEBUG ((DEBUG_INFO, "[DriverHealthManagement]RepairNotify: %d/%d\n", Value, Limit));
522 return EFI_SUCCESS;
523}
524
536 IN EFI_HII_HANDLE Handle,
537 OUT EFI_GUID *FormsetGuid
538 )
539{
540 EFI_STATUS Status;
541 EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
542 UINTN BufferSize;
543 UINT8 *Package;
544 UINT8 *OpCodeData;
545 UINT32 Offset;
546 UINT32 Offset2;
547 EFI_HII_PACKAGE_HEADER PackageHeader;
548 UINT8 Index;
549 UINT8 NumberOfClassGuid;
550 EFI_GUID *ClassGuid;
551
552 //
553 // Get HII PackageList
554 //
555 BufferSize = 0;
556 HiiPackageList = NULL;
557 Status = mDriverHealthManagerDatabase->ExportPackageLists (mDriverHealthManagerDatabase, Handle, &BufferSize, HiiPackageList);
558 if (Status == EFI_BUFFER_TOO_SMALL) {
559 HiiPackageList = AllocatePool (BufferSize);
560 ASSERT (HiiPackageList != NULL);
561
562 Status = mDriverHealthManagerDatabase->ExportPackageLists (mDriverHealthManagerDatabase, Handle, &BufferSize, HiiPackageList);
563 }
564
565 if (EFI_ERROR (Status)) {
566 return Status;
567 }
568
569 ASSERT (HiiPackageList != NULL);
570
571 //
572 // Get Form package from this HII package List
573 //
574 for (Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER); Offset < ReadUnaligned32 (&HiiPackageList->PackageLength); Offset += PackageHeader.Length) {
575 Package = ((UINT8 *)HiiPackageList) + Offset;
576 CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
577
578 if (PackageHeader.Type == EFI_HII_PACKAGE_FORMS) {
579 //
580 // Search FormSet in this Form Package
581 //
582
583 for (Offset2 = sizeof (EFI_HII_PACKAGE_HEADER); Offset2 < PackageHeader.Length; Offset2 += ((EFI_IFR_OP_HEADER *)OpCodeData)->Length) {
584 OpCodeData = Package + Offset2;
585
586 if ((((EFI_IFR_OP_HEADER *)OpCodeData)->OpCode == EFI_IFR_FORM_SET_OP) &&
587 (((EFI_IFR_OP_HEADER *)OpCodeData)->Length > OFFSET_OF (EFI_IFR_FORM_SET, Flags)))
588 {
589 //
590 // Try to compare against formset class GUID
591 //
592 NumberOfClassGuid = (UINT8)(((EFI_IFR_FORM_SET *)OpCodeData)->Flags & 0x3);
593 ClassGuid = (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_FORM_SET));
594 for (Index = 0; Index < NumberOfClassGuid; Index++) {
595 if (CompareGuid (&gEfiHiiDriverHealthFormsetGuid, &ClassGuid[Index])) {
596 CopyMem (FormsetGuid, &((EFI_IFR_FORM_SET *)OpCodeData)->Guid, sizeof (EFI_GUID));
597 FreePool (HiiPackageList);
598 return EFI_SUCCESS;
599 }
600 }
601 }
602 }
603 }
604 }
605
606 //
607 // Form package not found in this Package List
608 //
609 FreePool (HiiPackageList);
610 return EFI_NOT_FOUND;
611}
612
628VOID
630 IN EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth,
631 IN EFI_HANDLE ControllerHandle OPTIONAL,
632 IN EFI_HANDLE ChildHandle OPTIONAL,
633 IN EFI_DRIVER_HEALTH_STATUS HealthStatus,
634 IN EFI_DRIVER_HEALTH_HII_MESSAGE **MessageList OPTIONAL,
635 IN EFI_HII_HANDLE FormHiiHandle
636 )
637{
638 EFI_STATUS Status;
639
640 ASSERT (HealthStatus != EfiDriverHealthStatusConfigurationRequired);
641 //
642 // If the module need to be repaired or reconfiguration, will process it until
643 // reach a terminal status. The status from EfiDriverHealthStatusRepairRequired after repair
644 // will be in (Health, Failed, Configuration Required).
645 //
646 switch (HealthStatus) {
647 case EfiDriverHealthStatusRepairRequired:
648 Status = DriverHealth->Repair (
649 DriverHealth,
650 ControllerHandle,
651 ChildHandle,
653 );
654 break;
655
656 case EfiDriverHealthStatusRebootRequired:
657 gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
658 break;
659
660 case EfiDriverHealthStatusReconnectRequired:
661 Status = gBS->DisconnectController (ControllerHandle, NULL, NULL);
662 if (EFI_ERROR (Status)) {
663 //
664 // Disconnect failed. Need to promote reconnect to a reboot.
665 //
666 gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
667 } else {
668 gBS->ConnectController (ControllerHandle, NULL, NULL, TRUE);
669 }
670
671 break;
672
673 default:
674 break;
675 }
676}
677
684VOID
686 BOOLEAN ConfigureOnly
687 )
688{
689 EFI_STATUS Status;
690 EFI_IFR_GUID_LABEL *StartLabel;
691 EFI_IFR_GUID_LABEL *EndLabel;
692 VOID *StartOpCodeHandle;
693 VOID *EndOpCodeHandle;
694 UINTN Index;
695 EFI_STRING_ID Prompt;
696 EFI_STRING_ID Help;
697 CHAR16 String[512];
698 UINTN StringCount;
699 EFI_STRING TmpString;
700 EFI_STRING DriverName;
701 EFI_STRING ControllerName;
702 UINTN MessageIndex;
703 EFI_HANDLE DriverHandle;
704 EFI_STRING_ID DevicePath;
705 EFI_GUID FormsetGuid;
706
707 EfiBootManagerFreeDriverHealthInfo (mDriverHealthManagerHealthInfo, mDriverHealthManagerHealthInfoCount);
708 mDriverHealthManagerHealthInfo = EfiBootManagerGetDriverHealthInfo (&mDriverHealthManagerHealthInfoCount);
709
710 //
711 // Allocate space for creation of UpdateData Buffer
712 //
713 StartOpCodeHandle = HiiAllocateOpCodeHandle ();
714 ASSERT (StartOpCodeHandle != NULL);
715
716 EndOpCodeHandle = HiiAllocateOpCodeHandle ();
717 ASSERT (EndOpCodeHandle != NULL);
718
719 //
720 // Create Hii Extend Label OpCode as the start opcode
721 //
722 StartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
724 StartLabel->Number = LABEL_BEGIN;
725
726 //
727 // Create Hii Extend Label OpCode as the end opcode
728 //
729 EndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
731 EndLabel->Number = LABEL_END;
732
733 for (Index = 0; Index < mDriverHealthManagerHealthInfoCount; Index++) {
734 if (ConfigureOnly && (mDriverHealthManagerHealthInfo[Index].HealthStatus != EfiDriverHealthStatusConfigurationRequired)) {
735 continue;
736 }
737
738 DriverName = DriverHealthManagerGetDriverName (mDriverHealthManagerHealthInfo[Index].DriverHealthHandle);
739 ASSERT (DriverName != NULL);
740
741 if (mDriverHealthManagerHealthInfo[Index].ControllerHandle == NULL) {
742 //
743 // The ControllerHandle is set to NULL and the HealthStatus is set to EfiDriverHealthStatusHealthy
744 // if all the controllers managed by the driver are in healthy state.
745 //
746 ASSERT (mDriverHealthManagerHealthInfo[Index].HealthStatus == EfiDriverHealthStatusHealthy);
747 UnicodeSPrint (String, sizeof (String), L"%s", DriverName);
748 } else {
749 ControllerName = DriverHealthManagerGetControllerName (
750 mDriverHealthManagerHealthInfo[Index].DriverHealthHandle,
751 mDriverHealthManagerHealthInfo[Index].ControllerHandle,
752 mDriverHealthManagerHealthInfo[Index].ChildHandle
753 );
754 ASSERT (ControllerName != NULL);
755 UnicodeSPrint (String, sizeof (String), L"%s %s", DriverName, ControllerName);
756 FreePool (ControllerName);
757 }
758
759 FreePool (DriverName);
760
761 Prompt = HiiSetString (mDriverHealthManagerHiiHandle, 0, String, NULL);
762
763 switch (mDriverHealthManagerHealthInfo[Index].HealthStatus) {
764 case EfiDriverHealthStatusRepairRequired:
765 TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_REPAIR_REQUIRED), NULL);
766 break;
767 case EfiDriverHealthStatusConfigurationRequired:
768 TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_CONFIGURATION_REQUIRED), NULL);
769 break;
770 case EfiDriverHealthStatusFailed:
771 TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_FAILED), NULL);
772 break;
773 case EfiDriverHealthStatusReconnectRequired:
774 TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_RECONNECT_REQUIRED), NULL);
775 break;
776 case EfiDriverHealthStatusRebootRequired:
777 TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_REBOOT_REQUIRED), NULL);
778 break;
779 default:
780 ASSERT (mDriverHealthManagerHealthInfo[Index].HealthStatus == EfiDriverHealthStatusHealthy);
781 TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_HEALTHY), NULL);
782 break;
783 }
784
785 StringCount = UnicodeSPrint (String, sizeof (String), L"%s\n", TmpString);
786 FreePool (TmpString);
787
788 //
789 // Add the message of the Module itself provided as the help.
790 //
791 if (mDriverHealthManagerHealthInfo[Index].MessageList != NULL) {
792 for (MessageIndex = 0; mDriverHealthManagerHealthInfo[Index].MessageList[MessageIndex].HiiHandle != NULL; MessageIndex++) {
793 TmpString = HiiGetString (
794 mDriverHealthManagerHealthInfo[Index].MessageList[MessageIndex].HiiHandle,
795 mDriverHealthManagerHealthInfo[Index].MessageList[MessageIndex].StringId,
796 NULL
797 );
798 StringCount += UnicodeSPrint (String + StringCount, sizeof (String) - sizeof (String[0]) * StringCount, L"\n%s", TmpString);
799 FreePool (TmpString);
800 }
801 }
802
803 Help = HiiSetString (mDriverHealthManagerHiiHandle, 0, String, NULL);
804
805 switch (mDriverHealthManagerHealthInfo[Index].HealthStatus) {
806 case EfiDriverHealthStatusConfigurationRequired:
807 Status = mDriverHealthManagerDatabase->GetPackageListHandle (
808 mDriverHealthManagerDatabase,
809 mDriverHealthManagerHealthInfo[Index].HiiHandle,
810 &DriverHandle
811 );
812 ASSERT_EFI_ERROR (Status);
813 TmpString = ConvertDevicePathToText (DevicePathFromHandle (DriverHandle), FALSE, TRUE);
814 DevicePath = HiiSetString (mDriverHealthManagerHiiHandle, 0, TmpString, NULL);
815 FreePool (TmpString);
816
817 Status = DriverHealthManagerGetFormsetId (mDriverHealthManagerHealthInfo[Index].HiiHandle, &FormsetGuid);
818 ASSERT_EFI_ERROR (Status);
819
821 StartOpCodeHandle,
822 0,
823 Prompt,
824 Help,
825 0,
826 0,
827 0,
828 &FormsetGuid,
829 DevicePath
830 );
831 break;
832
833 case EfiDriverHealthStatusRepairRequired:
834 case EfiDriverHealthStatusReconnectRequired:
835 case EfiDriverHealthStatusRebootRequired:
837 StartOpCodeHandle,
838 (EFI_QUESTION_ID)(Index + QUESTION_ID_DRIVER_HEALTH_BASE),
839 Prompt,
840 Help,
841 EFI_IFR_FLAG_CALLBACK,
842 0
843 );
844 break;
845
846 default:
847 ASSERT (
848 mDriverHealthManagerHealthInfo[Index].HealthStatus == EfiDriverHealthStatusHealthy ||
849 mDriverHealthManagerHealthInfo[Index].HealthStatus == EfiDriverHealthStatusFailed
850 );
852 StartOpCodeHandle,
853 Prompt,
854 Help,
855 0
856 );
857 break;
858 }
859 }
860
861 Status = HiiUpdateForm (
862 mDriverHealthManagerHiiHandle,
863 ConfigureOnly ? PcdGetPtr (PcdDriverHealthConfigureForm) : &mDriverHealthManagerForm,
864 DRIVER_HEALTH_FORM_ID,
865 StartOpCodeHandle,
866 EndOpCodeHandle
867 );
868 ASSERT_EFI_ERROR (Status);
869
870 HiiFreeOpCodeHandle (StartOpCodeHandle);
871 HiiFreeOpCodeHandle (EndOpCodeHandle);
872}
873
877VOID
879 VOID
880 )
881{
882 EFI_STATUS Status;
883 EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
884 UINTN BufferSize;
885 EFI_HII_PACKAGE_HEADER *PackageHeader;
886 UINT32 FixedStringSize;
887
888 FixedStringSize = *(UINT32 *)&STRING_ARRAY_NAME - sizeof (UINT32);
889 BufferSize = sizeof (EFI_HII_PACKAGE_LIST_HEADER) + FixedStringSize + sizeof (EFI_HII_PACKAGE_HEADER);
890 HiiPackageList = AllocatePool (BufferSize);
891 ASSERT (HiiPackageList != NULL);
892
893 HiiPackageList->PackageLength = (UINT32)BufferSize;
894 CopyMem (&HiiPackageList->PackageListGuid, &gEfiCallerIdGuid, sizeof (EFI_GUID));
895
896 PackageHeader = (EFI_HII_PACKAGE_HEADER *)(HiiPackageList + 1);
897 CopyMem (PackageHeader, STRING_ARRAY_NAME + sizeof (UINT32), FixedStringSize);
898
899 PackageHeader = (EFI_HII_PACKAGE_HEADER *)((UINT8 *)PackageHeader + PackageHeader->Length);
900 PackageHeader->Type = EFI_HII_PACKAGE_END;
901 PackageHeader->Length = sizeof (EFI_HII_PACKAGE_HEADER);
902
903 Status = mDriverHealthManagerDatabase->UpdatePackageList (
904 mDriverHealthManagerDatabase,
905 mDriverHealthManagerHiiHandle,
906 HiiPackageList
907 );
908 ASSERT_EFI_ERROR (Status);
909
910 //
911 // Form package not found in this Package List
912 //
913 FreePool (HiiPackageList);
914}
915
933EFIAPI
936 IN EFI_BROWSER_ACTION Action,
937 IN EFI_QUESTION_ID QuestionId,
938 IN UINT8 Type,
939 IN EFI_IFR_TYPE_VALUE *Value,
940 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
941 )
942{
943 UINTN Index;
944
945 if ((QuestionId == QUESTION_ID_REFRESH_MANAGER) || (QuestionId == QUESTION_ID_REFRESH_CONFIGURE)) {
946 if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
947 DriverHealthManagerUpdateForm ((BOOLEAN)(QuestionId == QUESTION_ID_REFRESH_CONFIGURE));
948 } else if (Action == EFI_BROWSER_ACTION_FORM_CLOSE) {
950 }
951
952 return EFI_SUCCESS;
953 }
954
955 if (Action != EFI_BROWSER_ACTION_CHANGED) {
956 //
957 // Do nothing for other UEFI Action. Only do call back when data is changed.
958 //
959 return EFI_UNSUPPORTED;
960 }
961
962 if ((Value == NULL) || (ActionRequest == NULL)) {
963 return EFI_INVALID_PARAMETER;
964 }
965
966 DEBUG ((DEBUG_ERROR, "QuestionId = %x\n", QuestionId));
967
968 //
969 // We will have returned from processing a callback - user either hit ESC to exit, or selected
970 // a target to display.
971 // Process the diver health status states here.
972 //
973 Index = QuestionId - QUESTION_ID_DRIVER_HEALTH_BASE;
974 ASSERT (Index < mDriverHealthManagerHealthInfoCount);
975 //
976 // Process the driver's healthy status for the specify module
977 //
979 mDriverHealthManagerHealthInfo[Index].DriverHealth,
980 mDriverHealthManagerHealthInfo[Index].ControllerHandle,
981 mDriverHealthManagerHealthInfo[Index].ChildHandle,
982 mDriverHealthManagerHealthInfo[Index].HealthStatus,
983 &(mDriverHealthManagerHealthInfo[Index].MessageList),
984 mDriverHealthManagerHealthInfo[Index].HiiHandle
985 );
986
987 DriverHealthManagerUpdateForm ((BOOLEAN)(QuestionId == QUESTION_ID_REFRESH_CONFIGURE));
988
989 return EFI_SUCCESS;
990}
UINT64 UINTN
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
Definition: String.c:72
UINT32 EFIAPI ReadUnaligned32(IN CONST UINT32 *Buffer)
Definition: Unaligned.c:145
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
#define HARDWARE_DEVICE_PATH
Definition: DevicePath.h:68
#define HW_VENDOR_DP
Definition: DevicePath.h:133
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)
EFI_DRIVER_HEALTH_STATUS
Definition: DriverHealth.h:45
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)
Definition: HiiLib.c:3051
VOID EFIAPI HiiFreeOpCodeHandle(VOID *OpCodeHandle)
Definition: HiiLib.c:3085
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
Definition: HiiLib.c:141
UINT8 *EFIAPI HiiCreateGuidOpCode(IN VOID *OpCodeHandle, IN CONST EFI_GUID *Guid, IN CONST VOID *GuidOpCode OPTIONAL, IN UINTN OpCodeSize)
Definition: HiiLib.c:3411
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
Definition: HiiString.c:211
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)
Definition: HiiLib.c:4410
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
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)
Definition: HiiLib.c:3605
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)
Definition: HiiLib.c:3461
UINT8 *EFIAPI HiiCreateTextOpCode(IN VOID *OpCodeHandle, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN EFI_STRING_ID TextTwo)
Definition: HiiLib.c:4037
#define EFI_IFR_EXTEND_OP_LABEL
Definition: MdeModuleHii.h:33
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
Definition: PrintLib.c:408
EFI_RUNTIME_SERVICES * gRT
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OFFSET_OF(TYPE, Field)
Definition: Base.h:758
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define DEBUG(Expression)
Definition: DebugLib.h:434
#define PcdGetPtr(TokenName)
Definition: PcdLib.h:388
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_STATUS EFIAPI EfiBootManagerFreeDriverHealthInfo(EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *DriverHealthInfo, UINTN Count)
EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *EFIAPI EfiBootManagerGetDriverHealthInfo(UINTN *Count)
EFI_BOOT_SERVICES * gBS
#define STRING_TOKEN(t)
VOID * EFI_HII_HANDLE
EFI_STATUS EFIAPI GetEfiGlobalVariable2(IN CONST CHAR16 *Name, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
Definition: UefiLib.c:1470
CHAR8 *EFIAPI GetBestLanguage(IN CONST CHAR8 *SupportedLanguages, IN UINTN Iso639Language,...)
Definition: UefiLib.c:1522
@ EfiResetWarm
EFI_DRIVER_HEALTH_HII_MESSAGE * MessageList
Definition: Base.h:213