From b2de1a336855a4900245c7951c938e314f68b897 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Wed, 5 Jul 2023 12:15:51 +0200 Subject: soc/amd/*/root_complex.c: Use newer function for resource declarations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Arthur Heymans Change-Id: If2048c9cade731b2e4464d0670e0578f5f4bcea0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/76291 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held Reviewed-by: Kyösti Mälkki --- src/soc/amd/cezanne/root_complex.c | 19 ++++++++----------- src/soc/amd/glinda/root_complex.c | 19 ++++++++----------- src/soc/amd/mendocino/root_complex.c | 19 ++++++++----------- src/soc/amd/phoenix/root_complex.c | 19 ++++++++----------- src/soc/amd/picasso/root_complex.c | 19 ++++++++----------- 5 files changed, 40 insertions(+), 55 deletions(-) (limited to 'src/soc') diff --git a/src/soc/amd/cezanne/root_complex.c b/src/soc/amd/cezanne/root_complex.c index 848392213b..b6a28d40ee 100644 --- a/src/soc/amd/cezanne/root_complex.c +++ b/src/soc/amd/cezanne/root_complex.c @@ -120,28 +120,25 @@ static void read_resources(struct device *dev) fixed_io_range_reserved(dev, idx++, PCI_IO_CONFIG_INDEX, PCI_IO_CONFIG_PORT_COUNT); /* 0x0 - 0x9ffff */ - ram_resource_kb(dev, idx++, 0, 0xa0000 / KiB); + ram_range(dev, idx++, 0, 0xa0000); /* 0xa0000 - 0xbffff: legacy VGA */ - mmio_resource_kb(dev, idx++, VGA_MMIO_BASE / KiB, VGA_MMIO_SIZE / KiB); + mmio_range(dev, idx++, VGA_MMIO_BASE, VGA_MMIO_SIZE); /* 0xc0000 - 0xfffff: Option ROM */ - reserved_ram_resource_kb(dev, idx++, 0xc0000 / KiB, 0x40000 / KiB); + reserved_ram_from_to(dev, idx++, 0xc0000, 1 * MiB); /* 1MiB - bottom of DRAM reserved for early coreboot usage */ - ram_resource_kb(dev, idx++, (1 * MiB) / KiB, - (early_reserved_dram_start - (1 * MiB)) / KiB); + ram_from_to(dev, idx++, 1 * MiB, early_reserved_dram_start); /* DRAM reserved for early coreboot usage */ - reserved_ram_resource_kb(dev, idx++, early_reserved_dram_start / KiB, - (early_reserved_dram_end - early_reserved_dram_start) / KiB); + reserved_ram_from_to(dev, idx++, early_reserved_dram_start, early_reserved_dram_end); /* * top of DRAM consumed early - low top usable RAM * cbmem_top() accounts for low UMA and TSEG if they are used. */ - ram_resource_kb(dev, idx++, early_reserved_dram_end / KiB, - (mem_usable - early_reserved_dram_end) / KiB); + ram_from_to(dev, idx++, early_reserved_dram_end, mem_usable); mmconf_resource(dev, idx++); @@ -164,9 +161,9 @@ static void read_resources(struct device *dev) continue; /* Done separately */ if (res->type == EFI_RESOURCE_SYSTEM_MEMORY) - ram_resource_kb(dev, idx++, res->addr / KiB, res->length / KiB); + ram_range(dev, idx++, res->addr, res->length); else if (res->type == EFI_RESOURCE_MEMORY_RESERVED) - reserved_ram_resource_kb(dev, idx++, res->addr / KiB, res->length / KiB); + reserved_ram_range(dev, idx++, res->addr, res->length); else printk(BIOS_ERR, "failed to set resources for type %d\n", res->type); diff --git a/src/soc/amd/glinda/root_complex.c b/src/soc/amd/glinda/root_complex.c index 470dd49406..4e6eaeda95 100644 --- a/src/soc/amd/glinda/root_complex.c +++ b/src/soc/amd/glinda/root_complex.c @@ -135,28 +135,25 @@ static void read_resources(struct device *dev) fixed_io_range_reserved(dev, idx++, PCI_IO_CONFIG_INDEX, PCI_IO_CONFIG_PORT_COUNT); /* 0x0 - 0x9ffff */ - ram_resource_kb(dev, idx++, 0, 0xa0000 / KiB); + ram_range(dev, idx++, 0, 0xa0000); /* 0xa0000 - 0xbffff: legacy VGA */ - mmio_resource_kb(dev, idx++, VGA_MMIO_BASE / KiB, VGA_MMIO_SIZE / KiB); + mmio_range(dev, idx++, VGA_MMIO_BASE, VGA_MMIO_SIZE); /* 0xc0000 - 0xfffff: Option ROM */ - reserved_ram_resource_kb(dev, idx++, 0xc0000 / KiB, 0x40000 / KiB); + reserved_ram_from_to(dev, idx++, 0xc0000, 1 * MiB); /* 1MiB - bottom of DRAM reserved for early coreboot usage */ - ram_resource_kb(dev, idx++, (1 * MiB) / KiB, - (early_reserved_dram_start - (1 * MiB)) / KiB); + ram_from_to(dev, idx++, 1 * MiB, early_reserved_dram_start); /* DRAM reserved for early coreboot usage */ - reserved_ram_resource_kb(dev, idx++, early_reserved_dram_start / KiB, - (early_reserved_dram_end - early_reserved_dram_start) / KiB); + reserved_ram_from_to(dev, idx++, early_reserved_dram_start, early_reserved_dram_end); /* * top of DRAM consumed early - low top usable RAM * cbmem_top() accounts for low UMA and TSEG if they are used. */ - ram_resource_kb(dev, idx++, early_reserved_dram_end / KiB, - (mem_usable - early_reserved_dram_end) / KiB); + ram_from_to(dev, idx++, early_reserved_dram_end, mem_usable); mmconf_resource(dev, idx++); @@ -179,9 +176,9 @@ static void read_resources(struct device *dev) continue; /* Done separately */ if (res->type == EFI_RESOURCE_SYSTEM_MEMORY) - ram_resource_kb(dev, idx++, res->addr / KiB, res->length / KiB); + ram_range(dev, idx++, res->addr, res->length); else if (res->type == EFI_RESOURCE_MEMORY_RESERVED) - reserved_ram_resource_kb(dev, idx++, res->addr / KiB, res->length / KiB); + reserved_ram_range(dev, idx++, res->addr, res->length); else printk(BIOS_ERR, "Failed to set resources for type %d\n", res->type); diff --git a/src/soc/amd/mendocino/root_complex.c b/src/soc/amd/mendocino/root_complex.c index 5e1e11a431..cc21592e9e 100644 --- a/src/soc/amd/mendocino/root_complex.c +++ b/src/soc/amd/mendocino/root_complex.c @@ -163,28 +163,25 @@ static void read_resources(struct device *dev) fixed_io_range_reserved(dev, idx++, PCI_IO_CONFIG_INDEX, PCI_IO_CONFIG_PORT_COUNT); /* 0x0 - 0x9ffff */ - ram_resource_kb(dev, idx++, 0, 0xa0000 / KiB); + ram_range(dev, idx++, 0, 0xa0000); /* 0xa0000 - 0xbffff: legacy VGA */ - mmio_resource_kb(dev, idx++, VGA_MMIO_BASE / KiB, VGA_MMIO_SIZE / KiB); + mmio_range(dev, idx++, VGA_MMIO_BASE, VGA_MMIO_SIZE); /* 0xc0000 - 0xfffff: Option ROM */ - reserved_ram_resource_kb(dev, idx++, 0xc0000 / KiB, 0x40000 / KiB); + reserved_ram_from_to(dev, idx++, 0xc0000, 1 * MiB); /* 1MiB - bottom of DRAM reserved for early coreboot usage */ - ram_resource_kb(dev, idx++, (1 * MiB) / KiB, - (early_reserved_dram_start - (1 * MiB)) / KiB); + ram_from_to(dev, idx++, 1 * MiB, early_reserved_dram_start); /* DRAM reserved for early coreboot usage */ - reserved_ram_resource_kb(dev, idx++, early_reserved_dram_start / KiB, - (early_reserved_dram_end - early_reserved_dram_start) / KiB); + reserved_ram_from_to(dev, idx++, early_reserved_dram_start, early_reserved_dram_end); /* * top of DRAM consumed early - low top usable RAM * cbmem_top() accounts for low UMA and TSEG if they are used. */ - ram_resource_kb(dev, idx++, early_reserved_dram_end / KiB, - (mem_usable - early_reserved_dram_end) / KiB); + ram_from_to(dev, idx++, early_reserved_dram_end, mem_usable); mmconf_resource(dev, idx++); @@ -207,9 +204,9 @@ static void read_resources(struct device *dev) continue; /* Done separately */ if (res->type == EFI_RESOURCE_SYSTEM_MEMORY) - ram_resource_kb(dev, idx++, res->addr / KiB, res->length / KiB); + ram_range(dev, idx++, res->addr, res->length); else if (res->type == EFI_RESOURCE_MEMORY_RESERVED) - reserved_ram_resource_kb(dev, idx++, res->addr / KiB, res->length / KiB); + reserved_ram_range(dev, idx++, res->addr, res->length); else printk(BIOS_ERR, "Failed to set resources for type %d\n", res->type); diff --git a/src/soc/amd/phoenix/root_complex.c b/src/soc/amd/phoenix/root_complex.c index 999df58dcd..58a9a4fe47 100644 --- a/src/soc/amd/phoenix/root_complex.c +++ b/src/soc/amd/phoenix/root_complex.c @@ -135,28 +135,25 @@ static void read_resources(struct device *dev) fixed_io_range_reserved(dev, idx++, PCI_IO_CONFIG_INDEX, PCI_IO_CONFIG_PORT_COUNT); /* 0x0 - 0x9ffff */ - ram_resource_kb(dev, idx++, 0, 0xa0000 / KiB); + ram_range(dev, idx++, 0, 0xa0000); /* 0xa0000 - 0xbffff: legacy VGA */ - mmio_resource_kb(dev, idx++, VGA_MMIO_BASE / KiB, VGA_MMIO_SIZE / KiB); + mmio_range(dev, idx++, VGA_MMIO_BASE, VGA_MMIO_SIZE); /* 0xc0000 - 0xfffff: Option ROM */ - reserved_ram_resource_kb(dev, idx++, 0xc0000 / KiB, 0x40000 / KiB); + reserved_ram_from_to(dev, idx++, 0xc0000, 1 * MiB); /* 1MiB - bottom of DRAM reserved for early coreboot usage */ - ram_resource_kb(dev, idx++, (1 * MiB) / KiB, - (early_reserved_dram_start - (1 * MiB)) / KiB); + ram_from_to(dev, idx++, 1 * MiB, early_reserved_dram_start); /* DRAM reserved for early coreboot usage */ - reserved_ram_resource_kb(dev, idx++, early_reserved_dram_start / KiB, - (early_reserved_dram_end - early_reserved_dram_start) / KiB); + reserved_ram_from_to(dev, idx++, early_reserved_dram_start, early_reserved_dram_end); /* * top of DRAM consumed early - low top usable RAM * cbmem_top() accounts for low UMA and TSEG if they are used. */ - ram_resource_kb(dev, idx++, early_reserved_dram_end / KiB, - (mem_usable - early_reserved_dram_end) / KiB); + ram_from_to(dev, idx++, early_reserved_dram_end, mem_usable); mmconf_resource(dev, idx++); @@ -179,9 +176,9 @@ static void read_resources(struct device *dev) continue; /* Done separately */ if (res->type == EFI_RESOURCE_SYSTEM_MEMORY) - ram_resource_kb(dev, idx++, res->addr / KiB, res->length / KiB); + ram_range(dev, idx++, res->addr, res->length); else if (res->type == EFI_RESOURCE_MEMORY_RESERVED) - reserved_ram_resource_kb(dev, idx++, res->addr / KiB, res->length / KiB); + reserved_ram_range(dev, idx++, res->addr, res->length); else printk(BIOS_ERR, "Failed to set resources for type %d\n", res->type); diff --git a/src/soc/amd/picasso/root_complex.c b/src/soc/amd/picasso/root_complex.c index 27f2fcf927..526c7cf48d 100644 --- a/src/soc/amd/picasso/root_complex.c +++ b/src/soc/amd/picasso/root_complex.c @@ -120,26 +120,23 @@ static void read_resources(struct device *dev) fixed_io_range_reserved(dev, idx++, PCI_IO_CONFIG_INDEX, PCI_IO_CONFIG_PORT_COUNT); /* 0x0 - 0x9ffff */ - ram_resource_kb(dev, idx++, 0, 0xa0000 / KiB); + ram_range(dev, idx++, 0, 0xa0000); /* 0xa0000 - 0xbffff: legacy VGA */ - mmio_resource_kb(dev, idx++, VGA_MMIO_BASE / KiB, VGA_MMIO_SIZE / KiB); + mmio_range(dev, idx++, VGA_MMIO_BASE, VGA_MMIO_SIZE); /* 0xc0000 - 0xfffff: Option ROM */ - reserved_ram_resource_kb(dev, idx++, 0xc0000 / KiB, 0x40000 / KiB); + reserved_ram_from_to(dev, idx++, 0xc0000, 1 * MiB); /* 1MB - bottom of DRAM reserved for early coreboot usage */ - ram_resource_kb(dev, idx++, (1 * MiB) / KiB, - (early_reserved_dram_start - (1 * MiB)) / KiB); + ram_from_to(dev, idx++, 1 * MiB, early_reserved_dram_start); /* DRAM reserved for early coreboot usage */ - reserved_ram_resource_kb(dev, idx++, early_reserved_dram_start / KiB, - (early_reserved_dram_end - early_reserved_dram_start) / KiB); + reserved_ram_from_to(dev, idx++, early_reserved_dram_start, early_reserved_dram_end); /* top of DRAM consumed early - low top usable RAM * cbmem_top() accounts for low UMA and TSEG if they are used. */ - ram_resource_kb(dev, idx++, early_reserved_dram_end / KiB, - (mem_usable - early_reserved_dram_end) / KiB); + ram_from_to(dev, idx++, early_reserved_dram_end, mem_usable); mmconf_resource(dev, idx++); @@ -161,9 +158,9 @@ static void read_resources(struct device *dev) continue; /* Done separately */ if (res->type == EFI_RESOURCE_SYSTEM_MEMORY) - ram_resource_kb(dev, idx++, res->addr / KiB, res->length / KiB); + ram_range(dev, idx++, res->addr, res->length); else if (res->type == EFI_RESOURCE_MEMORY_RESERVED) - reserved_ram_resource_kb(dev, idx++, res->addr / KiB, res->length / KiB); + reserved_ram_range(dev, idx++, res->addr, res->length); else printk(BIOS_ERR, "failed to set resources for type %d\n", res->type); -- cgit v1.2.3