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