Got you. Thanks! Suggest to set new PCDs' token ids from 0x00000002, 0x00000003.... instead of 0x0000000a.
-----Original Message----- From: Chen Fan [mailto:[email protected]] Sent: Friday, September 26, 2014 6:39 PM To: [email protected] Cc: Jordan Justen; Fan, Jeff Subject: [RFC PATCH v4 07/23] UefiCpuPkg/CpuDxe: introduce PCD value PcdCpuApStackSize Introduce a PCD value to specify Application Processor Stack size, by default 32KB, and BSP allocates stack for APs after APs complete initlization. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen Fan <[email protected]> --- UefiCpuPkg/CpuDxe/CpuDxe.inf | 3 +++ UefiCpuPkg/CpuDxe/CpuMp.c | 18 ++++++++++++++++++ UefiCpuPkg/UefiCpuPkg.dec | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.inf b/UefiCpuPkg/CpuDxe/CpuDxe.inf index c2f12b7..88b107f 100644 --- a/UefiCpuPkg/CpuDxe/CpuDxe.inf +++ b/UefiCpuPkg/CpuDxe/CpuDxe.inf @@ -75,6 +75,9 @@ gIdleLoopEventGuid ## CONSUMES ## Event gEfiVectorHandoffTableGuid ## SOMETIMES_CONSUMES ## SystemTable +[Pcd] + gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize + [Depex] TRUE diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c index 2d52b22..11129e6 100644 --- a/UefiCpuPkg/CpuDxe/CpuMp.c +++ b/UefiCpuPkg/CpuDxe/CpuMp.c @@ -15,10 +15,14 @@ #include "CpuDxe.h" #include "CpuMp.h" +UINTN gApStackSize; + VOID *mCommonStack = 0; VOID *mTopOfApCommonStack = 0; +VOID *mApStackStart = 0; volatile UINTN mNumberOfProcessors; +volatile BOOLEAN mAllApsInitFinished = FALSE; /** Application Processor C code entry point. @@ -37,6 +41,13 @@ ApEntryPointInC ( AsmApDoneWithCommonStack (); + // + // Waiting for all APs complete initialization // while + (!mAllApsInitFinished) { + CpuPause (); + } + CpuSleep (); } @@ -57,5 +68,12 @@ InitializeMpSupport ( } DEBUG ((DEBUG_INFO, "Detect CPU count: %d\n", mNumberOfProcessors)); + + gApStackSize = (UINTN) PcdGet32 (PcdCpuApStackSize); + + mApStackStart = AllocatePages (EFI_SIZE_TO_PAGES + ((mNumberOfProcessors - 1) * gApStackSize)); ASSERT (mApStackStart != + 0x0); + + mAllApsInitFinished = TRUE; } diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index c6e73a9..5b35a23 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -54,6 +54,10 @@ ## 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 + ## This value specifies the Application Processor (AP) stack size, which used for Mp Service. + # @Prompt Configure stack size for Application Processor (AP) + gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize|0x8000|UINT32|0x0000000a + [UserExtensions.TianoCore."ExtraFiles"] UefiCpuPkgExtra.uni -- 1.9.3 ------------------------------------------------------------------------------ Slashdot TV. Videos for Nerds. Stuff that Matters. http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
