summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c7
-rw-r--r--MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHci.c8
-rw-r--r--MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHci.c8
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.
//