Initial commit for TF-A CI scripts

Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
diff --git a/patch/fault_inject/explicit-events.patch b/patch/fault_inject/explicit-events.patch
new file mode 100644
index 0000000..7b6e72f
--- /dev/null
+++ b/patch/fault_inject/explicit-events.patch
@@ -0,0 +1,16 @@
+--- a/plat/arm/common/aarch64/arm_sdei.c
++++ b/plat/arm/common/aarch64/arm_sdei.c
+@@ -12,7 +12,12 @@
+ 
+ /* Private event mappings */
+ static sdei_ev_map_t arm_sdei_private[] = {
+-	PLAT_ARM_PRIVATE_SDEI_EVENTS
++	PLAT_ARM_PRIVATE_SDEI_EVENTS,
++	SDEI_EXPLICIT_EVENT(5000, SDEI_MAPF_NORMAL),
++	SDEI_EXPLICIT_EVENT(5001, SDEI_MAPF_NORMAL),
++	SDEI_EXPLICIT_EVENT(5002, SDEI_MAPF_NORMAL),
++	SDEI_EXPLICIT_EVENT(5003, SDEI_MAPF_CRITICAL),
++	SDEI_EXPLICIT_EVENT(5004, SDEI_MAPF_CRITICAL),
+ };
+ 
+ /* Shared event mappings */
diff --git a/patch/fault_inject/fvp-fault-handlers.patch b/patch/fault_inject/fvp-fault-handlers.patch
new file mode 100644
index 0000000..02c7e18
--- /dev/null
+++ b/patch/fault_inject/fvp-fault-handlers.patch
@@ -0,0 +1,61 @@
+diff --git a/plat/arm/board/fvp/aarch64/fvp_fault.S b/plat/arm/board/fvp/aarch64/fvp_fault.S
+new file mode 100644
+index e69de29bb..3a2faca1a 100644
+--- /dev/null
++++ b/plat/arm/board/fvp/aarch64/fvp_fault.S
+@@ -0,0 +1,42 @@
++
++#include <asm_macros.S>
++
++	.globl	plat_handle_uncontainable_ea
++
++str_uncontainable:
++	.byte	10 /* Log marker */
++	.asciz "Injected Uncontainable Error\n"
++
++str_double_fault:
++	.byte	10 /* Log marker */
++	.asciz "Injected Double Fault\n"
++
++	/* -----------------------------------------------------
++	 * Platform handler for Uncontainable External Abort.
++	 *
++	 * x0: EA reason
++	 * x1: EA syndrome
++	 * -----------------------------------------------------
++	 */
++func plat_handle_uncontainable_ea
++	adr	x0, str_uncontainable
++	bl	tf_log
++1:
++	wfe
++	b	1b
++endfunc plat_handle_uncontainable_ea
++
++	/* -----------------------------------------------------
++	 * Platform handler for Double Fault.
++	 *
++	 * x0: EA reason
++	 * x1: EA syndrome
++	 * -----------------------------------------------------
++	 */
++func plat_handle_double_fault
++	adr	x0, str_double_fault
++	bl	tf_log
++1:
++	wfe
++	b	1b
++endfunc plat_handle_double_fault
+diff --git a/plat/arm/board/fvp/platform.mk b/plat/arm/board/fvp/platform.mk
+index 2b1e0ac70..461932124 100644
+--- a/plat/arm/board/fvp/platform.mk
++++ b/plat/arm/board/fvp/platform.mk
+@@ -4,6 +4,8 @@
+ # SPDX-License-Identifier: BSD-3-Clause
+ #
+ 
++BL31_SOURCES		+=	plat/arm/board/fvp/aarch64/fvp_fault.S
++
+ # Use the GICv3 driver on the FVP by default
+ FVP_USE_GIC_DRIVER	:= FVP_GICV3
+ 
diff --git a/patch/fault_inject/injected-fault-record-and-handler.patch b/patch/fault_inject/injected-fault-record-and-handler.patch
new file mode 100644
index 0000000..75e68d9
--- /dev/null
+++ b/patch/fault_inject/injected-fault-record-and-handler.patch
@@ -0,0 +1,49 @@
+--- a/plat/arm/board/fvp/aarch64/fvp_ras.c
++++ b/plat/arm/board/fvp/aarch64/fvp_ras.c
+@@ -5,11 +5,46 @@
+  */
+ 
+ #include <lib/extensions/ras.h>
++#include <services/sdei.h>
++
++static int injected_fault_handler(const struct err_record_info *info,
++		int probe_data, const struct err_handler_data *const data)
++{
++	uint64_t status;
++	int ret __unused;
++
++	/*
++	 * The faulting error record is already selected by the SER probe
++	 * function.
++	 */
++	status = read_erxstatus_el1();
++
++	ERROR("Fault reported by system error record %d on 0x%lx: status=0x%llx\n",
++			probe_data, read_mpidr_el1(), status);
++	ERROR(" exception reason=%u syndrome=0x%llx\n", data->ea_reason,
++			data->flags);
++
++	/* Clear error */
++	write_erxstatus_el1(status);
++
++	ret = sdei_dispatch_event(5000);
++	if (ret < 0) {
++		ERROR("Can't dispatch event to SDEI\n");
++		panic();
++	} else {
++		INFO("SDEI event dispatched\n");
++	}
++
++	return 0;
++}
+ 
+ struct ras_interrupt fvp_ras_interrupts[] = {
+ };
+ 
+ struct err_record_info fvp_err_records[] = {
++	/* Record for injected fault */
++	ERR_RECORD_SYSREG_V1(0, 2, ras_err_ser_probe_sysreg,
++			injected_fault_handler, NULL),
+ };
+ 
+ REGISTER_ERR_RECORD_INFO(fvp_err_records);