public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/PciHostBridge: Update Mem and PMem Limit Checks
@ 2020-04-23 10:43 Wasim Khan
  2020-04-23 11:36 ` Ni, Ray
  2020-04-23 18:56 ` Ard Biesheuvel
  0 siblings, 2 replies; 11+ messages in thread
From: Wasim Khan @ 2020-04-23 10:43 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, v.sethi, hao.a.wu, ray.ni, Wasim Khan

With Address Translation Support, it is possible and
also correct that Mem and Pmem Limit cross the 4GB boundary.
Update the checks so that Mem/PMem Limit should not cross 4GB
from the Mem/PMem Base address.

Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
---
 MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
index d304fae..9cf7e98 100644
--- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
+++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
@@ -117,8 +117,8 @@ CreateRootBridge (
   // Make sure Mem and MemAbove4G apertures are valid
   //
   if (RESOURCE_VALID (&Bridge->Mem)) {
-    ASSERT (Bridge->Mem.Limit < SIZE_4GB);
-    if (Bridge->Mem.Limit >= SIZE_4GB) {
+    ASSERT (Bridge->Mem.Limit < (Bridge->Mem.Base + SIZE_4GB));
+    if (Bridge->Mem.Limit >= (Bridge->Mem.Base + SIZE_4GB)) {
       return NULL;
     }
   }
@@ -129,8 +129,8 @@ CreateRootBridge (
     }
   }
   if (RESOURCE_VALID (&Bridge->PMem)) {
-    ASSERT (Bridge->PMem.Limit < SIZE_4GB);
-    if (Bridge->PMem.Limit >= SIZE_4GB) {
+    ASSERT (Bridge->PMem.Limit < (Bridge->PMem.Base + SIZE_4GB));
+    if (Bridge->PMem.Limit >= (Bridge->PMem.Base + SIZE_4GB)) {
       return NULL;
     }
   }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-04-24  7:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-23 10:43 [PATCH] MdeModulePkg/PciHostBridge: Update Mem and PMem Limit Checks Wasim Khan
2020-04-23 11:36 ` Ni, Ray
2020-04-23 13:52   ` Wasim Khan
2020-04-23 14:28     ` [edk2-devel] " Ni, Ray
2020-04-23 14:53       ` Wasim Khan
2020-04-23 15:17         ` Ni, Ray
2020-04-23 16:04           ` Wasim Khan
2020-04-23 18:56 ` Ard Biesheuvel
2020-04-24  4:35   ` Wasim Khan
2020-04-24  6:07     ` [edk2-devel] " Ard Biesheuvel
2020-04-24  7:32       ` Wasim Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox