mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/CpuS3DataDxe: do not allocate useless register tables
CpuS3DataDxe allocates the "RegisterTable" and "PreSmmInitRegisterTable"
arrays in ACPI_CPU_DATA just so every processor in the system can have its
own empty register table, matched by APIC ID. This has never been useful
in practice.
Given commit e992cc3f48
("UefiCpuPkg PiSmmCpuDxeSmm: Reduce SMRAM
consumption in CpuS3.c", 2021-01-11), simply leave both
"AcpiCpuData->RegisterTable" and "AcpiCpuData->PreSmmInitRegisterTable"
initialized to the zero address. This simplifies the driver, and saves
both normal RAM (boot services data type memory) and -- in PiSmmCpuDxeSmm
-- SMRAM.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3159
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Message-Id: <20210119155440.2262-4-lersek@redhat.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
parent
1487c13ce0
commit
38ee7bafa7
|
@ -165,10 +165,6 @@ CpuS3DataInitialize (
|
||||||
UINTN NumberOfCpus;
|
UINTN NumberOfCpus;
|
||||||
UINTN NumberOfEnabledProcessors;
|
UINTN NumberOfEnabledProcessors;
|
||||||
VOID *Stack;
|
VOID *Stack;
|
||||||
UINTN TableSize;
|
|
||||||
CPU_REGISTER_TABLE *RegisterTable;
|
|
||||||
UINTN Index;
|
|
||||||
EFI_PROCESSOR_INFORMATION ProcessorInfoBuffer;
|
|
||||||
UINTN GdtSize;
|
UINTN GdtSize;
|
||||||
UINTN IdtSize;
|
UINTN IdtSize;
|
||||||
VOID *Gdt;
|
VOID *Gdt;
|
||||||
|
@ -255,34 +251,6 @@ CpuS3DataInitialize (
|
||||||
AcpiCpuData->PreSmmInitRegisterTable = OldAcpiCpuData->PreSmmInitRegisterTable;
|
AcpiCpuData->PreSmmInitRegisterTable = OldAcpiCpuData->PreSmmInitRegisterTable;
|
||||||
AcpiCpuData->ApLocation = OldAcpiCpuData->ApLocation;
|
AcpiCpuData->ApLocation = OldAcpiCpuData->ApLocation;
|
||||||
CopyMem (&AcpiCpuData->CpuStatus, &OldAcpiCpuData->CpuStatus, sizeof (CPU_STATUS_INFORMATION));
|
CopyMem (&AcpiCpuData->CpuStatus, &OldAcpiCpuData->CpuStatus, sizeof (CPU_STATUS_INFORMATION));
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable for all CPUs
|
|
||||||
//
|
|
||||||
TableSize = 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE);
|
|
||||||
RegisterTable = (CPU_REGISTER_TABLE *)AllocateZeroPages (TableSize);
|
|
||||||
ASSERT (RegisterTable != NULL);
|
|
||||||
|
|
||||||
for (Index = 0; Index < NumberOfCpus; Index++) {
|
|
||||||
Status = MpServices->GetProcessorInfo (
|
|
||||||
MpServices,
|
|
||||||
Index,
|
|
||||||
&ProcessorInfoBuffer
|
|
||||||
);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
RegisterTable[Index].InitialApicId = (UINT32)ProcessorInfoBuffer.ProcessorId;
|
|
||||||
RegisterTable[Index].TableLength = 0;
|
|
||||||
RegisterTable[Index].AllocatedSize = 0;
|
|
||||||
RegisterTable[Index].RegisterTableEntry = 0;
|
|
||||||
|
|
||||||
RegisterTable[NumberOfCpus + Index].InitialApicId = (UINT32)ProcessorInfoBuffer.ProcessorId;
|
|
||||||
RegisterTable[NumberOfCpus + Index].TableLength = 0;
|
|
||||||
RegisterTable[NumberOfCpus + Index].AllocatedSize = 0;
|
|
||||||
RegisterTable[NumberOfCpus + Index].RegisterTableEntry = 0;
|
|
||||||
}
|
|
||||||
AcpiCpuData->RegisterTable = (EFI_PHYSICAL_ADDRESS)(UINTN)RegisterTable;
|
|
||||||
AcpiCpuData->PreSmmInitRegisterTable = (EFI_PHYSICAL_ADDRESS)(UINTN)(RegisterTable + NumberOfCpus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue