Path: blob/main/sys/contrib/edk2/Include/Protocol/DiskIo.h
96339 views
/** @file1Disk IO protocol as defined in the UEFI 2.0 specification.23The Disk IO protocol is used to convert block oriented devices into byte4oriented devices. The Disk IO protocol is intended to layer on top of the5Block IO protocol.67Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>8SPDX-License-Identifier: BSD-2-Clause-Patent910**/1112#ifndef __DISK_IO_H__13#define __DISK_IO_H__1415#define EFI_DISK_IO_PROTOCOL_GUID \16{ \170xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \18}1920///21/// Protocol GUID name defined in EFI1.1.22///23#define DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL_GUID2425typedef struct _EFI_DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL;2627///28/// Protocol defined in EFI1.1.29///30typedef EFI_DISK_IO_PROTOCOL EFI_DISK_IO;3132/**33Read BufferSize bytes from Offset into Buffer.3435@param This Protocol instance pointer.36@param MediaId Id of the media, changes every time the media is replaced.37@param Offset The starting byte offset to read from38@param BufferSize Size of Buffer39@param Buffer Buffer containing read data4041@retval EFI_SUCCESS The data was read correctly from the device.42@retval EFI_DEVICE_ERROR The device reported an error while performing the read.43@retval EFI_NO_MEDIA There is no media in the device.44@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.45@retval EFI_INVALID_PARAMETER The read request contains device addresses that are not46valid for the device.4748**/49typedef50EFI_STATUS51(EFIAPI *EFI_DISK_READ)(52IN EFI_DISK_IO_PROTOCOL *This,53IN UINT32 MediaId,54IN UINT64 Offset,55IN UINTN BufferSize,56OUT VOID *Buffer57);5859/**60Writes a specified number of bytes to a device.6162@param This Indicates a pointer to the calling context.63@param MediaId ID of the medium to be written.64@param Offset The starting byte offset on the logical block I/O device to write.65@param BufferSize The size in bytes of Buffer. The number of bytes to write to the device.66@param Buffer A pointer to the buffer containing the data to be written.6768@retval EFI_SUCCESS The data was written correctly to the device.69@retval EFI_WRITE_PROTECTED The device can not be written to.70@retval EFI_DEVICE_ERROR The device reported an error while performing the write.71@retval EFI_NO_MEDIA There is no media in the device.72@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.73@retval EFI_INVALID_PARAMETER The write request contains device addresses that are not74valid for the device.7576**/77typedef78EFI_STATUS79(EFIAPI *EFI_DISK_WRITE)(80IN EFI_DISK_IO_PROTOCOL *This,81IN UINT32 MediaId,82IN UINT64 Offset,83IN UINTN BufferSize,84IN VOID *Buffer85);8687#define EFI_DISK_IO_PROTOCOL_REVISION 0x000100008889///90/// Revision defined in EFI1.191///92#define EFI_DISK_IO_INTERFACE_REVISION EFI_DISK_IO_PROTOCOL_REVISION9394///95/// This protocol is used to abstract Block I/O interfaces.96///97struct _EFI_DISK_IO_PROTOCOL {98///99/// The revision to which the disk I/O interface adheres. All future100/// revisions must be backwards compatible. If a future version is not101/// backwards compatible, it is not the same GUID.102///103UINT64 Revision;104EFI_DISK_READ ReadDisk;105EFI_DISK_WRITE WriteDisk;106};107108extern EFI_GUID gEfiDiskIoProtocolGuid;109110#endif111112113