Reviewed-by: Giri P Mudusuru <giri.p.mudus...@intel.com> > -----Original Message----- > From: Fan, Jeff > Sent: Thursday, July 21, 2016 8:14 PM > To: edk2-devel@lists.01.org > Cc: Kinney, Michael D <michael.d.kin...@intel.com>; Tian, Feng > <feng.t...@intel.com>; Mudusuru, Giri P <giri.p.mudus...@intel.com>; Laszlo > Ersek <ler...@redhat.com> > Subject: [Patch v2 03/40] UefiCpuPkg/CpuS3DataDxe: Move StartupVector > allocation to EndOfDxe() > > Currently, we will allocate StartupVector buffer under 1MB at entry point > function. But some modules may allocate some hard code address under 1MB. > For example, LegacyBiosDxe driver tries to manage some legacy range under > 640KB. > > To avoid the conflicts, we move StartupVector buffer allocation to End Of > DXE event callback function. > > Cc: Michael Kinney <michael.d.kin...@intel.com> > Cc: Feng Tian <feng.t...@intel.com> > Cc: Giri P Mudusuru <giri.p.mudus...@intel.com> > Cc: Laszlo Ersek <ler...@redhat.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jeff Fan <jeff....@intel.com> > --- > UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c | 39 ++++++++++++++++++---------- > ---- > UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf | 2 +- > 2 files changed, 23 insertions(+), 18 deletions(-) > > diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c > b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c > index 9fb47dc..9e76cae 100644 > --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c > +++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c > @@ -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 > and customized if these additional features are required. > > -Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> > +Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR> > Copyright (c) 2015, Red Hat, Inc. > > This program and the accompanying materials > @@ -45,6 +45,8 @@ typedef struct { > IA32_DESCRIPTOR IdtrProfile; > } ACPI_CPU_DATA_EX; > > +ACPI_CPU_DATA *mAcpiCpuData; > + > /** > Allocate EfiACPIMemoryNVS below 4G memory address. > > @@ -84,18 +86,31 @@ AllocateAcpiNvsMemoryBelow4G ( > /** > Callback function executed when the EndOfDxe event group is signaled. > > - We delay saving the MTRR settings until BDS signals EndOfDxe. > + We delay allocating StartupVector and saving the MTRR settings until BDS > signals EndOfDxe. > > @param[in] Event Event whose notification function is being invoked. > @param[out] Context Pointer to the MTRR_SETTINGS buffer to fill in. > **/ > VOID > EFIAPI > -SaveMtrrsOnEndOfDxe ( > +CpuS3DataOnEndOfDxe ( > IN EFI_EVENT Event, > OUT VOID *Context > ) > { > + EFI_STATUS Status; > + // > + // Allocate a 4KB reserved page below 1MB > + // > + mAcpiCpuData->StartupVector = BASE_1MB - 1; > + Status = gBS->AllocatePages ( > + AllocateMaxAddress, > + EfiReservedMemoryType, > + 1, > + &mAcpiCpuData->StartupVector > + ); > + ASSERT_EFI_ERROR (Status); > + > DEBUG ((EFI_D_VERBOSE, "%a\n", __FUNCTION__)); > MtrrGetAllMtrrs (Context); > > @@ -162,18 +177,6 @@ CpuS3DataInitialize ( > ASSERT_EFI_ERROR (Status); > > // > - // Allocate a 4KB reserved page below 1MB > - // > - AcpiCpuData->StartupVector = BASE_1MB - 1; > - Status = gBS->AllocatePages ( > - AllocateMaxAddress, > - EfiReservedMemoryType, > - 1, > - &AcpiCpuData->StartupVector > - ); > - ASSERT_EFI_ERROR (Status); > - > - // > // Get the number of CPUs > // > Status = MpServices->GetNumberOfProcessors ( > @@ -255,17 +258,19 @@ CpuS3DataInitialize ( > > // > // Register EFI_END_OF_DXE_EVENT_GROUP_GUID event. > - // The notification function saves MTRRs for ACPI_CPU_DATA > + // The notification function allocates StartupVector and saves MTRRs for > ACPI_CPU_DATA > // > Status = gBS->CreateEventEx ( > EVT_NOTIFY_SIGNAL, > TPL_CALLBACK, > - SaveMtrrsOnEndOfDxe, > + CpuS3DataOnEndOfDxe, > &AcpiCpuDataEx->MtrrTable, > &gEfiEndOfDxeEventGroupGuid, > &Event > ); > ASSERT_EFI_ERROR (Status); > > + mAcpiCpuData = AcpiCpuData; > + > return EFI_SUCCESS; > } > diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf > b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf > index 857e12b..608e19f 100644 > --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf > +++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf > @@ -9,7 +9,7 @@ > # support hot plug CPUs. This module can be copied into a CPU specific > package > # and customized if these additional features are required. > # > -# Copyright (c) 2013-2015, Intel Corporation. All rights reserved.<BR> > +# Copyright (c) 2013-2016, Intel Corporation. All rights reserved.<BR> > # Copyright (c) 2015, Red Hat, Inc. > # > # This program and the accompanying materials > -- > 2.7.4.windows.1
_______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel