BlockIo.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /** @file
  2. BlockIo function declaration for Xen PV block driver.
  3. Copyright (C) 2014, Citrix Ltd.
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. /**
  7. Read BufferSize bytes from Lba into Buffer.
  8. @param This Indicates a pointer to the calling context.
  9. @param MediaId Id of the media, changes every time the media is replaced.
  10. @param Lba The starting Logical Block Address to read from
  11. @param BufferSize Size of Buffer, must be a multiple of device block size.
  12. @param Buffer A pointer to the destination buffer for the data. The caller is
  13. responsible for either having implicit or explicit ownership of the buffer.
  14. @retval EFI_SUCCESS The data was read correctly from the device.
  15. @retval EFI_DEVICE_ERROR The device reported an error while performing the read.
  16. @retval EFI_NO_MEDIA There is no media in the device.
  17. @retval EFI_MEDIA_CHANGED The MediaId does not match the current device.
  18. @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
  19. @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
  20. or the buffer is not on proper alignment.
  21. **/
  22. EFI_STATUS
  23. EFIAPI
  24. XenPvBlkDxeBlockIoReadBlocks (
  25. IN EFI_BLOCK_IO_PROTOCOL *This,
  26. IN UINT32 MediaId,
  27. IN EFI_LBA Lba,
  28. IN UINTN BufferSize,
  29. OUT VOID *Buffer
  30. );
  31. /**
  32. Write BufferSize bytes from Lba into Buffer.
  33. @param This Indicates a pointer to the calling context.
  34. @param MediaId The media ID that the write request is for.
  35. @param Lba The starting logical block address to be written. The caller is
  36. responsible for writing to only legitimate locations.
  37. @param BufferSize Size of Buffer, must be a multiple of device block size.
  38. @param Buffer A pointer to the source buffer for the data.
  39. @retval EFI_SUCCESS The data was written correctly to the device.
  40. @retval EFI_WRITE_PROTECTED The device can not be written to.
  41. @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
  42. @retval EFI_NO_MEDIA There is no media in the device.
  43. @retval EFI_MEDIA_CHANGED The MediaId does not match the current device.
  44. @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
  45. @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
  46. or the buffer is not on proper alignment.
  47. **/
  48. EFI_STATUS
  49. EFIAPI
  50. XenPvBlkDxeBlockIoWriteBlocks (
  51. IN EFI_BLOCK_IO_PROTOCOL *This,
  52. IN UINT32 MediaId,
  53. IN EFI_LBA Lba,
  54. IN UINTN BufferSize,
  55. IN VOID *Buffer
  56. );
  57. /**
  58. Flush the Block Device.
  59. @param This Indicates a pointer to the calling context.
  60. @retval EFI_SUCCESS All outstanding data was written to the device
  61. @retval EFI_DEVICE_ERROR The device reported an error while writing back the data
  62. @retval EFI_NO_MEDIA There is no media in the device.
  63. **/
  64. EFI_STATUS
  65. EFIAPI
  66. XenPvBlkDxeBlockIoFlushBlocks (
  67. IN EFI_BLOCK_IO_PROTOCOL *This
  68. );
  69. /**
  70. Reset the block device hardware.
  71. @param[in] This Indicates a pointer to the calling context.
  72. @param[in] ExtendedVerification Not used.
  73. @retval EFI_SUCCESS The device was reset.
  74. **/
  75. EFI_STATUS
  76. EFIAPI
  77. XenPvBlkDxeBlockIoReset (
  78. IN EFI_BLOCK_IO_PROTOCOL *This,
  79. IN BOOLEAN ExtendedVerification
  80. );
  81. extern EFI_BLOCK_IO_MEDIA gXenPvBlkDxeBlockIoMedia;
  82. extern EFI_BLOCK_IO_PROTOCOL gXenPvBlkDxeBlockIo;