mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-15 09:04:17 +00:00
feat(versal): deprecate build time arg VERSAL_PLATFORM
Update Versal platform to enable runtime detection of variants instead of relying on the build argument VERSAL_PLATFORM. Integrate functionality for identifying the board variant during runtime, allowing dynamic adjustment of CPU and UART clock values accordingly. Print the runtime board information during boot. This advancement streamlines the build process by eliminating dependencies on variant-specific builds, enabling the use of a single binary for multiple variants. Removing all the platform related constants for versal_virt,SPP,EMU as they are not used. Change-Id: I8c1a1d391bd1a8971addc1f56f8309a3fb75aa6d Signed-off-by: Amey Avinash Raghatate <AmeyAvinash.Raghatate@amd.com> Signed-off-by: Maheedhar Bollapalli <MaheedharSai.Bollapalli@amd.com>
This commit is contained in:
parent
a3939b1bda
commit
09ac1ca27c
6 changed files with 91 additions and 67 deletions
|
@ -14,11 +14,6 @@ To build:
|
|||
make RESET_TO_BL31=1 CROSS_COMPILE=aarch64-none-elf- PLAT=versal bl31
|
||||
```
|
||||
|
||||
To build ATF for different platform (supported are "silicon"(default) and "versal_virt")
|
||||
```bash
|
||||
make RESET_TO_BL31=1 CROSS_COMPILE=aarch64-none-elf- PLAT=versal VERSAL_PLATFORM=versal_virt bl31
|
||||
```
|
||||
|
||||
To build bl32 TSP you have to rebuild bl31 too
|
||||
```bash
|
||||
make CROSS_COMPILE=aarch64-none-elf- PLAT=versal SPD=tspd RESET_TO_BL31=1 bl31 bl32
|
||||
|
@ -51,11 +46,6 @@ Xilinx Versal platform specific build options
|
|||
- `pl011`, `pl011_0`: ARM pl011 UART 0
|
||||
- `pl011_1` : ARM pl011 UART 1
|
||||
|
||||
* `VERSAL_PLATFORM`: Select the platform. Options:
|
||||
- `versal_virt` : Versal Virtual platform
|
||||
- `spp_itr6` : SPP ITR6
|
||||
- `emu_itr6` : EMU ITR6
|
||||
|
||||
* `CPU_PWRDWN_SGI`: Select the SGI for triggering CPU power down request to
|
||||
secondary cores on receiving power down callback from
|
||||
firmware. Options:
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
|
||||
* Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <common/debug.h>
|
||||
#include <drivers/generic_delay_timer.h>
|
||||
#include <lib/mmio.h>
|
||||
#include <lib/xlat_tables/xlat_tables_v2.h>
|
||||
#include <plat/common/platform.h>
|
||||
|
@ -18,7 +17,7 @@
|
|||
#include <versal_def.h>
|
||||
|
||||
uint32_t platform_id, platform_version;
|
||||
uint32_t cpu_clock = VERSAL_CPU_CLOCK;
|
||||
uint32_t cpu_clock;
|
||||
|
||||
/*
|
||||
* Table of regions to map using the MMU.
|
||||
|
@ -39,19 +38,10 @@ const mmap_region_t *plat_get_mmap(void)
|
|||
return plat_versal_mmap;
|
||||
}
|
||||
|
||||
static void versal_print_platform_name(void)
|
||||
{
|
||||
NOTICE("TF-A running on %s\n", PLATFORM_NAME);
|
||||
}
|
||||
|
||||
void versal_config_setup(void)
|
||||
{
|
||||
/* Configure IPI data for versal */
|
||||
versal_ipi_config_table_init();
|
||||
|
||||
versal_print_platform_name();
|
||||
|
||||
generic_delay_timer_init();
|
||||
}
|
||||
|
||||
void board_detection(void)
|
||||
|
@ -70,7 +60,50 @@ void board_detection(void)
|
|||
platform_version = FIELD_GET(PLATFORM_VERSION_MASK, plat_info[1]);
|
||||
}
|
||||
|
||||
const char *board_name_decode(void)
|
||||
{
|
||||
const char *platform;
|
||||
|
||||
switch (platform_id) {
|
||||
case VERSAL_SPP:
|
||||
platform = "IPP";
|
||||
break;
|
||||
case VERSAL_EMU:
|
||||
platform = "EMU";
|
||||
break;
|
||||
case VERSAL_QEMU:
|
||||
platform = "QEMU";
|
||||
break;
|
||||
case VERSAL_SILICON:
|
||||
platform = "SILICON";
|
||||
break;
|
||||
default:
|
||||
platform = "unknown";
|
||||
}
|
||||
|
||||
return platform;
|
||||
}
|
||||
|
||||
uint32_t get_uart_clk(void)
|
||||
{
|
||||
return UART_CLOCK;
|
||||
uint32_t uart_clock;
|
||||
|
||||
switch (platform_id) {
|
||||
case VERSAL_SPP:
|
||||
uart_clock = 25000000;
|
||||
break;
|
||||
case VERSAL_EMU:
|
||||
uart_clock = 212000;
|
||||
break;
|
||||
case VERSAL_QEMU:
|
||||
uart_clock = 25000000;
|
||||
break;
|
||||
case VERSAL_SILICON:
|
||||
uart_clock = 100000000;
|
||||
break;
|
||||
default:
|
||||
panic();
|
||||
}
|
||||
|
||||
return uart_clock;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2018-2022, Xilinx, Inc. All rights reserved.
|
||||
* Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
|
||||
* Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -12,6 +12,7 @@
|
|||
#include <bl31/bl31.h>
|
||||
#include <common/bl_common.h>
|
||||
#include <common/debug.h>
|
||||
#include <drivers/generic_delay_timer.h>
|
||||
#include <lib/mmio.h>
|
||||
#include <lib/xlat_tables/xlat_tables_v2.h>
|
||||
#include <plat/common/platform.h>
|
||||
|
@ -73,22 +74,41 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
|||
enum pm_ret_status ret_status;
|
||||
uint64_t addr[HANDOFF_PARAMS_MAX_SIZE];
|
||||
|
||||
set_cnt_freq();
|
||||
|
||||
setup_console();
|
||||
|
||||
/* Initialize the platform config for future decision making */
|
||||
versal_config_setup();
|
||||
|
||||
/* Get platform related information */
|
||||
board_detection();
|
||||
|
||||
/*
|
||||
* Do initial security configuration to allow DRAM/device access. On
|
||||
* Base VERSAL only DRAM security is programmable (via TrustZone), but
|
||||
* other platforms might have more programmable security devices
|
||||
* present.
|
||||
*/
|
||||
versal_config_setup();
|
||||
|
||||
/* Initialize the platform config for future decision making */
|
||||
board_detection();
|
||||
|
||||
switch (platform_id) {
|
||||
case VERSAL_SPP:
|
||||
cpu_clock = 2720000;
|
||||
break;
|
||||
case VERSAL_EMU:
|
||||
cpu_clock = 212000;
|
||||
break;
|
||||
case VERSAL_QEMU:
|
||||
/* Random values now */
|
||||
cpu_clock = 2720000;
|
||||
break;
|
||||
case VERSAL_SILICON:
|
||||
cpu_clock = 100000000;
|
||||
break;
|
||||
default:
|
||||
panic();
|
||||
}
|
||||
set_cnt_freq();
|
||||
|
||||
generic_delay_timer_init();
|
||||
|
||||
setup_console();
|
||||
|
||||
NOTICE("TF-A running on %s %d\n", board_name_decode(), platform_version);
|
||||
|
||||
/* Populate common information for BL32 and BL33 */
|
||||
SET_PARAM_HEAD(&bl32_image_ep_info, PARAM_EP, VERSION_1, 0);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2019, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2018-2022, Xilinx, Inc. All rights reserved.
|
||||
* Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
|
||||
* Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -25,6 +25,8 @@ const mmap_region_t *plat_get_mmap(void);
|
|||
extern uint32_t cpu_clock, platform_id, platform_version;
|
||||
|
||||
void board_detection(void);
|
||||
const char *board_name_decode(void);
|
||||
|
||||
void plat_versal_gic_driver_init(void);
|
||||
void plat_versal_gic_init(void);
|
||||
void plat_versal_gic_cpuif_enable(void);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved.
|
||||
* Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
|
||||
* Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -25,13 +25,11 @@
|
|||
|
||||
#define CONSOLE_IS(con) (VERSAL_CONSOLE_ID_ ## con == VERSAL_CONSOLE)
|
||||
|
||||
/* List all supported platforms */
|
||||
#define VERSAL_PLATFORM_ID_versal_virt 1
|
||||
#define VERSAL_PLATFORM_ID_spp_itr6 2
|
||||
#define VERSAL_PLATFORM_ID_emu_itr6 3
|
||||
#define VERSAL_PLATFORM_ID_silicon 4
|
||||
|
||||
#define VERSAL_PLATFORM_IS(con) (VERSAL_PLATFORM_ID_ ## con == VERSAL_PLATFORM)
|
||||
/* List of platforms */
|
||||
#define VERSAL_SILICON U(0)
|
||||
#define VERSAL_SPP U(1)
|
||||
#define VERSAL_EMU U(2)
|
||||
#define VERSAL_QEMU U(3)
|
||||
|
||||
/* Firmware Image Package */
|
||||
#define VERSAL_PRIMARY_CPU 0
|
||||
|
@ -75,27 +73,7 @@
|
|||
/*******************************************************************************
|
||||
* Platform related constants
|
||||
******************************************************************************/
|
||||
#if VERSAL_PLATFORM_IS(versal_virt)
|
||||
# define PLATFORM_NAME "Versal Virt"
|
||||
# define UART_CLOCK 25000000
|
||||
# define UART_BAUDRATE 115200
|
||||
# define VERSAL_CPU_CLOCK 2720000
|
||||
#elif VERSAL_PLATFORM_IS(silicon)
|
||||
# define PLATFORM_NAME "Versal Silicon"
|
||||
# define UART_CLOCK 100000000
|
||||
# define UART_BAUDRATE 115200
|
||||
# define VERSAL_CPU_CLOCK 100000000
|
||||
#elif VERSAL_PLATFORM_IS(spp_itr6)
|
||||
# define PLATFORM_NAME "SPP ITR6"
|
||||
# define UART_CLOCK 25000000
|
||||
# define UART_BAUDRATE 115200
|
||||
# define VERSAL_CPU_CLOCK 2720000
|
||||
#elif VERSAL_PLATFORM_IS(emu_itr6)
|
||||
# define PLATFORM_NAME "EMU ITR6"
|
||||
# define UART_CLOCK 212000
|
||||
# define UART_BAUDRATE 9600
|
||||
# define VERSAL_CPU_CLOCK 212000
|
||||
#endif
|
||||
#define UART_BAUDRATE 115200
|
||||
|
||||
/* Access control register defines */
|
||||
#define ACTLR_EL3_L2ACTLR_BIT (1 << 6)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright (c) 2018-2021, Arm Limited and Contributors. All rights reserved.
|
||||
# Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
|
||||
# Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
@ -44,8 +44,9 @@ ifdef IPI_CRC_CHECK
|
|||
$(eval $(call add_define,IPI_CRC_CHECK))
|
||||
endif
|
||||
|
||||
VERSAL_PLATFORM ?= silicon
|
||||
$(eval $(call add_define_val,VERSAL_PLATFORM,VERSAL_PLATFORM_ID_${VERSAL_PLATFORM}))
|
||||
ifdef VERSAL_PLATFORM
|
||||
$(warning "VERSAL_PLATFORM has been deprecated")
|
||||
endif
|
||||
|
||||
ifdef XILINX_OF_BOARD_DTB_ADDR
|
||||
$(eval $(call add_define,XILINX_OF_BOARD_DTB_ADDR))
|
||||
|
|
Loading…
Add table
Reference in a new issue