diff options
author | Feng Tian <feng.tian@intel.com> | 2016-04-29 14:39:30 +0800 |
---|---|---|
committer | Feng Tian <feng.tian@intel.com> | 2016-05-06 16:09:59 +0800 |
commit | cb9cb9e2aaec95f89f3c0dfc411226aa6c42461a (patch) | |
tree | 36fe78994ab6714715f5abdb99ad8403ccdc3c03 /MdeModulePkg | |
parent | c25ddd0134be8756ff249cb5467a917a6a50c307 (diff) | |
download | edk2-platforms-cb9cb9e2aaec95f89f3c0dfc411226aa6c42461a.tar.xz |
MdeModulePkg/SdMmcPciHcDxe: Use BaseClk if the target clock is larger
The original code has a bug to calculate which clock freq should be
used when the target clock freq is larger than the BaseClock Freq
provided by the system.
Cc: Wu, Hao A <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 7 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHci.c | 8 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHci.c | 8 |
3 files changed, 20 insertions, 3 deletions
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c index baa12f44ee..72af1e7a1b 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c @@ -706,9 +706,14 @@ SdMmcHcClockSupply ( ASSERT (Capability.BaseClkFreq != 0);
BaseClkFreq = Capability.BaseClkFreq;
- if ((ClockFreq > (BaseClkFreq * 1000)) || (ClockFreq == 0)) {
+ if (ClockFreq == 0) {
return EFI_INVALID_PARAMETER;
}
+
+ if (ClockFreq > (BaseClkFreq * 1000)) {
+ ClockFreq = BaseClkFreq * 1000;
+ }
+
//
// Calculate the divisor of base frequency.
//
diff --git a/MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHci.c b/MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHci.c index 050d843176..569a86a6e1 100644 --- a/MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHci.c +++ b/MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHci.c @@ -535,9 +535,15 @@ EmmcPeimHcClockSupply ( ASSERT (Capability.BaseClkFreq != 0);
BaseClkFreq = Capability.BaseClkFreq;
- if ((ClockFreq > (BaseClkFreq * 1000)) || (ClockFreq == 0)) {
+
+ if (ClockFreq == 0) {
return EFI_INVALID_PARAMETER;
}
+
+ if (ClockFreq > (BaseClkFreq * 1000)) {
+ ClockFreq = BaseClkFreq * 1000;
+ }
+
//
// Calculate the divisor of base frequency.
//
diff --git a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHci.c b/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHci.c index cbee947993..48e4ae68ca 100644 --- a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHci.c +++ b/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHci.c @@ -535,9 +535,15 @@ SdPeimHcClockSupply ( ASSERT (Capability.BaseClkFreq != 0);
BaseClkFreq = Capability.BaseClkFreq;
- if ((ClockFreq > (BaseClkFreq * 1000)) || (ClockFreq == 0)) {
+
+ if (ClockFreq == 0) {
return EFI_INVALID_PARAMETER;
}
+
+ if (ClockFreq > (BaseClkFreq * 1000)) {
+ ClockFreq = BaseClkFreq * 1000;
+ }
+
//
// Calculate the divisor of base frequency.
//
|