spl.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (c) 2016 Google, Inc
  3. * SPDX-License-Identifier: GPL-2.0+
  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. void spl_board_announce_boot_device(void)
  23. {
  24. char fname[256];
  25. int ret;
  26. ret = os_find_u_boot(fname, sizeof(fname));
  27. if (ret) {
  28. printf("(%s not found, error %d)\n", fname, ret);
  29. return;
  30. }
  31. printf("%s\n", fname);
  32. }
  33. static int spl_board_load_image(struct spl_boot_device *bootdev)
  34. {
  35. char fname[256];
  36. int ret;
  37. ret = os_find_u_boot(fname, sizeof(fname));
  38. if (ret)
  39. return ret;
  40. /* Hopefully this will not return */
  41. return os_spl_to_uboot(fname);
  42. }
  43. SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
  44. void spl_board_init(void)
  45. {
  46. struct udevice *dev;
  47. preloader_console_init();
  48. /*
  49. * Scan all the devices so that we can output their platform data. See
  50. * sandbox_spl_probe().
  51. */
  52. for (uclass_first_device(UCLASS_MISC, &dev);
  53. dev;
  54. uclass_next_device(&dev))
  55. ;
  56. }