From nobody Mon Feb 9 16:01:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+87097+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87097+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1646036248; cv=none; d=zohomail.com; s=zohoarc; b=KC3iIRgM+Q3a66kHiDtg5HCwyJA79HwqVoocM5oaRL8PdX6bGDVlqeXx4g0mvak9kXIPht78iu4TU1TeQiYlZaBaL4ARzmIBB739KZtxyWssGwICOjlLwnDgkYUUZkfPSxVgj+Mo/LObZcfozkHAi4lJ+KOpLVMBXOEMw0iRwbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646036248; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=u47p63xkG8st3RhCbyQ5BsOE2usLYhBCjVY2739dsF0=; b=QZKoWCSFEx5RLmn3AB83uS99wp8MuqWTw4YdopAkk3Dh2ZroNk4Bt+Q1ehBH/DUFHxfxIlmEhNQsFH/3Phc8vhUgW9ccSeBxTcADTIC5KQgSoH9IBauILDZlhTmRNAwpYZLUA7lW9t5Ee1RtEchcfpZU6vcGcbwBlG1vPBYPz3k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87097+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16460362480481018.6497946938179; Mon, 28 Feb 2022 00:17:28 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id jnX1YY1788612xORLohJWBbj; Mon, 28 Feb 2022 00:17:27 -0800 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web09.17946.1646036246913914182 for ; Mon, 28 Feb 2022 00:17:27 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10271"; a="339269015" X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="339269015" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2022 00:17:26 -0800 X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="550140217" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.238.2.184]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2022 00:17:23 -0800 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Jian J Wang , Liming Gao , Hao A Wu , Ray Ni , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Gerd Hoffmann Subject: [edk2-devel] [PATCH V4 09/10] MdeModulePkg: Update PciEnumeratorSupport to ignore OptionRom if needed Date: Mon, 28 Feb 2022 16:16:30 +0800 Message-Id: <20220228081631.681-10-min.m.xu@intel.com> In-Reply-To: <20220228081631.681-1-min.m.xu@intel.com> References: <20220228081631.681-1-min.m.xu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: W9gwxIyjuOyDrmiZllOwgPf8x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646036247; bh=Nr9UmuMhCBH0UebnTb3PUkPw+67zxFTLkDJtPysgrPU=; h=Cc:Date:From:Reply-To:Subject:To; b=YTjSnF2Zv8JsMQX1tpsEB5ZrR6AoAjkS50sMNYaJNKC1Wp8FIBMCez0G5G9I7pHaHUs 0tB6Ihe6OTKS+LBFsC+CISU3pfEO8Kg0H2LqZt5mRmR/TXGjnVVtrG6F1HhBu/P2tg++V ljkQVSbN0hdUmHS10FM7nDlELyl+P2EmqLQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646036248524100014 Content-Type: text/plain; charset="utf-8" RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3429 Function of UpdatePciInfo() in PciEnumeratorSupport.c is used to update the bar information for those incompatible PCI device. It is the right place to check if the OptionRom need to be ignored. According to "Table 20. ACPI 2.0 & 3.0 QWORD Address Space Descriptor Usage" in PI Spec 1.7, Type-specific flags can be set to 0 when Address Translation Offset =3D=3D 6 to skip device option ROM (do not probe option rom BAR). Cc: Jian J Wang Cc: Liming Gao Cc: Hao A Wu Cc: Ray Ni Cc: Brijesh Singh Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Gerd Hoffmann Signed-off-by: Min Xu Reviewed-by: Ray Ni --- .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 23 +++++++++++++++---- .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.h | 4 +++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeMod= ulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index 9251388bc268..509f828b621d 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -220,8 +220,10 @@ PciSearchDevice ( ) { PCI_IO_DEVICE *PciIoDevice; + BOOLEAN IgnoreOptionRom; =20 - PciIoDevice =3D NULL; + PciIoDevice =3D NULL; + IgnoreOptionRom =3D FALSE; =20 DEBUG (( DEBUG_INFO, @@ -285,7 +287,7 @@ PciSearchDevice ( // // Update the bar information for this PCI device so as to support some = specific device // - UpdatePciInfo (PciIoDevice); + UpdatePciInfo (PciIoDevice, &IgnoreOptionRom); =20 if (PciIoDevice->DevicePath =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; @@ -295,7 +297,7 @@ PciSearchDevice ( // Detect this function has option rom // if (gFullEnumeration) { - if (!IS_CARDBUS_BRIDGE (Pci)) { + if (!IS_CARDBUS_BRIDGE (Pci) && !IgnoreOptionRom) { GetOpRomInfo (PciIoDevice); } =20 @@ -1310,6 +1312,7 @@ DetermineDeviceAttribute ( =20 @param PciIoDevice Input Pci device instance. Output Pci device ins= tance with updated Bar information. + @param IgnoreOptionRom Output If the option rom of incompatible device = need to be ignored. =20 @retval EFI_SUCCESS Successfully updated bar information. @retval EFI_UNSUPPORTED Given PCI device doesn't belong to incompatible = PCI device list. @@ -1317,7 +1320,8 @@ DetermineDeviceAttribute ( **/ EFI_STATUS UpdatePciInfo ( - IN OUT PCI_IO_DEVICE *PciIoDevice + IN OUT PCI_IO_DEVICE *PciIoDevice, + OUT BOOLEAN *IgnoreOptionRom ) { EFI_STATUS Status; @@ -1374,6 +1378,17 @@ UpdatePciInfo ( break; } =20 + // + // According to "Table 20. ACPI 2.0 & 3.0 QWORD Address Space Descript= or Usage" + // in PI Spec 1.7, Type-specific flags can be set to 0 when Address Tr= anslation + // Offset =3D=3D 6 to skip device option ROM (do not probe option rom = BAR). + // + if (((Ptr->AddrTranslationOffset =3D=3D PCI_MAX_BAR) && (Ptr->Specific= Flag =3D=3D 0))) { + *IgnoreOptionRom =3D TRUE; + Ptr++; + continue; + } + for (BarIndex =3D 0; BarIndex < PCI_MAX_BAR; BarIndex++) { if ((Ptr->AddrTranslationOffset !=3D MAX_UINT64) && (Ptr->AddrTranslationOffset !=3D MAX_UINT8) && diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h b/MdeMod= ulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h index 0ded4bea4f89..7daa6e020d09 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h @@ -262,6 +262,7 @@ DetermineDeviceAttribute ( =20 @param PciIoDevice Input Pci device instance. Output Pci device ins= tance with updated Bar information. + @param IgnoreOptionRom Output If the option rom of incompatible device = need to be ignored. =20 @retval EFI_SUCCESS Successfully updated bar information. @retval EFI_UNSUPPORTED Given PCI device doesn't belong to incompatible = PCI device list. @@ -269,7 +270,8 @@ DetermineDeviceAttribute ( **/ EFI_STATUS UpdatePciInfo ( - IN OUT PCI_IO_DEVICE *PciIoDevice + IN OUT PCI_IO_DEVICE *PciIoDevice, + OUT BOOLEAN *IgnoreOptionRom ); =20 /** --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87097): https://edk2.groups.io/g/devel/message/87097 Mute This Topic: https://groups.io/mt/89446698/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-