]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Ppi/NvmExpressPassThru.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Include / Ppi / NvmExpressPassThru.h
1 /** @file
2
3 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
5
6 **/
7
8 #ifndef _EDKII_NVME_PASS_THRU_PPI_H_
9 #define _EDKII_NVME_PASS_THRU_PPI_H_
10
11 #include <Protocol/DevicePath.h>
12 #include <Protocol/NvmExpressPassthru.h>
13
14 ///
15 /// Global ID for the EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI.
16 ///
17 #define EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI_GUID \
18 { \
19 0x6af31b2c, 0x3be, 0x46c1, { 0xb1, 0x2d, 0xea, 0x4a, 0x36, 0xdf, 0xa7, 0x4c } \
20 }
21
22 //
23 // Forward declaration for the EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI.
24 //
25 typedef struct _EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI;
26
27 //
28 // Revision The revision to which the Nvme Pass Thru PPI interface adheres.
29 // All future revisions must be backwards compatible.
30 // If a future version is not back wards compatible it is not the same GUID.
31 //
32 #define EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI_REVISION 0x00010000
33
34 /**
35 Gets the device path information of the underlying NVM Express host controller.
36
37 @param[in] This The PPI instance pointer.
38 @param[out] DevicePathLength The length of the device path in bytes specified
39 by DevicePath.
40 @param[out] DevicePath The device path of the underlying NVM Express
41 host controller.
42 This field re-uses EFI Device Path Protocol as
43 defined by Section 10.2 EFI Device Path Protocol
44 of UEFI 2.7 Specification.
45
46 @retval EFI_SUCCESS The operation succeeds.
47 @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL.
48 @retval EFI_OUT_OF_RESOURCES The operation fails due to lack of resources.
49
50 **/
51 typedef
52 EFI_STATUS
53 (EFIAPI *EDKII_PEI_NVME_PASS_THRU_GET_DEVICE_PATH)(
54 IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This,
55 OUT UINTN *DevicePathLength,
56 OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
57 );
58
59 /**
60 Used to retrieve the next namespace ID for this NVM Express controller.
61
62 If on input the value pointed to by NamespaceId is 0xFFFFFFFF, then the first
63 valid namespace ID defined on the NVM Express controller is returned in the
64 location pointed to by NamespaceId and a status of EFI_SUCCESS is returned.
65
66 If on input the value pointed to by NamespaceId is an invalid namespace ID
67 other than 0xFFFFFFFF, then EFI_INVALID_PARAMETER is returned.
68
69 If on input the value pointed to by NamespaceId is a valid namespace ID, then
70 the next valid namespace ID on the NVM Express controller is returned in the
71 location pointed to by NamespaceId, and EFI_SUCCESS is returned.
72
73 If the value pointed to by NamespaceId is the namespace ID of the last
74 namespace on the NVM Express controller, then EFI_NOT_FOUND is returned.
75
76 @param[in] This The PPI instance pointer.
77 @param[in,out] NamespaceId On input, a pointer to a legal NamespaceId
78 for an NVM Express namespace present on the
79 NVM Express controller. On output, a pointer
80 to the next NamespaceId of an NVM Express
81 namespace on an NVM Express controller. An
82 input value of 0xFFFFFFFF retrieves the
83 first NamespaceId for an NVM Express
84 namespace present on an NVM Express
85 controller.
86
87 @retval EFI_SUCCESS The Namespace ID of the next Namespace was
88 returned.
89 @retval EFI_NOT_FOUND There are no more namespaces defined on this
90 controller.
91 @retval EFI_INVALID_PARAMETER NamespaceId is an invalid value other than
92 0xFFFFFFFF.
93
94 **/
95 typedef
96 EFI_STATUS
97 (EFIAPI *EDKII_PEI_NVME_PASS_THRU_GET_NEXT_NAMESPACE)(
98 IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This,
99 IN OUT UINT32 *NamespaceId
100 );
101
102 /**
103 Sends an NVM Express Command Packet to an NVM Express controller or namespace. This function only
104 supports blocking execution of the command.
105
106 @param[in] This The PPI instance pointer.
107 @param[in] NamespaceId Is a 32 bit Namespace ID to which the Nvm Express command packet will
108 be sent.
109 A Value of 0 denotes the NVM Express controller, a Value of all 0FFh in
110 the namespace ID specifies that the command packet should be sent to all
111 valid namespaces.
112 @param[in,out] Packet A pointer to the EDKII PEI NVM Express PassThru Command Packet to send
113 to the NVMe namespace specified by NamespaceId.
114
115 @retval EFI_SUCCESS The EDKII PEI NVM Express Command Packet was sent by the host.
116 TransferLength bytes were transferred to, or from DataBuffer.
117 @retval EFI_NOT_READY The EDKII PEI NVM Express Command Packet could not be sent because
118 the controller is not ready. The caller may retry again later.
119 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the EDKII PEI NVM
120 Express Command Packet.
121 @retval EFI_INVALID_PARAMETER Namespace, or the contents of EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET
122 are invalid.
123 The EDKII PEI NVM Express Command Packet was not sent, so no
124 additional status information is available.
125 @retval EFI_UNSUPPORTED The command described by the EDKII PEI NVM Express Command Packet
126 is not supported by the host adapter.
127 The EDKII PEI NVM Express Command Packet was not sent, so no
128 additional status information is available.
129 @retval EFI_TIMEOUT A timeout occurred while waiting for the EDKII PEI NVM Express Command
130 Packet to execute.
131
132 **/
133 typedef
134 EFI_STATUS
135 (EFIAPI *EDKII_PEI_NVME_PASS_THRU_PASSTHRU)(
136 IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This,
137 IN UINT32 NamespaceId,
138 IN OUT EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET *Packet
139 );
140
141 //
142 // This PPI contains a set of services to send commands
143 // to a mass storage device.
144 //
145 struct _EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI {
146 UINT64 Revision;
147 EFI_NVM_EXPRESS_PASS_THRU_MODE *Mode;
148 EDKII_PEI_NVME_PASS_THRU_GET_DEVICE_PATH GetDevicePath;
149 EDKII_PEI_NVME_PASS_THRU_GET_NEXT_NAMESPACE GetNextNameSpace;
150 EDKII_PEI_NVME_PASS_THRU_PASSTHRU PassThru;
151 };
152
153 extern EFI_GUID gEdkiiPeiNvmExpressPassThruPpiGuid;
154
155 #endif