public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Set MaxPkgCState
@ 2017-11-09 11:06 Guo, Mang
  0 siblings, 0 replies; only message in thread
From: Guo, Mang @ 2017-11-09 11:06 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: Wei, David

Contributed-under: TianoCore Contribution Agreement 1.1

Signed-off-by: Guo Mang <mang.guo@intel.com>
---
 .../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 536c390..ab11aaa 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 2cf4810..2ac2859 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 5989d30..55ec5b7 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 af53b8c..7221f84 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 98100c2..c1ba128 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 a794d6b..526e903 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 4af0dc2..6c176d0 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.<BR>
+  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
 
   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 f0e6bf7..5ce0cc2 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 27c4dfc..db5b9a4 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 ea8d7fb..d1f8cc2 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 54e80df..b03f825 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 b15d0ed..8cb63e9 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 e15973a..14490e5 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 ideqval Setup.PmicSetupDefault == 1;
   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 8bf6dc2..d6a175b 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
-- 
2.10.1.windows.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-09 11:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-09 11:06 [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Set MaxPkgCState Guo, Mang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox