Revision: 16350
http://sourceforge.net/p/edk2/code/16350
Author: jljusten
Date: 2014-11-13 18:25:48 +0000 (Thu, 13 Nov 2014)
Log Message:
-----------
UefiCpuPkg/CpuDxe: introduce two PCD value
introduce PCD value: PcdCpuMaxLogicalProcessorNumber and PcdCpuApStackSize,
used for initialize APs stacks.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen Fan <[email protected]>
Reviewed-by: Jeff Fan <[email protected]>
Modified Paths:
--------------
trunk/edk2/UefiCpuPkg/CpuDxe/CpuDxe.inf
trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c
trunk/edk2/UefiCpuPkg/UefiCpuPkg.dec
Modified: trunk/edk2/UefiCpuPkg/CpuDxe/CpuDxe.inf
===================================================================
--- trunk/edk2/UefiCpuPkg/CpuDxe/CpuDxe.inf 2014-11-13 18:25:29 UTC (rev
16349)
+++ trunk/edk2/UefiCpuPkg/CpuDxe/CpuDxe.inf 2014-11-13 18:25:48 UTC (rev
16350)
@@ -75,6 +75,10 @@
gIdleLoopEventGuid ## CONSUMES ## Event
gEfiVectorHandoffTableGuid ## SOMETIMES_CONSUMES ##
SystemTable
+[Pcd]
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## CONSUMES
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize ## CONSUMES
+
[Depex]
TRUE
Modified: trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c
===================================================================
--- trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c 2014-11-13 18:25:29 UTC (rev
16349)
+++ trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c 2014-11-13 18:25:48 UTC (rev
16350)
@@ -15,9 +15,14 @@
#include "CpuDxe.h"
#include "CpuMp.h"
+UINTN gMaxLogicalProcessorNumber;
+UINTN gApStackSize;
+
VOID *mCommonStack = 0;
VOID *mTopOfApCommonStack = 0;
+VOID *mApStackStart = 0;
+volatile UINTN mNumberOfProcessors;
/**
Application Processor C code entry point.
@@ -29,6 +34,7 @@
VOID
)
{
+ mNumberOfProcessors++;
}
@@ -41,5 +47,39 @@
VOID
)
{
+ gMaxLogicalProcessorNumber = (UINTN) PcdGet32
(PcdCpuMaxLogicalProcessorNumber);
+ if (gMaxLogicalProcessorNumber < 1) {
+ DEBUG ((DEBUG_ERROR, "Setting PcdCpuMaxLogicalProcessorNumber should be
more than zero.\n"));
+ return;
+ }
+
+ if (gMaxLogicalProcessorNumber == 1) {
+ return;
+ }
+
+ gApStackSize = (UINTN) PcdGet32 (PcdCpuApStackSize);
+ ASSERT ((gApStackSize & (SIZE_4KB - 1)) == 0);
+
+ mApStackStart = AllocatePages (EFI_SIZE_TO_PAGES (gMaxLogicalProcessorNumber
* gApStackSize));
+ ASSERT (mApStackStart != NULL);
+
+ //
+ // the first buffer of stack size used for common stack, when the amount of
AP
+ // more than 1, we should never free the common stack which maybe used for
AP reset.
+ //
+ mCommonStack = mApStackStart;
+ mTopOfApCommonStack = (UINT8*) mApStackStart + gApStackSize;
+ mApStackStart = mTopOfApCommonStack;
+
+ mNumberOfProcessors = 1;
+
+ if (mNumberOfProcessors == 1) {
+ FreePages (mCommonStack, EFI_SIZE_TO_PAGES (gMaxLogicalProcessorNumber *
gApStackSize));
+ return;
+ }
+
+ if (mNumberOfProcessors < gMaxLogicalProcessorNumber) {
+ FreePages (mApStackStart, EFI_SIZE_TO_PAGES ((gMaxLogicalProcessorNumber -
mNumberOfProcessors) *
+ gApStackSize));
+ }
}
-
Modified: trunk/edk2/UefiCpuPkg/UefiCpuPkg.dec
===================================================================
--- trunk/edk2/UefiCpuPkg/UefiCpuPkg.dec 2014-11-13 18:25:29 UTC (rev
16349)
+++ trunk/edk2/UefiCpuPkg/UefiCpuPkg.dec 2014-11-13 18:25:48 UTC (rev
16350)
@@ -54,6 +54,13 @@
## Specifies delay value in microseconds after sending out an INIT IPI.
# @Prompt Configure delay value after send an INIT IPI
gUefiCpuPkgTokenSpaceGuid.PcdCpuInitIpiDelayInMicroSeconds|10000|UINT32|0x30000002
+ ## Specifies max supported number of Logical Processors.
+ # @Prompt Configure max supported number of Logical Processorss
+
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|64|UINT32|0x00000002
+ ## This value specifies the Application Processor (AP) stack size, used for
Mp Service, which must
+ ## aligns the address on a 4-KByte boundary.
+ # @Prompt Configure stack size for Application Processor (AP)
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize|0x8000|UINT32|0x00000003
[UserExtensions.TianoCore."ExtraFiles"]
UefiCpuPkgExtra.uni
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits