mirror of https://github.com/acidanthera/audk.git
IntelFrameworkModulePkg AcpiS3SaveDxe: Remove S3Ready() functional code
The S3Ready() functional code has been moved to S3SaveStateDxe in MdeModulePkg, the ACPI global variable related code is leaved as is for compatibility. PcdS3BootScriptStackSize is also moved to MdeModulePkg. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jeff Fan <jeff.fan@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
parent
e96708de88
commit
8ccd1d5b5c
|
@ -4,7 +4,7 @@
|
|||
# This package contains the definitions and module implementation
|
||||
# which follows Intel EFI Framework Specification.
|
||||
#
|
||||
# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2016, 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
|
||||
|
@ -248,12 +248,6 @@
|
|||
# @Prompt Reserved S3 Boot ACPI Memory Size
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize|0x8000|UINT32|0x30000006
|
||||
|
||||
## Specify memory size for boot script executor stack usage in S3 phase.
|
||||
# The default size 32K. When changing the value make sure the memory size is large enough
|
||||
# to meet boot script executor requirement in the S3 phase.
|
||||
# @Prompt Reserved S3 Boot Script Stack ACPI Memory Size
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3BootScriptStackSize|0x8000|UINT32|0x30000007
|
||||
|
||||
## Specify the end of address below 1MB for the OPROM.
|
||||
# The last shadowed OpROM should not exceed this address.
|
||||
# @Prompt Top Address of Shadowed Legacy OpROM
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// This package contains the definitions and module implementation
|
||||
// which follows Intel EFI Framework Specification.
|
||||
//
|
||||
// Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
// Copyright (c) 2007 - 2016, 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,10 +79,6 @@
|
|||
|
||||
#string STR_gEfiIntelFrameworkModulePkgTokenSpaceGuid_PcdS3AcpiReservedMemorySize_HELP #language en-US "Specify memory size with page number for a pre-allocated reserved memory to be used by PEI in S3 phase. The default size 32K. When changing the value make sure the memory size is large enough to meet PEI requirement in the S3 phase."
|
||||
|
||||
#string STR_gEfiIntelFrameworkModulePkgTokenSpaceGuid_PcdS3BootScriptStackSize_PROMPT #language en-US "Reserved S3 Boot Script Stack ACPI Memory Size"
|
||||
|
||||
#string STR_gEfiIntelFrameworkModulePkgTokenSpaceGuid_PcdS3BootScriptStackSize_HELP #language en-US "Specify memory size for boot script executor stack usage in S3 phase. The default size 32K. When changing the value make sure the memory size is large enough to meet boot script executor requirement in the S3 phase."
|
||||
|
||||
#string STR_gEfiIntelFrameworkModulePkgTokenSpaceGuid_PcdEndOpromShadowAddress_PROMPT #language en-US "Top Address of Shadowed Legacy OpROM"
|
||||
|
||||
#string STR_gEfiIntelFrameworkModulePkgTokenSpaceGuid_PcdEndOpromShadowAddress_HELP #language en-US "Specify the end of address below 1MB for the OPROM. The last shadowed OpROM should not exceed this address."
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
This is an implementation of the ACPI S3 Save protocol. This is defined in
|
||||
S3 boot path specification 0.9.
|
||||
|
||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
|
@ -16,27 +16,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
**/
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/LockBoxLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Guid/AcpiVariableCompatibility.h>
|
||||
#include <Guid/AcpiS3Context.h>
|
||||
#include <Guid/Acpi.h>
|
||||
#include <Protocol/AcpiS3Save.h>
|
||||
#include <IndustryStandard/Acpi.h>
|
||||
|
||||
#include "AcpiS3Save.h"
|
||||
|
||||
//
|
||||
// 8 extra pages for PF handler.
|
||||
//
|
||||
#define EXTRA_PAGE_TABLE_PAGES 8
|
||||
|
||||
/**
|
||||
Hook point for AcpiVariableThunkPlatform for InstallAcpiS3Save.
|
||||
**/
|
||||
|
@ -48,11 +35,10 @@ InstallAcpiS3SaveThunk (
|
|||
/**
|
||||
Hook point for AcpiVariableThunkPlatform for S3Ready.
|
||||
|
||||
@param AcpiS3Context ACPI s3 context
|
||||
**/
|
||||
VOID
|
||||
S3ReadyThunkPlatform (
|
||||
IN ACPI_S3_CONTEXT *AcpiS3Context
|
||||
VOID
|
||||
);
|
||||
|
||||
UINTN mLegacyRegionSize;
|
||||
|
@ -62,10 +48,6 @@ EFI_ACPI_S3_SAVE_PROTOCOL mS3Save = {
|
|||
S3Ready,
|
||||
};
|
||||
|
||||
EFI_GUID mAcpiS3IdtrProfileGuid = {
|
||||
0xdea652b0, 0xd587, 0x4c54, { 0xb5, 0xb4, 0xc6, 0x82, 0xe7, 0xa0, 0xaa, 0x3d }
|
||||
};
|
||||
|
||||
/**
|
||||
Allocate memory below 4G memory address.
|
||||
|
||||
|
@ -105,356 +87,6 @@ AllocateMemoryBelow4G (
|
|||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
This function scan ACPI table in RSDT.
|
||||
|
||||
@param Rsdt ACPI RSDT
|
||||
@param Signature ACPI table signature
|
||||
|
||||
@return ACPI table
|
||||
|
||||
**/
|
||||
VOID *
|
||||
ScanTableInRSDT (
|
||||
IN EFI_ACPI_DESCRIPTION_HEADER *Rsdt,
|
||||
IN UINT32 Signature
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINT32 EntryCount;
|
||||
UINT32 *EntryPtr;
|
||||
EFI_ACPI_DESCRIPTION_HEADER *Table;
|
||||
|
||||
if (Rsdt == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EntryCount = (Rsdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / sizeof(UINT32);
|
||||
|
||||
EntryPtr = (UINT32 *)(Rsdt + 1);
|
||||
for (Index = 0; Index < EntryCount; Index ++, EntryPtr ++) {
|
||||
Table = (EFI_ACPI_DESCRIPTION_HEADER *)((UINTN)(*EntryPtr));
|
||||
if (Table->Signature == Signature) {
|
||||
return Table;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
This function scan ACPI table in XSDT.
|
||||
|
||||
@param Xsdt ACPI XSDT
|
||||
@param Signature ACPI table signature
|
||||
|
||||
@return ACPI table
|
||||
|
||||
**/
|
||||
VOID *
|
||||
ScanTableInXSDT (
|
||||
IN EFI_ACPI_DESCRIPTION_HEADER *Xsdt,
|
||||
IN UINT32 Signature
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINT32 EntryCount;
|
||||
UINT64 EntryPtr;
|
||||
UINTN BasePtr;
|
||||
EFI_ACPI_DESCRIPTION_HEADER *Table;
|
||||
|
||||
if (Xsdt == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EntryCount = (Xsdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / sizeof(UINT64);
|
||||
|
||||
BasePtr = (UINTN)(Xsdt + 1);
|
||||
for (Index = 0; Index < EntryCount; Index ++) {
|
||||
CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * sizeof(UINT64)), sizeof(UINT64));
|
||||
Table = (EFI_ACPI_DESCRIPTION_HEADER *)((UINTN)(EntryPtr));
|
||||
if (Table->Signature == Signature) {
|
||||
return Table;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
To find Facs in FADT.
|
||||
|
||||
@param Fadt FADT table pointer
|
||||
|
||||
@return Facs table pointer.
|
||||
**/
|
||||
EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *
|
||||
FindAcpiFacsFromFadt (
|
||||
IN EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt
|
||||
)
|
||||
{
|
||||
EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs;
|
||||
UINT64 Data64;
|
||||
|
||||
if (Fadt == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (Fadt->Header.Revision < EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
|
||||
Facs = (EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)(UINTN)Fadt->FirmwareCtrl;
|
||||
} else {
|
||||
if (Fadt->FirmwareCtrl != 0) {
|
||||
Facs = (EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)(UINTN)Fadt->FirmwareCtrl;
|
||||
} else {
|
||||
CopyMem (&Data64, &Fadt->XFirmwareCtrl, sizeof(UINT64));
|
||||
Facs = (EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)(UINTN)Data64;
|
||||
}
|
||||
}
|
||||
return Facs;
|
||||
}
|
||||
|
||||
/**
|
||||
To find Facs in Acpi tables.
|
||||
|
||||
To find Firmware ACPI control strutcure in Acpi Tables since the S3 waking vector is stored
|
||||
in the table.
|
||||
|
||||
@param AcpiTableGuid The guid used to find ACPI table in UEFI ConfigurationTable.
|
||||
|
||||
@return Facs table pointer.
|
||||
**/
|
||||
EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *
|
||||
FindAcpiFacsTableByAcpiGuid (
|
||||
IN EFI_GUID *AcpiTableGuid
|
||||
)
|
||||
{
|
||||
EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;
|
||||
EFI_ACPI_DESCRIPTION_HEADER *Rsdt;
|
||||
EFI_ACPI_DESCRIPTION_HEADER *Xsdt;
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;
|
||||
EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs;
|
||||
UINTN Index;
|
||||
|
||||
Rsdp = NULL;
|
||||
//
|
||||
// found ACPI table RSD_PTR from system table
|
||||
//
|
||||
for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {
|
||||
if (CompareGuid (&(gST->ConfigurationTable[Index].VendorGuid), AcpiTableGuid)) {
|
||||
//
|
||||
// A match was found.
|
||||
//
|
||||
Rsdp = gST->ConfigurationTable[Index].VendorTable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Rsdp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Search XSDT
|
||||
//
|
||||
if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION) {
|
||||
Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN) Rsdp->XsdtAddress;
|
||||
Fadt = ScanTableInXSDT (Xsdt, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE);
|
||||
if (Fadt != NULL) {
|
||||
Facs = FindAcpiFacsFromFadt (Fadt);
|
||||
if (Facs != NULL) {
|
||||
return Facs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Search RSDT
|
||||
//
|
||||
Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN) Rsdp->RsdtAddress;
|
||||
Fadt = ScanTableInRSDT (Rsdt, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE);
|
||||
if (Fadt != NULL) {
|
||||
Facs = FindAcpiFacsFromFadt (Fadt);
|
||||
if (Facs != NULL) {
|
||||
return Facs;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
To find Facs in Acpi tables.
|
||||
|
||||
To find Firmware ACPI control strutcure in Acpi Tables since the S3 waking vector is stored
|
||||
in the table.
|
||||
|
||||
@return Facs table pointer.
|
||||
**/
|
||||
EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *
|
||||
FindAcpiFacsTable (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs;
|
||||
|
||||
Facs = FindAcpiFacsTableByAcpiGuid (&gEfiAcpi20TableGuid);
|
||||
if (Facs != NULL) {
|
||||
return Facs;
|
||||
}
|
||||
|
||||
return FindAcpiFacsTableByAcpiGuid (&gEfiAcpi10TableGuid);
|
||||
}
|
||||
|
||||
/**
|
||||
The function will check if long mode waking vector is supported.
|
||||
|
||||
@param[in] Facs Pointer to FACS table.
|
||||
|
||||
@retval TRUE Long mode waking vector is supported.
|
||||
@retval FALSE Long mode waking vector is not supported.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
IsLongModeWakingVectorSupport (
|
||||
IN EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs
|
||||
)
|
||||
{
|
||||
if ((Facs == NULL) ||
|
||||
(Facs->Signature != EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) ) {
|
||||
//
|
||||
// Something wrong with FACS.
|
||||
//
|
||||
return FALSE;
|
||||
}
|
||||
if (Facs->XFirmwareWakingVector != 0) {
|
||||
if ((Facs->Version == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
|
||||
((Facs->Flags & EFI_ACPI_4_0_64BIT_WAKE_SUPPORTED_F) != 0)) {
|
||||
//
|
||||
// BIOS supports 64bit waking vector.
|
||||
//
|
||||
if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Allocates page table buffer.
|
||||
|
||||
@param[in] LongModeWakingVectorSupport Support long mode waking vector or not.
|
||||
|
||||
If BootScriptExector driver will run in 64-bit mode, this function will establish the 1:1
|
||||
virtual to physical mapping page table when long mode waking vector is supported, otherwise
|
||||
create 4G page table when long mode waking vector is not supported and let PF handler to
|
||||
handle > 4G request.
|
||||
If BootScriptExector driver will not run in 64-bit mode, this function will do nothing.
|
||||
|
||||
@return Page table base address.
|
||||
|
||||
**/
|
||||
EFI_PHYSICAL_ADDRESS
|
||||
S3AllocatePageTablesBuffer (
|
||||
IN BOOLEAN LongModeWakingVectorSupport
|
||||
)
|
||||
{
|
||||
if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
|
||||
UINTN ExtraPageTablePages;
|
||||
UINT32 RegEax;
|
||||
UINT32 RegEdx;
|
||||
UINT8 PhysicalAddressBits;
|
||||
UINT32 NumberOfPml4EntriesNeeded;
|
||||
UINT32 NumberOfPdpEntriesNeeded;
|
||||
EFI_PHYSICAL_ADDRESS S3NvsPageTableAddress;
|
||||
UINTN TotalPageTableSize;
|
||||
VOID *Hob;
|
||||
BOOLEAN Page1GSupport;
|
||||
|
||||
Page1GSupport = FALSE;
|
||||
if (PcdGetBool(PcdUse1GPageTable)) {
|
||||
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
|
||||
if (RegEax >= 0x80000001) {
|
||||
AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx);
|
||||
if ((RegEdx & BIT26) != 0) {
|
||||
Page1GSupport = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get physical address bits supported.
|
||||
//
|
||||
Hob = GetFirstHob (EFI_HOB_TYPE_CPU);
|
||||
if (Hob != NULL) {
|
||||
PhysicalAddressBits = ((EFI_HOB_CPU *) Hob)->SizeOfMemorySpace;
|
||||
} else {
|
||||
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
|
||||
if (RegEax >= 0x80000008) {
|
||||
AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
|
||||
PhysicalAddressBits = (UINT8) RegEax;
|
||||
} else {
|
||||
PhysicalAddressBits = 36;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// IA-32e paging translates 48-bit linear addresses to 52-bit physical addresses.
|
||||
//
|
||||
ASSERT (PhysicalAddressBits <= 52);
|
||||
if (PhysicalAddressBits > 48) {
|
||||
PhysicalAddressBits = 48;
|
||||
}
|
||||
|
||||
ExtraPageTablePages = 0;
|
||||
if (!LongModeWakingVectorSupport) {
|
||||
//
|
||||
// Create 4G page table when BIOS does not support long mode waking vector,
|
||||
// and let PF handler to handle > 4G request.
|
||||
//
|
||||
PhysicalAddressBits = 32;
|
||||
ExtraPageTablePages = EXTRA_PAGE_TABLE_PAGES;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate the table entries needed.
|
||||
//
|
||||
if (PhysicalAddressBits <= 39 ) {
|
||||
NumberOfPml4EntriesNeeded = 1;
|
||||
NumberOfPdpEntriesNeeded = (UINT32)LShiftU64 (1, (PhysicalAddressBits - 30));
|
||||
} else {
|
||||
NumberOfPml4EntriesNeeded = (UINT32)LShiftU64 (1, (PhysicalAddressBits - 39));
|
||||
NumberOfPdpEntriesNeeded = 512;
|
||||
}
|
||||
|
||||
//
|
||||
// We need calculate whole page size then allocate once, because S3 restore page table does not know each page in Nvs.
|
||||
//
|
||||
if (!Page1GSupport) {
|
||||
TotalPageTableSize = (UINTN)(1 + NumberOfPml4EntriesNeeded + NumberOfPml4EntriesNeeded * NumberOfPdpEntriesNeeded);
|
||||
} else {
|
||||
TotalPageTableSize = (UINTN)(1 + NumberOfPml4EntriesNeeded);
|
||||
}
|
||||
|
||||
TotalPageTableSize += ExtraPageTablePages;
|
||||
DEBUG ((EFI_D_ERROR, "AcpiS3Save TotalPageTableSize - 0x%x pages\n", TotalPageTableSize));
|
||||
|
||||
//
|
||||
// By architecture only one PageMapLevel4 exists - so lets allocate storage for it.
|
||||
//
|
||||
S3NvsPageTableAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateMemoryBelow4G (EfiReservedMemoryType, EFI_PAGES_TO_SIZE(TotalPageTableSize));
|
||||
ASSERT (S3NvsPageTableAddress != 0);
|
||||
return S3NvsPageTableAddress;
|
||||
} else {
|
||||
//
|
||||
// If DXE is running 32-bit mode, no need to establish page table.
|
||||
//
|
||||
return (EFI_PHYSICAL_ADDRESS) 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Gets the buffer of legacy memory below 1 MB
|
||||
This function is to get the buffer in legacy memory below 1MB that is required during S3 resume.
|
||||
|
@ -502,13 +134,7 @@ S3Ready (
|
|||
IN VOID *LegacyMemoryAddress
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS AcpiS3ContextBuffer;
|
||||
ACPI_S3_CONTEXT *AcpiS3Context;
|
||||
STATIC BOOLEAN AlreadyEntered;
|
||||
IA32_DESCRIPTOR *Idtr;
|
||||
IA32_IDT_GATE_DESCRIPTOR *IdtGate;
|
||||
EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs;
|
||||
STATIC BOOLEAN AlreadyEntered;
|
||||
|
||||
DEBUG ((EFI_D_INFO, "S3Ready!\n"));
|
||||
|
||||
|
@ -521,77 +147,8 @@ S3Ready (
|
|||
}
|
||||
AlreadyEntered = TRUE;
|
||||
|
||||
AcpiS3Context = AllocateMemoryBelow4G (EfiReservedMemoryType, sizeof(*AcpiS3Context));
|
||||
ASSERT (AcpiS3Context != NULL);
|
||||
AcpiS3ContextBuffer = (EFI_PHYSICAL_ADDRESS)(UINTN)AcpiS3Context;
|
||||
|
||||
//
|
||||
// Get ACPI Table because we will save its position to variable
|
||||
//
|
||||
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) FindAcpiFacsTable ();
|
||||
AcpiS3Context->AcpiFacsTable = (EFI_PHYSICAL_ADDRESS) (UINTN) Facs;
|
||||
ASSERT (AcpiS3Context->AcpiFacsTable != 0);
|
||||
|
||||
IdtGate = AllocateMemoryBelow4G (EfiReservedMemoryType, sizeof(IA32_IDT_GATE_DESCRIPTOR) * 0x100 + sizeof(IA32_DESCRIPTOR));
|
||||
Idtr = (IA32_DESCRIPTOR *)(IdtGate + 0x100);
|
||||
Idtr->Base = (UINTN)IdtGate;
|
||||
Idtr->Limit = (UINT16)(sizeof(IA32_IDT_GATE_DESCRIPTOR) * 0x100 - 1);
|
||||
AcpiS3Context->IdtrProfile = (EFI_PHYSICAL_ADDRESS)(UINTN)Idtr;
|
||||
|
||||
Status = SaveLockBox (
|
||||
&mAcpiS3IdtrProfileGuid,
|
||||
(VOID *)(UINTN)Idtr,
|
||||
(UINTN)sizeof(IA32_DESCRIPTOR)
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = SetLockBoxAttributes (&mAcpiS3IdtrProfileGuid, LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Allocate page table
|
||||
//
|
||||
AcpiS3Context->S3NvsPageTableAddress = S3AllocatePageTablesBuffer (IsLongModeWakingVectorSupport (Facs));
|
||||
|
||||
//
|
||||
// Allocate stack
|
||||
//
|
||||
AcpiS3Context->BootScriptStackSize = PcdGet32 (PcdS3BootScriptStackSize);
|
||||
AcpiS3Context->BootScriptStackBase = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateMemoryBelow4G (EfiReservedMemoryType, PcdGet32 (PcdS3BootScriptStackSize));
|
||||
ASSERT (AcpiS3Context->BootScriptStackBase != 0);
|
||||
|
||||
//
|
||||
// Allocate a code buffer < 4G for S3 debug to load external code, set invalid code instructions in it.
|
||||
//
|
||||
AcpiS3Context->S3DebugBufferAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateMemoryBelow4G (EfiReservedMemoryType, EFI_PAGE_SIZE);
|
||||
SetMem ((VOID *)(UINTN)AcpiS3Context->S3DebugBufferAddress, EFI_PAGE_SIZE, 0xff);
|
||||
|
||||
DEBUG((EFI_D_INFO, "AcpiS3Context: AcpiFacsTable is 0x%8x\n", AcpiS3Context->AcpiFacsTable));
|
||||
DEBUG((EFI_D_INFO, "AcpiS3Context: IdtrProfile is 0x%8x\n", AcpiS3Context->IdtrProfile));
|
||||
DEBUG((EFI_D_INFO, "AcpiS3Context: S3NvsPageTableAddress is 0x%8x\n", AcpiS3Context->S3NvsPageTableAddress));
|
||||
DEBUG((EFI_D_INFO, "AcpiS3Context: S3DebugBufferAddress is 0x%8x\n", AcpiS3Context->S3DebugBufferAddress));
|
||||
DEBUG((EFI_D_INFO, "AcpiS3Context: BootScriptStackBase is 0x%8x\n", AcpiS3Context->BootScriptStackBase));
|
||||
DEBUG((EFI_D_INFO, "AcpiS3Context: BootScriptStackSize is 0x%8x\n", AcpiS3Context->BootScriptStackSize));
|
||||
|
||||
Status = SaveLockBox (
|
||||
&gEfiAcpiVariableGuid,
|
||||
&AcpiS3ContextBuffer,
|
||||
sizeof(AcpiS3ContextBuffer)
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = SaveLockBox (
|
||||
&gEfiAcpiS3ContextGuid,
|
||||
(VOID *)(UINTN)AcpiS3Context,
|
||||
(UINTN)sizeof(*AcpiS3Context)
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = SetLockBoxAttributes (&gEfiAcpiS3ContextGuid, LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
if (FeaturePcdGet(PcdFrameworkCompatibilitySupport)) {
|
||||
S3ReadyThunkPlatform (AcpiS3Context);
|
||||
S3ReadyThunkPlatform ();
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
|
|
@ -48,15 +48,9 @@
|
|||
BaseMemoryLib
|
||||
HobLib
|
||||
UefiLib
|
||||
LockBoxLib
|
||||
DebugLib
|
||||
DxeServicesLib
|
||||
|
||||
[Guids]
|
||||
gEfiAcpiVariableGuid ## PRODUCES ## UNDEFINED # LockBox Save Data.
|
||||
gEfiAcpiS3ContextGuid ## PRODUCES ## UNDEFINED # LockBox Save Data.
|
||||
gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES ## SystemTable
|
||||
gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES ## SystemTable
|
||||
## SOMETIMES_CONSUMES ## Variable:L"AcpiGlobalVariable"
|
||||
## SOMETIMES_PRODUCES ## Variable:L"AcpiGlobalVariable"
|
||||
gEfiAcpiVariableCompatiblityGuid
|
||||
|
@ -71,12 +65,9 @@
|
|||
[FeaturePcd]
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformCsmSupport ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES
|
||||
|
||||
[Pcd]
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize ## SOMETIMES_CONSUMES
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3BootScriptStackSize ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable ## CONSUMES
|
||||
|
||||
[Depex]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
This is an implementation of the AcpiVariable platform field for ECP platform.
|
||||
|
||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
|
@ -43,7 +43,6 @@ typedef struct {
|
|||
#include <Protocol/FrameworkMpService.h>
|
||||
#include <Protocol/VariableLock.h>
|
||||
#include <Guid/AcpiVariableCompatibility.h>
|
||||
#include <Guid/AcpiS3Context.h>
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED
|
||||
ACPI_VARIABLE_SET_COMPATIBILITY *mAcpiVariableSetCompatibility = NULL;
|
||||
|
@ -68,11 +67,10 @@ AllocateMemoryBelow4G (
|
|||
/**
|
||||
Hook point for AcpiVariableThunkPlatform for S3Ready.
|
||||
|
||||
@param AcpiS3Context ACPI s3 context
|
||||
**/
|
||||
VOID
|
||||
S3ReadyThunkPlatform (
|
||||
IN ACPI_S3_CONTEXT *AcpiS3Context
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_PHYSICAL_ADDRESS AcpiMemoryBase;
|
||||
|
|
Loading…
Reference in New Issue