From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=shifeix.a.lu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 271A4208F795A for ; Wed, 29 Nov 2017 23:26:40 -0800 (PST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Nov 2017 23:31:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,340,1508828400"; d="scan'208";a="182281522" Received: from shwdeopenpsi011.ccr.corp.intel.com (HELO SHWDEOPENPSI011.local) ([10.239.9.121]) by fmsmga006.fm.intel.com with SMTP; 29 Nov 2017 23:31:03 -0800 Date: Thu, 30 Nov 2017 15:31:03 +0800 From: lushifex CC: david.wei@intel.com; Sender: lushifex To: edk2-devel@lists.01.org Message-ID: <7cf56c9c-5325-4b3a-aa45-d761d6d02cba@SHWDEOPENPSI011.local> X-Mailer: TortoiseGit MIME-Version: 1.0 Subject: [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Set Speed. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 07:26:40 -0000 Content-Type: text/plain; Add a temporary platform workaround to downgrade eMMC host from HS400 to HS200 on MinnowBoard 3 FAB B and MinnowBoard 3 Next Pre-production board. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: lushifex --- .../BensonGlacier/BoardInitPostMem/BoardInit.c | 9 ++++-- .../BoardInitPostMem/BoardInitPostMem.inf | 1 + .../Board/LeafHill/BoardInitPostMem/BoardInit.c | 28 +++++++++++++++++ .../LeafHill/BoardInitPostMem/BoardInitPostMem.inf | 1 + .../MinnowBoard3/BoardInitPostMem/BoardInit.c | 35 ++++++++++++++++++++++ .../MinnowBoard3/BoardInitPostMem/BoardInitMiscs.h | 7 +++++ .../BoardInitPostMem/BoardInitPostMem.inf | 1 + .../MinnowBoard3Next/BoardInitPostMem/BoardInit.c | 35 ++++++++++++++++++++++ .../BoardInitPostMem/BoardInitMiscs.h | 7 +++++ .../BoardInitPostMem/BoardInitPostMem.inf | 1 + .../PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf | 1 + .../PeiFspPolicyInitLib/PeiFspScPolicyInitLib.c | 3 +- .../PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf | 1 + .../Library/PeiPolicyUpdateLib/PeiScPolicyUpdate.c | 2 +- Platform/BroxtonPlatformPkg/PlatformPkg.dec | 2 ++ 15 files changed, 130 insertions(+), 4 deletions(-) diff --git a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInit.c b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInit.c index 28fc529..74245de 100644 --- a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInit.c +++ b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInit.c @@ -58,13 +58,13 @@ BensonGlacierPostMemInitCallback ( VariableSize = sizeof (SYSTEM_CONFIGURATION); ZeroMem (&SystemConfiguration, sizeof (SYSTEM_CONFIGURATION)); - (*PeiServices)->LocatePpi ( + (*PeiServices)->LocatePpi ( (CONST EFI_PEI_SERVICES **)PeiServices, &gEfiPeiReadOnlyVariable2PpiGuid, 0, NULL, (VOID **) &VariableServices - ); + ); VariableServices->GetVariable ( VariableServices, @@ -129,6 +129,11 @@ BensonGlacierPostMemInitCallback ( // MaxPkgCState = MAX_PKG_CSTATE_C2; PcdSet8 (PcdMaxPkgCState, (UINT8) MaxPkgCState); + + // + // Set PcdeMMCHostMaxSpeed + // + PcdSet8 (PcdeMMCHostMaxSpeed, (UINT8) (SystemConfiguration.ScceMMCHostMaxSpeed)); // // Add init steps here diff --git a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitPostMem.inf b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitPostMem.inf index e15e612..0f1d555 100644 --- a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitPostMem.inf +++ b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitPostMem.inf @@ -66,6 +66,7 @@ gPlatformModuleTokenSpaceGuid.PcdSueCreek gPlatformModuleTokenSpaceGuid.PcdMaxPkgCState gPlatformModuleTokenSpaceGuid.PcdTi3100AudioCodecEnable + gPlatformModuleTokenSpaceGuid.PcdeMMCHostMaxSpeed [Guids] gEfiPlatformInfoGuid diff --git a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c index 8051b00..4bd93d1 100644 --- a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c +++ b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c @@ -59,6 +59,29 @@ LeafHillPostMemInitCallback ( UINT8 ResetType; UINTN BufferSize; UINT8 MaxPkgCState; + UINTN VariableSize; + EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariableServices; + SYSTEM_CONFIGURATION SystemConfiguration; + + VariableSize = sizeof (SYSTEM_CONFIGURATION); + ZeroMem (&SystemConfiguration, sizeof (SYSTEM_CONFIGURATION)); + + (*PeiServices)->LocatePpi ( + (CONST EFI_PEI_SERVICES **)PeiServices, + &gEfiPeiReadOnlyVariable2PpiGuid, + 0, + NULL, + (VOID **) &VariableServices + ); + + VariableServices->GetVariable ( + VariableServices, + PLATFORM_SETUP_VARIABLE_NAME, + &gEfiSetupVariableGuid, + NULL, + &VariableSize, + &SystemConfiguration + ); Status = PeiServicesLocatePpi ( &gBoardPostMemInitDoneGuid, @@ -106,6 +129,11 @@ LeafHillPostMemInitCallback ( // MaxPkgCState = MAX_PKG_CSTATE_C2; PcdSet8 (PcdMaxPkgCState, (UINT8) MaxPkgCState); + + // + // Set PcdeMMCHostMaxSpeed + // + PcdSet8 (PcdeMMCHostMaxSpeed, (UINT8) (SystemConfiguration.ScceMMCHostMaxSpeed)); // // Add init steps here diff --git a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf index 526e903..0f11b1c 100644 --- a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf +++ b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf @@ -63,6 +63,7 @@ gPlatformModuleTokenSpaceGuid.PcdBoardVbtFileGuid gPlatformModuleTokenSpaceGuid.PcdSueCreek gPlatformModuleTokenSpaceGuid.PcdMaxPkgCState + gPlatformModuleTokenSpaceGuid.PcdeMMCHostMaxSpeed [Guids] gEfiPlatformInfoGuid diff --git a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c index 6ee7e3d..c1ee6b9 100644 --- a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c +++ b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c @@ -59,6 +59,30 @@ MinnowBoard3PostMemInitCallback ( UINT8 ResetType; UINT8 BtDevice; UINTN BufferSize; + UINT8 MaxSpeed; + UINTN VariableSize; + EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariableServices; + SYSTEM_CONFIGURATION SystemConfiguration; + + VariableSize = sizeof (SYSTEM_CONFIGURATION); + ZeroMem (&SystemConfiguration, sizeof (SYSTEM_CONFIGURATION)); + + (*PeiServices)->LocatePpi ( + (CONST EFI_PEI_SERVICES **)PeiServices, + &gEfiPeiReadOnlyVariable2PpiGuid, + 0, + NULL, + (VOID **) &VariableServices + ); + + VariableServices->GetVariable ( + VariableServices, + PLATFORM_SETUP_VARIABLE_NAME, + &gEfiSetupVariableGuid, + NULL, + &VariableSize, + &SystemConfiguration + ); Status = PeiServicesLocatePpi ( &gBoardPostMemInitDoneGuid, @@ -113,6 +137,17 @@ MinnowBoard3PostMemInitCallback ( PcdSetBool (PcdLogoDisplay, TRUE); // + // Set PcdeMMCHostMaxSpeed + // + if ((SystemConfiguration.ScceMMCHostMaxSpeed == 0) || (SystemConfiguration.ScceMMCHostMaxSpeed == 1)) { + MaxSpeed = EMMC_HS200_MODE; + PcdSet8 (PcdeMMCHostMaxSpeed, (UINT8) MaxSpeed); + } else { + MaxSpeed = EMMC_DDR50_MODE; + PcdSet8 (PcdeMMCHostMaxSpeed, (UINT8) MaxSpeed); + } + + // // Add init steps here // // diff --git a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInitMiscs.h b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInitMiscs.h index 37faf87..3392a03 100644 --- a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInitMiscs.h +++ b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInitMiscs.h @@ -94,6 +94,13 @@ #define SUBSYSTEM_DEVICE_ID 0x1234 #define SUBSYSTEM_SVID_SSID (SUBSYSTEM_VENDOR_ID + (SUBSYSTEM_DEVICE_ID << 16)) +// +// eMMCHostMaxSpeed identifier. +// +#define EMMC_HS400_MODE 0x00 +#define EMMC_HS200_MODE 0x01 +#define EMMC_DDR50_MODE 0x02 + EFI_STATUS Minnow3GetPlatformInfoHob ( IN CONST EFI_PEI_SERVICES **PeiServices, diff --git a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInitPostMem.inf b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInitPostMem.inf index 665a557..801c47f 100644 --- a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInitPostMem.inf +++ b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInitPostMem.inf @@ -62,6 +62,7 @@ gPlatformModuleTokenSpaceGuid.PcdSueCreek gPlatformModuleTokenSpaceGuid.PcdLogoDisplay gPlatformModuleTokenSpaceGuid.PcdBtDevice + gPlatformModuleTokenSpaceGuid.PcdeMMCHostMaxSpeed [Guids] gEfiPlatformInfoGuid diff --git a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/BoardInitPostMem/BoardInit.c b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/BoardInitPostMem/BoardInit.c index cf8523a..cafc777 100644 --- a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/BoardInitPostMem/BoardInit.c +++ b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/BoardInitPostMem/BoardInit.c @@ -58,6 +58,30 @@ MinnowBoard3NextPostMemInitCallback ( UINT8 FabId; UINT8 ResetType; UINTN BufferSize; + UINT8 MaxSpeed; + UINTN VariableSize; + EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariableServices; + SYSTEM_CONFIGURATION SystemConfiguration; + + VariableSize = sizeof (SYSTEM_CONFIGURATION); + ZeroMem (&SystemConfiguration, sizeof (SYSTEM_CONFIGURATION)); + + (*PeiServices)->LocatePpi ( + (CONST EFI_PEI_SERVICES **)PeiServices, + &gEfiPeiReadOnlyVariable2PpiGuid, + 0, + NULL, + (VOID **) &VariableServices + ); + + VariableServices->GetVariable ( + VariableServices, + PLATFORM_SETUP_VARIABLE_NAME, + &gEfiSetupVariableGuid, + NULL, + &VariableSize, + &SystemConfiguration + ); Status = PeiServicesLocatePpi ( &gBoardPostMemInitDoneGuid, @@ -98,6 +122,17 @@ MinnowBoard3NextPostMemInitCallback ( PcdSetPtr(PcdBoardVbtFileGuid, &BufferSize, (UINT8 *)&gPeiMinnow3NextVbtGuid); // + // Set PcdeMMCHostMaxSpeed + // + if ((SystemConfiguration.ScceMMCHostMaxSpeed == 0) || (SystemConfiguration.ScceMMCHostMaxSpeed == 1)) { + MaxSpeed = EMMC_HS200_MODE; + PcdSet8 (PcdeMMCHostMaxSpeed, (UINT8) MaxSpeed); + } else { + MaxSpeed = EMMC_DDR50_MODE; + PcdSet8 (PcdeMMCHostMaxSpeed, (UINT8) MaxSpeed); + } + + // // Add init steps here // // diff --git a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/BoardInitPostMem/BoardInitMiscs.h b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/BoardInitPostMem/BoardInitMiscs.h index fd4d086..c1ced34 100644 --- a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/BoardInitPostMem/BoardInitMiscs.h +++ b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/BoardInitPostMem/BoardInitMiscs.h @@ -87,6 +87,13 @@ #define SUBSYSTEM_DEVICE_ID 0x1234 #define SUBSYSTEM_SVID_SSID (SUBSYSTEM_VENDOR_ID + (SUBSYSTEM_DEVICE_ID << 16)) +// +// eMMCHostMaxSpeed identifier. +// +#define EMMC_HS400_MODE 0x00 +#define EMMC_HS200_MODE 0x01 +#define EMMC_DDR50_MODE 0x02 + EFI_STATUS Minnow3NextGetPlatformInfoHob ( IN CONST EFI_PEI_SERVICES **PeiServices, diff --git a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/BoardInitPostMem/BoardInitPostMem.inf b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/BoardInitPostMem/BoardInitPostMem.inf index be32f93..1a4cc28 100644 --- a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/BoardInitPostMem/BoardInitPostMem.inf +++ b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/BoardInitPostMem/BoardInitPostMem.inf @@ -60,6 +60,7 @@ gPlatformModuleTokenSpaceGuid.PcdFabId gPlatformModuleTokenSpaceGuid.PcdResetType gPlatformModuleTokenSpaceGuid.PcdBoardVbtFileGuid + gPlatformModuleTokenSpaceGuid.PcdeMMCHostMaxSpeed [Guids] gEfiPlatformInfoGuid diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf b/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf index 5ce0cc2..8c1648d 100644 --- a/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf +++ b/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf @@ -86,6 +86,7 @@ gPlatformModuleTokenSpaceGuid.PcdResetType gPlatformModuleTokenSpaceGuid.PcdBoardVbtFileGuid gPlatformModuleTokenSpaceGuid.PcdMaxPkgCState + gPlatformModuleTokenSpaceGuid.PcdeMMCHostMaxSpeed [Ppis] gSiPolicyPpiGuid ## CONSUMES diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspScPolicyInitLib.c b/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspScPolicyInitLib.c index cf3eef2..1a6666e 100644 --- a/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspScPolicyInitLib.c +++ b/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspScPolicyInitLib.c @@ -615,7 +615,8 @@ PeiFspScPolicyInit ( FspsUpd->FspsConfig.UfsEnabled = 0; FspsUpd->FspsConfig.eMMCEnabled = SystemConfiguration->ScceMMCEnabled; FspsUpd->FspsConfig.SdioEnabled = SystemConfiguration->SccSdioEnabled; - FspsUpd->FspsConfig.eMMCHostMaxSpeed = SystemConfiguration->ScceMMCHostMaxSpeed; + FspsUpd->FspsConfig.eMMCHostMaxSpeed = (UINT8) PcdGet8 (PcdeMMCHostMaxSpeed); + FspsUpd->FspsConfig.GppLock = SystemConfiguration->GPPLock; FspsUpd->FspsConfig.SdioTxCmdCntl = 0x505; FspsUpd->FspsConfig.SdioTxDataCntl1 = 0xE; diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf b/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf index d1f8cc2..d5f0a1b 100644 --- a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf +++ b/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf @@ -82,6 +82,7 @@ gEfiBxtTokenSpaceGuid.PcdPmcGcrBaseAddress gPlatformModuleTokenSpaceGuid.PcdResetType gPlatformModuleTokenSpaceGuid.PcdMaxPkgCState + gPlatformModuleTokenSpaceGuid.PcdeMMCHostMaxSpeed [FixedPcd] gPlatformModuleTokenSpaceGuid.PcdFlashAreaSize diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiScPolicyUpdate.c b/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiScPolicyUpdate.c index 9d2c028..d9a991c 100644 --- a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiScPolicyUpdate.c +++ b/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiScPolicyUpdate.c @@ -705,7 +705,7 @@ UpdatePeiScPolicy ( ScsConfig->UfsEnable = 0; ScsConfig->EmmcEnable = SystemConfiguration.ScceMMCEnabled; ScsConfig->SdioEnable = SystemConfiguration.SccSdioEnabled; - ScsConfig->EmmcHostMaxSpeed = SystemConfiguration.ScceMMCHostMaxSpeed; + ScsConfig->EmmcHostMaxSpeed = (UINT8) PcdGet8 (PcdeMMCHostMaxSpeed); ScsConfig->GppLock = SystemConfiguration.GPPLock; ScsConfig->SccEmmcTraceLength = SCC_EMMC_LONG_TRACE_LEN; diff --git a/Platform/BroxtonPlatformPkg/PlatformPkg.dec b/Platform/BroxtonPlatformPkg/PlatformPkg.dec index 7c189a9..f61331f 100644 --- a/Platform/BroxtonPlatformPkg/PlatformPkg.dec +++ b/Platform/BroxtonPlatformPkg/PlatformPkg.dec @@ -197,6 +197,8 @@ gPlatformModuleTokenSpaceGuid.PcdUpdatePcieConfigFunc|2|UINT64|0x8000001A ## SerialIo Uart Configuration #gPlatformModuleTokenSpaceGuid.PcdSerialIoUartNumber|2|UINT8|0x8000001B + ## This PCD used to select eMMCHostMaxSpeed + gPlatformModuleTokenSpaceGuid.PcdeMMCHostMaxSpeed|0x00|UINT8|0x8000001C ## 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.7.0.windows.1