1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2016 Google, Inc
11 #include <asm/state.h>
13 DECLARE_GLOBAL_DATA_PTR;
15 /* SPL / TPL init function */
16 void board_init_f(ulong flag)
18 struct sandbox_state *state = state_get_current();
20 gd->arch.ram_buf = state->ram_buf;
21 gd->ram_size = state->ram_size;
24 u32 spl_boot_device(void)
26 return BOOT_DEVICE_BOARD;
29 static int spl_board_load_image(struct spl_image_info *spl_image,
30 struct spl_boot_device *bootdev)
35 ret = os_find_u_boot(fname, sizeof(fname));
37 printf("(%s not found, error %d)\n", fname, ret);
41 /* Set up spl_image to boot from jump_to_image_no_args() */
42 spl_image->arg = strdup(fname);
44 return log_msg_ret("Setup exec filename", -ENOMEM);
48 SPL_LOAD_IMAGE_METHOD("sandbox", 9, BOOT_DEVICE_BOARD, spl_board_load_image);
50 void spl_board_init(void)
52 struct sandbox_state *state = state_get_current();
55 preloader_console_init();
56 if (state->show_of_platdata) {
58 * Scan all the devices so that we can output their platform
59 * data. See sandbox_spl_probe().
61 printf("Scanning misc devices\n");
62 for (uclass_first_device(UCLASS_MISC, &dev);
64 uclass_next_device(&dev))
69 void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
71 const char *fname = spl_image->arg;
75 os_spl_to_uboot(fname);
77 printf("No filename provided for U-Boot\n");
82 int handoff_arch_save(struct spl_handoff *ho)
84 ho->arch.magic = TEST_HANDOFF_MAGIC;