From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web12.14424.1632623201607928892 for ; Sat, 25 Sep 2021 19:26:42 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=Oy9Rkqeo; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: ray.ni@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10118"; a="246788193" X-IronPort-AV: E=Sophos;i="5.85,322,1624345200"; d="scan'208";a="246788193" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2021 19:26:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,322,1624345200"; d="scan'208";a="560394953" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga002.fm.intel.com with ESMTP; 25 Sep 2021 19:26:40 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Sat, 25 Sep 2021 19:26:40 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Sat, 25 Sep 2021 19:26:40 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.168) 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.2242.12; Sat, 25 Sep 2021 19:26:40 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=db2tA9WG5rv3YSZIwP1ZtAPo2EaOSLI8MjWt5KwsuUUtZBHWlavqiX4w/UWCQU6YsaVSPxiy/lpmMkTIDVqe/nY0FL1t6+GufDi6EfpaGWY/7iFLYRx4tystt/3GFxZ8D6zelsDRTabyikMvQJHzul4+RZJhzt4CPI4/kC3CLo83AsvTdh+/jtOqW5HwkrFVAQaXadxqYgItjGp7HbwzB5AOr1z+fm7cwWLIzu/FSXGdcWjzp4Y+9tiVAPlBt8Vv/0MyjEN0zgWYPnbiQHX3pPuLGHhg6ZRoK9CsAVozKBSYo3nPzYv/m45WY/PN9y9KrEG/HESzsoCS9omXf+jHWg== 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; bh=RSaFrzIgPcsjVIXQAPh7P7dgpez5SUAkR8T8+ntyw0U=; b=jX5mZdX5vQeeATwCyVUjG3sHEyvmefhNp22IqO8vmfZr8ZkUiwy2fNbbn+vLdhjWc+sy+1o8QkyMLJsV7w42xHrAgZQwcGQkK80S3eP16fk43fBwoq5L1E90pHplA7fwkHfZHl7MSMVRKzFqMOY16K0P5h7PpYjTJHH60kpGCqCS4Y3j0eryiFkcycska/q/v6wbsdfVE+oGfj6PBsVOhRQQQq4zj5Vmx9IQoO9DQB+FtIXWFnqrV9u6F3dKwzP37EnhW/NTsoYxaftwRjaE9lhqDkdhvmndTXDNsAgIefKIW8Mvjfbs8/m7p16u4UVNc7MAd4qx/gAhZxIFaYVO6Q== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RSaFrzIgPcsjVIXQAPh7P7dgpez5SUAkR8T8+ntyw0U=; b=Oy9RkqeoFZXqtocAMWBD1IG8+hYiMeJjWPH8zDIHWG5tzLQoNuU7vrcpaW2OzUUayoFs+huMfoCrX7B0yFpKqk9miPDJfFo4/ainCEx9aLo7bMMK9LsLQxiXjIwjDl81pYFmEURnkccuR31s0qMNdH4GmkbMTm+FcyXuILJYj9o= Received: from CY4PR1101MB2072.namprd11.prod.outlook.com (2603:10b6:910:1d::15) by CY4PR11MB1493.namprd11.prod.outlook.com (2603:10b6:910:11::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.15; Sun, 26 Sep 2021 02:25:49 +0000 Received: from CY4PR1101MB2072.namprd11.prod.outlook.com ([fe80::7dc5:34b5:bbff:832f]) by CY4PR1101MB2072.namprd11.prod.outlook.com ([fe80::7dc5:34b5:bbff:832f%8]) with mapi id 15.20.4544.021; Sun, 26 Sep 2021 02:25:48 +0000 From: "Ni, Ray" To: "Xue, Shengfeng" , "devel@edk2.groups.io" , "Wu, Hao A" CC: "Liang, PanlingX" , "Xue, ShengfengX" Subject: Re: [PATCH V5] MdeModulePkg/PciBusDxe: Improve the flow of testing support attributes Thread-Topic: [PATCH V5] MdeModulePkg/PciBusDxe: Improve the flow of testing support attributes Thread-Index: AQHXsQ3T8lNyym2ESU6aCzmwehaCjKu1mTOA Date: Sun, 26 Sep 2021 02:25:48 +0000 Message-ID: References: <4713d27cb60bb2826520cff40900ccfc0af8fbc5.1632465012.git.xueshengfeng@byosoft.com.cn> In-Reply-To: <4713d27cb60bb2826520cff40900ccfc0af8fbc5.1632465012.git.xueshengfeng@byosoft.com.cn> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: byosoft.com.cn; dkim=none (message not signed) header.d=none;byosoft.com.cn; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 106178e4-1f06-4d66-2bb6-08d98094f3c6 x-ms-traffictypediagnostic: CY4PR11MB1493: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5neNJW2J4HjPZJU72hMa3fVeqlLEwLMMYtABhz6myvlPH+X02A4s8h15UEP91Rqb8aFuzYj7E0I/LTiAQyezdnMiGCBZQipccx8g15o674reRlQq3AEKmHmelaz4ePbNJ/IMbch7QoOTn7b0IJbrmSfUdpPdnE6XnSwLL+gCDMviRJ2lIAVuBSOUZzZvBN3+3kkdFiHrUtp3PCKoVsZHWydt5owJr/U+umHnsOaUnSkhAeoT4t7qGhNRxa0sHDpFbdCKfNLAZ+pi4oSYUyGqCXN+W5/OeYzfHsL464HxIgjw4m0DVSYuX+Lm5f9K4Anu/5OOA7FfkjubIuzHloG+pN5rQVJYA31aUTY+iZySO+rD51Y0aN8Ml7pZG+SyA4NghhhjPKYAtkFpvi0nQNM7B5TQ3EWvGZt2TggnZWPqF1aHvc/oInR6eRwdsm8Obv5eOWuNXA3szCUbsJyjOYfhSdKmvbNaali3AkSPkA5E8bG8TUj0D/hMaOpfe3B/K8o990S6L4ahZ5G2yB+GnV20c0ZR/R9dI3Ty8wl8E+MPAKvLsgakjsKFoXM5xHXPinsX+OY4d5lGvyCiPm48tI7SZHRmAk+4rz2uR4AxlP9epeYSFmzH7lHHZCRlGenctdZCW6d2xAoEHeJWghaNE0Y1ncYmA5DY/Xf6lTumwUn1t6UDR+Lo/22n20alTvYDQNIddj4fLxn5JHh/tEYXGiBzrQh/m65jyJp93VdGGJD7uXnka9wgoaJCyiH+M2FrP6T88K7Y7sLkzj4tziA85rhF4kj7ao0vvD7XFMedVMOstws= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR1101MB2072.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(5660300002)(6636002)(86362001)(508600001)(26005)(54906003)(2906002)(110136005)(8936002)(8676002)(6506007)(53546011)(107886003)(122000001)(7696005)(83380400001)(66556008)(38070700005)(64756008)(66476007)(66946007)(76116006)(66446008)(38100700002)(316002)(186003)(52536014)(71200400001)(966005)(4326008)(33656002)(55016002)(9686003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?wAe5buw58w9Qr/CXLfwEAOLHFt2h0wIocFWR33L/NFx3p/6/IjJgu0OzTSiQ?= =?us-ascii?Q?MId7P7TrD34oaKnQyfFmJ+9KLGif3+OWoNotV4iAnBnV8e3t7M6JaeQWKYft?= =?us-ascii?Q?DckpebwEDNbRCAEu3vzz3tSci8qDbqQ+yVsRyv0QEyaxXW5+Hr73MYDE9qWe?= =?us-ascii?Q?2bLoF6GgPj+nhB3q1Z4U2bVTFAW6609hv9F+f23l38nvtzeaM66/Aqe69WSm?= =?us-ascii?Q?IT2K+vVTw8fhz3IPgV56FIqUQiHV0U3VZeyDCllkwKgqpSnxGxlOlXeeY+br?= =?us-ascii?Q?dqVw01kVAdJqy4P596kAnuGaZz5rQDJJQupITqa9UFtSEFHvfTjVH3Luh704?= =?us-ascii?Q?JJgkv+VC0TaQT20Q4SnuAkyq0ruR8DZVXTcA6R6utIUptArz3ok7/5Z2Kw5s?= =?us-ascii?Q?t5K2RHIzA8RSJ21OcdqqHYrXrQWOAqXQ4PqBMT64Zmf5yRWbRPDYnaf+QW6r?= =?us-ascii?Q?CAj1F0jZ47GwUOnEmqVUWfAgonqSJWN+qgzpL3pq+aTvimrWv4nvmPpMpRJt?= =?us-ascii?Q?nA/8LT23oom9nrgqJ6DdJ9pxwLU8rpmE8JU30qFBWaPoWXdpeIkoxv0hQFvX?= =?us-ascii?Q?HFm/ey9VUCrYteAmIi8KxwzvLnKG/q+aWbt06QJvTgbAZfCDszeg/cu4AGca?= =?us-ascii?Q?tgv3ndiXFCrdDuYloNBFgdfBD1LTcESuqg7E2OSPjQBrr/rUidUxP9h/Zi3j?= =?us-ascii?Q?4PFuKO+nkyCbRU8DKMcXj1ApNsKHosJqxlUBYfXYg4urhc+qGD55+2Kqd2oQ?= =?us-ascii?Q?2s2AMj0nIQ9UY1i2mWQqycdCkMej8oC5InNiz8j00rZGqUSqKP2dc2IPcqGh?= =?us-ascii?Q?6SsA2oL/WAKl7HUnvP3hNc6BKSCGJHDtlRCwUE3Ed+clespRS/EMWNgIchM+?= =?us-ascii?Q?BHPqKtaBLY1y4l2f9W/bm5avKaCjXYdNqlcAfwdDVNJlFTadDvL8VftCfzkF?= =?us-ascii?Q?GqP9QLtiSY782Iq3waj1k6ua92a48XVcoVFPLHbHcJDx23WQGhqrC7O4GRBd?= =?us-ascii?Q?vsP+qfymWNOz4+FmXRM2TQv38YRvreFzvq/PAq+M5/foAq14l+TM7YFzBRtS?= =?us-ascii?Q?g+SgDT5TZ1BT0gI4dvpHa4KeOs2s8Q2cM6URKkU74/1wrwgk42Ms0B80Sojr?= =?us-ascii?Q?v8YZDf8iKtmPz9w5VRPNm2PvC+qL0AZDxxhlXDWJdXeKxqCGV57cIRMamDbD?= =?us-ascii?Q?wSmvqsV5Tt+dbnzk+3R4/PZXc0pccgfYDsSC4oZ9wM+8Sn5HhU2ytzBQmrJn?= =?us-ascii?Q?bL1kWM1MUd/mnIuQU1yLoFRsO4rqHpSsCz73MXVO0O7ELchHGMga+dCGYj4X?= =?us-ascii?Q?xvsz5nMHgxjUwkGbLneB/Rv7?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR1101MB2072.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 106178e4-1f06-4d66-2bb6-08d98094f3c6 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Sep 2021 02:25:48.1492 (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: kVscbxmHMYlLp4B9UGD5ERPAslBFskOcpbnOGiBc4BGRFO6gnWm6Ol6Is8dTVad6pQxQJ7wQxbj7YM1c1RctdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1493 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: xueshengfeng =20 Sent: Friday, September 24, 2021 2:31 PM To: devel@edk2.groups.io; Ni, Ray ; Wu, Hao A Cc: Liang, PanlingX ; Xue, ShengfengX Subject: [PATCH V5] MdeModulePkg/PciBusDxe: Improve the flow of testing sup= port attributes https://bugzilla.tianocore.org/show_bug.cgi?id=3D3635 Currently, in order to test the supported attributes, the PciTestSupportedAttribute() will set the command register to 0x27 (EFI_PCI_COMMAND_IO_SPACE, EFI_PCI_COMMAND_MEMORY_SPACE, EFI_PCI_COMMAND_BUS_MASTER, EFI_PCI_COMMAND_VGA_PALETTE_SNOOP) firstly, and then read back to check whether these attributes are set successfully in the device. This will cause the other enabled bits (other than EFI_PCI_COMMAND_IO_SPACE,EFI_PCI_COMMAND_MEMORY_SPACE, EFI_PCI_COMMAND_BUS_MASTER,EFI_PCI_COMMAND_VGA_PALETTE_SNOOP) be cleared for a short of time This patch fixes this issue by keeping the origina enabled bits when setting 0x27. Signed-off-by: xueshengfeng --- MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeMod= ulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index db1b35f8ef..3a238d4e46 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -933,6 +933,7 @@ PciTestSupportedAttribute ( ) { EFI_TPL OldTpl; + UINT16 CommandValue; =20 // // Preserve the original value @@ -943,10 +944,12 @@ PciTestSupportedAttribute ( // Raise TPL to high level to disable timer interrupt while the BAR is p= robed // OldTpl =3D gBS->RaiseTPL (TPL_HIGH_LEVEL); + CommandValue =3D *Command | *OldCommand; =20 - PCI_SET_COMMAND_REGISTER (PciIoDevice, *Command); - PCI_READ_COMMAND_REGISTER (PciIoDevice, Command); + PCI_SET_COMMAND_REGISTER (PciIoDevice, CommandValue); + PCI_READ_COMMAND_REGISTER (PciIoDevice, &CommandValue); =20 + *Command =3D *Command & CommandValue; // // Write back the original value // --=20 2.31.1.windows.1