summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2018-12-20 09:15:51 +0800
committerEric Dong <eric.dong@intel.com>2019-01-15 13:27:37 +0800
commiteb98fe2ae18d46a0f1c5bc35e79e3d429fadc9f5 (patch)
tree4be7e5fbfce157019710033c6ec44ed011c8aac2 /UefiCpuPkg
parent306a58365a89d9266d278c82e099f7052603ef54 (diff)
downloadedk2-eb98fe2ae18d46a0f1c5bc35e79e3d429fadc9f5.tar.gz
edk2-eb98fe2ae18d46a0f1c5bc35e79e3d429fadc9f5.tar.bz2
edk2-eb98fe2ae18d46a0f1c5bc35e79e3d429fadc9f5.zip
UefiCpuPkg/RegisterCpuFeaturesLib: Replace AcquireSpinLock.
In AcquireSpinLock function, it may call GetPerformanceCounter which final calls PeiService table. This code may also been used by AP but AP should not calls PeiService. This patch update code to avoid use AcquireSpinLock function. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1411 Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'UefiCpuPkg')
-rw-r--r--UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 269af052b1..bae92b89a6 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -1,7 +1,7 @@
/** @file
CPU Features Initialize functions.
- Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -841,7 +841,12 @@ ProgramProcessorRegister (
RegisterTableEntry = &RegisterTableEntryHead[Index];
DEBUG_CODE_BEGIN ();
- AcquireSpinLock (&CpuFlags->ConsoleLogLock);
+ //
+ // Wait for the AP to release the MSR spin lock.
+ //
+ while (!AcquireSpinLockOrFail (&CpuFlags->ConsoleLogLock)) {
+ CpuPause ();
+ }
ThreadIndex = ApLocation->Package * CpuStatus->MaxCoreCount * CpuStatus->MaxThreadCount +
ApLocation->Core * CpuStatus->MaxThreadCount +
ApLocation->Thread;