]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPeiPassThru.h
IntelSiliconPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / NvmExpressPei / NvmExpressPeiPassThru.h
CommitLineData
b8b69433
HW
1/** @file\r
2 The NvmExpressPei driver is used to manage non-volatile memory subsystem\r
3 which follows NVM Express specification at PEI phase.\r
4\r
5 Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
6\r
7 This program and the accompanying materials\r
8 are licensed and made available under the terms and conditions\r
9 of the BSD License which accompanies this distribution. The\r
10 full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18#ifndef _NVM_EXPRESS_PEI_PASSTHRU_H_\r
19#define _NVM_EXPRESS_PEI_PASSTHRU_H_\r
20\r
21#define NVME_CONTROLLER_NSID 0\r
22\r
23typedef struct {\r
24 UINT8 Opcode;\r
25 UINT8 FusedOperation;\r
26 #define NORMAL_CMD 0x00\r
27 #define FUSED_FIRST_CMD 0x01\r
28 #define FUSED_SECOND_CMD 0x02\r
29 UINT16 Cid;\r
30} NVME_CDW0;\r
31\r
32typedef struct {\r
33 NVME_CDW0 Cdw0;\r
34 UINT8 Flags;\r
35 #define CDW10_VALID 0x01\r
36 #define CDW11_VALID 0x02\r
37 #define CDW12_VALID 0x04\r
38 #define CDW13_VALID 0x08\r
39 #define CDW14_VALID 0x10\r
40 #define CDW15_VALID 0x20\r
41 UINT32 Nsid;\r
42 UINT32 Cdw10;\r
43 UINT32 Cdw11;\r
44 UINT32 Cdw12;\r
45 UINT32 Cdw13;\r
46 UINT32 Cdw14;\r
47 UINT32 Cdw15;\r
48} EDKII_PEI_NVM_EXPRESS_COMMAND;\r
49\r
50typedef struct {\r
51 UINT32 Cdw0;\r
52 UINT32 Cdw1;\r
53 UINT32 Cdw2;\r
54 UINT32 Cdw3;\r
55} EDKII_PEI_NVM_EXPRESS_COMPLETION;\r
56\r
57typedef struct {\r
58 UINT64 CommandTimeout;\r
59 VOID *TransferBuffer;\r
60 UINT32 TransferLength;\r
61 VOID *MetadataBuffer;\r
62 UINT32 MetadataLength;\r
63 UINT8 QueueType;\r
64 EDKII_PEI_NVM_EXPRESS_COMMAND *NvmeCmd;\r
65 EDKII_PEI_NVM_EXPRESS_COMPLETION *NvmeCompletion;\r
66} EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET;\r
67\r
68\r
69/**\r
70 Sends an NVM Express Command Packet to an NVM Express controller or namespace. This function only\r
71 supports blocking execution of the command.\r
72\r
73 @param[in] Private The pointer to the NVME_CONTEXT Data structure.\r
74 @param[in] NamespaceId Is a 32 bit Namespace ID to which the Express HCI command packet will\r
75 be sent.\r
76 A Value of 0 denotes the NVM Express controller, a Value of all 0FFh in\r
77 the namespace ID specifies that the command packet should be sent to all\r
78 valid namespaces.\r
79 @param[in,out] Packet A pointer to the EDKII PEI NVM Express PassThru Command Packet to send\r
80 to the NVMe namespace specified by NamespaceId.\r
81\r
82 @retval EFI_SUCCESS The EDKII PEI NVM Express Command Packet was sent by the host.\r
83 TransferLength bytes were transferred to, or from DataBuffer.\r
84 @retval EFI_NOT_READY The EDKII PEI NVM Express Command Packet could not be sent because\r
85 the controller is not ready. The caller may retry again later.\r
86 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the EDKII PEI NVM\r
87 Express Command Packet.\r
88 @retval EFI_INVALID_PARAMETER Namespace, or the contents of EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET\r
89 are invalid.\r
90 The EDKII PEI NVM Express Command Packet was not sent, so no\r
91 additional status information is available.\r
92 @retval EFI_UNSUPPORTED The command described by the EDKII PEI NVM Express Command Packet\r
93 is not supported by the host adapter.\r
94 The EDKII PEI NVM Express Command Packet was not sent, so no\r
95 additional status information is available.\r
96 @retval EFI_TIMEOUT A timeout occurred while waiting for the EDKII PEI NVM Express Command\r
97 Packet to execute.\r
98\r
99**/\r
100EFI_STATUS\r
101NvmePassThru (\r
102 IN PEI_NVME_CONTROLLER_PRIVATE_DATA *Private,\r
103 IN UINT32 NamespaceId,\r
104 IN OUT EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET *Packet\r
105 );\r
106\r
107#endif\r