qemu_bl1_setup.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <assert.h>
  7. #include <platform_def.h>
  8. #include <arch.h>
  9. #include <arch_helpers.h>
  10. #include <common/bl_common.h>
  11. #include "qemu_private.h"
  12. /* Data structure which holds the extents of the trusted SRAM for BL1*/
  13. static meminfo_t bl1_tzram_layout;
  14. meminfo_t *bl1_plat_sec_mem_layout(void)
  15. {
  16. return &bl1_tzram_layout;
  17. }
  18. /*******************************************************************************
  19. * Perform any BL1 specific platform actions.
  20. ******************************************************************************/
  21. void bl1_early_platform_setup(void)
  22. {
  23. /* Initialize the console to provide early debug support */
  24. qemu_console_init();
  25. /* Allow BL1 to see the whole Trusted RAM */
  26. bl1_tzram_layout.total_base = BL_RAM_BASE;
  27. bl1_tzram_layout.total_size = BL_RAM_SIZE;
  28. }
  29. /******************************************************************************
  30. * Perform the very early platform specific architecture setup. This only
  31. * does basic initialization. Later architectural setup (bl1_arch_setup())
  32. * does not do anything platform specific.
  33. *****************************************************************************/
  34. #ifdef __aarch64__
  35. #define QEMU_CONFIGURE_BL1_MMU(...) qemu_configure_mmu_el3(__VA_ARGS__)
  36. #else
  37. #define QEMU_CONFIGURE_BL1_MMU(...) qemu_configure_mmu_svc_mon(__VA_ARGS__)
  38. #endif
  39. void bl1_plat_arch_setup(void)
  40. {
  41. QEMU_CONFIGURE_BL1_MMU(bl1_tzram_layout.total_base,
  42. bl1_tzram_layout.total_size,
  43. BL_CODE_BASE, BL1_CODE_END,
  44. BL1_RO_DATA_BASE, BL1_RO_DATA_END,
  45. BL_COHERENT_RAM_BASE, BL_COHERENT_RAM_END);
  46. }
  47. void bl1_platform_setup(void)
  48. {
  49. plat_qemu_io_setup();
  50. }