diff options
author | Jeff Fan <jeff.fan@intel.com> | 2017-05-24 13:53:30 +0800 |
---|---|---|
committer | Guo Mang <mang.guo@intel.com> | 2017-07-12 11:24:50 +0800 |
commit | c6e834536eeb0fadb3f063e696716ac07150b49e (patch) | |
tree | 6d65c01e0d08730eacd725d35cd2484547534e7b /Core/UefiCpuPkg/Library/MpInitLib/MpLib.c | |
parent | cd13f226532a2783557707852f59b22f2179a75b (diff) | |
download | edk2-platforms-c6e834536eeb0fadb3f063e696716ac07150b49e.tar.xz |
UefiCpuPkg/MpInitLib: Check APIC mode change around AP function
If APIC ID values are changed during AP functions execution, we need to update
new APIC ID values in local data structure accordingly.
But if APIC mode change happened during AP function execution, we do not support
APIC ID value changed.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit c6b0feb39637867744bb7bffaa8534ecb1de707d)
Diffstat (limited to 'Core/UefiCpuPkg/Library/MpInitLib/MpLib.c')
-rw-r--r-- | Core/UefiCpuPkg/Library/MpInitLib/MpLib.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Core/UefiCpuPkg/Library/MpInitLib/MpLib.c b/Core/UefiCpuPkg/Library/MpInitLib/MpLib.c index 735e099b32..c6f81914d2 100644 --- a/Core/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/Core/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -547,6 +547,7 @@ ApWakeupFunction ( volatile UINT32 *ApStartupSignalBuffer;
CPU_INFO_IN_HOB *CpuInfoInHob;
UINT64 ApTopOfStack;
+ UINTN CurrentApicMode;
//
// AP finished assembly code and begin to execute C code
@@ -560,6 +561,7 @@ ApWakeupFunction ( ProgramVirtualWireMode ();
SyncLocalApicTimerSetting (CpuMpData);
+ CurrentApicMode = GetApicMode ();
while (TRUE) {
if (CpuMpData->InitFlag == ApInitConfig) {
//
@@ -627,11 +629,23 @@ ApWakeupFunction ( ApStartupSignalBuffer = CpuMpData->CpuData[ProcessorNumber].StartupApSignal;
CpuInfoInHob[ProcessorNumber].ApTopOfStack = CpuInfoInHob[CpuMpData->NewBspNumber].ApTopOfStack;
} else {
- //
- // Re-get the CPU APICID and Initial APICID
- //
- CpuInfoInHob[ProcessorNumber].ApicId = GetApicId ();
- CpuInfoInHob[ProcessorNumber].InitialApicId = GetInitialApicId ();
+ if (CpuInfoInHob[ProcessorNumber].ApicId != GetApicId () ||
+ CpuInfoInHob[ProcessorNumber].InitialApicId != GetInitialApicId ()) {
+ if (CurrentApicMode != GetApicMode ()) {
+ //
+ // If APIC mode change happened during AP function execution,
+ // we do not support APIC ID value changed.
+ //
+ ASSERT (FALSE);
+ CpuDeadLoop ();
+ } else {
+ //
+ // Re-get the CPU APICID and Initial APICID if they are changed
+ //
+ CpuInfoInHob[ProcessorNumber].ApicId = GetApicId ();
+ CpuInfoInHob[ProcessorNumber].InitialApicId = GetInitialApicId ();
+ }
+ }
}
}
SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateFinished);
|