Remove Variable PPI dependency from S3Resume module, check return status of locating SmmAccess PPI in S3Resume S3ResumeExecuteBootScript(), and locate SmmAccess PPI and Open SMRAM region only when gEfiAcpiVariableGuid HOB is found in S3Resume S3RestoreConfig2().

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13592 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lzeng14 2012-08-06 03:08:49 +00:00
parent cdd3f03236
commit 40ef06fc2a
2 changed files with 26 additions and 34 deletions

View File

@ -284,7 +284,9 @@ WriteToOsS3PerformanceData (
NULL,
(VOID **) &VariableServices
);
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
return;
}
VarSize = sizeof (EFI_PHYSICAL_ADDRESS);
Status = VariableServices->GetVariable (
@ -681,17 +683,18 @@ S3ResumeExecuteBootScript (
NULL,
(VOID **) &SmmAccess
);
if (!EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Close all SMRAM regions before executing boot script\n"));
for (Index = 0, Status = EFI_SUCCESS; !EFI_ERROR (Status); Index++) {
Status = SmmAccess->Close ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index);
}
DEBUG ((EFI_D_ERROR, "Close all SMRAM regions before executing boot script\n"));
for (Index = 0, Status = EFI_SUCCESS; !EFI_ERROR (Status); Index++) {
Status = SmmAccess->Close ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index);
}
DEBUG ((EFI_D_ERROR, "Lock all SMRAM regions before executing boot script\n"));
for (Index = 0, Status = EFI_SUCCESS; !EFI_ERROR (Status); Index++) {
Status = SmmAccess->Lock ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index);
DEBUG ((EFI_D_ERROR, "Lock all SMRAM regions before executing boot script\n"));
for (Index = 0, Status = EFI_SUCCESS; !EFI_ERROR (Status); Index++) {
Status = SmmAccess->Lock ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index);
}
}
}
@ -817,7 +820,6 @@ S3RestoreConfig2 (
PEI_SMM_ACCESS_PPI *SmmAccess;
UINTN Index;
ACPI_S3_CONTEXT *AcpiS3Context;
EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariableServices;
EFI_PHYSICAL_ADDRESS TempEfiBootScriptExecutorVariable;
EFI_PHYSICAL_ADDRESS TempAcpiS3Context;
BOOT_SCRIPT_EXECUTOR_VARIABLE *EfiBootScriptExecutorVariable;
@ -828,26 +830,6 @@ S3RestoreConfig2 (
DEBUG ((EFI_D_ERROR, "Enter S3 PEIM\r\n"));
Status = PeiServicesLocatePpi (
&gPeiSmmAccessPpiGuid,
0,
NULL,
(VOID **) &SmmAccess
);
for (Index = 0; !EFI_ERROR (Status); Index++) {
Status = SmmAccess->Open ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index);
}
Status = PeiServicesLocatePpi (
&gEfiPeiReadOnlyVariable2PpiGuid,
0,
NULL,
(VOID **) &VariableServices
);
if (EFI_ERROR (Status)) {
return Status;
}
VarSize = sizeof (EFI_PHYSICAL_ADDRESS);
Status = RestoreLockBox (
&gEfiAcpiVariableGuid,
@ -914,6 +896,16 @@ S3RestoreConfig2 (
//
GuidHob = GetFirstGuidHob (&gEfiAcpiVariableGuid);
if (GuidHob != NULL) {
Status = PeiServicesLocatePpi (
&gPeiSmmAccessPpiGuid,
0,
NULL,
(VOID **) &SmmAccess
);
for (Index = 0; !EFI_ERROR (Status); Index++) {
Status = SmmAccess->Open ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index);
}
SmramDescriptor = (EFI_SMRAM_DESCRIPTOR *) GET_GUID_HOB_DATA (GuidHob);
SmmS3ResumeState = (SMM_S3_RESUME_STATE *)(UINTN)SmramDescriptor->CpuStart;

View File

@ -4,7 +4,7 @@
# This module will excute the boot script saved during last boot and after that,
# control is passed to OS waking up handler.
#
# Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2010 - 2012, 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
@ -79,4 +79,4 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
[Depex]
gEfiPeiReadOnlyVariable2PpiGuid
TRUE