aboutsummaryrefslogtreecommitdiff
path: root/test/boot/image.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-10-31 14:43:04 -0400
committerTom Rini <trini@konsulko.com>2022-10-31 14:43:04 -0400
commita90afc6730e6c67ad37f4c98a02891a93b4ff971 (patch)
tree724c085433631e142a56c052d667139cba29b4a6 /test/boot/image.c
parent6f38d91158e7e4199753b79e0a25c1a65175aba4 (diff)
parent77bec9e3d8bd2dc307447b92a3d5cefd693a62ad (diff)
Merge branch '2022-10-31-vbe-implement-the-full-firmware-flow'
To quote Simon: This series provides an implementation of VBE from TPL through to U-Boot proper, using VBE to load the relevant firmware stages. It buils a single image.bin file containing all the phases: TPL - initial phase, loads VPL using binman symbols VPL - main firmware phase, loads SPL using VBE parameters SPL - loads U-Boot proper using VBE parameters U-Boot - final firmware phase, where OS booting is processed This series does not include the OS-booting phase. That will be the subject of a future series. The implementation is entirely handled by sandbox. It should be possible to enable this on a real board without much effort, but that is also the subject of a future series.
Diffstat (limited to 'test/boot/image.c')
-rw-r--r--test/boot/image.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/boot/image.c b/test/boot/image.c
new file mode 100644
index 0000000000..2844b05785
--- /dev/null
+++ b/test/boot/image.c
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test for vbe-simple bootmeth. All start with 'vbe_simple'
+ *
+ * Copyright 2023 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <common.h>
+#include <image.h>
+#include <test/suites.h>
+#include <test/ut.h>
+#include "bootstd_common.h"
+
+/* Test of image phase */
+static int test_image_phase(struct unit_test_state *uts)
+{
+ int val;
+
+ ut_asserteq_str("U-Boot phase", genimg_get_phase_name(IH_PHASE_U_BOOT));
+ ut_asserteq_str("SPL Phase", genimg_get_phase_name(IH_PHASE_SPL));
+ ut_asserteq_str("any", genimg_get_phase_name(IH_PHASE_NONE));
+ ut_asserteq_str("Unknown Phase", genimg_get_phase_name(-1));
+
+ ut_asserteq(IH_PHASE_U_BOOT, genimg_get_phase_id("u-boot"));
+ ut_asserteq(IH_PHASE_SPL, genimg_get_phase_id("spl"));
+ ut_asserteq(IH_PHASE_NONE, genimg_get_phase_id("none"));
+ ut_asserteq(-1, genimg_get_phase_id("fred"));
+
+ val = image_ph(IH_PHASE_SPL, IH_TYPE_FIRMWARE);
+ ut_asserteq(IH_PHASE_SPL, image_ph_phase(val));
+ ut_asserteq(IH_TYPE_FIRMWARE, image_ph_type(val));
+
+ return 0;
+}
+BOOTSTD_TEST(test_image_phase, 0);