From nobody Wed May 1 15:15:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1512207448641818.2908924976584; Sat, 2 Dec 2017 01:37:28 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 13D7821A10987; Sat, 2 Dec 2017 01:33:00 -0800 (PST) Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6922E21A10986 for ; Sat, 2 Dec 2017 01:32:57 -0800 (PST) Received: by mail-pf0-x244.google.com with SMTP id n6so5732648pfa.4 for ; Sat, 02 Dec 2017 01:37:25 -0800 (PST) Received: from szxbz956.huaweiobz.com ([45.56.152.86]) by smtp.gmail.com with ESMTPSA id c28sm15961652pfe.69.2017.12.02.01.37.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 02 Dec 2017 01:37:24 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c00::244; helo=mail-pf0-x244.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=irbh8ByYxdb9IffvPek/u6u+tKyqNBijVoihJ/db4d4=; b=BWhbUxuBgp1QSnWT4G5ReQTpGy+E5KtxzGgfma+ZHlLZxwn68wBiUTui5TQ4MSCgGg 80esAf5jT+OR6Itk3pri52RBn/bEq397CXP/WSc+CBCxNGgeA0byZDGUjDXzd/oQpVHu tUphoxr1G2d1QPW2e+1ieOVA6DKnBWhewwOy4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=irbh8ByYxdb9IffvPek/u6u+tKyqNBijVoihJ/db4d4=; b=JP79+qiV7aPSL9lax6/mEs3bS6sbBgUwrJiYkzcdZ3f3cnhaZs7UMdiP1j6ZPVjnDl kN2oVIGe9Y2+5dJLO6s3GG2gZ9kukavW6CKdwrL1m+ilVbVtSwO95/miO5qchJfxIn7C UM77647i3EzVb/yj+6gbrNf6x1xuG5jAchU7Tyxq5B6EGMTOO7Wx9yQqJRy1NNDsetW+ 64InlgVSNBYSggqIsOaqJqbRhLgVeJr32kcbsFj1ucO6rs4gc/TOjdl+N4XAA0z0cgg1 Ouez2haxsT36vih4qRLOoUEgWRZT56hh0Volt0BvJw/zCUAlHjfbBGtmd9Jj88kCoVsT IQ9Q== X-Gm-Message-State: AJaThX5eJUzFLi8mY7dF2T4qmcoMBamjoxbIOhj61UpDDl0F1mrhfl87 kZh8x7v/BKQlMmd8+KtSpErRjQ== X-Google-Smtp-Source: AGs4zMb2A35Z0B1fzJZu7bAPB5Pzxrt99I6VaAYRRHcAiHxsg+nrO8tv99R4xmW+Sug+OGo9x9gcPQ== X-Received: by 10.101.90.8 with SMTP id y8mr8461115pgs.21.1512207444925; Sat, 02 Dec 2017 01:37:24 -0800 (PST) From: Heyi Guo To: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org Date: Sat, 2 Dec 2017 17:22:16 +0800 Message-Id: <1512206536-39536-1-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.2.windows.1 Subject: [edk2] [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: , Cc: Heyi Guo , Heyi Guo , Eric Dong , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 NvmExpressPassThru 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 the 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, --=20 2.7.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel