]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Tcg/Opal/OpalPassword/OpalNvmeMode.h
SecurityPkg/OpalPassword: Remove HW init codes and consume SSC PPI
[mirror_edk2.git] / SecurityPkg / Tcg / Opal / OpalPassword / OpalNvmeMode.h
diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalNvmeMode.h b/SecurityPkg/Tcg/Opal/OpalPassword/OpalNvmeMode.h
deleted file mode 100644 (file)
index bd2bd52..0000000
+++ /dev/null
@@ -1,327 +0,0 @@
-/** @file\r
-  Header file for NVMe function definitions\r
-\r
-Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef __OPAL_PASSWORD_NVME_MODE_H__\r
-#define __OPAL_PASSWORD_NVME_MODE_H__\r
-\r
-\r
-#include "OpalNvmeReg.h"\r
-\r
-#define NVME_MAX_SECTORS            0x10000\r
-//\r
-// QueueId\r
-//\r
-#define NVME_ADMIN_QUEUE            0x00\r
-#define NVME_IO_QUEUE               0x01\r
-\r
-typedef struct {\r
-  UINT8                             Opcode;\r
-  UINT8                             FusedOperation;\r
-    #define NORMAL_CMD              0x00\r
-    #define FUSED_FIRST_CMD         0x01\r
-    #define FUSED_SECOND_CMD        0x02\r
-  UINT16                            Cid;\r
-} NVME_CDW0;\r
-\r
-typedef struct {\r
-  NVME_CDW0                         Cdw0;\r
-  UINT8                             Flags;\r
-    #define CDW10_VALID             0x01\r
-    #define CDW11_VALID             0x02\r
-    #define CDW12_VALID             0x04\r
-    #define CDW13_VALID             0x08\r
-    #define CDW14_VALID             0x10\r
-    #define CDW15_VALID             0x20\r
-  UINT32                            Nsid;\r
-  UINT32                            Cdw10;\r
-  UINT32                            Cdw11;\r
-  UINT32                            Cdw12;\r
-  UINT32                            Cdw13;\r
-  UINT32                            Cdw14;\r
-  UINT32                            Cdw15;\r
-} NVM_EXPRESS_COMMAND;\r
-\r
-typedef struct {\r
-  UINT32                            Cdw0;\r
-  UINT32                            Cdw1;\r
-  UINT32                            Cdw2;\r
-  UINT32                            Cdw3;\r
-} NVM_EXPRESS_RESPONSE;\r
-\r
-typedef struct {\r
-  UINT64                            CommandTimeout;\r
-  UINT64                            TransferBuffer;\r
-  UINT32                            TransferLength;\r
-  UINT64                            MetadataBuffer;\r
-  UINT32                            MetadataLength;\r
-  UINT8                             QueueId;\r
-  NVM_EXPRESS_COMMAND               *NvmeCmd;\r
-  NVM_EXPRESS_RESPONSE              *NvmeResponse;\r
-} NVM_EXPRESS_PASS_THRU_COMMAND_PACKET;\r
-\r
-\r
-#pragma pack(1)\r
-\r
-// Internal fields\r
-typedef enum {\r
-  NvmeStatusUnknown,\r
-  NvmeStatusInit,\r
-  NvmeStatusInuse,\r
-  NvmeStatusMax,\r
-} NVME_STATUS;\r
-\r
-typedef struct {\r
-  UINT32                            Nbar;\r
-  VOID                              *BaseMem;\r
-  VOID                              *BaseMemMapping;\r
-  BOOLEAN                           PollCancellation;\r
-  UINT16                            NvmeInitWaitTime;\r
-\r
-  NVME_STATUS                       State;\r
-  UINT8                             BusID;\r
-  UINT8                             DeviceID;\r
-  UINT8                             FuncID;\r
-  UINTN                             PciBase;\r
-\r
-  UINT32                            Nsid;\r
-  UINT64                            Nsuuid;\r
-  UINT32                            BlockSize;\r
-  EFI_LBA                           LastBlock;\r
-\r
-  //\r
-  // Pointers to 4kB aligned submission & completion queues.\r
-  //\r
-  NVME_SQ                           *SqBuffer[NVME_MAX_IO_QUEUES];\r
-  NVME_CQ                           *CqBuffer[NVME_MAX_IO_QUEUES];\r
-  UINT16                            Cid[NVME_MAX_IO_QUEUES];\r
-\r
-  //\r
-  // Submission and completion queue indices.\r
-  //\r
-  NVME_SQTDBL                       SqTdbl[NVME_MAX_IO_QUEUES];\r
-  NVME_CQHDBL                       CqHdbl[NVME_MAX_IO_QUEUES];\r
-  UINT8                             Pt[NVME_MAX_IO_QUEUES];\r
-\r
-  UINTN                             SqeCount[NVME_MAX_IO_QUEUES];\r
-\r
-  //\r
-  // Nvme controller capabilities\r
-  //\r
-  NVME_CAP                          Cap;\r
-\r
-  //\r
-  // pointer to identify controller Data\r
-  //\r
-  NVME_ADMIN_CONTROLLER_DATA        *ControllerData;\r
-  NVME_ADMIN_NAMESPACE_DATA         *NamespaceData;\r
-} NVME_CONTEXT;\r
-\r
-#pragma pack()\r
-\r
-/**\r
-  Transfer MMIO Data to memory.\r
-\r
-  @param[in,out] MemBuffer - Destination: Memory address\r
-  @param[in] MmioAddr      - Source: MMIO address\r
-  @param[in] Size          - Size for read\r
-\r
-  @retval EFI_SUCCESS - MMIO read sucessfully\r
-**/\r
-EFI_STATUS\r
-NvmeMmioRead (\r
-  IN OUT VOID *MemBuffer,\r
-  IN     UINTN MmioAddr,\r
-  IN     UINTN Size\r
-  );\r
-\r
-/**\r
-  Transfer memory Data to MMIO.\r
-\r
-  @param[in,out] MmioAddr - Destination: MMIO address\r
-  @param[in] MemBuffer    - Source: Memory address\r
-  @param[in] Size         - Size for write\r
-\r
-  @retval EFI_SUCCESS - MMIO write sucessfully\r
-**/\r
-EFI_STATUS\r
-NvmeMmioWrite (\r
-  IN OUT UINTN MmioAddr,\r
-  IN     VOID *MemBuffer,\r
-  IN     UINTN Size\r
-  );\r
-\r
-/**\r
-  Transfer memory data to MMIO.\r
-\r
-  @param[in,out] MmioAddr - Destination: MMIO address\r
-  @param[in] MemBuffer    - Source: Memory address\r
-  @param[in] Size         - Size for write\r
-\r
-  @retval EFI_SUCCESS - MMIO write sucessfully\r
-**/\r
-EFI_STATUS\r
-OpalPciWrite (\r
-  IN OUT UINTN MmioAddr,\r
-  IN     VOID *MemBuffer,\r
-  IN     UINTN Size\r
-  );\r
-\r
-/**\r
-  Transfer MMIO data to memory.\r
-\r
-  @param[in,out] MemBuffer - Destination: Memory address\r
-  @param[in] MmioAddr      - Source: MMIO address\r
-  @param[in] Size          - Size for read\r
-\r
-  @retval EFI_SUCCESS - MMIO read sucessfully\r
-**/\r
-EFI_STATUS\r
-OpalPciRead (\r
-  IN OUT VOID *MemBuffer,\r
-  IN     UINTN MmioAddr,\r
-  IN     UINTN Size\r
-  );\r
-\r
-/**\r
-  Allocate transfer-related Data struct which is used at Nvme.\r
-\r
-  @param[in, out] Nvme          The pointer to the NVME_CONTEXT Data structure.\r
-\r
-  @retval EFI_OUT_OF_RESOURCE   No enough resource.\r
-  @retval EFI_SUCCESS           Successful to allocate resource.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-NvmeAllocateResource (\r
-  IN OUT NVME_CONTEXT       *Nvme\r
-  );\r
-\r
-/**\r
-  Free allocated transfer-related Data struct which is used at NVMe.\r
-\r
-  @param[in, out] Nvme          The pointer to the NVME_CONTEXT Data structure.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-NvmeFreeResource (\r
-  IN OUT NVME_CONTEXT       *Nvme\r
-  );\r
-\r
-/**\r
-  Sends an NVM Express Command Packet to an NVM Express controller or namespace. This function supports\r
-  both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the nonblocking\r
-  I/O functionality is optional.\r
-\r
-  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data structure.\r
-  @param[in] NamespaceId            - Is a 32 bit Namespace ID to which the Express HCI command packet will be sent.\r
-                                      A Value of 0 denotes the NVM Express controller, a Value of all 0FFh in the namespace\r
-                                      ID specifies that the command packet should be sent to all valid namespaces.\r
-  @param[in] NamespaceUuid          - Is a 64 bit Namespace UUID to which the Express HCI command packet will be sent.\r
-                                      A Value of 0 denotes the NVM Express controller, a Value of all 0FFh in the namespace\r
-                                      UUID specifies that the command packet should be sent to all valid namespaces.\r
-  @param[in,out] Packet             - A pointer to the NVM Express HCI Command Packet to send to the NVMe namespace specified\r
-                                      by NamespaceId.\r
-\r
-  @retval EFI_SUCCESS               - The NVM Express Command Packet was sent by the host. TransferLength bytes were transferred\r
-                                      to, or from DataBuffer.\r
-  @retval EFI_NOT_READY             - The NVM Express Command Packet could not be sent because the controller is not ready. The caller\r
-                                      may retry again later.\r
-  @retval EFI_DEVICE_ERROR          - A device error occurred while attempting to send the NVM Express Command Packet.\r
-  @retval EFI_INVALID_PARAMETER     - Namespace, or the contents of NVM_EXPRESS_PASS_THRU_COMMAND_PACKET are invalid. The NVM\r
-                                      Express Command Packet was not sent, so no additional status information is available.\r
-  @retval EFI_UNSUPPORTED           - The command described by the NVM Express Command Packet is not supported by the host adapter.\r
-                                      The NVM Express Command Packet was not sent, so no additional status information is available.\r
-  @retval EFI_TIMEOUT               - A timeout occurred while waiting for the NVM Express Command Packet to execute.\r
-\r
-**/\r
-EFI_STATUS\r
-NvmePassThru (\r
-  IN     NVME_CONTEXT                         *Nvme,\r
-  IN     UINT32                               NamespaceId,\r
-  IN     UINT64                               NamespaceUuid,\r
-  IN OUT NVM_EXPRESS_PASS_THRU_COMMAND_PACKET *Packet\r
-  );\r
-\r
-/**\r
-  Waits until all NVME commands completed.\r
-\r
-  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data structure.\r
-  @param[in] Qid                    - Queue index\r
-\r
-  @retval EFI_SUCCESS               - All NVME commands have completed\r
-  @retval EFI_TIMEOUT               - Timeout occured\r
-  @retval EFI_NOT_READY             - Not all NVME commands have completed\r
-  @retval others                    - Error occurred on device side.\r
-**/\r
-EFI_STATUS\r
-NvmeWaitAllComplete (\r
-  IN NVME_CONTEXT       *Nvme,\r
-  IN UINT8              Qid\r
-  );\r
-\r
-/**\r
-  Initialize the Nvm Express controller.\r
-\r
-  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data structure.\r
-\r
-  @retval EFI_SUCCESS               - The NVM Express Controller is initialized successfully.\r
-  @retval Others                    - A device error occurred while initializing the controller.\r
-\r
-**/\r
-EFI_STATUS\r
-NvmeControllerInit (\r
-  IN NVME_CONTEXT       *Nvme\r
-  );\r
-\r
-/**\r
-  Un-initialize the Nvm Express controller.\r
-\r
-  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data structure.\r
-\r
-  @retval EFI_SUCCESS               - The NVM Express Controller is un-initialized successfully.\r
-  @retval Others                    - A device error occurred while un-initializing the controller.\r
-\r
-**/\r
-EFI_STATUS\r
-NvmeControllerExit (\r
-  IN NVME_CONTEXT       *Nvme\r
-  );\r
-\r
-/**\r
-  Security send and receive commands.\r
-\r
-  @param[in]     Nvme                   - The pointer to the NVME_CONTEXT Data structure.\r
-  @param[in]     SendCommand            - The flag to indicate the command type, TRUE for Send command and FALSE for receive command\r
-  @param[in]     SecurityProtocol       - Security Protocol\r
-  @param[in]     SpSpecific             - Security Protocol Specific\r
-  @param[in]     TransferLength         - Transfer Length of Buffer (in bytes) - always a multiple of 512\r
-  @param[in,out] TransferBuffer         - Address of Data to transfer\r
-\r
-  @return EFI_SUCCESS               - Successfully create io submission queue.\r
-  @return others                    - Fail to send/receive commands.\r
-\r
-**/\r
-EFI_STATUS\r
-NvmeSecuritySendReceive (\r
-  IN NVME_CONTEXT                          *Nvme,\r
-  IN BOOLEAN                               SendCommand,\r
-  IN UINT8                                 SecurityProtocol,\r
-  IN UINT16                                SpSpecific,\r
-  IN UINTN                                 TransferLength,\r
-  IN OUT VOID                              *TransferBuffer\r
-  );\r
-\r
-#endif\r