From nobody Fri Nov 1 12:24:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 1516683847025256.10023503968637; Mon, 22 Jan 2018 21:04:07 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9876822333790; Mon, 22 Jan 2018 20:58:38 -0800 (PST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 7A06D2233378E for ; Mon, 22 Jan 2018 20:58:36 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jan 2018 21:04:02 -0800 Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.10]) by fmsmga001.fm.intel.com with ESMTP; 22 Jan 2018 21:04:01 -0800 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=134.134.136.31; helo=mga06.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,399,1511856000"; d="scan'208";a="24620558" From: Hao Wu To: edk2-devel@lists.01.org Date: Tue, 23 Jan 2018 13:03:58 +0800 Message-Id: <20180123050358.17840-1-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 Subject: [edk2] [PATCH] MdeModulePkg/NvmExpressDxe: Fix data buffer not mapped for Write cmd X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hao Wu , Ruiyu Ni , Feng Tian , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Within function NvmExpressPassThru(): The data buffer for the below 2 Admin command: Create I/O Completion Queue command (Opcode 01h) Create I/O Submission Queue command (Opcode 05h) are not mapped to the PCI controller specific addresses. But the current code logic also prevents the below NVM command: Write (Opcode 01h) from mapping its data buffer. Hence, this commit refine the logics to resolve this issue. Cc: Star Zeng Cc: Ruiyu Ni Cc: Feng Tian Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu Reviewed-by: Star Zeng --- MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c b/MdeM= odulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c index 7356c1d673..302cfdcd8d 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c @@ -3,7 +3,7 @@ NVM Express specification. =20 (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -593,7 +593,8 @@ NvmExpressPassThru ( // these two cmds are special which requires their data buffer must supp= ort simultaneous access by both the // processor and a PCI Bus Master. It's caller's responsbility to ensure= this. // - if (((Sq->Opc & (BIT0 | BIT1)) !=3D 0) && (Sq->Opc !=3D NVME_ADMIN_CRIOC= Q_CMD) && (Sq->Opc !=3D NVME_ADMIN_CRIOSQ_CMD)) { + if (((Sq->Opc & (BIT0 | BIT1)) !=3D 0) && + !((Packet->QueueType =3D=3D NVME_ADMIN_QUEUE) && ((Sq->Opc =3D=3D NV= ME_ADMIN_CRIOCQ_CMD) || (Sq->Opc =3D=3D NVME_ADMIN_CRIOSQ_CMD)))) { if ((Packet->TransferLength =3D=3D 0) || (Packet->TransferBuffer =3D= =3D NULL)) { return EFI_INVALID_PARAMETER; } --=20 2.12.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel