]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPeiPassThru.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[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
ba3aa1c4 5 Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>\r
b8b69433 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
b8b69433
HW
14/**\r
15 Sends an NVM Express Command Packet to an NVM Express controller or namespace. This function only\r
16 supports blocking execution of the command.\r
17\r
18 @param[in] Private The pointer to the NVME_CONTEXT Data structure.\r
19 @param[in] NamespaceId Is a 32 bit Namespace ID to which the Express HCI command packet will\r
20 be sent.\r
21 A Value of 0 denotes the NVM Express controller, a Value of all 0FFh in\r
22 the namespace ID specifies that the command packet should be sent to all\r
23 valid namespaces.\r
24 @param[in,out] Packet A pointer to the EDKII PEI NVM Express PassThru Command Packet to send\r
25 to the NVMe namespace specified by NamespaceId.\r
26\r
27 @retval EFI_SUCCESS The EDKII PEI NVM Express Command Packet was sent by the host.\r
28 TransferLength bytes were transferred to, or from DataBuffer.\r
29 @retval EFI_NOT_READY The EDKII PEI NVM Express Command Packet could not be sent because\r
30 the controller is not ready. The caller may retry again later.\r
31 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the EDKII PEI NVM\r
32 Express Command Packet.\r
33 @retval EFI_INVALID_PARAMETER Namespace, or the contents of EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET\r
34 are invalid.\r
35 The EDKII PEI NVM Express Command Packet was not sent, so no\r
36 additional status information is available.\r
37 @retval EFI_UNSUPPORTED The command described by the EDKII PEI NVM Express Command Packet\r
38 is not supported by the host adapter.\r
39 The EDKII PEI NVM Express Command Packet was not sent, so no\r
40 additional status information is available.\r
41 @retval EFI_TIMEOUT A timeout occurred while waiting for the EDKII PEI NVM Express Command\r
42 Packet to execute.\r
43\r
44**/\r
45EFI_STATUS\r
ba3aa1c4 46NvmePassThruExecute (\r
1436aea4
MK
47 IN PEI_NVME_CONTROLLER_PRIVATE_DATA *Private,\r
48 IN UINT32 NamespaceId,\r
49 IN OUT EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET *Packet\r
ba3aa1c4
MC
50 );\r
51\r
52/**\r
53 Gets the device path information of the underlying NVM Express host controller.\r
54\r
55 @param[in] This The PPI instance pointer.\r
56 @param[out] DevicePathLength The length of the device path in bytes specified\r
57 by DevicePath.\r
58 @param[out] DevicePath The device path of the underlying NVM Express\r
59 host controller.\r
60 This field re-uses EFI Device Path Protocol as\r
61 defined by Section 10.2 EFI Device Path Protocol\r
62 of UEFI 2.7 Specification.\r
63\r
64 @retval EFI_SUCCESS The operation succeeds.\r
65 @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL.\r
66 @retval EFI_OUT_OF_RESOURCES The operation fails due to lack of resources.\r
67\r
68**/\r
69EFI_STATUS\r
70EFIAPI\r
71NvmePassThruGetDevicePath (\r
1436aea4
MK
72 IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This,\r
73 OUT UINTN *DevicePathLength,\r
74 OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
ba3aa1c4
MC
75 );\r
76\r
77/**\r
78 Used to retrieve the next namespace ID for this NVM Express controller.\r
79\r
80 If on input the value pointed to by NamespaceId is 0xFFFFFFFF, then the first\r
81 valid namespace ID defined on the NVM Express controller is returned in the\r
82 location pointed to by NamespaceId and a status of EFI_SUCCESS is returned.\r
83\r
84 If on input the value pointed to by NamespaceId is an invalid namespace ID\r
85 other than 0xFFFFFFFF, then EFI_INVALID_PARAMETER is returned.\r
86\r
87 If on input the value pointed to by NamespaceId is a valid namespace ID, then\r
88 the next valid namespace ID on the NVM Express controller is returned in the\r
89 location pointed to by NamespaceId, and EFI_SUCCESS is returned.\r
90\r
91 If the value pointed to by NamespaceId is the namespace ID of the last\r
92 namespace on the NVM Express controller, then EFI_NOT_FOUND is returned.\r
93\r
94 @param[in] This The PPI instance pointer.\r
95 @param[in,out] NamespaceId On input, a pointer to a legal NamespaceId\r
96 for an NVM Express namespace present on the\r
97 NVM Express controller. On output, a pointer\r
98 to the next NamespaceId of an NVM Express\r
99 namespace on an NVM Express controller. An\r
100 input value of 0xFFFFFFFF retrieves the\r
101 first NamespaceId for an NVM Express\r
102 namespace present on an NVM Express\r
103 controller.\r
104\r
105 @retval EFI_SUCCESS The Namespace ID of the next Namespace was\r
106 returned.\r
107 @retval EFI_NOT_FOUND There are no more namespaces defined on this\r
108 controller.\r
109 @retval EFI_INVALID_PARAMETER NamespaceId is an invalid value other than\r
110 0xFFFFFFFF.\r
111\r
112**/\r
113EFI_STATUS\r
114EFIAPI\r
115NvmePassThruGetNextNameSpace (\r
1436aea4
MK
116 IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This,\r
117 IN OUT UINT32 *NamespaceId\r
ba3aa1c4
MC
118 );\r
119\r
120/**\r
121 Sends an NVM Express Command Packet to an NVM Express controller or namespace. This function only\r
122 supports blocking execution of the command.\r
123\r
124 @param[in] This The PPI instance pointer.\r
125 @param[in] NamespaceId Is a 32 bit Namespace ID to which the Nvm Express command packet will\r
126 be sent.\r
127 A Value of 0 denotes the NVM Express controller, a Value of all 0FFh in\r
128 the namespace ID specifies that the command packet should be sent to all\r
129 valid namespaces.\r
130 @param[in,out] Packet A pointer to the EDKII PEI NVM Express PassThru Command Packet to send\r
131 to the NVMe namespace specified by NamespaceId.\r
132\r
133 @retval EFI_SUCCESS The EDKII PEI NVM Express Command Packet was sent by the host.\r
134 TransferLength bytes were transferred to, or from DataBuffer.\r
135 @retval EFI_NOT_READY The EDKII PEI NVM Express Command Packet could not be sent because\r
136 the controller is not ready. The caller may retry again later.\r
137 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the EDKII PEI NVM\r
138 Express Command Packet.\r
139 @retval EFI_INVALID_PARAMETER Namespace, or the contents of EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET\r
140 are invalid.\r
141 The EDKII PEI NVM Express Command Packet was not sent, so no\r
142 additional status information is available.\r
143 @retval EFI_UNSUPPORTED The command described by the EDKII PEI NVM Express Command Packet\r
144 is not supported by the host adapter.\r
145 The EDKII PEI NVM Express Command Packet was not sent, so no\r
146 additional status information is available.\r
147 @retval EFI_TIMEOUT A timeout occurred while waiting for the EDKII PEI NVM Express Command\r
148 Packet to execute.\r
149\r
150**/\r
151EFI_STATUS\r
152EFIAPI\r
153NvmePassThru (\r
1436aea4
MK
154 IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This,\r
155 IN UINT32 NamespaceId,\r
156 IN OUT EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET *Packet\r
b8b69433
HW
157 );\r
158\r
159#endif\r