diff options
author | Star Zeng <star.zeng@intel.com> | 2020-12-08 18:38:44 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-12-14 05:49:50 +0000 |
commit | 004f9776f47c4b8504bc9ce8dd584ad2d2017e23 (patch) | |
tree | 3e46fb495d9f4875650e9f7b07dd50e01b491ec0 /UefiCpuPkg | |
parent | 1f304300ffe64d47efc2f4d845da3081fd2b86a4 (diff) | |
download | edk2-004f9776f47c4b8504bc9ce8dd584ad2d2017e23.tar.gz edk2-004f9776f47c4b8504bc9ce8dd584ad2d2017e23.tar.bz2 edk2-004f9776f47c4b8504bc9ce8dd584ad2d2017e23.zip |
UefiCpuPkg RegisterCpuFeaturesLib: Use AllocatePages() for InitOrder
The required buffer size for InitOrder will be 96K when NumberOfCpus=1024.
sizeof (CPU_FEATURES_INIT_ORDER) = 96
NumberOfCpus = 1024 = 1K
sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus = 96K
AllocateZeroPool() will call to PeiServicesAllocatePool() which will use
EFI_HOB_MEMORY_POOL to management memory pool.
EFI_HOB_MEMORY_POOL.Header.HobLength is UINT16 type, so there is no way
for AllocateZeroPool() to allocate > 64K memory.
So AllocateZeroPool() could not be used anymore for the case above or
even bigger required buffer size.
This patch updates the code to use AllocatePages() instead of
AllocateZeroPool() to allocate buffer for InitOrder.
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'UefiCpuPkg')
-rw-r--r-- | UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c index d4a576385f..ba052732a8 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c @@ -126,8 +126,9 @@ CpuInitDataInitialize ( GetNumberOfProcessor (&NumberOfCpus, &NumberOfEnabledProcessors);
- CpuFeaturesData->InitOrder = AllocateZeroPool (sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus);
+ CpuFeaturesData->InitOrder = AllocatePages (EFI_SIZE_TO_PAGES (sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus));
ASSERT (CpuFeaturesData->InitOrder != NULL);
+ ZeroMem (CpuFeaturesData->InitOrder, sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus);
//
// Collect CPU Features information
|