diff options
author | Siyuan Fu <siyuan.fu@intel.com> | 2020-01-03 15:11:51 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-01-08 00:47:43 +0000 |
commit | 08a475df10b75f84cdeb9b11e38f8eee9b5c048d (patch) | |
tree | eb015ab0633acc483d0e81ced8563af4ee2a3564 /UefiCpuPkg/Library/MpInitLib/Microcode.c | |
parent | 70911f1f4aee0366b6122f2b90d367ec0f066beb (diff) | |
download | edk2-08a475df10b75f84cdeb9b11e38f8eee9b5c048d.tar.gz edk2-08a475df10b75f84cdeb9b11e38f8eee9b5c048d.tar.bz2 edk2-08a475df10b75f84cdeb9b11e38f8eee9b5c048d.zip |
UefiCpuPkg: Remove alignment check when calculate microcode size.
This patch removes the unnecessary alignment check on microcode patch
TotalSize introduced by commit d786a172. The TotalSize has already been
checked with 1K alignment and MAX_ADDRESS in previous code as below:
if ( (UINTN)MicrocodeEntryPoint > (MAX_ADDRESS - TotalSize) ||
((UINTN)MicrocodeEntryPoint + TotalSize) > MicrocodeEnd ||
(DataSize & 0x3) != 0 ||
(TotalSize & (SIZE_1KB - 1)) != 0 ||
TotalSize < DataSize
) {
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Diffstat (limited to 'UefiCpuPkg/Library/MpInitLib/Microcode.c')
-rw-r--r-- | UefiCpuPkg/Library/MpInitLib/Microcode.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/Microcode.c b/UefiCpuPkg/Library/MpInitLib/Microcode.c index 3da5bfb9cf..a9d06dd409 100644 --- a/UefiCpuPkg/Library/MpInitLib/Microcode.c +++ b/UefiCpuPkg/Library/MpInitLib/Microcode.c @@ -1,7 +1,7 @@ /** @file
Implementation of loading microcode on processors.
- Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -397,16 +397,7 @@ LoadMicrocodePatchWorker ( Patches[Index].Size
);
- //
- // Zero-fill the padding area
- // Please note that AlignedSize will be no less than Size
- //
- ZeroMem (
- Walker + Patches[Index].Size,
- Patches[Index].AlignedSize - Patches[Index].Size
- );
-
- Walker += Patches[Index].AlignedSize;
+ Walker += Patches[Index].Size;
}
//
@@ -578,14 +569,9 @@ LoadMicrocodePatch ( //
// Store the information of this microcode patch
//
- if (TotalSize > ALIGN_VALUE (TotalSize, SIZE_1KB) ||
- ALIGN_VALUE (TotalSize, SIZE_1KB) > MAX_UINTN - TotalLoadSize) {
- goto OnExit;
- }
- PatchInfoBuffer[PatchCount - 1].Address = (UINTN) MicrocodeEntryPoint;
- PatchInfoBuffer[PatchCount - 1].Size = TotalSize;
- PatchInfoBuffer[PatchCount - 1].AlignedSize = ALIGN_VALUE (TotalSize, SIZE_1KB);
- TotalLoadSize += PatchInfoBuffer[PatchCount - 1].AlignedSize;
+ PatchInfoBuffer[PatchCount - 1].Address = (UINTN) MicrocodeEntryPoint;
+ PatchInfoBuffer[PatchCount - 1].Size = TotalSize;
+ TotalLoadSize += TotalSize;
}
//
|