NorFlashSynQuacer.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /** @file
  2. Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. **/
  5. #include <Base.h>
  6. #include <Uefi.h>
  7. #include <Library/BaseLib.h>
  8. #include <Library/NorFlashPlatformLib.h>
  9. #include <Platform/MemoryMap.h>
  10. #define FW_CODE_REGION_BASE SYNQUACER_SPI_NOR_BASE
  11. #define FW_CODE_REGION_SIZE (FW_ENV_REGION_BASE - FW_CODE_REGION_BASE)
  12. #define FW_ENV_REGION_BASE FixedPcdGet32 (PcdFlashNvStorageVariableBase)
  13. #define FW_ENV_REGION_SIZE (FixedPcdGet32 (PcdFlashNvStorageVariableSize) + \
  14. FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + \
  15. FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize))
  16. STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
  17. {
  18. // UEFI code region
  19. SYNQUACER_SPI_NOR_BASE, // device base
  20. FW_CODE_REGION_BASE, // region base
  21. FW_CODE_REGION_SIZE, // region size
  22. SIZE_64KB, // block size
  23. },
  24. {
  25. // Environment variable region
  26. SYNQUACER_SPI_NOR_BASE, // device base
  27. FW_ENV_REGION_BASE, // region base
  28. FW_ENV_REGION_SIZE, // region size
  29. SIZE_64KB, // block size
  30. },
  31. };
  32. EFI_STATUS
  33. NorFlashPlatformInitialization (
  34. VOID
  35. )
  36. {
  37. return EFI_SUCCESS;
  38. }
  39. EFI_STATUS
  40. NorFlashPlatformGetDevices (
  41. OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,
  42. OUT UINT32 *Count
  43. )
  44. {
  45. if (NorFlashDevices == NULL ||
  46. Count == NULL) {
  47. return EFI_INVALID_PARAMETER;
  48. }
  49. *Count = ARRAY_SIZE (mNorFlashDevices);
  50. *NorFlashDevices = mNorFlashDevices;
  51. return EFI_SUCCESS;
  52. }