spl.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. int spl_board_load_image(void)
  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. void spl_board_init(void)
  44. {
  45. struct udevice *dev;
  46. preloader_console_init();
  47. /*
  48. * Scan all the devices so that we can output their platform data. See
  49. * sandbox_spl_probe().
  50. */
  51. for (uclass_first_device(UCLASS_MISC, &dev);
  52. dev;
  53. uclass_next_device(&dev))
  54. ;
  55. }