From 727c4c9a5ce70b6164611c51d31942a6d85bcb4b Mon Sep 17 00:00:00 2001 From: Guo Mang Date: Thu, 9 Nov 2017 18:49:05 +0800 Subject: Set MaxPkgCState Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Guo Mang --- .../Board/BensonGlacier/BoardInitPostMem/BoardInit.c | 11 +++++++++-- .../Board/BensonGlacier/BoardInitPostMem/BoardInitMiscs.h | 7 +++++++ .../Board/BensonGlacier/BoardInitPostMem/BoardInitPostMem.inf | 1 + .../Board/LeafHill/BoardInitPostMem/BoardInit.c | 9 ++++++++- .../Board/LeafHill/BoardInitPostMem/BoardInitMiscs.h | 6 ++++++ .../Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf | 1 + .../Library/PeiFspPolicyInitLib/PeiFspCpuPolicyInitLib.c | 4 ++-- .../Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf | 1 + .../Common/Library/PeiPolicyUpdateLib/PeiCpuPolicyUpdate.c | 2 +- .../Common/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf | 1 + .../Common/PlatformSettings/PlatformDxe/Platform.c | 8 +++----- .../Common/PlatformSettings/PlatformDxe/PlatformDxe.inf | 3 ++- .../Common/PlatformSettings/PlatformSetupDxe/CpuPower.vfi | 6 +++--- Platform/BroxtonPlatformPkg/PlatformPkg.dec | 6 ++++-- 14 files changed, 49 insertions(+), 17 deletions(-) diff --git a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInit.c b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInit.c index 536c390ec1..ab11aaafd2 100644 --- a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInit.c +++ b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInit.c @@ -50,6 +50,7 @@ BensonGlacierPostMemInitCallback ( UINT8 FabId; UINT8 ResetType; UINTN BufferSize; + UINT8 MaxPkgCState; Status = PeiServicesLocatePpi ( &gBoardPostMemInitDoneGuid, @@ -88,12 +89,18 @@ BensonGlacierPostMemInitCallback ( // BufferSize = sizeof (EFI_GUID); PcdSetPtr(PcdBoardVbtFileGuid, &BufferSize, (UINT8 *)&gPeiBensonGlacierVbtGuid); - + // // Set PcdSueCreek // PcdSetBool (PcdSueCreek, TRUE); - + + // + // Set PcdMaxPkgCState + // + MaxPkgCState = MAX_PKG_CSTATE_C2; + PcdSet8 (PcdMaxPkgCState, (UINT8) MaxPkgCState); + // // Add init steps here // diff --git a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitMiscs.h b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitMiscs.h index 2cf4810862..2ac2859444 100644 --- a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitMiscs.h +++ b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitMiscs.h @@ -94,6 +94,13 @@ #define SUBSYSTEM_DEVICE_ID 0x1234 #define SUBSYSTEM_SVID_SSID (SUBSYSTEM_VENDOR_ID + (SUBSYSTEM_DEVICE_ID << 16)) +// +// MaxPkgCState identifier. +// +#define MAX_PKG_CSTATE_C0 0x00 +#define MAX_PKG_CSTATE_C1 0x01 +#define MAX_PKG_CSTATE_C2 0x02 + EFI_STATUS BensonGetPlatformInfoHob ( IN CONST EFI_PEI_SERVICES **PeiServices, diff --git a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitPostMem.inf b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitPostMem.inf index 5989d30b6b..55ec5b75f0 100644 --- a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitPostMem.inf +++ b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitPostMem.inf @@ -64,6 +64,7 @@ gPlatformModuleTokenSpaceGuid.PcdResetType gPlatformModuleTokenSpaceGuid.PcdBoardVbtFileGuid gPlatformModuleTokenSpaceGuid.PcdSueCreek + gPlatformModuleTokenSpaceGuid.PcdMaxPkgCState [Guids] gEfiPlatformInfoGuid diff --git a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c index af53b8c652..7221f84a31 100644 --- a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c +++ b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c @@ -58,6 +58,7 @@ LeafHillPostMemInitCallback ( UINT8 FabId; UINT8 ResetType; UINTN BufferSize; + UINT8 MaxPkgCState; Status = PeiServicesLocatePpi ( &gBoardPostMemInitDoneGuid, @@ -101,7 +102,13 @@ LeafHillPostMemInitCallback ( // Set PcdSueCreek // PcdSetBool (PcdSueCreek, FALSE); - + + // + // Set PcdMaxPkgCState + // + MaxPkgCState = MAX_PKG_CSTATE_C2; + PcdSet8 (PcdMaxPkgCState, (UINT8) MaxPkgCState); + // // Add init steps here // diff --git a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitMiscs.h b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitMiscs.h index 98100c2186..c1ba128709 100644 --- a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitMiscs.h +++ b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitMiscs.h @@ -86,6 +86,12 @@ #define SUBSYSTEM_DEVICE_ID 0x1234 #define SUBSYSTEM_SVID_SSID (SUBSYSTEM_VENDOR_ID + (SUBSYSTEM_DEVICE_ID << 16)) +// +// MaxPkgCState identifier. +// +#define MAX_PKG_CSTATE_C0 0x00 +#define MAX_PKG_CSTATE_C1 0x01 +#define MAX_PKG_CSTATE_C2 0x02 EFI_STATUS LeafHillGetPlatformInfoHob ( IN CONST EFI_PEI_SERVICES **PeiServices, diff --git a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf index a794d6b07c..526e90357d 100644 --- a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf +++ b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf @@ -62,6 +62,7 @@ gPlatformModuleTokenSpaceGuid.PcdResetType gPlatformModuleTokenSpaceGuid.PcdBoardVbtFileGuid gPlatformModuleTokenSpaceGuid.PcdSueCreek + gPlatformModuleTokenSpaceGuid.PcdMaxPkgCState [Guids] gEfiPlatformInfoGuid diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspCpuPolicyInitLib.c b/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspCpuPolicyInitLib.c index 4af0dc2017..6c176d0685 100644 --- a/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspCpuPolicyInitLib.c +++ b/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspCpuPolicyInitLib.c @@ -1,7 +1,7 @@ /** @file Implementation of Fsp PCH Policy Initialization. - Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -112,7 +112,7 @@ PeiFspCpuPolicyInit ( FspsUpd->FspsConfig.EnableCx = SystemConfiguration->EnableCx; FspsUpd->FspsConfig.C1e = SystemConfiguration->EnableCxe; FspsUpd->FspsConfig.BiProcHot = SystemConfiguration->EnableProcHot; - FspsUpd->FspsConfig.PkgCStateLimit = (MAX_PKG_C_STATE) SystemConfiguration->MaxPkgCState; + FspsUpd->FspsConfig.PkgCStateLimit = (MAX_PKG_C_STATE) PcdGet8 (PcdMaxPkgCState); FspsUpd->FspsConfig.EnableCx = SystemConfiguration->EnableCx; FspsUpd->FspsConfig.CStateAutoDemotion = SystemConfiguration->CStateAutoDemotion; FspsUpd->FspsConfig.CStateUnDemotion = SystemConfiguration->CStateUnDemotion; diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf b/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf index f0e6bf710c..5ce0cc255a 100644 --- a/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf +++ b/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf @@ -85,6 +85,7 @@ gEfiBxtTokenSpaceGuid.PcdPmcGcrBaseAddress gPlatformModuleTokenSpaceGuid.PcdResetType gPlatformModuleTokenSpaceGuid.PcdBoardVbtFileGuid + gPlatformModuleTokenSpaceGuid.PcdMaxPkgCState [Ppis] gSiPolicyPpiGuid ## CONSUMES diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiCpuPolicyUpdate.c b/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiCpuPolicyUpdate.c index 27c4dfc710..db5b9a4870 100644 --- a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiCpuPolicyUpdate.c +++ b/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiCpuPolicyUpdate.c @@ -68,7 +68,7 @@ UpdatePeiCpuPolicy ( PowerMgmtConfig->Cx = SystemConfiguration->EnableCx; PowerMgmtConfig->C1e = SystemConfiguration->EnableCxe; PowerMgmtConfig->BiProcHot = SystemConfiguration->EnableProcHot; - PowerMgmtConfig->PkgCStateLimit = (MAX_PKG_C_STATE) SystemConfiguration->MaxPkgCState; + PowerMgmtConfig->PkgCStateLimit = (MAX_PKG_C_STATE) PcdGet8 (PcdMaxPkgCState); PowerMgmtConfig->AutoThermalReporting = SystemConfiguration->AutoThermalReporting; if (BxtStepping () >= BxtPB1) { diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf b/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf index ea8d7fb4b1..d1f8cc2793 100644 --- a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf +++ b/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf @@ -81,6 +81,7 @@ gEfiBxtTokenSpaceGuid.PcdP2SBBaseAddress gEfiBxtTokenSpaceGuid.PcdPmcGcrBaseAddress gPlatformModuleTokenSpaceGuid.PcdResetType + gPlatformModuleTokenSpaceGuid.PcdMaxPkgCState [FixedPcd] gPlatformModuleTokenSpaceGuid.PcdFlashAreaSize diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c index 54e80df917..b03f825f89 100644 --- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c +++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c @@ -773,11 +773,9 @@ InitializePlatform ( mSystemConfiguration.PlatformSettingEn = 1; } - mSystemConfiguration.PmicSetupDefault = 0; - if (PlatformInfoHob->PmicVersion == 0) { - mSystemConfiguration.PmicSetupDefault = 1; - mSystemConfiguration.MaxPkgCState = 0; - } + mSystemConfiguration.PmicSetupDefault = 1; + mSystemConfiguration.MaxPkgCState = PcdGet8 (PcdMaxPkgCState); + Status = gRT->SetVariable ( L"Setup", diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf index b15d0ed8ae..8cb63e9460 100644 --- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf +++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf @@ -133,7 +133,8 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdFastPS2Detection gEfiBxtTokenSpaceGuid.PcdP2SBBaseAddress gPlatformModuleTokenSpaceGuid.PcdLogoFileGuid - gPlatformModuleTokenSpaceGuid.PcdLogoDisplay + gPlatformModuleTokenSpaceGuid.PcdLogoDisplay + gPlatformModuleTokenSpaceGuid.PcdMaxPkgCState [FeaturePcd] gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/CpuPower.vfi b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/CpuPower.vfi index e15973a273..9deea25341 100644 --- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/CpuPower.vfi +++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/CpuPower.vfi @@ -64,13 +64,13 @@ form formid = CPU_PWR_CONFIGURATION_FORM_ID, oneof varid = Setup.MaxPkgCState, prompt = STRING_TOKEN(STR_MAX_PKG_CSTATE_SUPPORT_PROMPT), help = STRING_TOKEN(STR_MAX_PKG_CSTATE_STATE_SUPPORT_HELP), - option text = STRING_TOKEN(STR_MAX_PKG_CSTATE_C2), value = 2, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED; + option text = STRING_TOKEN(STR_MAX_PKG_CSTATE_C2), value = 2, flags = RESET_REQUIRED; option text = STRING_TOKEN(STR_MAX_PKG_CSTATE_C1), value = 1, flags = RESET_REQUIRED; - option text = STRING_TOKEN(STR_MAX_PKG_CSTATE_C0), value = 0, flags = RESET_REQUIRED; + option text = STRING_TOKEN(STR_MAX_PKG_CSTATE_C0), value = 0, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED; endoneof; endif; - suppressif NOT ideqval Setup.PmicSetupDefault == 1; + suppressif TRUE; text help = STRING_TOKEN(STR_MAX_PKG_CSTATE_STATE_SUPPORT_HELP), text = STRING_TOKEN(STR_MAX_PKG_CSTATE_SUPPORT_PROMPT), diff --git a/Platform/BroxtonPlatformPkg/PlatformPkg.dec b/Platform/BroxtonPlatformPkg/PlatformPkg.dec index 8bf6dc2d2f..d6a175b8ca 100644 --- a/Platform/BroxtonPlatformPkg/PlatformPkg.dec +++ b/Platform/BroxtonPlatformPkg/PlatformPkg.dec @@ -187,8 +187,10 @@ ## This PCD used for QR code display under EFI Shell gPlatformModuleTokenSpaceGuid.PcdLogoDisplay|FALSE|BOOLEAN|0x80000016 ## This PCD used to select bluetooth device - gPlatformModuleTokenSpaceGuid.PcdBtDevice|0x00|UINT8|0x80000017 - + gPlatformModuleTokenSpaceGuid.PcdBtDevice|0x00|UINT8|0x80000017 + ## This PCD used to select MaxPkgCState + gPlatformModuleTokenSpaceGuid.PcdMaxPkgCState|0x00|UINT8|0x80000018 + ## MemoryCheck value for checking memory before boot OS. ## To save the boot performance, the default MemoryCheck is set to 0. gClientCommonModuleTokenSpaceGuid.PcdPlatformMemoryCheck|0|UINT8|0x40000005 -- cgit v1.2.3