2 Disk I/O 2 protocol as defined in the UEFI 2.4 specification.
4 The Disk I/O 2 protocol defines an extension to the Disk I/O protocol to enable
5 non-blocking / asynchronous byte-oriented disk operation.
7 Copyright (c) 2013, 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 __DISK_IO2_H__
19 #define __DISK_IO2_H__
21 #define EFI_DISK_IO2_PROTOCOL_GUID \
23 0x151c8eae, 0x7f2c, 0x472c, 0x9e, 0x54, 0x98, 0x28, 0x19, 0x4f, 0x6a, 0x88 \
26 typedef struct _EFI_DISK_IO2_PROTOCOL EFI_DISK_IO2_PROTOCOL
;
29 The struct of Disk IO2 Token.
33 // If Event is NULL, then blocking I/O is performed.
34 // If Event is not NULL and non-blocking I/O is supported, then non-blocking I/O is performed,
35 // and Event will be signaled when the I/O request is completed.
36 // The caller must be prepared to handle the case where the callback associated with Event occurs
37 // before the original asynchronous I/O request call returns.
42 // Defines whether or not the signaled event encountered an error.
44 EFI_STATUS TransactionStatus
;
48 Terminate outstanding asynchronous requests to a device.
50 @param This Indicates a pointer to the calling context.
52 @retval EFI_SUCCESS All outstanding requests were successfully terminated.
53 @retval EFI_DEVICE_ERROR The device reported an error while performing the cancel
58 (EFIAPI
*EFI_DISK_CANCEL_EX
) (
59 IN EFI_DISK_IO2_PROTOCOL
*This
63 Reads a specified number of bytes from a device.
65 @param This Indicates a pointer to the calling context.
66 @param MediaId ID of the medium to be read.
67 @param Offset The starting byte offset on the logical block I/O device to read from.
68 @param Token A pointer to the token associated with the transaction.
69 If this field is NULL, synchronous/blocking IO is performed.
70 @param BufferSize The size in bytes of Buffer. The number of bytes to read from the device.
71 @param Buffer A pointer to the destination buffer for the data.
72 The caller is responsible either having implicit or explicit ownership of the buffer.
74 @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was read correctly from the device.
75 If Event is not NULL (asynchronous I/O): The request was successfully queued for processing.
76 Event will be signaled upon completion.
77 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
78 @retval EFI_NO_MEDIA There is no medium in the device.
79 @retval EFI_MEDIA_CHNAGED The MediaId is not for the current medium.
80 @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not valid for the device.
81 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
86 (EFIAPI
*EFI_DISK_READ_EX
) (
87 IN EFI_DISK_IO2_PROTOCOL
*This
,
90 IN OUT EFI_DISK_IO2_TOKEN
*Token
,
96 Writes a specified number of bytes to a device.
98 @param This Indicates a pointer to the calling context.
99 @param MediaId ID of the medium to be written.
100 @param Offset The starting byte offset on the logical block I/O device to write to.
101 @param Token A pointer to the token associated with the transaction.
102 If this field is NULL, synchronous/blocking IO is performed.
103 @param BufferSize The size in bytes of Buffer. The number of bytes to write to the device.
104 @param Buffer A pointer to the buffer containing the data to be written.
106 @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was written correctly to the device.
107 If Event is not NULL (asynchronous I/O): The request was successfully queued for processing.
108 Event will be signaled upon completion.
109 @retval EFI_WRITE_PROTECTED The device cannot be written to.
110 @retval EFI_DEVICE_ERROR The device reported an error while performing the write operation.
111 @retval EFI_NO_MEDIA There is no medium in the device.
112 @retval EFI_MEDIA_CHNAGED The MediaId is not for the current medium.
113 @retval EFI_INVALID_PARAMETER The write request contains device addresses that are not valid for the device.
114 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
119 (EFIAPI
*EFI_DISK_WRITE_EX
) (
120 IN EFI_DISK_IO2_PROTOCOL
*This
,
123 IN OUT EFI_DISK_IO2_TOKEN
*Token
,
129 Flushes all modified data to the physical device.
131 @param This Indicates a pointer to the calling context.
132 @param MediaId ID of the medium to be written.
133 @param Token A pointer to the token associated with the transaction.
134 If this field is NULL, synchronous/blocking IO is performed.
136 @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was flushed successfully to the device.
137 If Event is not NULL (asynchronous I/O): The request was successfully queued for processing.
138 Event will be signaled upon completion.
139 @retval EFI_WRITE_PROTECTED The device cannot be written to.
140 @retval EFI_DEVICE_ERROR The device reported an error while performing the write operation.
141 @retval EFI_NO_MEDIA There is no medium in the device.
142 @retval EFI_MEDIA_CHNAGED The MediaId is not for the current medium.
143 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
147 (EFIAPI
*EFI_DISK_FLUSH_EX
) (
148 IN EFI_DISK_IO2_PROTOCOL
*This
,
149 IN OUT EFI_DISK_IO2_TOKEN
*Token
152 #define EFI_DISK_IO2_PROTOCOL_REVISION 0x00020000
155 /// This protocol is used to abstract Block I/O interfaces.
157 struct _EFI_DISK_IO2_PROTOCOL
{
159 /// The revision to which the disk I/O interface adheres. All future
160 /// revisions must be backwards compatible. If a future version is not
161 /// backwards compatible, it is not the same GUID.
164 EFI_DISK_CANCEL_EX Cancel
;
165 EFI_DISK_READ_EX ReadDiskEx
;
166 EFI_DISK_WRITE_EX WriteDiskEx
;
167 EFI_DISK_FLUSH_EX FlushDiskEx
;
170 extern EFI_GUID gEfiDiskIo2ProtocolGuid
;