Sync the branch changes to trunk.
Update the FCE tool to remove “runtime access” . and recovery "Setup" variable in case of “Setup” variable size is incorrect somehow. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Tim He <tim.he@intel.com> Reviewed-by: David Wei <david.wei@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17620 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -697,7 +697,18 @@ OnReadyToBoot (
|
|||||||
&VariableSize,
|
&VariableSize,
|
||||||
&SetupVarBuffer
|
&SetupVarBuffer
|
||||||
);
|
);
|
||||||
|
if (EFI_ERROR (Status) || VariableSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VariableSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
L"SetupRecovery",
|
||||||
|
&mSystemConfigurationGuid,
|
||||||
|
NULL,
|
||||||
|
&VariableSize,
|
||||||
|
&SetupVarBuffer
|
||||||
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find the AcpiSupport protocol.
|
// Find the AcpiSupport protocol.
|
||||||
@@ -817,7 +828,18 @@ AcpiPlatformEntryPoint (
|
|||||||
&VarSize,
|
&VarSize,
|
||||||
&mSystemConfiguration
|
&mSystemConfiguration
|
||||||
);
|
);
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
L"SetupRecovery",
|
||||||
|
&mSystemConfigurationGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&mSystemConfiguration
|
||||||
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find the AcpiSupport protocol.
|
// Find the AcpiSupport protocol.
|
||||||
@@ -842,6 +864,19 @@ AcpiPlatformEntryPoint (
|
|||||||
&SysCfgSize,
|
&SysCfgSize,
|
||||||
&mSystemConfig
|
&mSystemConfig
|
||||||
);
|
);
|
||||||
|
if (EFI_ERROR (Status) || SysCfgSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
SysCfgSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
L"SetupRecovery",
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&SysCfgSize,
|
||||||
|
&mSystemConfig
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
Instance = 0;
|
Instance = 0;
|
||||||
|
Binary file not shown.
@@ -346,7 +346,18 @@ ConfigurePlatformClocks (
|
|||||||
);
|
);
|
||||||
//
|
//
|
||||||
// Use normal setup default from NVRAM variable,
|
// Use normal setup default from NVRAM variable,
|
||||||
// the Platform Mode (manufacturing/safe/normal) is handle in PeiGetVariable.
|
// the Platform Mode (manufacturing/safe/normal) is handle in PeiGetVariable.
|
||||||
|
//
|
||||||
|
VariableSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = Variable->GetVariable (Variable,
|
||||||
|
L"Setup",
|
||||||
|
&gEfiSetupVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&VariableSize,
|
||||||
|
&SystemConfiguration);
|
||||||
|
if (EFI_ERROR (Status) || VariableSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VariableSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
Status = Variable->GetVariable(Variable,
|
Status = Variable->GetVariable(Variable,
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
&gEfiSetupVariableGuid,
|
&gEfiSetupVariableGuid,
|
||||||
|
@@ -322,7 +322,18 @@ GetGopDevicePath (
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Select display devices
|
// Select display devices
|
||||||
|
//
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
L"Setup",
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&mSystemConfiguration
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
//The setup variable is corrupted
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
Status = gRT->GetVariable(
|
Status = gRT->GetVariable(
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
&gEfiNormalSetupGuid,
|
&gEfiNormalSetupGuid,
|
||||||
@@ -624,7 +635,18 @@ PlatformBdsForceActiveVga (
|
|||||||
if (PlugInPciVgaDevicePath == NULL && OnboardPciVgaDevicePath == NULL) {
|
if (PlugInPciVgaDevicePath == NULL && OnboardPciVgaDevicePath == NULL) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
L"Setup",
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&mSystemConfiguration
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
//The setup variable is corrupted
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
Status = gRT->GetVariable(
|
Status = gRT->GetVariable(
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
&gEfiNormalSetupGuid,
|
&gEfiNormalSetupGuid,
|
||||||
@@ -680,7 +702,18 @@ UpdateConsoleResolution(
|
|||||||
|
|
||||||
HorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution);
|
HorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution);
|
||||||
VerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution);
|
VerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution);
|
||||||
|
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
L"Setup",
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&SystemConfiguration
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
//The setup variable is corrupted
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
Status = gRT->GetVariable(
|
Status = gRT->GetVariable(
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
&gEfiNormalSetupGuid,
|
&gEfiNormalSetupGuid,
|
||||||
@@ -1576,6 +1609,11 @@ PlatformBdsPolicyBehavior (
|
|||||||
UINTN HandleCount;
|
UINTN HandleCount;
|
||||||
EFI_HANDLE *HandleBuffer;
|
EFI_HANDLE *HandleBuffer;
|
||||||
UINTN Index1;
|
UINTN Index1;
|
||||||
|
UINTN SataPciRegBase = 0;
|
||||||
|
UINT16 SataModeSelect = 0;
|
||||||
|
VOID *RegistrationExitPmAuth = NULL;
|
||||||
|
EFI_EVENT Event;
|
||||||
|
BOOLEAN IsFirstBoot;
|
||||||
UINT16 *BootOrder;
|
UINT16 *BootOrder;
|
||||||
UINTN BootOrderSize;
|
UINTN BootOrderSize;
|
||||||
|
|
||||||
@@ -1584,8 +1622,18 @@ PlatformBdsPolicyBehavior (
|
|||||||
//we think the Timeout variable is corrupted
|
//we think the Timeout variable is corrupted
|
||||||
Timeout = 10;
|
Timeout = 10;
|
||||||
}
|
}
|
||||||
Timeout = PcdGet16 (PcdPlatformBootTimeOut);
|
|
||||||
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
NORMAL_SETUP_NAME,
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&SystemConfiguration
|
||||||
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
Status = gRT->GetVariable(
|
Status = gRT->GetVariable(
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
|
@@ -343,7 +343,18 @@ PciPlatformDriverEntry (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN VarSize;
|
UINTN VarSize;
|
||||||
|
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
L"Setup",
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&mSystemConfiguration
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
Status = gRT->GetVariable(
|
Status = gRT->GetVariable(
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
&gEfiNormalSetupGuid,
|
&gEfiNormalSetupGuid,
|
||||||
|
@@ -73,7 +73,18 @@ InitExI (
|
|||||||
UINTN VarSize;
|
UINTN VarSize;
|
||||||
|
|
||||||
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
L"Setup",
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&SystemConfiguration
|
||||||
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
Status = gRT->GetVariable(
|
Status = gRT->GetVariable(
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
&gEfiNormalSetupGuid,
|
&gEfiNormalSetupGuid,
|
||||||
|
@@ -49,6 +49,8 @@ Abstract:
|
|||||||
#include <Protocol/GlobalNvsArea.h>
|
#include <Protocol/GlobalNvsArea.h>
|
||||||
#include <Protocol/IgdOpRegion.h>
|
#include <Protocol/IgdOpRegion.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
#include <Protocol/VariableLock.h>
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// VLV2 GPIO GROUP OFFSET
|
// VLV2 GPIO GROUP OFFSET
|
||||||
@@ -200,6 +202,82 @@ InitRC6Policy(
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
SaveSetupRecoveryVar(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status = EFI_SUCCESS;
|
||||||
|
UINTN SizeOfNvStore = 0;
|
||||||
|
UINTN SizeOfSetupVar = 0;
|
||||||
|
SYSTEM_CONFIGURATION *SetupData = NULL;
|
||||||
|
SYSTEM_CONFIGURATION *RecoveryNvData = NULL;
|
||||||
|
EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, "SaveSetupRecoveryVar() Entry \n"));
|
||||||
|
SizeOfNvStore = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
RecoveryNvData = AllocateZeroPool (sizeof(SYSTEM_CONFIGURATION));
|
||||||
|
if (NULL == RecoveryNvData) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
L"SetupRecovery",
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&SizeOfNvStore,
|
||||||
|
RecoveryNvData
|
||||||
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
// Don't find the "SetupRecovery" variable.
|
||||||
|
// have to copy "Setup" variable to "SetupRecovery" variable.
|
||||||
|
SetupData = AllocateZeroPool (sizeof(SYSTEM_CONFIGURATION));
|
||||||
|
if (NULL == SetupData) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
SizeOfSetupVar = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
NORMAL_SETUP_NAME,
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&SizeOfSetupVar,
|
||||||
|
SetupData
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
Status = gRT->SetVariable (
|
||||||
|
L"SetupRecovery",
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||||
|
sizeof(SYSTEM_CONFIGURATION),
|
||||||
|
SetupData
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
Status = VariableLock->RequestToLock (VariableLock, L"SetupRecovery", &gEfiNormalSetupGuid);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Exit:
|
||||||
|
if (RecoveryNvData)
|
||||||
|
FreePool (RecoveryNvData);
|
||||||
|
if (SetupData)
|
||||||
|
FreePool (SetupData);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
TristateLpcGpioConfig (
|
TristateLpcGpioConfig (
|
||||||
IN UINT32 Gpio_Mmio_Offset,
|
IN UINT32 Gpio_Mmio_Offset,
|
||||||
@@ -692,6 +770,10 @@ InitializePlatform (
|
|||||||
//
|
//
|
||||||
InitializeObservableProtocol();
|
InitializeObservableProtocol();
|
||||||
|
|
||||||
|
Status = SaveSetupRecoveryVar();
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "InitializePlatform() Save SetupRecovery variable failed \n"));
|
||||||
|
}
|
||||||
|
|
||||||
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
Status = gRT->GetVariable(
|
Status = gRT->GetVariable(
|
||||||
@@ -701,7 +783,25 @@ InitializePlatform (
|
|||||||
&VarSize,
|
&VarSize,
|
||||||
&mSystemConfiguration
|
&mSystemConfiguration
|
||||||
);
|
);
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
L"SetupRecovery",
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&mSystemConfiguration
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
Status = gRT->SetVariable (
|
||||||
|
NORMAL_SETUP_NAME,
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||||
|
sizeof(SYSTEM_CONFIGURATION),
|
||||||
|
&mSystemConfiguration
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Status = EfiCreateEventReadyToBootEx (
|
Status = EfiCreateEventReadyToBootEx (
|
||||||
TPL_CALLBACK,
|
TPL_CALLBACK,
|
||||||
@@ -1394,12 +1494,7 @@ InitMfgAndConfigModeStateVar()
|
|||||||
{
|
{
|
||||||
EFI_PLATFORM_SETUP_ID *BootModeBuffer;
|
EFI_PLATFORM_SETUP_ID *BootModeBuffer;
|
||||||
VOID *HobList;
|
VOID *HobList;
|
||||||
UINT16 State;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Variable initialization
|
|
||||||
//
|
|
||||||
State = FALSE;
|
|
||||||
|
|
||||||
HobList = GetFirstGuidHob(&gEfiPlatformBootModeGuid);
|
HobList = GetFirstGuidHob(&gEfiPlatformBootModeGuid);
|
||||||
if (HobList != NULL) {
|
if (HobList != NULL) {
|
||||||
@@ -1416,16 +1511,8 @@ InitMfgAndConfigModeStateVar()
|
|||||||
mMfgMode = TRUE;
|
mMfgMode = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Check if in safe mode
|
|
||||||
//
|
|
||||||
if ( !CompareMem (
|
|
||||||
&BootModeBuffer->SetupName,
|
|
||||||
SAFE_SETUP_NAME,
|
|
||||||
StrSize (SAFE_SETUP_NAME)
|
|
||||||
) ) {
|
|
||||||
State = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1588,6 +1675,19 @@ UpdateDVMTSetup(
|
|||||||
&SystemConfiguration
|
&SystemConfiguration
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
L"SetupRecovery",
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&SystemConfiguration
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
if((SystemConfiguration.GraphicsDriverMemorySize < 4) && !EFI_ERROR(Status) ) {
|
if((SystemConfiguration.GraphicsDriverMemorySize < 4) && !EFI_ERROR(Status) ) {
|
||||||
switch (SystemConfiguration.GraphicsDriverMemorySize){
|
switch (SystemConfiguration.GraphicsDriverMemorySize){
|
||||||
case 1:
|
case 1:
|
||||||
|
@@ -128,6 +128,7 @@
|
|||||||
gEfiCpuIo2ProtocolGuid
|
gEfiCpuIo2ProtocolGuid
|
||||||
gIgdOpRegionProtocolGuid
|
gIgdOpRegionProtocolGuid
|
||||||
gExitPmAuthProtocolGuid
|
gExitPmAuthProtocolGuid
|
||||||
|
gEdkiiVariableLockProtocolGuid
|
||||||
|
|
||||||
[Pcd.common]
|
[Pcd.common]
|
||||||
gPlatformModuleTokenSpaceGuid.PcdPBTNDisableInterval
|
gPlatformModuleTokenSpaceGuid.PcdPBTNDisableInterval
|
||||||
|
@@ -181,7 +181,19 @@ PlatformGOPPolicyEntryPoint (
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Install protocol to allow access to this Policy.
|
// Install protocol to allow access to this Policy.
|
||||||
//
|
//
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
L"Setup",
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&SystemConfiguration
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
&gEfiNormalSetupGuid,
|
&gEfiNormalSetupGuid,
|
||||||
NULL,
|
NULL,
|
||||||
|
@@ -63,6 +63,19 @@ PlatformInfoInit (
|
|||||||
UINT8 *LpssDataVarPtr;
|
UINT8 *LpssDataVarPtr;
|
||||||
UINTN i;
|
UINTN i;
|
||||||
|
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
NORMAL_SETUP_NAME,
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&SystemConfiguration
|
||||||
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
&gEfiNormalSetupGuid,
|
&gEfiNormalSetupGuid,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -113,7 +126,7 @@ PlatformInfoInit (
|
|||||||
LpssDataVarPtr = &SystemConfiguration.LpssPciModeEnabled;
|
LpssDataVarPtr = &SystemConfiguration.LpssPciModeEnabled;
|
||||||
for (i = 0; i < sizeof(EFI_PLATFORM_LPSS_DATA); i++) {
|
for (i = 0; i < sizeof(EFI_PLATFORM_LPSS_DATA); i++) {
|
||||||
*LpssDataVarPtr = *LpssDataHobPtr;
|
*LpssDataVarPtr = *LpssDataHobPtr;
|
||||||
LpssDataVarPtr++;
|
LpssDataVarPtr++;
|
||||||
LpssDataHobPtr++;
|
LpssDataHobPtr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +159,7 @@ PlatformInfoInit (
|
|||||||
&VarSize,
|
&VarSize,
|
||||||
&TmpHob
|
&TmpHob
|
||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR(Status) || CompareMem (&TmpHob, PlatformInfoHobPtr, VarSize)) {
|
if (EFI_ERROR(Status) || CompareMem (&TmpHob, PlatformInfoHobPtr, VarSize)) {
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@@ -202,6 +202,19 @@ UpdateBootMode (
|
|||||||
// Use normal setup default from NVRAM variable,
|
// Use normal setup default from NVRAM variable,
|
||||||
// the Platform Mode (manufacturing/safe/normal) is handle in PeiGetVariable.
|
// the Platform Mode (manufacturing/safe/normal) is handle in PeiGetVariable.
|
||||||
//
|
//
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = Variable->GetVariable (
|
||||||
|
Variable,
|
||||||
|
L"Setup",
|
||||||
|
&gEfiSetupVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&SystemConfiguration
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = Variable->GetVariable(
|
||||||
Variable,
|
Variable,
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
&gEfiSetupVariableGuid,
|
&gEfiSetupVariableGuid,
|
||||||
@@ -386,16 +399,16 @@ SetPlatformBootMode (
|
|||||||
|
|
||||||
ZeroMem(&PlatformSetupId, sizeof (EFI_PLATFORM_SETUP_ID));
|
ZeroMem(&PlatformSetupId, sizeof (EFI_PLATFORM_SETUP_ID));
|
||||||
|
|
||||||
CopyMem (&PlatformSetupId.SetupGuid,
|
CopyMem (&PlatformSetupId.SetupGuid,
|
||||||
&gEfiNormalSetupGuid,
|
&gEfiNormalSetupGuid,
|
||||||
sizeof (EFI_GUID));
|
sizeof (EFI_GUID));
|
||||||
|
|
||||||
if (CheckIfRecoveryMode(PeiServices, PlatformInfoHob)) {
|
if (CheckIfRecoveryMode(PeiServices, PlatformInfoHob)) {
|
||||||
//
|
//
|
||||||
// Recovery mode
|
// Recovery mode
|
||||||
//
|
//
|
||||||
CopyMem (&PlatformSetupId.SetupName,
|
CopyMem (&PlatformSetupId.SetupName,
|
||||||
SAFE_SETUP_NAME,
|
&NORMAL_SETUP_NAME,
|
||||||
StrSize (NORMAL_SETUP_NAME));
|
StrSize (NORMAL_SETUP_NAME));
|
||||||
PlatformSetupId.PlatformBootMode = PLATFORM_RECOVERY_MODE;
|
PlatformSetupId.PlatformBootMode = PLATFORM_RECOVERY_MODE;
|
||||||
} else if (CheckIfSafeMode(PeiServices, PlatformInfoHob)) {
|
} else if (CheckIfSafeMode(PeiServices, PlatformInfoHob)) {
|
||||||
|
@@ -196,7 +196,19 @@ GetSetupVariable (
|
|||||||
// Use normal setup default from NVRAM variable,
|
// Use normal setup default from NVRAM variable,
|
||||||
// the Platform Mode (manufacturing/safe/normal) is handle in PeiGetVariable.
|
// the Platform Mode (manufacturing/safe/normal) is handle in PeiGetVariable.
|
||||||
//
|
//
|
||||||
VariableSize = sizeof(SYSTEM_CONFIGURATION);
|
VariableSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = Variable->GetVariable (
|
||||||
|
Variable,
|
||||||
|
L"Setup",
|
||||||
|
&gEfiSetupVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&VariableSize,
|
||||||
|
SystemConfiguration
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status) || VariableSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VariableSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = Variable->GetVariable(
|
||||||
Variable,
|
Variable,
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
&gEfiSetupVariableGuid,
|
&gEfiSetupVariableGuid,
|
||||||
|
@@ -716,7 +716,20 @@ PeiInitPlatform (
|
|||||||
NULL,
|
NULL,
|
||||||
(void **)&Variable
|
(void **)&Variable
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR(Status);
|
ASSERT_EFI_ERROR(Status);
|
||||||
|
Status = Variable->GetVariable (
|
||||||
|
Variable,
|
||||||
|
L"Setup",
|
||||||
|
&gEfiSetupVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&VariableSize,
|
||||||
|
&SystemConfiguration
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status) || VariableSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VariableSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = Variable->GetVariable(
|
||||||
|
Variable,
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
&gEfiSetupVariableGuid,
|
&gEfiSetupVariableGuid,
|
||||||
NULL,
|
NULL,
|
||||||
|
@@ -17,6 +17,8 @@ Module Name:
|
|||||||
|
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Module Name:
|
Module Name:
|
||||||
|
|
||||||
@@ -306,7 +308,7 @@ SystemConfigRouteConfig (
|
|||||||
Private->BackupNvData.ReservedO = Private->FakeNvData.ReservedO;
|
Private->BackupNvData.ReservedO = Private->FakeNvData.ReservedO;
|
||||||
LoadLpssDefaultValues (Private);
|
LoadLpssDefaultValues (Private);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Pass changed uncommitted data back to Form Browser
|
// Pass changed uncommitted data back to Form Browser
|
||||||
//
|
//
|
||||||
HiiSetBrowserData (&mSystemConfigGuid, mVariableName, sizeof (SYSTEM_CONFIGURATION), (UINT8 *) FakeNvData, NULL);
|
HiiSetBrowserData (&mSystemConfigGuid, mVariableName, sizeof (SYSTEM_CONFIGURATION), (UINT8 *) FakeNvData, NULL);
|
||||||
@@ -358,6 +360,7 @@ SystemConfigCallback (
|
|||||||
{
|
{
|
||||||
EFI_CALLBACK_INFO *Private;
|
EFI_CALLBACK_INFO *Private;
|
||||||
SYSTEM_CONFIGURATION *FakeNvData;
|
SYSTEM_CONFIGURATION *FakeNvData;
|
||||||
|
SYSTEM_CONFIGURATION *SetupData;
|
||||||
UINTN SizeOfNvStore;
|
UINTN SizeOfNvStore;
|
||||||
EFI_INPUT_KEY Key;
|
EFI_INPUT_KEY Key;
|
||||||
CHAR16 *StringBuffer1;
|
CHAR16 *StringBuffer1;
|
||||||
@@ -474,7 +477,7 @@ SystemConfigCallback (
|
|||||||
FakeNvData = &Private->FakeNvData;
|
FakeNvData = &Private->FakeNvData;
|
||||||
|
|
||||||
Status = HiiGetBrowserData (
|
Status = HiiGetBrowserData (
|
||||||
&mSystemConfigGuid,
|
&mSystemConfigGuid,
|
||||||
mVariableName,
|
mVariableName,
|
||||||
sizeof (SYSTEM_CONFIGURATION),
|
sizeof (SYSTEM_CONFIGURATION),
|
||||||
(UINT8 *) FakeNvData
|
(UINT8 *) FakeNvData
|
||||||
@@ -525,7 +528,7 @@ SystemConfigCallback (
|
|||||||
FakeNvData = &Private->FakeNvData;
|
FakeNvData = &Private->FakeNvData;
|
||||||
|
|
||||||
Status = HiiGetBrowserData (
|
Status = HiiGetBrowserData (
|
||||||
&mSystemConfigGuid,
|
&mSystemConfigGuid,
|
||||||
mVariableName,
|
mVariableName,
|
||||||
sizeof (SYSTEM_CONFIGURATION),
|
sizeof (SYSTEM_CONFIGURATION),
|
||||||
(UINT8 *) FakeNvData
|
(UINT8 *) FakeNvData
|
||||||
@@ -596,34 +599,32 @@ SystemConfigCallback (
|
|||||||
//
|
//
|
||||||
StrCpy (StringBuffer1, L"Do you want to load setup defaults and Exit?");
|
StrCpy (StringBuffer1, L"Do you want to load setup defaults and Exit?");
|
||||||
StrCpy (StringBuffer2, L" Enter (YES) / Esc (NO) ");
|
StrCpy (StringBuffer2, L" Enter (YES) / Esc (NO) ");
|
||||||
|
|
||||||
do {
|
do {
|
||||||
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL);
|
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL);
|
||||||
|
} while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the user hits the YES Response key
|
// If the user hits the YES Response key
|
||||||
//
|
//
|
||||||
if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
|
if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
|
||||||
|
|
||||||
//
|
Status = gBS->LocateProtocol (&gEdkiiFormBrowserEx2ProtocolGuid, NULL, (VOID **) &FormBrowserEx2);
|
||||||
// Load default
|
FormBrowserEx2->ExecuteAction(BROWSER_ACTION_DEFAULT, EFI_HII_DEFAULT_CLASS_STANDARD);
|
||||||
//
|
|
||||||
FakeNvData = AllocateZeroPool (sizeof(SYSTEM_CONFIGURATION));
|
FakeNvData = AllocateZeroPool (sizeof(SYSTEM_CONFIGURATION));
|
||||||
|
|
||||||
if (FakeNvData == NULL) {
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
if (FakeNvData == NULL) {
|
if (FakeNvData == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
SizeOfNvStore = sizeof(SYSTEM_CONFIGURATION);
|
|
||||||
|
|
||||||
Status = HiiGetBrowserData (
|
Status = HiiGetBrowserData (
|
||||||
&mSystemConfigGuid,
|
&mSystemConfigGuid,
|
||||||
NULL,
|
mVariableName,
|
||||||
sizeof (SYSTEM_CONFIGURATION),
|
sizeof (SYSTEM_CONFIGURATION),
|
||||||
(UINT8 *) FakeNvData
|
(UINT8 *) FakeNvData
|
||||||
);
|
);
|
||||||
|
|
||||||
if(SizeOfNvStore >= sizeof(SYSTEM_CONFIGURATION)) {
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = gRT->SetVariable (
|
Status = gRT->SetVariable (
|
||||||
L"Setup",
|
L"Setup",
|
||||||
|
@@ -126,6 +126,7 @@
|
|||||||
gEfiPciRootBridgeIoProtocolGuid
|
gEfiPciRootBridgeIoProtocolGuid
|
||||||
gEfiBusSpecificDriverOverrideProtocolGuid ## SOMETIMES_CONSUMED (Check whether the PCI device contains one or more efi drivers in its option rom by this protocol)
|
gEfiBusSpecificDriverOverrideProtocolGuid ## SOMETIMES_CONSUMED (Check whether the PCI device contains one or more efi drivers in its option rom by this protocol)
|
||||||
|
|
||||||
|
gEfiDriverBindingProtocolGuid ## SOMETIMES_CONSUMED
|
||||||
gEfiLoadedImageProtocolGuid ## SOMETIMES_CONSUMED
|
gEfiLoadedImageProtocolGuid ## SOMETIMES_CONSUMED
|
||||||
gEfiLoadedImageDevicePathProtocolGuid ## SOMETIMES_CONSUMED (Show the drivers in the second page that support DriverBindingProtocol, LoadedImageProtocol and LoadedImageDevicePathProtocol)
|
gEfiLoadedImageDevicePathProtocolGuid ## SOMETIMES_CONSUMED (Show the drivers in the second page that support DriverBindingProtocol, LoadedImageProtocol and LoadedImageDevicePathProtocol)
|
||||||
gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMED (Show the controller device in the first page that support DevicePathProtocol)
|
gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMED (Show the controller device in the first page that support DevicePathProtocol)
|
||||||
|
@@ -1750,7 +1750,18 @@ SetupInfo (void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = gRT->GetVariable(
|
||||||
|
NORMAL_SETUP_NAME,
|
||||||
|
&gEfiNormalSetupGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&mSystemConfiguration
|
||||||
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
//The setup variable is corrupted
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
Status = gRT->GetVariable(
|
Status = gRT->GetVariable(
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
&gEfiNormalSetupGuid,
|
&gEfiNormalSetupGuid,
|
||||||
|
@@ -170,6 +170,18 @@ InitializePlatformSmm (
|
|||||||
//
|
//
|
||||||
|
|
||||||
mAcpiBaseAddr = PchLpcPciCfg16( R_PCH_LPC_ACPI_BASE ) & B_PCH_LPC_ACPI_BASE_BAR;
|
mAcpiBaseAddr = PchLpcPciCfg16( R_PCH_LPC_ACPI_BASE ) & B_PCH_LPC_ACPI_BASE_BAR;
|
||||||
|
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = SystemTable->RuntimeServices->GetVariable(
|
||||||
|
L"Setup",
|
||||||
|
&gEfiSetupVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&mSystemConfiguration
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
Status = SystemTable->RuntimeServices->GetVariable(
|
Status = SystemTable->RuntimeServices->GetVariable(
|
||||||
L"SetupRecovery",
|
L"SetupRecovery",
|
||||||
&gEfiSetupVariableGuid,
|
&gEfiSetupVariableGuid,
|
||||||
@@ -848,7 +860,20 @@ EnableS5WakeOnRtc()
|
|||||||
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
|
||||||
//
|
//
|
||||||
// read the variable into the buffer
|
// read the variable into the buffer
|
||||||
|
//
|
||||||
|
Status = mSmmVariable->SmmGetVariable(
|
||||||
|
L"Setup",
|
||||||
|
&gEfiSetupVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&VarSize,
|
||||||
|
&mSystemConfiguration
|
||||||
|
);
|
||||||
|
if (EFI_ERROR(Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
|
||||||
|
//The setup variable is corrupted
|
||||||
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
|
Status = mSmmVariable->SmmGetVariable(
|
||||||
|
L"SetupRecovery",
|
||||||
&gEfiSetupVariableGuid,
|
&gEfiSetupVariableGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&VarSize,
|
&VarSize,
|
||||||
|
@@ -217,10 +217,10 @@ echo Running fce...
|
|||||||
|
|
||||||
pushd %PLATFORM_PACKAGE%
|
pushd %PLATFORM_PACKAGE%
|
||||||
:: Extract Hii data from build and store in HiiDefaultData.txt
|
:: Extract Hii data from build and store in HiiDefaultData.txt
|
||||||
fce read -i ..\%BUILD_PATH%\FV\Vlv.fd > ..\%BUILD_PATH%\FV\HiiDefaultData.txt 1>>EDK2.log 2>&1
|
fce read -i ..\%BUILD_PATH%\FV\Vlv.fd > ..\%BUILD_PATH%\FV\HiiDefaultData.txt
|
||||||
|
|
||||||
:: copy the Setup variable to the SetupDefault variable and save changes to VlvXXX.fd
|
:: save changes to VlvXXX.fd
|
||||||
fce mirror -i ..\%BUILD_PATH%\FV\Vlv.fd -o ..\%BUILD_PATH%\FV\Vlv%Arch%.fd Setup SetupDefault 1>>EDK2.log 2>&1
|
fce update -i ..\%BUILD_PATH%\FV\Vlv.fd -s ..\%BUILD_PATH%\FV\HiiDefaultData.txt -o ..\%BUILD_PATH%\FV\Vlv%Arch%.fd
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user