public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wasim Khan" <wasim.khan@nxp.com>
To: devel@edk2.groups.io
Cc: ard.biesheuvel@linaro.org, v.sethi@nxp.com, hao.a.wu@intel.com,
	ray.ni@intel.com, Wasim Khan <wasim.khan@nxp.com>
Subject: [PATCH] MdeModulePkg/PciHostBridge: Update Mem and PMem Limit Checks
Date: Thu, 23 Apr 2020 16:13:32 +0530	[thread overview]
Message-ID: <1587638612-13056-1-git-send-email-wasim.khan@nxp.com> (raw)

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


             reply	other threads:[~2020-04-23 10:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23 10:43 Wasim Khan [this message]
2020-04-23 11:36 ` [PATCH] MdeModulePkg/PciHostBridge: Update Mem and PMem Limit Checks 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1587638612-13056-1-git-send-email-wasim.khan@nxp.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox