Merge changes from topic "ja/ffa_v1_3"
* changes:
test(spm): bump partitions to FF-A v1.3
fix: the FF-A version compatibility check
chore: drop unused FF-A version macros
test(ff-a): bump FF-A version to v1.3
diff --git a/.checkpatch.conf b/.checkpatch.conf
index 63c51b0..c418250 100644
--- a/.checkpatch.conf
+++ b/.checkpatch.conf
@@ -10,12 +10,12 @@
#
# E.g.:
# Without this option, we have the following output:
-# #333: FILE: drivers/arm/gic/arm_gic_v2v3.c:160:
+# #333: FILE: drivers/arm/gic/arm_gic.c:160:
# So we have 2 lines indications (333 and 160), which is confusing.
# We only care about the position in the source file.
#
# With this option, it becomes:
-# drivers/arm/gic/arm_gic_v2v3.c:160:
+# drivers/arm/gic/arm_gic.c:160:
--showfile
# Don't show some messages like the list of ignored types or the suggestion to
diff --git a/.gitmodules b/.gitmodules
index c753963..844ca3c 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -5,3 +5,6 @@
path = contrib/libtl
url = https://review.trustedfirmware.org/shared/transfer-list-library
shallow = true
+[submodule "contrib/libeventlog"]
+ path = contrib/libeventlog
+ url = https://review.trustedfirmware.org/shared/libEventLog
diff --git a/contrib/libeventlog b/contrib/libeventlog
new file mode 160000
index 0000000..e2f92a9
--- /dev/null
+++ b/contrib/libeventlog
@@ -0,0 +1 @@
+Subproject commit e2f92a92245f9fb073ed995b4e80b71f9c4ff6a2
diff --git a/contrib/libtl b/contrib/libtl
index 38b309b..022175f 160000
--- a/contrib/libtl
+++ b/contrib/libtl
@@ -1 +1 @@
-Subproject commit 38b309b70f830280af038e03c51082df8f54a149
+Subproject commit 022175f49371aeb3bb267201ae06125fd6ae262e
diff --git a/docs/design.rst b/docs/design.rst
index e900efe..3e1fb72 100644
--- a/docs/design.rst
+++ b/docs/design.rst
@@ -80,17 +80,13 @@
- ``irq.h``
IRQ handling support. Used to configure IRQs and register/unregister
- handlers called upon reception of a specific IRQ.
+ handlers called upon reception of a specific IRQ. Also raises software
+ generated interrupts (SGI).
- ``power_management.h``
Power management operations (CPU ON/OFF, CPU suspend, etc.).
- - ``sgi.h``
-
- Software Generated Interrupt support. Used as an inter-CPU communication
- mechanism.
-
- ``spinlock.h``
Lightweight implementation of synchronisation locks. Used to prevent
@@ -242,6 +238,6 @@
--------------
-*Copyright (c) 2018-2019, Arm Limited. All rights reserved.*
+*Copyright (c) 2018-2025, Arm Limited. All rights reserved.*
.. _Firmware update: https://trustedfirmware-a.readthedocs.io/en/latest/components/firmware-update.html
diff --git a/docs/getting_started/requirements.rst b/docs/getting_started/requirements.rst
index 3c27b9d..eba75a2 100644
--- a/docs/getting_started/requirements.rst
+++ b/docs/getting_started/requirements.rst
@@ -26,6 +26,8 @@
Name Version
======================== =====================
Mbed TLS 3.6.3
+Transfer List Library 0.0.1
+Event Log Library 0.0.1
======================== =====================
Toolchain
diff --git a/drivers/arm/gic/arm_gic_v2v3.c b/drivers/arm/gic/arm_gic.c
similarity index 94%
rename from drivers/arm/gic/arm_gic_v2v3.c
rename to drivers/arm/gic/arm_gic.c
index 9c7692e..d3b2536 100644
--- a/drivers/arm/gic/arm_gic_v2v3.c
+++ b/drivers/arm/gic/arm_gic.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2023, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -8,7 +8,7 @@
#include <arch_helpers.h>
#include <assert.h>
#include <debug.h>
-#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gic_v2v3_common.h>
#include <drivers/arm/gic_v2.h>
#include <drivers/arm/gic_v3.h>
#include <stdbool.h>
@@ -198,14 +198,12 @@
bool arm_gic_is_espi_supported(void)
{
- unsigned int typer_reg = gicv3_get_gicd_typer();
-
if (!gicv3_detected) {
return false;
}
/* Check if extended SPI range is implemented. */
- if ((typer_reg & TYPER_ESPI) != 0U) {
+ if ((gicv3_get_gicd_typer() & TYPER_ESPI) != 0U) {
return true;
}
diff --git a/drivers/arm/gic/arm_gic_v2.c b/drivers/arm/gic/arm_gic_v2.c
deleted file mode 100644
index a781703..0000000
--- a/drivers/arm/gic/arm_gic_v2.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <arch.h>
-#include <arch_helpers.h>
-#include <assert.h>
-#include <debug.h>
-#include <drivers/arm/gic_v2.h>
-#include <stdbool.h>
-
-void arm_gic_enable_interrupts_local(void)
-{
- gicv2_enable_cpuif();
-}
-
-void arm_gic_setup_local(void)
-{
- gicv2_probe_gic_cpu_id();
- gicv2_setup_cpuif();
-}
-
-void arm_gic_disable_interrupts_local(void)
-{
- gicv2_disable_cpuif();
-}
-
-void arm_gic_save_context_local(void)
-{
- gicv2_save_cpuif_context();
-}
-
-void arm_gic_restore_context_local(void)
-{
- gicv2_restore_cpuif_context();
-}
-
-void arm_gic_save_context_global(void)
-{
- gicv2_save_sgi_ppi_context();
-}
-
-void arm_gic_restore_context_global(void)
-{
- gicv2_setup_distif();
- gicv2_restore_sgi_ppi_context();
-}
-
-void arm_gic_setup_global(void)
-{
- gicv2_setup_distif();
-}
-
-unsigned int arm_gic_get_intr_priority(unsigned int num)
-{
- return gicv2_gicd_get_ipriorityr(num);
-}
-
-void arm_gic_set_intr_priority(unsigned int num,
- unsigned int priority)
-{
- gicv2_gicd_set_ipriorityr(num, priority);
-}
-
-void arm_gic_send_sgi(unsigned int sgi_id, unsigned int core_pos)
-{
- gicv2_send_sgi(sgi_id, core_pos);
-}
-
-void arm_gic_set_intr_target(unsigned int num, unsigned int core_pos)
-{
- gicv2_set_itargetsr(num, core_pos);
-}
-
-unsigned int arm_gic_intr_enabled(unsigned int num)
-{
- return gicv2_gicd_get_isenabler(num) != 0;
-}
-
-void arm_gic_intr_enable(unsigned int num)
-{
- gicv2_gicd_set_isenabler(num);
-}
-
-void arm_gic_intr_disable(unsigned int num)
-{
- gicv2_gicd_set_icenabler(num);
-}
-
-unsigned int arm_gic_intr_ack(unsigned int *raw_iar)
-{
- assert(raw_iar);
-
- *raw_iar = gicv2_gicc_read_iar();
- return get_gicc_iar_intid(*raw_iar);
-}
-
-unsigned int arm_gic_is_intr_pending(unsigned int num)
-{
- return gicv2_gicd_get_ispendr(num);
-}
-
-void arm_gic_intr_clear(unsigned int num)
-{
- gicv2_gicd_set_icpendr(num);
-}
-
-void arm_gic_end_of_intr(unsigned int raw_iar)
-{
- gicv2_gicc_write_eoir(raw_iar);
-}
-
-void arm_gic_init(uintptr_t gicc_base,
- uintptr_t gicd_base,
- uintptr_t gicr_base)
-{
- gicv2_init(gicc_base, gicd_base);
- INFO("ARM GIC v2 driver initialized\n");
-}
-
-bool arm_gic_is_espi_supported(void)
-{
- /* ESPI not supported by GICv2. */
- return false;
-}
diff --git a/drivers/arm/gic/gic_v2.c b/drivers/arm/gic/gic_v2.c
index f91427c..f5fdc44 100644
--- a/drivers/arm/gic/gic_v2.c
+++ b/drivers/arm/gic/gic_v2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -8,7 +8,7 @@
#include <arch_helpers.h>
#include <assert.h>
#include <drivers/arm/arm_gic.h>
-#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gic_v2v3_common.h>
#include <drivers/arm/gic_v2.h>
#include <mmio.h>
#include <platform.h>
diff --git a/drivers/arm/gic/gic_common.c b/drivers/arm/gic/gic_v2v3_common.c
similarity index 94%
rename from drivers/arm/gic/gic_common.c
rename to drivers/arm/gic/gic_v2v3_common.c
index 7e76a20..4eafa59 100644
--- a/drivers/arm/gic/gic_common.c
+++ b/drivers/arm/gic/gic_v2v3_common.c
@@ -1,13 +1,14 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch.h>
#include <arch_helpers.h>
+#include <arch_features.h>
#include <assert.h>
-#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gic_v2v3_common.h>
#include <drivers/arm/gic_v3.h>
#include <mmio.h>
@@ -187,16 +188,11 @@
priority & GIC_PRI_MASK);
}
-unsigned int is_gicv3_mode(void)
+bool is_gicv3_mode(void)
{
/* Check if GICv3 system register available */
-#ifdef __aarch64__
- if (!(read_id_aa64pfr0_el1() & (ID_AA64PFR0_GIC_MASK << ID_AA64PFR0_GIC_SHIFT)))
+ if (!is_feat_gic_supported())
return 0;
-#else
- if (!(read_id_pfr1() & (ID_PFR1_GIC_MASK << ID_PFR1_GIC_SHIFT)))
- return 0;
-#endif
/* Check whether the system register interface is enabled */
return !!is_sre_enabled();
diff --git a/drivers/arm/gic/gic_v3.c b/drivers/arm/gic/gic_v3.c
index 93c707a..8bbea48 100644
--- a/drivers/arm/gic/gic_v3.c
+++ b/drivers/arm/gic/gic_v3.c
@@ -1,15 +1,16 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch.h>
+#include <arch_features.h>
#include <arch_helpers.h>
#include <assert.h>
#include <debug.h>
#include <drivers/arm/arm_gic.h>
-#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gic_v2v3_common.h>
#include <drivers/arm/gic_v3.h>
#include <mmio.h>
#include <platform.h>
@@ -477,12 +478,8 @@
assert(gicd_base_addr);
/* Check for system register support */
-#ifdef __aarch64__
- assert(read_id_aa64pfr0_el1() &
- (ID_AA64PFR0_GIC_MASK << ID_AA64PFR0_GIC_SHIFT));
-#else
- assert(read_id_pfr1() & (ID_PFR1_GIC_MASK << ID_PFR1_GIC_SHIFT));
-#endif
+
+ assert(is_feat_gic_supported());
/* Assert that system register access is enabled */
assert(is_sre_enabled());
diff --git a/include/drivers/arm/gic_common.h b/include/drivers/arm/gic_v2v3_common.h
similarity index 97%
rename from include/drivers/arm/gic_common.h
rename to include/drivers/arm/gic_v2v3_common.h
index 71387f6..7bcae6a 100644
--- a/include/drivers/arm/gic_common.h
+++ b/include/drivers/arm/gic_v2v3_common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -7,6 +7,8 @@
#ifndef __GIC_COMMON_H__
#define __GIC_COMMON_H__
+#include <stdbool.h>
+
/***************************************************************************
* Defines and prototypes common to GIC v2 and v3 drivers.
**************************************************************************/
@@ -49,7 +51,7 @@
#include <mmio.h>
/* Helper to detect the GIC mode (GICv2 or GICv3) configured in the system */
-unsigned int is_gicv3_mode(void);
+bool is_gicv3_mode(void);
/*******************************************************************************
* Private GIC Distributor function prototypes for use by GIC drivers
diff --git a/include/lib/aarch32/arch.h b/include/lib/aarch32/arch.h
index cfbce56..255a9eb 100644
--- a/include/lib/aarch32/arch.h
+++ b/include/lib/aarch32/arch.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2023, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2025, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -142,7 +142,7 @@
#define ID_PFR1_GENTIMER_SHIFT U(16)
#define ID_PFR1_GENTIMER_MASK U(0xf)
#define ID_PFR1_GIC_SHIFT U(28)
-#define ID_PFR1_GIC_MASK U(0xf)
+#define ID_PFR1_GIC_WIDTH U(4)
/* SCTLR definitions */
#define SCTLR_RES1_DEF ((U(1) << 23) | (U(1) << 22) | (U(1) << 4) | \
diff --git a/include/lib/aarch32/arch_features.h b/include/lib/aarch32/arch_features.h
index 999f7ec..44a6845 100644
--- a/include/lib/aarch32/arch_features.h
+++ b/include/lib/aarch32/arch_features.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -66,4 +66,9 @@
ID_PFR0_AMU_MASK;
}
+static inline bool is_feat_gic_supported(void)
+{
+ return EXTRACT(ID_PFR1_GIC, read_id_pfr1()) >= 1;
+}
+
#endif /* ARCH_FEATURES_H */
diff --git a/include/lib/aarch64/arch.h b/include/lib/aarch64/arch.h
index 94837ea..e408afa 100644
--- a/include/lib/aarch64/arch.h
+++ b/include/lib/aarch64/arch.h
@@ -180,7 +180,6 @@
#define ID_AA64PFR0_ADVSIMD_MASK U(0xf)
#define ID_AA64PFR0_GIC_SHIFT U(24)
#define ID_AA64PFR0_GIC_WIDTH U(4)
-#define ID_AA64PFR0_GIC_MASK ULL(0xf)
#define ID_AA64PFR0_GIC_NOT_SUPPORTED ULL(0x0)
#define ID_AA64PFR0_GICV3_GICV4_SUPPORTED ULL(0x1)
#define ID_AA64PFR0_GICV4_1_SUPPORTED ULL(0x2)
@@ -825,6 +824,14 @@
#define CPTR_EL2_RESET_VAL CPTR_EL2_RES1
/* CPSR/SPSR definitions */
+#define SPSR_M3_0_SHIFT U(0)
+#define SPSR_M3_0_MASK U(0xf)
+#define SPSR_M3_0_EL0 U(0)
+#define SPSR_M3_0_EL1_SP_EL0 U(4)
+#define SPSR_M3_0_EL1_SP_EL1 U(5)
+#define SPSR_M3_0_EL2_SP_EL0 U(8)
+#define SPSR_M3_0_EL2_SP_EL2 U(9)
+
#define DAIF_FIQ_BIT (U(1) << 0)
#define DAIF_IRQ_BIT (U(1) << 1)
#define DAIF_ABT_BIT (U(1) << 2)
@@ -1769,69 +1776,73 @@
* Definitions of system register identifiers
*****************************************************************************/
-#define ESR_EL2_SYSREG_TRAP_OP0_SHIFT 20
-#define ESR_EL2_SYSREG_TRAP_OP0_WIDTH U(2)
+#define SYSREG_ID_OP2_SHIFT 0
+#define SYSREG_ID_OP2_WIDTH U(3)
-#define ESR_EL2_SYSREG_TRAP_OP2_SHIFT 17
-#define ESR_EL2_SYSREG_TRAP_OP2_WIDTH U(3)
+#define SYSREG_ID_CRM_SHIFT 3
+#define SYSREG_ID_CRM_WIDTH U(4)
-#define ESR_EL2_SYSREG_TRAP_OP1_SHIFT 14
-#define ESR_EL2_SYSREG_TRAP_OP1_WIDTH U(3)
+#define SYSREG_ID_CRN_SHIFT 7
+#define SYSREG_ID_CRN_WIDTH U(4)
-#define ESR_EL2_SYSREG_TRAP_CRN_SHIFT 10
-#define ESR_EL2_SYSREG_TRAP_CRN_WIDTH U(4)
+#define SYSREG_ID_OP1_SHIFT 11
+#define SYSREG_ID_OP1_WIDTH U(3)
-#define ESR_EL2_SYSREG_TRAP_CRM_SHIFT 1
-#define ESR_EL2_SYSREG_TRAP_CRM_WIDTH U(4)
+#define SYSREG_ID_OP0_SHIFT 14
+#define SYSREG_ID_OP0_WIDTH U(2)
-#define SYSREG_ESR(op0, op1, crn, crm, op2) \
- ((UL(op0) << ESR_EL2_SYSREG_TRAP_OP0_SHIFT) | \
- (UL(op1) << ESR_EL2_SYSREG_TRAP_OP1_SHIFT) | \
- (UL(crn) << ESR_EL2_SYSREG_TRAP_CRN_SHIFT) | \
- (UL(crm) << ESR_EL2_SYSREG_TRAP_CRM_SHIFT) | \
- (UL(op2) << ESR_EL2_SYSREG_TRAP_OP2_SHIFT))
+#define SYSREG_ID_D128_SHIFT 16
+#define SYSREG_ID_D128_WIDTH U(1)
-#define SYSREG_ID_sp_el0 SYSREG_ESR(3, 0, 4, 1, 0)
-#define SYSREG_ID_sp_el1 SYSREG_ESR(3, 4, 4, 1, 0)
-#define SYSREG_ID_elr_el1 SYSREG_ESR(3, 0, 4, 0, 1)
-#define SYSREG_ID_spsr_el1 SYSREG_ESR(3, 0, 4, 0, 0)
-#define SYSREG_ID_pmcr_el0 SYSREG_ESR(3, 3, 9, 12, 0)
-#define SYSREG_ID_tpidrro_el0 SYSREG_ESR(3, 3, 13, 0, 3)
-#define SYSREG_ID_tpidr_el0 SYSREG_ESR(3, 3, 13, 0, 2)
-#define SYSREG_ID_csselr_el1 SYSREG_ESR(3, 2, 0, 0, 0)
-#define SYSREG_ID_sctlr_el1 SYSREG_ESR(3, 0, 1, 0, 0)
-#define SYSREG_ID_actlr_el1 SYSREG_ESR(3, 0, 1, 0, 1)
-#define SYSREG_ID_cpacr_el1 SYSREG_ESR(3, 0, 1, 0, 2)
-#define SYSREG_ID_zcr_el1 SYSREG_ESR(3, 0, 1, 2, 0)
-#define SYSREG_ID_ttbr0_el1 SYSREG_ESR(3, 0, 2, 0, 0)
-#define SYSREG_ID_ttbr1_el1 SYSREG_ESR(3, 0, 2, 0, 1)
-#define SYSREG_ID_tcr_el1 SYSREG_ESR(3, 0, 2, 0, 2)
-#define SYSREG_ID_esr_el1 SYSREG_ESR(3, 0, 5, 2, 0)
-#define SYSREG_ID_afsr0_el1 SYSREG_ESR(3, 0, 5, 1, 0)
-#define SYSREG_ID_afsr1_el1 SYSREG_ESR(3, 0, 5, 1, 1)
-#define SYSREG_ID_far_el1 SYSREG_ESR(3, 0, 6, 0, 0)
-#define SYSREG_ID_mair_el1 SYSREG_ESR(3, 0, 10, 2, 0)
-#define SYSREG_ID_vbar_el1 SYSREG_ESR(3, 0, 12, 0, 0)
-#define SYSREG_ID_contextidr_el1 SYSREG_ESR(3, 0, 13, 0, 1)
-#define SYSREG_ID_tpidr_el1 SYSREG_ESR(3, 0, 13, 0, 4)
-#define SYSREG_ID_amair_el1 SYSREG_ESR(3, 0, 10, 3, 0)
-#define SYSREG_ID_cntkctl_el1 SYSREG_ESR(3, 0, 14, 1, 0)
-#define SYSREG_ID_par_el1 SYSREG_ESR(3, 0, 7, 4, 0)
-#define SYSREG_ID_mdscr_el1 SYSREG_ESR(2, 0, 0, 2, 2)
-#define SYSREG_ID_mdccint_el1 SYSREG_ESR(2, 0, 0, 2, 0)
-#define SYSREG_ID_disr_el1 SYSREG_ESR(3, 0, 12, 1, 1)
-#define SYSREG_ID_mpam0_el1 SYSREG_ESR(3, 0, 10, 5, 1)
-#define SYSREG_ID_apiakeylo_el1 SYSREG_ESR(3, 0, 2, 1, 0)
-#define SYSREG_ID_apiakeyhi_el1 SYSREG_ESR(3, 0, 2, 1, 1)
-#define SYSREG_ID_apibkeylo_el1 SYSREG_ESR(3, 0, 2, 1, 2)
-#define SYSREG_ID_apibkeyhi_el1 SYSREG_ESR(3, 0, 2, 1, 3)
-#define SYSREG_ID_apdakeylo_el1 SYSREG_ESR(3, 0, 2, 2, 0)
-#define SYSREG_ID_apdakeyhi_el1 SYSREG_ESR(3, 0, 2, 2, 1)
-#define SYSREG_ID_apdbkeylo_el1 SYSREG_ESR(3, 0, 2, 2, 2)
-#define SYSREG_ID_apdbkeyhi_el1 SYSREG_ESR(3, 0, 2, 2, 3)
-#define SYSREG_ID_apgakeylo_el1 SYSREG_ESR(3, 0, 2, 3, 0)
-#define SYSREG_ID_apgakeyhi_el1 SYSREG_ESR(3, 0, 2, 3, 1)
-#define SYSREG_ID_mpamidr_el1 SYSREG_ESR(3, 0, 10, 4, 4)
+#define SYSREG_ID(d128, op0, op1, crn, crm, op2) \
+ ((UL(op0) << SYSREG_ID_OP0_SHIFT) | \
+ (UL(op1) << SYSREG_ID_OP1_SHIFT) | \
+ (UL(crn) << SYSREG_ID_CRN_SHIFT) | \
+ (UL(crm) << SYSREG_ID_CRM_SHIFT) | \
+ (UL(op2) << SYSREG_ID_OP2_SHIFT) | \
+ (UL(d128) << SYSREG_ID_D128_SHIFT))
+
+#define SYSREG_ID_sp_el0 SYSREG_ID(0, 3, 0, 4, 1, 0)
+#define SYSREG_ID_sp_el1 SYSREG_ID(0, 3, 4, 4, 1, 0)
+#define SYSREG_ID_elr_el1 SYSREG_ID(0, 3, 0, 4, 0, 1)
+#define SYSREG_ID_spsr_el1 SYSREG_ID(0, 3, 0, 4, 0, 0)
+#define SYSREG_ID_pmcr_el0 SYSREG_ID(0, 3, 3, 9, 12, 0)
+#define SYSREG_ID_tpidrro_el0 SYSREG_ID(0, 3, 3, 13, 0, 3)
+#define SYSREG_ID_tpidr_el0 SYSREG_ID(0, 3, 3, 13, 0, 2)
+#define SYSREG_ID_csselr_el1 SYSREG_ID(0, 3, 2, 0, 0, 0)
+#define SYSREG_ID_sctlr_el1 SYSREG_ID(0, 3, 0, 1, 0, 0)
+#define SYSREG_ID_actlr_el1 SYSREG_ID(0, 3, 0, 1, 0, 1)
+#define SYSREG_ID_cpacr_el1 SYSREG_ID(0, 3, 0, 1, 0, 2)
+#define SYSREG_ID_zcr_el1 SYSREG_ID(0, 3, 0, 1, 2, 0)
+#define SYSREG_ID_ttbr0_el1 SYSREG_ID(1, 3, 0, 2, 0, 0)
+#define SYSREG_ID_ttbr1_el1 SYSREG_ID(1, 3, 0, 2, 0, 1)
+#define SYSREG_ID_tcr_el1 SYSREG_ID(0, 3, 0, 2, 0, 2)
+#define SYSREG_ID_esr_el1 SYSREG_ID(0, 3, 0, 5, 2, 0)
+#define SYSREG_ID_afsr0_el1 SYSREG_ID(0, 3, 0, 5, 1, 0)
+#define SYSREG_ID_afsr1_el1 SYSREG_ID(0, 3, 0, 5, 1, 1)
+#define SYSREG_ID_far_el1 SYSREG_ID(0, 3, 0, 6, 0, 0)
+#define SYSREG_ID_mair_el1 SYSREG_ID(0, 3, 0, 10, 2, 0)
+#define SYSREG_ID_vbar_el1 SYSREG_ID(0, 3, 0, 12, 0, 0)
+#define SYSREG_ID_contextidr_el1 SYSREG_ID(0, 3, 0, 13, 0, 1)
+#define SYSREG_ID_tpidr_el1 SYSREG_ID(0, 3, 0, 13, 0, 4)
+#define SYSREG_ID_amair_el1 SYSREG_ID(0, 3, 0, 10, 3, 0)
+#define SYSREG_ID_cntkctl_el1 SYSREG_ID(0, 3, 0, 14, 1, 0)
+#define SYSREG_ID_par_el1 SYSREG_ID(1, 3, 0, 7, 4, 0)
+#define SYSREG_ID_mdscr_el1 SYSREG_ID(0, 2, 0, 0, 2, 2)
+#define SYSREG_ID_mdccint_el1 SYSREG_ID(0, 2, 0, 0, 2, 0)
+#define SYSREG_ID_disr_el1 SYSREG_ID(0, 3, 0, 12, 1, 1)
+#define SYSREG_ID_mpam0_el1 SYSREG_ID(0, 3, 0, 10, 5, 1)
+#define SYSREG_ID_apiakeylo_el1 SYSREG_ID(0, 3, 0, 2, 1, 0)
+#define SYSREG_ID_apiakeyhi_el1 SYSREG_ID(0, 3, 0, 2, 1, 1)
+#define SYSREG_ID_apibkeylo_el1 SYSREG_ID(0, 3, 0, 2, 1, 2)
+#define SYSREG_ID_apibkeyhi_el1 SYSREG_ID(0, 3, 0, 2, 1, 3)
+#define SYSREG_ID_apdakeylo_el1 SYSREG_ID(0, 3, 0, 2, 2, 0)
+#define SYSREG_ID_apdakeyhi_el1 SYSREG_ID(0, 3, 0, 2, 2, 1)
+#define SYSREG_ID_apdbkeylo_el1 SYSREG_ID(0, 3, 0, 2, 2, 2)
+#define SYSREG_ID_apdbkeyhi_el1 SYSREG_ID(0, 3, 0, 2, 2, 3)
+#define SYSREG_ID_apgakeylo_el1 SYSREG_ID(0, 3, 0, 2, 3, 0)
+#define SYSREG_ID_apgakeyhi_el1 SYSREG_ID(0, 3, 0, 2, 3, 1)
+#define SYSREG_ID_mpamidr_el1 SYSREG_ID(0, 3, 0, 10, 4, 4)
/* RNDR definition */
#define RNDR S3_3_C2_C4_0
diff --git a/include/lib/aarch64/arch_features.h b/include/lib/aarch64/arch_features.h
index cb3936c..dfc9850 100644
--- a/include/lib/aarch64/arch_features.h
+++ b/include/lib/aarch64/arch_features.h
@@ -595,4 +595,10 @@
return EXTRACT(ID_AA64MMFR3_EL1_MEC, read_id_aa64mmfr3_el1())
== ID_AA64MMFR3_EL1_MEC_SUPPORTED;
}
+
+static inline bool is_feat_gic_supported(void)
+{
+ return EXTRACT(ID_AA64PFR0_GIC, read_id_aa64pfr0_el1())
+ >= ID_AA64PFR0_GICV3_GICV4_SUPPORTED;
+}
#endif /* ARCH_FEATURES_H */
diff --git a/include/lib/event_log/event_handoff.h b/include/lib/event_log/event_handoff.h
deleted file mode 100644
index f8c8716..0000000
--- a/include/lib/event_log/event_handoff.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2025, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-
-#ifndef HANDOFF_H
-#define HANDOFF_H
-
-#include <stdint.h>
-
-#include <transfer_list.h>
-
-/**
- * Initializes or extends the TPM event log in the transfer list.
- *
- * If an event log entry exists, attempts to resize it. Otherwise, adds a new entry.
- * Copies old data if needed. Updates free to reflect available space.
- *
- * @param tl Pointer to the transfer list header.
- * @param req_size Requested size (bytes)
- * @param free Available size (bytes)
- * @return Pointer to writable space in the log, or NULL on failure.
- */
-uint8_t *transfer_list_event_log_extend(struct transfer_list_header *tl,
- size_t req_size, size_t *free);
-
-/**
- * Finalizes the event log after writing is complete.
- *
- * Resizes the event log to match actual data written, updates checksum,
- * and flushes cache for the next stage.
- *
- * @param tl Pointer to the transfer list header.
- * @param cursor End offset of written log data.
- * @return Pointer to finalized log data (past reserved bytes), or NULL.
- */
-uint8_t *transfer_list_event_log_finish(struct transfer_list_header *tl,
- uintptr_t cursor);
-
-#define EVENT_LOG_RESERVED_BYTES U(4)
-
-#endif /* HANDOFF_H */
diff --git a/include/lib/event_log/event_log.h b/include/lib/event_log/event_log.h
deleted file mode 100644
index 964f80a..0000000
--- a/include/lib/event_log/event_log.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 2020-2025, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef EVENT_LOG_H
-#define EVENT_LOG_H
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <lib/utils_def.h>
-#include <drivers/auth/crypto_mod.h>
-#include "event_handoff.h"
-#include "tcg.h"
-
-/*
- * Set Event Log debug level to one of:
- *
- * LOG_LEVEL_ERROR
- * LOG_LEVEL_INFO
- * LOG_LEVEL_WARNING
- * LOG_LEVEL_VERBOSE
- */
-#if EVENT_LOG_LEVEL == LOG_LEVEL_ERROR
-#define LOG_EVENT ERROR
-#elif EVENT_LOG_LEVEL == LOG_LEVEL_NOTICE
-#define LOG_EVENT NOTICE
-#elif EVENT_LOG_LEVEL == LOG_LEVEL_WARNING
-#define LOG_EVENT WARN
-#elif EVENT_LOG_LEVEL == LOG_LEVEL_INFO
-#define LOG_EVENT INFO
-#elif EVENT_LOG_LEVEL == LOG_LEVEL_VERBOSE
-#define LOG_EVENT VERBOSE
-#else
-#define LOG_EVENT printf
-#endif
-
-/* Number of hashing algorithms supported */
-#define HASH_ALG_COUNT 1U
-
-#define EVLOG_INVALID_ID UINT32_MAX
-
-#define MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
-
-typedef struct {
- unsigned int id;
- const char *name;
- unsigned int pcr;
-} event_log_metadata_t;
-
-#define ID_EVENT_SIZE (sizeof(id_event_headers_t) + \
- (sizeof(id_event_algorithm_size_t) * HASH_ALG_COUNT) + \
- sizeof(id_event_struct_data_t))
-
-#define LOC_EVENT_SIZE (sizeof(event2_header_t) + \
- sizeof(tpmt_ha) + TCG_DIGEST_SIZE + \
- sizeof(event2_data_t) + \
- sizeof(startup_locality_event_t))
-
-#define LOG_MIN_SIZE (ID_EVENT_SIZE + LOC_EVENT_SIZE)
-
-#define EVENT2_HDR_SIZE (sizeof(event2_header_t) + \
- sizeof(tpmt_ha) + TCG_DIGEST_SIZE + \
- sizeof(event2_data_t))
-
-/* Functions' declarations */
-
-/**
- * Initialize the Event Log buffer.
- *
- * Sets global pointers to manage the Event Log memory region,
- * allowing subsequent log operations to write into the buffer.
- *
- * @param[in] event_log_start Pointer to the start of the Event Log buffer.
- * @param[in] event_log_finish Pointer to the end of the buffer
- * (i.e., one byte past the last valid address).
- *
- * @return 0 on success, or -EINVAL if the input range is invalid.
- */
-int event_log_buf_init(uint8_t *event_log_start, uint8_t *event_log_finish);
-
-/**
- * Dump the contents of the Event Log.
- *
- * Outputs the raw contents of the Event Log buffer, typically
- * for debugging or audit purposes.
- *
- * @param[in] log_addr Pointer to the start of the Event Log buffer.
- * @param[in] log_size Size of the Event Log buffer in bytes.
- *
- * @return 0 on success, or a negative error code on failure.
- */
-int event_log_dump(uint8_t *log_addr, size_t log_size);
-
-/**
- * Initialize the Event Log subsystem.
- *
- * Wrapper around `event_log_buf_init()` to configure the memory range
- * for the Event Log buffer.
- *
- * @param[in] event_log_start Pointer to the start of the Event Log buffer.
- * @param[in] event_log_finish Pointer to the end of the buffer
- * (i.e., one byte past the last valid address).
- *
- * @return 0 on success, or a negative error code on failure.
- */
-int event_log_init(uint8_t *event_log_start, uint8_t *event_log_finish);
-
-/**
- * Measure input data and log its hash to the Event Log.
- *
- * Computes the cryptographic hash of the specified data and records it
- * in the Event Log as a TCG_PCR_EVENT2 structure using event type EV_POST_CODE.
- * Useful for firmware or image attestation.
- *
- * @param[in] data_base Pointer to the base of the data to be measured.
- * @param[in] data_size Size of the data in bytes.
- * @param[in] data_id Identifier used to match against metadata.
- * @param[in] metadata_ptr Pointer to an array of event_log_metadata_t.
- *
- * @return 0 on success, or a negative error code on failure.
- */
-int event_log_measure_and_record(uintptr_t data_base, uint32_t data_size,
- uint32_t data_id,
- const event_log_metadata_t *metadata_ptr);
-
-/**
- * Measure the input data and return its hash.
- *
- * Computes the cryptographic hash of the specified memory region using
- * the default hashing algorithm configured in the Event Log subsystem.
- *
- * @param[in] data_base Pointer to the base of the data to be measured.
- * @param[in] data_size Size of the data in bytes.
- * @param[out] hash_data Buffer to hold the resulting hash output
- * (must be at least CRYPTO_MD_MAX_SIZE bytes).
- *
- * @return 0 on success, or an error code on failure.
- */
-int event_log_measure(uintptr_t data_base, uint32_t data_size,
- unsigned char hash_data[CRYPTO_MD_MAX_SIZE]);
-
-/**
- * Record a measurement event in the Event Log.
- *
- * Writes a TCG_PCR_EVENT2 structure to the Event Log using the
- * provided hash and metadata. This function assumes the buffer
- * has enough space and that `event_log_buf_init()` has been called.
- *
- * @param[in] hash Pointer to the digest (TCG_DIGEST_SIZE bytes).
- * @param[in] event_type Type of the event, as defined in tcg.h.
- * @param[in] metadata_ptr Pointer to an event_log_metadata_t structure
- * providing event-specific context (e.g., PCR index, name).
- *
- * @return 0 on success, or -ENOMEM if the buffer has insufficient space.
- */
-int event_log_record(const uint8_t *hash, uint32_t event_type,
- const event_log_metadata_t *metadata_ptr);
-
-/**
- * Initialize the Event Log with mandatory header events.
- *
- * Writes the Specification ID (SpecID) and Startup Locality events
- * as required by the TCG PC Client Platform Firmware Profile.
- * These must be the first entries in the Event Log.
- *
- * @return 0 on success, or a negative error code on failure.
- */
-int event_log_write_header(void);
-
-/**
- * Write the SpecID event to the Event Log.
- *
- * Records the TCG_EfiSpecIDEventStruct to declare the structure
- * and supported algorithms of the Event Log format.
- *
- * @return 0 on success, or a negative error code on failure.
- */
-int event_log_write_specid_event(void);
-
-/**
- * Get the current size of the Event Log.
- *
- * Calculates how many bytes of the Event Log buffer have been used,
- * based on the current log pointer and the start of the buffer.
- *
- * @param[in] event_log_start Pointer to the start of the Event Log buffer.
- *
- * @return The number of bytes currently used in the Event Log.
- */
-size_t event_log_get_cur_size(uint8_t *event_log_start);
-
-#endif /* EVENT_LOG_H */
diff --git a/include/lib/event_log/tcg.h b/include/lib/event_log/tcg.h
deleted file mode 100644
index 653f9c2..0000000
--- a/include/lib/event_log/tcg.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright (c) 2020-2022, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef TCG_H
-#define TCG_H
-
-#include <stdint.h>
-#include <common/sha_common_macros.h>
-
-#define TCG_ID_EVENT_SIGNATURE_03 "Spec ID Event03"
-#define TCG_STARTUP_LOCALITY_SIGNATURE "StartupLocality"
-
-#define TCG_SPEC_VERSION_MAJOR_TPM2 2
-#define TCG_SPEC_VERSION_MINOR_TPM2 0
-#define TCG_SPEC_ERRATA_TPM2 2
-
-/*
- * Event types
- * Ref. Table 9 Events
- * TCG PC Client Platform Firmware Profile Specification.
- */
-#define EV_PREBOOT_CERT U(0x00000000)
-#define EV_POST_CODE U(0x00000001)
-#define EV_UNUSED U(0x00000002)
-#define EV_NO_ACTION U(0x00000003)
-#define EV_SEPARATOR U(0x00000004)
-#define EV_ACTION U(0x00000005)
-#define EV_EVENT_TAG U(0x00000006)
-#define EV_S_CRTM_CONTENTS U(0x00000007)
-#define EV_S_CRTM_VERSION U(0x00000008)
-#define EV_CPU_MICROCODE U(0x00000009)
-#define EV_PLATFORM_CONFIG_FLAGS U(0x0000000A)
-#define EV_TABLE_OF_DEVICES U(0x0000000B)
-#define EV_COMPACT_HASH U(0x0000000C)
-#define EV_IPL U(0x0000000D)
-#define EV_IPL_PARTITION_DATA U(0x0000000E)
-#define EV_NONHOST_CODE U(0x0000000F)
-#define EV_NONHOST_CONFIG U(0x00000010)
-#define EV_NONHOST_INFO U(0x00000011)
-#define EV_OMIT_BOOT_DEVICE_EVENTS U(0x00000012)
-#define EV_EFI_EVENT_BASE U(0x80000000)
-#define EV_EFI_VARIABLE_DRIVER_CONFIG U(0x80000001)
-#define EV_EFI_VARIABLE_BOOT U(0x80000002)
-#define EV_EFI_BOOT_SERVICES_APPLICATION U(0x80000003)
-#define EV_EFI_BOOT_SERVICES_DRIVER U(0x80000004)
-#define EV_EFI_RUNTIME_SERVICES_DRIVER U(0x80000005)
-#define EV_EFI_GPT_EVENT U(0x80000006)
-#define EV_EFI_ACTION U(0x80000007)
-#define EV_EFI_PLATFORM_FIRMWARE_BLOB U(0x80000008)
-#define EV_EFI_HANDOFF_TABLES U(0x80000009)
-#define EV_EFI_HCRTM_EVENT U(0x80000010)
-#define EV_EFI_VARIABLE_AUTHORITY U(0x800000E0)
-
-/*
- * TPM_ALG_ID constants.
- * Ref. Table 9 - Definition of (UINT16) TPM_ALG_ID Constants
- * Trusted Platform Module Library. Part 2: Structures
- */
-#define TPM_ALG_SHA256 0x000B
-#define TPM_ALG_SHA384 0x000C
-#define TPM_ALG_SHA512 0x000D
-
-/* TCG Platform Type */
-#define PLATFORM_CLASS_CLIENT 0
-#define PLATFORM_CLASS_SERVER 1
-
-enum {
- /*
- * SRTM, BIOS, Host Platform Extensions, Embedded
- * Option ROMs and PI Drivers
- */
- PCR_0 = 0,
- /* Host Platform Configuration */
- PCR_1,
- /* UEFI driver and application Code */
- PCR_2,
- /* UEFI driver and application Configuration and Data */
- PCR_3,
- /* UEFI Boot Manager Code (usually the MBR) and Boot Attempts */
- PCR_4,
- /*
- * Boot Manager Code Configuration and Data (for use
- * by the Boot Manager Code) and GPT/Partition Table
- */
- PCR_5,
- /* Host Platform Manufacturer Specific */
- PCR_6,
- /* Secure Boot Policy */
- PCR_7,
- /* 8-15: Defined for use by the Static OS */
- PCR_8,
- /* Debug */
- PCR_16 = 16,
-
- /* D-CRTM-measurements by DRTM implementation */
- PCR_17 = 17,
- /* DCE measurements by DRTM implementation */
- PCR_18 = 18
-};
-
-#pragma pack(push, 1)
-
-/*
- * PCR Event Header
- * TCG EFI Protocol Specification
- * 5.3 Event Log Header
- */
-typedef struct {
- /* PCRIndex:
- * The PCR Index to which this event is extended
- */
- uint32_t pcr_index;
-
- /* EventType:
- * SHALL be an EV_NO_ACTION event
- */
- uint32_t event_type;
-
- /* SHALL be 20 Bytes of 0x00 */
- uint8_t digest[SHA1_DIGEST_SIZE];
-
- /* The size of the event */
- uint32_t event_size;
-
- /* SHALL be a TCG_EfiSpecIdEvent */
- uint8_t event[]; /* [event_data_size] */
-} tcg_pcr_event_t;
-
-/*
- * Log Header Entry Data
- * Ref. Table 14 TCG_EfiSpecIdEventAlgorithmSize
- * TCG PC Client Platform Firmware Profile 9.4.5.1
- */
-typedef struct {
- /* Algorithm ID (hashAlg) of the Hash used by BIOS */
- uint16_t algorithm_id;
-
- /* The size of the digest produced by the implemented Hash algorithm */
- uint16_t digest_size;
-} id_event_algorithm_size_t;
-
-/*
- * TCG_EfiSpecIdEvent structure
- * Ref. Table 15 TCG_EfiSpecIdEvent
- * TCG PC Client Platform Firmware Profile 9.4.5.1
- */
-typedef struct {
- /*
- * The NUL-terminated ASCII string "Spec ID Event03".
- * SHALL be set to {0x53, 0x70, 0x65, 0x63, 0x20, 0x49, 0x44,
- * 0x20, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x30, 0x33, 0x00}.
- */
- uint8_t signature[16];
-
- /*
- * The value for the Platform Class.
- * The enumeration is defined in the TCG ACPI Specification Client
- * Common Header.
- */
- uint32_t platform_class;
-
- /*
- * The PC Client Platform Profile Specification minor version number
- * this BIOS supports.
- * Any BIOS supporting this version (2.0) MUST set this value to 0x00.
- */
- uint8_t spec_version_minor;
-
- /*
- * The PC Client Platform Profile Specification major version number
- * this BIOS supports.
- * Any BIOS supporting this version (2.0) MUST set this value to 0x02.
- */
- uint8_t spec_version_major;
-
- /*
- * The PC Client Platform Profile Specification errata version number
- * this BIOS supports.
- * Any BIOS supporting this version (2.0) MUST set this value to 0x02.
- */
- uint8_t spec_errata;
-
- /*
- * Specifies the size of the UINTN fields used in various data
- * structures used in this specification.
- * 0x01 indicates UINT32 and 0x02 indicates UINT64.
- */
- uint8_t uintn_size;
-
- /*
- * The number of Hash algorithms in the digestSizes field.
- * This field MUST be set to a value of 0x01 or greater.
- */
- uint32_t number_of_algorithms;
-
- /*
- * Each TCG_EfiSpecIdEventAlgorithmSize SHALL contain an algorithmId
- * and digestSize for each hash algorithm used in the TCG_PCR_EVENT2
- * structure, the first of which is a Hash algorithmID and the second
- * is the size of the respective digest.
- */
- id_event_algorithm_size_t digest_size[]; /* number_of_algorithms */
-} id_event_struct_header_t;
-
-typedef struct {
- /*
- * Size in bytes of the VendorInfo field.
- * Maximum value MUST be FFh bytes.
- */
- uint8_t vendor_info_size;
-
- /*
- * Provided for use by Platform Firmware implementer. The value might
- * be used, for example, to provide more detailed information about the
- * specific BIOS such as BIOS revision numbers, etc. The values within
- * this field are not standardized and are implementer-specific.
- * Platform-specific or -unique information MUST NOT be provided in
- * this field.
- *
- */
- uint8_t vendor_info[]; /* [vendorInfoSize] */
-} id_event_struct_data_t;
-
-typedef struct {
- id_event_struct_header_t struct_header;
- id_event_struct_data_t struct_data;
-} id_event_struct_t;
-
-typedef struct {
- tcg_pcr_event_t header;
- id_event_struct_header_t struct_header;
-} id_event_headers_t;
-
-/* TPMT_HA Structure */
-typedef struct {
- /* Selector of the hash contained in the digest that implies
- * the size of the digest
- */
- uint16_t algorithm_id; /* AlgorithmId */
-
- /* Digest, depends on AlgorithmId */
- uint8_t digest[]; /* Digest[] */
-} tpmt_ha;
-
-/*
- * TPML_DIGEST_VALUES Structure
- */
-typedef struct {
- /* The number of digests in the list */
- uint32_t count; /* Count */
-
- /* The list of tagged digests, as sent to the TPM as part of a
- * TPM2_PCR_Extend or as received from a TPM2_PCR_Event command
- */
- tpmt_ha digests[]; /* Digests[Count] */
-} tpml_digest_values;
-
-/*
- * TCG_PCR_EVENT2 header
- */
-typedef struct {
- /* The PCR Index to which this event was extended */
- uint32_t pcr_index; /* PCRIndex */
-
- /* Type of event */
- uint32_t event_type; /* EventType */
-
- /* Digests:
- * A counted list of tagged digests, which contain the digest of
- * the event data (or external data) for all active PCR banks
- */
- tpml_digest_values digests; /* Digests */
-} event2_header_t;
-
-typedef struct event2_data {
- /* The size of the event data */
- uint32_t event_size; /* EventSize */
-
- /* The data of the event */
- uint8_t event[]; /* Event[EventSize] */
-} event2_data_t;
-
-/*
- * Startup Locality Event
- * Ref. TCG PC Client Platform Firmware Profile 9.4.5.3
- */
-typedef struct {
- /*
- * The NUL-terminated ASCII string "StartupLocality" SHALL be
- * set to {0x53 0x74 0x61 0x72 0x74 0x75 0x70 0x4C 0x6F 0x63
- * 0x61 0x6C 0x69 0x74 0x79 0x00}
- */
- uint8_t signature[16];
-
- /* The Locality Indicator which sent the TPM2_Startup command */
- uint8_t startup_locality;
-} startup_locality_event_t;
-
-#pragma pack(pop)
-
-#endif /* TCG_H */
diff --git a/include/lib/irq.h b/include/lib/irq.h
index 6a37e05..17993a8 100644
--- a/include/lib/irq.h
+++ b/include/lib/irq.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -59,6 +59,11 @@
int tftf_irq_handler_dispatcher(void);
/*
+ * Send an SGI to a given core.
+ */
+void tftf_send_sgi(unsigned int sgi_id, unsigned int core_pos);
+
+/*
* Enable interrupt #irq_num for the calling core.
*/
void tftf_irq_enable(unsigned int irq_num, uint8_t irq_priority);
diff --git a/include/lib/sgi.h b/include/lib/sgi.h
deleted file mode 100644
index d2f4b37..0000000
--- a/include/lib/sgi.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef __SGI_H__
-#define __SGI_H__
-
-/* Data associated with the reception of an SGI */
-typedef struct {
- /* Interrupt ID of the signaled interrupt */
- unsigned int irq_id;
-} sgi_data_t;
-
-/*
- * Send an SGI to a given core.
- */
-void tftf_send_sgi(unsigned int sgi_id, unsigned int core_pos);
-
-#endif /* __SGI_H__ */
diff --git a/include/lib/utils_def.h b/include/lib/utils_def.h
index 0128277..c9bd527 100644
--- a/include/lib/utils_def.h
+++ b/include/lib/utils_def.h
@@ -172,6 +172,15 @@
(((reg) & MASK(regfield)) >> (regfield##_SHIFT))
/*
+ * Generates an unsigned long long (64-bit) value where the bits @_msb
+ * through @_lsb (inclusive) are set to one and all other bits are zero. The
+ * parameters can hold values from 0 through 63 and if _msb == _lsb a single
+ * bit is set at that location.
+ */
+#define BIT_MASK_ULL(_msb, _lsb) \
+ ((~ULL(0) >> (63UL - (_msb))) & (~ULL(0) << (_lsb)))
+
+/*
* Defines member of structure and reserves space
* for the next member with specified offset.
*/
diff --git a/include/runtime_services/ffa_svc.h b/include/runtime_services/ffa_svc.h
index 4c82507..e3ac6b8 100644
--- a/include/runtime_services/ffa_svc.h
+++ b/include/runtime_services/ffa_svc.h
@@ -129,6 +129,9 @@
#define FFA_FNUM_PARTITION_INFO_GET_REGS U(0x8B)
#define FFA_FNUM_EL3_INTR_HANDLE U(0x8C)
+/* FF-A v1.3 ALP1 */
+#define FFA_FNUM_ABORT U(0x90)
+
/* FFA SMC32 FIDs */
#define FFA_ERROR FFA_FID(SMC_32, FFA_FNUM_ERROR)
#define FFA_SUCCESS_SMC32 FFA_FID(SMC_32, FFA_FNUM_SUCCESS)
@@ -176,6 +179,7 @@
#define FFA_NOTIFICATION_INFO_GET \
FFA_FID(SMC_32, FFA_FNUM_NOTIFICATION_INFO_GET)
#define FFA_SPM_ID_GET FFA_FID(SMC_32, FFA_FNUM_SPM_ID_GET)
+#define FFA_ABORT_32 FFA_FID(SMC_32, FFA_FNUM_ABORT)
/* Implementation defined SMC32 FIDs */
#define FFA_CONSOLE_LOG_SMC32 FFA_FID(SMC_32, FFA_FNUM_CONSOLE_LOG)
@@ -200,6 +204,7 @@
#define FFA_FEATURES_MEM_RETRIEVE_REQ_NS_SUPPORT (UINT32_C(1) << 1)
#define FFA_PARTITION_INFO_GET_REGS_SMC64 \
FFA_FID(SMC_64, FFA_FNUM_PARTITION_INFO_GET_REGS)
+#define FFA_ABORT_64 FFA_FID(SMC_64, FFA_FNUM_ABORT)
/* Implementation defined SMC64 FIDs */
#define FFA_CONSOLE_LOG_SMC64 FFA_FID(SMC_64, FFA_FNUM_CONSOLE_LOG)
diff --git a/include/runtime_services/host_realm_managment/realm_def.h b/include/runtime_services/host_realm_managment/realm_def.h
index 6fca05c..5f662e2 100644
--- a/include/runtime_services/host_realm_managment/realm_def.h
+++ b/include/runtime_services/host_realm_managment/realm_def.h
@@ -29,11 +29,33 @@
#if (PAGE_SIZE == PAGE_SIZE_4KB)
#define PAGE_ALIGNMENT PAGE_SIZE_4KB
#define TCR_TG0 TCR_TG0_4K
+#define GRANULE_SHIFT U(12)
#else
#error "Undefined value for PAGE_SIZE"
#endif
/*
+ * TTE_STRIDE: The number of bits resolved in a single level of translation
+ * walk (except for the starting level which may resolve more or fewer bits)
+ */
+#define MAX_IPA_BITS U(48)
+#define TTE_STRIDE (GRANULE_SHIFT - 3U)
+
+/*
+ * TTE_STRIDE_LM1: The number of bits resolved al level -1 when FEAT_LPA2
+ * is enabled. This value is equal to
+ * MAX_IPA_BITS_LPA2 - ((4 * S2TTE_STRIDE) + GRANULE_SHIFT)
+ * as Level -1 only has 4 bits for the index (bits [51:48])
+ */
+#define MAX_IPA_BITS_LPA2 U(52)
+#define TTE_STRIDE_LM1 U(4)
+
+#define TT_PAGE_LEVEL U(3)
+#define tte_map_size(level) \
+ (1ULL << (unsigned int)(((TT_PAGE_LEVEL - (level)) * \
+ (int)TTE_STRIDE) + (int)GRANULE_SHIFT))
+
+/*
* 'MPIDR_EL1_AFF<n>_VAL_SHIFT' constants specify the left shift
* for affinity <n> value that gives the field's actual value.
*/
diff --git a/lib/event_log/event_handoff.c b/lib/event_log/event_handoff.c
deleted file mode 100644
index 238ea27..0000000
--- a/lib/event_log/event_handoff.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2025, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <stddef.h>
-
-#include <common/debug.h>
-#include <drivers/measured_boot/event_log/event_handoff.h>
-
-#include <platform_def.h>
-
-static uint8_t *get_log_ptr(struct transfer_list_entry *te, size_t offset)
-{
- uint8_t *base_ptr = transfer_list_entry_data(te);
-
- if (base_ptr == NULL) {
- return NULL;
- }
-
- return base_ptr + offset;
-}
-
-uint8_t *transfer_list_event_log_extend(struct transfer_list_header *tl,
- size_t req_size, size_t *free)
-{
- struct transfer_list_entry *existing_entry;
- struct transfer_list_entry *new_entry;
- uint8_t *old_data;
- size_t existing_offset;
- size_t old_size;
-
- if (tl == NULL || free == NULL || req_size == 0) {
- ERROR("Invalid arguments to event log extend.\n");
- return NULL;
- }
-
- existing_entry = transfer_list_find(tl, TL_TAG_TPM_EVLOG);
- existing_offset = EVENT_LOG_RESERVED_BYTES;
-
- if (existing_entry != NULL) {
- existing_offset = existing_entry->data_size;
-
- if (transfer_list_set_data_size(tl, existing_entry,
- req_size + existing_offset)) {
- VERBOSE("TPM event log entry resized: new space %zu bytes at offset %zu\n",
- req_size, existing_offset);
-
- *free = existing_entry->data_size - existing_offset;
-
- return get_log_ptr(existing_entry, existing_offset);
- }
- }
-
- /* Add new entry (resize failed or no existing entry) */
- new_entry = transfer_list_add(tl, TL_TAG_TPM_EVLOG,
- req_size + existing_offset, NULL);
-
- if (new_entry == NULL) {
- ERROR("Failed to add TPM event log entry to transfer list.\n");
- return NULL;
- }
-
- VERBOSE("New TPM event log entry added at %p\n",
- transfer_list_entry_data(new_entry));
-
- if (existing_entry != NULL) {
- old_data = transfer_list_entry_data(existing_entry);
- old_size = existing_offset;
-
- VERBOSE("Copying existing event log (%zu bytes) to new entry at %p\n",
- old_size, transfer_list_entry_data(new_entry));
-
- memmove(transfer_list_entry_data(new_entry), old_data,
- old_size);
-
- transfer_list_rem(tl, existing_entry);
- }
-
- *free = new_entry->data_size - existing_offset;
-
- return get_log_ptr(new_entry, existing_offset);
-}
-
-uint8_t *transfer_list_event_log_finish(struct transfer_list_header *tl,
- uintptr_t cursor)
-{
- uintptr_t entry_data_base;
- size_t final_log_size;
- struct transfer_list_entry *entry;
-
- entry = transfer_list_find(tl, TL_TAG_TPM_EVLOG);
- entry_data_base = (uintptr_t)transfer_list_entry_data(entry);
-
- if (cursor < entry_data_base ||
- cursor >= entry_data_base + entry->data_size) {
- ERROR("Invalid cursor: outside event log bounds.\n");
- return NULL;
- }
-
- final_log_size = cursor - entry_data_base;
-
- if (!transfer_list_set_data_size(tl, entry, final_log_size)) {
- ERROR("Unable to resize event log TE.\n");
- return NULL;
- }
-
- transfer_list_update_checksum(tl);
-
- VERBOSE("TPM event log finalized: trimmed to %zu bytes",
- final_log_size - EVENT_LOG_RESERVED_BYTES);
-
- /* Ensure changes are visible to the next stage. */
- flush_dcache_range((uintptr_t)tl, tl->size);
-
- return get_log_ptr(entry, EVENT_LOG_RESERVED_BYTES);
-}
diff --git a/lib/event_log/event_log.c b/lib/event_log/event_log.c
deleted file mode 100644
index 761ff29..0000000
--- a/lib/event_log/event_log.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Copyright (c) 2020-2025, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-
-#include "crypto_mod.h"
-#include "event_log.h"
-
-#if TPM_ALG_ID == TPM_ALG_SHA512
-#define CRYPTO_MD_ID CRYPTO_MD_SHA512
-#elif TPM_ALG_ID == TPM_ALG_SHA384
-#define CRYPTO_MD_ID CRYPTO_MD_SHA384
-#elif TPM_ALG_ID == TPM_ALG_SHA256
-#define CRYPTO_MD_ID CRYPTO_MD_SHA256
-#else
-# error Invalid TPM algorithm.
-#endif /* TPM_ALG_ID */
-
-/* Running Event Log Pointer */
-static uint8_t *log_ptr;
-
-/* Pointer to the first byte past end of the Event Log buffer */
-static uintptr_t log_end;
-
-/* TCG_EfiSpecIdEvent */
-static const id_event_headers_t id_event_header = {
- .header = {
- .pcr_index = PCR_0,
- .event_type = EV_NO_ACTION,
- .digest = {0},
- .event_size = (uint32_t)(sizeof(id_event_struct_t) +
- (sizeof(id_event_algorithm_size_t) *
- HASH_ALG_COUNT))
- },
-
- .struct_header = {
- .signature = TCG_ID_EVENT_SIGNATURE_03,
- .platform_class = PLATFORM_CLASS_CLIENT,
- .spec_version_minor = TCG_SPEC_VERSION_MINOR_TPM2,
- .spec_version_major = TCG_SPEC_VERSION_MAJOR_TPM2,
- .spec_errata = TCG_SPEC_ERRATA_TPM2,
- .uintn_size = (uint8_t)(sizeof(unsigned int) /
- sizeof(uint32_t)),
- .number_of_algorithms = HASH_ALG_COUNT
- }
-};
-
-static const event2_header_t locality_event_header = {
- /*
- * All EV_NO_ACTION events SHALL set
- * TCG_PCR_EVENT2.pcrIndex = 0, unless otherwise specified
- */
- .pcr_index = PCR_0,
-
- /*
- * All EV_NO_ACTION events SHALL set
- * TCG_PCR_EVENT2.eventType = 03h
- */
- .event_type = EV_NO_ACTION,
-
- /*
- * All EV_NO_ACTION events SHALL set TCG_PCR_EVENT2.digests to all
- * 0x00's for each allocated Hash algorithm
- */
- .digests = {
- .count = HASH_ALG_COUNT
- }
-};
-
-int event_log_record(const uint8_t *hash, uint32_t event_type,
- const event_log_metadata_t *metadata_ptr)
-{
- void *ptr = log_ptr;
- uint32_t name_len = 0U;
-
- /* event_log_buf_init() must have been called prior to this. */
- if (hash == NULL || metadata_ptr == NULL || log_ptr == NULL) {
- return -EINVAL;
- }
-
- if (metadata_ptr->name != NULL) {
- name_len = (uint32_t)strlen(metadata_ptr->name) + 1U;
- }
-
- /* Check for space in Event Log buffer */
- if (((uintptr_t)ptr + (uint32_t)EVENT2_HDR_SIZE + name_len) > log_end) {
- return -ENOMEM;
- }
-
- /*
- * As per TCG specifications, firmware components that are measured
- * into PCR[0] must be logged in the event log using the event type
- * EV_POST_CODE.
- */
- /* TCG_PCR_EVENT2.PCRIndex */
- ((event2_header_t *)ptr)->pcr_index = metadata_ptr->pcr;
-
- /* TCG_PCR_EVENT2.EventType */
- ((event2_header_t *)ptr)->event_type = event_type;
-
- /* TCG_PCR_EVENT2.Digests.Count */
- ptr = (uint8_t *)ptr + offsetof(event2_header_t, digests);
- ((tpml_digest_values *)ptr)->count = HASH_ALG_COUNT;
-
- /* TCG_PCR_EVENT2.Digests[] */
- ptr = (uint8_t *)((uintptr_t)ptr +
- offsetof(tpml_digest_values, digests));
-
- /* TCG_PCR_EVENT2.Digests[].AlgorithmId */
- ((tpmt_ha *)ptr)->algorithm_id = TPM_ALG_ID;
-
- /* TCG_PCR_EVENT2.Digests[].Digest[] */
- ptr = (uint8_t *)((uintptr_t)ptr + offsetof(tpmt_ha, digest));
-
- /* Copy digest */
- (void)memcpy(ptr, (const void *)hash, TCG_DIGEST_SIZE);
-
- /* TCG_PCR_EVENT2.EventSize */
- ptr = (uint8_t *)((uintptr_t)ptr + TCG_DIGEST_SIZE);
- ((event2_data_t *)ptr)->event_size = name_len;
-
- /* Copy event data to TCG_PCR_EVENT2.Event */
- if (metadata_ptr->name != NULL) {
- (void)memcpy((void *)(((event2_data_t *)ptr)->event),
- (const void *)metadata_ptr->name, name_len);
- }
-
- /* End of event data */
- log_ptr = (uint8_t *)((uintptr_t)ptr +
- offsetof(event2_data_t, event) + name_len);
-
- return 0;
-}
-
-int event_log_buf_init(uint8_t *event_log_start, uint8_t *event_log_finish)
-{
- if (event_log_start == NULL || event_log_finish == NULL ||
- event_log_start > event_log_finish) {
- return -EINVAL;
- }
-
- log_ptr = event_log_start;
- log_end = (uintptr_t)event_log_finish;
-
- return 0;
-}
-
-int event_log_init(uint8_t *event_log_start, uint8_t *event_log_finish)
-{
- return event_log_buf_init(event_log_start, event_log_finish);
-}
-
-int event_log_write_specid_event(void)
-{
- void *ptr;
-
- /* event_log_buf_init() must have been called prior to this. */
- if (log_ptr == NULL) {
- return -EFAULT;
- }
-
- if (((uintptr_t)log_ptr + ID_EVENT_SIZE) > log_end) {
- return -ENOMEM;
- }
-
- ptr = log_ptr;
-
- /*
- * Add Specification ID Event first
- *
- * Copy TCG_EfiSpecIDEventStruct structure header
- */
- (void)memcpy(ptr, (const void *)&id_event_header,
- sizeof(id_event_header));
- ptr = (uint8_t *)((uintptr_t)ptr + sizeof(id_event_header));
-
- /* TCG_EfiSpecIdEventAlgorithmSize structure */
- ((id_event_algorithm_size_t *)ptr)->algorithm_id = TPM_ALG_ID;
- ((id_event_algorithm_size_t *)ptr)->digest_size = TCG_DIGEST_SIZE;
- ptr = (uint8_t *)((uintptr_t)ptr + sizeof(id_event_algorithm_size_t));
-
- /*
- * TCG_EfiSpecIDEventStruct.vendorInfoSize
- * No vendor data
- */
- ((id_event_struct_data_t *)ptr)->vendor_info_size = 0;
- log_ptr = (uint8_t *)((uintptr_t)ptr +
- offsetof(id_event_struct_data_t, vendor_info));
-
- return 0;
-}
-
-int event_log_write_header(void)
-{
- const char locality_signature[] = TCG_STARTUP_LOCALITY_SIGNATURE;
- void *ptr;
- int rc;
-
- rc = event_log_write_specid_event();
- if (rc < 0) {
- return rc;
- }
-
- if (((uintptr_t)log_ptr + LOC_EVENT_SIZE) > log_end) {
- return -ENOMEM;
- }
-
- ptr = log_ptr;
-
- /*
- * The Startup Locality event should be placed in the log before
- * any event which extends PCR[0].
- *
- * Ref. TCG PC Client Platform Firmware Profile 9.4.5.3
- */
-
- /* Copy Startup Locality Event Header */
- (void)memcpy(ptr, (const void *)&locality_event_header,
- sizeof(locality_event_header));
- ptr = (uint8_t *)((uintptr_t)ptr + sizeof(locality_event_header));
-
- /* TCG_PCR_EVENT2.Digests[].AlgorithmId */
- ((tpmt_ha *)ptr)->algorithm_id = TPM_ALG_ID;
-
- /* TCG_PCR_EVENT2.Digests[].Digest[] */
- (void)memset(&((tpmt_ha *)ptr)->digest, 0, TCG_DIGEST_SIZE);
- ptr = (uint8_t *)((uintptr_t)ptr +
- offsetof(tpmt_ha, digest) + TCG_DIGEST_SIZE);
-
- /* TCG_PCR_EVENT2.EventSize */
- ((event2_data_t *)ptr)->event_size =
- (uint32_t)sizeof(startup_locality_event_t);
- ptr = (uint8_t *)((uintptr_t)ptr + offsetof(event2_data_t, event));
-
- /* TCG_EfiStartupLocalityEvent.Signature */
- (void)memcpy(ptr, (const void *)locality_signature,
- sizeof(TCG_STARTUP_LOCALITY_SIGNATURE));
-
- /*
- * TCG_EfiStartupLocalityEvent.StartupLocality = 0:
- * the platform's boot firmware
- */
- ((startup_locality_event_t *)ptr)->startup_locality = 0U;
- log_ptr = (uint8_t *)((uintptr_t)ptr + sizeof(startup_locality_event_t));
-
- return 0;
-}
-
-int event_log_measure(uintptr_t data_base, uint32_t data_size,
- unsigned char hash_data[CRYPTO_MD_MAX_SIZE])
-{
- /* Calculate hash */
- return crypto_mod_calc_hash(CRYPTO_MD_ID,
- (void *)data_base, data_size, hash_data);
-}
-
-int event_log_measure_and_record(uintptr_t data_base, uint32_t data_size,
- uint32_t data_id,
- const event_log_metadata_t *metadata_ptr)
-{
- unsigned char hash_data[CRYPTO_MD_MAX_SIZE];
- int rc;
-
- if (metadata_ptr == NULL) {
- return -EINVAL;
- }
-
- /* Get the metadata associated with this image. */
- while (metadata_ptr->id != data_id) {
- if (metadata_ptr->id == EVLOG_INVALID_ID) {
- return -EINVAL;
- }
-
- metadata_ptr++;
- }
-
- /* Measure the payload with algorithm selected by EventLog driver */
- rc = event_log_measure(data_base, data_size, hash_data);
- if (rc != 0) {
- return rc;
- }
-
- rc = event_log_record(hash_data, EV_POST_CODE, metadata_ptr);
- if (rc != 0) {
- return rc;
- }
-
- return 0;
-}
-
-size_t event_log_get_cur_size(uint8_t *event_log_start)
-{
- assert(event_log_start != NULL);
- assert(log_ptr >= event_log_start);
-
- return (size_t)((uintptr_t)log_ptr - (uintptr_t)event_log_start);
-}
diff --git a/lib/event_log/event_log.mk b/lib/event_log/event_log.mk
index df55c62..ae701c1 100644
--- a/lib/event_log/event_log.mk
+++ b/lib/event_log/event_log.mk
@@ -4,51 +4,11 @@
# SPDX-License-Identifier: BSD-3-Clause
#
-# Path to library sources
-EVENT_LOG_SRC_DIR := lib/event_log/
+LIBEVLOG_PATH ?= contrib/libeventlog
-# Default log level to dump the event log (LOG_LEVEL_INFO)
-EVENT_LOG_LEVEL ?= 40
+EVENT_LOG_INCLUDES += -I$(LIBEVLOG_PATH)/include \
+ -I$(LIBEVLOG_PATH)/include/private
-EVENT_LOG_SOURCES := ${EVENT_LOG_SRC_DIR}event_print.c
-INCLUDES += -Iinclude/lib/event_log \
- -Iinclude/drivers/auth
-
-ifdef CRYPTO_SUPPORT
-# Measured Boot hash algorithm.
-# SHA-256 (or stronger) is required for all devices that are TPM 2.0 compliant.
-ifdef TPM_HASH_ALG
- $(warning "TPM_HASH_ALG is deprecated. Please use MBOOT_EL_HASH_ALG instead.")
- MBOOT_EL_HASH_ALG := ${TPM_HASH_ALG}
-else
- MBOOT_EL_HASH_ALG := sha256
-endif
-
-ifeq (${MBOOT_EL_HASH_ALG}, sha512)
- TPM_ALG_ID := TPM_ALG_SHA512
- TCG_DIGEST_SIZE := 64U
-else ifeq (${MBOOT_EL_HASH_ALG}, sha384)
- TPM_ALG_ID := TPM_ALG_SHA384
- TCG_DIGEST_SIZE := 48U
-else
- TPM_ALG_ID := TPM_ALG_SHA256
- TCG_DIGEST_SIZE := 32U
-endif #MBOOT_EL_HASH_ALG
-
-# Set definitions for event log library.
-$(eval $(call add_define,TFTF_DEFINES,TPM_ALG_ID))
-$(eval $(call add_define,TFTF_DEFINES,EVENT_LOG_LEVEL))
-$(eval $(call add_define,TFTF_DEFINES,TCG_DIGEST_SIZE))
-
-EVENT_LOG_SOURCES := ${EVENT_LOG_SRC_DIR}event_log.c
-
-INCLUDES += -Iinclude/lib/event_log \
- -Iinclude/drivers/auth
-
-ifeq (${TRANSFER_LIST}, 1)
-EVENT_LOG_SOURCES += ${EVENT_LOG_SRC_DIR}/event_handoff.c
-INCLUDES += -Iinclude/lib
-endif
-
-endif
+EVENT_LOG_SOURCES := $(LIBEVLOG_PATH)/src/event_print.c \
+ $(LIBEVLOG_PATH)/src/digest.c
diff --git a/lib/event_log/event_print.c b/lib/event_log/event_print.c
deleted file mode 100644
index 234a694..0000000
--- a/lib/event_log/event_print.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Copyright (c) 2020-2025, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <common/debug.h>
-#include "event_log.h"
-
-/**
- * Print a TCG_EfiSpecIDEventStruct entry from the event log.
- *
- * This function extracts and prints a TCG_EfiSpecIDEventStruct
- * entry from the event log for debugging or auditing purposes.
- *
- * @param[in,out] log_addr Pointer to the current position in the Event Log.
- * Updated to the next entry after processing.
- * @param[in,out] log_size Pointer to the remaining Event Log size.
- * Updated to reflect the remaining bytes.
- *
- * @return 0 on success, or a negative error code on failure.
- */
-static int event_log_print_id_event(uint8_t **log_addr, size_t *log_size)
-{
- unsigned int i;
- uint8_t info_size, *info_size_ptr;
- void *ptr = *log_addr;
- id_event_headers_t *event = (id_event_headers_t *)ptr;
- id_event_algorithm_size_t *alg_ptr;
- uint32_t event_size, number_of_algorithms;
- size_t digest_len;
- const uint8_t *end_ptr = (uint8_t *)((uintptr_t)*log_addr + *log_size);
-
- if (*log_size < sizeof(id_event_headers_t)) {
- return -EINVAL;
- }
-
- /* The fields of the event log header are defined to be PCRIndex of 0,
- * EventType of EV_NO_ACTION, Digest of 20 bytes of 0, and
- * Event content defined as TCG_EfiSpecIDEventStruct.
- */
- LOG_EVENT("TCG_EfiSpecIDEvent:\n");
- LOG_EVENT(" PCRIndex : %u\n", event->header.pcr_index);
- if (event->header.pcr_index != (uint32_t)PCR_0) {
- return -EINVAL;
- }
-
- LOG_EVENT(" EventType : %u\n", event->header.event_type);
- if (event->header.event_type != EV_NO_ACTION) {
- return -EINVAL;
- }
-
- LOG_EVENT(" Digest :");
- for (i = 0U; i < sizeof(event->header.digest); ++i) {
- uint8_t val = event->header.digest[i];
-
- (void)printf(" %02x", val);
- if ((i & U(0xF)) == 0U) {
- (void)printf("\n");
- LOG_EVENT("\t\t :");
- }
- }
-
- if ((i & U(0xF)) != 0U) {
- (void)printf("\n");
- }
-
- /* EventSize */
- event_size = event->header.event_size;
- LOG_EVENT(" EventSize : %u\n", event_size);
-
- LOG_EVENT(" Signature : %s\n",
- event->struct_header.signature);
- LOG_EVENT(" PlatformClass : %u\n",
- event->struct_header.platform_class);
- LOG_EVENT(" SpecVersion : %u.%u.%u\n",
- event->struct_header.spec_version_major,
- event->struct_header.spec_version_minor,
- event->struct_header.spec_errata);
- LOG_EVENT(" UintnSize : %u\n",
- event->struct_header.uintn_size);
-
- /* NumberOfAlgorithms */
- number_of_algorithms = event->struct_header.number_of_algorithms;
- LOG_EVENT(" NumberOfAlgorithms : %u\n", number_of_algorithms);
-
- /* Address of DigestSizes[] */
- alg_ptr = event->struct_header.digest_size;
-
- /* Size of DigestSizes[] */
- digest_len = number_of_algorithms * sizeof(id_event_algorithm_size_t);
- if (digest_len > (uintptr_t)end_ptr - (uintptr_t)alg_ptr) {
- return -EFAULT;
- }
-
- LOG_EVENT(" DigestSizes :\n");
- for (i = 0U; i < number_of_algorithms; ++i) {
- LOG_EVENT(" #%u AlgorithmId : SHA", i);
- uint16_t algorithm_id = alg_ptr[i].algorithm_id;
-
- switch (algorithm_id) {
- case TPM_ALG_SHA256:
- (void)printf("256\n");
- break;
- case TPM_ALG_SHA384:
- (void)printf("384\n");
- break;
- case TPM_ALG_SHA512:
- (void)printf("512\n");
- break;
- default:
- (void)printf("?\n");
- ERROR("Algorithm 0x%x not found\n", algorithm_id);
- return -ENOENT;
- }
-
- LOG_EVENT(" DigestSize : %u\n",
- alg_ptr[i].digest_size);
- }
-
- /* Address of VendorInfoSize */
- info_size_ptr = (uint8_t *)((uintptr_t)alg_ptr + digest_len);
- if ((uintptr_t)info_size_ptr > (uintptr_t)end_ptr) {
- return -EFAULT;
- }
-
- info_size = *info_size_ptr++;
- LOG_EVENT(" VendorInfoSize : %u\n", info_size);
-
- /* Check VendorInfo end address */
- if (((uintptr_t)info_size_ptr + info_size) > (uintptr_t)end_ptr) {
- return -EFAULT;
- }
-
- /* Check EventSize */
- if (event_size !=
- (sizeof(id_event_struct_t) + digest_len + info_size)) {
- return -EFAULT;
- }
-
- if (info_size != 0U) {
- LOG_EVENT(" VendorInfo :");
- for (i = 0U; i < info_size; ++i) {
- (void)printf(" %02x", *info_size_ptr++);
- }
- (void)printf("\n");
- }
-
- *log_size -= (uintptr_t)info_size_ptr - (uintptr_t)*log_addr;
- *log_addr = info_size_ptr;
-
- return 0;
-}
-
-/**
- * Print a TCG_PCR_EVENT2 entry from the event log.
- *
- * This function extracts and prints a TCG_PCR_EVENT2 structure
- * from the event log for debugging or auditing purposes.
- *
- * @param[in,out] log_addr Pointer to the current position in the Event Log.
- * Updated to the next entry after processing.
- * @param[in,out] log_size Pointer to the remaining Event Log size.
- * Updated to reflect the remaining bytes.
- *
- * @return 0 on success, or a negative error code on failure.
- */
-static int event_log_print_pcr_event2(uint8_t **log_addr, size_t *log_size)
-{
- uint32_t event_size, count;
- size_t sha_size, digests_size = 0U;
- void *ptr = *log_addr;
- const uint8_t *end_ptr = (uint8_t *)((uintptr_t)*log_addr + *log_size);
-
- if (*log_size < sizeof(event2_header_t)) {
- return -EINVAL;
- }
-
- LOG_EVENT("PCR_Event2:\n");
- LOG_EVENT(" PCRIndex : %u\n",
- ((event2_header_t *)ptr)->pcr_index);
- LOG_EVENT(" EventType : %u\n",
- ((event2_header_t *)ptr)->event_type);
-
- count = ((event2_header_t *)ptr)->digests.count;
- if (count < 1U) {
- LOG_EVENT("Invalid Digests Count : %u\n", count);
- return -EINVAL;
- }
-
- LOG_EVENT(" Digests Count : %u\n", count);
-
- /* Address of TCG_PCR_EVENT2.Digests[] */
- ptr = (uint8_t *)ptr + sizeof(event2_header_t);
- if ((uintptr_t)ptr > (uintptr_t)end_ptr) {
- return -EFAULT;
- }
-
- for (unsigned int i = 0U; i < count; ++i) {
- /* Check AlgorithmId address */
- if (((uintptr_t)ptr + offsetof(tpmt_ha, digest)) >
- (uintptr_t)end_ptr) {
- return -EFAULT;
- }
-
- LOG_EVENT(" #%u AlgorithmId : SHA", i);
- switch (((tpmt_ha *)ptr)->algorithm_id) {
- case TPM_ALG_SHA256:
- sha_size = SHA256_DIGEST_SIZE;
- (void)printf("256\n");
- break;
- case TPM_ALG_SHA384:
- sha_size = SHA384_DIGEST_SIZE;
- (void)printf("384\n");
- break;
- case TPM_ALG_SHA512:
- sha_size = SHA512_DIGEST_SIZE;
- (void)printf("512\n");
- break;
- default:
- (void)printf("?\n");
- printf("Algorithm 0x%x not found\n",
- ((tpmt_ha *)ptr)->algorithm_id);
- return -ENOENT;
- }
-
- /* End of Digest[] */
- ptr = (uint8_t *)((uintptr_t)ptr + offsetof(tpmt_ha, digest));
- if (((uintptr_t)ptr + sha_size) > (uintptr_t)end_ptr) {
- return -EFAULT;
- }
-
- /* Total size of all digests */
- digests_size += sha_size;
-
- LOG_EVENT(" Digest :");
- for (unsigned int j = 0U; j < sha_size; ++j) {
- (void)printf(" %02x", *(uint8_t *)ptr++);
- if ((j & U(0xF)) == U(0xF)) {
- (void)printf("\n");
- if (j < (sha_size - 1U)) {
- LOG_EVENT("\t\t :");
- }
- }
- }
- }
-
- /* TCG_PCR_EVENT2.EventSize */
- if (((uintptr_t)ptr + offsetof(event2_data_t, event)) >
- (uintptr_t)end_ptr) {
- return -EFAULT;
- }
-
- event_size = ((event2_data_t *)ptr)->event_size;
- LOG_EVENT(" EventSize : %u\n", event_size);
-
- /* Address of TCG_PCR_EVENT2.Event[EventSize] */
- ptr = (uint8_t *)((uintptr_t)ptr + offsetof(event2_data_t, event));
-
- /* End of TCG_PCR_EVENT2.Event[EventSize] */
- if (((uintptr_t)ptr + event_size) > (uintptr_t)end_ptr) {
- return -EFAULT;
- }
-
- if ((event_size == sizeof(startup_locality_event_t)) &&
- (strcmp((const char *)ptr, TCG_STARTUP_LOCALITY_SIGNATURE) == 0)) {
- LOG_EVENT(" Signature : %s\n",
- ((startup_locality_event_t *)ptr)->signature);
- LOG_EVENT(" StartupLocality : %u\n",
- ((startup_locality_event_t *)ptr)->startup_locality);
- } else {
- LOG_EVENT(" Event : %s\n", (uint8_t *)ptr);
- }
-
- *log_size -= (uintptr_t)ptr + event_size - (uintptr_t)*log_addr;
- *log_addr = (uint8_t *)ptr + event_size;
-
- return 0;
-}
-
-int event_log_dump(uint8_t *log_addr, size_t log_size)
-{
- int rc;
-
- if (log_addr == NULL) {
- return -EINVAL;
- }
-
- /* Print TCG_EfiSpecIDEvent */
- rc = event_log_print_id_event(&log_addr, &log_size);
-
- if (rc < 0) {
- return rc;
- }
-
- while (log_size != 0U) {
- rc = event_log_print_pcr_event2(&log_addr, &log_size);
- if (rc < 0) {
- return rc;
- }
- }
- return 0;
-}
diff --git a/lib/exceptions/irq.c b/lib/exceptions/irq.c
index 70c321b..b99857c 100644
--- a/lib/exceptions/irq.c
+++ b/lib/exceptions/irq.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -13,7 +13,6 @@
#include <platform.h>
#include <platform_def.h>
#include <power_management.h>
-#include <sgi.h>
#include <spinlock.h>
#include <string.h>
#include <tftf.h>
@@ -166,7 +165,6 @@
{
unsigned int raw_iar;
unsigned int irq_num;
- sgi_data_t sgi_data;
irq_handler_t *handler;
void *irq_data = NULL;
int rc = 0;
@@ -175,14 +173,7 @@
irq_num = arm_gic_intr_ack(&raw_iar);
handler = get_irq_handler(irq_num);
- if (IS_PLAT_SPI(irq_num)) {
- irq_data = &irq_num;
- } else if (IS_PPI(irq_num)) {
- irq_data = &irq_num;
- } else if (IS_SGI(irq_num)) {
- sgi_data.irq_id = irq_num;
- irq_data = &sgi_data;
- }
+ irq_data = &irq_num;
if (*handler != NULL)
rc = (*handler)(irq_data);
diff --git a/lib/libtl/libtl.mk b/lib/libtl/libtl.mk
index 4e685d2..e400c0d 100644
--- a/lib/libtl/libtl.mk
+++ b/lib/libtl/libtl.mk
@@ -11,5 +11,6 @@
LIBTL_SOURCES += $(addprefix ${LIBTL_PATH}/src/generic/, \
transfer_list.c \
+ tpm_event_log.c \
logging.c \
)
diff --git a/lib/power_management/hotplug/hotplug.c b/lib/power_management/hotplug/hotplug.c
index 3981aa9..7d534b5 100644
--- a/lib/power_management/hotplug/hotplug.c
+++ b/lib/power_management/hotplug/hotplug.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -16,7 +16,6 @@
#include <platform_def.h>
#include <power_management.h>
#include <psci.h>
-#include <sgi.h>
#include <spinlock.h>
#include <stdint.h>
#include <tftf.h>
diff --git a/lib/power_management/suspend/tftf_suspend.c b/lib/power_management/suspend/tftf_suspend.c
index ee6f9ca..f80ad15 100644
--- a/lib/power_management/suspend/tftf_suspend.c
+++ b/lib/power_management/suspend/tftf_suspend.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -11,7 +11,6 @@
#include <platform.h>
#include <power_management.h>
#include <psci.h>
-#include <sgi.h>
#include <stdint.h>
#include <tftf.h>
#include <tftf_lib.h>
diff --git a/lib/psci/psci.c b/lib/psci/psci.c
index aace092..42e53b9 100644
--- a/lib/psci/psci.c
+++ b/lib/psci/psci.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -11,7 +11,6 @@
#include <platform.h>
#include <power_management.h>
#include <psci.h>
-#include <sgi.h>
#include <tftf.h>
#include <tftf_lib.h>
@@ -344,7 +343,9 @@
int tftf_is_valid_psci_version(unsigned int version)
{
- if (version != PSCI_VERSION(1, 1) &&
+ if (version != PSCI_VERSION(1, 3) &&
+ version != PSCI_VERSION(1, 2) &&
+ version != PSCI_VERSION(1, 1) &&
version != PSCI_VERSION(1, 0) &&
version != PSCI_VERSION(0, 2) &&
version != PSCI_VERSION(0, 1)) {
diff --git a/lib/trng/trng.c b/lib/trng/trng.c
index 976d26e..efc1acc 100644
--- a/lib/trng/trng.c
+++ b/lib/trng/trng.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -10,7 +10,6 @@
#include <irq.h>
#include <platform.h>
#include <trng.h>
-#include <sgi.h>
#include <tftf.h>
#include <tftf_lib.h>
diff --git a/plat/amd/versal2/platform.mk b/plat/amd/versal2/platform.mk
index 2304d2f..4b27f8f 100644
--- a/plat/amd/versal2/platform.mk
+++ b/plat/amd/versal2/platform.mk
@@ -10,11 +10,7 @@
PLAT_INCLUDES := -I${XLNX_COMMON_PATH}/include/ \
-I${VERSAL2_PATH}/include/
-PLAT_SOURCES := drivers/arm/gic/arm_gic_v2v3.c \
- drivers/arm/gic/gic_common.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/gic/gic_v3.c \
- drivers/arm/pl011/${ARCH}/pl011_console.S \
+PLAT_SOURCES := drivers/arm/pl011/${ARCH}/pl011_console.S \
drivers/arm/timer/private_timer.c \
drivers/console/console.c \
${VERSAL2_PATH}/versal2_setup.c \
diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk
index b146654..a47d40b 100644
--- a/plat/arm/common/arm_common.mk
+++ b/plat/arm/common/arm_common.mk
@@ -1,13 +1,12 @@
#
-# Copyright (c) 2018, Arm Limited. All rights reserved.
+# Copyright (c) 2018-2025, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
PLAT_INCLUDES += -Iinclude/plat/arm/common/
-PLAT_SOURCES += drivers/arm/gic/gic_common.c \
- drivers/arm/pl011/${ARCH}/pl011_console.S \
+PLAT_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \
drivers/console/console.c \
plat/arm/common/arm_setup.c \
plat/arm/common/arm_timers.c
diff --git a/plat/arm/corstone1000/platform.mk b/plat/arm/corstone1000/platform.mk
index a5a011d..cd7a191 100644
--- a/plat/arm/corstone1000/platform.mk
+++ b/plat/arm/corstone1000/platform.mk
@@ -1,14 +1,12 @@
#
-# Copyright (c) 2022, Arm Limited. All rights reserved.
+# Copyright (c) 2022-2025, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
PLAT_INCLUDES := -Iplat/arm/corstone1000/include/
-PLAT_SOURCES := drivers/arm/gic/arm_gic_v2.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/timer/private_timer.c \
+PLAT_SOURCES := drivers/arm/timer/private_timer.c \
drivers/arm/timer/system_timer.c \
plat/arm/corstone1000/plat_helpers.S \
plat/arm/corstone1000/corstone1000_pwr_state.c \
diff --git a/plat/arm/fvp/platform.mk b/plat/arm/fvp/platform.mk
index 42df3f7..0f2a128 100644
--- a/plat/arm/fvp/platform.mk
+++ b/plat/arm/fvp/platform.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2018-2024, Arm Limited. All rights reserved.
+# Copyright (c) 2018-2025, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -93,10 +93,7 @@
PLAT_INCLUDES += -Iplat/arm/fvp/include/ \
-Iinclude/lib/pcie/
-PLAT_SOURCES := drivers/arm/gic/arm_gic_v2v3.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/gic/gic_v3.c \
- drivers/arm/sp805/sp805.c \
+PLAT_SOURCES := drivers/arm/sp805/sp805.c \
drivers/arm/timer/private_timer.c \
drivers/arm/timer/system_timer.c \
plat/arm/fvp/${ARCH}/plat_helpers.S \
diff --git a/plat/arm/juno/platform.mk b/plat/arm/juno/platform.mk
index d788177..5e07343 100644
--- a/plat/arm/juno/platform.mk
+++ b/plat/arm/juno/platform.mk
@@ -1,14 +1,12 @@
#
-# Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+# Copyright (c) 2018-2025, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
PLAT_INCLUDES := -Iplat/arm/juno/include/
-PLAT_SOURCES := drivers/arm/gic/arm_gic_v2.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/sp805/sp805.c \
+PLAT_SOURCES := drivers/arm/sp805/sp805.c \
drivers/arm/timer/private_timer.c \
drivers/arm/timer/sp804.c \
plat/arm/juno/${ARCH}/plat_helpers.S \
diff --git a/plat/arm/n1sdp/platform.mk b/plat/arm/n1sdp/platform.mk
index 39c33ab..5cabaab 100644
--- a/plat/arm/n1sdp/platform.mk
+++ b/plat/arm/n1sdp/platform.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2022, Arm Limited. All rights reserved.
+# Copyright (c) 2022-2025, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -12,10 +12,7 @@
PLAT_INCLUDES += -Iplat/arm/n1sdp/include/
-PLAT_SOURCES := drivers/arm/gic/arm_gic_v2v3.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/gic/gic_v3.c \
- drivers/arm/sp805/sp805.c \
+PLAT_SOURCES := drivers/arm/sp805/sp805.c \
drivers/arm/timer/private_timer.c \
drivers/arm/timer/system_timer.c \
plat/arm/n1sdp/${ARCH}/plat_helpers.S \
diff --git a/plat/arm/neoverse_rd/common/nrd_common.mk b/plat/arm/neoverse_rd/common/nrd_common.mk
index 10ee08b..5a22576 100644
--- a/plat/arm/neoverse_rd/common/nrd_common.mk
+++ b/plat/arm/neoverse_rd/common/nrd_common.mk
@@ -1,15 +1,12 @@
#
-# Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2018-2025, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
PLAT_INCLUDES := -Iplat/arm/neoverse_rd/common/include/
-PLAT_SOURCES := drivers/arm/gic/arm_gic_v2v3.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/gic/gic_v3.c \
- drivers/arm/sp805/sp805.c \
+PLAT_SOURCES := drivers/arm/sp805/sp805.c \
drivers/arm/timer/private_timer.c \
drivers/arm/timer/system_timer.c \
plat/arm/neoverse_rd/common/arch/${ARCH}/plat_helpers.S\
diff --git a/plat/arm/tc/platform.mk b/plat/arm/tc/platform.mk
index 14db89b..d626460 100644
--- a/plat/arm/tc/platform.mk
+++ b/plat/arm/tc/platform.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2020-2023, Arm Limited. All rights reserved.
+# Copyright (c) 2020-2025, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -21,10 +21,7 @@
PLAT_INCLUDES += -Iplat/arm/tc/include/
-PLAT_SOURCES := drivers/arm/gic/arm_gic_v2v3.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/gic/gic_v3.c \
- drivers/arm/sp805/sp805.c \
+PLAT_SOURCES := drivers/arm/sp805/sp805.c \
drivers/arm/timer/private_timer.c \
drivers/arm/timer/system_timer.c \
plat/arm/tc/${ARCH}/plat_helpers.S \
diff --git a/plat/hisilicon/hikey960/platform.mk b/plat/hisilicon/hikey960/platform.mk
index 20b42df..c233d72 100644
--- a/plat/hisilicon/hikey960/platform.mk
+++ b/plat/hisilicon/hikey960/platform.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2018, Arm Limited. All rights reserved.
+# Copyright (c) 2018-2025, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -12,9 +12,6 @@
${HIKEY960_PATH}/hikey960_pwr_state.c \
${HIKEY960_PATH}/aarch64/plat_helpers.S \
drivers/arm/pl011/${ARCH}/pl011_console.S \
- drivers/arm/gic/gic_common.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/gic/arm_gic_v2.c \
drivers/arm/timer/system_timer.c \
drivers/arm/timer/private_timer.c \
drivers/console/console.c \
diff --git a/plat/nvidia/tegra186/platform.mk b/plat/nvidia/tegra186/platform.mk
index b7042e6..e2c983e 100644
--- a/plat/nvidia/tegra186/platform.mk
+++ b/plat/nvidia/tegra186/platform.mk
@@ -6,10 +6,7 @@
PLAT_INCLUDES := -Iplat/nvidia/tegra186/include/
-PLAT_SOURCES := drivers/arm/gic/arm_gic_v2.c \
- drivers/arm/gic/gic_common.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/timer/private_timer.c \
+PLAT_SOURCES := drivers/arm/timer/private_timer.c \
drivers/ti/uart/aarch64/16550_console.S \
plat/nvidia/drivers/reset/reset.c \
plat/nvidia/drivers/timer/timers.c \
diff --git a/plat/nvidia/tegra186/setup.c b/plat/nvidia/tegra186/setup.c
index 5e27543..45decab 100644
--- a/plat/nvidia/tegra186/setup.c
+++ b/plat/nvidia/tegra186/setup.c
@@ -6,7 +6,7 @@
#include <debug.h>
#include <drivers/console.h>
-#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gic_v2v3_common.h>
#include <drivers/arm/gic_v2.h>
#include <platform.h>
#include <platform_def.h>
diff --git a/plat/nvidia/tegra194/platform.mk b/plat/nvidia/tegra194/platform.mk
index 081c244..39f0b99 100644
--- a/plat/nvidia/tegra194/platform.mk
+++ b/plat/nvidia/tegra194/platform.mk
@@ -6,10 +6,7 @@
PLAT_INCLUDES := -Iplat/nvidia/tegra194/include/
-PLAT_SOURCES := drivers/arm/gic/arm_gic_v2.c \
- drivers/arm/gic/gic_common.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/timer/private_timer.c \
+PLAT_SOURCES := drivers/arm/timer/private_timer.c \
drivers/ti/uart/aarch64/16550_console.S \
plat/nvidia/drivers/reset/reset.c \
plat/nvidia/drivers/timer/timers.c \
diff --git a/plat/nvidia/tegra194/setup.c b/plat/nvidia/tegra194/setup.c
index 08529d7..e1e52dd 100644
--- a/plat/nvidia/tegra194/setup.c
+++ b/plat/nvidia/tegra194/setup.c
@@ -6,7 +6,7 @@
#include <debug.h>
#include <drivers/console.h>
-#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gic_v2v3_common.h>
#include <drivers/arm/gic_v2.h>
#include <platform.h>
#include <platform_def.h>
diff --git a/plat/nvidia/tegra210/platform.mk b/plat/nvidia/tegra210/platform.mk
index 66f294c..46fcaf1 100644
--- a/plat/nvidia/tegra210/platform.mk
+++ b/plat/nvidia/tegra210/platform.mk
@@ -6,10 +6,7 @@
PLAT_INCLUDES := -Iplat/nvidia/tegra210/include/
-PLAT_SOURCES := drivers/arm/gic/arm_gic_v2.c \
- drivers/arm/gic/gic_common.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/timer/private_timer.c \
+PLAT_SOURCES := drivers/arm/timer/private_timer.c \
drivers/ti/uart/aarch64/16550_console.S \
plat/nvidia/drivers/reset/reset.c \
plat/nvidia/drivers/timer/timers.c \
diff --git a/plat/nvidia/tegra210/setup.c b/plat/nvidia/tegra210/setup.c
index 18cfa2c..6ddc2f6 100644
--- a/plat/nvidia/tegra210/setup.c
+++ b/plat/nvidia/tegra210/setup.c
@@ -6,7 +6,7 @@
#include <debug.h>
#include <drivers/console.h>
-#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gic_v2v3_common.h>
#include <drivers/arm/gic_v2.h>
#include <platform.h>
#include <platform_def.h>
diff --git a/plat/xilinx/versal/platform.mk b/plat/xilinx/versal/platform.mk
index 2161e89..4da709f 100644
--- a/plat/xilinx/versal/platform.mk
+++ b/plat/xilinx/versal/platform.mk
@@ -9,11 +9,7 @@
PLAT_INCLUDES := -I${VERSAL_PATH}/include/
-PLAT_SOURCES := drivers/arm/gic/arm_gic_v2v3.c \
- drivers/arm/gic/gic_common.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/gic/gic_v3.c \
- drivers/arm/pl011/${ARCH}/pl011_console.S \
+PLAT_SOURCES := drivers/arm/pl011/${ARCH}/pl011_console.S \
drivers/arm/timer/private_timer.c \
drivers/console/console.c \
${VERSAL_PATH}/versal_setup.c \
diff --git a/plat/xilinx/versal_net/platform.mk b/plat/xilinx/versal_net/platform.mk
index 90d6d73..786e0c3 100644
--- a/plat/xilinx/versal_net/platform.mk
+++ b/plat/xilinx/versal_net/platform.mk
@@ -9,11 +9,7 @@
PLAT_INCLUDES := -I${VERSAL_NET_PATH}/include/
-PLAT_SOURCES := drivers/arm/gic/arm_gic_v2v3.c \
- drivers/arm/gic/gic_common.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/gic/gic_v3.c \
- drivers/arm/pl011/${ARCH}/pl011_console.S \
+PLAT_SOURCES := drivers/arm/pl011/${ARCH}/pl011_console.S \
drivers/arm/timer/private_timer.c \
drivers/console/console.c \
${VERSAL_NET_PATH}/versal_net_setup.c \
diff --git a/plat/xilinx/versal_net/tests_to_skip.txt b/plat/xilinx/versal_net/tests_to_skip.txt
index f9668ee..c3d5d4e 100644
--- a/plat/xilinx/versal_net/tests_to_skip.txt
+++ b/plat/xilinx/versal_net/tests_to_skip.txt
@@ -70,3 +70,6 @@
#TESTS: debugfs
DebugFS
+
+#TESTS: SDEI
+SDEI/Test binding more events than are available in the PPI range
diff --git a/plat/xilinx/zynqmp/platform.mk b/plat/xilinx/zynqmp/platform.mk
index 201c2ee..b960257 100644
--- a/plat/xilinx/zynqmp/platform.mk
+++ b/plat/xilinx/zynqmp/platform.mk
@@ -9,10 +9,7 @@
PLAT_INCLUDES += -Iplat/xilinx/zynqmp/include/
-PLAT_SOURCES := drivers/arm/gic/arm_gic_v2.c \
- drivers/arm/gic/gic_common.c \
- drivers/arm/gic/gic_v2.c \
- drivers/arm/timer/private_timer.c \
+PLAT_SOURCES := drivers/arm/timer/private_timer.c \
drivers/cadence/uart/aarch64/cdns_console.S \
plat/xilinx/zynqmp/aarch64/plat_helpers.S \
plat/xilinx/zynqmp/zynqmp_pwr_state.c \
diff --git a/plat/xilinx/zynqmp/zynqmp_setup.c b/plat/xilinx/zynqmp/zynqmp_setup.c
index 4a7d371..881638f 100644
--- a/plat/xilinx/zynqmp/zynqmp_setup.c
+++ b/plat/xilinx/zynqmp/zynqmp_setup.c
@@ -5,7 +5,7 @@
*/
#include <drivers/console.h>
-#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gic_v2v3_common.h>
#include <drivers/arm/gic_v2.h>
#include <platform.h>
#include <platform_def.h>
diff --git a/realm/include/realm_rsi.h b/realm/include/realm_rsi.h
index a6260e4..38793e9 100644
--- a/realm/include/realm_rsi.h
+++ b/realm/include/realm_rsi.h
@@ -359,12 +359,12 @@
/*
* FID: 0xC40001AE
*/
-#define SMC_RSI_PLANE_REG_READ SMC64_RSI_FID(U(0x1E))
+#define SMC_RSI_PLANE_SYSREG_READ SMC64_RSI_FID(U(0x1E))
/*
* FID: 0xC40001AF
*/
-#define SMC_RSI_PLANE_REG_WRITE SMC64_RSI_FID(U(0x1F))
+#define SMC_RSI_PLANE_SYSREG_WRITE SMC64_RSI_FID(U(0x1F))
typedef enum {
RSI_EMPTY = 0U,
@@ -560,9 +560,11 @@
/* Data structure used to pass values from P0 to the RMM on Plane entry */
struct rsi_plane_entry {
/* Flags */
- SET_MEMBER(u_register_t flags, 0, 0x8); /* Offset 0 */
+ SET_MEMBER(u_register_t flags, 0, 0x8); /* Offset 0 */
/* PC */
- SET_MEMBER(u_register_t pc, 0x8, 0x100); /* Offset 0x8 */
+ SET_MEMBER(u_register_t pc, 0x8, 0x10); /* Offset 0x8 */
+ /* PSTATE */
+ SET_MEMBER(u_register_t pstate, 0x10, 0x100); /* Offset 0x10 */
/* General-purpose registers */
SET_MEMBER(u_register_t gprs[RSI_PLANE_NR_GPRS], 0x100, 0x200); /* 0x100 */
/* EL1 system registers */
@@ -584,9 +586,11 @@
/* Exception Syndrome Register */
u_register_t esr; /* 0x108 */
/* Fault Address Register */
- u_register_t far; /* 0x108 */
+ u_register_t far; /* 0x110 */
/* Hypervisor IPA Fault Address register */
- u_register_t hpfar; /* 0x110 */
+ u_register_t hpfar; /* 0x118 */
+ /* Hypervisor PSTATE */
+ u_register_t pstate; /* 0x120 */
}, 0x100, 0x200);
/* General-purpose registers */
SET_MEMBER(u_register_t gprs[RSI_PLANE_NR_GPRS], 0x200, 0x300); /* 0x200 */
@@ -609,37 +613,11 @@
SET_MEMBER(struct rsi_plane_exit exit, 0x800, 0x1000);/* 0x800 */
} rsi_plane_run;
-/*
- * arg1 == plane index
- * arg2 == run pointer
- *
- * ret0 == status
- */
-#define RSI_PLANE_ENTER SMC_RSI_FID(0x13U)
+u_register_t rsi_plane_sysreg_read(u_register_t plane_index, u_register_t register_encoding,
+ u_register_t *value_lo, u_register_t *value_hi);
-/*
- * arg1 == plane index
- * arg2 == register encoding
- *
- * ret0 == status
- * ret1 = register value
- */
-#define RSI_PLANE_REG_READ SMC_RSI_FID(0x1EU)
-
-u_register_t rsi_plane_reg_read(u_register_t plane_index, u_register_t register_encoding,
- u_register_t *value);
-
-u_register_t rsi_plane_reg_write(u_register_t plane_index, u_register_t register_encoding,
- u_register_t value);
-
-/*
- * arg1 == plane index
- * arg2 == register encoding
- * arg3 == register value
- *
- * ret0 == status
- */
-#define RSI_PLANE_REG_WRITE SMC_RSI_FID(0x1FU)
+u_register_t rsi_plane_sysreg_write(u_register_t plane_index, u_register_t register_encoding,
+ u_register_t value_lo, u_register_t value_hi);
/*
* Function to set overlay permission value for a specified
diff --git a/realm/realm_multiple_rec.c b/realm/realm_multiple_rec.c
index 95bb6f1..2b364c5 100644
--- a/realm/realm_multiple_rec.c
+++ b/realm/realm_multiple_rec.c
@@ -48,6 +48,11 @@
/* enter plane */
u_register_t flags = 0U;
+ /* Setup the initial PSTATE for the plane */
+ run[rec].enter.pstate = ((SPSR_M3_0_EL1_SP_EL1 << SPSR_M3_0_SHIFT) |
+ (SPSR_M_AARCH64 << SPSR_M_SHIFT) |
+ (0xf << SPSR_DAIF_SHIFT));
+
/* Use Base adr, plane_index, perm_index programmed by P0 rec0 */
run[rec].enter.pc = base;
realm_printf("Entering plane %ld, ep=0x%lx rec=0x%lx\n", plane_index, base, rec);
diff --git a/realm/realm_payload_main.c b/realm/realm_payload_main.c
index 50b78c8..c891746 100644
--- a/realm/realm_payload_main.c
+++ b/realm/realm_payload_main.c
@@ -92,41 +92,85 @@
realm_printf("P0 read 0x%lx 0x%lx\n", reg1, reg2);
/* read pauth register for plane1 */
- ret = rsi_plane_reg_read(plane_index, SYSREG_ID_apiakeylo_el1, ®3);
+ ret = rsi_plane_sysreg_read(plane_index,
+ SYSREG_ID_apiakeylo_el1,
+ ®3, NULL);
if ((ret != RSI_SUCCESS) || (reg1 != reg3)) {
- realm_printf("pauth register mismatch 0x%lx 0x%lx\n", reg1, reg3);
+ realm_printf("pauth register mismatch 0x%lx 0x%lx\n",
+ reg1, reg3);
return false;
}
/* read sctlr register for plane1 */
- ret = rsi_plane_reg_read(plane_index, SYSREG_ID_sctlr_el1, ®4);
+ ret = rsi_plane_sysreg_read(plane_index,
+ SYSREG_ID_sctlr_el1, ®4, NULL);
if ((ret != RSI_SUCCESS) || (reg2 != reg4)) {
- realm_printf("sctlr register mismatch 0x%lx 0x%lx\n", reg2, reg4);
+ realm_printf("sctlr register mismatch 0x%lx 0x%lx\n",
+ reg2, reg4);
return false;
}
/* write pauth register and verify it is same after exiting plane n */
- ret = rsi_plane_reg_write(plane_index, SYSREG_ID_apibkeylo_el1, 0xABCD);
+ ret = rsi_plane_sysreg_write(plane_index,
+ SYSREG_ID_apibkeylo_el1,
+ 0xABCD, 0UL);
if (ret != RSI_SUCCESS) {
realm_printf("pauth register write failed\n");
return false;
}
+ /*
+ * write ttbr0_el1 register and verify it is same after
+ * exiting plane n to validate access to 128-bit registers.
+ */
+ ret = rsi_plane_sysreg_write(plane_index,
+ SYSREG_ID_ttbr0_el1,
+ 0x12340000, 0xA0000);
+ if (ret != RSI_SUCCESS) {
+ realm_printf("ttbr0_el1 register write failed\n");
+ return false;
+ }
+
/* enter plane n */
ret = realm_plane_enter(plane_index, perm_index, base, flags, &run);
if (ret) {
/* read pauth register for plane1 */
- ret = rsi_plane_reg_read(plane_index, SYSREG_ID_apibkeylo_el1,
- ®3);
+ ret = rsi_plane_sysreg_read(plane_index, SYSREG_ID_apibkeylo_el1,
+ ®3, NULL);
if ((ret != RSI_SUCCESS) || (reg3 != 0xABCD)) {
realm_printf("reg mismatch after write 0x%lx\n", reg3);
return false;
}
+
+ /*
+ * read ttbr0_el1 register for plane1 to validate
+ * access to 128-bit registers.
+ */
+ ret = rsi_plane_sysreg_read(plane_index, SYSREG_ID_ttbr0_el1,
+ ®3, ®4);
+
+ if (!is_feat_d128_supported()) {
+ /*
+ * As FEAT_D128 is not supported, manually write
+ * the expected value into reg4.
+ */
+ reg4 = 0xA0000;
+ }
+
+ if ((ret != RSI_SUCCESS) ||
+ (reg3 != 0x12340000) ||
+ (reg4 != 0xA0000)) {
+ realm_printf("reg mismatch after write 0x%lx - 0x%lx\n",
+ reg3, reg4);
+ return false;
+ }
}
/* read sysreg not supported by rmm, expect error */
- ret = rsi_plane_reg_read(plane_index, SYSREG_ID_mpamidr_el1, ®3);
+ ret = rsi_plane_sysreg_read(plane_index,
+ SYSREG_ID_mpamidr_el1,
+ ®3, NULL);
if (ret == RSI_SUCCESS) {
realm_printf("reg read should have failed\n");
return false;
diff --git a/realm/realm_plane.c b/realm/realm_plane.c
index ff42ba9..dba6cff 100644
--- a/realm/realm_plane.c
+++ b/realm/realm_plane.c
@@ -172,6 +172,11 @@
memset(run, 0, sizeof(rsi_plane_run));
run->enter.pc = base;
+ /* Setup the initial PSTATE for the plane */
+ run->enter.pstate = ((SPSR_M3_0_EL1_SP_EL1 << SPSR_M3_0_SHIFT) |
+ (SPSR_M_AARCH64 << SPSR_M_SHIFT) |
+ (0xf << SPSR_DAIF_SHIFT));
+
/* Perm init */
if (plane_init[plane_index]) {
return true;
@@ -198,6 +203,10 @@
while (true) {
ret = rsi_plane_enter(plane_index, (u_register_t)run);
+
+ /* Restore PSTATE with the value on run->exit for the next entry */
+ run->enter.pstate = run->exit.pstate;
+
if (ret != RSI_SUCCESS) {
ERROR("Plane %u enter failed ret= 0x%lx\n", plane_index, ret);
return false;
diff --git a/realm/realm_rsi.c b/realm/realm_rsi.c
index 163443e..a22ddc2 100644
--- a/realm/realm_rsi.c
+++ b/realm/realm_rsi.c
@@ -218,30 +218,44 @@
return res.ret0;
}
-u_register_t rsi_plane_reg_read(u_register_t plane_index,
+/*
+ * Call RSI_PLANE_SYSREG_READ.
+ *
+ * Note that if @value_hi is not NULL and FEAT_D128 is disabled, its return
+ * value will be undefined.
+ */
+u_register_t rsi_plane_sysreg_read(u_register_t plane_index,
u_register_t register_encoding,
- u_register_t *value)
+ u_register_t *value_lo, u_register_t *value_hi)
{
smc_ret_values res = {};
res = tftf_smc(&(smc_args)
- {SMC_RSI_PLANE_REG_READ, plane_index,
+ {SMC_RSI_PLANE_SYSREG_READ, plane_index,
register_encoding});
if (res.ret0 == RSI_SUCCESS) {
- *value = res.ret1;
+ *value_lo = res.ret1;
+ if (value_hi != NULL) {
+ *value_hi = res.ret2;
+ }
}
return res.ret0;
}
-u_register_t rsi_plane_reg_write(u_register_t plane_index,
+/*
+ * Call RSI_PLANE_SYSREG_WRITE.
+ *
+ * Note that @value_hi will be ignored if FEAT_D128 is disabled.
+ */
+u_register_t rsi_plane_sysreg_write(u_register_t plane_index,
u_register_t register_encoding,
- u_register_t value)
+ u_register_t value_lo, u_register_t value_hi)
{
smc_ret_values res = {};
res = tftf_smc(&(smc_args)
- {SMC_RSI_PLANE_REG_WRITE, plane_index,
- register_encoding, value});
+ {SMC_RSI_PLANE_SYSREG_WRITE, plane_index,
+ register_encoding, value_lo, value_hi});
return res.ret0;
}
diff --git a/spm/cactus/cactus_tests/cactus_tests_smmuv3.c b/spm/cactus/cactus_tests/cactus_tests_smmuv3.c
index 5308d93..ad98006 100644
--- a/spm/cactus/cactus_tests/cactus_tests_smmuv3.c
+++ b/spm/cactus/cactus_tests/cactus_tests_smmuv3.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2023, Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -24,6 +24,30 @@
#define NO_SUBSTREAMID (0xFFFFFFFFU)
#define LOOP_COUNT (5000U)
+/*
+ * This function will configure an SMMUv3TestEngine to make access to the Secure
+ * PAS. To do that it uses a regularly (non-PCIe) connected device in place of
+ * the PL 330 cluster. This is non standard and must be enabled on the FVP
+ * commandline with:
+ * -C pci.dma330x4.use_smmuv3testengine_not_dmacs=1
+ *
+ * Some notes about the model:
+ *
+ * A DMAC is a DMA-Controller a DMA-330 (a.k.a. DMAC_PL_330, a.k.a. PL_330). It
+ * is an ancient (32b) device that has its own little instruction set and
+ * several concurrent threads of execution that can be used to move memory
+ * about.
+ *
+ * The original DMAC cluster was put in so that it provides an easy work-load to
+ * program for the SMMU rather than a full PCIe device.
+ *
+ * The PCIe block diagram is not quite right depending on your point of view.
+ * The PCIe Subsystem is above the SMMU – i.e. all accesses made by PCIe devices
+ * go through the SMMU.
+ *
+ * The DMAC cluster is also above the same SMMU and so is (mostly)
+ * indistinguishable from the PCIe device traffic.
+ */
static bool run_testengine(uint32_t operation, uintptr_t source_addr,
uintptr_t target_addr, size_t transfer_size,
uint32_t attributes)
diff --git a/spm/cactus/plat/arm/fvp/fdts/cactus.dts b/spm/cactus/plat/arm/fvp/fdts/cactus.dts
index 0c0a961..3ca54f4 100644
--- a/spm/cactus/plat/arm/fvp/fdts/cactus.dts
+++ b/spm/cactus/plat/arm/fvp/fdts/cactus.dts
@@ -114,10 +114,10 @@
/*
* SMMUv3TestEngine is a DMA IP modeled in the
* Base-RevC FVP Model.
- * User Frame: 0x2bfe0000
- * Privileged Frame: 0x2bff0000
+ * User Frame: 0x2b500000
+ * Privileged Frame: 0x25100000
*/
- base-address = <0x00000000 0x2bfe0000>;
+ base-address = <0x00000000 0x2b500000>;
pages-count = <32>; /* Two 64KB pages */
attributes = <0x3>; /* read-write */
smmu-id = <0>;
diff --git a/spm/cactus/plat/arm/fvp/include/sp_platform_def.h b/spm/cactus/plat/arm/fvp/include/sp_platform_def.h
index 390294f..173f4fd 100644
--- a/spm/cactus/plat/arm/fvp/include/sp_platform_def.h
+++ b/spm/cactus/plat/arm/fvp/include/sp_platform_def.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020-2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2020-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -32,8 +32,8 @@
#define PLAT_CACTUS_MEMCPY_RANGE ULL(0x8000)
/* Base address of user and PRIV frames in SMMUv3TestEngine */
-#define USR_BASE_FRAME ULL(0x2BFE0000)
-#define PRIV_BASE_FRAME ULL(0x2BFF0000)
+#define USR_BASE_FRAME ULL(0x2B500000)
+#define PRIV_BASE_FRAME ULL(0x2B510000)
/* Base address for memory sharing tests. */
#define CACTUS_SP1_MEM_SHARE_BASE 0x7500000
diff --git a/spm/common/sp_tests/sp_test_ffa.c b/spm/common/sp_tests/sp_test_ffa.c
index fc2b0fb..951e44b 100644
--- a/spm/common/sp_tests/sp_test_ffa.c
+++ b/spm/common/sp_tests/sp_test_ffa.c
@@ -80,12 +80,17 @@
const struct ffa_features_test *func_id_targets;
/* Get common features between tftf and cactus. */
size_t test_target_size = get_ffa_feature_test_target(&func_id_targets);
+ /* EL0 partitions don't support NPI. */
+ const unsigned int expected_ret_npi_feature = (el1_partition)
+ ? FFA_SUCCESS_SMC32
+ : FFA_ERROR;
+ /* Specific to SPs. */
struct ffa_features_test feature_id_targets[] = {
{"FFA_FEATURE_MEI", FFA_FEATURE_MEI, FFA_SUCCESS_SMC32, 0,
FFA_VERSION_1_1},
{"FFA_FEATURE_SRI", FFA_FEATURE_SRI, FFA_ERROR, 0,
FFA_VERSION_1_1},
- {"FFA_FEATURE_NPI", FFA_FEATURE_NPI, FFA_SUCCESS_SMC32, 0,
+ {"FFA_FEATURE_NPI", FFA_FEATURE_NPI, expected_ret_npi_feature, 0,
FFA_VERSION_1_1},
{"FFA_YIELD_32", FFA_MSG_YIELD, FFA_SUCCESS_SMC32,
FFA_VERSION_1_0},
@@ -95,12 +100,6 @@
ffa_features_test_targets(func_id_targets, test_target_size);
/* Features are expected to be different to tftf. */
-
- /* EL0 partitions don't support NPI. */
- if (!el1_partition) {
- feature_id_targets[2].expected_ret = FFA_ERROR;
- }
-
ffa_features_test_targets(feature_id_targets,
ARRAY_SIZE(feature_id_targets));
}
diff --git a/spm/ivy/app/ivy_main.c b/spm/ivy/app/ivy_main.c
index 53dbf73..edf52ac 100644
--- a/spm/ivy/app/ivy_main.c
+++ b/spm/ivy/app/ivy_main.c
@@ -23,6 +23,7 @@
struct ffa_value ret;
ffa_id_t my_id;
struct mailbox_buffers mb;
+ bool el1_partition = IVY_SHIM == 1;
set_putc_impl(FFA_SVC_SMC_CALL_AS_STDOUT);
@@ -47,7 +48,7 @@
panic();
}
- ffa_tests(&mb, false);
+ ffa_tests(&mb, el1_partition);
ret = ffa_msg_wait();
diff --git a/tftf/framework/framework.mk b/tftf/framework/framework.mk
index 24742a4..edcae60 100644
--- a/tftf/framework/framework.mk
+++ b/tftf/framework/framework.mk
@@ -58,6 +58,10 @@
${EVENT_LOG_SOURCES} \
lib/extensions/amu/${ARCH}/amu.c \
lib/extensions/amu/${ARCH}/amu_helpers.S \
+ drivers/arm/gic/arm_gic.c \
+ drivers/arm/gic/gic_v2v3_common.c \
+ drivers/arm/gic/gic_v2.c \
+ drivers/arm/gic/gic_v3.c \
lib/exceptions/irq.c \
lib/hob/hob.c \
lib/locks/${ARCH}/spinlock.S \
diff --git a/tftf/framework/main.c b/tftf/framework/main.c
index 0701e28..0ae03e5 100644
--- a/tftf/framework/main.c
+++ b/tftf/framework/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -18,15 +18,11 @@
#include <platform_def.h>
#include <power_management.h>
#include <psci.h>
-#include <sgi.h>
#include <stdint.h>
#include <string.h>
#include <tftf.h>
#include <tftf_lib.h>
#include <timer.h>
-#if TRANSFER_LIST
-#include <transfer_list.h>
-#endif
#define MIN_RETRY_TO_POWER_ON_LEAD_CPU 10
diff --git a/tftf/framework/timer/timer_framework.c b/tftf/framework/timer/timer_framework.c
index 46fe987..556d46e 100644
--- a/tftf/framework/timer/timer_framework.c
+++ b/tftf/framework/timer/timer_framework.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -14,7 +14,6 @@
#include <platform.h>
#include <platform_def.h>
#include <power_management.h>
-#include <sgi.h>
#include <spinlock.h>
#include <stddef.h>
#include <stdint.h>
diff --git a/tftf/tests/framework_validation_tests/test_timer_framework.c b/tftf/tests/framework_validation_tests/test_timer_framework.c
index 47647e7..421ddc6 100644
--- a/tftf/tests/framework_validation_tests/test_timer_framework.c
+++ b/tftf/tests/framework_validation_tests/test_timer_framework.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -14,7 +14,6 @@
#include <platform.h>
#include <power_management.h>
#include <psci.h>
-#include <sgi.h>
#include <stdlib.h>
#include <test_helpers.h>
#include <tftf_lib.h>
diff --git a/tftf/tests/framework_validation_tests/test_validation_irq.c b/tftf/tests/framework_validation_tests/test_validation_irq.c
index fb4645c..914a1ca 100644
--- a/tftf/tests/framework_validation_tests/test_validation_irq.c
+++ b/tftf/tests/framework_validation_tests/test_validation_irq.c
@@ -8,7 +8,6 @@
#include <drivers/arm/arm_gic.h>
#include <irq.h>
#include <platform.h>
-#include <sgi.h>
#include <tftf_lib.h>
static volatile unsigned int counter;
diff --git a/tftf/tests/framework_validation_tests/test_validation_sgi.c b/tftf/tests/framework_validation_tests/test_validation_sgi.c
index 7f81b2b..0f9ac9b 100644
--- a/tftf/tests/framework_validation_tests/test_validation_sgi.c
+++ b/tftf/tests/framework_validation_tests/test_validation_sgi.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -9,14 +9,13 @@
#include <drivers/arm/arm_gic.h>
#include <irq.h>
#include <platform.h>
-#include <sgi.h>
#include <tftf_lib.h>
/*
* The 2 following global variables are used by the SGI handler to return
* information to the main test function.
*/
-static sgi_data_t sgi_data;
+static unsigned int sgi_data;
/* Flag to indicate whether the SGI has been handled */
static volatile unsigned int sgi_handled;
@@ -24,7 +23,7 @@
static int sgi_handler(void *data)
{
/* Save SGI data */
- sgi_data = *(sgi_data_t *) data;
+ sgi_data = *(unsigned int *) data;
sgi_handled = 1;
/* Return value doesn't matter */
@@ -69,9 +68,9 @@
continue;
/* Verify the data received in the SGI handler */
- if (sgi_data.irq_id != sgi_id) {
+ if (sgi_data != sgi_id) {
tftf_testcase_printf("Wrong IRQ ID, expected %u, got %u\n",
- sgi_id, sgi_data.irq_id);
+ sgi_id, sgi_data);
test_res = TEST_RESULT_FAIL;
}
diff --git a/tftf/tests/misc_tests/boot_req_tests/test_cntfrq.c b/tftf/tests/misc_tests/boot_req_tests/test_cntfrq.c
index 78289bb..d885ead 100644
--- a/tftf/tests/misc_tests/boot_req_tests/test_cntfrq.c
+++ b/tftf/tests/misc_tests/boot_req_tests/test_cntfrq.c
@@ -20,7 +20,7 @@
ns_cntfrq = mmio_read_32(SYS_CNT_BASE1 + CNTBASEN_CNTFRQ);
if (cntfrq_el0 != ns_cntfrq) {
- tftf_testcase_printf("CNTFRQ read from sys_reg = %llx and NS timer = %llx differs/n",
+ tftf_testcase_printf("CNTFRQ read from sys_reg = %llx and NS timer = %llx differs\n",
(unsigned long long)cntfrq_el0,
(unsigned long long)ns_cntfrq);
return TEST_RESULT_FAIL;
diff --git a/tftf/tests/misc_tests/test_firmware_handoff.c b/tftf/tests/misc_tests/test_firmware_handoff.c
index 026f057..8d702d6 100644
--- a/tftf/tests/misc_tests/test_firmware_handoff.c
+++ b/tftf/tests/misc_tests/test_firmware_handoff.c
@@ -11,7 +11,7 @@
#include <tftf_lib.h>
#include <transfer_list.h>
-#include "event_log.h"
+#include "event_print.h"
extern u_register_t hw_config_base;
extern u_register_t ns_tl;
diff --git a/tftf/tests/misc_tests/test_pmu_leakage.c b/tftf/tests/misc_tests/test_pmu_leakage.c
index 36b3138..9b2f735 100644
--- a/tftf/tests/misc_tests/test_pmu_leakage.c
+++ b/tftf/tests/misc_tests/test_pmu_leakage.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -48,7 +48,6 @@
#include <irq.h>
#include <platform.h>
#include <power_management.h>
-#include <sgi.h>
#include <string.h>
#include <test_helpers.h>
diff --git a/tftf/tests/misc_tests/test_ras_kfh_reflect.c b/tftf/tests/misc_tests/test_ras_kfh_reflect.c
index eb93d72..7d771a4 100644
--- a/tftf/tests/misc_tests/test_ras_kfh_reflect.c
+++ b/tftf/tests/misc_tests/test_ras_kfh_reflect.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Arm Limited. All rights reserved.
+ * Copyright (c) 2023-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -12,7 +12,6 @@
#include <platform.h>
#include <psci.h>
#include <serror.h>
-#include <sgi.h>
#include <smccc.h>
#include <tftf_lib.h>
diff --git a/tftf/tests/runtime_services/host_realm_managment/host_realm_helper.c b/tftf/tests/runtime_services/host_realm_managment/host_realm_helper.c
index 583e612..564d0d2 100644
--- a/tftf/tests/runtime_services/host_realm_managment/host_realm_helper.c
+++ b/tftf/tests/runtime_services/host_realm_managment/host_realm_helper.c
@@ -19,7 +19,6 @@
#include <plat_topology.h>
#include <power_management.h>
#include <realm_def.h>
-#include <sgi.h>
#include <test_helpers.h>
#include <xlat_tables_v2.h>
diff --git a/tftf/tests/runtime_services/host_realm_managment/host_realm_rmi.c b/tftf/tests/runtime_services/host_realm_managment/host_realm_rmi.c
index 6fb4405..21e6c59 100644
--- a/tftf/tests/runtime_services/host_realm_managment/host_realm_rmi.c
+++ b/tftf/tests/runtime_services/host_realm_managment/host_realm_rmi.c
@@ -40,6 +40,21 @@
static spinlock_t pool_lock;
static unsigned int pool_counter;
+/*
+ * Return an IPA mask @level
+ */
+static unsigned long tte_ipa_lvl_mask(long level, bool lpa2)
+{
+ unsigned long mask;
+ unsigned long levels = (unsigned long)(TT_PAGE_LEVEL - level);
+ unsigned long lsb = (levels * TTE_STRIDE) + GRANULE_SHIFT;
+ unsigned long oa_bits = (lpa2 == true) ? MAX_IPA_BITS_LPA2 : MAX_IPA_BITS;
+
+ mask = BIT_MASK_ULL((oa_bits - 1U), lsb);
+
+ return mask;
+}
+
static smc_ret_values host_rmi_handler(smc_args *args, unsigned int in_reg)
{
u_register_t regs[8];
@@ -325,18 +340,12 @@
u_register_t host_rmi_rtt_aux_map_unprotected(u_register_t rd,
u_register_t map_addr,
- u_register_t tree_index,
- u_register_t *fail_index,
- u_register_t *level_pri,
- u_register_t *state)
+ u_register_t tree_index)
{
smc_ret_values rets;
rets = host_rmi_handler(&(smc_args) {SMC_RMI_RTT_AUX_MAP_UNPROTECTED,
rd, map_addr, tree_index}, 4U);
- *fail_index = rets.ret1;
- *level_pri = rets.ret2;
- *state = rets.ret3;
return rets.ret0;
}
@@ -391,15 +400,13 @@
u_register_t host_rmi_rtt_aux_unmap_unprotected(u_register_t rd,
u_register_t map_addr,
u_register_t tree_index,
- u_register_t *top,
- u_register_t *level)
+ u_register_t *top)
{
smc_ret_values rets;
rets = host_rmi_handler(&(smc_args) {SMC_RMI_RTT_AUX_UNMAP_UNPROTECTED,
rd, map_addr, tree_index}, 4U);
*top = rets.ret1;
- *level = rets.ret2;
return rets.ret0;
}
@@ -612,6 +619,7 @@
}
map_addr += PAGE_SIZE;
}
+
return REALM_SUCCESS;
}
@@ -887,6 +895,7 @@
ipa, ret, tree_index);
}
}
+
/* Retry DATA_DESTROY */
continue;
}
@@ -913,6 +922,31 @@
return REALM_SUCCESS;
}
+
+static u_register_t host_realm_aux_unmap_unprotected(struct realm *realm,
+ u_register_t unmap_addr)
+{
+ u_register_t ret = RMI_SUCCESS;
+ __unused u_register_t top;
+
+ for (unsigned int tree_index = 1U;
+ tree_index <= realm->num_aux_planes; tree_index++) {
+ bool lpa2 = (realm->rmm_feat_reg0 & RMI_FEATURE_REGISTER_0_LPA2);
+ unsigned long unmap_ns_addr = unmap_addr &
+ tte_ipa_lvl_mask(realm->start_level, lpa2);
+
+ ret = host_rmi_rtt_aux_unmap_unprotected(realm->rd,
+ unmap_ns_addr,
+ tree_index, &top);
+
+ if (ret != RMI_SUCCESS) {
+ return ret;
+ }
+ }
+
+ return ret;
+}
+
static u_register_t host_realm_tear_down_rtt_range(struct realm *realm,
long level,
u_register_t start,
@@ -939,26 +973,17 @@
switch (rtt.state) {
case RMI_ASSIGNED:
if (host_ipa_is_ns(map_addr, realm->rmm_feat_reg0)) {
-
- u_register_t level1;
-
/* Unmap from all Aux RTT */
if (!realm->rtt_s2ap_enc_indirect) {
- for (unsigned int tree_index = 1U;
- tree_index <= realm->num_aux_planes;
- tree_index++) {
- ret = host_rmi_rtt_aux_unmap_unprotected(
- rd,
- map_addr,
- tree_index,
- &top, &level1);
+ u_register_t ret =
+ host_realm_aux_unmap_unprotected(
+ realm, map_addr);
- if (ret != RMI_SUCCESS) {
- ERROR("%s() failed, addr=0x%lx ret=0x%lx\n",
+ if (ret != RMI_SUCCESS) {
+ ERROR("%s() failed, addr=0x%lx ret=0x%lx\n",
"host_rmi_rtt_unmap_unprotected",
map_addr, ret);
- }
}
}
@@ -1398,47 +1423,31 @@
/* AUX MAP NS buffer for all RTTs */
if (!realm->rtt_tree_single) {
for (unsigned int j = 0U; j < realm->num_aux_planes; j++) {
- for (unsigned int i = 0U; i < ns_shared_mem_size / PAGE_SIZE; i++) {
- u_register_t fail_index, level_pri, state;
-
+ bool lpa2 = (realm->rmm_feat_reg0 & RMI_FEATURE_REGISTER_0_LPA2);
+ unsigned long sl_map_size = tte_map_size(realm->start_level);
+ unsigned long map_ns_addr = realm->ipa_ns_buffer &
+ tte_ipa_lvl_mask(realm->start_level, lpa2);
+ do {
ret = host_rmi_rtt_aux_map_unprotected(realm->rd,
- realm->ipa_ns_buffer + (i * PAGE_SIZE),
- j + 1, &fail_index, &level_pri, &state);
+ map_ns_addr, j + 1U);
- if (ret == RMI_SUCCESS) {
- continue;
- } else if (RMI_RETURN_STATUS(ret) == RMI_ERROR_RTT_AUX) {
-
- /* Create Level and retry */
+ if (RMI_RETURN_STATUS(ret) == RMI_ERROR_RTT) {
int8_t ulevel = RMI_RETURN_INDEX(ret);
long level = (long)ulevel;
- ret = host_realm_create_rtt_aux_levels(realm,
- realm->ipa_ns_buffer +
- (i * PAGE_SIZE),
- level, 3, j + 1);
-
- if (ret != RMI_SUCCESS) {
- return REALM_ERROR;
- }
-
- ret = host_rmi_rtt_aux_map_unprotected(realm->rd,
- realm->ipa_ns_buffer +
- (i * PAGE_SIZE),
- j + 1, &fail_index,
- &level_pri, &state);
-
- if (ret == RMI_SUCCESS) {
- continue;
- }
+ ERROR("%s() failed, walk_pri.level = %ld\n",
+ "host_realm_map_unprotected", level);
+ return REALM_ERROR;
}
- ERROR("%s() failed, par_base=0x%lx ret=0x%lx\n",
- "host_realm_aux_map_unprotected",
- (ns_shared_mem_adr), ret);
- return REALM_ERROR;
+ if (ret != RMI_SUCCESS) {
+ ERROR("%s() failed\n", "host_realm_map_unprotected");
+ return REALM_ERROR;
+ }
- }
+ map_ns_addr += sl_map_size;
+ } while (map_ns_addr < (realm->ipa_ns_buffer +
+ realm->ns_buffer_size));
}
}
diff --git a/tftf/tests/runtime_services/realm_payload/host_realm_payload_multiple_rec_tests.c b/tftf/tests/runtime_services/realm_payload/host_realm_payload_multiple_rec_tests.c
index e863756..883102e 100644
--- a/tftf/tests/runtime_services/realm_payload/host_realm_payload_multiple_rec_tests.c
+++ b/tftf/tests/runtime_services/realm_payload/host_realm_payload_multiple_rec_tests.c
@@ -11,7 +11,6 @@
#include <plat_topology.h>
#include <power_management.h>
#include <psci.h>
-#include <sgi.h>
#include <test_helpers.h>
#include <host_realm_helper.h>
diff --git a/tftf/tests/runtime_services/realm_payload/host_realm_payload_tests.c b/tftf/tests/runtime_services/realm_payload/host_realm_payload_tests.c
index 34ead9f..be999c3 100644
--- a/tftf/tests/runtime_services/realm_payload/host_realm_payload_tests.c
+++ b/tftf/tests/runtime_services/realm_payload/host_realm_payload_tests.c
@@ -40,7 +40,7 @@
#endif
/*
- * @Test_Aim@ Test RSI_PLANE_REG_READ/WRITE
+ * @Test_Aim@ Test RSI_PLANE_SYSREG_READ/WRITE
*/
test_result_t host_test_realm_create_planes_register_rw(void)
{
diff --git a/tftf/tests/runtime_services/secure_service/spm_common.c b/tftf/tests/runtime_services/secure_service/spm_common.c
index 029113f..92a6644 100644
--- a/tftf/tests/runtime_services/secure_service/spm_common.c
+++ b/tftf/tests/runtime_services/secure_service/spm_common.c
@@ -22,8 +22,9 @@
bool is_ffa_call_error(struct ffa_value ret)
{
if (ffa_func_id(ret) == FFA_ERROR) {
- VERBOSE("FF-A call returned error: %s\n",
- ffa_error_name(ffa_error_code(ret)));
+ VERBOSE("FF-A call returned error: %s - %#x\n",
+ ffa_error_name(ffa_error_code(ret)),
+ ffa_error_code(ret));
return true;
}
return false;
@@ -36,16 +37,16 @@
received_func = ffa_func_id(ret);
if (received_func != FFA_ERROR) {
- ERROR("Expected FFA_ERROR, got %s instead\n",
- ffa_func_name(received_func));
+ ERROR("Expected FFA_ERROR, got %s - %#x instead\n",
+ ffa_func_name(received_func), received_func);
return false;
}
received_error = ffa_error_code(ret);
if (received_error != expected_error) {
- ERROR("Expected %s, got %s instead\n",
- ffa_error_name(expected_error),
- ffa_error_name(received_error));
+ ERROR("Expected %s - %#x, got %s - %#x instead\n",
+ ffa_error_name(expected_error), expected_error,
+ ffa_error_name(received_error), received_error);
return false;
}
@@ -64,7 +65,9 @@
return true;
}
- VERBOSE("%s is not FF-A response.\n", ffa_func_name(ffa_func_id(ret)));
+ VERBOSE("%s - %#x is not FF-A response.\n",
+ ffa_func_name(ffa_func_id(ret)), ffa_func_id(ret));
+
/* To log error in case it is FFA_ERROR*/
is_ffa_call_error(ret);
@@ -80,8 +83,9 @@
return true;
}
- VERBOSE("Expecting %s, FF-A return was %s\n", ffa_func_name(func_id),
- ffa_func_name(ffa_func_id(ret)));
+ VERBOSE("Expecting %s - %#x, FF-A return was %s - %#x\n",
+ ffa_func_name(func_id), func_id,
+ ffa_func_name(ffa_func_id(ret)), ffa_func_id(ret));
return false;
}
@@ -95,10 +99,10 @@
if (cactus_get_response(ret) != expected_resp ||
(uint32_t)ret.arg4 != arg) {
- VERBOSE("Expected response %x and %x; "
- "Obtained %x and %x\n",
- expected_resp, arg, cactus_get_response(ret),
- (int32_t)ret.arg4);
+ VERBOSE("Expected response %#x and %#x; "
+ "Obtained %#x and %#x\n",
+ expected_resp, arg, cactus_get_response(ret),
+ (int32_t)ret.arg4);
return false;
}
@@ -107,15 +111,9 @@
void dump_ffa_value(struct ffa_value ret)
{
- NOTICE("FF-A value: %lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx\n",
- ret.fid,
- ret.arg1,
- ret.arg2,
- ret.arg3,
- ret.arg4,
- ret.arg5,
- ret.arg6,
- ret.arg7);
+ NOTICE("FF-A value: %lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx\n", ret.fid,
+ ret.arg1, ret.arg2, ret.arg3, ret.arg4, ret.arg5, ret.arg6,
+ ret.arg7);
}
/*
@@ -202,6 +200,8 @@
FFA_SUCCESS_SMC32},
{"FFA_NOTIFICATION_INFO_GET_64", FFA_NOTIFICATION_INFO_GET_SMC64,
FFA_SUCCESS_SMC32},
+ {"FFA_ABORT_32", FFA_ABORT_32, FFA_ERROR},
+ {"FFA_ABORT_64", FFA_ABORT_64, FFA_ERROR},
{"Check non-existent command", 0xFFFF, FFA_ERROR},
};
@@ -233,27 +233,30 @@
ffa_ret = ffa_features_with_input_property(test_target->feature,
test_target->param);
- expected_ret = FFA_VERSION_COMPILED
- >= test_target->version_added ?
- test_target->expected_ret : FFA_ERROR;
+ expected_ret =
+ FFA_VERSION_COMPILED >= test_target->version_added
+ ? test_target->expected_ret
+ : FFA_ERROR;
if (ffa_func_id(ffa_ret) != expected_ret) {
- ERROR("Unexpected return: %s (expected %s)."
+ ERROR("Unexpected return: %s - %x (expected %s - %x)."
" FFA_FEATURES test: %s.\n",
ffa_func_name(ffa_func_id(ffa_ret)),
- ffa_func_name(expected_ret),
- test_target->test_name);
+ ffa_func_id(ffa_ret), ffa_func_name(expected_ret),
+ expected_ret, test_target->test_name);
ret = false;
}
if (expected_ret == FFA_ERROR) {
if (ffa_error_code(ffa_ret) !=
FFA_ERROR_NOT_SUPPORTED) {
- ERROR("Unexpected error code: %s (expected %s)."
+ ERROR("Unexpected error code: %s - %#x "
+ "(expected %s - %#x)."
" FFA_FEATURES test: %s.\n",
ffa_error_name(ffa_error_code(ffa_ret)),
+ ffa_error_code(ffa_ret),
ffa_error_name(expected_ret),
- test_target->test_name);
+ expected_ret, test_target->test_name);
ret = false;
}
}
@@ -320,7 +323,8 @@
if ((*retrieved)->receiver_count > MAX_MEM_SHARE_RECIPIENTS) {
VERBOSE("SPMC memory sharing operations support max of %u "
- "receivers!\n", MAX_MEM_SHARE_RECIPIENTS);
+ "receivers!\n",
+ MAX_MEM_SHARE_RECIPIENTS);
return false;
}
@@ -749,34 +753,29 @@
ffa_uuid_equal(uuid, NULL_UUID) ? expected->uuid : NULL_UUID;
if (info->id != expected->id) {
- ERROR("Wrong ID. Expected %x, got %x\n", expected->id, info->id);
+ ERROR("Wrong ID. Expected %#x, got %#x\n", expected->id,
+ info->id);
result = false;
}
if (info->exec_context != expected->exec_context) {
- ERROR("Wrong context. Expected %x, got %x\n",
- expected->exec_context,
- info->exec_context);
+ ERROR("Wrong context. Expected %#x, got %#x\n",
+ expected->exec_context, info->exec_context);
result = false;
}
if (info->properties != expected->properties) {
- ERROR("Wrong properties. Expected %x, got %x\n",
- expected->properties,
- info->properties);
+ ERROR("Wrong properties. Expected %#x, got %#x\n",
+ expected->properties, info->properties);
result = false;
}
if (!ffa_uuid_equal(info->uuid, expected_uuid)) {
- ERROR("Wrong UUID. Expected %x %x %x %x, "
- "got %x %x %x %x\n",
- expected_uuid.uuid[0],
- expected_uuid.uuid[1],
- expected_uuid.uuid[2],
- expected_uuid.uuid[3],
- info->uuid.uuid[0],
- info->uuid.uuid[1],
- info->uuid.uuid[2],
- info->uuid.uuid[3]);
+ ERROR("Wrong UUID. Expected %#x %#x %#x %#x, "
+ "got %#x %#x %#x %#x\n",
+ expected_uuid.uuid[0], expected_uuid.uuid[1],
+ expected_uuid.uuid[2], expected_uuid.uuid[3],
+ info->uuid.uuid[0], info->uuid.uuid[1],
+ info->uuid.uuid[2], info->uuid.uuid[3]);
result = false;
}
@@ -997,7 +996,8 @@
}
if (receiver != header.receiver) {
- ERROR("Header receiver: %x different than expected receiver: %x\n",
+ ERROR("Header receiver: %#x different than expected receiver: "
+ "%#x\n",
header.receiver, receiver);
return false;
}
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
index f58b6e4..2697fac 100644
--- a/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -14,7 +14,6 @@
#include <platform.h>
#include <power_management.h>
#include <psci.h>
-#include <sgi.h>
#include <test_helpers.h>
#include <tftf_lib.h>
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/cpu_suspend/test_suspend.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/cpu_suspend/test_suspend.c
index ba98df4..e802d43 100644
--- a/tftf/tests/runtime_services/standard_service/psci/api_tests/cpu_suspend/test_suspend.c
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/cpu_suspend/test_suspend.c
@@ -15,7 +15,6 @@
#include <platform_def.h>
#include <power_management.h>
#include <psci.h>
-#include <sgi.h>
#include <tftf_lib.h>
#include <timer.h>
@@ -446,6 +445,18 @@
false);
}
+static test_result_t check_osi_mode_support(void) {
+ int feat;
+
+ feat = tftf_get_psci_feature_info(SMC_PSCI_CPU_SUSPEND);
+ if (feat < 0)
+ return TEST_RESULT_FAIL;
+ if ((feat & (1 << CPU_SUSPEND_FEAT_OS_INIT_MODE_SHIFT)) == 0)
+ return TEST_RESULT_SKIPPED;
+
+ return TEST_RESULT_SUCCESS;
+}
+
/*
* @Test_Aim@ Suspend to the specified suspend type targeted at affinity level 0
* in OS-initiated mode
@@ -454,6 +465,10 @@
{
int err, rc;
+ err = check_osi_mode_support();
+ if (err != TEST_RESULT_SUCCESS)
+ return err;
+
err = tftf_psci_set_suspend_mode(PSCI_OS_INIT);
if (err != PSCI_E_SUCCESS)
return TEST_RESULT_FAIL;
@@ -499,6 +514,10 @@
tftf_pwr_domain_node_t pd_node;
int err, rc;
+ err = check_osi_mode_support();
+ if (err != TEST_RESULT_SUCCESS)
+ return err;
+
err = test_init(PSTATE_AFF_LVL_1, suspend_type);
if (err != TEST_RESULT_SUCCESS)
return err;
@@ -573,6 +592,10 @@
tftf_pwr_domain_node_t lvl_1_pd_node, lvl_2_pd_node;
int err, rc;
+ err = check_osi_mode_support();
+ if (err != TEST_RESULT_SUCCESS)
+ return err;
+
err = test_init(PSTATE_AFF_LVL_2, suspend_type);
if (err != TEST_RESULT_SUCCESS)
return err;
@@ -656,6 +679,10 @@
return TEST_RESULT_SKIPPED;
}
+ err = check_osi_mode_support();
+ if (err != TEST_RESULT_SUCCESS)
+ return err;
+
/*
* Non-lead CPUs should be suspended, and the lead CPU should
* attempt to supend to level 2. As there is a cpu running in another
@@ -724,6 +751,10 @@
tftf_pwr_domain_node_t lvl_1_pd_node, lvl_2_pd_node, lvl_3_pd_node;
int err, rc;
+ err = check_osi_mode_support();
+ if (err != TEST_RESULT_SUCCESS)
+ return err;
+
err = test_init(PSTATE_AFF_LVL_3, PSTATE_TYPE_POWERDOWN);
if (err != TEST_RESULT_SUCCESS)
return err;
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c
index 2a1e9e7..547af15 100644
--- a/tftf/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -18,7 +18,6 @@
#include <platform_def.h>
#include <power_management.h>
#include <psci.h>
-#include <sgi.h>
#include <spinlock.h>
#include <string.h>
#include <test_helpers.h>
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c
index 748c817..e79293b 100644
--- a/tftf/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -17,7 +17,6 @@
#include <platform_def.h>
#include <power_management.h>
#include <psci.h>
-#include <sgi.h>
#include <test_helpers.h>
#include <tftf.h>
#include <tftf_lib.h>
@@ -44,7 +43,7 @@
static volatile int wakeup_irq_rcvd[PLATFORM_CORE_COUNT];
static volatile unsigned int sgi_handled[PLATFORM_CORE_COUNT];
-static sgi_data_t sgi_data;
+static unsigned int sgi_data;
static volatile int cpu_ref_count;
extern unsigned long __TEXT_START__;
@@ -67,7 +66,7 @@
unsigned int mpid = read_mpidr_el1() & MPID_MASK;
unsigned int core_pos = platform_get_core_pos(mpid);
- sgi_data = *(sgi_data_t *) data;
+ sgi_data = *(unsigned int *) data;
sgi_handled[core_pos] = 1;
return 0;
}
@@ -518,9 +517,9 @@
;
/* Verify the sgi data received by the SGI handler */
- if (sgi_data.irq_id != sgi_id) {
+ if (sgi_data != sgi_id) {
tftf_testcase_printf("Wrong IRQ ID, expected %u, got %u\n",
- sgi_id, sgi_data.irq_id);
+ sgi_id, sgi_data);
ret = TEST_RESULT_FAIL;
}
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/validate_power_state/test_validate_power_state.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/validate_power_state/test_validate_power_state.c
index 1690ca3..565914b 100644
--- a/tftf/tests/runtime_services/standard_service/psci/api_tests/validate_power_state/test_validate_power_state.c
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/validate_power_state/test_validate_power_state.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -14,7 +14,6 @@
#include <platform_def.h>
#include <power_management.h>
#include <psci.h>
-#include <sgi.h>
#include <stdlib.h>
#include <tftf_lib.h>
diff --git a/tftf/tests/runtime_services/standard_service/psci/system_tests/test_psci_on_off_suspend_stress.c b/tftf/tests/runtime_services/standard_service/psci/system_tests/test_psci_on_off_suspend_stress.c
index 58ece71..b282f01 100644
--- a/tftf/tests/runtime_services/standard_service/psci/system_tests/test_psci_on_off_suspend_stress.c
+++ b/tftf/tests/runtime_services/standard_service/psci/system_tests/test_psci_on_off_suspend_stress.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -14,7 +14,6 @@
#include <platform_def.h>
#include <power_management.h>
#include <psci.h>
-#include <sgi.h>
#include <stdlib.h>
#include <test_helpers.h>
#include <tftf.h>
diff --git a/tftf/tests/runtime_services/standard_service/psci/system_tests/test_psci_system_suspend_stress.c b/tftf/tests/runtime_services/standard_service/psci/system_tests/test_psci_system_suspend_stress.c
index 6f629e8..e6cdcba 100644
--- a/tftf/tests/runtime_services/standard_service/psci/system_tests/test_psci_system_suspend_stress.c
+++ b/tftf/tests/runtime_services/standard_service/psci/system_tests/test_psci_system_suspend_stress.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -17,7 +17,6 @@
#include <platform_def.h>
#include <power_management.h>
#include <psci.h>
-#include <sgi.h>
#include <stdlib.h>
#include <test_helpers.h>
#include <tftf.h>
diff --git a/tftf/tests/runtime_services/trusted_os/tsp/test_irq_preempted_std_smc.c b/tftf/tests/runtime_services/trusted_os/tsp/test_irq_preempted_std_smc.c
index c206c3d..3e24ccd 100644
--- a/tftf/tests/runtime_services/trusted_os/tsp/test_irq_preempted_std_smc.c
+++ b/tftf/tests/runtime_services/trusted_os/tsp/test_irq_preempted_std_smc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -7,14 +7,13 @@
#include <arch_helpers.h>
#include <debug.h>
#include <drivers/arm/arm_gic.h>
-#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gic_v2v3_common.h>
#include <drivers/arm/gic_v2.h>
#include <events.h>
#include <irq.h>
#include <plat_topology.h>
#include <platform.h>
#include <power_management.h>
-#include <sgi.h>
#include <smccc.h>
#include <string.h>
#include <test_helpers.h>
diff --git a/tftf/tests/runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c b/tftf/tests/runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c
index 3f0c9cb..ab4162d 100644
--- a/tftf/tests/runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c
+++ b/tftf/tests/runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -7,7 +7,7 @@
#include <arch_helpers.h>
#include <debug.h>
#include <drivers/arm/arm_gic.h>
-#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gic_v2v3_common.h>
#include <drivers/arm/gic_v2.h>
#include <events.h>
#include <irq.h>
diff --git a/tftf/tests/runtime_services/trusted_os/tsp/test_normal_int_switch.c b/tftf/tests/runtime_services/trusted_os/tsp/test_normal_int_switch.c
index 19f3781..eb04006 100644
--- a/tftf/tests/runtime_services/trusted_os/tsp/test_normal_int_switch.c
+++ b/tftf/tests/runtime_services/trusted_os/tsp/test_normal_int_switch.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -12,7 +12,6 @@
#include <mmio.h>
#include <platform.h>
#include <platform_def.h>
-#include <sgi.h>
#include <smccc.h>
#include <std_svc.h>
#include <stdlib.h>
diff --git a/tftf/tests/tests-firmware-handoff.mk b/tftf/tests/tests-firmware-handoff.mk
index c7ca2cd..a09ea28 100644
--- a/tftf/tests/tests-firmware-handoff.mk
+++ b/tftf/tests/tests-firmware-handoff.mk
@@ -9,6 +9,8 @@
include lib/event_log/event_log.mk
include lib/libtl/libtl.mk
+TFTF_INCLUDES += $(EVENT_LOG_INCLUDES)
+
TESTS_SOURCES += $(addprefix tftf/tests/misc_tests/, \
test_firmware_handoff.c \
)