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, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #ifndef _SD_BLOCK_IO_H_
19 #define _SD_BLOCK_IO_H_
22 Reset the Block Device.
24 @param This Indicates a pointer to the calling context.
25 @param ExtendedVerification Driver may perform diagnostics on reset.
27 @retval EFI_SUCCESS The device was reset.
28 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
35 IN EFI_BLOCK_IO_PROTOCOL
*This
,
36 IN BOOLEAN ExtendedVerification
40 Read BufferSize bytes from Lba into Buffer.
42 @param This Indicates a pointer to the calling context.
43 @param MediaId Id of the media, changes every time the media is replaced.
44 @param Lba The starting Logical Block Address to read from
45 @param BufferSize Size of Buffer, must be a multiple of device block size.
46 @param Buffer A pointer to the destination buffer for the data. The caller is
47 responsible for either having implicit or explicit ownership of the buffer.
49 @retval EFI_SUCCESS The data was read correctly from the device.
50 @retval EFI_DEVICE_ERROR The device reported an error while performing the read.
51 @retval EFI_NO_MEDIA There is no media in the device.
52 @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.
53 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
54 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
55 or the buffer is not on proper alignment.
61 IN EFI_BLOCK_IO_PROTOCOL
*This
,
69 Write BufferSize bytes from Lba into Buffer.
71 @param This Indicates a pointer to the calling context.
72 @param MediaId The media ID that the write request is for.
73 @param Lba The starting logical block address to be written. The caller is
74 responsible for writing to only legitimate locations.
75 @param BufferSize Size of Buffer, must be a multiple of device block size.
76 @param Buffer A pointer to the source buffer for the data.
78 @retval EFI_SUCCESS The data was written correctly to the device.
79 @retval EFI_WRITE_PROTECTED The device can not be written to.
80 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
81 @retval EFI_NO_MEDIA There is no media in the device.
82 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
83 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
84 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
85 or the buffer is not on proper alignment.
91 IN EFI_BLOCK_IO_PROTOCOL
*This
,
99 Flush the Block Device.
101 @param This Indicates a pointer to the calling context.
103 @retval EFI_SUCCESS All outstanding data was written to the device
104 @retval EFI_DEVICE_ERROR The device reported an error while writing back the data
105 @retval EFI_NO_MEDIA There is no media in the device.
111 IN EFI_BLOCK_IO_PROTOCOL
*This
115 Reset the Block Device.
117 @param[in] This Indicates a pointer to the calling context.
118 @param[in] ExtendedVerification Driver may perform diagnostics on reset.
120 @retval EFI_SUCCESS The device was reset.
121 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
128 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
129 IN BOOLEAN ExtendedVerification
133 Read BufferSize bytes from Lba into Buffer.
135 @param[in] This Indicates a pointer to the calling context.
136 @param[in] MediaId Id of the media, changes every time the media is replaced.
137 @param[in] Lba The starting Logical Block Address to read from.
138 @param[in, out] Token A pointer to the token associated with the transaction.
139 @param[in] BufferSize Size of Buffer, must be a multiple of device block size.
140 @param[out] Buffer A pointer to the destination buffer for the data. The caller is
141 responsible for either having implicit or explicit ownership of the buffer.
143 @retval EFI_SUCCESS The read request was queued if Event is not NULL.
144 The data was read correctly from the device if
146 @retval EFI_DEVICE_ERROR The device reported an error while performing
148 @retval EFI_NO_MEDIA There is no media in the device.
149 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
150 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the
151 intrinsic block size of the device.
152 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
153 or the buffer is not on proper alignment.
154 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
161 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
164 IN OUT EFI_BLOCK_IO2_TOKEN
*Token
,
170 Write BufferSize bytes from Lba into Buffer.
172 @param[in] This Indicates a pointer to the calling context.
173 @param[in] MediaId The media ID that the write request is for.
174 @param[in] Lba The starting logical block address to be written. The
175 caller is responsible for writing to only legitimate
177 @param[in, out] Token A pointer to the token associated with the transaction.
178 @param[in] BufferSize Size of Buffer, must be a multiple of device block size.
179 @param[in] Buffer A pointer to the source buffer for the data.
181 @retval EFI_SUCCESS The data was written correctly to the device.
182 @retval EFI_WRITE_PROTECTED The device can not be written to.
183 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
184 @retval EFI_NO_MEDIA There is no media in the device.
185 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
186 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
187 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
188 or the buffer is not on proper alignment.
194 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
197 IN OUT EFI_BLOCK_IO2_TOKEN
*Token
,
203 Flush the Block Device.
205 @param[in] This Indicates a pointer to the calling context.
206 @param[in, out] Token A pointer to the token associated with the transaction.
208 @retval EFI_SUCCESS All outstanding data was written to the device
209 @retval EFI_DEVICE_ERROR The device reported an error while writing back the data
210 @retval EFI_NO_MEDIA There is no media in the device.
216 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
217 IN OUT EFI_BLOCK_IO2_TOKEN
*Token