2 Disk IO protocol as defined in the UEFI 2.0 specification.
4 The Disk IO2 protocol is used to convert block oriented devices into byte
5 oriented devices. The Disk IO protocol is intended to layer on top of the
8 Copyright (c) 2013, 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
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.
19 #ifndef __DISK_IO2_H__
20 #define __DISK_IO2_H__
22 #define EFI_DISK_IO2_PROTOCOL_GUID \
24 0x151c8eae, 0x7f2c, 0x472c, 0x9e, 0x54, 0x98, 0x28, 0x19, 0x4f, 0x6a, 0x88 \
27 typedef struct _EFI_DISK_IO2_PROTOCOL EFI_DISK_IO2_PROTOCOL
;
30 The struct of Disk IO2 Token.
34 // If Event is NULL, then blocking I/O is performed.
35 // If Event is not NULL and non-blocking I/O is supported, then non-blocking I/O is performed,
36 // and Event will be signaled when the I/O request is completed.
37 // The caller must be prepared to handle the case where the callback associated with Event occurs
38 // before the original asynchronous I/O request call returns.
43 // Defines whether or not the signaled event encountered an error.
45 EFI_STATUS TransactionStatus
;
49 Terminate outstanding asynchronous requests to a device.
51 @param This Indicates a pointer to the calling context.
53 @retval EFI_SUCCESS All outstanding requests were successfully terminated.
54 @retval EFI_DEVICE_ERROR The device reported an error while performing the cancel
59 (EFIAPI
*EFI_DISK_CANCEL_EX
) (
60 IN EFI_DISK_IO2_PROTOCOL
*This
64 Reads a specified number of bytes from a device.
66 @param This Indicates a pointer to the calling context.
67 @param MediaId ID of the medium to be read.
68 @param Offset The starting byte offset on the logical block I/O device to read from.
69 @param Token A pointer to the token associated with the transaction.
70 If this field is NULL, synchronous/blocking IO is performed.
71 @param BufferSize The size in bytes of Buffer. The number of bytes to read from the device.
72 @param Buffer A pointer to the destination buffer for the data.
73 The caller is responsible either having implicit or explicit ownership of the buffer.
75 @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was read correctly from the device.
76 If Event is not NULL (asynchronous I/O): The request was successfully queued for processing.
77 Event will be signaled upon completion.
78 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
79 @retval EFI_NO_MEDIA There is no medium in the device.
80 @retval EFI_MEDIA_CHNAGED The MediaId is not for the current medium.
81 @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not valid for the device.
82 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
87 (EFIAPI
*EFI_DISK_READ_EX
) (
88 IN EFI_DISK_IO2_PROTOCOL
*This
,
91 IN OUT EFI_DISK_IO2_TOKEN
*Token
,
97 Writes a specified number of bytes to a device.
99 @param This Indicates a pointer to the calling context.
100 @param MediaId ID of the medium to be written.
101 @param Offset The starting byte offset on the logical block I/O device to write to.
102 @param Token A pointer to the token associated with the transaction.
103 If this field is NULL, synchronous/blocking IO is performed.
104 @param BufferSize The size in bytes of Buffer. The number of bytes to write to the device.
105 @param Buffer A pointer to the buffer containing the data to be written.
107 @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was written correctly to the device.
108 If Event is not NULL (asynchronous I/O): The request was successfully queued for processing.
109 Event will be signaled upon completion.
110 @retval EFI_WRITE_PROTECTED The device cannot be written to.
111 @retval EFI_DEVICE_ERROR The device reported an error while performing the write operation.
112 @retval EFI_NO_MEDIA There is no medium in the device.
113 @retval EFI_MEDIA_CHNAGED The MediaId is not for the current medium.
114 @retval EFI_INVALID_PARAMETER The write request contains device addresses that are not valid for the device.
115 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
120 (EFIAPI
*EFI_DISK_WRITE_EX
) (
121 IN EFI_DISK_IO2_PROTOCOL
*This
,
124 IN OUT EFI_DISK_IO2_TOKEN
*Token
,
130 Flushes all modified data to the physical device.
132 @param This Indicates a pointer to the calling context.
133 @param MediaId ID of the medium to be written.
134 @param Token A pointer to the token associated with the transaction.
135 If this field is NULL, synchronous/blocking IO is performed.
137 @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was flushed successfully to the device.
138 If Event is not NULL (asynchronous I/O): The request was successfully queued for processing.
139 Event will be signaled upon completion.
140 @retval EFI_WRITE_PROTECTED The device cannot be written to.
141 @retval EFI_DEVICE_ERROR The device reported an error while performing the write operation.
142 @retval EFI_NO_MEDIA There is no medium in the device.
143 @retval EFI_MEDIA_CHNAGED The MediaId is not for the current medium.
144 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
148 (EFIAPI
*EFI_DISK_FLUSH_EX
) (
149 IN EFI_DISK_IO2_PROTOCOL
*This
,
150 IN OUT EFI_DISK_IO2_TOKEN
*Token
153 #define EFI_DISK_IO2_PROTOCOL_REVISION 0x00020000
156 /// This protocol is used to abstract Block I/O interfaces.
158 struct _EFI_DISK_IO2_PROTOCOL
{
160 /// The revision to which the disk I/O interface adheres. All future
161 /// revisions must be backwards compatible. If a future version is not
162 /// backwards compatible, it is not the same GUID.
165 EFI_DISK_CANCEL_EX Cancel
;
166 EFI_DISK_READ_EX ReadDiskEx
;
167 EFI_DISK_WRITE_EX WriteDiskEx
;
168 EFI_DISK_FLUSH_EX FlushDiskEx
;
171 extern EFI_GUID gEfiDiskIo2ProtocolGuid
;