public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017 10/1 BroxtonPlatformPkg: Disable NPK based on DciEn
@ 2017-08-24  3:19 Guo, Mang
  0 siblings, 0 replies; only message in thread
From: Guo, Mang @ 2017-08-24  3:19 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Disable NPK based on DciEn

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Guo Mang <mang.guo@intel.com>
---
 .../BensonGlacier/BoardInitPreMem/BoardInitMiscs.c | 56 ++++++++++++++--------
 1 file changed, 37 insertions(+), 19 deletions(-)

diff --git a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPreMem/BoardInitMiscs.c b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPreMem/BoardInitMiscs.c
index 0b602bd..afad081 100644
--- a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPreMem/BoardInitMiscs.c
+++ b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPreMem/BoardInitMiscs.c
@@ -36,14 +36,16 @@ BgUpdateFspmUpd (
   IN FSPM_UPD                *FspUpdRgn
   )
 {
-  EFI_PEI_HOB_POINTERS           Hob;
-  EFI_PLATFORM_INFO_HOB          *PlatformInfo = NULL;
-  DRAM_POLICY_PPI                *DramPolicy;
-  EFI_STATUS                     Status;
- MRC_NV_DATA_FRAME                 *MrcNvData;
-
-  MRC_PARAMS_SAVE_RESTORE        *MrcParamsHob;
-  BOOT_VARIABLE_NV_DATA          *BootVariableNvDataHob;
+  EFI_PEI_HOB_POINTERS               Hob;
+  EFI_PLATFORM_INFO_HOB             *PlatformInfo = NULL;
+  DRAM_POLICY_PPI                   *DramPolicy;
+  EFI_STATUS                         Status;
+  MRC_NV_DATA_FRAME                 *MrcNvData;
+  MRC_PARAMS_SAVE_RESTORE           *MrcParamsHob;
+  BOOT_VARIABLE_NV_DATA             *BootVariableNvDataHob;
+  SYSTEM_CONFIGURATION               SystemConfiguration;
+  UINTN                              VariableSize;
+  EFI_PEI_READ_ONLY_VARIABLE2_PPI   *VariablePpi;
 
   Status = (*PeiServices)->LocatePpi (
                              PeiServices,
@@ -115,7 +117,7 @@ BgUpdateFspmUpd (
   FspUpdRgn->FspmConfig.Profile               = 0x0B; // LPDDR4_2400_24_22_22
   FspUpdRgn->FspmConfig.MemoryDown            = 0x01;
   FspUpdRgn->FspmConfig.DualRankSupportEnable = 0x01;
-  
+
   FspUpdRgn->FspmConfig.Ch0_RankEnable        = 0x03; // [0]: Rank 0 [1]: Rank 1
   FspUpdRgn->FspmConfig.Ch0_DeviceWidth       = 0x01; // x16
   FspUpdRgn->FspmConfig.Ch0_DramDensity       = 0x02; // 8Gb
@@ -146,6 +148,31 @@ BgUpdateFspmUpd (
     CopyMem (&(FspUpdRgn->FspmConfig.Ch3_Bit_swizzling), ChSwizzle_BG[3], DRAM_POLICY_NUMBER_BITS * sizeof(UINT8));
   }
 
+  //
+  // Disable NPK based on DciEn
+  //
+  Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NULL, (VOID **) &VariablePpi);
+  if (!EFI_ERROR (Status)) {
+    VariableSize = sizeof (SYSTEM_CONFIGURATION);
+    Status = VariablePpi->GetVariable (
+                            VariablePpi,
+                            PLATFORM_SETUP_VARIABLE_NAME,
+                            &gEfiSetupVariableGuid,
+                            NULL,
+                            &VariableSize,
+                            &SystemConfiguration
+                            );
+    if (!EFI_ERROR (Status)) {
+      if (SystemConfiguration.DciEn == 0) {
+        FspUpdRgn->FspmConfig.NpkEn = 0;
+      } else if (SystemConfiguration.DciAutoDetect == 1) {
+        FspUpdRgn->FspmConfig.NpkEn = 3;
+      } else {
+        FspUpdRgn->FspmConfig.NpkEn = 1;
+      }
+    }
+  }
+
   return EFI_SUCCESS;
 }
 
@@ -290,16 +317,7 @@ BgDramCreatePolicyDefaults (
     CopyMem (DramPolicy->ChSwizzle, ChSwizlePtr, sizeof (DramPolicy->ChSwizzle));
   }
 
-  Status = VariablePpi->GetVariable (
-                          VariablePpi,
-                          PLATFORM_SETUP_VARIABLE_NAME,
-                          &gEfiSetupVariableGuid,
-                          NULL,
-                          &VariableSize,
-                          &SystemConfiguration
-                          );
-
-  if (!EFI_ERROR (Status)) {
+  if (ReadSetupVars) {
     if (SystemConfiguration.Max2G == 0) {
       DramPolicy->SystemMemorySizeLimit = 0x800;
     }
-- 
2.10.1.windows.1



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

only message in thread, other threads:[~2017-08-24  3:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-24  3:19 [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017 10/1 BroxtonPlatformPkg: Disable NPK based on DciEn Guo, Mang

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