iPXE
DiskIo.h
Go to the documentation of this file.
1 /** @file
2  Disk IO protocol as defined in the UEFI 2.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 - 2018, Intel Corporation. All rights reserved.<BR>
9  SPDX-License-Identifier: BSD-2-Clause-Patent
10 
11 **/
12 
13 #ifndef __DISK_IO_H__
14 #define __DISK_IO_H__
15 
16 FILE_LICENCE ( BSD2_PATENT );
17 FILE_SECBOOT ( PERMITTED );
18 
19 #define EFI_DISK_IO_PROTOCOL_GUID \
20  { \
21  0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
22  }
23 
24 ///
25 /// Protocol GUID name defined in EFI1.1.
26 ///
27 #define DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL_GUID
28 
30 
31 ///
32 /// Protocol defined in EFI1.1.
33 ///
35 
36 /**
37  Read BufferSize bytes from Offset into Buffer.
38 
39  @param This Protocol instance pointer.
40  @param MediaId Id of the media, changes every time the media is replaced.
41  @param Offset The starting byte offset to read from
42  @param BufferSize Size of Buffer
43  @param Buffer Buffer containing read data
44 
45  @retval EFI_SUCCESS The data was read correctly from the device.
46  @retval EFI_DEVICE_ERROR The device reported an error while performing the read.
47  @retval EFI_NO_MEDIA There is no media in the device.
48  @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
49  @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not
50  valid for the device.
51 
52 **/
53 typedef
57  IN UINT32 MediaId,
58  IN UINT64 Offset,
60  OUT VOID *Buffer
61  );
62 
63 /**
64  Writes a specified number of bytes to a device.
65 
66  @param This Indicates a pointer to the calling context.
67  @param MediaId ID of the medium to be written.
68  @param Offset The starting byte offset on the logical block I/O device to write.
69  @param BufferSize The size in bytes of Buffer. The number of bytes to write to the device.
70  @param Buffer A pointer to the buffer containing the data to be written.
71 
72  @retval EFI_SUCCESS The data was written correctly to the device.
73  @retval EFI_WRITE_PROTECTED The device can not be written to.
74  @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
75  @retval EFI_NO_MEDIA There is no media in the device.
76  @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
77  @retval EFI_INVALID_PARAMETER The write request contains device addresses that are not
78  valid for the device.
79 
80 **/
81 typedef
85  IN UINT32 MediaId,
86  IN UINT64 Offset,
88  IN VOID *Buffer
89  );
90 
91 #define EFI_DISK_IO_PROTOCOL_REVISION 0x00010000
92 
93 ///
94 /// Revision defined in EFI1.1
95 ///
96 #define EFI_DISK_IO_INTERFACE_REVISION EFI_DISK_IO_PROTOCOL_REVISION
97 
98 ///
99 /// This protocol is used to abstract Block I/O interfaces.
100 ///
102  ///
103  /// The revision to which the disk I/O interface adheres. All future
104  /// revisions must be backwards compatible. If a future version is not
105  /// backwards compatible, it is not the same GUID.
106  ///
110 };
111 
113 
114 #endif
128 bit buffer containing a unique identifier value.
Definition: Base.h:216
unsigned int UINT32
Definition: ProcessorBind.h:99
EFI_DISK_READ ReadDisk
Definition: DiskIo.h:108
UINT16_t BufferSize
Buffer size.
Definition: pxe_api.h:64
EFI_STATUS(EFIAPI * EFI_DISK_READ)(IN EFI_DISK_IO_PROTOCOL *This, IN UINT32 MediaId, IN UINT64 Offset, IN UINTN BufferSize, OUT VOID *Buffer)
Read BufferSize bytes from Offset into Buffer.
Definition: DiskIo.h:55
EFI_STATUS(EFIAPI * EFI_DISK_WRITE)(IN EFI_DISK_IO_PROTOCOL *This, IN UINT32 MediaId, IN UINT64 Offset, IN UINTN BufferSize, IN VOID *Buffer)
Writes a specified number of bytes to a device.
Definition: DiskIo.h:83
FILE_SECBOOT(PERMITTED)
FILE_LICENCE(BSD2_PATENT)
EFI_DISK_WRITE WriteDisk
Definition: DiskIo.h:109
#define OUT
Definition: mlx_utils.h:29
This protocol is used to abstract Block I/O interfaces.
Definition: DiskIo.h:101
EFI_DISK_IO_PROTOCOL EFI_DISK_IO
Protocol defined in EFI1.1.
Definition: DiskIo.h:34
#define EFIAPI
EFI_GUID gEfiDiskIoProtocolGuid
SEGOFF16_t Buffer
Buffer address.
Definition: pxe_api.h:65
UINT64 UINTN
Unsigned value of native width.
#define VOID
Undeclared type.
Definition: Base.h:272
unsigned long long UINT64
Definition: ProcessorBind.h:97
#define IN
Definition: mlx_utils.h:28
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
UINT64 Revision
The revision to which the disk I/O interface adheres.
Definition: DiskIo.h:107