From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jian.j.wang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 6F24B2119EF57 for ; Wed, 12 Dec 2018 17:39:40 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Dec 2018 17:39:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,346,1539673200"; d="scan'208";a="127436258" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 12 Dec 2018 17:39:40 -0800 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 12 Dec 2018 17:39:39 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 12 Dec 2018 17:39:39 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.59]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.222]) with mapi id 14.03.0415.000; Thu, 13 Dec 2018 09:39:37 +0800 From: "Wang, Jian J" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Chiu, Chasel" , "Wu, Hao A" Thread-Topic: [PATCH] MdeModulePkg/PciBus: Fix system hang when no PCI Option ROM exists Thread-Index: AQHUkiyl5T7XY8v0fEGeIfMcSUq3i6V75PVg Date: Thu, 13 Dec 2018 01:39:37 +0000 Message-ID: References: <20181212151015.117308-1-ruiyu.ni@intel.com> In-Reply-To: <20181212151015.117308-1-ruiyu.ni@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDVlNGQyN2MtYWNiYS00MjI3LWI4Y2MtYjYzODdiMzgwNzE4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZGI3dFFKRkRHUnJ1ak9wS2FhQmNmc2ZXdkJIM3BJemVFeWQ3TVwvMEhicitcL0tTcGJ3dThmS0pRd25Ed1pjK20wIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action 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 01:39:40 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jian J Wang > -----Original Message----- > From: Ni, Ruiyu > Sent: Wednesday, December 12, 2018 11:10 PM > To: edk2-devel@lists.01.org > Cc: Chiu, Chasel ; Wu, Hao A ; > Wang, Jian J > Subject: [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); > + } >=20 > // > // Create resourcemap by going through all the devices subject to = this root > bridge > -- > 2.16.1.windows.1