VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/BlockIo2.h@ 105681

最後變更 在這個檔案從105681是 99404,由 vboxsync 提交於 2 年 前

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 7.7 KB
 
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 - 2018, Intel Corporation. All rights reserved.<BR>
9 SPDX-License-Identifier: BSD-2-Clause-Patent
10
11**/
12
13#ifndef __BLOCK_IO2_H__
14#define __BLOCK_IO2_H__
15
16#include <Protocol/BlockIo.h>
17
18#define EFI_BLOCK_IO2_PROTOCOL_GUID \
19 { \
20 0xa77b2472, 0xe282, 0x4e9f, {0xa2, 0x45, 0xc2, 0xc0, 0xe2, 0x7b, 0xbc, 0xc1} \
21 }
22
23typedef struct _EFI_BLOCK_IO2_PROTOCOL EFI_BLOCK_IO2_PROTOCOL;
24
25/**
26 The struct of Block IO2 Token.
27**/
28typedef struct {
29 ///
30 /// If Event is NULL, then blocking I/O is performed.If Event is not NULL and
31 /// non-blocking I/O is supported, then non-blocking I/O is performed, and
32 /// Event will be signaled when the read request is completed.
33 ///
34 EFI_EVENT Event;
35
36 ///
37 /// Defines whether or not the signaled event encountered an error.
38 ///
39 EFI_STATUS TransactionStatus;
40} EFI_BLOCK_IO2_TOKEN;
41
42/**
43 Reset the block device hardware.
44
45 @param[in] This Indicates a pointer to the calling context.
46 @param[in] ExtendedVerification Indicates that the driver may perform a more
47 exhausive verification operation of the device
48 during reset.
49
50 @retval EFI_SUCCESS The device was reset.
51 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
52 not be reset.
53
54**/
55typedef
56EFI_STATUS
57(EFIAPI *EFI_BLOCK_RESET_EX)(
58 IN EFI_BLOCK_IO2_PROTOCOL *This,
59 IN BOOLEAN ExtendedVerification
60 );
61
62/**
63 Read BufferSize bytes from Lba into Buffer.
64
65 This function reads the requested number of blocks from the device. All the
66 blocks are read, or an error is returned.
67 If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_or EFI_MEDIA_CHANGED is returned and
68 non-blocking I/O is being used, the Event associated with this request will
69 not be signaled.
70
71 @param[in] This Indicates a pointer to the calling context.
72 @param[in] MediaId Id of the media, changes every time the media is
73 replaced.
74 @param[in] Lba The starting Logical Block Address to read from.
75 @param[in, out] Token A pointer to the token associated with the transaction.
76 @param[in] BufferSize Size of Buffer, must be a multiple of device block size.
77 @param[out] Buffer A pointer to the destination buffer for the data. The
78 caller is responsible for either having implicit or
79 explicit ownership of the buffer.
80
81 @retval EFI_SUCCESS The read request was queued if Token->Event is
82 not NULL.The data was read correctly from the
83 device if the Token->Event is NULL.
84 @retval EFI_DEVICE_ERROR The device reported an error while performing
85 the read.
86 @retval EFI_NO_MEDIA There is no media in the device.
87 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
88 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the
89 intrinsic block size of the device.
90 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
91 or the buffer is not on proper alignment.
92 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
93 of resources.
94**/
95typedef
96EFI_STATUS
97(EFIAPI *EFI_BLOCK_READ_EX)(
98 IN EFI_BLOCK_IO2_PROTOCOL *This,
99 IN UINT32 MediaId,
100 IN EFI_LBA LBA,
101 IN OUT EFI_BLOCK_IO2_TOKEN *Token,
102 IN UINTN BufferSize,
103 OUT VOID *Buffer
104 );
105
106/**
107 Write BufferSize bytes from Lba into Buffer.
108
109 This function writes the requested number of blocks to the device. All blocks
110 are written, or an error is returned.If EFI_DEVICE_ERROR, EFI_NO_MEDIA,
111 EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED is returned and non-blocking I/O is
112 being used, the Event associated with this request will not be signaled.
113
114 @param[in] This Indicates a pointer to the calling context.
115 @param[in] MediaId The media ID that the write request is for.
116 @param[in] Lba The starting logical block address to be written. The
117 caller is responsible for writing to only legitimate
118 locations.
119 @param[in, out] Token A pointer to the token associated with the transaction.
120 @param[in] BufferSize Size of Buffer, must be a multiple of device block size.
121 @param[in] Buffer A pointer to the source buffer for the data.
122
123 @retval EFI_SUCCESS The write request was queued if Event is not NULL.
124 The data was written correctly to the device if
125 the Event is NULL.
126 @retval EFI_WRITE_PROTECTED The device can not be written to.
127 @retval EFI_NO_MEDIA There is no media in the device.
128 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
129 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
130 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
131 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
132 or the buffer is not on proper alignment.
133 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
134 of resources.
135
136**/
137typedef
138EFI_STATUS
139(EFIAPI *EFI_BLOCK_WRITE_EX)(
140 IN EFI_BLOCK_IO2_PROTOCOL *This,
141 IN UINT32 MediaId,
142 IN EFI_LBA LBA,
143 IN OUT EFI_BLOCK_IO2_TOKEN *Token,
144 IN UINTN BufferSize,
145 IN VOID *Buffer
146 );
147
148/**
149 Flush the Block Device.
150
151 If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED
152 is returned and non-blocking I/O is being used, the Event associated with
153 this request will not be signaled.
154
155 @param[in] This Indicates a pointer to the calling context.
156 @param[in,out] Token A pointer to the token associated with the transaction
157
158 @retval EFI_SUCCESS The flush request was queued if Event is not NULL.
159 All outstanding data was written correctly to the
160 device if the Event is NULL.
161 @retval EFI_DEVICE_ERROR The device reported an error while writting back
162 the data.
163 @retval EFI_WRITE_PROTECTED The device cannot be written to.
164 @retval EFI_NO_MEDIA There is no media in the device.
165 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
166 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
167 of resources.
168
169**/
170typedef
171EFI_STATUS
172(EFIAPI *EFI_BLOCK_FLUSH_EX)(
173 IN EFI_BLOCK_IO2_PROTOCOL *This,
174 IN OUT EFI_BLOCK_IO2_TOKEN *Token
175 );
176
177///
178/// The Block I/O2 protocol defines an extension to the Block I/O protocol which
179/// enables the ability to read and write data at a block level in a non-blocking
180// manner.
181///
182struct _EFI_BLOCK_IO2_PROTOCOL {
183 ///
184 /// A pointer to the EFI_BLOCK_IO_MEDIA data for this device.
185 /// Type EFI_BLOCK_IO_MEDIA is defined in BlockIo.h.
186 ///
187 EFI_BLOCK_IO_MEDIA *Media;
188
189 EFI_BLOCK_RESET_EX Reset;
190 EFI_BLOCK_READ_EX ReadBlocksEx;
191 EFI_BLOCK_WRITE_EX WriteBlocksEx;
192 EFI_BLOCK_FLUSH_EX FlushBlocksEx;
193};
194
195extern EFI_GUID gEfiBlockIo2ProtocolGuid;
196
197#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette