2 Header file for SdDxe Driver.
4 This file defines common data structures, macro definitions and some module
5 internal function header files.
7 Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #ifndef _SD_BLOCK_IO_H_
13 #define _SD_BLOCK_IO_H_
16 Reset the Block Device.
18 @param This Indicates a pointer to the calling context.
19 @param ExtendedVerification Driver may perform diagnostics on reset.
21 @retval EFI_SUCCESS The device was reset.
22 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
29 IN EFI_BLOCK_IO_PROTOCOL
*This
,
30 IN BOOLEAN ExtendedVerification
34 Read BufferSize bytes from Lba into Buffer.
36 @param This Indicates a pointer to the calling context.
37 @param MediaId Id of the media, changes every time the media is replaced.
38 @param Lba The starting Logical Block Address to read from
39 @param BufferSize Size of Buffer, must be a multiple of device block size.
40 @param Buffer A pointer to the destination buffer for the data. The caller is
41 responsible for either having implicit or explicit ownership of the buffer.
43 @retval EFI_SUCCESS The data was read correctly from the device.
44 @retval EFI_DEVICE_ERROR The device reported an error while performing the read.
45 @retval EFI_NO_MEDIA There is no media in the device.
46 @retval EFI_MEDIA_CHANGED The MediaId does not match the current device.
47 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
48 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
49 or the buffer is not on proper alignment.
55 IN EFI_BLOCK_IO_PROTOCOL
*This
,
63 Write BufferSize bytes from Lba into Buffer.
65 @param This Indicates a pointer to the calling context.
66 @param MediaId The media ID that the write request is for.
67 @param Lba The starting logical block address to be written. The caller is
68 responsible for writing to only legitimate locations.
69 @param BufferSize Size of Buffer, must be a multiple of device block size.
70 @param Buffer A pointer to the source buffer for the data.
72 @retval EFI_SUCCESS The data was written correctly to the device.
73 @retval EFI_WRITE_PROTECTED The device can not be written to.
74 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
75 @retval EFI_NO_MEDIA There is no media in the device.
76 @retval EFI_MEDIA_CHANGED The MediaId does not match the current device.
77 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
78 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
79 or the buffer is not on proper alignment.
85 IN EFI_BLOCK_IO_PROTOCOL
*This
,
93 Flush the Block Device.
95 @param This Indicates a pointer to the calling context.
97 @retval EFI_SUCCESS All outstanding data was written to the device
98 @retval EFI_DEVICE_ERROR The device reported an error while writing back the data
99 @retval EFI_NO_MEDIA There is no media in the device.
105 IN EFI_BLOCK_IO_PROTOCOL
*This
109 Reset the Block Device.
111 @param[in] This Indicates a pointer to the calling context.
112 @param[in] ExtendedVerification Driver may perform diagnostics on reset.
114 @retval EFI_SUCCESS The device was reset.
115 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
122 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
123 IN BOOLEAN ExtendedVerification
127 Read BufferSize bytes from Lba into Buffer.
129 @param[in] This Indicates a pointer to the calling context.
130 @param[in] MediaId Id of the media, changes every time the media is replaced.
131 @param[in] Lba The starting Logical Block Address to read from.
132 @param[in, out] Token A pointer to the token associated with the transaction.
133 @param[in] BufferSize Size of Buffer, must be a multiple of device block size.
134 @param[out] Buffer A pointer to the destination buffer for the data. The caller is
135 responsible for either having implicit or explicit ownership of the buffer.
137 @retval EFI_SUCCESS The read request was queued if Event is not NULL.
138 The data was read correctly from the device if
140 @retval EFI_DEVICE_ERROR The device reported an error while performing
142 @retval EFI_NO_MEDIA There is no media in the device.
143 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
144 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the
145 intrinsic block size of the device.
146 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
147 or the buffer is not on proper alignment.
148 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
155 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
158 IN OUT EFI_BLOCK_IO2_TOKEN
*Token
,
164 Write BufferSize bytes from Lba into Buffer.
166 @param[in] This Indicates a pointer to the calling context.
167 @param[in] MediaId The media ID that the write request is for.
168 @param[in] Lba The starting logical block address to be written. The
169 caller is responsible for writing to only legitimate
171 @param[in, out] Token A pointer to the token associated with the transaction.
172 @param[in] BufferSize Size of Buffer, must be a multiple of device block size.
173 @param[in] Buffer A pointer to the source buffer for the data.
175 @retval EFI_SUCCESS The data was written correctly to the device.
176 @retval EFI_WRITE_PROTECTED The device can not be written to.
177 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
178 @retval EFI_NO_MEDIA There is no media in the device.
179 @retval EFI_MEDIA_CHANGED The MediaId does not match the current device.
180 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
181 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
182 or the buffer is not on proper alignment.
188 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
191 IN OUT EFI_BLOCK_IO2_TOKEN
*Token
,
197 Flush the Block Device.
199 @param[in] This Indicates a pointer to the calling context.
200 @param[in, out] Token A pointer to the token associated with the transaction.
202 @retval EFI_SUCCESS All outstanding data was written to the device
203 @retval EFI_DEVICE_ERROR The device reported an error while writing back the data
204 @retval EFI_NO_MEDIA There is no media in the device.
210 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
211 IN OUT EFI_BLOCK_IO2_TOKEN
*Token
215 Erase a specified number of device blocks.
217 @param[in] This Indicates a pointer to the calling context.
218 @param[in] MediaId The media ID that the erase request is for.
219 @param[in] Lba The starting logical block address to be
220 erased. The caller is responsible for erasing
221 only legitimate locations.
222 @param[in, out] Token A pointer to the token associated with the
224 @param[in] Size The size in bytes to be erased. This must be
225 a multiple of the physical block size of the
228 @retval EFI_SUCCESS The erase request was queued if Event is not
229 NULL. The data was erased correctly to the
230 device if the Event is NULL.to the device.
231 @retval EFI_WRITE_PROTECTED The device cannot be erased due to write
233 @retval EFI_DEVICE_ERROR The device reported an error while attempting
234 to perform the erase operation.
235 @retval EFI_INVALID_PARAMETER The erase request contains LBAs that are not
237 @retval EFI_NO_MEDIA There is no media in the device.
238 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
244 IN EFI_ERASE_BLOCK_PROTOCOL
*This
,
247 IN OUT EFI_ERASE_BLOCK_TOKEN
*Token
,