From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2C48E220EE069 for ; Sun, 3 Dec 2017 17:12:14 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2017 17:16:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,356,1508828400"; d="scan'208";a="180889119" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga005.jf.intel.com with ESMTP; 03 Dec 2017 17:16:42 -0800 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 3 Dec 2017 17:16:42 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 3 Dec 2017 17:16:41 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.213]) with mapi id 14.03.0319.002; Mon, 4 Dec 2017 09:16:40 +0800 From: "Zeng, Star" To: Heyi Guo , "linaro-uefi@lists.linaro.org" , "edk2-devel@lists.01.org" CC: Heyi Guo , "Dong, Eric" , "Wu, Hao A" , "Ni, Ruiyu" , "Zeng, Star" Thread-Topic: [edk2] [PATCH] MdeModulePkg/NvmExpressDxe: fix error status override Thread-Index: AQHTa1EvXNDt+rsDEU2pPM9cZunznqMyZFjA Date: Mon, 4 Dec 2017 01:16:39 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B9BF055@shsmsx102.ccr.corp.intel.com> References: <1512206536-39536-1-git-send-email-heyi.guo@linaro.org> In-Reply-To: <1512206536-39536-1-git-send-email-heyi.guo@linaro.org> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/NvmExpressDxe: fix error status override X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Dec 2017 01:12:14 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc Hao and Ruiyu. Thanks, Star -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Heyi= Guo Sent: Saturday, December 2, 2017 5:22 PM To: linaro-uefi@lists.linaro.org; edk2-devel@lists.01.org Cc: Heyi Guo ; Heyi Guo ; Dong, Er= ic ; Zeng, Star Subject: [edk2] [PATCH] MdeModulePkg/NvmExpressDxe: fix error status overri= de Commit f6b139b added return status handling to PciIo->Mem.Write. However, the second status handling will override EFI_DEVICE_ERROR returned= in this branch: // // Check the NVMe cmd execution result // if (Status !=3D EFI_TIMEOUT) { if ((Cq->Sct =3D=3D 0) && (Cq->Sc =3D=3D 0)) { Status =3D EFI_SUCCESS; } else { Status =3D EFI_DEVICE_ERROR; ^^^^^^^^^^^^^^^^ Since PciIo->Mem.Write will probably return SUCCESS, it causes NvmExpressPa= ssThru to return SUCCESS even when DEVICE_ERROR occurs. Callers of NvmExpressPassThru will then continue executing which may cause = further unexpected results, e.g. DiscoverAllNamespaces couldn't break out t= he loop. So we add a | (bit-or) to combine the return status together. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Heyi Guo Cc: Star Zeng Cc: Eric Dong --- MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c b/MdeM= odulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c index c33038f..2698b27 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c @@ -831,7 +831,7 @@ NvmExpressPassThru ( } =20 Data =3D ReadUnaligned32 ((UINT32*)&Private->CqHdbl[QueueId]); - Status =3D PciIo->Mem.Write ( + Status |=3D PciIo->Mem.Write ( PciIo, EfiPciIoWidthUint32, NVME_BAR, -- 2.7.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel