Initial import.
[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 typedef struct _EFI_DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL;
30
31 /**
32 Read BufferSize bytes from Offset into Buffer.
33
34 @param This Protocol instance pointer.
35 @param MediaId Id of the media, changes every time the media is replaced.
36 @param Offset The starting byte offset to read from
37 @param BufferSize Size of Buffer
38 @param Buffer Buffer containing read data
39
40 @retval EFI_SUCCESS The data was read correctly from the device.
41 @retval EFI_DEVICE_ERROR The device reported an error while performing the read.
42 @retval EFI_NO_MEDIA There is no media in the device.
43 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
44 @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not
45 valid for the device.
46
47 **/
48 typedef
49 EFI_STATUS
50 (EFIAPI *EFI_DISK_READ) (
51 IN EFI_DISK_IO_PROTOCOL *This,
52 IN UINT32 MediaId,
53 IN UINT64 Offset,
54 IN UINTN BufferSize,
55 OUT VOID *Buffer
56 )
57 ;
58
59 /**
60 Read BufferSize bytes from Offset into Buffer.
61
62 @param This Protocol instance pointer.
63 @param MediaId Id of the media, changes every time the media is replaced.
64 @param Offset The starting byte offset to read from
65 @param BufferSize Size of Buffer
66 @param Buffer Buffer containing read data
67
68 @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 not
74 valid for the device.
75
76 **/
77 typedef
78 EFI_STATUS
79 (EFIAPI *EFI_DISK_WRITE) (
80 IN EFI_DISK_IO_PROTOCOL *This,
81 IN UINT32 MediaId,
82 IN UINT64 Offset,
83 IN UINTN BufferSize,
84 IN VOID *Buffer
85 )
86 ;
87
88 #define EFI_DISK_IO_PROTOCOL_REVISION 0x00010000
89
90 struct _EFI_DISK_IO_PROTOCOL {
91 UINT64 Revision;
92 EFI_DISK_READ ReadDisk;
93 EFI_DISK_WRITE WriteDisk;
94 };
95
96 extern EFI_GUID gEfiDiskIoProtocolGuid;
97
98 #endif