handoff.c 885 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Passing basic information from SPL to U-Boot proper
  4. *
  5. * Copyright 2018 Google, Inc
  6. */
  7. #include <common.h>
  8. #include <handoff.h>
  9. DECLARE_GLOBAL_DATA_PTR;
  10. void handoff_save_dram(struct spl_handoff *ho)
  11. {
  12. ho->ram_size = gd->ram_size;
  13. #ifdef CONFIG_NR_DRAM_BANKS
  14. {
  15. struct bd_info *bd = gd->bd;
  16. int i;
  17. for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
  18. ho->ram_bank[i].start = bd->bi_dram[i].start;
  19. ho->ram_bank[i].size = bd->bi_dram[i].size;
  20. }
  21. }
  22. #endif
  23. }
  24. void handoff_load_dram_size(struct spl_handoff *ho)
  25. {
  26. gd->ram_size = ho->ram_size;
  27. }
  28. void handoff_load_dram_banks(struct spl_handoff *ho)
  29. {
  30. #ifdef CONFIG_NR_DRAM_BANKS
  31. {
  32. struct bd_info *bd = gd->bd;
  33. int i;
  34. for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
  35. bd->bi_dram[i].start = ho->ram_bank[i].start;
  36. bd->bi_dram[i].size = ho->ram_bank[i].size;
  37. }
  38. }
  39. #endif
  40. }