summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-03-08 11:23:52 -0600
committerAaron Durbin <adurbin@chromium.org>2016-03-09 16:47:40 +0100
commit0fcd6f912ba53ef1fc6327143c07727a556a718a (patch)
treefe11ec57cde33cf42d20d45d679a39c761701bf9
parent9b28f0023cc6bf71d500132f8cdf5b0a7193a580 (diff)
drivers/intel/fsp2_0: remove struct resource usage
There's no need to use a struct resource type for fsp_find_reserved_memory(). struct resource is mainly associated with a device and that memory is added to cbmem after memory init. Other uses ins FSP 2.0 just use struct range_entry. Use that instead for consistency. Change-Id: Id7d39da1c2e23f97cdaafd7f5d281cefa6fee543 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/13960 Tested-by: build bot (Jenkins) Reviewed-by: Andrey Petrov <andrey.petrov@intel.com>
-rw-r--r--src/drivers/intel/fsp2_0/hand_off_block.c7
-rw-r--r--src/drivers/intel/fsp2_0/include/fsp/util.h3
-rw-r--r--src/soc/intel/apollolake/romstage.c13
3 files changed, 10 insertions, 13 deletions
diff --git a/src/drivers/intel/fsp2_0/hand_off_block.c b/src/drivers/intel/fsp2_0/hand_off_block.c
index 3bc33afccf..c1f8f10fed 100644
--- a/src/drivers/intel/fsp2_0/hand_off_block.c
+++ b/src/drivers/intel/fsp2_0/hand_off_block.c
@@ -208,11 +208,11 @@ struct hob_resource *find_resource_hob_by_uuid(const struct hob_header *hob,
return NULL;
}
-void fsp_find_reserved_memory(struct resource *res, const void *hob_list)
+void fsp_find_reserved_memory(struct range_entry *re, const void *hob_list)
{
const struct hob_resource *fsp_mem;
- memset(res, 0, sizeof(*res));
+ range_entry_init(re, 0, 0, 0);
fsp_mem = find_resource_hob_by_uuid(hob_list, uuid_owner_fsp);
@@ -220,8 +220,7 @@ void fsp_find_reserved_memory(struct resource *res, const void *hob_list)
return;
}
- res->base = fsp_mem->addr;
- res->size = fsp_mem->length;
+ range_entry_init(re, fsp_mem->addr, fsp_mem->addr + fsp_mem->length, 0);
}
/*
diff --git a/src/drivers/intel/fsp2_0/include/fsp/util.h b/src/drivers/intel/fsp2_0/include/fsp/util.h
index 69e545ee0e..0bdcd79dd4 100644
--- a/src/drivers/intel/fsp2_0/include/fsp/util.h
+++ b/src/drivers/intel/fsp2_0/include/fsp/util.h
@@ -15,7 +15,6 @@
#include <boot/coreboot_tables.h>
#include <fsp/info_header.h>
-#include <device/resource.h>
#include <memrange.h>
/*
@@ -30,7 +29,7 @@ enum cb_err fsp_fill_lb_framebuffer(struct lb_framebuffer *framebuffer);
* Hand-off-block utilities which do not depend on CBMEM, but need to be passed
* the HOB list explicitly.
*/
-void fsp_find_reserved_memory(struct resource *res, const void *hob_list);
+void fsp_find_reserved_memory(struct range_entry *re, const void *hob_list);
void fsp_print_memory_resource_hobs(const void *hob_list);
/* Load an FSP binary into CBFS, and fill the associated fsp_header struct */
diff --git a/src/soc/intel/apollolake/romstage.c b/src/soc/intel/apollolake/romstage.c
index 29a966e641..2c8bbe80c9 100644
--- a/src/soc/intel/apollolake/romstage.c
+++ b/src/soc/intel/apollolake/romstage.c
@@ -75,11 +75,10 @@ static void disable_watchdog(void)
outl(reg, ACPI_PMIO_BASE + 0x68);
}
-
asmlinkage void car_stage_entry(void)
{
void *hob_list_ptr;
- struct resource fsp_mem;
+ struct range_entry fsp_mem;
struct range_entry reg_car;
printk(BIOS_DEBUG, "Starting romstage...\n");
@@ -89,9 +88,8 @@ asmlinkage void car_stage_entry(void)
soc_early_romstage_init();
/* Make sure the blob does not override our data in CAR */
- memset(&reg_car, 0, sizeof(reg_car));
- reg_car.begin = (uintptr_t) _car_relocatable_data_end;
- reg_car.end = (uintptr_t) _car_region_end;
+ range_entry_init(&reg_car, (uintptr_t)_car_relocatable_data_end,
+ (uintptr_t)_car_region_end, 0);
if (fsp_memory_init(&hob_list_ptr, &reg_car) != FSP_SUCCESS) {
die("FSP memory init failed. Giving up.");
@@ -101,10 +99,11 @@ asmlinkage void car_stage_entry(void)
/* initialize cbmem by adding FSP reserved memory first thing */
cbmem_initialize_empty_id_size(CBMEM_ID_FSP_RESERVED_MEMORY,
- fsp_mem.size);
+ range_entry_size(&fsp_mem));
/* make sure FSP memory is reserved in cbmem */
- if (fsp_mem.base != (uintptr_t)cbmem_find(CBMEM_ID_FSP_RESERVED_MEMORY))
+ if (range_entry_base(&fsp_mem) !=
+ (uintptr_t)cbmem_find(CBMEM_ID_FSP_RESERVED_MEMORY))
die("Failed to accommodate FSP reserved memory request");
/* Now that CBMEM is up, save the list so ramstage can use it */