1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2016 Google, Inc
14 #include <asm/state.h>
16 DECLARE_GLOBAL_DATA_PTR;
18 /* SPL / TPL init function */
19 void board_init_f(ulong flag)
21 struct sandbox_state *state = state_get_current();
23 gd->arch.ram_buf = state->ram_buf;
24 gd->ram_size = state->ram_size;
27 u32 spl_boot_device(void)
29 return BOOT_DEVICE_BOARD;
32 static int spl_board_load_image(struct spl_image_info *spl_image,
33 struct spl_boot_device *bootdev)
38 ret = os_find_u_boot(fname, sizeof(fname));
40 printf("(%s not found, error %d)\n", fname, ret);
44 /* Set up spl_image to boot from jump_to_image_no_args() */
45 spl_image->arg = strdup(fname);
47 return log_msg_ret("Setup exec filename", -ENOMEM);
51 SPL_LOAD_IMAGE_METHOD("sandbox", 9, BOOT_DEVICE_BOARD, spl_board_load_image);
53 void spl_board_init(void)
55 struct sandbox_state *state = state_get_current();
58 preloader_console_init();
59 if (state->show_of_platdata) {
61 * Scan all the devices so that we can output their platform
62 * data. See sandbox_spl_probe().
64 printf("Scanning misc devices\n");
65 for (uclass_first_device(UCLASS_MISC, &dev);
67 uclass_next_device(&dev))
72 void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
74 const char *fname = spl_image->arg;
78 os_spl_to_uboot(fname);
80 printf("No filename provided for U-Boot\n");
85 int handoff_arch_save(struct spl_handoff *ho)
87 ho->arch.magic = TEST_HANDOFF_MAGIC;