From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web09.3823.1632292913230261072 for ; Tue, 21 Sep 2021 23:41:54 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=K/0wUFaj; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: ray.ni@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10114"; a="210765285" X-IronPort-AV: E=Sophos;i="5.85,313,1624345200"; d="scan'208";a="210765285" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2021 23:41:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,313,1624345200"; d="scan'208";a="533583193" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by fmsmga004.fm.intel.com with ESMTP; 21 Sep 2021 23:41:51 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 21 Sep 2021 23:41:51 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 21 Sep 2021 23:41:51 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Tue, 21 Sep 2021 23:41:51 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.174) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Tue, 21 Sep 2021 23:41:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LM2J6ri890elWXySMH0QjmBnK7T/0W62Y0v9oHgH+yCUyF06rM77I0fhtOPzSCtFEpPuvp0bOZQ70FEFDboKbGP9zirmQZDp/ppeCTUhc/1T46/a1lrbu0BMUmL1Ef9qXmlrb7YxlIcQ76qL/ERSfX8lxfU38Y+vgSojCvBS24+ySYzL0PVNC6XSCWgu5saI1iTtw2t/KNNidxS+LxBwR/5gRkyfxnM4nzbj1ugdVovaxFbs154VpTWLrjxO4EIPKvu2L5ZCYjh0qIN4rNWbP5N1XRru+iXmcDf452K9F+/GWRGSWYHjEEvofNRai2+Sd3/rwe8W2gXOyBm0mA20Pw== 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=jnC29o0rhI0PSEC80kMG1RYZV6EsLlr+j+pq7h40Hhc=; b=jKw4Q5LoVjIVSUN9RiFdi6Ayc3YfrfNhDHdFhFA3am4yH0ts7WKOQRdmbVGlBiUbFHZKF969vkS09jM4Lk99FpCJBX5jdvHeB96D16v9BdX6reQB+3ik4eIEY5Ni2C0wxIROP2olsmumiLjYgFrpoAgVOs/oLTIItWOC0sIDlmr0BiJEg65bRYBDtYlZ98AG+TbwO3GEcfE/KVwf8ZPUNpG6GUULKq6pugvKn2Ka9YIcM9LEJqMoi0APBVLQUE59HxAz9jyoObeYRJd48ntdUqtipCYRkP5vTAe1YncDJs+KQ/Lue0sOXYjXe+n7MxuuaLQSk7ZfTwEgsnE72uDTRw== 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=jnC29o0rhI0PSEC80kMG1RYZV6EsLlr+j+pq7h40Hhc=; b=K/0wUFajO6foOZZO4pAsVPC5Totwe6GkE9Hcci2W4LPG7k2JpGIG5C7fML3S50a29/heAh2eprPrMzVjaO+/Uq7OixFs2WFFe9u3IR/4qOCKU6JVlVuBx74Yex9Ff9XMnJxEttvJCIJuUfESUqYAVsG9Of4iyiWvFA7vP9P1LL8= Received: from CY4PR1101MB2072.namprd11.prod.outlook.com (2603:10b6:910:1d::15) by CY4PR11MB1799.namprd11.prod.outlook.com (2603:10b6:903:125::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.17; Wed, 22 Sep 2021 06:41:48 +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.4523.020; Wed, 22 Sep 2021 06:41:48 +0000 From: "Ni, Ray" To: "Xue, Shengfeng" , "devel@edk2.groups.io" , "gaoliming@byosoft.com.cn" , "Wu, Hao A" CC: "Xue, ShengfengX" , "Liang, PanlingX" Subject: Re: [PATCH] On branch PCIBus dulePkg/PciBusDxe: PciTestSupportedAttribute logic should be changed. Thread-Topic: [PATCH] On branch PCIBus dulePkg/PciBusDxe: PciTestSupportedAttribute logic should be changed. Thread-Index: AQHXr2CWmZ479qmO8UOltN1LxqyJGKuvapyg Date: Wed, 22 Sep 2021 06:41:47 +0000 Message-ID: References: <57eb87fe03d054ffd8078bd40652104c9bc5c76e.1632280373.git.xueshengfeng@byosoft.com.cn> In-Reply-To: <57eb87fe03d054ffd8078bd40652104c9bc5c76e.1632280373.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: 008109a1-3d6f-4793-9a2a-08d97d940d42 x-ms-traffictypediagnostic: CY4PR11MB1799: 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:5797; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: kPkfESKI/+FkMxLrH4+TV1hhYPjAEKJ1TZbTq9zlClllLDH5G0Krl+NJNhdtXCcBsyDe384p2y97m0As4qOB7bN6rwO98QHkcGEz19mwL9VcMrI7ZmkQY54+24k3MEZrJ39Ij87mXCyc1ZFhg5tAzTgq5Ngc+ztksVW7u/Xj0dd7eSErFQH/2G5XuRb6QMcBrAuVNY8V/yS94MSoHFPZ+iWLfKXap/stbWZD2YbZ3qYy3rdVT8TXM8suQ8663hG82yt/+sD0blh20YK/TBP51v5MoJQnD67gXfVQ/fcuxfjweup1tAkkENIqDo9aDc61a0MzbUCHfdeJB/Lh5Mh9xRw6Yx+r5xI8EBR49+Y96XSZnTUHHrT8DKh1qlO4R7agqWmg/9ehF8OKDm+vrxUrMQ7kWVM8y5Kvq/N2+FcJAGkmm8Q3S0oDAyA4S1act9pHlIesqAiT8YgG5jb6q/wBQk3m202HiVgDDVjv2d0sLTdSILdszF16e0OYBsfijNTxNOWXZf24hHzRJy7k4g+M3eO3X2DtYVAAGd2BVYw+K8rQd24CTytnr01771hLmF1GD0F0anh/10ofMbf7iycjBK5fFuRPWT3SQ7elT35Zuvir0bNwHKcAOXHdKCj3A+JPPYygDUdgKO5UjBysUW+Dc3r8wnuqTr5NZnEGbgeYX/tb2IWRSFhRA9Tt133J/i9v+azt6x1B0bk7fuCVPfLV2B4/n8gcyfPzVmmYPMaxMarB4yjZHBMPq/+5zrS7hMCyhwc1JupphjsgeAGtEQ9woftTBl1PdIx1ZAxxSaZm+fo= 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)(26005)(2906002)(52536014)(508600001)(54906003)(110136005)(6636002)(122000001)(55016002)(33656002)(966005)(66946007)(86362001)(66446008)(8936002)(107886003)(64756008)(4326008)(83380400001)(316002)(186003)(6506007)(9686003)(66556008)(7696005)(38100700002)(38070700005)(53546011)(71200400001)(5660300002)(76116006)(8676002)(66476007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?lHqO/oVN8njzs2fjpaHM+HLtlaMRtUjlZvPN8V6QWRXhx0Ppmgm8V5lKyd2E?= =?us-ascii?Q?rlcZYuf8fGVz0IpNa5FGAVPuox8RMyJOiP42MDF/1N7wh0VxsuL1ulcXg6gD?= =?us-ascii?Q?dfiTL0vZd4qnPkUJznhUtDoh2BqM8xX25MIgeLYJ3HPJL1C7YBR9G5737yCT?= =?us-ascii?Q?b8FRmbQ2j2EofA70jP0Hxt3bA2zXPwx3PPXdRvfsRsWQcp2SpwsKjCEpbA7D?= =?us-ascii?Q?u3c3g6ZoQrn3C/EkksHPBrDBMahZk2D/VX6lh/1qS7jwC+x61UrANCFU7mi3?= =?us-ascii?Q?J09OtpXHc8ihUx6YoX+NBb47CRth5gOFh7WjxLOPYONJ4irnpZ7IsHVUQuhs?= =?us-ascii?Q?EGP4Fb8U27/q93Sjl/Gbi/CXkTUS3+RsI32K9JqB0EJdsdfU2ZPnhDlAif6l?= =?us-ascii?Q?y1G48Foc8pcTWk+HJ0f7EZ9yXkC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wX+?= =?us-ascii?Q?Gox1v8XlkwrjAM/CQ2Ax9pD8?= 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: 008109a1-3d6f-4793-9a2a-08d97d940d42 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Sep 2021 06:41:47.9526 (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: Nj23bgVa1Up1wSjl4vZvt/W/wnDtnF3VfUonp48XXXPPJBawZ7HrtEqaSXBCrgvlNGa7zEq8YF6eXgb1GxClFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1799 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 Shengfeng, I guess your patch is to avoid some other 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 b= y the first PCI_SET_COMMAND_REGISTER(). Can you refine your commit message to describe it clearly? The current commit message looks very confusing to me. And don't do inline assignment please. The flow could be: UINT16 CommandValue; PCI_READ_COMMAND_REGISTER (PciIoDevice, OldCommand); // // Raise TPL to high level to disable timer interrupt while the BAR is pr= obed // OldTpl =3D gBS->RaiseTPL (TPL_HIGH_LEVEL); CommandValue =3D *Command | OldCommand; PCI_SET_COMMAND_REGISTER (PciIoDevice, CommandValue); PCI_READ_COMMAND_REGISTER (PciIoDevice, &CommandValue); *Command =3D *Command & CommandValue; // // Write back the original value // PCI_SET_COMMAND_REGISTER (PciIoDevice, *OldCommand); -----Original Message----- From: xueshengfeng =20 Sent: Wednesday, September 22, 2021 11:18 AM To: devel@edk2.groups.io; gaoliming@byosoft.com.cn; Wu, Hao A ; Ni, Ray Cc: Xue, ShengfengX ; Liang, PanlingX Subject: [PATCH] On branch PCIBus dulePkg/PciBusDxe: PciTestSupportedAttrib= ute logic should be changed. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3635 In file Edk2\MdeModulePkg\Bus\Pci\PciBusDxe\PciEnumeratorSupport.c Function PciTestSupportedAttribute, This function is called when doing th= e PCI enumerate, it tries to test whether the device can support given att= ributes by follow steps. 1), read the original register value 2), set to the input register value 3), read back the register value, return this value as output 4), restore= the original value This will cause the enabled bits in this register be disabled during this sequence. Below are the new suggested flow: 1) , read the original register value. 2), set to input register value OR(|) the original register value. 3), read back the register value, return the value AND(&) the input command value as output. 4), restore the original value Above sequence will not change the enabled bits in the register, and can the new supported attributes by the device. Signed-off-by: shengfengx.xue@intel.com Reviewed-by: gaoliming@byosoft.com.cn --- MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeMod= ulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index db1b35f8ef..2462f58833 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -933,6 +933,7 @@ PciTestSupportedAttribute ( ) { EFI_TPL OldTpl; + UINT16 CommandTemp =3D 0; =20 // // Preserve the original value @@ -944,9 +945,10 @@ PciTestSupportedAttribute ( // OldTpl =3D gBS->RaiseTPL (TPL_HIGH_LEVEL); =20 - PCI_SET_COMMAND_REGISTER (PciIoDevice, *Command); - PCI_READ_COMMAND_REGISTER (PciIoDevice, Command); + PCI_SET_COMMAND_REGISTER (PciIoDevice, (*Command | *OldCommand)); =20 + PCI_READ_COMMAND_REGISTER (PciIoDevice, &CommandTemp); =20 + *Command =3D (*Command) & CommandTemp; // // Write back the original value // -- 2.31.1.windows.1