]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/DiskIo.h
Import Pal.h and Sal.h.
[mirror_edk2.git] / MdePkg / Include / Protocol / DiskIo.h
1 /** @file
2 Disk IO protocol as defined in the EFI 1.0 specification.
3
4 The Disk IO 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
6 Block IO protocol.
7
8 Copyright (c) 2006, Intel Corporation
9 All rights reserved. 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
13
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.
16
17 Module Name: DiskIo.h
18
19 **/
20
21 #ifndef __DISK_IO_H__
22 #define __DISK_IO_H__
23
24 #define EFI_DISK_IO_PROTOCOL_GUID \
25 { \
26 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
27 }
28
29 //
30 // Protocol GUID name defined in EFI1.1.
31 //
32 #define DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL_GUID
33
34 typedef struct _EFI_DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL;
35
36 //
37 // Protocol defined in EFI1.1.
38 //
39 typedef EFI_DISK_IO_PROTOCOL EFI_DISK_IO;
40
41 /**
42 Read BufferSize bytes from Offset into Buffer.
43
44 @param This Protocol instance pointer.
45 @param MediaId Id of the media, changes every time the media is replaced.
46 @param Offset The starting byte offset to read from
47 @param BufferSize Size of Buffer
48 @param Buffer Buffer containing read data
49
50 @retval EFI_SUCCESS The data was read correctly from the device.
51 @retval EFI_DEVICE_ERROR The device reported an error while performing the read.
52 @retval EFI_NO_MEDIA There is no media in the device.
53 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
54 @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not
55 valid for the device.
56
57 **/
58 typedef
59 EFI_STATUS
60 (EFIAPI *EFI_DISK_READ) (
61 IN EFI_DISK_IO_PROTOCOL *This,
62 IN UINT32 MediaId,
63 IN UINT64 Offset,
64 IN UINTN BufferSize,
65 OUT VOID *Buffer
66 )
67 ;
68
69 /**
70 Read BufferSize bytes from Offset into Buffer.
71
72 @param This Protocol instance pointer.
73 @param MediaId Id of the media, changes every time the media is replaced.
74 @param Offset The starting byte offset to read from
75 @param BufferSize Size of Buffer
76 @param Buffer Buffer containing read data
77
78 @retval EFI_SUCCESS The data was written correctly to the device.
79 @retval EFI_WRITE_PROTECTED The device can not be written to.
80 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
81 @retval EFI_NO_MEDIA There is no media in the device.
82 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
83 @retval EFI_INVALID_PARAMETER The write request contains device addresses that are not
84 valid for the device.
85
86 **/
87 typedef
88 EFI_STATUS
89 (EFIAPI *EFI_DISK_WRITE) (
90 IN EFI_DISK_IO_PROTOCOL *This,
91 IN UINT32 MediaId,
92 IN UINT64 Offset,
93 IN UINTN BufferSize,
94 IN VOID *Buffer
95 )
96 ;
97
98 #define EFI_DISK_IO_PROTOCOL_REVISION 0x00010000
99
100 //
101 // Revision defined in EFI1.1
102 //
103 #define EFI_DISK_IO_INTERFACE_REVISION EFI_DISK_IO_PROTOCOL_REVISION
104
105 struct _EFI_DISK_IO_PROTOCOL {
106 UINT64 Revision;
107 EFI_DISK_READ ReadDisk;
108 EFI_DISK_WRITE WriteDisk;
109 };
110
111 extern EFI_GUID gEfiDiskIoProtocolGuid;
112
113 #endif