From e3aa424a4f53b8ac4c658a3cf33b7b52971599b3 Mon Sep 17 00:00:00 2001 From: Marshall Dawson Date: Wed, 16 Oct 2019 21:53:21 -0600 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/36110 Reviewed-by: Martin Roth Tested-by: build bot (Jenkins) --- src/drivers/intel/fsp2_0/memory_init.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c index a075f01879..e7ddb15aa2 100644 --- a/src/drivers/intel/fsp2_0/memory_init.c +++ b/src/drivers/intel/fsp2_0/memory_init.c @@ -390,7 +390,7 @@ void fsp_memory_init(bool s3wake) struct region_device file_data; const char *name = CONFIG_FSP_M_CBFS; struct memranges memmap; - struct range_entry freeranges[2]; + struct range_entry prog_ranges[2]; elog_boot_notify(s3wake); @@ -402,9 +402,10 @@ void fsp_memory_init(bool s3wake) cbfs_file_data(&file_data, &file_desc); /* Build up memory map of romstage address space including CAR. */ - memranges_init_empty(&memmap, &freeranges[0], ARRAY_SIZE(freeranges)); - memranges_insert(&memmap, (uintptr_t)_car_region_start, - _car_unallocated_start - _car_region_start, 0); + memranges_init_empty(&memmap, &prog_ranges[0], ARRAY_SIZE(prog_ranges)); + if (ENV_CACHE_AS_RAM) + memranges_insert(&memmap, (uintptr_t)_car_region_start, + _car_unallocated_start - _car_region_start, 0); memranges_insert(&memmap, (uintptr_t)_program, REGION_SIZE(program), 0); if (!CONFIG(FSP_M_XIP)) -- cgit v1.2.3