From 4003ac02eb4e5b0551614710f3e99a2e23cfe799 Mon Sep 17 00:00:00 2001 From: Saivardhan Thatikonda Date: Fri, 17 Jan 2025 15:07:07 +0530 Subject: [PATCH] feat(versal2): update platform version to versal2 Extend board detection with saving information about PS, PMC and RTL versions. Variables can be use to cover different behavior based on version and version information is also printed for chip identification. Change-Id: Ia37418f6a31426a5763fb89fc76fef91d09df155 Signed-off-by: Saivardhan Thatikonda --- plat/amd/versal2/aarch64/common.c | 5 ++++- plat/amd/versal2/bl31_setup.c | 8 ++++++-- plat/amd/versal2/include/def.h | 3 +++ plat/amd/versal2/include/plat_private.h | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/plat/amd/versal2/aarch64/common.c b/plat/amd/versal2/aarch64/common.c index c78d71169..8d9e05c11 100644 --- a/plat/amd/versal2/aarch64/common.c +++ b/plat/amd/versal2/aarch64/common.c @@ -18,7 +18,7 @@ #include #include -uint32_t platform_id, platform_version; +uint32_t platform_id, platform_version, rtlversion, psversion, pmcversion; /* * Table of regions to map using the MMU. @@ -77,6 +77,9 @@ void board_detection(void) version_type = mmio_read_32(PMC_TAP_VERSION); platform_id = FIELD_GET((uint32_t)PLATFORM_MASK, version_type); platform_version = FIELD_GET((uint32_t)PLATFORM_VERSION_MASK, version_type); + rtlversion = FIELD_GET((uint32_t)RTL_VERSION, version_type); + psversion = FIELD_GET((uint32_t)PS_VERSION, version_type); + pmcversion = FIELD_GET((uint32_t)PMC_VERSION, version_type); if (platform_id == QEMU_COSIM) { platform_id = QEMU; diff --git a/plat/amd/versal2/bl31_setup.c b/plat/amd/versal2/bl31_setup.c index 05e4c96ce..1914830f9 100644 --- a/plat/amd/versal2/bl31_setup.c +++ b/plat/amd/versal2/bl31_setup.c @@ -132,8 +132,12 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, setup_console(); - NOTICE("TF-A running on %s %d.%d\n", board_name_decode(), - platform_version / 10U, platform_version % 10U); + NOTICE("TF-A running on %s v%d.%d, RTL v%d.%d, PS v%d.%d, PMC v%d.%d\n", + board_name_decode(), + (platform_version >> 1), platform_version % 10U, + (rtlversion >> 1), rtlversion % 10U, + (psversion >> 1), psversion % 10U, + (pmcversion >> 1), pmcversion % 10U); /* * Do initial security configuration to allow DRAM/device access. On diff --git a/plat/amd/versal2/include/def.h b/plat/amd/versal2/include/def.h index 0c43d1b3c..938b118a4 100644 --- a/plat/amd/versal2/include/def.h +++ b/plat/amd/versal2/include/def.h @@ -45,6 +45,9 @@ /* For platform detection */ #define PMC_TAP U(0xF11A0000) #define PMC_TAP_VERSION (PMC_TAP + 0x4U) +# define PMC_VERSION GENMASK(7U, 0U) +# define PS_VERSION GENMASK(15U, 8U) +# define RTL_VERSION GENMASK(23U, 16U) # define PLATFORM_MASK GENMASK(27U, 24U) # define PLATFORM_VERSION_MASK GENMASK(31U, 28U) diff --git a/plat/amd/versal2/include/plat_private.h b/plat/amd/versal2/include/plat_private.h index 5a2e5bd9f..4be2061a7 100644 --- a/plat/amd/versal2/include/plat_private.h +++ b/plat/amd/versal2/include/plat_private.h @@ -41,6 +41,7 @@ void plat_gic_redistif_on(void); void plat_gic_redistif_off(void); extern uint32_t cpu_clock, platform_id, platform_version; +extern uint32_t rtlversion, psversion, pmcversion; void board_detection(void); const char *board_name_decode(void); uint64_t smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,