From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web12.9658.1647610869854058256 for ; Fri, 18 Mar 2022 06:41:10 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=McRO85Jg; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647610869; x=1679146869; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=agCNbTH4C/Xe3wZQArI2Sf67ySKjoDl6nek76HwsGZE=; b=McRO85JgOZSnnU/+0By2GmO7k74a2wGd6LNkK7RDRku8MUjSLgzTb6mG j8IAtjpJulkf0Mrv8vQpIVPQqr21c8HkihpfXamk/7gBoxCVxSsFtdV4d A+QObfACMNZpv7cevWOZ84z0czhKVagRWBQK6c9Qy0BTvTe2G27CU9t4A vN8nIgonbn2ENqYbQD9zTkMugr7va0UwOV498/HhaFQyWVpWBNHJbjyaU HeY9lnZRmdpiH/SUnQe+8lc9hHImRC1aZcQZnnsfbTWrAchpAdkZV50eS PZw8Htsm9Z2N0uzA4oHL5uDG4KAKcCyaSgkf3fnDxJWse/h5IZAvjw0qx A==; X-IronPort-AV: E=McAfee;i="6200,9189,10289"; a="256864330" X-IronPort-AV: E=Sophos;i="5.90,192,1643702400"; d="scan'208";a="256864330" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2022 06:41:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,192,1643702400"; d="scan'208";a="822298349" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga005.fm.intel.com with ESMTP; 18 Mar 2022 06:41:06 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 18 Mar 2022 06:41:06 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21 via Frontend Transport; Fri, 18 Mar 2022 06:41:06 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.40) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.21; Fri, 18 Mar 2022 06:41:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dvt/rOkQxj9LhFbUP5atVwrxRl2S09BkC2JR526shBwBEHqN5xHtuZeLTQFwtaYKXrLAsP0tx4EfjEaFqohrQF9844GAQ1fQU8bX3TaTzOeh64MC3plOJ86nUHMlDA/Weoqj66ngW9I1jKHUusu1CwEDZDUcMDz52CBdLaqRVkx6Gkkp2Ujyg/A7QeK0dwNlmTrQRyJ0swpxgGAhm5uqDgBES8Z2egbouqtZVO+LqwbJMBtnrUv17kX3w3hw7YJCwd+TLvCx2IFbTeoFcd4u42n6RnEEYBKqVKlfwtnQeQ+oRMFpN7OlBy+ipwAn4kuP54MCRgwf5JsnEN3TMlJ8/g== 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=NsM7Uwni51ZWB4KYzaYbSnRarFqN6sOBAi2w6maInIs=; b=NrXE3bwV/s2AcbowXQOWmkwB2nuaUrNrznVyvhcFWsNVRp6T+oV4ANQ8vHqyFZmMgNFHWMrjsalMjn7SYOIEDILwCd/qKpXofl8uIaXvHYjiOr9D5qTbSEGTn7lALEXsFgRPSOuAQDTqFUd/oc2OPjhkRawzNWyM16TAcTq84B4MHFVlTJMzAi0LUEEI3cvimARt2wSLZE6bMa44wthxDV6rHDN+sK80glIeYQ3aJdjxySCEukahiFu4y+w30dQ0pTaG95rtfG9kqc6Wi9tBTIQsWFWN7KxutqUzqlgJcXzBD1HoM6ngf1d90qM+6qZwG/KHuBL4Tj0bneT/j8CfrQ== 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 MWHPR11MB1631.namprd11.prod.outlook.com (2603:10b6:301:10::10) by SA2PR11MB4907.namprd11.prod.outlook.com (2603:10b6:806:111::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Fri, 18 Mar 2022 13:41:04 +0000 Received: from MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::30a3:3926:64ca:50d5]) by MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::30a3:3926:64ca:50d5%8]) with mapi id 15.20.5081.018; Fri, 18 Mar 2022 13:41:04 +0000 From: "Ni, Ray" To: "Xu, Min M" , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Gao, Liming" , "Wu, Hao A" , Brijesh Singh , "Aktas, Erdem" , "James Bottomley" , "Yao, Jiewen" , "Tom Lendacky" , Gerd Hoffmann Subject: Re: [PATCH V4 09/10] MdeModulePkg: Update PciEnumeratorSupport to ignore OptionRom if needed Thread-Topic: [PATCH V4 09/10] MdeModulePkg: Update PciEnumeratorSupport to ignore OptionRom if needed Thread-Index: AQHYLHupbp2cFlo05kKu/iGwXeu5FKzFQpbQ Date: Fri, 18 Mar 2022 13:41:04 +0000 Message-ID: References: <20220228081631.681-1-min.m.xu@intel.com> <20220228081631.681-10-min.m.xu@intel.com> In-Reply-To: <20220228081631.681-10-min.m.xu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: d91d71bb-61ff-4761-0ebc-08da08e4f2d3 x-ms-traffictypediagnostic: SA2PR11MB4907: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: dRbZMT8W6UH3aQPaAQYi3ILahBCg/Z8yMfOsBH8/mjbWW4W6gJ9NwtjSfYJwyeeFfZK90uFvEsYATibe5geIOy8XFWtN8f2CGBr3UyE+IqeJEW+A33z2yaPMwfFvH2DRBtNFWYBT5+6GMT5yFMFAASZo2vg/609GmygMTsDeBn1K24F88pk4cpSlJjPIBU8UzOJCYCblTSaYHRRMM6A8MALCPRCF2e33qkPWy251y4R862IuzouODLtt+pFRiBw1lLUaTeHTxs9T8MSEYdfiJGl/klEo0Sh7DQA6iQ2evzk5514NQDVvMqWcW6QOycDhmewthQdze5769P8HPeBpg96wKrQqFzQI1FXGavg4u5U8z9UiInulgutQw8sta4hOUoOmjX9EJtm4hxJCzjxuEXYpe3Oq4Yn4rZc4tX3/l6iBUZ5ch2TM/lNH9pwEBTIAUV5rB0jdIGHOGpJ8IkrWBh6IrKgeU0D9XBLKxfULgX0nFbZG27kknm4UCkzxUzWA9/uqCUYsxiRdSS9YFXYR18o8VwF7BGf3Q0qf5NqCks0mN31aadD7bXkVpzxbuNZ4Cyci5U9+Yv5ZJll8EcS/X2eFr1m6OqOjrOnwK0NNedt6wpuG9w6M8PMCzBLp2G2ctPY8L8YynoCtXyF4aKBXZcr8c0yR1dQNy6S5KngNIMxY8J9YJ/EL+9FwmG8m61+UZfJsnVuBg4O1KYW4EpTDn+UmOszUgfmGsioCLqINRkhqGUqMgRq5qWPd4JzN/+qOhQ5c3uWq9lOaTZFFxqF3Bcb2/8Uzy09qbbF7Q5pzsnk= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1631.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(110136005)(316002)(71200400001)(55016003)(54906003)(33656002)(15650500001)(2906002)(508600001)(83380400001)(966005)(6506007)(4326008)(5660300002)(38070700005)(7696005)(53546011)(8676002)(64756008)(66446008)(66946007)(66556008)(66476007)(76116006)(122000001)(82960400001)(186003)(38100700002)(26005)(52536014)(9686003)(8936002)(86362001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?UsZ77nV2Si95v26Kmb+bPBXZjr7bmmEpYXlU58B90gczpqzeXvm7Ea6VevoG?= =?us-ascii?Q?yIhpOkccQR3ZGotjtywKDdelRY/F5W4XuinrDl3TrR+tR/wchkDLi9ETnAjd?= =?us-ascii?Q?n7INNAGd6mW6ZuEz8354Pfa3UBGs7eNwgwNTFV0jciBxqeML7hVc75DazD7J?= =?us-ascii?Q?fm+Cr7weOCoVTPlUJGv7eQTUI05PKZ2fXvycqCrjbYgUVGZjza16BbPmviWc?= =?us-ascii?Q?shTrqmTsrJ+JcVyGBPrwfwEqgiQJ4PSQUAqeg85uHJWZJJXGVIBV68eO/r7s?= =?us-ascii?Q?P6vygsUbIpeoUSi5Y6svesG0jynNSp5KGVZ/SonDqMfOvQYqdoX8odjYQrk/?= =?us-ascii?Q?V08l/4UiD9rhskzsSG34KSyxj0To+X8S+MuLXzH310AOSTJE3zwD6NzlTBfP?= =?us-ascii?Q?QfHbCtuc7DC3ZAdj0j78sNUowp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LAwYVeShIqlbkJnUNux4iyx9/tTiciKdKiBOUzlhRnTBDkkh0Vr2jow2?= =?us-ascii?Q?gpSmVAIsoY8NCpp3hpujS0w5Sd8TZkB5kFO9Hk3W1NHwTMkJPB7DaondxpYB?= =?us-ascii?Q?QQy8Qq+gmKKUX/KEJhoVf5dLiDC+cdKz?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1631.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d91d71bb-61ff-4761-0ebc-08da08e4f2d3 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Mar 2022 13:41:04.4111 (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: Niya4LaIkc2i4EW/+uG63NirCtlxhWY9z50UK9/HCGvFUOVryztLe7R0LockO87m2GjzLVcU3CQYFVrasNiuHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB4907 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni -----Original Message----- From: Xu, Min M =20 Sent: Monday, February 28, 2022 4:17 PM To: devel@edk2.groups.io Cc: Xu, Min M ; Wang, Jian J ; G= ao, Liming ; Wu, Hao A ; Ni, = Ray ; Brijesh Singh ; Aktas, Erdem= ; James Bottomley ; Yao, Jiewen= ; Tom Lendacky ; Gerd Hoffm= ann Subject: [PATCH V4 09/10] MdeModulePkg: Update PciEnumeratorSupport to igno= re OptionRom if needed 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 t= o 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 Translat= ion 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 --- .../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 UpdatePc= iInfo ( - 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/MdeM= odulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h b/MdeModulePkg/Bus/Pci/Pc= iBusDxe/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 UpdatePciI= nfo ( - IN OUT PCI_IO_DEVICE *PciIoDevice + IN OUT PCI_IO_DEVICE *PciIoDevice, + OUT BOOLEAN *IgnoreOptionRom ); =20 /** -- 2.29.2.windows.2