]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
UefiCpuPkg/CpuS3DataDxe: Move StartupVector allocation to EndOfDxe()
[mirror_edk2.git] / UefiCpuPkg / CpuS3DataDxe / CpuS3Data.c
index 9fb47dc5289d189879b64b87ce4a806dd8e10107..7bd928f33063536ddf89644f2dd7eff05819d770 100644 (file)
@@ -9,7 +9,7 @@ number of CPUs reported by the MP Services Protocol, so this module does not
 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 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>\r
 Copyright (c) 2015, Red Hat, Inc.\r
 \r
 This program and the accompanying materials\r
@@ -84,20 +84,36 @@ AllocateAcpiNvsMemoryBelow4G (
 /**\r
   Callback function executed when the EndOfDxe event group is signaled.\r
 \r
-  We delay saving the MTRR settings until BDS signals EndOfDxe.\r
+  We delay allocating StartupVector and saving the MTRR settings until BDS signals EndOfDxe.\r
 \r
   @param[in]  Event    Event whose notification function is being invoked.\r
   @param[out] Context  Pointer to the MTRR_SETTINGS buffer to fill in.\r
 **/\r
 VOID\r
 EFIAPI\r
-SaveMtrrsOnEndOfDxe (\r
+CpuS3DataOnEndOfDxe (\r
   IN  EFI_EVENT  Event,\r
   OUT VOID       *Context\r
   )\r
 {\r
+  EFI_STATUS         Status;\r
+  ACPI_CPU_DATA_EX   *AcpiCpuDataEx;\r
+\r
+  AcpiCpuDataEx = (ACPI_CPU_DATA_EX *) Context;\r
+  //\r
+  // Allocate a 4KB reserved page below 1MB\r
+  //\r
+  AcpiCpuDataEx->AcpiCpuData.StartupVector = BASE_1MB - 1;\r
+  Status = gBS->AllocatePages (\r
+                  AllocateMaxAddress,\r
+                  EfiReservedMemoryType,\r
+                  1,\r
+                  &AcpiCpuDataEx->AcpiCpuData.StartupVector\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
   DEBUG ((EFI_D_VERBOSE, "%a\n", __FUNCTION__));\r
-  MtrrGetAllMtrrs (Context);\r
+  MtrrGetAllMtrrs (&AcpiCpuDataEx->MtrrTable);\r
 \r
   //\r
   // Close event, so it will not be invoked again.\r
@@ -161,18 +177,6 @@ CpuS3DataInitialize (
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  //\r
-  // Allocate a 4KB reserved page below 1MB\r
-  //\r
-  AcpiCpuData->StartupVector = BASE_1MB - 1;\r
-  Status = gBS->AllocatePages (\r
-                  AllocateMaxAddress,\r
-                  EfiReservedMemoryType,\r
-                  1,\r
-                  &AcpiCpuData->StartupVector\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
   //\r
   // Get the number of CPUs\r
   //\r
@@ -255,13 +259,13 @@ CpuS3DataInitialize (
 \r
   //\r
   // Register EFI_END_OF_DXE_EVENT_GROUP_GUID event.\r
-  // The notification function saves MTRRs for ACPI_CPU_DATA\r
+  // The notification function allocates StartupVector and saves MTRRs for ACPI_CPU_DATA\r
   //\r
   Status = gBS->CreateEventEx (\r
                   EVT_NOTIFY_SIGNAL,\r
                   TPL_CALLBACK,\r
-                  SaveMtrrsOnEndOfDxe,\r
-                  &AcpiCpuDataEx->MtrrTable,\r
+                  CpuS3DataOnEndOfDxe,\r
+                  AcpiCpuData,\r
                   &gEfiEndOfDxeEventGroupGuid,\r
                   &Event\r
                   );\r