stm32mp_io_storage.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (c) 2021-2023, STMicroelectronics - All Rights Reserved
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef STM32MP_IO_STORAGE_H
  7. #define STM32MP_IO_STORAGE_H
  8. #include <stdint.h>
  9. #include <drivers/io/io_storage.h>
  10. /*******************************************************************************
  11. * STM32MP1 RAW partition offset for devices without GPT
  12. ******************************************************************************/
  13. #define STM32MP_EMMC_BOOT_FIP_OFFSET U(0x00040000)
  14. #if PSA_FWU_SUPPORT
  15. #define STM32MP_NOR_METADATA1_OFFSET U(0x00080000)
  16. #define STM32MP_NOR_METADATA2_OFFSET U(0x000C0000)
  17. #define STM32MP_NOR_FIP_A_OFFSET U(0x00100000)
  18. #define STM32MP_NOR_FIP_A_GUID (const struct efi_guid)EFI_GUID(0x4fd84c93, \
  19. 0x54ef, 0x463f, 0xa7, 0xef, 0xae, 0x25, 0xff,\
  20. 0x88, 0x70, 0x87)
  21. #define STM32MP_NOR_FIP_B_OFFSET U(0x00500000)
  22. #define STM32MP_NOR_FIP_B_GUID (const struct efi_guid)EFI_GUID(0x09c54952, \
  23. 0xd5bf, 0x45af, 0xac, 0xee, 0x33, 0x53, 0x03,\
  24. 0x76, 0x6f, 0xb3)
  25. #define STM32MP_NAND_METADATA1_OFFSET U(0x00100000)
  26. #define STM32MP_NAND_METADATA2_OFFSET U(0x00180000)
  27. #define STM32MP_NAND_FIP_A_OFFSET U(0x00200000)
  28. #define STM32MP_NAND_FIP_A_GUID (const struct efi_guid)EFI_GUID(0x4fd84c93, \
  29. 0x54ef, 0x463f, 0xa7, 0xef, 0xae, 0x25, 0xff,\
  30. 0x88, 0x70, 0x87)
  31. #define STM32MP_NAND_FIP_B_OFFSET U(0x00A00000)
  32. #define STM32MP_NAND_FIP_B_GUID (const struct efi_guid)EFI_GUID(0x09c54952, \
  33. 0xd5bf, 0x45af, 0xac, 0xee, 0x33, 0x53, 0x03,\
  34. 0x76, 0x6f, 0xb3)
  35. #define STM32MP_NAND_FIP_B_MAX_OFFSET U(0x01200000)
  36. #else /* PSA_FWU_SUPPORT */
  37. #ifndef STM32MP_NOR_FIP_OFFSET
  38. #define STM32MP_NOR_FIP_OFFSET U(0x00080000)
  39. #endif
  40. #ifndef STM32MP_NAND_FIP_OFFSET
  41. #define STM32MP_NAND_FIP_OFFSET U(0x00200000)
  42. #endif
  43. #endif /* PSA_FWU_SUPPORT */
  44. /*
  45. * Only used for MTD devices that need some backup blocks.
  46. * Must define a maximum size for a partition.
  47. */
  48. #define PLATFORM_MTD_MAX_PART_SIZE U(0x00400000)
  49. #define FIP_IMAGE_NAME "fip"
  50. #define METADATA_PART_1 "metadata1"
  51. #define METADATA_PART_2 "metadata2"
  52. /* IO devices handle */
  53. extern uintptr_t storage_dev_handle;
  54. extern uintptr_t fip_dev_handle;
  55. extern uintptr_t enc_dev_handle;
  56. extern io_block_spec_t image_block_spec;
  57. /* Function declarations */
  58. int open_fip(const uintptr_t spec);
  59. #ifndef DECRYPTION_SUPPORT_none
  60. int open_enc_fip(const uintptr_t spec);
  61. #endif
  62. int open_storage(const uintptr_t spec);
  63. #endif /* STM32MP_IO_STORAGE_H */