mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/PiSmmCpuDxeSmm: TransferApToSafeState() use UINTN params
Update TransferApToSafeState() use UINTN params to reduce the number of type casts required in these calls. Also change the NumberToFinish parameter from UINT32* to UINTN NumberToFinishAddress to resolve issues with conversion from a volatile pointer to a non-volatile pointer. The assembly code that receives the NumberToFinishAddress value must treat that memory location as a volatile to track the number of APs. Cc: Liming Gao <liming.gao@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Andrew Fish <afish@apple.com> Cc: Jeff Fan <jeff.fan@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com>
This commit is contained in:
parent
0468303899
commit
672b80c8b7
|
@ -385,7 +385,7 @@ MPRendezvousProcedure (
|
||||||
CPU_REGISTER_TABLE *RegisterTableList;
|
CPU_REGISTER_TABLE *RegisterTableList;
|
||||||
UINT32 InitApicId;
|
UINT32 InitApicId;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
UINT32 TopOfStack;
|
UINTN TopOfStack;
|
||||||
UINT8 Stack[128];
|
UINT8 Stack[128];
|
||||||
|
|
||||||
ProgramVirtualWireMode ();
|
ProgramVirtualWireMode ();
|
||||||
|
@ -403,10 +403,10 @@ MPRendezvousProcedure (
|
||||||
//
|
//
|
||||||
// Place AP into the safe code, count down the number with lock mechanism in the safe code.
|
// Place AP into the safe code, count down the number with lock mechanism in the safe code.
|
||||||
//
|
//
|
||||||
TopOfStack = (UINT32) (UINTN) Stack + sizeof (Stack);
|
TopOfStack = (UINTN) Stack + sizeof (Stack);
|
||||||
TopOfStack &= ~(UINT32) (CPU_STACK_ALIGNMENT - 1);
|
TopOfStack &= ~(UINTN) (CPU_STACK_ALIGNMENT - 1);
|
||||||
CopyMem ((VOID *) (UINTN) mApHltLoopCode, mApHltLoopCodeTemplate, sizeof (mApHltLoopCodeTemplate));
|
CopyMem ((VOID *) (UINTN) mApHltLoopCode, mApHltLoopCodeTemplate, sizeof (mApHltLoopCodeTemplate));
|
||||||
TransferApToSafeState ((UINT32) (UINTN) mApHltLoopCode, TopOfStack, &mNumberToFinish);
|
TransferApToSafeState ((UINTN)mApHltLoopCode, TopOfStack, (UINTN)&mNumberToFinish);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -129,23 +129,23 @@ InitGdt (
|
||||||
/**
|
/**
|
||||||
Transfer AP to safe hlt-loop after it finished restore CPU features on S3 patch.
|
Transfer AP to safe hlt-loop after it finished restore CPU features on S3 patch.
|
||||||
|
|
||||||
@param[in] ApHltLoopCode The 32-bit address of the safe hlt-loop function.
|
@param[in] ApHltLoopCode The address of the safe hlt-loop function.
|
||||||
@param[in] TopOfStack A pointer to the new stack to use for the ApHltLoopCode.
|
@param[in] TopOfStack A pointer to the new stack to use for the ApHltLoopCode.
|
||||||
@param[in] NumberToFinish Semaphore of APs finish count.
|
@param[in] NumberToFinishAddress Address of Semaphore of APs finish count.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
TransferApToSafeState (
|
TransferApToSafeState (
|
||||||
IN UINT32 ApHltLoopCode,
|
IN UINTN ApHltLoopCode,
|
||||||
IN UINT32 TopOfStack,
|
IN UINTN TopOfStack,
|
||||||
IN UINT32 *NumberToFinish
|
IN UINTN NumberToFinishAddress
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
SwitchStack (
|
SwitchStack (
|
||||||
(SWITCH_STACK_ENTRY_POINT) (UINTN) ApHltLoopCode,
|
(SWITCH_STACK_ENTRY_POINT)ApHltLoopCode,
|
||||||
NumberToFinish,
|
(VOID *)NumberToFinishAddress,
|
||||||
NULL,
|
NULL,
|
||||||
(VOID *) (UINTN) TopOfStack
|
(VOID *)TopOfStack
|
||||||
);
|
);
|
||||||
//
|
//
|
||||||
// It should never reach here
|
// It should never reach here
|
||||||
|
|
|
@ -974,16 +974,16 @@ GetAcpiS3EnableFlag (
|
||||||
/**
|
/**
|
||||||
Transfer AP to safe hlt-loop after it finished restore CPU features on S3 patch.
|
Transfer AP to safe hlt-loop after it finished restore CPU features on S3 patch.
|
||||||
|
|
||||||
@param[in] ApHltLoopCode The 32-bit address of the safe hlt-loop function.
|
@param[in] ApHltLoopCode The address of the safe hlt-loop function.
|
||||||
@param[in] TopOfStack A pointer to the new stack to use for the ApHltLoopCode.
|
@param[in] TopOfStack A pointer to the new stack to use for the ApHltLoopCode.
|
||||||
@param[in] NumberToFinish Semaphore of APs finish count.
|
@param[in] NumberToFinishAddress Address of Semaphore of APs finish count.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
TransferApToSafeState (
|
TransferApToSafeState (
|
||||||
IN UINT32 ApHltLoopCode,
|
IN UINTN ApHltLoopCode,
|
||||||
IN UINT32 TopOfStack,
|
IN UINTN TopOfStack,
|
||||||
IN UINT32 *NumberToFinish
|
IN UINTN NumberToFinishAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -129,24 +129,24 @@ GetProtectedModeCS (
|
||||||
/**
|
/**
|
||||||
Transfer AP to safe hlt-loop after it finished restore CPU features on S3 patch.
|
Transfer AP to safe hlt-loop after it finished restore CPU features on S3 patch.
|
||||||
|
|
||||||
@param[in] ApHltLoopCode The 32-bit address of the safe hlt-loop function.
|
@param[in] ApHltLoopCode The address of the safe hlt-loop function.
|
||||||
@param[in] TopOfStack A pointer to the new stack to use for the ApHltLoopCode.
|
@param[in] TopOfStack A pointer to the new stack to use for the ApHltLoopCode.
|
||||||
@param[in] NumberToFinish Semaphore of APs finish count.
|
@param[in] NumberToFinishAddress Address of Semaphore of APs finish count.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
TransferApToSafeState (
|
TransferApToSafeState (
|
||||||
IN UINT32 ApHltLoopCode,
|
IN UINTN ApHltLoopCode,
|
||||||
IN UINT32 TopOfStack,
|
IN UINTN TopOfStack,
|
||||||
IN UINT32 *NumberToFinish
|
IN UINTN NumberToFinishAddress
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
AsmDisablePaging64 (
|
AsmDisablePaging64 (
|
||||||
GetProtectedModeCS (),
|
GetProtectedModeCS (),
|
||||||
(UINT32) (UINTN) ApHltLoopCode,
|
(UINT32)ApHltLoopCode,
|
||||||
(UINT32) (UINTN) NumberToFinish,
|
(UINT32)NumberToFinishAddress,
|
||||||
0,
|
0,
|
||||||
TopOfStack
|
(UINT32)TopOfStack
|
||||||
);
|
);
|
||||||
//
|
//
|
||||||
// It should never reach here
|
// It should never reach here
|
||||||
|
|
Loading…
Reference in New Issue