From c37fd87d8596b067cbf5d935d807218fa0b27442 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Thu, 13 Oct 2022 13:06:24 +0200 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68406 Reviewed-by: Paul Menzel Tested-by: build bot (Jenkins) Reviewed-by: Marc Jones Reviewed-by: Angel Pons --- src/soc/intel/common/block/systemagent/systemagent.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src/soc') diff --git a/src/soc/intel/common/block/systemagent/systemagent.c b/src/soc/intel/common/block/systemagent/systemagent.c index dbc52c52b2..1938765b84 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_get_mem_map(struct device *dev, uint64_t *values) */ 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 @@ static void sa_add_dram_resources(struct device *dev, int *resource_count) 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 @@ static void sa_add_dram_resources(struct device *dev, int *resource_count) * 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; } -- cgit v1.2.3