Raul E Rangel | 899be1b | 2021-02-05 15:50:20 -0700 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <stdint.h> |
| 4 | #include <console/console.h> |
| 5 | #include <cbmem.h> |
| 6 | #include <amdblocks/memmap.h> |
| 7 | |
| 8 | void memmap_stash_early_dram_usage(void) |
| 9 | { |
| 10 | struct memmap_early_dram *e; |
| 11 | |
| 12 | e = cbmem_add(CBMEM_ID_CB_EARLY_DRAM, sizeof(*e)); |
| 13 | |
| 14 | if (!e) |
| 15 | die("ERROR: Failed to stash early dram usage!\n"); |
| 16 | |
| 17 | e->base = (uint32_t)(uintptr_t)_early_reserved_dram; |
| 18 | e->size = REGION_SIZE(early_reserved_dram); |
| 19 | } |
| 20 | |
| 21 | const struct memmap_early_dram *memmap_get_early_dram_usage(void) |
| 22 | { |
| 23 | struct memmap_early_dram *e = cbmem_find(CBMEM_ID_CB_EARLY_DRAM); |
| 24 | |
| 25 | if (!e) |
| 26 | die("ERROR: Failed to read early dram usage!\n"); |
| 27 | |
| 28 | return e; |
| 29 | } |