* [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Set Speed.
@ 2017-11-30 7:31 lushifex
0 siblings, 0 replies; only message in thread
From: lushifex @ 2017-11-30 7:31 UTC (permalink / raw)
To: edk2-devel; +Cc: david.wei
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 <shifeix.a.lu@intel.com>
---
.../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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-11-30 7:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-30 7:31 [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Set Speed lushifex
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox