mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/CpuS3DataDxe: Consume the existing PcdCpuS3DataAddress
If PCD PcdCpuS3DataAddress is set before, CpuS3DataDxe should get RegisterTable and PreSmmRegisterTable from existing PCD pointed buffer and needn't to allocate new buffer for RegisterTable and PreSmmRegisterTable. Cc: Feng Tian <feng.tian@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
This commit is contained in:
parent
9cc45009ba
commit
8b371e93f2
|
@ -160,11 +160,17 @@ CpuS3DataInitialize (
|
||||||
VOID *Gdt;
|
VOID *Gdt;
|
||||||
VOID *Idt;
|
VOID *Idt;
|
||||||
EFI_EVENT Event;
|
EFI_EVENT Event;
|
||||||
|
ACPI_CPU_DATA *OldAcpiCpuData;
|
||||||
|
|
||||||
if (!PcdGetBool (PcdAcpiS3Enable)) {
|
if (!PcdGetBool (PcdAcpiS3Enable)) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set PcdCpuS3DataAddress to the base address of the ACPI_CPU_DATA structure
|
||||||
|
//
|
||||||
|
OldAcpiCpuData = (ACPI_CPU_DATA *) (UINTN) PcdGet64 (PcdCpuS3DataAddress);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate ACPI NVS memory below 4G memory for use on ACPI S3 resume.
|
// Allocate ACPI NVS memory below 4G memory for use on ACPI S3 resume.
|
||||||
//
|
//
|
||||||
|
@ -229,12 +235,17 @@ CpuS3DataInitialize (
|
||||||
AcpiCpuDataEx->GdtrProfile.Base = (UINTN)Gdt;
|
AcpiCpuDataEx->GdtrProfile.Base = (UINTN)Gdt;
|
||||||
AcpiCpuDataEx->IdtrProfile.Base = (UINTN)Idt;
|
AcpiCpuDataEx->IdtrProfile.Base = (UINTN)Idt;
|
||||||
|
|
||||||
|
if (OldAcpiCpuData != NULL) {
|
||||||
|
AcpiCpuData->RegisterTable = OldAcpiCpuData->RegisterTable;
|
||||||
|
AcpiCpuData->PreSmmInitRegisterTable = OldAcpiCpuData->PreSmmInitRegisterTable;
|
||||||
|
} else {
|
||||||
//
|
//
|
||||||
// Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable for all CPUs
|
// Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable for all CPUs
|
||||||
//
|
//
|
||||||
TableSize = 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE);
|
TableSize = 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE);
|
||||||
RegisterTable = (CPU_REGISTER_TABLE *)AllocateAcpiNvsMemoryBelow4G (TableSize);
|
RegisterTable = (CPU_REGISTER_TABLE *)AllocateAcpiNvsMemoryBelow4G (TableSize);
|
||||||
ASSERT (RegisterTable != NULL);
|
ASSERT (RegisterTable != NULL);
|
||||||
|
|
||||||
for (Index = 0; Index < NumberOfCpus; Index++) {
|
for (Index = 0; Index < NumberOfCpus; Index++) {
|
||||||
Status = MpServices->GetProcessorInfo (
|
Status = MpServices->GetProcessorInfo (
|
||||||
MpServices,
|
MpServices,
|
||||||
|
@ -255,6 +266,7 @@ CpuS3DataInitialize (
|
||||||
}
|
}
|
||||||
AcpiCpuData->RegisterTable = (EFI_PHYSICAL_ADDRESS)(UINTN)RegisterTable;
|
AcpiCpuData->RegisterTable = (EFI_PHYSICAL_ADDRESS)(UINTN)RegisterTable;
|
||||||
AcpiCpuData->PreSmmInitRegisterTable = (EFI_PHYSICAL_ADDRESS)(UINTN)(RegisterTable + NumberOfCpus);
|
AcpiCpuData->PreSmmInitRegisterTable = (EFI_PHYSICAL_ADDRESS)(UINTN)(RegisterTable + NumberOfCpus);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set PcdCpuS3DataAddress to the base address of the ACPI_CPU_DATA structure
|
// Set PcdCpuS3DataAddress to the base address of the ACPI_CPU_DATA structure
|
||||||
|
|
Loading…
Reference in New Issue