nb/amd/pi/00730F01/northbridge: rework idx in domain_read_resources

Start with the resource index 0 and increment it after reporting each
resource.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I6fb59ff3d371b744b53093d17392d1c3510bef82
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79610
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Felix Held 2023-12-17 18:20:01 +01:00
parent 3eaa850c6a
commit dcbb1e8b61
1 changed files with 5 additions and 9 deletions

View File

@ -586,7 +586,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 idx; unsigned long idx = 0;
#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
@ -611,7 +611,6 @@ static void domain_read_resources(struct device *dev)
} }
#endif #endif
idx = 0x10;
resource_t basek, limitk, sizek; resource_t basek, limitk, sizek;
if (get_dram_base_limit(&basek, &limitk)) { if (get_dram_base_limit(&basek, &limitk)) {
sizek = limitk - basek; sizek = limitk - basek;
@ -621,8 +620,7 @@ static void domain_read_resources(struct device *dev)
/* 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, basek, 640 - basek); ram_resource_kb(dev, idx++, basek, 640 - basek);
idx += 0x10;
basek = 1024; basek = 1024;
sizek = limitk - basek; sizek = limitk - basek;
} }
@ -636,8 +634,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, basek, pre_sizek); ram_resource_kb(dev, idx++, basek, pre_sizek);
idx += 0x10;
sizek -= pre_sizek; sizek -= pre_sizek;
} }
basek = mmio_basek; basek = mmio_basek;
@ -652,13 +649,12 @@ static void domain_read_resources(struct device *dev)
} }
} }
ram_resource_kb(dev, idx, basek, sizek); ram_resource_kb(dev, idx++, basek, sizek);
idx += 0x10;
printk(BIOS_DEBUG, "mmio_basek=%08lx, basek=%08llx, limitk=%08llx\n", printk(BIOS_DEBUG, "mmio_basek=%08lx, basek=%08llx, limitk=%08llx\n",
mmio_basek, basek, limitk); mmio_basek, basek, limitk);
} }
add_uma_resource_below_tolm(dev, 7); add_uma_resource_below_tolm(dev, idx++);
} }
static const char *domain_acpi_name(const struct device *dev) static const char *domain_acpi_name(const struct device *dev)