From nobody Mon Feb 9 09:51:56 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+87517+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+87517+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1647132123; cv=none; d=zohomail.com; s=zohoarc; b=UO+DutRRwP2I2Uzd19O1wSqWOLgghbgUylPG8aVUTOfDvzca1tHDrVjC6DAmenYiJyqLbkE2qdYlINM+hGIK6gHHHS0zXahQmFIZeIs9P64rIXV7tWe9vDqn00YeHpGcDXe6v7fKlCjlqek2zvoT05d9NN05BaUr67H7LjvCNJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647132123; 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=dOXV95rQORlqObio8MwUqmNz+YOWizJUESSJ1/o6tzE=; b=gZiNji7xyiVGxHge3RuNBdvl3fvHEa3naB63S2eQ8v4szCJAVVq6GCnHnrGYBi8VbKL4TVm4N8IiUMLfSDfL+BwtFP8wldYCY5VWzItLryNCgYtLl+2NJSOdsN/tK17lHO1vyh92xNgB8udDi4FNpt0hxWs72CVSRqn3gxnKYnc= 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+87517+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 1647132123253448.9439602616095; Sat, 12 Mar 2022 16:42:03 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id E7NXYY1788612xukIqUaWwpE; Sat, 12 Mar 2022 16:42:02 -0800 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.11061.1647132122144666718 for ; Sat, 12 Mar 2022 16:42:02 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10284"; a="255781193" X-IronPort-AV: E=Sophos;i="5.90,177,1643702400"; d="scan'208";a="255781193" X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2022 16:41:55 -0800 X-IronPort-AV: E=Sophos;i="5.90,177,1643702400"; d="scan'208";a="539479422" X-Received: from xshi3x-mobl.ccr.corp.intel.com (HELO mxu9-mobl1.ccr.corp.intel.com) ([10.249.171.182]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2022 16:41:49 -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 V5 09/10] MdeModulePkg: Update PciEnumeratorSupport to ignore OptionRom if needed Date: Sun, 13 Mar 2022 08:41:10 +0800 Message-Id: <20220313004111.388-10-min.m.xu@intel.com> In-Reply-To: <20220313004111.388-1-min.m.xu@intel.com> References: <20220313004111.388-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: OqIOKuentE2Ds09wvkunQc0fx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1647132122; bh=53C7Ms/bgNYlPYx53xcYJ7WyhNsPHIgQ9oxtZzOCePI=; h=Cc:Date:From:Reply-To:Subject:To; b=X8BBAClZFhHiDYE+4n3qeC7NcC1+3qhu/0+0QLAKzlio8N9qTOVErUYlfELEKpQfIQF 5ME9I5MEfQSsnanEoW3dJzRdXCUxdMP2J3Dqas42qqxt+2GItZTy/KkPB7WthkMM9lt3R dK0+ZnZl6g1UXb79OGe8y/n0CzeJxEuqpZg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1647132125395100001 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 Acked-by: Gerd Hoffmann --- .../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 (#87517): https://edk2.groups.io/g/devel/message/87517 Mute This Topic: https://groups.io/mt/89743616/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-