spl.c 903 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (c) 2016 Google, Inc
  4. */
  5. #include <common.h>
  6. #include <dm.h>
  7. #include <os.h>
  8. #include <spl.h>
  9. #include <asm/spl.h>
  10. #include <asm/state.h>
  11. DECLARE_GLOBAL_DATA_PTR;
  12. void board_init_f(ulong flag)
  13. {
  14. struct sandbox_state *state = state_get_current();
  15. gd->arch.ram_buf = state->ram_buf;
  16. gd->ram_size = state->ram_size;
  17. }
  18. u32 spl_boot_device(void)
  19. {
  20. return BOOT_DEVICE_BOARD;
  21. }
  22. static int spl_board_load_image(struct spl_image_info *spl_image,
  23. struct spl_boot_device *bootdev)
  24. {
  25. char fname[256];
  26. int ret;
  27. ret = os_find_u_boot(fname, sizeof(fname));
  28. if (ret) {
  29. printf("(%s not found, error %d)\n", fname, ret);
  30. return ret;
  31. }
  32. /* Hopefully this will not return */
  33. return os_spl_to_uboot(fname);
  34. }
  35. SPL_LOAD_IMAGE_METHOD("sandbox", 0, BOOT_DEVICE_BOARD, spl_board_load_image);
  36. void spl_board_init(void)
  37. {
  38. preloader_console_init();
  39. }