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