blob: 9efe959d4d8736cecf372077d9df295dc9003c01 [file] [log] [blame]
Raul E Rangel899be1b2021-02-05 15:50:20 -07001/* 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
8void 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
21const 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}