]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/DiskIo.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / DiskIo.h
CommitLineData
d1f95000 1/** @file\r
8a7d75b0 2 Disk IO protocol as defined in the UEFI 2.0 specification.\r
d1f95000 3\r
4 The Disk IO protocol is used to convert block oriented devices into byte\r
5 oriented devices. The Disk IO protocol is intended to layer on top of the\r
6 Block IO protocol.\r
7\r
9095d37b 8 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 9 SPDX-License-Identifier: BSD-2-Clause-Patent\r
d1f95000 10\r
d1f95000 11**/\r
12\r
13#ifndef __DISK_IO_H__\r
14#define __DISK_IO_H__\r
15\r
16#define EFI_DISK_IO_PROTOCOL_GUID \\r
17 { \\r
18 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
19 }\r
20\r
99e8ed21 21///\r
22/// Protocol GUID name defined in EFI1.1.\r
9095d37b 23///\r
a6508c05 24#define DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL_GUID\r
25\r
d1f95000 26typedef struct _EFI_DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL;\r
27\r
99e8ed21 28///\r
29/// Protocol defined in EFI1.1.\r
9095d37b 30///\r
a6508c05 31typedef EFI_DISK_IO_PROTOCOL EFI_DISK_IO;\r
32\r
d1f95000 33/**\r
34 Read BufferSize bytes from Offset into Buffer.\r
35\r
36 @param This Protocol instance pointer.\r
37 @param MediaId Id of the media, changes every time the media is replaced.\r
38 @param Offset The starting byte offset to read from\r
39 @param BufferSize Size of Buffer\r
40 @param Buffer Buffer containing read data\r
41\r
42 @retval EFI_SUCCESS The data was read correctly from the device.\r
43 @retval EFI_DEVICE_ERROR The device reported an error while performing the read.\r
44 @retval EFI_NO_MEDIA There is no media in the device.\r
45 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
46 @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not\r
47 valid for the device.\r
48\r
49**/\r
50typedef\r
51EFI_STATUS\r
8b13229b 52(EFIAPI *EFI_DISK_READ)(\r
d1f95000 53 IN EFI_DISK_IO_PROTOCOL *This,\r
54 IN UINT32 MediaId,\r
55 IN UINT64 Offset,\r
56 IN UINTN BufferSize,\r
57 OUT VOID *Buffer\r
ed66e1bc 58 );\r
d1f95000 59\r
60/**\r
74fec708 61 Writes a specified number of bytes to a device.\r
d1f95000 62\r
74fec708
LG
63 @param This Indicates a pointer to the calling context.\r
64 @param MediaId ID of the medium to be written.\r
65 @param Offset The starting byte offset on the logical block I/O device to write.\r
66 @param BufferSize The size in bytes of Buffer. The number of bytes to write to the device.\r
67 @param Buffer A pointer to the buffer containing the data to be written.\r
d1f95000 68\r
69 @retval EFI_SUCCESS The data was written correctly to the device.\r
70 @retval EFI_WRITE_PROTECTED The device can not be written to.\r
71 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r
72 @retval EFI_NO_MEDIA There is no media in the device.\r
73 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
74 @retval EFI_INVALID_PARAMETER The write request contains device addresses that are not\r
75 valid for the device.\r
76\r
77**/\r
78typedef\r
79EFI_STATUS\r
8b13229b 80(EFIAPI *EFI_DISK_WRITE)(\r
d1f95000 81 IN EFI_DISK_IO_PROTOCOL *This,\r
82 IN UINT32 MediaId,\r
83 IN UINT64 Offset,\r
84 IN UINTN BufferSize,\r
85 IN VOID *Buffer\r
ed66e1bc 86 );\r
d1f95000 87\r
88#define EFI_DISK_IO_PROTOCOL_REVISION 0x00010000\r
89\r
99e8ed21 90///\r
91/// Revision defined in EFI1.1\r
9095d37b 92///\r
a6508c05 93#define EFI_DISK_IO_INTERFACE_REVISION EFI_DISK_IO_PROTOCOL_REVISION\r
94\r
44717a39 95///\r
96/// This protocol is used to abstract Block I/O interfaces.\r
97///\r
d1f95000 98struct _EFI_DISK_IO_PROTOCOL {\r
3354353d 99 ///\r
100 /// The revision to which the disk I/O interface adheres. All future\r
101 /// revisions must be backwards compatible. If a future version is not\r
102 /// backwards compatible, it is not the same GUID.\r
103 ///\r
d1f95000 104 UINT64 Revision;\r
105 EFI_DISK_READ ReadDisk;\r
106 EFI_DISK_WRITE WriteDisk;\r
107};\r
108\r
109extern EFI_GUID gEfiDiskIoProtocolGuid;\r
110\r
111#endif\r