Martin L Roth has submitted this change. ( https://review.coreboot.org/c/coreboot/+/68406 )
Change subject: soc/intel/systemagent: Rewrite using new resource API ......................................................................
soc/intel/systemagent: Rewrite using new resource API
Working with resources in KB is tedious and the base_k / size_k variable naming was simply wrong in one case.
Change-Id: Ic5df054e714d06c9003752ed49dc704554e7b904 Signed-off-by: Arthur Heymans arthur@aheymans.xyz Reviewed-on: https://review.coreboot.org/c/coreboot/+/68406 Reviewed-by: Paul Menzel paulepanter@mailbox.org Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Marc Jones marc@marcjonesconsulting.com Reviewed-by: Angel Pons th3fanbus@gmail.com --- M src/soc/intel/common/block/systemagent/systemagent.c 1 file changed, 23 insertions(+), 14 deletions(-)
Approvals: build bot (Jenkins): Verified Marc Jones: Looks good to me, approved Paul Menzel: Looks good to me, but someone else must approve Angel Pons: Looks good to me, approved
diff --git a/src/soc/intel/common/block/systemagent/systemagent.c b/src/soc/intel/common/block/systemagent/systemagent.c index dbc52c5..1938765 100644 --- a/src/soc/intel/common/block/systemagent/systemagent.c +++ b/src/soc/intel/common/block/systemagent/systemagent.c @@ -187,8 +187,6 @@ */ static void sa_add_dram_resources(struct device *dev, int *resource_count) { - uintptr_t base_k; - size_t size_k; uint64_t sa_map_values[MAX_MAP_ENTRIES]; uintptr_t top_of_ram; int index = *resource_count; @@ -196,21 +194,15 @@ top_of_ram = (uintptr_t)cbmem_top();
/* 0 - > 0xa0000 */ - base_k = 0; - size_k = (0xa0000 / KiB) - base_k; - ram_resource_kb(dev, index++, base_k, size_k); + ram_from_to(dev, index++, 0, 0xa0000);
/* 0xc0000 -> top_of_ram */ - base_k = 0xc0000 / KiB; - size_k = (top_of_ram / KiB) - base_k; - ram_resource_kb(dev, index++, base_k, size_k); + ram_from_to(dev, index++, 0xc0000, top_of_ram);
sa_get_mem_map(dev, &sa_map_values[0]);
/* top_of_ram -> TOLUD */ - base_k = top_of_ram; - size_k = sa_map_values[SA_TOLUD_REG] - base_k; - reserved_ram_resource_kb(dev, index++, base_k / KiB, size_k / KiB); + reserved_ram_from_to(dev, index++, top_of_ram, sa_map_values[SA_TOLUD_REG]);
/* 4GiB -> TOUUD */ upper_ram_end(dev, index++, sa_map_values[SA_TOUUD_REG]); @@ -221,9 +213,8 @@ * 0xa0000 - 0xbffff: legacy VGA * 0xc0000 - 0xfffff: RAM */ - mmio_resource_kb(dev, index++, 0xa0000 / KiB, (0xc0000 - 0xa0000) / KiB); - reserved_ram_resource_kb(dev, index++, 0xc0000 / KiB, - (1*MiB - 0xc0000) / KiB); + mmio_from_to(dev, index++, 0xa0000, 0xc0000); + reserved_ram_from_to(dev, index++, 0xc0000, 1 * MiB);
*resource_count = index; }