nb/amd/pi/00730F01/northbridge: simplify domain_read_resources

This APU is always a single-node, so domain_read_resources only needs to
handle exactly one node and doesn't need to loop over the nodes.

TEST=PC Engines APU2 still boots and doesn't show any new problems

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I4218077cb4e11b762ce0e8694a97bdec33eaa056
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79605
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Felix Held 2023-11-17 17:23:47 +01:00
parent 606e5636c2
commit ce8dfc51ec

View file

@ -614,7 +614,7 @@ static struct hw_mem_hole_info get_hw_mem_hole_info(void)
static void domain_read_resources(struct device *dev) static void domain_read_resources(struct device *dev)
{ {
unsigned long mmio_basek; unsigned long mmio_basek;
int i, idx; int idx;
#if CONFIG_HW_MEM_HOLE_SIZEK != 0 #if CONFIG_HW_MEM_HOLE_SIZEK != 0
struct hw_mem_hole_info mem_hole; struct hw_mem_hole_info mem_hole;
#endif #endif
@ -640,27 +640,23 @@ static void domain_read_resources(struct device *dev)
#endif #endif
idx = 0x10; idx = 0x10;
for (i = 0; i < get_node_nums(); i++) { resource_t basek, limitk, sizek;
resource_t basek, limitk, sizek; // 4 1T if (get_dram_base_limit(0, &basek, &limitk)) {
if (!get_dram_base_limit(i, &basek, &limitk))
continue; // no memory on this node
sizek = limitk - basek; sizek = limitk - basek;
printk(BIOS_DEBUG, "node %d: basek=%08llx, limitk=%08llx, sizek=%08llx,\n", printk(BIOS_DEBUG, "basek=%08llx, limitk=%08llx, sizek=%08llx,\n",
i, basek, limitk, sizek); basek, limitk, sizek);
/* See if we need a hole from 0xa0000 (640K) to 0xfffff (1024K) */ /* See if we need a hole from 0xa0000 (640K) to 0xfffff (1024K) */
if (basek < 640 && sizek > 1024) { if (basek < 640 && sizek > 1024) {
ram_resource_kb(dev, (idx | i), basek, 640 - basek); ram_resource_kb(dev, idx, basek, 640 - basek);
idx += 0x10; idx += 0x10;
basek = 1024; basek = 1024;
sizek = limitk - basek; sizek = limitk - basek;
} }
printk(BIOS_DEBUG, "node %d: basek=%08llx, limitk=%08llx, sizek=%08llx,\n", printk(BIOS_DEBUG, "basek=%08llx, limitk=%08llx, sizek=%08llx,\n",
i, basek, limitk, sizek); basek, limitk, sizek);
/* split the region to accommodate pci memory space */ /* split the region to accommodate pci memory space */
if ((basek < 4 * 1024 * 1024) && (limitk > mmio_basek)) { if ((basek < 4 * 1024 * 1024) && (limitk > mmio_basek)) {
@ -668,7 +664,7 @@ static void domain_read_resources(struct device *dev)
unsigned int pre_sizek; unsigned int pre_sizek;
pre_sizek = mmio_basek - basek; pre_sizek = mmio_basek - basek;
if (pre_sizek > 0) { if (pre_sizek > 0) {
ram_resource_kb(dev, (idx | i), basek, pre_sizek); ram_resource_kb(dev, idx, basek, pre_sizek);
idx += 0x10; idx += 0x10;
sizek -= pre_sizek; sizek -= pre_sizek;
} }
@ -684,10 +680,10 @@ static void domain_read_resources(struct device *dev)
} }
} }
ram_resource_kb(dev, (idx | i), basek, sizek); ram_resource_kb(dev, idx, basek, sizek);
idx += 0x10; idx += 0x10;
printk(BIOS_DEBUG, "node %d: mmio_basek=%08lx, basek=%08llx, limitk=%08llx\n", printk(BIOS_DEBUG, "mmio_basek=%08lx, basek=%08llx, limitk=%08llx\n",
i, mmio_basek, basek, limitk); mmio_basek, basek, limitk);
} }
add_uma_resource_below_tolm(dev, 7); add_uma_resource_below_tolm(dev, 7);