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