platform_common.c 1.3 KB

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