Jassi Brar | 2244bf1 | 2022-03-03 15:24:31 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022, Socionext Inc. All rights reserved. |
| 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/arm/pl011.h> |
| 14 | #include <drivers/io/io_storage.h> |
| 15 | #include <lib/xlat_tables/xlat_tables_v2.h> |
| 16 | #include <plat/common/platform.h> |
| 17 | |
| 18 | #include <platform_def.h> |
| 19 | #include <sq_common.h> |
| 20 | |
| 21 | static console_t console; |
| 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 | /* Initialize the console to provide early debug support */ |
| 27 | (void)console_pl011_register(PLAT_SQ_BOOT_UART_BASE, |
| 28 | PLAT_SQ_BOOT_UART_CLK_IN_HZ, |
| 29 | SQ_CONSOLE_BAUDRATE, &console); |
| 30 | console_set_scope(&console, CONSOLE_FLAG_BOOT); |
| 31 | } |
| 32 | |
| 33 | void bl2_el3_plat_arch_setup(void) |
| 34 | { |
| 35 | int ret; |
| 36 | |
| 37 | sq_mmap_setup(BL2_BASE, BL2_SIZE, NULL); |
| 38 | |
| 39 | ret = sq_io_setup(); |
| 40 | if (ret) { |
| 41 | ERROR("failed to setup io devices\n"); |
| 42 | plat_error_handler(ret); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | void bl2_platform_setup(void) |
| 47 | { |
| 48 | } |
| 49 | |
| 50 | void plat_flush_next_bl_params(void) |
| 51 | { |
| 52 | flush_bl_params_desc(); |
| 53 | } |
| 54 | |
| 55 | bl_load_info_t *plat_get_bl_image_load_info(void) |
| 56 | { |
| 57 | return get_bl_load_info_from_mem_params_desc(); |
| 58 | } |
| 59 | |
| 60 | bl_params_t *plat_get_next_bl_params(void) |
| 61 | { |
| 62 | return get_next_bl_params_from_mem_params_desc(); |
| 63 | } |
| 64 | |
| 65 | void bl2_plat_preload_setup(void) |
| 66 | { |
| 67 | } |
| 68 | |
| 69 | int bl2_plat_handle_pre_image_load(unsigned int image_id) |
| 70 | { |
| 71 | struct image_info *image_info; |
| 72 | |
| 73 | image_info = sq_get_image_info(image_id); |
| 74 | |
| 75 | return mmap_add_dynamic_region(image_info->image_base, |
| 76 | image_info->image_base, |
| 77 | image_info->image_max_size, |
| 78 | MT_MEMORY | MT_RW | MT_NS); |
| 79 | } |
| 80 | |
| 81 | int bl2_plat_handle_post_image_load(unsigned int image_id) |
| 82 | { |
| 83 | return 0; |
| 84 | } |