97 IN OUT volatile UINT32 *Sem
104 if (Value == MAX_UINT32) {
140 IN OUT volatile UINT32 *Sem
147 }
while (Value + 1 != 0 &&
154 if (Value == MAX_UINT32) {
175 IN OUT volatile UINT32 *Sem
213 RETURN_STATUS Status;
222 ASSERT (Context !=
NULL);
241 if (*Context ==
NULL) {
245 (*Context)->ArrivedCpuCountUponLock = 0;
250 (*Context)->NumberOfCpus = NumberOfCpus;
272 (*Context)->SemBuffer =
AllocatePages ((*Context)->SemBufferPages);
273 if ((*Context)->SemBuffer ==
NULL) {
281 SemAddr = (
UINTN)(*Context)->SemBuffer;
283 *(*Context)->CpuCount = 0;
285 SemAddr += OneSemSize;
290 CpuSem = (*Context)->CpuSem;
291 for (CpuIndex = 0; CpuIndex < NumberOfCpus; CpuIndex++) {
296 SemAddr += OneSemSize;
321 ASSERT (Context !=
NULL);
323 FreePages (Context->SemBuffer, Context->SemBufferPages);
345 ASSERT (Context !=
NULL);
347 Context->ArrivedCpuCountUponLock = 0;
348 *Context->CpuCount = 0;
372 ASSERT (Context !=
NULL);
374 Value = *Context->CpuCount;
376 if (Value == (UINT32)-1) {
377 return Context->ArrivedCpuCountUponLock;
405 ASSERT (Context !=
NULL);
407 ASSERT (CpuIndex < Context->NumberOfCpus);
442 ASSERT (Context !=
NULL);
444 ASSERT (CpuIndex < Context->NumberOfCpus);
478 ASSERT (Context !=
NULL);
480 ASSERT (CpuCount !=
NULL);
482 ASSERT (CpuIndex < Context->NumberOfCpus);
489 Context->ArrivedCpuCountUponLock = *Context->CpuCount;
499 Context->ArrivedCpuCountUponLock = *CpuCount;
533 ASSERT (Context !=
NULL);
535 ASSERT (NumberOfAPs < Context->NumberOfCpus);
537 ASSERT (BspIndex < Context->NumberOfCpus);
539 for (Arrived = 0; Arrived < NumberOfAPs; Arrived++) {
568 ASSERT (Context !=
NULL);
570 ASSERT (BspIndex != CpuIndex);
572 ASSERT (CpuIndex < Context->NumberOfCpus);
574 ASSERT (BspIndex < Context->NumberOfCpus);
608 ASSERT (Context !=
NULL);
610 ASSERT (BspIndex != CpuIndex);
612 ASSERT (CpuIndex < Context->NumberOfCpus);
614 ASSERT (BspIndex < Context->NumberOfCpus);
643 ASSERT (Context !=
NULL);
645 ASSERT (BspIndex != CpuIndex);
647 ASSERT (CpuIndex < Context->NumberOfCpus);
649 ASSERT (BspIndex < Context->NumberOfCpus);
VOID EFIAPI CpuPause(VOID)
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define RETURN_ERROR(StatusCode)
#define RETURN_OUT_OF_RESOURCES
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
VOID *EFIAPI AllocatePages(IN UINTN Pages)
RETURN_STATUS EFIAPI SafeUintnAdd(IN UINTN Augend, IN UINTN Addend, OUT UINTN *Result)
RETURN_STATUS EFIAPI SafeUintnMult(IN UINTN Multiplicand, IN UINTN Multiplier, OUT UINTN *Result)
VOID EFIAPI SmmCpuSyncWaitForBsp(IN OUT SMM_CPU_SYNC_CONTEXT *Context, IN UINTN CpuIndex, IN UINTN BspIndex)
RETURN_STATUS EFIAPI SmmCpuSyncCheckOutCpu(IN OUT SMM_CPU_SYNC_CONTEXT *Context, IN UINTN CpuIndex)
STATIC UINT32 InternalLockdownSemaphore(IN OUT volatile UINT32 *Sem)
VOID EFIAPI SmmCpuSyncContextDeinit(IN OUT SMM_CPU_SYNC_CONTEXT *Context)
volatile UINT32 SMM_CPU_SYNC_SEMAPHORE
VOID EFIAPI SmmCpuSyncContextReset(IN OUT SMM_CPU_SYNC_CONTEXT *Context)
VOID EFIAPI SmmCpuSyncWaitForAPs(IN OUT SMM_CPU_SYNC_CONTEXT *Context, IN UINTN NumberOfAPs, IN UINTN BspIndex)
VOID EFIAPI SmmCpuSyncLockDoor(IN OUT SMM_CPU_SYNC_CONTEXT *Context, IN UINTN CpuIndex, OUT UINTN *CpuCount)
RETURN_STATUS EFIAPI SmmCpuSyncContextInit(IN UINTN NumberOfCpus, OUT SMM_CPU_SYNC_CONTEXT **Context)
VOID EFIAPI SmmCpuSyncReleaseBsp(IN OUT SMM_CPU_SYNC_CONTEXT *Context, IN UINTN CpuIndex, IN UINTN BspIndex)
UINTN EFIAPI SmmCpuSyncGetArrivedCpuCount(IN SMM_CPU_SYNC_CONTEXT *Context)
STATIC UINT32 InternalWaitForSemaphore(IN OUT volatile UINT32 *Sem)
VOID EFIAPI SmmCpuSyncReleaseOneAp(IN OUT SMM_CPU_SYNC_CONTEXT *Context, IN UINTN CpuIndex, IN UINTN BspIndex)
RETURN_STATUS EFIAPI SmmCpuSyncCheckInCpu(IN OUT SMM_CPU_SYNC_CONTEXT *Context, IN UINTN CpuIndex)
STATIC UINT32 InternalReleaseSemaphore(IN OUT volatile UINT32 *Sem)
UINTN EFIAPI GetSpinLockProperties(VOID)
UINT32 EFIAPI InterlockedCompareExchange32(IN OUT volatile UINT32 *Value, IN UINT32 CompareValue, IN UINT32 ExchangeValue)
#define EFI_SIZE_TO_PAGES(Size)
UINTN ArrivedCpuCountUponLock
SMM_CPU_SYNC_SEMAPHORE * CpuCount
SMM_CPU_SYNC_SEMAPHORE_FOR_EACH_CPU CpuSem[]
SMM_CPU_SYNC_SEMAPHORE * Run