handoff.c 821 B

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