blob: 1ad7fb6c60e8641878684490e909cea1030e81cb [file] [log] [blame]
Simon Glasse961a662016-07-04 11:57:51 -06001/*
2 * Copyright (c) 2016 Google, Inc
3 * SPDX-License-Identifier: GPL-2.0+
4 */
5
6#include <common.h>
7#include <dm.h>
8#include <os.h>
Simon Glassa091a8f2016-07-04 11:57:55 -06009#include <spl.h>
Simon Glasse961a662016-07-04 11:57:51 -060010#include <asm/spl.h>
11#include <asm/state.h>
12
13DECLARE_GLOBAL_DATA_PTR;
14
15void board_init_f(ulong flag)
16{
17 struct sandbox_state *state = state_get_current();
18
19 gd->arch.ram_buf = state->ram_buf;
20 gd->ram_size = state->ram_size;
21}
22
23u32 spl_boot_device(void)
24{
25 return BOOT_DEVICE_BOARD;
26}
27
28void spl_board_announce_boot_device(void)
29{
30 char fname[256];
31 int ret;
32
33 ret = os_find_u_boot(fname, sizeof(fname));
34 if (ret) {
35 printf("(%s not found, error %d)\n", fname, ret);
36 return;
37 }
38 printf("%s\n", fname);
39}
40
Simon Glass2a2ee2a2016-09-24 18:20:13 -060041static int spl_board_load_image(struct spl_image_info *spl_image,
42 struct spl_boot_device *bootdev)
Simon Glasse961a662016-07-04 11:57:51 -060043{
44 char fname[256];
45 int ret;
46
47 ret = os_find_u_boot(fname, sizeof(fname));
48 if (ret)
49 return ret;
50
51 /* Hopefully this will not return */
52 return os_spl_to_uboot(fname);
53}
Simon Glass97d9df02016-09-24 18:20:12 -060054SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
Simon Glassa091a8f2016-07-04 11:57:55 -060055
56void spl_board_init(void)
57{
58 struct udevice *dev;
59
60 preloader_console_init();
61
62 /*
63 * Scan all the devices so that we can output their platform data. See
64 * sandbox_spl_probe().
65 */
66 for (uclass_first_device(UCLASS_MISC, &dev);
67 dev;
68 uclass_next_device(&dev))
69 ;
70}