platform_common.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) 2020, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. /* Project Includes */
  7. #include <lib/xlat_tables/xlat_tables_v2.h>
  8. /* Platform Includes */
  9. #include <platform_def.h>
  10. /* Table of regions to map using the MMU. */
  11. const mmap_region_t plat_mmap[] = {
  12. /* for TF text, RO, RW */
  13. MAP_REGION_FLAT(MTK_DEV_RNG0_BASE, MTK_DEV_RNG0_SIZE,
  14. MT_DEVICE | MT_RW | MT_SECURE),
  15. MAP_REGION_FLAT(MTK_DEV_RNG1_BASE, MTK_DEV_RNG1_SIZE,
  16. MT_DEVICE | MT_RW | MT_SECURE),
  17. MAP_REGION_FLAT(MTK_DEV_RNG2_BASE, MTK_DEV_RNG2_SIZE,
  18. MT_DEVICE | MT_RW | MT_SECURE),
  19. MAP_REGION_FLAT(MTK_MCDI_SRAM_BASE, MTK_MCDI_SRAM_MAP_SIZE,
  20. MT_DEVICE | MT_RW | MT_SECURE),
  21. MAP_REGION_FLAT(APUSYS_SCTRL_REVISER_BASE, APUSYS_SCTRL_REVISER_SIZE,
  22. MT_DEVICE | MT_RW | MT_SECURE),
  23. MAP_REGION_FLAT(APUSYS_APU_S_S_4_BASE, APUSYS_APU_S_S_4_SIZE,
  24. MT_DEVICE | MT_RW | MT_SECURE),
  25. MAP_REGION_FLAT(APUSYS_APC_AO_WRAPPER_BASE, APUSYS_APC_AO_WRAPPER_SIZE,
  26. MT_DEVICE | MT_RW | MT_SECURE),
  27. MAP_REGION_FLAT(APUSYS_NOC_DAPC_AO_BASE, APUSYS_NOC_DAPC_AO_SIZE,
  28. MT_DEVICE | MT_RW | MT_SECURE),
  29. { 0 }
  30. };
  31. /*******************************************************************************
  32. * Macro generating the code for the function setting up the pagetables as per
  33. * the platform memory map & initialize the mmu, for the given exception level
  34. ******************************************************************************/
  35. void plat_configure_mmu_el3(uintptr_t total_base,
  36. uintptr_t total_size,
  37. uintptr_t ro_start,
  38. uintptr_t ro_limit)
  39. {
  40. mmap_add_region(total_base, total_base, total_size,
  41. MT_RW_DATA | MT_SECURE);
  42. mmap_add_region(ro_start, ro_start, ro_limit - ro_start,
  43. MT_CODE | MT_SECURE);
  44. mmap_add(plat_mmap);
  45. init_xlat_tables();
  46. enable_mmu_el3(0);
  47. }
  48. unsigned int plat_get_syscnt_freq2(void)
  49. {
  50. return SYS_COUNTER_FREQ_IN_TICKS;
  51. }