From nobody Thu Mar 28 19:57:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+42092+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42092+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1560165666; cv=none; d=zoho.com; s=zohoarc; b=OZHAr4v/dG2GH2gY52oeyST4haq4VKQNlHba79llW+xOVsbXg8lNUf1IfkLsJ2qL0T0WTjX4+psEf/E8hS3Q7Cv8jHgH0ZYvkIaSaZKSffeQd3t9iC+m/K0UywIEax6753BYYWjs7hDyPDSFZElYq+o6hw6MABC1nASWEk52oqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560165666; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=84KF9lgRk7wOovx0ockNZCjHj1czgYR/eFBQV4dSlpE=; b=bSKZ2Syq5NshD3qsmaH41FSjBa+tEmNZm+9xUfLfAuLZ0b+tWlMQWtARXhgzbsoIyuUBaNtH7R2dZQECwBxknnxsRdjUqpcUMh0jAYlXf5gwsm0Db7rNV6mwEDBRlMIMtaKkWz2+ihjPT5EPhKmNHvvPTmlVQOg9h0gX/pfvfss= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42092+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1560165666493855.559178693357; Mon, 10 Jun 2019 04:21:06 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by groups.io with SMTP; Mon, 10 Jun 2019 04:21:05 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 04:21:04 -0700 X-ExtLoop1: 1 X-Received: from chumaggi-mobl.gar.corp.intel.com ([10.5.245.223]) by orsmga005.jf.intel.com with ESMTP; 10 Jun 2019 04:21:03 -0700 From: "Maggie Chu" To: devel@edk2.groups.io Cc: Hao A Wu , Jian J Wang , Ray Ni , Star Zeng Subject: [edk2-devel] [PATCH] MdeModulePkg: Add definitions for NVM Express Passthru PPI Date: Mon, 10 Jun 2019 19:21:00 +0800 Message-Id: <20190610112100.18836-1-maggie.chu@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,maggie.chu@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1560165666; bh=OSsEHNZQGWhhxSxLAOk37F4cWVv0PdvmPCnuQsOQics=; h=Cc:Date:From:Reply-To:Subject:To; b=lgISujyWxgsEdPY8J/BjHaQ9cUUZKGMof5uW1YMZytDuQfdZ5S4aCHYJYfjR4TxJTcO mkEmA9RjmJviYg9iAMzFMoDnDgtF4pV1sntxgZ5WhUB/gABT4wJ9xQu4ysZG3RmrAsU7g 0ym8k3LzqJuA8fwtTyVYL78q6PG2afa8Y0E= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D1879 This commit will add the definitions of Nvm Express PassThru PPI. This PPI will provide services that allow NVM commands to be sent to NVM Express devices during PEI phase. More specifically, the PPI will provide services to: * Sends an NVM Express Command Packet to an NVM Express controller or namespace (by service 'PassThru'); * Get the list of the attached namespaces on a controller (by services 'GetNextNameSpace'); * Get the identification information (DevicePath) of the underlying NVM Express host controller (by service 'GetDevicePath'). Signed-off-by: Maggie Chu Cc: Hao A Wu Cc: Jian J Wang Cc: Ray Ni Cc: Star Zeng --- MdeModulePkg/Include/Ppi/NvmExpressPassThru.h | 156 ++++++++++++++++++++++= ++++ MdeModulePkg/MdeModulePkg.dec | 3 + 2 files changed, 159 insertions(+) create mode 100644 MdeModulePkg/Include/Ppi/NvmExpressPassThru.h diff --git a/MdeModulePkg/Include/Ppi/NvmExpressPassThru.h b/MdeModulePkg/I= nclude/Ppi/NvmExpressPassThru.h new file mode 100644 index 0000000000..cb5b3b3b18 --- /dev/null +++ b/MdeModulePkg/Include/Ppi/NvmExpressPassThru.h @@ -0,0 +1,156 @@ +/** @file + + Copyright (c) 2019, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _EDKII_NVME_PASS_THRU_PPI_H_ +#define _EDKII_NVME_PASS_THRU_PPI_H_ + +#include +#include + +/// +/// Global ID for the EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI. +/// +#define EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI_GUID \ + { \ + 0x6af31b2c, 0x3be, 0x46c1, { 0xb1, 0x2d, 0xea, 0x4a, 0x36, 0xdf, 0xa7,= 0x4c } \ + } + +// +// Forward declaration for the EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI. +// +typedef struct _EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI EDKII_PEI_NVM_EXPRESS= _PASS_THRU_PPI; + +// +// Revision The revision to which the Nvme Pass Thru PPI interface adheres. +// All future revisions must be backwards compatible. +// If a future version is not back wards compatible it is not the= same GUID. +// +#define EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI_REVISION 0x00010000 + +/** + Gets the device path information of the underlying NVM Express host cont= roller. + + @param[in] This The PPI instance pointer. + @param[out] DevicePathLength The length of the device path in bytes = specified + by DevicePath. + @param[out] DevicePath The device path of the underlying NVM E= xpress + host controller. + This field re-uses EFI Device Path Prot= ocol as + defined by Section 10.2 EFI Device Path= Protocol + of UEFI 2.7 Specification. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL. + @retval EFI_OUT_OF_RESOURCES The operation fails due to lack of reso= urces. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_NVME_PASS_THRU_GET_DEVICE_PATH) ( + IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This, + OUT UINTN *DevicePathLength, + OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath + ); + +/** + Used to retrieve the next namespace ID for this NVM Express controller. + + If on input the value pointed to by NamespaceId is 0xFFFFFFFF, then the = first + valid namespace ID defined on the NVM Express controller is returned in = the + location pointed to by NamespaceId and a status of EFI_SUCCESS is return= ed. + + If on input the value pointed to by NamespaceId is an invalid namespace = ID + other than 0xFFFFFFFF, then EFI_INVALID_PARAMETER is returned. + + If on input the value pointed to by NamespaceId is a valid namespace ID,= then + the next valid namespace ID on the NVM Express controller is returned in= the + location pointed to by NamespaceId, and EFI_SUCCESS is returned. + + If the value pointed to by NamespaceId is the namespace ID of the last + namespace on the NVM Express controller, then EFI_NOT_FOUND is returned. + + @param[in] This The PPI instance pointer. + @param[in,out] NamespaceId On input, a pointer to a legal Namespac= eId + for an NVM Express namespace present on= the + NVM Express controller. On output, a po= inter + to the next NamespaceId of an NVM Expre= ss + namespace on an NVM Express controller.= An + input value of 0xFFFFFFFF retrieves the + first NamespaceId for an NVM Express + namespace present on an NVM Express + controller. + + @retval EFI_SUCCESS The Namespace ID of the next Namespace was + returned. + @retval EFI_NOT_FOUND There are no more namespaces defined on t= his + controller. + @retval EFI_INVALID_PARAMETER NamespaceId is an invalid value other than + 0xFFFFFFFF. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_NVME_PASS_THRU_GET_NEXT_NAMESPACE)( + IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This, + IN OUT UINT32 *NamespaceId + ); + + +/** + Sends an NVM Express Command Packet to an NVM Express controller or name= space. This function only + supports blocking execution of the command. + + @param[in] This The PPI instance pointer. + @param[in] NamespaceId Is a 32 bit Namespace ID to which the N= vm Express command packet will + be sent. + A Value of 0 denotes the NVM Express co= ntroller, a Value of all 0FFh in + the namespace ID specifies that the com= mand packet should be sent to all + valid namespaces. + @param[in,out] Packet A pointer to the EDKII PEI NVM Express = PassThru Command Packet to send + to the NVMe namespace specified by Name= spaceId. + + @retval EFI_SUCCESS The EDKII PEI NVM Express Command Packe= t was sent by the host. + TransferLength bytes were transferred t= o, or from DataBuffer. + @retval EFI_NOT_READY The EDKII PEI NVM Express Command Packe= t could not be sent because + the controller is not ready. The caller= may retry again later. + @retval EFI_DEVICE_ERROR A device error occurred while attemptin= g to send the EDKII PEI NVM + Express Command Packet. + @retval EFI_INVALID_PARAMETER Namespace, or the contents of EDKII_PEI= _NVM_EXPRESS_PASS_THRU_COMMAND_PACKET + are invalid. + The EDKII PEI NVM Express Command Packe= t was not sent, so no + additional status information is availa= ble. + @retval EFI_UNSUPPORTED The command described by the EDKII PEI = NVM Express Command Packet + is not supported by the host adapter. + The EDKII PEI NVM Express Command Packe= t was not sent, so no + additional status information is availa= ble. + @retval EFI_TIMEOUT A timeout occurred while waiting for th= e EDKII PEI NVM Express Command + Packet to execute. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_NVME_PASS_THRU_PASSTHRU) ( + IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This, + IN UINT32 NamespaceId, + IN OUT EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET *Packet + ); + +// +// This PPI contains a set of services to send commands +// to a mass storage device. +// +struct _EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI { + UINT64 Revision; + EFI_NVM_EXPRESS_PASS_THRU_MODE *Mode; + EDKII_PEI_NVME_PASS_THRU_GET_DEVICE_PATH GetDevicePath; + EDKII_PEI_NVME_PASS_THRU_GET_NEXT_NAMESPACE GetNextNameSpace; + EDKII_PEI_NVME_PASS_THRU_PASSTHRU PassThru; +}; + +extern EFI_GUID gEdkiiPeiNvmExpressPassThruPpiGuid; + +#endif diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 6cba729982..8ade6bac0e 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -466,6 +466,9 @@ ## Include/Ppi/Debug.h gEdkiiDebugPpiGuid =3D { 0x999e699c, 0xb013, 0x47= 5e, { 0xb1, 0x7b, 0xf3, 0xa8, 0xae, 0x5c, 0x48, 0x75 } } =20 + ## Include/Ppi/NvmExpressPassThru.h + gEdkiiPeiNvmExpressPassThruPpiGuid =3D { 0x6af31b2c, 0x3be, 0x46c1, {= 0xb1, 0x2d, 0xea, 0x4a, 0x36, 0xdf, 0xa7, 0x4c } } + [Protocols] ## Load File protocol provides capability to load and unload EFI image i= nto memory and execute it. # Include/Protocol/LoadPe32Image.h --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#42092): https://edk2.groups.io/g/devel/message/42092 Mute This Topic: https://groups.io/mt/32002950/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-