diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/NonMmramMapDxeSmm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/NonMmramMapDxeSmm.c index 51f0edd296..a98013b7d0 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/NonMmramMapDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/NonMmramMapDxeSmm.c @@ -495,11 +495,7 @@ GetSmmProfileData ( ASSERT (Size != NULL); - if (mBtsSupported) { - *Size = PcdGet32 (PcdCpuSmmProfileSize) + mMsrDsAreaSize; - } else { - *Size = PcdGet32 (PcdCpuSmmProfileSize); - } + *Size = PcdGet32 (PcdCpuSmmProfileSize); Base = 0xFFFFFFFF; Status = gBS->AllocatePages ( diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h index 0dccf7ca65..bc08f03640 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h @@ -270,8 +270,6 @@ extern UINTN mSmmShadowStackSize; /// extern UINT8 mSmmSaveStateRegisterLma; -extern BOOLEAN mBtsSupported; -extern UINTN mMsrDsAreaSize; extern BOOLEAN mAcpiS3Enable; #define PAGE_TABLE_POOL_ALIGNMENT BASE_128KB diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c index 164af20a4c..c152dccea4 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c @@ -748,9 +748,6 @@ InitSmmProfileInternal ( ); ASSERT (mLastPFEntryPointer != NULL); - mSmmProfileSize = FixedPcdGet32 (PcdCpuSmmProfileSize); - ASSERT ((mSmmProfileSize & 0xFFF) == 0); - // // Get Smm Profile Base // @@ -758,6 +755,15 @@ InitSmmProfileInternal ( DEBUG ((DEBUG_ERROR, "SmmProfileBase = 0x%016x.\n", (UINTN)mSmmProfileBase)); DEBUG ((DEBUG_ERROR, "SmmProfileSize = 0x%016x.\n", (UINTN)SmmProfileSize)); + if (mBtsSupported) { + ASSERT (SmmProfileSize > mMsrDsAreaSize); + mSmmProfileSize = (UINTN)SmmProfileSize - mMsrDsAreaSize; + } else { + mSmmProfileSize = (UINTN)SmmProfileSize; + } + + ASSERT ((mSmmProfileSize & 0xFFF) == 0); + // // Initialize SMM profile data header. // diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index 2cabf5fc03..33ac8cf91c 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -281,7 +281,7 @@ ## Specifies buffer size in bytes to save SMM profile data. The value should be a multiple of 4KB. # @Prompt SMM profile data buffer size. - gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmProfileSize|0x200000|UINT32|0x32132107 + gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmProfileSize|0x600000|UINT32|0x32132107 ## Specifies stack size in bytes for each processor in SMM. # @Prompt Processor stack size in SMM.