support hot plug CPUs. This module can be copied into a CPU specific package\r
and customized if these additional features are required.\r
\r
-Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.<BR>\r
Copyright (c) 2015, Red Hat, Inc.\r
\r
This program and the accompanying materials\r
VOID *Gdt;\r
VOID *Idt;\r
EFI_EVENT Event;\r
+ ACPI_CPU_DATA *OldAcpiCpuData;\r
\r
if (!PcdGetBool (PcdAcpiS3Enable)) {\r
return EFI_UNSUPPORTED;\r
}\r
\r
+ //\r
+ // Set PcdCpuS3DataAddress to the base address of the ACPI_CPU_DATA structure\r
+ //\r
+ OldAcpiCpuData = (ACPI_CPU_DATA *) (UINTN) PcdGet64 (PcdCpuS3DataAddress);\r
+\r
//\r
// Allocate ACPI NVS memory below 4G memory for use on ACPI S3 resume.\r
//\r
AcpiCpuDataEx->GdtrProfile.Base = (UINTN)Gdt;\r
AcpiCpuDataEx->IdtrProfile.Base = (UINTN)Idt;\r
\r
- //\r
- // Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable for all CPUs\r
- //\r
- TableSize = 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE);\r
- RegisterTable = (CPU_REGISTER_TABLE *)AllocateAcpiNvsMemoryBelow4G (TableSize);\r
- ASSERT (RegisterTable != NULL);\r
- for (Index = 0; Index < NumberOfCpus; Index++) {\r
- Status = MpServices->GetProcessorInfo (\r
+ if (OldAcpiCpuData != NULL) {\r
+ AcpiCpuData->RegisterTable = OldAcpiCpuData->RegisterTable;\r
+ AcpiCpuData->PreSmmInitRegisterTable = OldAcpiCpuData->PreSmmInitRegisterTable;\r
+ } else {\r
+ //\r
+ // Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable for all CPUs\r
+ //\r
+ TableSize = 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE);\r
+ RegisterTable = (CPU_REGISTER_TABLE *)AllocateAcpiNvsMemoryBelow4G (TableSize);\r
+ ASSERT (RegisterTable != NULL);\r
+\r
+ for (Index = 0; Index < NumberOfCpus; Index++) {\r
+ Status = MpServices->GetProcessorInfo (\r
MpServices,\r
Index,\r
&ProcessorInfoBuffer\r
);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- RegisterTable[Index].InitialApicId = (UINT32)ProcessorInfoBuffer.ProcessorId;\r
- RegisterTable[Index].TableLength = 0;\r
- RegisterTable[Index].AllocatedSize = 0;\r
- RegisterTable[Index].RegisterTableEntry = NULL;\r
-\r
- RegisterTable[NumberOfCpus + Index].InitialApicId = (UINT32)ProcessorInfoBuffer.ProcessorId;\r
- RegisterTable[NumberOfCpus + Index].TableLength = 0;\r
- RegisterTable[NumberOfCpus + Index].AllocatedSize = 0;\r
- RegisterTable[NumberOfCpus + Index].RegisterTableEntry = NULL;\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ RegisterTable[Index].InitialApicId = (UINT32)ProcessorInfoBuffer.ProcessorId;\r
+ RegisterTable[Index].TableLength = 0;\r
+ RegisterTable[Index].AllocatedSize = 0;\r
+ RegisterTable[Index].RegisterTableEntry = 0;\r
+\r
+ RegisterTable[NumberOfCpus + Index].InitialApicId = (UINT32)ProcessorInfoBuffer.ProcessorId;\r
+ RegisterTable[NumberOfCpus + Index].TableLength = 0;\r
+ RegisterTable[NumberOfCpus + Index].AllocatedSize = 0;\r
+ RegisterTable[NumberOfCpus + Index].RegisterTableEntry = 0;\r
+ }\r
+ AcpiCpuData->RegisterTable = (EFI_PHYSICAL_ADDRESS)(UINTN)RegisterTable;\r
+ AcpiCpuData->PreSmmInitRegisterTable = (EFI_PHYSICAL_ADDRESS)(UINTN)(RegisterTable + NumberOfCpus);\r
}\r
- AcpiCpuData->RegisterTable = (EFI_PHYSICAL_ADDRESS)(UINTN)RegisterTable;\r
- AcpiCpuData->PreSmmInitRegisterTable = (EFI_PHYSICAL_ADDRESS)(UINTN)(RegisterTable + NumberOfCpus);\r
\r
//\r
// Set PcdCpuS3DataAddress to the base address of the ACPI_CPU_DATA structure\r