> When GetHealthStatus() returns NULL FormHiiHandle, DeviceManager shouldn't call SendForm to show the configuration form.

> Combine the multiple reset request returned by GetHealthStatus() when repairing all the controllers.
> Fix the bug that source code and VFR code use different value for DRIVER_HEALTH_FORM_ID.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11494 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
niruiyu 2011-04-01 05:22:18 +00:00
parent 67f802edba
commit 2fde83b14c
6 changed files with 154 additions and 130 deletions

View File

@ -53,6 +53,7 @@
HwErrRecSupport.h
DeviceMngr/DeviceManager.h
DeviceMngr/DeviceManagerVfr.h
DeviceMngr/DeviceManagerVfr.Vfr
DeviceMngr/DriverHealthVfr.Vfr
DeviceMngr/DeviceManagerStrings.uni

View File

@ -1,7 +1,7 @@
/** @file
The platform device manager reference implementation
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@ -1168,6 +1168,7 @@ CallDriverHealth (
LIST_ENTRY *Link;
EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath;
UINTN Length;
BOOLEAN RebootRequired;
Index = 0;
Length = 0;
@ -1304,30 +1305,31 @@ CallDriverHealth (
//
switch(DriverHealthInfo->HealthStatus) {
case EfiDriverHealthStatusRepairRequired:
Length = StrLen (GetStringById (STRING_TOKEN (STR_REPAIR_REQUIRED)));
StrnCat (String, GetStringById (STRING_TOKEN (STR_REPAIR_REQUIRED)), Length);
TmpString = GetStringById (STRING_TOKEN (STR_REPAIR_REQUIRED));
StrCat (String, TmpString);
break;
case EfiDriverHealthStatusConfigurationRequired:
Length = StrLen (GetStringById (STRING_TOKEN (STR_CONFIGURATION_REQUIRED)));
StrnCat (String, GetStringById (STRING_TOKEN (STR_CONFIGURATION_REQUIRED)), Length);
TmpString = GetStringById (STRING_TOKEN (STR_CONFIGURATION_REQUIRED));
StrCat (String, TmpString);
break;
case EfiDriverHealthStatusFailed:
Length = StrLen (GetStringById (STRING_TOKEN (STR_OPERATION_FAILED)));
StrnCat (String, GetStringById (STRING_TOKEN (STR_OPERATION_FAILED)), Length);
TmpString = GetStringById (STRING_TOKEN (STR_OPERATION_FAILED));
StrCat (String, TmpString);
break;
case EfiDriverHealthStatusReconnectRequired:
Length = StrLen (GetStringById (STRING_TOKEN (STR_RECONNECT_REQUIRED)));
StrnCat (String, GetStringById (STRING_TOKEN (STR_RECONNECT_REQUIRED)), Length);
TmpString = GetStringById (STRING_TOKEN (STR_RECONNECT_REQUIRED));
StrCat (String, TmpString);
break;
case EfiDriverHealthStatusRebootRequired:
Length = StrLen (GetStringById (STRING_TOKEN (STR_REBOOT_REQUIRED)));
StrnCat (String, GetStringById (STRING_TOKEN (STR_REBOOT_REQUIRED)), Length);
TmpString = GetStringById (STRING_TOKEN (STR_REBOOT_REQUIRED));
StrCat (String, TmpString);
break;
default:
Length = StrLen (GetStringById (STRING_TOKEN (STR_DRIVER_HEALTH_HEALTHY)));
StrnCat (String, GetStringById (STRING_TOKEN (STR_DRIVER_HEALTH_HEALTHY)), Length);
TmpString = GetStringById (STRING_TOKEN (STR_DRIVER_HEALTH_HEALTHY));
StrCat (String, TmpString);
break;
}
FreePool (TmpString);
}
Token = HiiSetString (HiiHandle, 0, String, NULL);
@ -1439,15 +1441,20 @@ CallDriverHealth (
//
// Process the driver's healthy status for the specify module
//
RebootRequired = FALSE;
ProcessSingleControllerHealth (
DriverHealthInfo->DriverHealth,
DriverHealthInfo->ControllerHandle,
DriverHealthInfo->ChildHandle,
DriverHealthInfo->HealthStatus,
&(DriverHealthInfo->MessageList),
DriverHealthInfo->HiiHandle
);
break;
DriverHealthInfo->HiiHandle,
&RebootRequired
);
if (RebootRequired) {
gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
}
break;
}
Index++;
Link = GetNextNode (&DriverHealthList, Link);
@ -1934,15 +1941,17 @@ PlaformHealthStatusCheck (
ChildHandle. This is an optional parameter that may be NULL.
@param FormHiiHandle The HII handle for an HII form associated with the
controller specified by ControllerHandle and ChildHandle.
@param RebootRequired Indicate whether a reboot is required to repair the controller.
**/
VOID
ProcessSingleControllerHealth (
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
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,
IN OUT BOOLEAN *RebootRequired
)
{
EFI_STATUS Status;
@ -1954,8 +1963,8 @@ ProcessSingleControllerHealth (
// reach a terminal status. The status from EfiDriverHealthStatusRepairRequired after repair
// will be in (Health, Failed, Configuration Required).
//
while( LocalHealthStatus == EfiDriverHealthStatusConfigurationRequired ||
LocalHealthStatus == EfiDriverHealthStatusRepairRequired) {
while(LocalHealthStatus == EfiDriverHealthStatusConfigurationRequired ||
LocalHealthStatus == EfiDriverHealthStatusRepairRequired) {
if (LocalHealthStatus == EfiDriverHealthStatusRepairRequired) {
Status = DriverHealth->Repair (
@ -1971,16 +1980,23 @@ ProcessSingleControllerHealth (
// (Healthy, Reboot Required, Failed, Reconnect Required, Repair Required).
//
if (LocalHealthStatus == EfiDriverHealthStatusConfigurationRequired) {
Status = gFormBrowser2->SendForm (
gFormBrowser2,
&FormHiiHandle,
1,
&gEfiHiiDriverHealthFormsetGuid,
0,
NULL,
NULL
);
ASSERT( !EFI_ERROR (Status));
if (FormHiiHandle != NULL) {
Status = gFormBrowser2->SendForm (
gFormBrowser2,
&FormHiiHandle,
1,
&gEfiHiiDriverHealthFormsetGuid,
0,
NULL,
NULL
);
ASSERT( !EFI_ERROR (Status));
} else {
//
// Exit the loop in case no FormHiiHandle is supplied to prevent dead-loop
//
break;
}
}
Status = DriverHealth->GetHealthStatus (
@ -1991,11 +2007,11 @@ ProcessSingleControllerHealth (
NULL,
&FormHiiHandle
);
ASSERT_EFI_ERROR (Status);
ASSERT_EFI_ERROR (Status);
if (*MessageList != NULL) {
if (*MessageList != NULL) {
ProcessMessages (*MessageList);
}
}
}
//
@ -2010,7 +2026,7 @@ ProcessSingleControllerHealth (
// Check for RebootRequired or ReconnectRequired
//
if (LocalHealthStatus == EfiDriverHealthStatusRebootRequired) {
gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
*RebootRequired = TRUE;
}
//
@ -2019,12 +2035,13 @@ ProcessSingleControllerHealth (
if (LocalHealthStatus == EfiDriverHealthStatusReconnectRequired) {
Status = gBS->DisconnectController (ControllerHandle, NULL, NULL);
if (EFI_ERROR (Status)) {
//
// Disconnect failed. Need to promote reconnect to a reboot.
//
gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
//
// Disconnect failed. Need to promote reconnect to a reboot.
//
*RebootRequired = TRUE;
} else {
gBS->ConnectController (ControllerHandle, NULL, NULL, TRUE);
}
gBS->ConnectController (ControllerHandle, NULL, NULL, TRUE);
}
}
@ -2117,12 +2134,16 @@ PlatformRepairAll (
{
DRIVER_HEALTH_INFO *DriverHealthInfo;
LIST_ENTRY *Link;
BOOLEAN RebootRequired;
ASSERT (DriverHealthList != NULL);
Link = GetFirstNode (DriverHealthList);
RebootRequired = FALSE;
while (!IsNull (DriverHealthList, Link)) {
for ( Link = GetFirstNode (DriverHealthList)
; !IsNull (DriverHealthList, Link)
; Link = GetNextNode (DriverHealthList, Link)
) {
DriverHealthInfo = DEVICE_MANAGER_HEALTH_INFO_FROM_LINK (Link);
//
// Do driver health status operation by each link node
@ -2130,15 +2151,18 @@ PlatformRepairAll (
ASSERT (DriverHealthInfo != NULL);
ProcessSingleControllerHealth (
DriverHealthInfo->DriverHealth,
DriverHealthInfo->ControllerHandle,
DriverHealthInfo->ChildHandle,
DriverHealthInfo->HealthStatus,
&(DriverHealthInfo->MessageList),
DriverHealthInfo->HiiHandle
);
DriverHealthInfo->DriverHealth,
DriverHealthInfo->ControllerHandle,
DriverHealthInfo->ChildHandle,
DriverHealthInfo->HealthStatus,
&(DriverHealthInfo->MessageList),
DriverHealthInfo->HiiHandle,
&RebootRequired
);
}
Link = GetNextNode (DriverHealthList, Link);
if (RebootRequired) {
gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
}
}

View File

@ -1,7 +1,7 @@
/** @file
The platform device manager reference implement
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@ -17,57 +17,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Bds.h"
#include "FrontPage.h"
#include "DeviceManagerVfr.h"
#include <Protocol/PciIo.h>
//
// These are defined as the same with vfr file
//
#define DEVICE_MANAGER_FORMSET_GUID \
{ \
0x3ebfa8e6, 0x511d, 0x4b5b, {0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27} \
}
#define DRIVER_HEALTH_FORMSET_GUID \
{ \
0xf76e0a70, 0xb5ed, 0x4c38, {0xac, 0x9a, 0xe5, 0xf5, 0x4b, 0xf1, 0x6e, 0x34} \
}
#define LABEL_DEVICES_LIST 0x1100
#define LABEL_NETWORK_DEVICE_LIST_ID 0x1101
#define LABEL_NETWORK_DEVICE_ID 0x1102
#define LABEL_END 0xffff
#define LABEL_FORM_ID_OFFSET 0x0100
#define LABEL_DRIVER_HEALTH 0x2000
#define LABEL_DRIVER_HEALTH_END 0x2001
#define LABEL_DRIVER_HEALTH_REAPIR_ALL 0x3000
#define LABEL_DRIVER_HEALTH_REAPIR_ALL_END 0x3001
#define LABEL_VBIOS 0x0040
#define DEVICE_MANAGER_FORM_ID 0x1000
#define NETWORK_DEVICE_LIST_FORM_ID 0x1001
#define NETWORK_DEVICE_FORM_ID 0x1002
#define DRIVER_HEALTH_FORM_ID 0x1003
#define DEVICE_KEY_OFFSET 0x4000
#define NETWORK_DEVICE_LIST_KEY_OFFSET 0x2000
#define DEVICE_MANAGER_KEY_VBIOS 0x3000
#define MAX_KEY_SECTION_LEN 0x1000
#define DEVICE_MANAGER_KEY_DRIVER_HEALTH 0x1111
#define DRIVER_HEALTH_KEY_OFFSET 0x2000
#define DRIVER_HEALTH_REPAIR_ALL_KEY 0x3000
#define DRIVER_HEALTH_RETURN_KEY 0x4000
#define QUESTION_NETWORK_DEVICE_ID 0x3FFF
//
// These are the VFR compiler generated data representing our VFR data.
//
extern UINT8 DeviceManagerVfrBin[];
extern UINT8 DriverHealthVfrBin[];
#define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('D', 'M', 'C', 'B')
#define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('D', 'M', 'C', 'B')
#define DEVICE_MANAGER_DRIVER_HEALTH_INFO_SIGNATURE SIGNATURE_32 ('D', 'M', 'D', 'H')
@ -346,7 +299,7 @@ PlatformRepairAll (
ChildHandle. This is an optional parameter that may be NULL.
@param FormHiiHandle The HII handle for an HII form associated with the
controller specified by ControllerHandle and ChildHandle.
@param RebootRequired Indicate whether a reboot is required to repair the controller.
**/
VOID
ProcessSingleControllerHealth (
@ -355,8 +308,9 @@ ProcessSingleControllerHealth (
IN EFI_HANDLE ChildHandle, OPTIONAL
IN EFI_DRIVER_HEALTH_STATUS HealthStatus,
IN EFI_DRIVER_HEALTH_HII_MESSAGE **MessageList, OPTIONAL
IN EFI_HII_HANDLE FormHiiHandle
);
IN EFI_HII_HANDLE FormHiiHandle,
IN OUT BOOLEAN *RebootRequired
);
/**
Repair notification function, simply print the repair progress.

View File

@ -2,7 +2,7 @@
//
// Device Manager formset.
//
// Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
// Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
@ -13,7 +13,7 @@
//
//**/
#define FORMSET_GUID { 0x3ebfa8e6, 0x511d, 0x4b5b, 0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27 }
#include "DeviceManagerVfr.h"
#define EFI_DISK_DEVICE_CLASS 0x0001
#define EFI_VIDEO_DEVICE_CLASS 0x0002
@ -21,26 +21,15 @@
#define EFI_INPUT_DEVICE_CLASS 0x0008
#define EFI_ON_BOARD_DEVICE_CLASS 0x0010
#define EFI_OTHER_DEVICE_CLASS 0x0020
#define LABEL_VBIOS 0x0040
#define LABEL_DEVICES_LIST 0x1100
#define LABEL_NETWORK_DEVICE_LIST_ID 0x1101
#define LABEL_NETWORK_DEVICE_ID 0x1102
#define LABEL_END 0xffff
#define DEVICE_MANAGER_CLASS 0x0000
#define FRONT_PAGE_SUBCLASS 0x0003
#define DEVICE_MANAGER_FORM_ID 0x1000
#define NETWORK_DEVICE_LIST_FORM_ID 0x1001
#define NETWORK_DEVICE_FORM_ID 0x1002
#define DEVICE_MANAGER_KEY_DRIVER_HEALTH 0x1111
formset
guid = FORMSET_GUID,
guid = DEVICE_MANAGER_FORMSET_GUID,
title = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE),
help = STRING_TOKEN(STR_EMPTY_STRING),
classguid = FORMSET_GUID,
classguid = DEVICE_MANAGER_FORMSET_GUID,
class = DEVICE_MANAGER_CLASS,
subclass = FRONT_PAGE_SUBCLASS,

View File

@ -0,0 +1,63 @@
/** @file
The platform device manager reference implement
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _DEVICE_MANAGER_VFR_H_
#define _DEVICE_MANAGER_VFR_H_
#define DEVICE_MANAGER_FORMSET_GUID \
{ \
0x3ebfa8e6, 0x511d, 0x4b5b, {0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27} \
}
#define DRIVER_HEALTH_FORMSET_GUID \
{ \
0xf76e0a70, 0xb5ed, 0x4c38, {0xac, 0x9a, 0xe5, 0xf5, 0x4b, 0xf1, 0x6e, 0x34} \
}
#define LABEL_DEVICES_LIST 0x1100
#define LABEL_NETWORK_DEVICE_LIST_ID 0x1101
#define LABEL_NETWORK_DEVICE_ID 0x1102
#define LABEL_END 0xffff
#define LABEL_FORM_ID_OFFSET 0x0100
#define LABEL_DRIVER_HEALTH 0x2000
#define LABEL_DRIVER_HEALTH_END 0x2001
#define LABEL_DRIVER_HEALTH_REAPIR_ALL 0x3000
#define LABEL_DRIVER_HEALTH_REAPIR_ALL_END 0x3001
#define LABEL_VBIOS 0x0040
#define DEVICE_MANAGER_FORM_ID 0x1000
#define NETWORK_DEVICE_LIST_FORM_ID 0x1001
#define NETWORK_DEVICE_FORM_ID 0x1002
#define DRIVER_HEALTH_FORM_ID 0x1003
#define DEVICE_KEY_OFFSET 0x4000
#define NETWORK_DEVICE_LIST_KEY_OFFSET 0x2000
#define DEVICE_MANAGER_KEY_VBIOS 0x3000
#define MAX_KEY_SECTION_LEN 0x1000
#define DEVICE_MANAGER_KEY_DRIVER_HEALTH 0x1111
#define DRIVER_HEALTH_KEY_OFFSET 0x2000
#define DRIVER_HEALTH_REPAIR_ALL_KEY 0x3000
#define DRIVER_HEALTH_RETURN_KEY 0x4000
#define QUESTION_NETWORK_DEVICE_ID 0x3FFF
//
// These are the VFR compiler generated data representing our VFR data.
//
extern UINT8 DeviceManagerVfrBin[];
extern UINT8 DriverHealthVfrBin[];
#endif

View File

@ -2,7 +2,7 @@
//
// Driver Health formset.
//
// Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
// Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
@ -13,14 +13,7 @@
//
//**/
#define DRIVER_HEALTH_FORMSET_GUID { 0xf76e0a70, 0xb5ed, 0x4c38, 0xac, 0x9a, 0xe5, 0xf5, 0x4b, 0xf1, 0x6e, 0x34 }
#define LABEL_DRIVER_HEALTH 0x2000
#define LABEL_DRIVER_HEALTH_END 0x2001
#define LABEL_DRIVER_HEALTH_REAPIR_ALL 0x3000
#define LABEL_DRIVER_HEALTH_REAPIR_ALL_END 0x3001
#define DRIVER_HEALTH_FORM_ID 0x1001
#include "DeviceManagerVfr.h"
formset
guid = DRIVER_HEALTH_FORMSET_GUID,