summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-09-07 05:27:10 +0300
committerTom Rini <trini@konsulko.com>2022-09-29 23:10:43 +0300
commit756c01422dfa193097aa3d43c083b8b23e4b2301 (patch)
treedea1edaa0d86459012b5f8edb92a0fe75bc8a656 /include
parent9859d89b6e859a242d083a96950e0c05f60a5152 (diff)
downloadu-boot-756c01422dfa193097aa3d43c083b8b23e4b2301.tar.xz
sandbox: Support setting up the other FDT for testing
Provide a way to copy over the 'other' FDT when running tests. This loads it and allocates memory for the copy, if not done already, then does the copy. Avoid using U-Boot's malloc() pool for these copies, at least for now, since they are part of the test system. Tidy up the cpu.c header files while here. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/test/test.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/include/test/test.h b/include/test/test.h
index 51efaecba7..225bf45504 100644
--- a/include/test/test.h
+++ b/include/test/test.h
@@ -23,6 +23,8 @@
* @fdt_chksum: crc8 of the device tree contents
* @fdt_copy: Copy of the device tree
* @fdt_size: Size of the device-tree copy
+ * @other_fdt: Buffer for the other FDT (UT_TESTF_OTHER_FDT)
+ * @other_fdt_size: Size of the other FDT (UT_TESTF_OTHER_FDT)
* @runs_per_test: Number of times to run each test (typically 1)
* @expect_str: Temporary string used to hold expected string value
* @actual_str: Temporary string used to hold actual string value
@@ -39,6 +41,8 @@ struct unit_test_state {
uint fdt_chksum;
void *fdt_copy;
uint fdt_size;
+ void *other_fdt;
+ int other_fdt_size;
int runs_per_test;
char expect_str[512];
char actual_str[512];
@@ -132,13 +136,24 @@ enum {
*/
struct udevice *testbus_get_clear_removed(void);
-static inline void arch_reset_for_test(void)
-{
#ifdef CONFIG_SANDBOX
#include <asm/state.h>
+#include <asm/test.h>
+#endif
+static inline void arch_reset_for_test(void)
+{
+#ifdef CONFIG_SANDBOX
state_reset_for_test(state_get_current());
#endif
}
+static inline int test_load_other_fdt(struct unit_test_state *uts)
+{
+ int ret = 0;
+#ifdef CONFIG_SANDBOX
+ ret = sandbox_load_other_fdt(&uts->other_fdt, &uts->other_fdt_size);
+#endif
+ return ret;
+}
#endif /* __TEST_TEST_H */