diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2022-10-13 13:06:24 +0200 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2022-10-22 16:46:40 +0000 |
commit | c37fd87d8596b067cbf5d935d807218fa0b27442 (patch) | |
tree | 384cf0f182e48653fea4cedd198a2030b36203c4 /src/soc | |
parent | 9c2f3cc9d9b3b3b7cfe1e62a70ea3061ca6c15ac (diff) |
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>
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/intel/common/block/systemagent/systemagent.c | 19 |
1 files changed, 5 insertions, 14 deletions
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; } |