From 7f19d205944d46483bf414420118b8d937a113ce Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Fri, 1 Dec 2023 15:29:08 +0100 Subject: [PATCH] soc/amd/stoney/northbridge: Remove dead code All the resource on the host bridge are fixed resources and therefore have the IORESOURCE_STORED flag set, so the body of this function which configures IO or MEM ranges is never reached. Signed-off-by: Arthur Heymans Change-Id: I1839f030a4a365e5bc1cdaa3cf37cdf9ca382ff8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/79385 Reviewed-by: Felix Held Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/soc/amd/stoneyridge/northbridge.c | 74 --------------------------- 1 file changed, 74 deletions(-) diff --git a/src/soc/amd/stoneyridge/northbridge.c b/src/soc/amd/stoneyridge/northbridge.c index 1e601cf4b7..ef53b2ed3b 100644 --- a/src/soc/amd/stoneyridge/northbridge.c +++ b/src/soc/amd/stoneyridge/northbridge.c @@ -30,31 +30,6 @@ #include "chip.h" -static void set_io_addr_reg(struct device *dev, u32 nodeid, u32 linkn, u32 reg, - u32 io_min, u32 io_max) -{ - u32 tempreg; - - /* io range allocation. Limit */ - tempreg = (nodeid & 0xf) | ((nodeid & 0x30) << (8 - 4)) | (linkn << 4) - | ((io_max & 0xf0) << (12 - 4)); - pci_write_config32(SOC_ADDR_DEV, reg + 4, tempreg); - tempreg = 3 | ((io_min & 0xf0) << (12 - 4)); /* base: ISA and VGA ? */ - pci_write_config32(SOC_ADDR_DEV, reg, tempreg); -} - -static void set_mmio_addr_reg(u32 nodeid, u32 linkn, u32 reg, u32 index, - u32 mmio_min, u32 mmio_max) -{ - u32 tempreg; - - /* io range allocation. Limit */ - tempreg = (nodeid & 0xf) | (linkn << 4) | (mmio_max & 0xffffff00); - pci_write_config32(SOC_ADDR_DEV, reg + 4, tempreg); - tempreg = 3 | (nodeid & 0x30) | (mmio_min & 0xffffff00); - pci_write_config32(SOC_ADDR_DEV, reg, tempreg); -} - static void read_resources(struct device *dev) { unsigned int idx = 0; @@ -73,50 +48,6 @@ static void read_resources(struct device *dev) mmio_range(dev, idx++, IO_APIC2_ADDR, 0x1000); } -static void set_resource(struct device *dev, struct resource *res, u32 nodeid) -{ - resource_t rbase, rend; - unsigned int reg, link_num; - char buf[50]; - - /* Make certain the resource has actually been set */ - if (!(res->flags & IORESOURCE_ASSIGNED)) - return; - - /* If I have already stored this resource don't worry about it */ - if (res->flags & IORESOURCE_STORED) - return; - - /* Only handle PCI memory and IO resources */ - if (!(res->flags & (IORESOURCE_MEM | IORESOURCE_IO))) - return; - - /* Ensure I am actually looking at a resource of function 1 */ - if ((res->index & 0xffff) < 0x1000) - return; - - /* Get the base address */ - rbase = res->base; - - /* Get the limit (rounded up) */ - rend = resource_end(res); - - /* Get the register and link */ - reg = res->index & 0xfff; /* 4k */ - link_num = IOINDEX_LINK(res->index); - - if (res->flags & IORESOURCE_IO) - set_io_addr_reg(dev, nodeid, link_num, reg, rbase >> 8, rend >> 8); - else if (res->flags & IORESOURCE_MEM) - set_mmio_addr_reg(nodeid, link_num, reg, - (res->index >> 24), rbase >> 8, rend >> 8); - - res->flags |= IORESOURCE_STORED; - snprintf(buf, sizeof(buf), " ", - nodeid, link_num); - report_resource_stored(dev, res, buf); -} - /** * I tried to reuse the resource allocation code in set_resource() * but it is too difficult to deal with the resource allocation magic. @@ -144,15 +75,10 @@ static void create_vga_resource(struct device *dev) static void set_resources(struct device *dev) { struct bus *bus; - struct resource *res; /* do we need this? */ create_vga_resource(dev); - /* Set each resource we have found */ - for (res = dev->resource_list ; res ; res = res->next) - set_resource(dev, res, 0); - for (bus = dev->link_list ; bus ; bus = bus->next) if (bus->children) assign_resources(bus);