OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
/** @file
|
2015-07-26 10:02:29 +02:00
|
|
|
This is a replacement for the ACPI S3 Save protocol.
|
|
|
|
|
|
|
|
The ACPI S3 Save protocol used to be defined in the S3 boot path
|
|
|
|
specification 0.9. Instead, the same functionality is now hooked to the
|
|
|
|
End-of-Dxe event.
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
|
OvmfPkg: AcpiS3SaveDxe: prepare for End-of-Dxe callback
We are preparing for detaching the S3Ready() functionality from the
EFI_ACPI_S3_SAVE_PROTOCOL.S3Save() protocol member function. Instead, we
will hook the same logic to the End-of-Dxe event group.
The EFI_ACPI_S3_SAVE_PROTOCOL has another member: GetLegacyMemorySize().
According to the documenation,
This function returns the size of the legacy memory (meaning below 1 MB)
that is required during an S3 resume. Before the Framework-based
firmware transfers control to the OS, it has to transition from flat
mode into real mode in case the OS supplies only a real-mode waking
vector. This transition requires a certain amount of legacy memory.
After getting the size of legacy memory below, the caller is responsible
for allocating the legacy memory below 1 MB according to the size that
is returned. The specific implementation of allocating the legacy memory
is out of the scope of this specification.
When EFI_ACPI_S3_SAVE_PROTOCOL.S3Save() is called, the address of the
legacy memory allocated above must be passed to it, in the
LegacyMemoryAddress parameter.
In practice however:
- The S3Ready() function ignores the LegacyMemoryAddress completely.
- No code in the edk2 tree calls
EFI_ACPI_S3_SAVE_PROTOCOL.GetLegacyMemorySize(), ever.
- All callers of this specific implementation of
EFI_ACPI_S3_SAVE_PROTOCOL.S3Save() in the edk2 tree pass a NULL
LegacyMemoryAddress:
BdsLibBootViaBootOption()
[IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c]
For this reason, ASSERT() explicitly that LegacyGetS3MemorySize() is never
called, and that the LegacyMemoryAddress parameter is always NULL.
This fact is important to capture in the code, because in the End-of-Dxe
callback, no LegacyMemoryAddress parameter can be taken. So let's make it
clear that we actually don't even have any use for that parameter.
This patch ports the identical change from IntelFrameworkModulePkg to
OvmfPkg.
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18033 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-26 10:02:02 +02:00
|
|
|
Copyright (c) 2014-2015, Red Hat, Inc.<BR>
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
Copyright (c) 2006 - 2013, 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.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#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>
|
2014-03-31 22:35:58 +02:00
|
|
|
#include <Library/QemuFwCfgLib.h>
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
#include <Guid/AcpiVariableCompatibility.h>
|
|
|
|
#include <Guid/AcpiS3Context.h>
|
|
|
|
#include <Guid/Acpi.h>
|
2015-07-26 10:02:07 +02:00
|
|
|
#include <Guid/EventGroup.h>
|
2014-03-04 09:04:04 +01:00
|
|
|
#include <Protocol/LockBox.h>
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
#include <IndustryStandard/Acpi.h>
|
|
|
|
|
|
|
|
EFI_GUID mAcpiS3IdtrProfileGuid = {
|
|
|
|
0xdea652b0, 0xd587, 0x4c54, { 0xb5, 0xb4, 0xc6, 0x82, 0xe7, 0xa0, 0xaa, 0x3d }
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
Allocate memory below 4G memory address.
|
|
|
|
|
|
|
|
This function allocates memory below 4G memory address.
|
|
|
|
|
|
|
|
@param MemoryType Memory type of memory to allocate.
|
|
|
|
@param Size Size of memory to allocate.
|
|
|
|
|
|
|
|
@return Allocated address for output.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID*
|
|
|
|
AllocateMemoryBelow4G (
|
|
|
|
IN EFI_MEMORY_TYPE MemoryType,
|
|
|
|
IN UINTN Size
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UINTN Pages;
|
|
|
|
EFI_PHYSICAL_ADDRESS Address;
|
|
|
|
EFI_STATUS Status;
|
|
|
|
VOID* Buffer;
|
|
|
|
|
|
|
|
Pages = EFI_SIZE_TO_PAGES (Size);
|
|
|
|
Address = 0xffffffff;
|
|
|
|
|
|
|
|
Status = gBS->AllocatePages (
|
|
|
|
AllocateMaxAddress,
|
|
|
|
MemoryType,
|
|
|
|
Pages,
|
|
|
|
&Address
|
|
|
|
);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
|
|
|
Buffer = (VOID *) (UINTN) Address;
|
|
|
|
ZeroMem (Buffer, Size);
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Allocates and fills in the Page Directory and Page Table Entries to
|
|
|
|
establish a 1:1 Virtual to Physical mapping.
|
|
|
|
If BootScriptExector driver will run in 64-bit mode, this function will establish the 1:1
|
|
|
|
virtual to physical mapping page table.
|
|
|
|
If BootScriptExector driver will not run in 64-bit mode, this function will do nothing.
|
|
|
|
|
|
|
|
@return the 1:1 Virtual to Physical identity mapping page table base address.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_PHYSICAL_ADDRESS
|
|
|
|
S3CreateIdentityMappingPageTables (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// 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);
|
|
|
|
}
|
2015-07-28 20:33:23 +02:00
|
|
|
DEBUG ((EFI_D_ERROR, "TotalPageTableSize - %Lx pages\n",
|
|
|
|
(UINT64)TotalPageTableSize));
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Prepares all information that is needed in the S3 resume boot path.
|
|
|
|
|
|
|
|
Allocate the resources or prepare informations and save in ACPI variable set for S3 resume boot path
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS All information was saved successfully.
|
|
|
|
**/
|
2015-07-26 10:02:29 +02:00
|
|
|
STATIC
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
S3Ready (
|
2015-07-26 10:02:29 +02:00
|
|
|
VOID
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_PHYSICAL_ADDRESS AcpiS3ContextBuffer;
|
|
|
|
ACPI_S3_CONTEXT *AcpiS3Context;
|
|
|
|
STATIC BOOLEAN AlreadyEntered;
|
|
|
|
IA32_DESCRIPTOR *Idtr;
|
|
|
|
IA32_IDT_GATE_DESCRIPTOR *IdtGate;
|
|
|
|
|
|
|
|
DEBUG ((EFI_D_INFO, "S3Ready!\n"));
|
|
|
|
|
2015-07-26 10:02:29 +02:00
|
|
|
ASSERT (!AlreadyEntered);
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
if (AlreadyEntered) {
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
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
|
|
|
|
//
|
|
|
|
AcpiS3Context->AcpiFacsTable = (EFI_PHYSICAL_ADDRESS)(UINTN)FindAcpiFacsTable ();
|
|
|
|
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 = S3CreateIdentityMappingPageTables ();
|
|
|
|
|
|
|
|
//
|
|
|
|
// 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);
|
|
|
|
|
2015-07-28 20:33:23 +02:00
|
|
|
DEBUG ((EFI_D_INFO, "AcpiS3Context: AcpiFacsTable is 0x%8Lx\n",
|
|
|
|
AcpiS3Context->AcpiFacsTable));
|
|
|
|
DEBUG ((EFI_D_INFO, "AcpiS3Context: IdtrProfile is 0x%8Lx\n",
|
|
|
|
AcpiS3Context->IdtrProfile));
|
|
|
|
DEBUG ((EFI_D_INFO, "AcpiS3Context: S3NvsPageTableAddress is 0x%8Lx\n",
|
|
|
|
AcpiS3Context->S3NvsPageTableAddress));
|
|
|
|
DEBUG ((EFI_D_INFO, "AcpiS3Context: S3DebugBufferAddress is 0x%8Lx\n",
|
|
|
|
AcpiS3Context->S3DebugBufferAddress));
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2015-07-26 10:02:07 +02:00
|
|
|
/**
|
|
|
|
Callback function executed when the EndOfDxe event group is signaled.
|
|
|
|
|
|
|
|
@param[in] Event Event whose notification function is being invoked.
|
|
|
|
@param[in] Context The pointer to the notification function's context, which
|
|
|
|
is implementation-dependent.
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
OnEndOfDxe (
|
|
|
|
IN EFI_EVENT Event,
|
|
|
|
IN VOID *Context
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
|
|
|
|
//
|
2015-07-26 10:02:29 +02:00
|
|
|
// Our S3Ready() function always succeeds.
|
2015-07-26 10:02:07 +02:00
|
|
|
//
|
2015-07-26 10:02:29 +02:00
|
|
|
Status = S3Ready ();
|
2015-07-26 10:02:07 +02:00
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Close the event, deregistering the callback and freeing resources.
|
|
|
|
//
|
|
|
|
Status = gBS->CloseEvent (Event);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
/**
|
|
|
|
The Driver Entry Point.
|
|
|
|
|
2015-07-26 10:02:29 +02:00
|
|
|
The function is the driver Entry point that will register the End-of-Dxe
|
|
|
|
callback.
|
|
|
|
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
@param ImageHandle A handle for the image that is initializing this driver
|
|
|
|
@param SystemTable A pointer to the EFI system table
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS: Driver initialized successfully
|
|
|
|
@retval EFI_LOAD_ERROR: Failed to Initialize or has been loaded
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
2015-07-26 10:02:29 +02:00
|
|
|
InstallEndOfDxeCallback (
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
2015-07-26 10:02:07 +02:00
|
|
|
EFI_EVENT EndOfDxeEvent;
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
|
2014-03-31 22:35:58 +02:00
|
|
|
if (!QemuFwCfgS3Enabled()) {
|
|
|
|
return EFI_LOAD_ERROR;
|
|
|
|
}
|
|
|
|
|
2015-11-30 19:42:01 +01:00
|
|
|
if (!FeaturePcdGet (PcdSmmSmramRequire)) {
|
|
|
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
|
|
|
&ImageHandle,
|
|
|
|
&gEfiLockBoxProtocolGuid, NULL,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
}
|
2015-07-26 10:02:07 +02:00
|
|
|
|
|
|
|
Status = gBS->CreateEventEx (
|
|
|
|
EVT_NOTIFY_SIGNAL,
|
|
|
|
TPL_CALLBACK,
|
|
|
|
OnEndOfDxe,
|
|
|
|
NULL, /* NotifyContext */
|
|
|
|
&gEfiEndOfDxeEventGroupGuid,
|
|
|
|
&EndOfDxeEvent
|
|
|
|
);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf"
currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services).
The justification is the following code sequence:
InstallAcpiS3Save()
if PcdFrameworkCompatibilitySupport is set:
InstallAcpiS3SaveThunk()
if EFI_MP_SERVICES_PROTOCOL is available:
GetVariable(ACPI_GLOBAL_VARIABLE)
In English, the AcpiS3SaveDxe driver insists on the presence of MP
Services *unconditionally* because,
- if PcdFrameworkCompatibilitySupport is set (the default is false),
- and MP Services are available (which is constant true under the above
condition),
then the AcpiS3SaveDxe driver would like to get the ACPI_GLOBAL_VARIABLE
variable from the MP Services driver, rather than setting it itself.
The DepEx prevents AcpiS3SaveDxe from loading under OvmfPkg, since we
provide no MP Services implementation. This is particularly broken since
the default PcdFrameworkCompatibilitySupport value is FALSE, making the
entire code that would look at EFI_MP_SERVICES_PROTOCOL dead.
Copy AcpiS3SaveDxe to OvmfPkg, substitute PcdFrameworkCompatibilitySupport
with constant FALSE, and remove all code that becomes dead, including the
DepEx.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15302 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-04 09:03:31 +01:00
|
|
|
return Status;
|
|
|
|
}
|