nrd_plat3.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <assert.h>
  7. #include <drivers/arm/css/sds.h>
  8. #include <drivers/arm/sbsa.h>
  9. #include <lib/utils_def.h>
  10. #include <plat/arm/common/plat_arm.h>
  11. #include <plat/common/platform.h>
  12. #include <platform_def.h>
  13. /*
  14. * Table of regions for different BL stages to map using the MMU.
  15. */
  16. #if IMAGE_BL1
  17. const mmap_region_t plat_arm_mmap[] = {
  18. NRD_CSS_SHARED_RAM_MMAP(0),
  19. NRD_ROS_FLASH0_RO_MMAP,
  20. NRD_CSS_PERIPH_MMAP(0),
  21. NRD_ROS_PLATFORM_PERIPH_MMAP,
  22. NRD_ROS_SYSTEM_PERIPH_MMAP,
  23. {0}
  24. };
  25. #endif /* IMAGE_BL3 */
  26. #if IMAGE_BL2
  27. const mmap_region_t plat_arm_mmap[] = {
  28. NRD_CSS_SHARED_RAM_MMAP(0),
  29. NRD_ROS_FLASH0_RO_MMAP,
  30. #ifdef PLAT_ARM_MEM_PROT_ADDR
  31. NRD_ROS_V2M_MEM_PROTECT_MMAP,
  32. #endif
  33. NRD_CSS_PERIPH_MMAP(0),
  34. NRD_ROS_PLATFORM_PERIPH_MMAP,
  35. NRD_ROS_SYSTEM_PERIPH_MMAP,
  36. NRD_CSS_NS_DRAM1_MMAP,
  37. #if TRUSTED_BOARD_BOOT && !RESET_TO_BL2
  38. NRD_CSS_BL1_RW_MMAP,
  39. #endif
  40. NRD_CSS_GPT_L1_DRAM_MMAP,
  41. NRD_CSS_RMM_REGION_MMAP,
  42. {0}
  43. };
  44. #endif /* IMAGE_BL2 */
  45. #if IMAGE_BL31
  46. const mmap_region_t plat_arm_mmap[] = {
  47. NRD_CSS_SHARED_RAM_MMAP(0),
  48. #ifdef PLAT_ARM_MEM_PROT_ADDR
  49. NRD_ROS_V2M_MEM_PROTECT_MMAP,
  50. #endif
  51. NRD_CSS_PERIPH_MMAP(0),
  52. NRD_ROS_PLATFORM_PERIPH_MMAP,
  53. NRD_ROS_SYSTEM_PERIPH_MMAP,
  54. NRD_CSS_GPT_L1_DRAM_MMAP,
  55. NRD_CSS_EL3_RMM_SHARED_MEM_MMAP,
  56. NRD_CSS_GPC_SMMU_SMMUV3_MMAP,
  57. #if RESET_TO_BL31
  58. NRD_CSS_MAP_BL31_DTB,
  59. #endif
  60. {0}
  61. };
  62. #endif /* IMAGE_BL31 */
  63. ARM_CASSERT_MMAP
  64. #if TRUSTED_BOARD_BOOT
  65. int plat_get_mbedtls_heap(void **heap_addr, size_t *heap_size)
  66. {
  67. assert(heap_addr != NULL);
  68. assert(heap_size != NULL);
  69. return arm_get_mbedtls_heap(heap_addr, heap_size);
  70. }
  71. #endif
  72. void plat_arm_secure_wdt_start(void)
  73. {
  74. sbsa_wdog_start(NRD_CSS_AP_SECURE_WDOG_BASE,
  75. NRD_CSS_AP_SECURE_WDOG_TIMEOUT);
  76. }
  77. void plat_arm_secure_wdt_stop(void)
  78. {
  79. sbsa_wdog_stop(NRD_CSS_AP_SECURE_WDOG_BASE);
  80. }
  81. static sds_region_desc_t nrd_sds_regions[] = {
  82. { .base = PLAT_ARM_SDS_MEM_BASE },
  83. };
  84. sds_region_desc_t *plat_sds_get_regions(unsigned int *region_count)
  85. {
  86. *region_count = ARRAY_SIZE(nrd_sds_regions);
  87. return nrd_sds_regions;
  88. }