iPXE
DiskIo.h
Go to the documentation of this file.
00001 /** @file
00002   Disk IO protocol as defined in the UEFI 2.0 specification.
00003 
00004   The Disk IO protocol is used to convert block oriented devices into byte
00005   oriented devices. The Disk IO protocol is intended to layer on top of the
00006   Block IO protocol.
00007 
00008   Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
00009   This program and the accompanying materials
00010   are licensed and made available under the terms and conditions of the BSD License
00011   which accompanies this distribution.  The full text of the license may be found at
00012   http://opensource.org/licenses/bsd-license.php
00013 
00014   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00015   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00016 
00017 **/
00018 
00019 #ifndef __DISK_IO_H__
00020 #define __DISK_IO_H__
00021 
00022 FILE_LICENCE ( BSD3 );
00023 
00024 #define EFI_DISK_IO_PROTOCOL_GUID \
00025   { \
00026     0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
00027   }
00028 
00029 ///
00030 /// Protocol GUID name defined in EFI1.1.
00031 ///
00032 #define DISK_IO_PROTOCOL  EFI_DISK_IO_PROTOCOL_GUID
00033 
00034 typedef struct _EFI_DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL;
00035 
00036 ///
00037 /// Protocol defined in EFI1.1.
00038 ///
00039 typedef EFI_DISK_IO_PROTOCOL  EFI_DISK_IO;
00040 
00041 /**
00042   Read BufferSize bytes from Offset into Buffer.
00043 
00044   @param  This                  Protocol instance pointer.
00045   @param  MediaId               Id of the media, changes every time the media is replaced.
00046   @param  Offset                The starting byte offset to read from
00047   @param  BufferSize            Size of Buffer
00048   @param  Buffer                Buffer containing read data
00049 
00050   @retval EFI_SUCCESS           The data was read correctly from the device.
00051   @retval EFI_DEVICE_ERROR      The device reported an error while performing the read.
00052   @retval EFI_NO_MEDIA          There is no media in the device.
00053   @retval EFI_MEDIA_CHNAGED     The MediaId does not matched the current device.
00054   @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not
00055                                 valid for the device.
00056 
00057 **/
00058 typedef
00059 EFI_STATUS
00060 (EFIAPI *EFI_DISK_READ)(
00061   IN EFI_DISK_IO_PROTOCOL         *This,
00062   IN UINT32                       MediaId,
00063   IN UINT64                       Offset,
00064   IN UINTN                        BufferSize,
00065   OUT VOID                        *Buffer
00066   );
00067 
00068 /**
00069   Writes a specified number of bytes to a device.
00070 
00071   @param  This       Indicates a pointer to the calling context.
00072   @param  MediaId    ID of the medium to be written.
00073   @param  Offset     The starting byte offset on the logical block I/O device to write.
00074   @param  BufferSize The size in bytes of Buffer. The number of bytes to write to the device.
00075   @param  Buffer     A pointer to the buffer containing the data to be written.
00076 
00077   @retval EFI_SUCCESS           The data was written correctly to the device.
00078   @retval EFI_WRITE_PROTECTED   The device can not be written to.
00079   @retval EFI_DEVICE_ERROR      The device reported an error while performing the write.
00080   @retval EFI_NO_MEDIA          There is no media in the device.
00081   @retval EFI_MEDIA_CHNAGED     The MediaId does not matched the current device.
00082   @retval EFI_INVALID_PARAMETER The write request contains device addresses that are not
00083                                  valid for the device.
00084 
00085 **/
00086 typedef
00087 EFI_STATUS
00088 (EFIAPI *EFI_DISK_WRITE)(
00089   IN EFI_DISK_IO_PROTOCOL         *This,
00090   IN UINT32                       MediaId,
00091   IN UINT64                       Offset,
00092   IN UINTN                        BufferSize,
00093   IN VOID                         *Buffer
00094   );
00095 
00096 #define EFI_DISK_IO_PROTOCOL_REVISION 0x00010000
00097 
00098 ///
00099 /// Revision defined in EFI1.1
00100 ///
00101 #define EFI_DISK_IO_INTERFACE_REVISION  EFI_DISK_IO_PROTOCOL_REVISION
00102 
00103 ///
00104 /// This protocol is used to abstract Block I/O interfaces.
00105 ///
00106 struct _EFI_DISK_IO_PROTOCOL {
00107   ///
00108   /// The revision to which the disk I/O interface adheres. All future
00109   /// revisions must be backwards compatible. If a future version is not
00110   /// backwards compatible, it is not the same GUID.
00111   ///
00112   UINT64          Revision;
00113   EFI_DISK_READ   ReadDisk;
00114   EFI_DISK_WRITE  WriteDisk;
00115 };
00116 
00117 extern EFI_GUID gEfiDiskIoProtocolGuid;
00118 
00119 #endif