From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7D42D211A1E20 for ; Thu, 13 Dec 2018 04:48:29 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Dec 2018 04:48:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,349,1539673200"; d="scan'208";a="283284879" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 13 Dec 2018 04:48:27 -0800 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 13 Dec 2018 04:48:28 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 13 Dec 2018 04:48:27 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.203]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.59]) with mapi id 14.03.0415.000; Thu, 13 Dec 2018 20:48:26 +0800 From: "Wu, Hao A" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] MdeModulePkg/PciBus: Fix system hang when no PCI Option ROM exists Thread-Index: AQHUkiyVOQR4nLFAUUCqYfW0OYZIEqV8n81w Date: Thu, 13 Dec 2018 12:48:25 +0000 Message-ID: References: <20181212151015.117308-1-ruiyu.ni@intel.com> In-Reply-To: <20181212151015.117308-1-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/PciBus: Fix system hang when no PCI Option ROM exists X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2018 12:48:29 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Ruiyu Ni > Sent: Wednesday, December 12, 2018 11:10 PM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A > Subject: [edk2] [PATCH] MdeModulePkg/PciBus: Fix system hang when no > PCI Option ROM exists >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1394 >=20 > When there is no PCI option ROM exists, today's logic still creates > virtual BAR for option ROM using Length =3D 0, Alignment =3D (-1). > It causes the final MEM32 alignment requirement is as big as > 0xFFFFFFFF_FFFFFFFF. >=20 > The patch fixes this issue by only creating virtual BAR for option > ROM when there is PCI option ROM. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ruiyu Ni > Cc: Chiu Chasel > Cc: Hao A Wu > Cc: Jian J Wang > --- > MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c > index 7255bcfbbc..ee5c77147e 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c > @@ -515,10 +515,12 @@ PciHostBridgeResourceAllocator ( > // All devices' Option ROM share the same MEM32 resource. > // > MaxOptionRomSize =3D GetMaxOptionRomSize (RootBridgeDev); > - RootBridgeDev->PciBar[0].BarType =3D PciBarTypeOpRom; > - RootBridgeDev->PciBar[0].Length =3D MaxOptionRomSize; > - RootBridgeDev->PciBar[0].Alignment =3D MaxOptionRomSize - 1; > - GetResourceFromDevice (RootBridgeDev, IoBridge, Mem32Bridge, > PMem32Bridge, Mem64Bridge, PMem64Bridge); > + if (MaxOptionRomSize !=3D 0) { > + RootBridgeDev->PciBar[0].BarType =3D PciBarTypeOpRom; > + RootBridgeDev->PciBar[0].Length =3D MaxOptionRomSize; > + RootBridgeDev->PciBar[0].Alignment =3D MaxOptionRomSize - 1; > + GetResourceFromDevice (RootBridgeDev, IoBridge, Mem32Bridge, > PMem32Bridge, Mem64Bridge, PMem64Bridge); > + } Reviewed-by: Hao Wu Best Regards, Hao Wu >=20 > // > // Create resourcemap by going through all the devices subject to = this > root bridge > -- > 2.16.1.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel