From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web12.604.1648681276473805373 for ; Wed, 30 Mar 2022 16:01:18 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=TWxUJgYr; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: guo.dong@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648681276; x=1680217276; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=GBo4fVXFjH/l++FIaM5x65eCqnMGFBH3dPRDEKIme2E=; b=TWxUJgYrBctTb1/Uz7PDA4Fz/pxCmpJ1vnXHWoQxtiyZN3zO72bmtLEs V1IQ4DK4SYC8rXOEo4zTVqdbWePRrvbPJAM13H8eGHd3mrl70UJn4QxNJ zWiRQuA7R9PMLbaeWc/vAdj4bVX9TKsH8ZbgE7o211tSr0Gzb9xTTMoJg peUBNorii8zXxoR2gGwuB7XrGglg+iZ9TGECyJ0hPDzWyCEqvv8N2PhrN D86bTvt8KNDjGq4HAlx5IrQ7M17BFzejb1gKP6prMX4S2Qeh49436/eSP wQn1d1kjoqLbIHGb4WEnbJ4QMYPiVObFFIWIuUPeQXPHacTLzOUJP9npX w==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="241817342" X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="241817342" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 16:00:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="522090408" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by orsmga006.jf.intel.com with ESMTP; 30 Mar 2022 16:00:54 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 30 Mar 2022 16:00:54 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 30 Mar 2022 16:00:54 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.104) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.21; Wed, 30 Mar 2022 16:00:54 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hKz7wXUnAzeq9Hs8eBKZowRMgvApcbTxzCeoz4ChkHcrfMq+xEm4cQKQQ76WyXLPWIWgqyJPVkLto+U7ObbJLc5sOvYENF3C1re4DZuHn0Q0kzQKRfKKz/hs8H8sMWfwmrFZ02FTpMuCF9HQdkPxt1wVPtdnLi8K/CLua6u36F5iULRBeAFytHua/mUXzHpJlWeZi3TQevJRPnf74awUSeStY3nO57DzQBMb/ZbsHFFqrT7Zia29vSEoHuSU4e0Iin4e5e4WDWpo2vmapkhHU5xhKznYX1sIiuKxjd7R/QBvDlz/EyhHMgrMnnHZmB9/WS0BE0ruaxqpV5Yn1M2buw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7s62FfcsdByn18AECJh4aXFflIHlkenFBnDkgiqzF/c=; b=aMT6VVO47reAB74jVpMJRJd6Kiw+B17snqqxJ0rYw1oMxXIG4+fjXdMhfgARdsn5aFbfDc+vJLdf+1/RYHAk++c4WpVbfea4P3HWHrRBt7FJepJJyV8NiZA10Rn44oK0J6ol/dyJWrOg4w0Fs+YXcpog+gVezs3dwY+x7YBRyR8CAiBwpY7/Kvcgmr5TFcIdUnpqSeEJwZiyBRkBowNpSEortLvryeU2v/dVc5M0FIxFJU3pjkTxNLZUPS7cHNGcHKIv/aufKGz6cxhvOmWJvYCVv9V+Z4dSUzY+/7+ef3V/u4DoN2dSDOLw0yMSPssGTPxqfuIGKZJ22nG0rk75nw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from BYAPR11MB3622.namprd11.prod.outlook.com (2603:10b6:a03:fe::30) by BN6PR11MB0050.namprd11.prod.outlook.com (2603:10b6:405:68::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.22; Wed, 30 Mar 2022 23:00:43 +0000 Received: from BYAPR11MB3622.namprd11.prod.outlook.com ([fe80::b13f:e635:ce8d:fad1]) by BYAPR11MB3622.namprd11.prod.outlook.com ([fe80::b13f:e635:ce8d:fad1%4]) with mapi id 15.20.5123.019; Wed, 30 Mar 2022 23:00:43 +0000 From: "Guo Dong" To: "Rhodes, Sean" , "devel@edk2.groups.io" CC: "Tan, Lean Sheng" , "Ni, Ray" , "Ma, Maurice" , "You, Benjamin" , "Rhodes, Sean" , "Patrick Rudolph" Subject: Re: [PATCH 1/2] UefiPayloadPkg: Fix PciHostBridgeLib Thread-Topic: [PATCH 1/2] UefiPayloadPkg: Fix PciHostBridgeLib Thread-Index: AQHYRGQaCURbMilQ+k+olpcxgJL5M6zYiyDg Date: Wed, 30 Mar 2022 23:00:43 +0000 Message-ID: References: <5b99fc3587bec6bd7552ec8aeda76501f1a7b935.1648664943.git.sean@starlabs.systems> In-Reply-To: <5b99fc3587bec6bd7552ec8aeda76501f1a7b935.1648664943.git.sean@starlabs.systems> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.401.20 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 06dcdb24-66ae-426b-31d5-08da12a11e59 x-ms-traffictypediagnostic: BN6PR11MB0050:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dZXsJtPqIAEDPvGmpCmThb/M6ED7mr7MKbinLiI5IYiqurhHaZ7HIpnE2ipvnFvupZXoFkUrOo7ZNqVK6VgAeMut/aTbGt+ihMeW7jVGwDUoLm2JvgiCL0ITAo0yPMBa3X2fkgLnjUO51S6Q4dAj2mKb3hY9ql8kbVkPMaVjF+CG3lZwAO/eiraaoxuR1y3gdWJV/kwUZW1qWiJD6li1/aQPIuCZdWk/lPh29TjhUZqJtij4AmpirOX4wTWhTywIgFxruTip/J8fdZuVcsRojDOk0BNgOjaai2YTe7PSf0aY6mAl95dimM4ViBziIhh2njhQqbHJvj0La128heP/5m1qx/Kmdxom1v0vugmyBWpO16MOt3Wh3s8DPgQl76tOGRvb00EAw8d3Wge5u5w+gTaj+XR7g63BBVzDEd/Z2OqqOyi27rxs/ZpcuMzaGaeIkeDqfnvwdBviFj/Hh31SRTota9r0+y6t+MLWR9QKShSfz1BtVJc3iWxwAUmmqgXlj4EguefTSucWTyq9N04UbLz/Vi4EPfc0O8qihyDdjVYwNlrQi7OiAgso4Y1NnoQSPO47SqcB3pAoyQvODoWZV+Tfq8YLCFFV2J5PriCvgrhYunUH4s6PHG/CdR1MvOztbYJc7XbFSKGBoQUxupP7krrXXz72sbh1/ZHUactbGxzbAAgfPEnzrk3XEVGJGJMlmKe2dc5ve8D0xAP3SJYlXA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR11MB3622.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(9686003)(38100700002)(4326008)(6506007)(82960400001)(508600001)(55016003)(122000001)(186003)(54906003)(7696005)(2906002)(38070700005)(71200400001)(64756008)(86362001)(66946007)(53546011)(66476007)(66446008)(8936002)(83380400001)(76116006)(8676002)(52536014)(66556008)(33656002)(110136005)(316002)(5660300002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 2 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?KbwVFuMtPe+JyzLjibo1r2E+cfqIDh0cbz8DHaIyL7+vDnRV3yt+beyRYyOl?= =?us-ascii?Q?ExaGzKTNo/ac6+YT0Cef7uGTLk8xwPpAcI3FZi+6AjHCRxdcMvo/U+/ghkya?= =?us-ascii?Q?4AYOUfBrFFgvL+brYkzcofhWpeL+mGFe6jNZmBUF3r+Z5dM9qNfAPCEObwsT?= =?us-ascii?Q?sk66sD9gRS943uZysSKM7P6MVDaX9g8hWo64YiUwKl4+41dCakNrKuzae26d?= =?us-ascii?Q?4avXSHamSdBTvza7c2ac2VTWhB3LKMbyvN9SK63GGOn6+yYZqKQ0AfVUtJpJ?= =?us-ascii?Q?q9K0AfX1oEa13rzD3XovTMNt7LCBb/sOfxVpaiAEmVA7PGM5HR95Afg3iBvs?= =?us-ascii?Q?h0uVOyOrNxE4GgqjDPO7k6wstvROWadoHuGce7TCIw3Q4t7LlqtvfO1ChxY6?= =?us-ascii?Q?oxLTWKfU3yoBJFIqNuFllbyozcFGnhl8BrlUGP1R6LNDP7pucR+yR4bPJRU9?= =?us-ascii?Q?3Wv7meuNoyJS8ev3xIOB+S66WyDYGynwX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sznKb3gC1JGVTqLWrbqP1ZthO2ThdrhTyXaG6GwmJEEdn3G4Vj+NAsPP?= =?us-ascii?Q?VY7BVJnCpjEacJTEvayl/5p0HNlYDMcM36WUXT6tcR/d0W3+tQpwfuQXjtLe?= =?us-ascii?Q?Wbfjr5PfpF9APHfaBxpz+8KfvvCh+RVUcC9OtUQaF0RxoUsf0hRATT/si4Cz?= =?us-ascii?Q?u7mg4rWRIo5tljX7+DciczG0xh+J2CssSMfRR6fH1p4AkblBevSYYCfiIm+x?= =?us-ascii?Q?vYNpqTgW9HHvdaFhUrCf/2exC6FI0GDFjOYvt9wAth5miQM/Htl3lvKZ+Iw9?= =?us-ascii?Q?icNasLcmMttzaHkWG+z1k9VINrRpsI7PxC+eCDgqyhPpaawvDfOVRZM5yVUl?= =?us-ascii?Q?WMViSkhgL6VUEZvZcwtlOX0PKI5PHZ+LCUjE47z5gji3ELrSfdWnIGZkkzxw?= x-ms-exchange-antispam-messagedata-1: GiTXXZuB19nHEQ== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3622.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06dcdb24-66ae-426b-31d5-08da12a11e59 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Mar 2022 23:00:43.2824 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: iTBtKbxm+uPNP1lXATIQwaDXTb1Rdv1PbzN1NRpkretdJi11QwJ7HRbO9y6sL2RAkC4FLkuKLag07tS8KYcHLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB0050 Return-Path: guo.dong@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Guo Dong -----Original Message----- From: Sean Rhodes =20 Sent: Wednesday, March 30, 2022 11:29 AM To: devel@edk2.groups.io Cc: Tan, Lean Sheng ; Dong, Guo ; Ni, Ray ; Ma, Maurice ; You, Be= njamin ; Rhodes, Sean ; Patr= ick Rudolph Subject: [PATCH 1/2] UefiPayloadPkg: Fix PciHostBridgeLib From: Lean Sheng Tan 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 ass= igned to. Fixes assertion "ASSERT [PciHostBridgeDxe] Bridge->MemAbove4G.Base >=3D 0x0000000100000000U= LL". Tested with coreboot as bootloader on platforms that have PCI resource abov= e 4GiB and on platforms that don't have resource above 4GiB. Cc: Guo Dong Cc: Ray Ni Cc: Maurice Ma Cc: Benjamin You Cc: Sean Rhodes Signed-off-by: Patrick Rudolph --- .../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 =3D ((UINT32)Pci.Bridge.PrefetchableMemoryBase & 0xfff0) <= < 16; Limit =3D (((UINT32)Pci.Bridge.PrefetchableMemoryLimit & 0x= fff0) << 16) | 0xfffff;- MemAperture =3D &Mem;+= if (Value =3D=3D BIT0) {- Base |=3D LShiftU64 (= Pci.Bridge.PrefetchableBaseUpper32, 32);- Limit |=3D LShift= U64 (Pci.Bridge.PrefetchableLimitUpper32, 32);- MemAperture =3D = &MemAbove4G;+ Base |=3D LShiftU64 (Pci.Bridge.PrefetchableBaseU= pper32, 32);+ Limit |=3D LShiftU64 (Pci.Bridge.PrefetchableLimit= Upper32, 32); } if ((Base > 0) && (Base < Limit)) {+ = if (Base < BASE_4GB) {+ MemAperture =3D &Mem;+ = } else {+ MemAperture =3D &MemAbove4G;+ }+ = if (MemAperture->Base > Base) { MemAperture->Base = =3D Base; }--=20 2.32.0