public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Guo Dong" <guo.dong@intel.com>
To: "Rhodes, Sean" <sean@starlabs.systems>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Tan, Lean Sheng" <sheng.tan@9elements.com>,
	"Ni, Ray" <ray.ni@intel.com>,
	"Ma, Maurice" <maurice.ma@intel.com>,
	"You, Benjamin" <benjamin.you@intel.com>,
	"Rhodes, Sean" <sean@starlabs.systems>,
	"Patrick Rudolph" <patrick.rudolph@9elements.com>
Subject: Re: [PATCH 1/2] UefiPayloadPkg: Fix PciHostBridgeLib
Date: Wed, 30 Mar 2022 23:00:43 +0000	[thread overview]
Message-ID: <BYAPR11MB3622FFD285F2FC09426979E99E1F9@BYAPR11MB3622.namprd11.prod.outlook.com> (raw)
In-Reply-To: <5b99fc3587bec6bd7552ec8aeda76501f1a7b935.1648664943.git.sean@starlabs.systems>


Reviewed-by: Guo Dong <guo.dong@intel.com>

-----Original Message-----
From: Sean Rhodes <sean@starlabs.systems> 
Sent: Wednesday, March 30, 2022 11:29 AM
To: devel@edk2.groups.io
Cc: Tan, Lean Sheng <sheng.tan@9elements.com>; Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Ma, Maurice <maurice.ma@intel.com>; You, Benjamin <benjamin.you@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Patrick Rudolph <patrick.rudolph@9elements.com>
Subject: [PATCH 1/2] UefiPayloadPkg: Fix PciHostBridgeLib

From: Lean Sheng Tan <sheng.tan@9elements.com>

Don't assume a 64bit register always holds an address greater than 4GB.
Check the value in the register and decide which Aperature it should be assigned to.

Fixes assertion
"ASSERT [PciHostBridgeDxe] Bridge->MemAbove4G.Base >= 0x0000000100000000ULL".

Tested with coreboot as bootloader on platforms that have PCI resource above 4GiB and on platforms that don't have resource above 4GiB.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
---
 .../Library/PciHostBridgeLib/PciHostBridgeSupport.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
index 8a890b6b53..e1faa24ae7 100644
--- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
+++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
@@ -354,14 +354,19 @@ ScanForRootBridges (
           Base  = ((UINT32)Pci.Bridge.PrefetchableMemoryBase & 0xfff0) << 16;           Limit = (((UINT32)Pci.Bridge.PrefetchableMemoryLimit & 0xfff0)                    << 16) | 0xfffff;-          MemAperture = &Mem;+           if (Value == BIT0) {-            Base       |= LShiftU64 (Pci.Bridge.PrefetchableBaseUpper32, 32);-            Limit      |= LShiftU64 (Pci.Bridge.PrefetchableLimitUpper32, 32);-            MemAperture = &MemAbove4G;+            Base  |= LShiftU64 (Pci.Bridge.PrefetchableBaseUpper32, 32);+            Limit |= LShiftU64 (Pci.Bridge.PrefetchableLimitUpper32, 32);           }            if ((Base > 0) && (Base < Limit)) {+            if (Base < BASE_4GB) {+              MemAperture = &Mem;+            } else {+              MemAperture = &MemAbove4G;+            }+             if (MemAperture->Base > Base) {               MemAperture->Base = Base;             }-- 
2.32.0


      parent reply	other threads:[~2022-03-30 23:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30 18:29 [PATCH 1/2] UefiPayloadPkg: Fix PciHostBridgeLib Sean Rhodes
2022-03-30 18:29 ` [PATCH 2/2] OvmfPkg: Fix PciHostBridgeLibScan Sean Rhodes
2022-03-31  6:25   ` [edk2-devel] " Ard Biesheuvel
2022-05-17 12:08     ` Sheng Lean Tan
2022-03-30 18:29 ` [PATCH 1/2] UefiPayloadPkg: Fix PciHostBridgeLib Sean Rhodes
2022-03-30 23:00 ` Guo Dong [this message]

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=BYAPR11MB3622FFD285F2FC09426979E99E1F9@BYAPR11MB3622.namprd11.prod.outlook.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