mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/PiSmmCpuDxeSmm: Allocate buffer for each CPU semaphores
Allocate each CPU semaphores in allocated aligned semaphores buffer. And add it into semaphores structure. Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Michael Kinney <michael.d.kinney@intel.com> Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
fe3a75bc41
commit
4e92058113
|
@ -1208,6 +1208,7 @@ InitializeSmmCpuSemaphores (
|
||||||
UINTN ProcessorCount;
|
UINTN ProcessorCount;
|
||||||
UINTN TotalSize;
|
UINTN TotalSize;
|
||||||
UINTN GlobalSemaphoresSize;
|
UINTN GlobalSemaphoresSize;
|
||||||
|
UINTN CpuSemaphoresSize;
|
||||||
UINTN SemaphoreSize;
|
UINTN SemaphoreSize;
|
||||||
UINTN Pages;
|
UINTN Pages;
|
||||||
UINTN *SemaphoreBlock;
|
UINTN *SemaphoreBlock;
|
||||||
|
@ -1216,7 +1217,8 @@ InitializeSmmCpuSemaphores (
|
||||||
SemaphoreSize = GetSpinLockProperties ();
|
SemaphoreSize = GetSpinLockProperties ();
|
||||||
ProcessorCount = gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus;
|
ProcessorCount = gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus;
|
||||||
GlobalSemaphoresSize = (sizeof (SMM_CPU_SEMAPHORE_GLOBAL) / sizeof (VOID *)) * SemaphoreSize;
|
GlobalSemaphoresSize = (sizeof (SMM_CPU_SEMAPHORE_GLOBAL) / sizeof (VOID *)) * SemaphoreSize;
|
||||||
TotalSize = GlobalSemaphoresSize;
|
CpuSemaphoresSize = (sizeof (SMM_CPU_SEMAPHORE_CPU) / sizeof (VOID *)) * ProcessorCount * SemaphoreSize;
|
||||||
|
TotalSize = GlobalSemaphoresSize + CpuSemaphoresSize;
|
||||||
DEBUG((EFI_D_INFO, "One Semaphore Size = 0x%x\n", SemaphoreSize));
|
DEBUG((EFI_D_INFO, "One Semaphore Size = 0x%x\n", SemaphoreSize));
|
||||||
DEBUG((EFI_D_INFO, "Total Semaphores Size = 0x%x\n", TotalSize));
|
DEBUG((EFI_D_INFO, "Total Semaphores Size = 0x%x\n", TotalSize));
|
||||||
Pages = EFI_SIZE_TO_PAGES (TotalSize);
|
Pages = EFI_SIZE_TO_PAGES (TotalSize);
|
||||||
|
@ -1236,6 +1238,13 @@ InitializeSmmCpuSemaphores (
|
||||||
mSmmCpuSemaphores.SemaphoreGlobal.CodeAccessCheckLock
|
mSmmCpuSemaphores.SemaphoreGlobal.CodeAccessCheckLock
|
||||||
= (SPIN_LOCK *)SemaphoreAddr;
|
= (SPIN_LOCK *)SemaphoreAddr;
|
||||||
|
|
||||||
|
SemaphoreAddr = (UINTN)SemaphoreBlock + GlobalSemaphoresSize;
|
||||||
|
mSmmCpuSemaphores.SemaphoreCpu.Busy = (SPIN_LOCK *)SemaphoreAddr;
|
||||||
|
SemaphoreAddr += ProcessorCount * SemaphoreSize;
|
||||||
|
mSmmCpuSemaphores.SemaphoreCpu.Run = (UINT32 *)SemaphoreAddr;
|
||||||
|
SemaphoreAddr += ProcessorCount * SemaphoreSize;
|
||||||
|
mSmmCpuSemaphores.SemaphoreCpu.Present = (BOOLEAN *)SemaphoreAddr;
|
||||||
|
|
||||||
mSmmMpSyncData->Counter = mSmmCpuSemaphores.SemaphoreGlobal.Counter;
|
mSmmMpSyncData->Counter = mSmmCpuSemaphores.SemaphoreGlobal.Counter;
|
||||||
mSmmMpSyncData->InsideSmm = mSmmCpuSemaphores.SemaphoreGlobal.InsideSmm;
|
mSmmMpSyncData->InsideSmm = mSmmCpuSemaphores.SemaphoreGlobal.InsideSmm;
|
||||||
mSmmMpSyncData->AllCpusInSync = mSmmCpuSemaphores.SemaphoreGlobal.AllCpusInSync;
|
mSmmMpSyncData->AllCpusInSync = mSmmCpuSemaphores.SemaphoreGlobal.AllCpusInSync;
|
||||||
|
|
|
@ -366,11 +366,22 @@ typedef struct {
|
||||||
SPIN_LOCK *CodeAccessCheckLock;
|
SPIN_LOCK *CodeAccessCheckLock;
|
||||||
} SMM_CPU_SEMAPHORE_GLOBAL;
|
} SMM_CPU_SEMAPHORE_GLOBAL;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// All semaphores for each processor
|
||||||
|
///
|
||||||
|
typedef struct {
|
||||||
|
SPIN_LOCK *Busy;
|
||||||
|
volatile UINT32 *Run;
|
||||||
|
volatile BOOLEAN *Present;
|
||||||
|
} SMM_CPU_SEMAPHORE_CPU;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// All semaphores' information
|
/// All semaphores' information
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SMM_CPU_SEMAPHORE_GLOBAL SemaphoreGlobal;
|
SMM_CPU_SEMAPHORE_GLOBAL SemaphoreGlobal;
|
||||||
|
SMM_CPU_SEMAPHORE_CPU SemaphoreCpu;
|
||||||
} SMM_CPU_SEMAPHORES;
|
} SMM_CPU_SEMAPHORES;
|
||||||
|
|
||||||
extern IA32_DESCRIPTOR gcSmiGdtr;
|
extern IA32_DESCRIPTOR gcSmiGdtr;
|
||||||
|
|
Loading…
Reference in New Issue