15d5fb10fSMikael Olsson /*
2b6e6e2e6SJayanth Dodderi Chidanand * Copyright (c) 2021-2025, Arm Limited and Contributors. All rights reserved.
35d5fb10fSMikael Olsson *
45d5fb10fSMikael Olsson * SPDX-License-Identifier: BSD-3-Clause
55d5fb10fSMikael Olsson */
65d5fb10fSMikael Olsson
75d5fb10fSMikael Olsson #include <assert.h>
85d5fb10fSMikael Olsson
95d5fb10fSMikael Olsson #include <common/debug.h>
105d5fb10fSMikael Olsson #include <lib/fconf/fconf.h>
115d5fb10fSMikael Olsson #include <lib/fconf/fconf_dyn_cfg_getter.h>
125d5fb10fSMikael Olsson
135d5fb10fSMikael Olsson #include <plat/arm/common/plat_arm.h>
14e9a457f4SYeoreum Yun #include <platform_def.h>
155d5fb10fSMikael Olsson
bl31_early_platform_setup2(u_register_t arg0,u_register_t arg1,u_register_t arg2,u_register_t arg3)165d5fb10fSMikael Olsson void __init bl31_early_platform_setup2(u_register_t arg0,
175d5fb10fSMikael Olsson u_register_t arg1, u_register_t arg2, u_register_t arg3)
185d5fb10fSMikael Olsson {
19*fad88444SYeoreum Yun /* Initialize the console to provide early debug support */
20*fad88444SYeoreum Yun arm_console_boot_init();
21*fad88444SYeoreum Yun
22*fad88444SYeoreum Yun #if !(TRANSFER_LIST || RESET_TO_BL31 || RESET_TO_BL2)
235d5fb10fSMikael Olsson const struct dyn_cfg_dtb_info_t *soc_fw_config_info;
245d5fb10fSMikael Olsson
255d5fb10fSMikael Olsson INFO("BL31 FCONF: FW_CONFIG address = %lx\n", (uintptr_t)arg1);
265d5fb10fSMikael Olsson
275d5fb10fSMikael Olsson /* Fill the properties struct with the info from the config dtb */
285d5fb10fSMikael Olsson fconf_populate("FW_CONFIG", arg1);
295d5fb10fSMikael Olsson
305d5fb10fSMikael Olsson soc_fw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, SOC_FW_CONFIG_ID);
315d5fb10fSMikael Olsson if (soc_fw_config_info != NULL) {
325d5fb10fSMikael Olsson arg1 = soc_fw_config_info->config_addr;
335d5fb10fSMikael Olsson }
34*fad88444SYeoreum Yun #endif
355d5fb10fSMikael Olsson
36b6e6e2e6SJayanth Dodderi Chidanand arm_bl31_early_platform_setup(arg0, arg1, arg2, arg3);
375d5fb10fSMikael Olsson
385d5fb10fSMikael Olsson /*
395d5fb10fSMikael Olsson * Initialize Interconnect for this cluster during cold boot.
405d5fb10fSMikael Olsson * No need for locks as no other CPU is active.
415d5fb10fSMikael Olsson */
425d5fb10fSMikael Olsson plat_arm_interconnect_init();
435d5fb10fSMikael Olsson
445d5fb10fSMikael Olsson /*
455d5fb10fSMikael Olsson * Enable Interconnect coherency for the primary CPU's cluster.
465d5fb10fSMikael Olsson * Earlier bootloader stages might already do this (e.g. Trusted
475d5fb10fSMikael Olsson * Firmware's BL1 does it) but we can't assume so. There is no harm in
485d5fb10fSMikael Olsson * executing this code twice anyway.
495d5fb10fSMikael Olsson * Platform specific PSCI code will enable coherency for other
505d5fb10fSMikael Olsson * clusters.
515d5fb10fSMikael Olsson */
525d5fb10fSMikael Olsson plat_arm_interconnect_enter_coherency();
535d5fb10fSMikael Olsson }
545d5fb10fSMikael Olsson
55*fad88444SYeoreum Yun #if !TRANSFER_LIST
bl31_plat_arch_setup(void)565d5fb10fSMikael Olsson void __init bl31_plat_arch_setup(void)
575d5fb10fSMikael Olsson {
585d5fb10fSMikael Olsson arm_bl31_plat_arch_setup();
595d5fb10fSMikael Olsson
605d5fb10fSMikael Olsson /* HW_CONFIG was also loaded by BL2 */
615d5fb10fSMikael Olsson const struct dyn_cfg_dtb_info_t *hw_config_info;
625d5fb10fSMikael Olsson
635d5fb10fSMikael Olsson hw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, HW_CONFIG_ID);
645d5fb10fSMikael Olsson assert(hw_config_info != NULL);
655d5fb10fSMikael Olsson
665d5fb10fSMikael Olsson fconf_populate("HW_CONFIG", hw_config_info->config_addr);
675d5fb10fSMikael Olsson }
68*fad88444SYeoreum Yun #endif
69