Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 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 | |
Simon Glass | b711ef7 | 2024-08-21 10:19:13 -0600 | [diff] [blame] | 8 | #include <bloblist.h> |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 9 | #include <handoff.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 10 | #include <asm/global_data.h> |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 11 | |
| 12 | DECLARE_GLOBAL_DATA_PTR; |
| 13 | |
| 14 | void handoff_save_dram(struct spl_handoff *ho) |
| 15 | { |
Stefan Roese | bbc8846 | 2020-08-12 11:55:46 +0200 | [diff] [blame] | 16 | struct bd_info *bd = gd->bd; |
| 17 | int i; |
| 18 | |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 19 | ho->ram_size = gd->ram_size; |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 20 | |
Stefan Roese | bbc8846 | 2020-08-12 11:55:46 +0200 | [diff] [blame] | 21 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { |
| 22 | ho->ram_bank[i].start = bd->bi_dram[i].start; |
| 23 | ho->ram_bank[i].size = bd->bi_dram[i].size; |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 24 | } |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | void handoff_load_dram_size(struct spl_handoff *ho) |
| 28 | { |
| 29 | gd->ram_size = ho->ram_size; |
| 30 | } |
| 31 | |
| 32 | void handoff_load_dram_banks(struct spl_handoff *ho) |
| 33 | { |
Stefan Roese | bbc8846 | 2020-08-12 11:55:46 +0200 | [diff] [blame] | 34 | struct bd_info *bd = gd->bd; |
| 35 | int i; |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 36 | |
Stefan Roese | bbc8846 | 2020-08-12 11:55:46 +0200 | [diff] [blame] | 37 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { |
| 38 | bd->bi_dram[i].start = ho->ram_bank[i].start; |
| 39 | bd->bi_dram[i].size = ho->ram_bank[i].size; |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 40 | } |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 41 | } |
Simon Glass | b711ef7 | 2024-08-21 10:19:13 -0600 | [diff] [blame] | 42 | |
| 43 | struct spl_handoff *handoff_get(void) |
| 44 | { |
| 45 | struct spl_handoff *handoff; |
| 46 | |
| 47 | handoff = bloblist_find(BLOBLISTT_U_BOOT_SPL_HANDOFF, |
| 48 | sizeof(struct spl_handoff)); |
| 49 | debug("Found SPL hand-off info %p\n", handoff); |
| 50 | |
| 51 | return handoff; |
| 52 | } |