drivers/intel/fsp2_0: Add ENV_CACHE_AS_RAM check for consumed ranges

Rename the freeranges array to better match what they represent, i.e.
ranges that are used by the current running program and CAR region that
is not unallocated.

Skip adding the CAR region if cache-as-RAM is not active.

Change-Id: I78ee5536d890f30450a5ad2a753c948b02634d6d
Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/36110
Reviewed-by: Martin Roth <martinroth@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Marshall Dawson 2019-10-16 21:53:21 -06:00 committed by Martin Roth
parent 3edc9e24c3
commit e3aa424a4f
1 changed files with 5 additions and 4 deletions

View File

@ -390,7 +390,7 @@ void fsp_memory_init(bool s3wake)
struct region_device file_data; struct region_device file_data;
const char *name = CONFIG_FSP_M_CBFS; const char *name = CONFIG_FSP_M_CBFS;
struct memranges memmap; struct memranges memmap;
struct range_entry freeranges[2]; struct range_entry prog_ranges[2];
elog_boot_notify(s3wake); elog_boot_notify(s3wake);
@ -402,7 +402,8 @@ void fsp_memory_init(bool s3wake)
cbfs_file_data(&file_data, &file_desc); cbfs_file_data(&file_data, &file_desc);
/* Build up memory map of romstage address space including CAR. */ /* Build up memory map of romstage address space including CAR. */
memranges_init_empty(&memmap, &freeranges[0], ARRAY_SIZE(freeranges)); memranges_init_empty(&memmap, &prog_ranges[0], ARRAY_SIZE(prog_ranges));
if (ENV_CACHE_AS_RAM)
memranges_insert(&memmap, (uintptr_t)_car_region_start, memranges_insert(&memmap, (uintptr_t)_car_region_start,
_car_unallocated_start - _car_region_start, 0); _car_unallocated_start - _car_region_start, 0);
memranges_insert(&memmap, (uintptr_t)_program, REGION_SIZE(program), 0); memranges_insert(&memmap, (uintptr_t)_program, REGION_SIZE(program), 0);