]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/CpuMpPei: Prepare for monitor buffer
authorJeff Fan <jeff.fan@intel.com>
Fri, 18 Dec 2015 03:25:02 +0000 (03:25 +0000)
committervanjeff <vanjeff@Edk2>
Fri, 18 Dec 2015 03:25:02 +0000 (03:25 +0000)
Get AP loop mode to prepare for the monitor buffer required for ApInMwaitLoop
and ApInRunLoop.

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19344 6f19259b-4bc3-4df7-8a09-765794883524

UefiCpuPkg/CpuMpPei/CpuMpPei.c
UefiCpuPkg/CpuMpPei/CpuMpPei.h

index ac609a01f8cc4a4e2b3c0894f313eaed2d7f15c2..b8fa5118b45a8058ad10a377ecd99fdf67240e0f 100644 (file)
@@ -589,6 +589,10 @@ PrepareAPStartupVector (
   UINTN                         WakeupBuffer;\r
   UINTN                         WakeupBufferSize;\r
   MP_ASSEMBLY_ADDRESS_MAP       AddressMap;\r
+  UINT8                         ApLoopMode;\r
+  UINT16                        MonitorFilterSize;\r
+  UINT8                         *MonitorBuffer;\r
+  UINTN                         Index;\r
 \r
   AsmGetAddressMap (&AddressMap);\r
   WakeupBufferSize = AddressMap.RendezvousFunnelSize + sizeof (MP_CPU_EXCHANGE_INFO);\r
@@ -597,11 +601,14 @@ PrepareAPStartupVector (
   DEBUG ((EFI_D_INFO, "CpuMpPei: WakeupBuffer = 0x%x\n", WakeupBuffer));\r
 \r
   //\r
-  // Allocate Pages for APs stack, CPU MP Data and backup buffer for wakeup buffer\r
+  // Allocate Pages for APs stack, CPU MP Data, backup buffer for wakeup buffer,\r
+  // and monitor buffer if required.\r
   //\r
   MaxCpuCount = PcdGet32(PcdCpuMaxLogicalProcessorNumber);\r
   BufferSize  = PcdGet32 (PcdCpuApStackSize) * MaxCpuCount + sizeof (PEI_CPU_MP_DATA)\r
                   + WakeupBufferSize + sizeof (PEI_CPU_DATA) * MaxCpuCount;\r
+  ApLoopMode = GetApLoopMode (&MonitorFilterSize);\r
+  BufferSize += MonitorFilterSize * MaxCpuCount;\r
   Status = PeiServicesAllocatePages (\r
              EfiBootServicesData,\r
              EFI_SIZE_TO_PAGES (BufferSize),\r
@@ -627,7 +634,21 @@ PrepareAPStartupVector (
   InitializeSpinLock(&PeiCpuMpData->MpLock);\r
   SaveVolatileRegisters (&PeiCpuMpData->CpuData[0].VolatileRegisters);\r
   CopyMem (&PeiCpuMpData->AddressMap, &AddressMap, sizeof (MP_ASSEMBLY_ADDRESS_MAP));\r
-\r
+  //\r
+  // Initialize AP loop mode\r
+  //\r
+  PeiCpuMpData->ApLoopMode = ApLoopMode;\r
+  DEBUG ((EFI_D_INFO, "AP Loop Mode is %d\n", PeiCpuMpData->ApLoopMode));\r
+  MonitorBuffer = (UINT8 *)(PeiCpuMpData->CpuData + MaxCpuCount);\r
+  if (PeiCpuMpData->ApLoopMode != ApInHltLoop) {\r
+    //\r
+    // Set up APs wakeup signal buffer\r
+    //\r
+    for (Index = 0; Index < MaxCpuCount; Index++) {\r
+      PeiCpuMpData->CpuData[Index].StartupApSignal = \r
+        (UINT32 *)(MonitorBuffer + MonitorFilterSize * Index);\r
+    }\r
+  }\r
   //\r
   // Backup original data and copy AP reset code in it\r
   //\r
index be4e31237747b1737c660edad97f3cfb7a0baf45..a22bae7005426f270000b5417de4f1e311f4817f 100644 (file)
@@ -134,6 +134,7 @@ typedef struct {
 } CPU_VOLATILE_REGISTERS;\r
 \r
 typedef struct {\r
+  volatile UINT32                *StartupApSignal;\r
   UINT32                         ApicId;\r
   EFI_HEALTH_FLAGS               Health;\r
   CPU_STATE                      State;\r
@@ -163,6 +164,8 @@ struct _PEI_CPU_MP_DATA {
   CPU_EXCHANGE_ROLE_INFO         BSPInfo;\r
   CPU_EXCHANGE_ROLE_INFO         APInfo;\r
   MTRR_SETTINGS                  MtrrTable;\r
+  UINT8                          ApLoopMode;\r
+  UINT8                          ApTargetCState;\r
   PEI_CPU_DATA                   *CpuData;\r
   volatile MP_CPU_EXCHANGE_INFO  *MpCpuExchangeInfo;\r
 };\r