handoff.c 792 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. struct bd_info *bd = gd->bd;
  13. int i;
  14. ho->ram_size = gd->ram_size;
  15. for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
  16. ho->ram_bank[i].start = bd->bi_dram[i].start;
  17. ho->ram_bank[i].size = bd->bi_dram[i].size;
  18. }
  19. }
  20. void handoff_load_dram_size(struct spl_handoff *ho)
  21. {
  22. gd->ram_size = ho->ram_size;
  23. }
  24. void handoff_load_dram_banks(struct spl_handoff *ho)
  25. {
  26. struct bd_info *bd = gd->bd;
  27. int i;
  28. for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
  29. bd->bi_dram[i].start = ho->ram_bank[i].start;
  30. bd->bi_dram[i].size = ho->ram_bank[i].size;
  31. }
  32. }