SbsaQemuNorFlashLib.c 788 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /** @file
  2. Copyright (c) 2019, Linaro Ltd. All rights reserved
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. **/
  5. #include <Base.h>
  6. #include <PiDxe.h>
  7. #include <Library/VirtNorFlashPlatformLib.h>
  8. #define QEMU_NOR_BLOCK_SIZE SIZE_256KB
  9. EFI_STATUS
  10. VirtNorFlashPlatformInitialization (
  11. VOID
  12. )
  13. {
  14. return EFI_SUCCESS;
  15. }
  16. STATIC VIRT_NOR_FLASH_DESCRIPTION mNorFlashDevice =
  17. {
  18. FixedPcdGet64(PcdFdBaseAddress),
  19. FixedPcdGet64(PcdFlashNvStorageVariableBase),
  20. FixedPcdGet32(PcdFdSize),
  21. QEMU_NOR_BLOCK_SIZE
  22. };
  23. EFI_STATUS
  24. VirtNorFlashPlatformGetDevices (
  25. OUT VIRT_NOR_FLASH_DESCRIPTION **NorFlashDescriptions,
  26. OUT UINT32 *Count
  27. )
  28. {
  29. *NorFlashDescriptions = &mNorFlashDevice;
  30. *Count = 1;
  31. return EFI_SUCCESS;
  32. }