Arthur: enable Lazor LAVA test

Signed-off-by: Arthur She <arthur.she@linaro.org>
Change-Id: I006dffb9c67c03ba00e53afa2638dcb744be8d07
diff --git a/group/tf-l1-boot-tests-plat/sc7180-default:sc7180-depthcharge.bl31 b/group/tf-l1-boot-tests-plat/sc7180-default:sc7180-depthcharge.bl31
new file mode 100644
index 0000000..57f11c1
--- /dev/null
+++ b/group/tf-l1-boot-tests-plat/sc7180-default:sc7180-depthcharge.bl31
@@ -0,0 +1,21 @@
+#
+# Copyright (c) 2019-2023 Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+pre_tf_build() {
+    local ext_lib="libqtisec.a"
+
+    pushd "${workspace}"
+
+    if [ ! -f "${ext_lib}" ]; then
+        echo "Fetch ${ext_lib} for sc7180"
+        saveas="${ext_lib}" \
+            url="https://github.com/coreboot/qc_blobs/raw/master/sc7180/qtiseclib/libqtisec.a" \
+            fetch_file
+        pwd; ls -l
+    fi
+
+    popd "${workspace}"
+}
diff --git a/group/tf-l1-build-plat/sc7180-default:nil b/group/tf-l1-build-plat/sc7180-default:nil
index d52947d..2e1e8dd 100644
--- a/group/tf-l1-build-plat/sc7180-default:nil
+++ b/group/tf-l1-build-plat/sc7180-default:nil
@@ -1,6 +1,21 @@
 #
-# Copyright (c) 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2023, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
 
+pre_tf_build() {
+    local ext_lib="libqtisec.a"
+
+    pushd "${workspace}"
+
+    if [ ! -f "${ext_lib}" ]; then
+        echo "Fetch ${ext_lib} for sc7180"
+        saveas="${ext_lib}" \
+            url="https://github.com/coreboot/qc_blobs/raw/master/sc7180/qtiseclib/libqtisec.a" \
+            fetch_file
+        pwd; ls -l
+    fi
+
+    popd "${workspace}"
+}
diff --git a/run_config/sc7180-depthcharge.bl31 b/run_config/sc7180-depthcharge.bl31
new file mode 100644
index 0000000..a3740d5
--- /dev/null
+++ b/run_config/sc7180-depthcharge.bl31
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2019-2023 Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+post_fetch_tf_resource() {
+	payload_type="bl31_depthcharge_boot" gen_sc7180_yaml
+}
diff --git a/sc7180_utils.sh b/sc7180_utils.sh
new file mode 100644
index 0000000..939ae01
--- /dev/null
+++ b/sc7180_utils.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+set -u
+
+gen_sc7180_yaml(){
+    local yaml_file="$workspace/sc7180.yaml"
+    local job_file="$workspace/job.yaml"
+    local payload_type="${payload_type:?}"
+
+    bin_mode="$mode" \
+        "$ci_root/script/gen_sc7180_${payload_type}_yaml.sh" > "$yaml_file"
+
+    cp "$yaml_file" "$job_file"
+    archive_file "$yaml_file"
+    archive_file "$job_file"
+}
+
+set +u
diff --git a/script/gen_sc7180_bl31_depthcharge_boot_yaml.sh b/script/gen_sc7180_bl31_depthcharge_boot_yaml.sh
new file mode 100755
index 0000000..8c8bafd
--- /dev/null
+++ b/script/gen_sc7180_bl31_depthcharge_boot_yaml.sh
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2019-2022 Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+# Generate a YAML file in order to dispatch Juno TFTF runs on LAVA. Note that
+# this script would produce a meaningful output when run via. Jenkins.
+#
+# $bin_mode must be set. This script outputs to STDOUT
+
+ci_root="$(readlink -f "$(dirname "$0")/..")"
+source "$ci_root/utils.sh"
+
+get_bl31_url() {
+	local bin_mode="${bin_mode:?}"
+
+	if upon "$jenkins_run"; then
+		echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/bl31.elf"
+	else
+		echo "file://$workspace/artefacts/$bin_mode/bl31.elf"
+	fi
+}
+
+bl31_url="${bl31_url:-$(get_bl31_url)}"
+
+build_mode=$(echo $bin_mode | tr '[:lower:]' '[:upper:]')
+
+cat <<EOF
+device_type: sc7180-trogdor-lazor-limozeen
+job_name: SC7180 Chromebook BL31 depthcharge boot test - $build_mode
+timeouts:
+  job:
+    minutes: 30
+  action:
+    minutes: 2
+  connection:
+    minutes: 5
+priority: medium
+visibility: public
+actions:
+- deploy:
+    timeout:
+      minutes: 5
+    to: flasher
+    images:
+      image:
+        url: https://images.validation.linaro.org/people.linaro.org/~arthur.she/images/chromebook/lazor/lazor_tf-a-ci_golden_image.bin.gz
+      bl31:
+        url: $bl31_url
+- boot:
+    timeout:
+      minutes: 2
+    method: minimal
+- test:
+    timeout:
+      minutes: 5
+    monitors:
+    - name: "BL31_boot_test"
+      start: "Initializing runtime services"
+      end: "This is a TF-A test build\\\\. Halting\\\\.{3}"
+      pattern: "Starting depthcharge on Lazor\\\\.{3}"
+      fixupdict:
+          '!': pass
+          '': fail
+
+EOF
diff --git a/tf_config/sc7180-default b/tf_config/sc7180-default
index 2f8b19c..1ef99fe 100644
--- a/tf_config/sc7180-default
+++ b/tf_config/sc7180-default
@@ -1,3 +1,4 @@
 COREBOOT=1
 CROSS_COMPILE=aarch64-none-elf-
 PLAT=sc7180
+QTISECLIB_PATH=../workspace/libqtisec.a