1 /* 2 * Copyright (c) 2025, Qualcomm Technologies, Inc. and/or its subsidiaries. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <errno.h> 8 9 #include <common/bl_common.h> 10 #include <common/debug.h> 11 #include <common/desc_image_load.h> 12 #include <common/image_decompress.h> 13 #include <drivers/io/io_storage.h> 14 #include <lib/xlat_tables/xlat_tables_v2.h> 15 #include <plat/common/platform.h> 16 17 #include <platform_def.h> 18 #include <qti_plat.h> 19 #include <qti_uart_console.h> 20 21 static console_t g_qti_console_uart; 22 23 void bl2_el3_early_platform_setup(u_register_t x0, u_register_t x1, 24 u_register_t x2, u_register_t x3) 25 { 26 qti_console_uart_register(&g_qti_console_uart, 27 PLAT_QTI_UART_BASE); 28 console_set_scope(&g_qti_console_uart, 29 CONSOLE_FLAG_BOOT | CONSOLE_FLAG_CRASH); 30 } 31 32 void bl2_el3_plat_arch_setup(void) 33 { 34 int ret; 35 36 qti_setup_page_tables(BL2_BASE, 37 BL2_SIZE, 38 BL_CODE_BASE, 39 BL_CODE_END, 40 BL_RO_DATA_BASE, 41 BL_RO_DATA_END); 42 enable_mmu_el3(0); 43 44 ret = qti_io_setup(); 45 if (ret) { 46 ERROR("failed to setup io devices\n"); 47 plat_error_handler(ret); 48 } 49 } 50 51 void bl2_platform_setup(void) 52 { 53 } 54 55 void plat_flush_next_bl_params(void) 56 { 57 flush_bl_params_desc(); 58 } 59 60 bl_load_info_t *plat_get_bl_image_load_info(void) 61 { 62 return get_bl_load_info_from_mem_params_desc(); 63 } 64 65 bl_params_t *plat_get_next_bl_params(void) 66 { 67 return get_next_bl_params_from_mem_params_desc(); 68 } 69 70 void bl2_plat_preload_setup(void) 71 { 72 } 73 74 int bl2_plat_handle_pre_image_load(unsigned int image_id) 75 { 76 struct image_info *image_info; 77 78 image_info = qti_get_image_info(image_id); 79 80 return mmap_add_dynamic_region(image_info->image_base, 81 image_info->image_base, 82 image_info->image_max_size, 83 MT_MEMORY | MT_RW | MT_NS); 84 } 85 86 int bl2_plat_handle_post_image_load(unsigned int image_id) 87 { 88 return 0; 89 } 90