diff options
Diffstat (limited to 'src/soc/amd/common')
-rw-r--r-- | src/soc/amd/common/block/cpu/noncar/memmap.c | 37 | ||||
-rw-r--r-- | src/soc/amd/common/block/include/amdblocks/memmap.h | 5 |
2 files changed, 40 insertions, 2 deletions
diff --git a/src/soc/amd/common/block/cpu/noncar/memmap.c b/src/soc/amd/common/block/cpu/noncar/memmap.c index e21cff8a3c..2aaba83039 100644 --- a/src/soc/amd/common/block/cpu/noncar/memmap.c +++ b/src/soc/amd/common/block/cpu/noncar/memmap.c @@ -2,9 +2,11 @@ #include <amdblocks/memmap.h> #include <amdblocks/smm.h> +#include <arch/vga.h> #include <console/console.h> #include <cbmem.h> #include <cpu/x86/smm.h> +#include <device/device.h> #include <memrange.h> #include <types.h> @@ -21,7 +23,7 @@ void memmap_stash_early_dram_usage(void) e->size = REGION_SIZE(early_reserved_dram); } -const struct memmap_early_dram *memmap_get_early_dram_usage(void) +static const struct memmap_early_dram *memmap_get_early_dram_usage(void) { struct memmap_early_dram *e = cbmem_find(CBMEM_ID_CB_EARLY_DRAM); @@ -31,6 +33,39 @@ const struct memmap_early_dram *memmap_get_early_dram_usage(void) return e; } +/* report SoC memory map up to cbmem_top */ +void read_lower_soc_memmap_resources(struct device *dev, unsigned long *idx) +{ + uint32_t mem_usable = (uintptr_t)cbmem_top(); + + uintptr_t early_reserved_dram_start, early_reserved_dram_end; + const struct memmap_early_dram *e = memmap_get_early_dram_usage(); + + early_reserved_dram_start = e->base; + early_reserved_dram_end = e->base + e->size; + + /* 0x0 - 0x9ffff */ + ram_range(dev, (*idx)++, 0, 0xa0000); + + /* 0xa0000 - 0xbffff: legacy VGA */ + mmio_range(dev, (*idx)++, VGA_MMIO_BASE, VGA_MMIO_SIZE); + + /* 0xc0000 - 0xfffff: Option ROM */ + reserved_ram_from_to(dev, (*idx)++, 0xc0000, 1 * MiB); + + /* 1MiB - bottom of DRAM reserved for early coreboot usage */ + ram_from_to(dev, (*idx)++, 1 * MiB, early_reserved_dram_start); + + /* DRAM reserved for early coreboot usage */ + reserved_ram_from_to(dev, (*idx)++, early_reserved_dram_start, early_reserved_dram_end); + + /* + * top of DRAM consumed early - low top usable RAM + * cbmem_top() accounts for low UMA and TSEG if they are used. + */ + ram_from_to(dev, (*idx)++, early_reserved_dram_end, mem_usable); +} + void smm_region(uintptr_t *start, size_t *size) { static int once; diff --git a/src/soc/amd/common/block/include/amdblocks/memmap.h b/src/soc/amd/common/block/include/amdblocks/memmap.h index cc89d86d50..258b8b7d86 100644 --- a/src/soc/amd/common/block/include/amdblocks/memmap.h +++ b/src/soc/amd/common/block/include/amdblocks/memmap.h @@ -3,6 +3,7 @@ #ifndef AMD_BLOCK_MEMMAP_H #define AMD_BLOCK_MEMMAP_H +#include <device/device.h> #include <stdint.h> #include <symbols.h> @@ -15,7 +16,9 @@ struct memmap_early_dram { }; void memmap_stash_early_dram_usage(void); -const struct memmap_early_dram *memmap_get_early_dram_usage(void); + +/* report SoC memory map up to cbmem_top */ +void read_lower_soc_memmap_resources(struct device *dev, unsigned long *idx); void fsp_get_smm_region(uintptr_t *start, size_t *size); |