UefiCpuPkg/MpInitLib: Implementation of MpInitLibSwitchBSP()
v4: 1. Simply the internal function SwitchBSPWorker()'s comment header due to it is duplicated with MpInitLibSwitchBSP(). v3: 1. Rename MpInitLibSwitchBsp to MpInitLibSwitchBSP. Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Michael Kinney <michael.d.kinney@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Michael Kinney <michael.d.kinney@intel.com>
This commit is contained in:
@ -389,7 +389,31 @@ MpInitLibSwitchBSP (
|
||||
IN BOOLEAN EnableOldBSP
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN OldInterruptState;
|
||||
|
||||
//
|
||||
// Before send both BSP and AP to a procedure to exchange their roles,
|
||||
// interrupt must be disabled. This is because during the exchange role
|
||||
// process, 2 CPU may use 1 stack. If interrupt happens, the stack will
|
||||
// be corrupted, since interrupt return address will be pushed to stack
|
||||
// by hardware.
|
||||
//
|
||||
OldInterruptState = SaveAndDisableInterrupts ();
|
||||
|
||||
//
|
||||
// Mask LINT0 & LINT1 for the old BSP
|
||||
//
|
||||
DisableLvtInterrupts ();
|
||||
|
||||
Status = SwitchBSPWorker (ProcessorNumber, EnableOldBSP);
|
||||
|
||||
//
|
||||
// Restore interrupt state.
|
||||
//
|
||||
SetInterruptState (OldInterruptState);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user