QemuFlash.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /** @file
  2. OVMF support for QEMU system firmware flash device
  3. Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef __QEMU_FLASH_H__
  7. #define __QEMU_FLASH_H__
  8. #include <Protocol/FirmwareVolumeBlock.h>
  9. extern UINT8 *mFlashBase;
  10. /**
  11. Read from QEMU Flash
  12. @param[in] Lba The starting logical block index to read from.
  13. @param[in] Offset Offset into the block at which to begin reading.
  14. @param[in] NumBytes On input, indicates the requested read size. On
  15. output, indicates the actual number of bytes read
  16. @param[in] Buffer Pointer to the buffer to read into.
  17. **/
  18. EFI_STATUS
  19. QemuFlashRead (
  20. IN EFI_LBA Lba,
  21. IN UINTN Offset,
  22. IN UINTN *NumBytes,
  23. IN UINT8 *Buffer
  24. );
  25. /**
  26. Write to QEMU Flash
  27. @param[in] Lba The starting logical block index to write to.
  28. @param[in] Offset Offset into the block at which to begin writing.
  29. @param[in] NumBytes On input, indicates the requested write size. On
  30. output, indicates the actual number of bytes written
  31. @param[in] Buffer Pointer to the data to write.
  32. **/
  33. EFI_STATUS
  34. QemuFlashWrite (
  35. IN EFI_LBA Lba,
  36. IN UINTN Offset,
  37. IN UINTN *NumBytes,
  38. IN UINT8 *Buffer
  39. );
  40. /**
  41. Erase a QEMU Flash block
  42. @param Lba The logical block index to erase.
  43. **/
  44. EFI_STATUS
  45. QemuFlashEraseBlock (
  46. IN EFI_LBA Lba
  47. );
  48. /**
  49. Initializes QEMU flash memory support
  50. @retval EFI_WRITE_PROTECTED The QEMU flash device is not present.
  51. @retval EFI_SUCCESS The QEMU flash device is supported.
  52. **/
  53. EFI_STATUS
  54. QemuFlashInitialize (
  55. VOID
  56. );
  57. VOID
  58. QemuFlashConvertPointers (
  59. VOID
  60. );
  61. VOID
  62. QemuFlashBeforeProbe (
  63. IN EFI_PHYSICAL_ADDRESS BaseAddress,
  64. IN UINTN FdBlockSize,
  65. IN UINTN FdBlockCount
  66. );
  67. /**
  68. Write to QEMU Flash
  69. @param[in] Ptr Pointer to the location to write.
  70. @param[in] Value The value to write.
  71. **/
  72. VOID
  73. QemuFlashPtrWrite (
  74. IN volatile UINT8 *Ptr,
  75. IN UINT8 Value
  76. );
  77. #endif