Commit | Line | Data |
---|---|---|
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 | |
9d510e61 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
b8b69433 HW |
8 | \r |
9 | **/\r | |
10 | \r | |
11 | #ifndef _NVM_EXPRESS_PEI_PASSTHRU_H_\r | |
12 | #define _NVM_EXPRESS_PEI_PASSTHRU_H_\r | |
13 | \r | |
14 | #define NVME_CONTROLLER_NSID 0\r | |
15 | \r | |
16 | typedef struct {\r | |
17 | UINT8 Opcode;\r | |
18 | UINT8 FusedOperation;\r | |
19 | #define NORMAL_CMD 0x00\r | |
20 | #define FUSED_FIRST_CMD 0x01\r | |
21 | #define FUSED_SECOND_CMD 0x02\r | |
22 | UINT16 Cid;\r | |
23 | } NVME_CDW0;\r | |
24 | \r | |
25 | typedef struct {\r | |
26 | NVME_CDW0 Cdw0;\r | |
27 | UINT8 Flags;\r | |
28 | #define CDW10_VALID 0x01\r | |
29 | #define CDW11_VALID 0x02\r | |
30 | #define CDW12_VALID 0x04\r | |
31 | #define CDW13_VALID 0x08\r | |
32 | #define CDW14_VALID 0x10\r | |
33 | #define CDW15_VALID 0x20\r | |
34 | UINT32 Nsid;\r | |
35 | UINT32 Cdw10;\r | |
36 | UINT32 Cdw11;\r | |
37 | UINT32 Cdw12;\r | |
38 | UINT32 Cdw13;\r | |
39 | UINT32 Cdw14;\r | |
40 | UINT32 Cdw15;\r | |
41 | } EDKII_PEI_NVM_EXPRESS_COMMAND;\r | |
42 | \r | |
43 | typedef struct {\r | |
44 | UINT32 Cdw0;\r | |
45 | UINT32 Cdw1;\r | |
46 | UINT32 Cdw2;\r | |
47 | UINT32 Cdw3;\r | |
48 | } EDKII_PEI_NVM_EXPRESS_COMPLETION;\r | |
49 | \r | |
50 | typedef struct {\r | |
51 | UINT64 CommandTimeout;\r | |
52 | VOID *TransferBuffer;\r | |
53 | UINT32 TransferLength;\r | |
54 | VOID *MetadataBuffer;\r | |
55 | UINT32 MetadataLength;\r | |
56 | UINT8 QueueType;\r | |
57 | EDKII_PEI_NVM_EXPRESS_COMMAND *NvmeCmd;\r | |
58 | EDKII_PEI_NVM_EXPRESS_COMPLETION *NvmeCompletion;\r | |
59 | } EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET;\r | |
60 | \r | |
61 | \r | |
62 | /**\r | |
63 | Sends an NVM Express Command Packet to an NVM Express controller or namespace. This function only\r | |
64 | supports blocking execution of the command.\r | |
65 | \r | |
66 | @param[in] Private The pointer to the NVME_CONTEXT Data structure.\r | |
67 | @param[in] NamespaceId Is a 32 bit Namespace ID to which the Express HCI command packet will\r | |
68 | be sent.\r | |
69 | A Value of 0 denotes the NVM Express controller, a Value of all 0FFh in\r | |
70 | the namespace ID specifies that the command packet should be sent to all\r | |
71 | valid namespaces.\r | |
72 | @param[in,out] Packet A pointer to the EDKII PEI NVM Express PassThru Command Packet to send\r | |
73 | to the NVMe namespace specified by NamespaceId.\r | |
74 | \r | |
75 | @retval EFI_SUCCESS The EDKII PEI NVM Express Command Packet was sent by the host.\r | |
76 | TransferLength bytes were transferred to, or from DataBuffer.\r | |
77 | @retval EFI_NOT_READY The EDKII PEI NVM Express Command Packet could not be sent because\r | |
78 | the controller is not ready. The caller may retry again later.\r | |
79 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the EDKII PEI NVM\r | |
80 | Express Command Packet.\r | |
81 | @retval EFI_INVALID_PARAMETER Namespace, or the contents of EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET\r | |
82 | are invalid.\r | |
83 | The EDKII PEI NVM Express Command Packet was not sent, so no\r | |
84 | additional status information is available.\r | |
85 | @retval EFI_UNSUPPORTED The command described by the EDKII PEI NVM Express Command Packet\r | |
86 | is not supported by the host adapter.\r | |
87 | The EDKII PEI NVM Express Command Packet was not sent, so no\r | |
88 | additional status information is available.\r | |
89 | @retval EFI_TIMEOUT A timeout occurred while waiting for the EDKII PEI NVM Express Command\r | |
90 | Packet to execute.\r | |
91 | \r | |
92 | **/\r | |
93 | EFI_STATUS\r | |
94 | NvmePassThru (\r | |
95 | IN PEI_NVME_CONTROLLER_PRIVATE_DATA *Private,\r | |
96 | IN UINT32 NamespaceId,\r | |
97 | IN OUT EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET *Packet\r | |
98 | );\r | |
99 | \r | |
100 | #endif\r |