]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/BlockIo2.h
MdePkg: Fix some typing errors in the header files
[mirror_edk2.git] / MdePkg / Include / Protocol / BlockIo2.h
CommitLineData
b5867578 1/** @file\r
2 Block IO2 protocol as defined in the UEFI 2.3.1 specification.\r
3\r
4 The Block IO2 protocol defines an extension to the Block IO protocol which\r
5 enables the ability to read and write data at a block level in a non-blocking\r
6 manner.\r
7\r
8 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
9 This program and the accompanying materials \r
10 are licensed and made available under the terms and conditions of the BSD License \r
11 which accompanies this distribution. The full text of the license may be found at \r
12 http://opensource.org/licenses/bsd-license.php \r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
16\r
17**/\r
18\r
19#ifndef __BLOCK_IO2_H__\r
20#define __BLOCK_IO2_H__\r
21\r
22#include <Protocol/BlockIo.h>\r
23\r
24#define EFI_BLOCK_IO2_PROTOCOL_GUID \\r
25 { \\r
26 0xa77b2472, 0xe282, 0x4e9f, {0xa2, 0x45, 0xc2, 0xc0, 0xe2, 0x7b, 0xbc, 0xc1} \\r
27 }\r
28\r
29typedef struct _EFI_BLOCK_IO2_PROTOCOL EFI_BLOCK_IO2_PROTOCOL;\r
30\r
31/**\r
32 The struct of Block IO2 Token.\r
33**/\r
34typedef struct {\r
35\r
36 ///\r
37 /// If Event is NULL, then blocking I/O is performed.If Event is not NULL and\r
38 /// non-blocking I/O is supported, then non-blocking I/O is performed, and\r
39 /// Event will be signaled when the read request is completed.\r
40 ///\r
41 EFI_EVENT Event;\r
42\r
43 ///\r
44 /// Defines whether or not the signaled event encountered an error.\r
45 ///\r
46 EFI_STATUS TransactionStatus;\r
47} EFI_BLOCK_IO2_TOKEN;\r
48\r
49\r
50/**\r
51 Reset the block device hardware.\r
52\r
53 @param[in] This Indicates a pointer to the calling context.\r
54 @param[in] ExtendedVerification Indicates that the driver may perform a more\r
00b7cc0f 55 exhausive verification operation of the device\r
b5867578 56 during reset.\r
57\r
58 @retval EFI_SUCCESS The device was reset.\r
59 @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
60 not be reset.\r
61\r
62**/\r
63typedef\r
64EFI_STATUS\r
65(EFIAPI *EFI_BLOCK_RESET_EX) (\r
66 IN EFI_BLOCK_IO2_PROTOCOL *This,\r
67 IN BOOLEAN ExtendedVerification\r
68 );\r
69\r
70/**\r
71 Read BufferSize bytes from Lba into Buffer.\r
72 \r
73 This function reads the requested number of blocks from the device. All the\r
74 blocks are read, or an error is returned.\r
75 If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_or EFI_MEDIA_CHANGED is returned and\r
76 non-blocking I/O is being used, the Event associated with this request will\r
77 not be signaled.\r
78\r
79 @param[in] This Indicates a pointer to the calling context.\r
80 @param[in] MediaId Id of the media, changes every time the media is \r
81 replaced.\r
82 @param[in] Lba The starting Logical Block Address to read from.\r
83 @param[in, out] Token A pointer to the token associated with the transaction.\r
84 @param[in] BufferSize Size of Buffer, must be a multiple of device block size. \r
85 @param[out] Buffer A pointer to the destination buffer for the data. The \r
86 caller is responsible for either having implicit or \r
87 explicit ownership of the buffer.\r
88\r
89 @retval EFI_SUCCESS The read request was queued if Token->Event is\r
90 not NULL.The data was read correctly from the\r
91 device if the Token->Event is NULL.\r
92 @retval EFI_DEVICE_ERROR The device reported an error while performing\r
93 the read.\r
94 @retval EFI_NO_MEDIA There is no media in the device.\r
95 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
96 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the\r
97 intrinsic block size of the device.\r
98 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid, \r
99 or the buffer is not on proper alignment.\r
100 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack\r
101 of resources.\r
102**/\r
103typedef\r
104EFI_STATUS\r
105(EFIAPI *EFI_BLOCK_READ_EX) (\r
106 IN EFI_BLOCK_IO2_PROTOCOL *This,\r
107 IN UINT32 MediaId,\r
108 IN EFI_LBA LBA,\r
109 IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r
110 IN UINTN BufferSize,\r
111 OUT VOID *Buffer\r
112 );\r
113\r
114/**\r
115 Write BufferSize bytes from Lba into Buffer.\r
116\r
117 This function writes the requested number of blocks to the device. All blocks\r
118 are written, or an error is returned.If EFI_DEVICE_ERROR, EFI_NO_MEDIA,\r
119 EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED is returned and non-blocking I/O is\r
120 being used, the Event associated with this request will not be signaled.\r
121\r
122 @param[in] This Indicates a pointer to the calling context.\r
123 @param[in] MediaId The media ID that the write request is for.\r
124 @param[in] Lba The starting logical block address to be written. The\r
125 caller is responsible for writing to only legitimate\r
126 locations.\r
127 @param[in, out] Token A pointer to the token associated with the transaction.\r
128 @param[in] BufferSize Size of Buffer, must be a multiple of device block size.\r
129 @param[in] Buffer A pointer to the source buffer for the data.\r
130\r
131 @retval EFI_SUCCESS The write request was queued if Event is not NULL.\r
132 The data was written correctly to the device if\r
133 the Event is NULL.\r
134 @retval EFI_WRITE_PROTECTED The device can not be written to.\r
135 @retval EFI_NO_MEDIA There is no media in the device.\r
136 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
137 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r
138 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
139 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid, \r
140 or the buffer is not on proper alignment.\r
141 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack\r
142 of resources.\r
143\r
144**/\r
145typedef\r
146EFI_STATUS\r
147(EFIAPI *EFI_BLOCK_WRITE_EX) (\r
148 IN EFI_BLOCK_IO2_PROTOCOL *This,\r
149 IN UINT32 MediaId,\r
150 IN EFI_LBA LBA,\r
151 IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r
152 IN UINTN BufferSize,\r
153 IN VOID *Buffer\r
154 );\r
155\r
156/**\r
157 Flush the Block Device.\r
158 \r
159 If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED\r
160 is returned and non-blocking I/O is being used, the Event associated with\r
161 this request will not be signaled. \r
162\r
163 @param[in] This Indicates a pointer to the calling context.\r
164 @param[in,out] Token A pointer to the token associated with the transaction\r
165\r
166 @retval EFI_SUCCESS The flush request was queued if Event is not NULL.\r
167 All outstanding data was written correctly to the\r
168 device if the Event is NULL.\r
169 @retval EFI_DEVICE_ERROR The device reported an error while writting back\r
170 the data.\r
171 @retval EFI_WRITE_PROTECTED The device cannot be written to.\r
172 @retval EFI_NO_MEDIA There is no media in the device.\r
173 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
174 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack\r
175 of resources.\r
176\r
177**/\r
178typedef\r
179EFI_STATUS\r
180(EFIAPI *EFI_BLOCK_FLUSH_EX) (\r
181 IN EFI_BLOCK_IO2_PROTOCOL *This,\r
182 IN OUT EFI_BLOCK_IO2_TOKEN *Token\r
183 );\r
184\r
185///\r
186/// The Block I/O2 protocol defines an extension to the Block I/O protocol which\r
187/// enables the ability to read and write data at a block level in a non-blocking\r
188// manner.\r
189///\r
190struct _EFI_BLOCK_IO2_PROTOCOL {\r
191 ///\r
192 /// A pointer to the EFI_BLOCK_IO_MEDIA data for this device. \r
193 /// Type EFI_BLOCK_IO_MEDIA is defined in BlockIo.h.\r
194 /// \r
195 EFI_BLOCK_IO_MEDIA *Media;\r
196\r
197 EFI_BLOCK_RESET_EX Reset;\r
198 EFI_BLOCK_READ_EX ReadBlocksEx;\r
199 EFI_BLOCK_WRITE_EX WriteBlocksEx;\r
200 EFI_BLOCK_FLUSH_EX FlushBlocksEx;\r
201};\r
202\r
203extern EFI_GUID gEfiBlockIo2ProtocolGuid;\r
204\r
205#endif\r
206\r