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