spl.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. struct sandbox_state *state = state_get_current();
  39. struct udevice *dev;
  40. preloader_console_init();
  41. if (state->show_of_platdata) {
  42. /*
  43. * Scan all the devices so that we can output their platform
  44. * data. See sandbox_spl_probe().
  45. */
  46. printf("Scanning misc devices\n");
  47. for (uclass_first_device(UCLASS_MISC, &dev);
  48. dev;
  49. uclass_next_device(&dev))
  50. ;
  51. }
  52. }