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>
This commit is contained in:
parent
9c2f3cc9d9
commit
c37fd87d85
|
@ -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)
|
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];
|
uint64_t sa_map_values[MAX_MAP_ENTRIES];
|
||||||
uintptr_t top_of_ram;
|
uintptr_t top_of_ram;
|
||||||
int index = *resource_count;
|
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();
|
top_of_ram = (uintptr_t)cbmem_top();
|
||||||
|
|
||||||
/* 0 - > 0xa0000 */
|
/* 0 - > 0xa0000 */
|
||||||
base_k = 0;
|
ram_from_to(dev, index++, 0, 0xa0000);
|
||||||
size_k = (0xa0000 / KiB) - base_k;
|
|
||||||
ram_resource_kb(dev, index++, base_k, size_k);
|
|
||||||
|
|
||||||
/* 0xc0000 -> top_of_ram */
|
/* 0xc0000 -> top_of_ram */
|
||||||
base_k = 0xc0000 / KiB;
|
ram_from_to(dev, index++, 0xc0000, top_of_ram);
|
||||||
size_k = (top_of_ram / KiB) - base_k;
|
|
||||||
ram_resource_kb(dev, index++, base_k, size_k);
|
|
||||||
|
|
||||||
sa_get_mem_map(dev, &sa_map_values[0]);
|
sa_get_mem_map(dev, &sa_map_values[0]);
|
||||||
|
|
||||||
/* top_of_ram -> TOLUD */
|
/* top_of_ram -> TOLUD */
|
||||||
base_k = top_of_ram;
|
reserved_ram_from_to(dev, index++, top_of_ram, sa_map_values[SA_TOLUD_REG]);
|
||||||
size_k = sa_map_values[SA_TOLUD_REG] - base_k;
|
|
||||||
reserved_ram_resource_kb(dev, index++, base_k / KiB, size_k / KiB);
|
|
||||||
|
|
||||||
/* 4GiB -> TOUUD */
|
/* 4GiB -> TOUUD */
|
||||||
upper_ram_end(dev, index++, sa_map_values[SA_TOUUD_REG]);
|
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
|
* 0xa0000 - 0xbffff: legacy VGA
|
||||||
* 0xc0000 - 0xfffff: RAM
|
* 0xc0000 - 0xfffff: RAM
|
||||||
*/
|
*/
|
||||||
mmio_resource_kb(dev, index++, 0xa0000 / KiB, (0xc0000 - 0xa0000) / KiB);
|
mmio_from_to(dev, index++, 0xa0000, 0xc0000);
|
||||||
reserved_ram_resource_kb(dev, index++, 0xc0000 / KiB,
|
reserved_ram_from_to(dev, index++, 0xc0000, 1 * MiB);
|
||||||
(1*MiB - 0xc0000) / KiB);
|
|
||||||
|
|
||||||
*resource_count = index;
|
*resource_count = index;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue