diff --git a/sys/arm/mv/mv_pci.c b/sys/arm/mv/mv_pci.c --- a/sys/arm/mv/mv_pci.c +++ b/sys/arm/mv/mv_pci.c @@ -916,11 +916,9 @@ case SYS_RES_IOPORT: case SYS_RES_MEMORY: break; -#ifdef PCI_RES_BUS case PCI_RES_BUS: return (pci_domain_alloc_bus(sc->ap_segment, child, rid, start, end, count, flags)); -#endif default: return (BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, type, rid, start, end, count, flags)); @@ -944,20 +942,16 @@ mv_pcib_adjust_resource(device_t dev, device_t child, int type, struct resource *r, rman_res_t start, rman_res_t end) { -#ifdef PCI_RES_BUS struct mv_pcib_softc *sc = device_get_softc(dev); -#endif switch (type) { case SYS_RES_IOPORT: case SYS_RES_MEMORY: return (bus_generic_rman_adjust_resource(dev, child, type, r, start, end)); -#ifdef PCI_RES_BUS case PCI_RES_BUS: return (pci_domain_adjust_bus(sc->ap_segment, child, r, start, end)); -#endif default: return (bus_generic_adjust_resource(dev, child, type, r, start, end)); @@ -968,19 +962,15 @@ mv_pcib_release_resource(device_t dev, device_t child, int type, int rid, struct resource *res) { -#ifdef PCI_RES_BUS struct mv_pcib_softc *sc = device_get_softc(dev); -#endif switch (type) { case SYS_RES_IOPORT: case SYS_RES_MEMORY: return (bus_generic_rman_release_resource(dev, child, type, rid, res)); -#ifdef PCI_RES_BUS case PCI_RES_BUS: return (pci_domain_release_bus(sc->ap_segment, child, rid, res)); -#endif default: return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child, type, rid, res)); @@ -991,19 +981,15 @@ mv_pcib_activate_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { -#ifdef PCI_RES_BUS struct mv_pcib_softc *sc = device_get_softc(dev); -#endif switch (type) { case SYS_RES_IOPORT: case SYS_RES_MEMORY: return (bus_generic_rman_activate_resource(dev, child, type, rid, r)); -#ifdef PCI_RES_BUS case PCI_RES_BUS: return (pci_domain_activate_bus(sc->ap_segment, child, rid, r)); -#endif default: return (bus_generic_activate_resource(dev, child, type, rid, r)); @@ -1014,20 +1000,16 @@ mv_pcib_deactivate_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { -#ifdef PCI_RES_BUS struct mv_pcib_softc *sc = device_get_softc(dev); -#endif switch (type) { case SYS_RES_IOPORT: case SYS_RES_MEMORY: return (bus_generic_rman_deactivate_resource(dev, child, type, rid, r)); -#ifdef PCI_RES_BUS case PCI_RES_BUS: return (pci_domain_deactivate_bus(sc->ap_segment, child, rid, r)); -#endif default: return (bus_generic_deactivate_resource(dev, child, type, rid, r)); diff --git a/sys/arm64/cavium/thunder_pcie_pem.c b/sys/arm64/cavium/thunder_pcie_pem.c --- a/sys/arm64/cavium/thunder_pcie_pem.c +++ b/sys/arm64/cavium/thunder_pcie_pem.c @@ -257,16 +257,12 @@ thunder_pem_activate_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { -#if defined(PCI_RES_BUS) struct thunder_pem_softc *sc; sc = device_get_softc(dev); -#endif switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_activate_bus(sc->id, child, rid, r)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_activate_resource(dev, child, type, @@ -281,16 +277,12 @@ thunder_pem_deactivate_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { -#if defined(PCI_RES_BUS) struct thunder_pem_softc *sc; sc = device_get_softc(dev); -#endif switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_deactivate_bus(sc->id, child, rid, r)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_deactivate_resource(dev, child, type, @@ -358,16 +350,12 @@ thunder_pem_adjust_resource(device_t dev, device_t child, int type, struct resource *res, rman_res_t start, rman_res_t end) { -#if defined(PCI_RES_BUS) struct thunder_pem_softc *sc; sc = device_get_softc(dev); -#endif switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_adjust_bus(sc->id, child, res, start, end)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_adjust_resource(dev, child, type, res, @@ -679,11 +667,9 @@ device_t parent_dev; switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_alloc_bus(sc->id, child, rid, start, end, count, flags)); -#endif case SYS_RES_IOPORT: case SYS_RES_MEMORY: break; @@ -727,15 +713,11 @@ struct resource *res) { device_t parent_dev; -#if defined(PCI_RES_BUS) struct thunder_pem_softc *sc = device_get_softc(dev); -#endif switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_release_bus(sc->id, child, rid, res)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_release_resource(dev, child, type, diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c --- a/sys/dev/acpica/acpi_pcib_acpi.c +++ b/sys/dev/acpica/acpi_pcib_acpi.c @@ -96,7 +96,6 @@ static int acpi_pcib_acpi_adjust_resource(device_t dev, device_t child, int type, struct resource *r, rman_res_t start, rman_res_t end); -#ifdef PCI_RES_BUS static int acpi_pcib_acpi_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); @@ -106,7 +105,6 @@ static int acpi_pcib_acpi_deactivate_resource(device_t dev, device_t child, int type, int rid, struct resource *r); -#endif static int acpi_pcib_request_feature(device_t pcib, device_t dev, enum pci_feature feature); static bus_dma_tag_t acpi_pcib_get_dma_tag(device_t bus, device_t child); @@ -124,15 +122,9 @@ DEVMETHOD(bus_write_ivar, acpi_pcib_write_ivar), DEVMETHOD(bus_alloc_resource, acpi_pcib_acpi_alloc_resource), DEVMETHOD(bus_adjust_resource, acpi_pcib_acpi_adjust_resource), -#if defined(PCI_RES_BUS) DEVMETHOD(bus_release_resource, acpi_pcib_acpi_release_resource), DEVMETHOD(bus_activate_resource, acpi_pcib_acpi_activate_resource), DEVMETHOD(bus_deactivate_resource, acpi_pcib_acpi_deactivate_resource), -#else - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), -#endif DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_get_cpus, acpi_pcib_get_cpus), @@ -246,11 +238,9 @@ case ACPI_IO_RANGE: type = SYS_RES_IOPORT; break; -#ifdef PCI_RES_BUS case ACPI_BUS_NUMBER_RANGE: type = PCI_RES_BUS; break; -#endif default: return (AE_OK); } @@ -285,7 +275,6 @@ return (AE_OK); } -#if defined(PCI_RES_BUS) static bool get_decoded_bus_range(struct acpi_hpcib_softc *sc, rman_res_t *startp, rman_res_t *endp) @@ -299,7 +288,6 @@ *endp = rle->end; return (true); } -#endif static int acpi_pcib_osc(struct acpi_hpcib_softc *sc, uint32_t osc_ctl) @@ -364,11 +352,9 @@ ACPI_STATUS status; static int bus0_seen = 0; u_int slot, func, busok; -#if defined(PCI_RES_BUS) struct resource *bus_res; rman_res_t end, start; int rid; -#endif int error, domain; uint8_t busno; @@ -482,7 +468,6 @@ } } -#if defined(PCI_RES_BUS) /* * If nothing else worked, hope that ACPI at least lays out the * Host-PCI bridges in order and that as a result the next free @@ -527,18 +512,6 @@ } } } -#else - /* - * If nothing else worked, hope that ACPI at least lays out the - * host-PCI bridges in order and that as a result our unit number - * is actually our bus number. There are several reasons this - * might not be true. - */ - if (busok == 0) { - sc->ap_bus = device_get_unit(dev); - device_printf(dev, "trying bus number %d\n", sc->ap_bus); - } -#endif /* If this is bus 0 on segment 0, note that it has been seen already. */ if (sc->ap_segment == 0 && sc->ap_bus == 0) @@ -569,9 +542,7 @@ errout: device_printf(device_get_parent(dev), "couldn't attach pci bus\n"); -#if defined(PCI_RES_BUS) pcib_host_res_free(dev, &sc->ap_host_res); -#endif return (error); } @@ -703,11 +674,9 @@ #endif sc = device_get_softc(dev); -#ifdef PCI_RES_BUS if (type == PCI_RES_BUS) return (pci_domain_alloc_bus(sc->ap_segment, child, rid, start, end, count, flags)); -#endif res = pcib_host_res_alloc(&sc->ap_host_res, child, type, rid, start, end, count, flags); @@ -731,16 +700,13 @@ struct acpi_hpcib_softc *sc; sc = device_get_softc(dev); -#ifdef PCI_RES_BUS if (type == PCI_RES_BUS) return (pci_domain_adjust_bus(sc->ap_segment, child, r, start, end)); -#endif return (pcib_host_res_adjust(&sc->ap_host_res, child, type, r, start, end)); } -#ifdef PCI_RES_BUS int acpi_pcib_acpi_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r) @@ -777,7 +743,6 @@ r)); return (bus_generic_deactivate_resource(dev, child, type, rid, r)); } -#endif static int acpi_pcib_request_feature(device_t pcib, device_t dev, enum pci_feature feature) diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c --- a/sys/dev/cardbus/cardbus.c +++ b/sys/dev/cardbus/cardbus.c @@ -93,13 +93,10 @@ cardbus_attach(device_t cbdev) { struct cardbus_softc *sc; -#ifdef PCI_RES_BUS int rid; -#endif sc = device_get_softc(cbdev); sc->sc_dev = cbdev; -#ifdef PCI_RES_BUS rid = 0; sc->sc_bus = bus_alloc_resource(cbdev, PCI_RES_BUS, &rid, pcib_get_bus(cbdev), pcib_get_bus(cbdev), 1, 0); @@ -107,25 +104,18 @@ device_printf(cbdev, "failed to allocate bus number\n"); return (ENXIO); } -#else - device_printf(cbdev, "Your bus numbers may be AFU\n"); -#endif return (0); } static int cardbus_detach(device_t cbdev) { -#ifdef PCI_RES_BUS struct cardbus_softc *sc; -#endif cardbus_detach_card(cbdev); -#ifdef PCI_RES_BUS sc = device_get_softc(cbdev); device_printf(cbdev, "Freeing up the allocatd bus\n"); (void)bus_release_resource(cbdev, PCI_RES_BUS, 0, sc->sc_bus); -#endif return (0); } diff --git a/sys/dev/cardbus/cardbusvar.h b/sys/dev/cardbus/cardbusvar.h --- a/sys/dev/cardbus/cardbusvar.h +++ b/sys/dev/cardbus/cardbusvar.h @@ -68,9 +68,7 @@ struct cardbus_softc { device_t sc_dev; -#ifdef PCI_RES_BUS struct resource *sc_bus; -#endif }; /* diff --git a/sys/dev/ofw/ofw_pcib.c b/sys/dev/ofw/ofw_pcib.c --- a/sys/dev/ofw/ofw_pcib.c +++ b/sys/dev/ofw/ofw_pcib.c @@ -424,17 +424,13 @@ ofw_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { -#if defined(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); -#endif switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_alloc_bus(sc->sc_pci_domain, child, rid, start, end, count, flags)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_alloc_resource(bus, child, type, rid, @@ -449,17 +445,13 @@ ofw_pcib_release_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { -#if defined(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); -#endif switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_release_bus(sc->sc_pci_domain, child, rid, res)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_release_resource(bus, child, type, rid, @@ -513,17 +505,13 @@ ofw_pcib_activate_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { -#if defined(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); -#endif switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_activate_bus(sc->sc_pci_domain, child, rid, res)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_activate_resource(bus, child, type, rid, @@ -634,17 +622,13 @@ ofw_pcib_deactivate_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { -#if defined(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); -#endif switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_deactivate_bus(sc->sc_pci_domain, child, rid, res)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_deactivate_resource(bus, child, type, @@ -659,17 +643,13 @@ ofw_pcib_adjust_resource(device_t bus, device_t child, int type, struct resource *res, rman_res_t start, rman_res_t end) { -#if defined(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); -#endif switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_adjust_bus(sc->sc_pci_domain, child, res, start, end)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_adjust_resource(bus, child, type, res, diff --git a/sys/dev/pccbb/pccbb_pci.c b/sys/dev/pccbb/pccbb_pci.c --- a/sys/dev/pccbb/pccbb_pci.c +++ b/sys/dev/pccbb/pccbb_pci.c @@ -276,10 +276,6 @@ static int cbb_pci_attach(device_t brdev) { -#if !defined(PCI_RES_BUS) - static int curr_bus_number = 2; /* XXX EVILE BAD (see below) */ - uint32_t pribus; -#endif struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev); struct sysctl_ctx_list *sctx; struct sysctl_oid *soid; @@ -293,13 +289,8 @@ sc->cbdev = NULL; sc->domain = pci_get_domain(brdev); sc->pribus = pcib_get_bus(parent); -#if defined(PCI_RES_BUS) pci_write_config(brdev, PCIR_PRIBUS_2, sc->pribus, 1); pcib_setup_secbus(brdev, &sc->bus, 1); -#else - sc->bus.sec = pci_read_config(brdev, PCIR_SECBUS_2, 1); - sc->bus.sub = pci_read_config(brdev, PCIR_SUBBUS_2, 1); -#endif SLIST_INIT(&sc->rl); rid = CBBR_SOCKBASE; @@ -351,32 +342,6 @@ CTLFLAG_RD, &sc->subbus, 0, "io range 2 open"); #endif -#if !defined(PCI_RES_BUS) - /* - * This is a gross hack. We should be scanning the entire pci - * tree, assigning bus numbers in a way such that we (1) can - * reserve 1 extra bus just in case and (2) all sub buses - * are in an appropriate range. - */ - DEVPRINTF((brdev, "Secondary bus is %d\n", sc->bus.sec)); - pribus = pci_read_config(brdev, PCIR_PRIBUS_2, 1); - if (sc->bus.sec == 0 || sc->pribus != pribus) { - if (curr_bus_number <= sc->pribus) - curr_bus_number = sc->pribus + 1; - if (pribus != sc->pribus) { - DEVPRINTF((brdev, "Setting primary bus to %d\n", - sc->pribus)); - pci_write_config(brdev, PCIR_PRIBUS_2, sc->pribus, 1); - } - sc->bus.sec = curr_bus_number++; - sc->bus.sub = curr_bus_number++; - DEVPRINTF((brdev, "Secondary bus set to %d subbus %d\n", - sc->bus.sec, sc->bus.sub)); - pci_write_config(brdev, PCIR_SECBUS_2, sc->bus.sec, 1); - pci_write_config(brdev, PCIR_SUBBUS_2, sc->bus.sub, 1); - } -#endif - /* Map and establish the interrupt. */ rid = 0; sc->irq_res = bus_alloc_resource_any(brdev, SYS_RES_IRQ, &rid, @@ -429,16 +394,12 @@ static int cbb_pci_detach(device_t brdev) { -#if defined(PCI_RES_BUS) struct cbb_softc *sc = device_get_softc(brdev); -#endif int error; error = cbb_detach(brdev); -#if defined(PCI_RES_BUS) if (error == 0) pcib_free_secbus(brdev, &sc->bus); -#endif return (error); } @@ -787,7 +748,6 @@ return retval; } -#if defined(PCI_RES_BUS) static struct resource * cbb_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) @@ -837,7 +797,6 @@ } return (cbb_release_resource(bus, child, type, rid, r)); } -#endif /************************************************************************/ /* PCI compat methods */ @@ -932,14 +891,9 @@ /* bus methods */ DEVMETHOD(bus_read_ivar, cbb_read_ivar), DEVMETHOD(bus_write_ivar, cbb_write_ivar), -#if defined(PCI_RES_BUS) DEVMETHOD(bus_alloc_resource, cbb_pci_alloc_resource), DEVMETHOD(bus_adjust_resource, cbb_pci_adjust_resource), DEVMETHOD(bus_release_resource, cbb_pci_release_resource), -#else - DEVMETHOD(bus_alloc_resource, cbb_alloc_resource), - DEVMETHOD(bus_release_resource, cbb_release_resource), -#endif DEVMETHOD(bus_activate_resource, cbb_activate_resource), DEVMETHOD(bus_deactivate_resource, cbb_deactivate_resource), DEVMETHOD(bus_driver_added, cbb_driver_added), diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -399,11 +399,9 @@ SYSCTL_INT(_hw_pci, OID_AUTO, clear_bars, CTLFLAG_RDTUN, &pci_clear_bars, 0, "Ignore firmware-assigned resources for BARs."); -#if defined(PCI_RES_BUS) static int pci_clear_buses; SYSCTL_INT(_hw_pci, OID_AUTO, clear_buses, CTLFLAG_RDTUN, &pci_clear_buses, 0, "Ignore firmware-assigned bus numbers."); -#endif static int pci_enable_ari = 1; SYSCTL_INT(_hw_pci, OID_AUTO, enable_ari, CTLFLAG_RDTUN, &pci_enable_ari, @@ -3700,7 +3698,6 @@ bus_release_resource(self, SYS_RES_MEMORY, rid, res); } -#if defined(PCI_RES_BUS) static void pci_reserve_secbus(device_t bus, device_t dev, pcicfgregs *cfg, struct resource_list *rl) @@ -3856,7 +3853,6 @@ return (resource_list_alloc(rl, dev, child, PCI_RES_BUS, rid, start, end, count, flags)); } -#endif static int pci_ea_bei_to_rid(device_t dev, int bei) @@ -4112,13 +4108,11 @@ uhci_early_takeover(dev); } -#if defined(PCI_RES_BUS) /* * Reserve resources for secondary bus ranges behind bridge * devices. */ pci_reserve_secbus(bus, dev, cfg, rl); -#endif } static struct pci_devinfo * @@ -4464,14 +4458,11 @@ { struct pci_softc *sc; int busno, domain; -#ifdef PCI_RES_BUS int rid; -#endif sc = device_get_softc(dev); domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); -#ifdef PCI_RES_BUS rid = 0; sc->sc_bus = bus_alloc_resource(dev, PCI_RES_BUS, &rid, busno, busno, 1, 0); @@ -4479,7 +4470,6 @@ device_printf(dev, "failed to allocate bus number\n"); return (ENXIO); } -#endif if (bootverbose) device_printf(dev, "domain=%d, physical bus=%d\n", domain, busno); @@ -4511,20 +4501,16 @@ int pci_detach(device_t dev) { -#ifdef PCI_RES_BUS struct pci_softc *sc; -#endif int error; error = bus_generic_detach(dev); if (error) return (error); -#ifdef PCI_RES_BUS sc = device_get_softc(dev); error = bus_release_resource(dev, PCI_RES_BUS, 0, sc->sc_bus); if (error) return (error); -#endif return (device_delete_children(dev)); } @@ -5105,10 +5091,8 @@ pci_printf(&dinfo->cfg, "Device leaked memory resources\n"); if (resource_list_release_active(rl, dev, child, SYS_RES_IOPORT) != 0) pci_printf(&dinfo->cfg, "Device leaked I/O resources\n"); -#ifdef PCI_RES_BUS if (resource_list_release_active(rl, dev, child, PCI_RES_BUS) != 0) pci_printf(&dinfo->cfg, "Device leaked PCI bus numbers\n"); -#endif pci_cfg_save(child, dinfo, 1); } @@ -5545,11 +5529,9 @@ rl = &dinfo->resources; cfg = &dinfo->cfg; switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_alloc_secbus(dev, child, rid, start, end, count, flags)); -#endif case SYS_RES_IRQ: /* * Can't alloc legacy interrupt once MSI messages have diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -363,11 +363,9 @@ sc = device_get_softc(dev); -#if defined(PCI_RES_BUS) if (type == PCI_RES_BUS) { return (pci_domain_release_bus(sc->ecam, child, rid, res)); } -#endif rm = generic_pcie_rman(sc, type, rman_get_flags(res)); if (rm != NULL) { @@ -460,12 +458,10 @@ sc = device_get_softc(dev); -#if defined(PCI_RES_BUS) if (type == PCI_RES_BUS) { return (pci_domain_alloc_bus(sc->ecam, child, rid, start, end, count, flags)); } -#endif rm = generic_pcie_rman(sc, type, flags); if (rm == NULL) @@ -504,18 +500,14 @@ generic_pcie_activate_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { -#if defined(PCI_RES_BUS) struct generic_pcie_core_softc *sc; -#endif rman_res_t start, end; int res; -#if defined(PCI_RES_BUS) sc = device_get_softc(dev); if (type == PCI_RES_BUS) { return (pci_domain_activate_bus(sc->ecam, child, rid, r)); } -#endif if ((res = rman_activate_resource(r)) != 0) return (res); @@ -539,17 +531,13 @@ generic_pcie_deactivate_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { -#if defined(PCI_RES_BUS) struct generic_pcie_core_softc *sc; -#endif int res; -#if defined(PCI_RES_BUS) sc = device_get_softc(dev); if (type == PCI_RES_BUS) { return (pci_domain_deactivate_bus(sc->ecam, child, rid, r)); } -#endif if ((res = rman_deactivate_resource(r)) != 0) return (res); @@ -575,11 +563,9 @@ struct rman *rm; sc = device_get_softc(dev); -#if defined(PCI_RES_BUS) if (type == PCI_RES_BUS) return (pci_domain_adjust_bus(sc->ecam, child, res, start, end)); -#endif rm = generic_pcie_rman(sc, type, rman_get_flags(res)); if (rm != NULL) diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -166,10 +166,8 @@ pcib_is_resource_managed(struct pcib_softc *sc, int type, struct resource *r) { -#ifdef PCI_RES_BUS if (type == PCI_RES_BUS) return (rman_is_region_manager(r, &sc->bus.rman)); -#endif return (pcib_get_resource_window(sc, type, r) != NULL); } @@ -593,7 +591,6 @@ pcib_release_window(sc, &sc->io, SYS_RES_IOPORT); } -#ifdef PCI_RES_BUS /* * Allocate a suitable secondary bus for this bridge if needed and * initialize the resource manager for the secondary bus range. Note @@ -780,7 +777,6 @@ flags)); return (NULL); } -#endif #ifdef PCI_HP /* @@ -1387,10 +1383,6 @@ * Get current bridge configuration. */ sc->domain = pci_get_domain(dev); -#if !defined(PCI_RES_BUS) - sc->bus.sec = pci_read_config(dev, PCIR_SECBUS_1, 1); - sc->bus.sub = pci_read_config(dev, PCIR_SUBBUS_1, 1); -#endif sc->bridgectl = pci_read_config(dev, PCIR_BRIDGECTL_1, 2); /* @@ -1418,20 +1410,6 @@ * Quirk handling. */ switch (pci_get_devid(dev)) { -#if !defined(PCI_RES_BUS) - case 0x12258086: /* Intel 82454KX/GX (Orion) */ - { - uint8_t supbus; - - supbus = pci_read_config(dev, 0x41, 1); - if (supbus != 0xff) { - sc->bus.sec = supbus + 1; - sc->bus.sub = supbus + 1; - } - break; - } -#endif - /* * The i82380FB mobile docking controller is a PCI-PCI bridge, * and it is a subtractive bridge. However, the ProgIf is wrong @@ -1444,34 +1422,6 @@ case 0x060513d7: /* Toshiba ???? */ sc->flags |= PCIB_SUBTRACTIVE; break; - -#if !defined(PCI_RES_BUS) - /* Compaq R3000 BIOS sets wrong subordinate bus number. */ - case 0x00dd10de: - { - char *cp; - - if ((cp = kern_getenv("smbios.planar.maker")) == NULL) - break; - if (strncmp(cp, "Compal", 6) != 0) { - freeenv(cp); - break; - } - freeenv(cp); - if ((cp = kern_getenv("smbios.planar.product")) == NULL) - break; - if (strncmp(cp, "08A0", 4) != 0) { - freeenv(cp); - break; - } - freeenv(cp); - if (sc->bus.sub < 0xa) { - pci_write_config(dev, PCIR_SUBBUS_1, 0xa, 1); - sc->bus.sub = pci_read_config(dev, PCIR_SUBBUS_1, 1); - } - break; - } -#endif } if (pci_msi_device_blacklisted(dev)) @@ -1495,9 +1445,7 @@ #ifdef PCI_HP pcib_probe_hotplug(sc); #endif -#ifdef PCI_RES_BUS pcib_setup_secbus(dev, &sc->bus, 1); -#endif pcib_probe_windows(sc); #ifdef PCI_HP if (sc->flags & PCIB_HOTPLUG) @@ -1604,9 +1552,7 @@ if (error) return (error); pcib_free_windows(sc); -#ifdef PCI_RES_BUS pcib_free_secbus(dev, &sc->bus); -#endif return (0); } @@ -2088,11 +2034,9 @@ } switch (type) { -#ifdef PCI_RES_BUS case PCI_RES_BUS: return (pcib_alloc_subbus(&sc->bus, child, rid, start, end, count, flags)); -#endif case SYS_RES_IOPORT: if (pcib_is_isa_range(sc, start, end, count)) return (NULL); @@ -2172,7 +2116,6 @@ return (bus_generic_adjust_resource(bus, child, type, r, start, end)); -#ifdef PCI_RES_BUS if (type == PCI_RES_BUS) { /* * If our bus range isn't big enough to grow the sub-allocation @@ -2186,9 +2129,7 @@ if (error != 0) return (error); } - } else -#endif - { + } else { /* * Resource is managed and not a secondary bus number, must * be from one of our windows. diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h --- a/sys/dev/pci/pci_private.h +++ b/sys/dev/pci/pci_private.h @@ -40,9 +40,7 @@ struct pci_softc { bus_dma_tag_t sc_dma_tag; -#ifdef PCI_RES_BUS struct resource *sc_bus; -#endif }; extern int pci_do_power_resume; diff --git a/sys/dev/pci/pci_subr.c b/sys/dev/pci/pci_subr.c --- a/sys/dev/pci/pci_subr.c +++ b/sys/dev/pci/pci_subr.c @@ -283,7 +283,6 @@ return (ERANGE); } -#ifdef PCI_RES_BUS struct pci_domain { int pd_domain; struct rman pd_bus_rman; @@ -410,4 +409,3 @@ #endif return (rman_deactivate_resource(r)); } -#endif /* PCI_RES_BUS */ diff --git a/sys/dev/pci/pcib_private.h b/sys/dev/pci/pcib_private.h --- a/sys/dev/pci/pcib_private.h +++ b/sys/dev/pci/pcib_private.h @@ -84,13 +84,11 @@ struct pcib_secbus { u_int sec; u_int sub; -#if defined(PCI_RES_BUS) device_t dev; struct rman rman; struct resource *res; const char *name; int sub_reg; -#endif }; /* @@ -140,7 +138,6 @@ int host_pcib_get_busno(pci_read_config_fn read_config, int bus, int slot, int func, uint8_t *busnum); -#if defined(PCI_RES_BUS) struct resource *pci_domain_alloc_bus(int domain, device_t dev, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int pci_domain_adjust_bus(int domain, device_t dev, @@ -157,7 +154,6 @@ void pcib_free_secbus(device_t dev, struct pcib_secbus *bus); void pcib_setup_secbus(device_t dev, struct pcib_secbus *bus, int min_count); -#endif int pcib_attach(device_t dev); int pcib_attach_child(device_t dev); void pcib_attach_common(device_t dev); diff --git a/sys/x86/pci/pci_bus.c b/sys/x86/pci/pci_bus.c --- a/sys/x86/pci/pci_bus.c +++ b/sys/x86/pci/pci_bus.c @@ -595,17 +595,14 @@ rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { -#if defined(PCI_RES_BUS) if (type == PCI_RES_BUS) return (pci_domain_alloc_bus(0, child, rid, start, end, count, flags)); -#endif start = hostb_alloc_start(type, start, end, count); return (bus_generic_alloc_resource(dev, child, type, rid, start, end, count, flags)); } -#if defined(PCI_RES_BUS) int legacy_pcib_adjust_resource(device_t dev, device_t child, int type, struct resource *r, rman_res_t start, rman_res_t end) @@ -643,7 +640,6 @@ return (pci_domain_deactivate_bus(0, child, rid, r)); return (bus_generic_deactivate_resource(dev, child, type, rid, r)); } -#endif static device_method_t legacy_pcib_methods[] = { /* Device interface */ @@ -658,17 +654,10 @@ DEVMETHOD(bus_read_ivar, legacy_pcib_read_ivar), DEVMETHOD(bus_write_ivar, legacy_pcib_write_ivar), DEVMETHOD(bus_alloc_resource, legacy_pcib_alloc_resource), -#if defined(PCI_RES_BUS) DEVMETHOD(bus_adjust_resource, legacy_pcib_adjust_resource), DEVMETHOD(bus_release_resource, legacy_pcib_release_resource), DEVMETHOD(bus_activate_resource, legacy_pcib_activate_resource), DEVMETHOD(bus_deactivate_resource, legacy_pcib_deactivate_resource), -#else - DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), -#endif DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), diff --git a/sys/x86/pci/qpi.c b/sys/x86/pci/qpi.c --- a/sys/x86/pci/qpi.c +++ b/sys/x86/pci/qpi.c @@ -246,7 +246,6 @@ } } -#if defined(PCI_RES_BUS) static struct resource * qpi_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) @@ -258,7 +257,6 @@ return (bus_generic_alloc_resource(dev, child, type, rid, start, end, count, flags)); } -#endif static int qpi_pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr, @@ -280,18 +278,11 @@ /* Bus interface */ DEVMETHOD(bus_read_ivar, qpi_pcib_read_ivar), -#if defined(PCI_RES_BUS) DEVMETHOD(bus_alloc_resource, qpi_pcib_alloc_resource), DEVMETHOD(bus_adjust_resource, legacy_pcib_adjust_resource), DEVMETHOD(bus_release_resource, legacy_pcib_release_resource), DEVMETHOD(bus_activate_resource, legacy_pcib_activate_resource), DEVMETHOD(bus_deactivate_resource, legacy_pcib_deactivate_resource), -#else - DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), -#endif DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), diff --git a/sys/x86/x86/mptable_pci.c b/sys/x86/x86/mptable_pci.c --- a/sys/x86/x86/mptable_pci.c +++ b/sys/x86/x86/mptable_pci.c @@ -100,11 +100,9 @@ { struct mptable_hostb_softc *sc; -#ifdef PCI_RES_BUS if (type == PCI_RES_BUS) return (pci_domain_alloc_bus(0, child, rid, start, end, count, flags)); -#endif sc = device_get_softc(dev); if (type == SYS_RES_IOPORT && start + count - 1 == end) { if (mptable_is_isa_range(start, end)) { @@ -141,10 +139,8 @@ { struct mptable_hostb_softc *sc; -#ifdef PCI_RES_BUS if (type == PCI_RES_BUS) return (pci_domain_adjust_bus(0, child, r, start, end)); -#endif sc = device_get_softc(dev); return (pcib_host_res_adjust(&sc->sc_host_res, child, type, r, start, end)); @@ -163,15 +159,9 @@ DEVMETHOD(bus_write_ivar, legacy_pcib_write_ivar), DEVMETHOD(bus_alloc_resource, mptable_hostb_alloc_resource), DEVMETHOD(bus_adjust_resource, mptable_hostb_adjust_resource), -#if defined(PCI_RES_BUS) DEVMETHOD(bus_release_resource, legacy_pcib_release_resource), DEVMETHOD(bus_activate_resource, legacy_pcib_activate_resource), DEVMETHOD(bus_deactivate_resource, legacy_pcib_deactivate_resource), -#else - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), -#endif DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),