diff options
author | Guo Mang <mang.guo@intel.com> | 2017-08-22 15:19:35 +0800 |
---|---|---|
committer | Guo Mang <mang.guo@intel.com> | 2017-08-24 18:52:41 +0800 |
commit | 5bbace989f4afc6b57ae37b10f9a2832dc58f84d (patch) | |
tree | 2ae8b8369a86d14a8f094d26db099c0c45fe3492 /Platform/BroxtonPlatformPkg | |
parent | 4773b1c76d67f7ea3d92c958a790c1cffb1407b9 (diff) | |
download | edk2-platforms-5bbace989f4afc6b57ae37b10f9a2832dc58f84d.tar.xz |
BroxtonPlatformPkg: Disable NPK based on DciEn
Disable NPK based on DciEn
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'Platform/BroxtonPlatformPkg')
-rw-r--r-- | Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPreMem/BoardInitMiscs.c | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPreMem/BoardInitMiscs.c b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPreMem/BoardInitMiscs.c index 0b602bd96e..afad08169c 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;
}
|