You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DiskIo.h 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /** @file
  2. Disk IO protocol as defined in the UEFI 2.0 specification.
  3. The Disk IO protocol is used to convert block oriented devices into byte
  4. oriented devices. The Disk IO protocol is intended to layer on top of the
  5. Block IO protocol.
  6. Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
  7. This program and the accompanying materials
  8. are licensed and made available under the terms and conditions of the BSD License
  9. which accompanies this distribution. The full text of the license may be found at
  10. http://opensource.org/licenses/bsd-license.php
  11. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  13. **/
  14. #ifndef __DISK_IO_H__
  15. #define __DISK_IO_H__
  16. FILE_LICENCE ( BSD3 );
  17. #define EFI_DISK_IO_PROTOCOL_GUID \
  18. { \
  19. 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
  20. }
  21. ///
  22. /// Protocol GUID name defined in EFI1.1.
  23. ///
  24. #define DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL_GUID
  25. typedef struct _EFI_DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL;
  26. ///
  27. /// Protocol defined in EFI1.1.
  28. ///
  29. typedef EFI_DISK_IO_PROTOCOL EFI_DISK_IO;
  30. /**
  31. Read BufferSize bytes from Offset into Buffer.
  32. @param This Protocol instance pointer.
  33. @param MediaId Id of the media, changes every time the media is replaced.
  34. @param Offset The starting byte offset to read from
  35. @param BufferSize Size of Buffer
  36. @param Buffer Buffer containing read data
  37. @retval EFI_SUCCESS The data was read correctly from the device.
  38. @retval EFI_DEVICE_ERROR The device reported an error while performing the read.
  39. @retval EFI_NO_MEDIA There is no media in the device.
  40. @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
  41. @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not
  42. valid for the device.
  43. **/
  44. typedef
  45. EFI_STATUS
  46. (EFIAPI *EFI_DISK_READ)(
  47. IN EFI_DISK_IO_PROTOCOL *This,
  48. IN UINT32 MediaId,
  49. IN UINT64 Offset,
  50. IN UINTN BufferSize,
  51. OUT VOID *Buffer
  52. );
  53. /**
  54. Writes a specified number of bytes to a device.
  55. @param This Indicates a pointer to the calling context.
  56. @param MediaId ID of the medium to be written.
  57. @param Offset The starting byte offset on the logical block I/O device to write.
  58. @param BufferSize The size in bytes of Buffer. The number of bytes to write to the device.
  59. @param Buffer A pointer to the buffer containing the data to be written.
  60. @retval EFI_SUCCESS The data was written correctly to the device.
  61. @retval EFI_WRITE_PROTECTED The device can not be written to.
  62. @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
  63. @retval EFI_NO_MEDIA There is no media in the device.
  64. @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
  65. @retval EFI_INVALID_PARAMETER The write request contains device addresses that are not
  66. valid for the device.
  67. **/
  68. typedef
  69. EFI_STATUS
  70. (EFIAPI *EFI_DISK_WRITE)(
  71. IN EFI_DISK_IO_PROTOCOL *This,
  72. IN UINT32 MediaId,
  73. IN UINT64 Offset,
  74. IN UINTN BufferSize,
  75. IN VOID *Buffer
  76. );
  77. #define EFI_DISK_IO_PROTOCOL_REVISION 0x00010000
  78. ///
  79. /// Revision defined in EFI1.1
  80. ///
  81. #define EFI_DISK_IO_INTERFACE_REVISION EFI_DISK_IO_PROTOCOL_REVISION
  82. ///
  83. /// This protocol is used to abstract Block I/O interfaces.
  84. ///
  85. struct _EFI_DISK_IO_PROTOCOL {
  86. ///
  87. /// The revision to which the disk I/O interface adheres. All future
  88. /// revisions must be backwards compatible. If a future version is not
  89. /// backwards compatible, it is not the same GUID.
  90. ///
  91. UINT64 Revision;
  92. EFI_DISK_READ ReadDisk;
  93. EFI_DISK_WRITE WriteDisk;
  94. };
  95. extern EFI_GUID gEfiDiskIoProtocolGuid;
  96. #endif