]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressBlockIo.h
MdeModulePkg: Convert all .uni files to utf-8
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / NvmExpressDxe / NvmExpressBlockIo.h
CommitLineData
eb290d02
FT
1/** @file\r
2 Header file for EFI_BLOCK_IO_PROTOCOL interface.\r
3\r
754b489b 4Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\r
eb290d02
FT
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _EFI_NVME_BLOCKIO_H_\r
16#define _EFI_NVME_BLOCKIO_H_\r
17\r
18/**\r
19 Reset the Block Device.\r
20\r
21 @param This Indicates a pointer to the calling context.\r
22 @param ExtendedVerification Driver may perform diagnostics on reset.\r
23\r
24 @retval EFI_SUCCESS The device was reset.\r
25 @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
26 not be reset.\r
27\r
28**/\r
29EFI_STATUS\r
30EFIAPI\r
31NvmeBlockIoReset (\r
32 IN EFI_BLOCK_IO_PROTOCOL *This,\r
33 IN BOOLEAN ExtendedVerification\r
34 );\r
35\r
36/**\r
37 Read BufferSize bytes from Lba into Buffer.\r
38\r
39 @param This Indicates a pointer to the calling context.\r
40 @param MediaId Id of the media, changes every time the media is replaced.\r
41 @param Lba The starting Logical Block Address to read from\r
42 @param BufferSize Size of Buffer, must be a multiple of device block size.\r
43 @param Buffer A pointer to the destination buffer for the data. The caller is\r
44 responsible for either having implicit or explicit ownership of the buffer.\r
45\r
46 @retval EFI_SUCCESS The data was read correctly from the device.\r
47 @retval EFI_DEVICE_ERROR The device reported an error while performing the read.\r
48 @retval EFI_NO_MEDIA There is no media in the device.\r
49 @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.\r
50 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
51 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
52 or the buffer is not on proper alignment.\r
53\r
54**/\r
55EFI_STATUS\r
56EFIAPI\r
57NvmeBlockIoReadBlocks (\r
58 IN EFI_BLOCK_IO_PROTOCOL *This,\r
59 IN UINT32 MediaId,\r
60 IN EFI_LBA Lba,\r
61 IN UINTN BufferSize,\r
62 OUT VOID *Buffer\r
63 );\r
64\r
65/**\r
66 Write BufferSize bytes from Lba into Buffer.\r
67\r
68 @param This Indicates a pointer to the calling context.\r
69 @param MediaId The media ID that the write request is for.\r
70 @param Lba The starting logical block address to be written. The caller is\r
71 responsible for writing to only legitimate locations.\r
72 @param BufferSize Size of Buffer, must be a multiple of device block size.\r
73 @param Buffer A pointer to the source buffer for the data.\r
74\r
75 @retval EFI_SUCCESS The data was written correctly to the device.\r
76 @retval EFI_WRITE_PROTECTED The device can not be written to.\r
77 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r
78 @retval EFI_NO_MEDIA There is no media in the device.\r
79 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
80 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
81 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r
82 or the buffer is not on proper alignment.\r
83\r
84**/\r
85EFI_STATUS\r
86EFIAPI\r
87NvmeBlockIoWriteBlocks (\r
88 IN EFI_BLOCK_IO_PROTOCOL *This,\r
89 IN UINT32 MediaId,\r
90 IN EFI_LBA Lba,\r
91 IN UINTN BufferSize,\r
92 IN VOID *Buffer\r
93 );\r
94\r
95/**\r
96 Flush the Block Device.\r
97\r
98 @param This Indicates a pointer to the calling context.\r
99\r
100 @retval EFI_SUCCESS All outstanding data was written to the device\r
101 @retval EFI_DEVICE_ERROR The device reported an error while writing back the data\r
102 @retval EFI_NO_MEDIA There is no media in the device.\r
103\r
104**/\r
105EFI_STATUS\r
106EFIAPI\r
107NvmeBlockIoFlushBlocks (\r
108 IN EFI_BLOCK_IO_PROTOCOL *This\r
109 );\r
110\r
754b489b
TF
111/**\r
112 Send a security protocol command to a device that receives data and/or the result\r
113 of one or more commands sent by SendData.\r
114\r
115 The ReceiveData function sends a security protocol command to the given MediaId.\r
116 The security protocol command sent is defined by SecurityProtocolId and contains\r
117 the security protocol specific data SecurityProtocolSpecificData. The function\r
118 returns the data from the security protocol command in PayloadBuffer.\r
119\r
120 For devices supporting the SCSI command set, the security protocol command is sent\r
121 using the SECURITY PROTOCOL IN command defined in SPC-4.\r
122\r
123 For devices supporting the ATA command set, the security protocol command is sent\r
124 using one of the TRUSTED RECEIVE commands defined in ATA8-ACS if PayloadBufferSize\r
125 is non-zero.\r
126\r
127 If the PayloadBufferSize is zero, the security protocol command is sent using the\r
128 Trusted Non-Data command defined in ATA8-ACS.\r
129\r
130 If PayloadBufferSize is too small to store the available data from the security\r
131 protocol command, the function shall copy PayloadBufferSize bytes into the\r
132 PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.\r
133\r
134 If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero,\r
135 the function shall return EFI_INVALID_PARAMETER.\r
136\r
137 If the given MediaId does not support security protocol commands, the function shall\r
138 return EFI_UNSUPPORTED. If there is no media in the device, the function returns\r
139 EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the device,\r
140 the function returns EFI_MEDIA_CHANGED.\r
141\r
142 If the security protocol fails to complete within the Timeout period, the function\r
143 shall return EFI_TIMEOUT.\r
144\r
145 If the security protocol command completes without an error, the function shall\r
146 return EFI_SUCCESS. If the security protocol command completes with an error, the\r
147 function shall return EFI_DEVICE_ERROR.\r
148\r
149 @param This Indicates a pointer to the calling context.\r
150 @param MediaId ID of the medium to receive data from.\r
151 @param Timeout The timeout, in 100ns units, to use for the execution\r
152 of the security protocol command. A Timeout value of 0\r
153 means that this function will wait indefinitely for the\r
154 security protocol command to execute. If Timeout is greater\r
155 than zero, then this function will return EFI_TIMEOUT\r
156 if the time required to execute the receive data command\r
157 is greater than Timeout.\r
158 @param SecurityProtocolId The value of the "Security Protocol" parameter of\r
159 the security protocol command to be sent.\r
160 @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r
161 of the security protocol command to be sent.\r
162 @param PayloadBufferSize Size in bytes of the payload data buffer.\r
163 @param PayloadBuffer A pointer to a destination buffer to store the security\r
164 protocol command specific payload data for the security\r
165 protocol command. The caller is responsible for having\r
166 either implicit or explicit ownership of the buffer.\r
167 @param PayloadTransferSize A pointer to a buffer to store the size in bytes of the\r
168 data written to the payload data buffer.\r
169\r
170 @retval EFI_SUCCESS The security protocol command completed successfully.\r
171 @retval EFI_WARN_BUFFER_TOO_SMALL The PayloadBufferSize was too small to store the available\r
172 data from the device. The PayloadBuffer contains the truncated data.\r
173 @retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.\r
174 @retval EFI_DEVICE_ERROR The security protocol command completed with an error.\r
175 @retval EFI_NO_MEDIA There is no media in the device.\r
176 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
177 @retval EFI_INVALID_PARAMETER The PayloadBuffer or PayloadTransferSize is NULL and\r
178 PayloadBufferSize is non-zero.\r
179 @retval EFI_TIMEOUT A timeout occurred while waiting for the security\r
180 protocol command to execute.\r
181\r
182**/\r
183EFI_STATUS\r
184EFIAPI\r
185NvmeStorageSecurityReceiveData (\r
186 IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,\r
187 IN UINT32 MediaId,\r
188 IN UINT64 Timeout,\r
189 IN UINT8 SecurityProtocolId,\r
190 IN UINT16 SecurityProtocolSpecificData,\r
191 IN UINTN PayloadBufferSize,\r
192 OUT VOID *PayloadBuffer,\r
193 OUT UINTN *PayloadTransferSize\r
194 );\r
195\r
196/**\r
197 Send a security protocol command to a device.\r
198\r
199 The SendData function sends a security protocol command containing the payload\r
200 PayloadBuffer to the given MediaId. The security protocol command sent is\r
201 defined by SecurityProtocolId and contains the security protocol specific data\r
202 SecurityProtocolSpecificData. If the underlying protocol command requires a\r
203 specific padding for the command payload, the SendData function shall add padding\r
204 bytes to the command payload to satisfy the padding requirements.\r
205\r
206 For devices supporting the SCSI command set, the security protocol command is sent\r
207 using the SECURITY PROTOCOL OUT command defined in SPC-4.\r
208\r
209 For devices supporting the ATA command set, the security protocol command is sent\r
210 using one of the TRUSTED SEND commands defined in ATA8-ACS if PayloadBufferSize\r
211 is non-zero. If the PayloadBufferSize is zero, the security protocol command is\r
212 sent using the Trusted Non-Data command defined in ATA8-ACS.\r
213\r
214 If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall\r
215 return EFI_INVALID_PARAMETER.\r
216\r
217 If the given MediaId does not support security protocol commands, the function\r
218 shall return EFI_UNSUPPORTED. If there is no media in the device, the function\r
219 returns EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the\r
220 device, the function returns EFI_MEDIA_CHANGED.\r
221\r
222 If the security protocol fails to complete within the Timeout period, the function\r
223 shall return EFI_TIMEOUT.\r
224\r
225 If the security protocol command completes without an error, the function shall return\r
226 EFI_SUCCESS. If the security protocol command completes with an error, the function\r
227 shall return EFI_DEVICE_ERROR.\r
228\r
229 @param This Indicates a pointer to the calling context.\r
230 @param MediaId ID of the medium to receive data from.\r
231 @param Timeout The timeout, in 100ns units, to use for the execution\r
232 of the security protocol command. A Timeout value of 0\r
233 means that this function will wait indefinitely for the\r
234 security protocol command to execute. If Timeout is greater\r
235 than zero, then this function will return EFI_TIMEOUT\r
236 if the time required to execute the receive data command\r
237 is greater than Timeout.\r
238 @param SecurityProtocolId The value of the "Security Protocol" parameter of\r
239 the security protocol command to be sent.\r
240 @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r
241 of the security protocol command to be sent.\r
242 @param PayloadBufferSize Size in bytes of the payload data buffer.\r
243 @param PayloadBuffer A pointer to a destination buffer to store the security\r
244 protocol command specific payload data for the security\r
245 protocol command.\r
246\r
247 @retval EFI_SUCCESS The security protocol command completed successfully.\r
248 @retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.\r
249 @retval EFI_DEVICE_ERROR The security protocol command completed with an error.\r
250 @retval EFI_NO_MEDIA There is no media in the device.\r
251 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
252 @retval EFI_INVALID_PARAMETER The PayloadBuffer is NULL and PayloadBufferSize is non-zero.\r
253 @retval EFI_TIMEOUT A timeout occurred while waiting for the security\r
254 protocol command to execute.\r
255\r
256**/\r
257EFI_STATUS\r
258EFIAPI\r
259NvmeStorageSecuritySendData (\r
260 IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,\r
261 IN UINT32 MediaId,\r
262 IN UINT64 Timeout,\r
263 IN UINT8 SecurityProtocolId,\r
264 IN UINT16 SecurityProtocolSpecificData,\r
265 IN UINTN PayloadBufferSize,\r
266 IN VOID *PayloadBuffer\r
267 );\r
268\r
eb290d02 269#endif\r