1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2016 Google, Inc
14 #include <asm/state.h>
15 #include <test/test.h>
17 DECLARE_GLOBAL_DATA_PTR;
19 /* SPL / TPL init function */
20 void board_init_f(ulong flag)
22 struct sandbox_state *state = state_get_current();
24 gd->arch.ram_buf = state->ram_buf;
25 gd->ram_size = state->ram_size;
28 u32 spl_boot_device(void)
30 return BOOT_DEVICE_BOARD;
33 static int spl_board_load_image(struct spl_image_info *spl_image,
34 struct spl_boot_device *bootdev)
39 ret = os_find_u_boot(fname, sizeof(fname));
41 printf("(%s not found, error %d)\n", fname, ret);
45 /* Set up spl_image to boot from jump_to_image_no_args() */
46 spl_image->arg = strdup(fname);
48 return log_msg_ret("Setup exec filename", -ENOMEM);
52 SPL_LOAD_IMAGE_METHOD("sandbox", 9, BOOT_DEVICE_BOARD, spl_board_load_image);
54 void spl_board_init(void)
56 struct sandbox_state *state = state_get_current();
58 preloader_console_init();
60 if (state->run_unittests) {
63 ret = dm_test_main(state->select_unittests);
64 /* continue execution into U-Boot */
68 void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
70 const char *fname = spl_image->arg;
74 os_spl_to_uboot(fname);
76 printf("No filename provided for U-Boot\n");
81 int handoff_arch_save(struct spl_handoff *ho)
83 ho->arch.magic = TEST_HANDOFF_MAGIC;