git: 8415a654d02e - main - Retire non-NEW_PCIB code and remove config option
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 18 Jul 2024 17:56:26 UTC
The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=8415a654d02e1c4268885e667c539873db570576 commit 8415a654d02e1c4268885e667c539873db570576 Author: Jessica Clarke <jrtc27@FreeBSD.org> AuthorDate: 2024-07-18 17:55:12 +0000 Commit: Jessica Clarke <jrtc27@FreeBSD.org> CommitDate: 2024-07-18 17:55:12 +0000 Retire non-NEW_PCIB code and remove config option All architectures enable NEW_PCIB in DEFAULTS (arm being the most recent to do so in 121be555997b (arm: Set NEW_PCIB in DEFAULTS rather than a subset of kernel configs")), so it's time we removed the legacy code that no longer sees much testing and has a significant maintenance burden. Reviewed by: jhb, andrew, emaste Differential Revision: https://reviews.freebsd.org/D32954 --- sys/amd64/conf/DEFAULTS | 2 - sys/amd64/include/resource.h | 2 - sys/arm/conf/DEFAULTS | 1 - sys/arm/include/resource.h | 2 - sys/arm64/cavium/thunder_pcie_pem.c | 18 +- sys/arm64/conf/DEFAULTS | 1 - sys/arm64/include/resource.h | 2 - sys/conf/config.mk | 6 +- sys/conf/options | 1 - sys/dev/acpica/acpi_pcib_acpi.c | 31 +-- sys/dev/hyperv/pcib/vmbus_pcib.c | 3 - sys/dev/hyperv/vmbus/vmbus.c | 11 +- sys/dev/hyperv/vmbus/vmbus_var.h | 2 - sys/dev/ofw/ofw_pcib.c | 20 +- sys/dev/pccbb/pccbb_pci.c | 14 +- sys/dev/pci/pci.c | 12 +- sys/dev/pci/pci_host_generic.c | 26 +-- sys/dev/pci/pci_pci.c | 374 +----------------------------------- sys/dev/pci/pci_subr.c | 3 - sys/dev/pci/pcib_private.h | 19 +- sys/i386/conf/DEFAULTS | 2 - sys/i386/include/resource.h | 2 - sys/modules/cardbus/Makefile | 4 - sys/modules/cbb/Makefile | 4 - sys/powerpc/conf/DEFAULTS | 2 - sys/riscv/conf/DEFAULTS | 1 - sys/riscv/include/resource.h | 2 - sys/x86/include/mptable.h | 4 - sys/x86/pci/pci_bus.c | 6 +- sys/x86/pci/qpi.c | 4 +- sys/x86/x86/mptable.c | 12 -- sys/x86/x86/mptable_pci.c | 11 +- 32 files changed, 64 insertions(+), 540 deletions(-) diff --git a/sys/amd64/conf/DEFAULTS b/sys/amd64/conf/DEFAULTS index 5167cf4d98d0..eb8ee6b76a69 100644 --- a/sys/amd64/conf/DEFAULTS +++ b/sys/amd64/conf/DEFAULTS @@ -25,6 +25,4 @@ options GEOM_PART_GPT # Default congestion control algorithm options CC_CUBIC # include CUBIC congestion control -options NEW_PCIB - options NETLINK # netlink(4) support diff --git a/sys/amd64/include/resource.h b/sys/amd64/include/resource.h index 368a13b88d3a..9477572176e0 100644 --- a/sys/amd64/include/resource.h +++ b/sys/amd64/include/resource.h @@ -39,8 +39,6 @@ #define SYS_RES_DRQ 2 /* isa dma lines */ #define SYS_RES_MEMORY 3 /* i/o memory */ #define SYS_RES_IOPORT 4 /* i/o ports */ -#ifdef NEW_PCIB #define PCI_RES_BUS 5 /* PCI bus numbers */ -#endif #endif /* !_MACHINE_RESOURCE_H_ */ diff --git a/sys/arm/conf/DEFAULTS b/sys/arm/conf/DEFAULTS index 85d090dfa782..1acfe6349b4b 100644 --- a/sys/arm/conf/DEFAULTS +++ b/sys/arm/conf/DEFAULTS @@ -7,5 +7,4 @@ device mem # Default congestion control algorithm options CC_CUBIC # include CUBIC congestion control -options NEW_PCIB options INTRNG # All arm systems use INTRNG these days diff --git a/sys/arm/include/resource.h b/sys/arm/include/resource.h index d6b544d662d4..f7c2633c5f0d 100644 --- a/sys/arm/include/resource.h +++ b/sys/arm/include/resource.h @@ -40,8 +40,6 @@ #define SYS_RES_MEMORY 3 /* i/o memory */ #define SYS_RES_IOPORT 4 /* i/o ports */ #define SYS_RES_GPIO 5 /* general purpose i/o */ -#ifdef NEW_PCIB #define PCI_RES_BUS 6 /* PCI bus numbers */ -#endif #endif /* !_MACHINE_RESOURCE_H_ */ diff --git a/sys/arm64/cavium/thunder_pcie_pem.c b/sys/arm64/cavium/thunder_pcie_pem.c index a27ed810c618..c334342afe4a 100644 --- a/sys/arm64/cavium/thunder_pcie_pem.c +++ b/sys/arm64/cavium/thunder_pcie_pem.c @@ -254,13 +254,13 @@ thunder_pem_write_ivar(device_t dev, device_t child, int index, static int thunder_pem_activate_resource(device_t dev, device_t child, struct resource *r) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct thunder_pem_softc *sc; sc = device_get_softc(dev); #endif switch (rman_get_type(r)) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_activate_bus(sc->id, child, r)); #endif @@ -276,13 +276,13 @@ static int thunder_pem_deactivate_resource(device_t dev, device_t child, struct resource *r) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct thunder_pem_softc *sc; sc = device_get_softc(dev); #endif switch (rman_get_type(r)) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_deactivate_bus(sc->id, child, r)); #endif @@ -350,13 +350,13 @@ static int thunder_pem_adjust_resource(device_t dev, device_t child, struct resource *res, rman_res_t start, rman_res_t end) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct thunder_pem_softc *sc; sc = device_get_softc(dev); #endif switch (rman_get_type(res)) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_adjust_bus(sc->id, child, res, start, end)); #endif @@ -671,7 +671,7 @@ thunder_pem_alloc_resource(device_t dev, device_t child, int type, int *rid, device_t parent_dev; switch (type) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_alloc_bus(sc->id, child, rid, start, end, count, flags)); @@ -718,12 +718,12 @@ static int thunder_pem_release_resource(device_t dev, device_t child, struct resource *res) { device_t parent_dev; -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct thunder_pem_softc *sc = device_get_softc(dev); #endif switch (rman_get_type(res)) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_release_bus(sc->id, child, res)); #endif diff --git a/sys/arm64/conf/DEFAULTS b/sys/arm64/conf/DEFAULTS index 5d267af4b7d7..fb8b74783867 100644 --- a/sys/arm64/conf/DEFAULTS +++ b/sys/arm64/conf/DEFAULTS @@ -15,7 +15,6 @@ options GEOM_PART_GPT # Default congestion control algorithm options CC_CUBIC # include CUBIC congestion control -options NEW_PCIB options INTRNG options NETLINK # netlink(4) support diff --git a/sys/arm64/include/resource.h b/sys/arm64/include/resource.h index d4cffb1ae854..336fc11a435a 100644 --- a/sys/arm64/include/resource.h +++ b/sys/arm64/include/resource.h @@ -44,9 +44,7 @@ #define SYS_RES_MEMORY 3 /* i/o memory */ #define SYS_RES_IOPORT 4 /* i/o ports */ #define SYS_RES_GPIO 5 /* general purpose i/o */ -#ifdef NEW_PCIB #define PCI_RES_BUS 6 /* PCI bus numbers */ -#endif #endif /* !_MACHINE_RESOURCE_H_ */ diff --git a/sys/conf/config.mk b/sys/conf/config.mk index 729111b4ef3a..9ef3e7936a48 100644 --- a/sys/conf/config.mk +++ b/sys/conf/config.mk @@ -59,9 +59,9 @@ opt_sctp.h: opt_wlan.h: echo "#define IEEE80211_DEBUG 1" > ${.TARGET} echo "#define IEEE80211_SUPPORT_MESH 1" >> ${.TARGET} -KERN_OPTS.i386=NEW_PCIB DEV_PCI -KERN_OPTS.amd64=NEW_PCIB DEV_PCI -KERN_OPTS.powerpc=NEW_PCIB DEV_PCI +KERN_OPTS.i386=DEV_PCI +KERN_OPTS.amd64=DEV_PCI +KERN_OPTS.powerpc=DEV_PCI KERN_OPTS=MROUTING IEEE80211_DEBUG \ IEEE80211_SUPPORT_MESH DEV_BPF \ ${KERN_OPTS.${MACHINE}} ${KERN_OPTS_EXTRA} diff --git a/sys/conf/options b/sys/conf/options index 928927fe99df..8464fd919ff0 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -186,7 +186,6 @@ MFI_DEBUG opt_mfi.h MFI_DECODE_LOG opt_mfi.h MPROF_BUFFERS opt_mprof.h MPROF_HASH_SIZE opt_mprof.h -NEW_PCIB opt_global.h NO_ADAPTIVE_MUTEXES opt_adaptive_mutexes.h NO_ADAPTIVE_RWLOCKS NO_ADAPTIVE_SX diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c index 4c3d62a66d58..18fece293183 100644 --- a/sys/dev/acpica/acpi_pcib_acpi.c +++ b/sys/dev/acpica/acpi_pcib_acpi.c @@ -67,9 +67,7 @@ struct acpi_hpcib_softc { int ap_addr; /* device/func of PCI-Host bridge */ ACPI_BUFFER ap_prt; /* interrupt routing table */ -#ifdef NEW_PCIB struct pcib_host_resources ap_host_res; -#endif }; static int acpi_pcib_acpi_probe(device_t bus); @@ -95,7 +93,6 @@ static struct resource *acpi_pcib_acpi_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); -#ifdef NEW_PCIB static int acpi_pcib_acpi_adjust_resource(device_t dev, device_t child, struct resource *r, rman_res_t start, rman_res_t end); @@ -107,7 +104,6 @@ static int acpi_pcib_acpi_activate_resource(device_t dev, static int acpi_pcib_acpi_deactivate_resource(device_t dev, device_t child, struct resource *r); #endif -#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,12 +120,8 @@ static device_method_t acpi_pcib_acpi_methods[] = { DEVMETHOD(bus_read_ivar, acpi_pcib_read_ivar), DEVMETHOD(bus_write_ivar, acpi_pcib_write_ivar), DEVMETHOD(bus_alloc_resource, acpi_pcib_acpi_alloc_resource), -#ifdef NEW_PCIB DEVMETHOD(bus_adjust_resource, acpi_pcib_acpi_adjust_resource), -#else - DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), -#endif -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#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), @@ -183,7 +175,6 @@ acpi_pcib_acpi_probe(device_t dev) return (0); } -#ifdef NEW_PCIB static ACPI_STATUS acpi_pcib_producer_handler(ACPI_RESOURCE *res, void *context) { @@ -290,9 +281,8 @@ acpi_pcib_producer_handler(ACPI_RESOURCE *res, void *context) } return (AE_OK); } -#endif -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) static bool get_decoded_bus_range(struct acpi_hpcib_softc *sc, rman_res_t *startp, rman_res_t *endp) @@ -371,7 +361,7 @@ acpi_pcib_acpi_attach(device_t dev) ACPI_STATUS status; static int bus0_seen = 0; u_int slot, func, busok; -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct resource *bus_res; rman_res_t end, start; int rid; @@ -421,7 +411,6 @@ acpi_pcib_acpi_attach(device_t dev) sc->ap_addr = -1; } -#ifdef NEW_PCIB /* * Determine which address ranges this bridge decodes and setup * resource managers for those ranges. @@ -435,7 +424,6 @@ acpi_pcib_acpi_attach(device_t dev) device_printf(sc->ap_dev, "failed to parse resources: %s\n", AcpiFormatException(status)); } -#endif /* * Get our base bus number by evaluating _BBN. @@ -491,7 +479,7 @@ acpi_pcib_acpi_attach(device_t dev) } } -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#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 @@ -578,7 +566,7 @@ acpi_pcib_acpi_attach(device_t dev) errout: device_printf(device_get_parent(dev), "couldn't attach pci bus\n"); -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) pcib_host_res_free(dev, &sc->ap_host_res); #endif return (error); @@ -704,16 +692,13 @@ struct resource * acpi_pcib_acpi_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) { -#ifdef NEW_PCIB struct acpi_hpcib_softc *sc; struct resource *res; -#endif #if defined(__i386__) || defined(__amd64__) start = hostb_alloc_start(type, start, end, count); #endif -#ifdef NEW_PCIB sc = device_get_softc(dev); #ifdef PCI_RES_BUS if (type == PCI_RES_BUS) @@ -734,13 +719,8 @@ acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid, res = bus_generic_alloc_resource(dev, child, type, rid, start, end, count, flags); return (res); -#else - return (bus_generic_alloc_resource(dev, child, type, rid, start, end, - count, flags)); -#endif } -#ifdef NEW_PCIB int acpi_pcib_acpi_adjust_resource(device_t dev, device_t child, struct resource *r, rman_res_t start, rman_res_t end) @@ -793,7 +773,6 @@ acpi_pcib_acpi_deactivate_resource(device_t dev, device_t child, return (bus_generic_deactivate_resource(dev, child, r)); } #endif -#endif static int acpi_pcib_request_feature(device_t pcib, device_t dev, enum pci_feature feature) diff --git a/sys/dev/hyperv/pcib/vmbus_pcib.c b/sys/dev/hyperv/pcib/vmbus_pcib.c index f6237535cce3..9aec2fac698a 100644 --- a/sys/dev/hyperv/pcib/vmbus_pcib.c +++ b/sys/dev/hyperv/pcib/vmbus_pcib.c @@ -25,7 +25,6 @@ */ #include <sys/cdefs.h> -#ifdef NEW_PCIB #include "opt_acpi.h" #include <sys/param.h> @@ -2042,5 +2041,3 @@ DEFINE_CLASS_0(pcib, vmbus_pcib_driver, vmbus_pcib_methods, DRIVER_MODULE(vmbus_pcib, vmbus, vmbus_pcib_driver, 0, 0); MODULE_DEPEND(vmbus_pcib, vmbus, 1, 1, 1); MODULE_DEPEND(vmbus_pcib, pci, 1, 1, 1); - -#endif /* NEW_PCIB */ diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c index dee738f6e373..4157a4c41cea 100644 --- a/sys/dev/hyperv/vmbus/vmbus.c +++ b/sys/dev/hyperv/vmbus/vmbus.c @@ -1069,15 +1069,12 @@ vmbus_alloc_resource(device_t dev, device_t child, int type, int *rid, device_t parent = device_get_parent(dev); struct resource *res; -#ifdef NEW_PCIB if (type == SYS_RES_MEMORY) { struct vmbus_softc *sc = device_get_softc(dev); res = pcib_host_res_alloc(&sc->vmbus_mmio_res, child, type, rid, start, end, count, flags); - } else -#endif - { + } else { res = BUS_ALLOC_RESOURCE(parent, child, type, rid, start, end, count, flags); } @@ -1158,7 +1155,6 @@ vmbus_get_eventtq_method(device_t bus, device_t dev __unused, int cpu) return (VMBUS_PCPU_GET(sc, event_tq, cpu)); } -#ifdef NEW_PCIB #define VTPM_BASE_ADDR 0xfed40000 #define FOUR_GB (1ULL << 32) @@ -1375,7 +1371,6 @@ vmbus_free_mmio_res(device_t dev) if (hv_fb_res) hv_fb_res = NULL; } -#endif /* NEW_PCIB */ static void vmbus_identify(driver_t *driver, device_t parent) @@ -1460,10 +1455,8 @@ vmbus_doattach(struct vmbus_softc *sc) if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) return (0); -#ifdef NEW_PCIB vmbus_get_mmio_res(sc->vmbus_dev); vmbus_fb_mmio_res(sc->vmbus_dev); -#endif sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; @@ -1681,9 +1674,7 @@ vmbus_detach(device_t dev) mtx_destroy(&sc->vmbus_prichan_lock); mtx_destroy(&sc->vmbus_chan_lock); -#ifdef NEW_PCIB vmbus_free_mmio_res(dev); -#endif #if defined(__aarch64__) bus_release_resource(device_get_parent(dev), SYS_RES_IRQ, sc->vector, diff --git a/sys/dev/hyperv/vmbus/vmbus_var.h b/sys/dev/hyperv/vmbus/vmbus_var.h index 4e0a769402d5..cadcaa45aae5 100644 --- a/sys/dev/hyperv/vmbus/vmbus_var.h +++ b/sys/dev/hyperv/vmbus/vmbus_var.h @@ -127,10 +127,8 @@ struct vmbus_softc { struct intr_config_hook vmbus_intrhook; -#ifdef NEW_PCIB /* The list of usable MMIO ranges for PCIe pass-through */ struct pcib_host_resources vmbus_mmio_res; -#endif #if defined(__aarch64__) struct resource *ires; diff --git a/sys/dev/ofw/ofw_pcib.c b/sys/dev/ofw/ofw_pcib.c index ebc09fccd93e..3f55e45f5b92 100644 --- a/sys/dev/ofw/ofw_pcib.c +++ b/sys/dev/ofw/ofw_pcib.c @@ -421,13 +421,13 @@ static struct resource * 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(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); #endif switch (type) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_alloc_bus(sc->sc_pci_domain, child, rid, start, end, count, flags)); @@ -445,13 +445,13 @@ ofw_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid, static int ofw_pcib_release_resource(device_t bus, device_t child, struct resource *res) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); #endif switch (rman_get_type(res)) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_release_bus(sc->sc_pci_domain, child, res)); #endif @@ -505,13 +505,13 @@ ofw_pcib_translate_resource(device_t bus, int type, rman_res_t start, static int ofw_pcib_activate_resource(device_t bus, device_t child, struct resource *res) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); #endif switch (rman_get_type(res)) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_activate_bus(sc->sc_pci_domain, child, res)); #endif @@ -621,13 +621,13 @@ ofw_pcib_bus_get_bus_tag(device_t bus, device_t child) static int ofw_pcib_deactivate_resource(device_t bus, device_t child, struct resource *res) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); #endif switch (rman_get_type(res)) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_deactivate_bus(sc->sc_pci_domain, child, res)); @@ -644,13 +644,13 @@ static int ofw_pcib_adjust_resource(device_t bus, device_t child, struct resource *res, rman_res_t start, rman_res_t end) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); #endif switch (rman_get_type(res)) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_adjust_bus(sc->sc_pci_domain, child, res, start, end)); diff --git a/sys/dev/pccbb/pccbb_pci.c b/sys/dev/pccbb/pccbb_pci.c index 3b66b3df3852..eca370d17ca5 100644 --- a/sys/dev/pccbb/pccbb_pci.c +++ b/sys/dev/pccbb/pccbb_pci.c @@ -276,7 +276,7 @@ cbb_print_config(device_t dev) static int cbb_pci_attach(device_t brdev) { -#if !(defined(NEW_PCIB) && defined(PCI_RES_BUS)) +#if !defined(PCI_RES_BUS) static int curr_bus_number = 2; /* XXX EVILE BAD (see below) */ uint32_t pribus; #endif @@ -293,7 +293,7 @@ cbb_pci_attach(device_t brdev) sc->cbdev = NULL; sc->domain = pci_get_domain(brdev); sc->pribus = pcib_get_bus(parent); -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) pci_write_config(brdev, PCIR_PRIBUS_2, sc->pribus, 1); pcib_setup_secbus(brdev, &sc->bus, 1); #else @@ -351,7 +351,7 @@ cbb_pci_attach(device_t brdev) CTLFLAG_RD, &sc->subbus, 0, "io range 2 open"); #endif -#if !(defined(NEW_PCIB) && defined(PCI_RES_BUS)) +#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 @@ -429,13 +429,13 @@ err: static int cbb_pci_detach(device_t brdev) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct cbb_softc *sc = device_get_softc(brdev); #endif int error; error = cbb_detach(brdev); -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) if (error == 0) pcib_free_secbus(brdev, &sc->bus); #endif @@ -787,7 +787,7 @@ cbb_pci_filt(void *arg) return retval; } -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#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) @@ -931,7 +931,7 @@ static device_method_t cbb_methods[] = { /* bus methods */ DEVMETHOD(bus_read_ivar, cbb_read_ivar), DEVMETHOD(bus_write_ivar, cbb_write_ivar), -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#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), diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 171c6b710a32..efe017f9a3ba 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -405,7 +405,7 @@ static int pci_clear_bars; SYSCTL_INT(_hw_pci, OID_AUTO, clear_bars, CTLFLAG_RDTUN, &pci_clear_bars, 0, "Ignore firmware-assigned resources for BARs."); -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#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."); @@ -3706,7 +3706,7 @@ xhci_early_takeover(device_t self) bus_release_resource(self, SYS_RES_MEMORY, rid, res); } -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) static void pci_reserve_secbus(device_t bus, device_t dev, pcicfgregs *cfg, struct resource_list *rl) @@ -4118,7 +4118,7 @@ pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask) uhci_early_takeover(dev); } -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) /* * Reserve resources for secondary bus ranges behind bridge * devices. @@ -5551,7 +5551,7 @@ pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, rl = &dinfo->resources; cfg = &dinfo->cfg; switch (type) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_alloc_secbus(dev, child, rid, start, end, count, flags)); @@ -5576,7 +5576,6 @@ pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, break; case SYS_RES_IOPORT: case SYS_RES_MEMORY: -#ifdef NEW_PCIB /* * PCI-PCI bridge I/O window resources are not BARs. * For those allocations just pass the request up the @@ -5595,7 +5594,6 @@ pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, type, rid, start, end, count, flags)); } } -#endif /* Reserve resources for this BAR if needed. */ rle = resource_list_find(rl, type, *rid); if (rle == NULL) { @@ -5668,7 +5666,6 @@ pci_release_resource(device_t dev, device_t child, struct resource *r) } #endif -#ifdef NEW_PCIB /* * PCI-PCI bridge I/O window resources are not BARs. For * those allocations just pass the request up the tree. @@ -5683,7 +5680,6 @@ pci_release_resource(device_t dev, device_t child, struct resource *r) return (bus_generic_release_resource(dev, child, r)); } } -#endif rl = &dinfo->resources; return (resource_list_release(rl, dev, child, r)); diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c index c3dba9d72484..c3f4f03b76ad 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -416,13 +416,13 @@ int pci_host_generic_core_release_resource(device_t dev, device_t child, struct resource *res) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct generic_pcie_core_softc *sc; sc = device_get_softc(dev); #endif switch (rman_get_type(res)) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_release_bus(sc->ecam, child, res)); #endif @@ -506,17 +506,17 @@ struct resource * pci_host_generic_core_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) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct generic_pcie_core_softc *sc; #endif struct resource *res; -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) sc = device_get_softc(dev); #endif switch (type) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: res = pci_domain_alloc_bus(sc->ecam, child, rid, start, end, count, flags); @@ -543,13 +543,13 @@ pci_host_generic_core_alloc_resource(device_t dev, device_t child, int type, static int generic_pcie_activate_resource(device_t dev, device_t child, struct resource *r) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct generic_pcie_core_softc *sc; sc = device_get_softc(dev); #endif switch (rman_get_type(r)) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_activate_bus(sc->ecam, child, r)); #endif @@ -565,13 +565,13 @@ static int generic_pcie_deactivate_resource(device_t dev, device_t child, struct resource *r) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct generic_pcie_core_softc *sc; sc = device_get_softc(dev); #endif switch (rman_get_type(r)) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_deactivate_bus(sc->ecam, child, r)); #endif @@ -587,13 +587,13 @@ static int generic_pcie_adjust_resource(device_t dev, device_t child, struct resource *res, rman_res_t start, rman_res_t end) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) struct generic_pcie_core_softc *sc; sc = device_get_softc(dev); #endif switch (rman_get_type(res)) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_adjust_bus(sc->ecam, child, res, start, end)); @@ -619,7 +619,7 @@ generic_pcie_map_resource(device_t dev, device_t child, struct resource *r, type = rman_get_type(r); switch (type) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (EINVAL); #endif @@ -658,7 +658,7 @@ generic_pcie_unmap_resource(device_t dev, device_t child, struct resource *r, type = rman_get_type(r); switch (type) { -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (EINVAL); #endif diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index 40b22c9802c4..7977b9148c9b 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -58,19 +58,16 @@ #include "pcib_if.h" static int pcib_probe(device_t dev); -static int pcib_suspend(device_t dev); static int pcib_resume(device_t dev); static bus_child_present_t pcib_child_present; static bus_alloc_resource_t pcib_alloc_resource; -#ifdef NEW_PCIB static bus_adjust_resource_t pcib_adjust_resource; static bus_release_resource_t pcib_release_resource; static bus_activate_resource_t pcib_activate_resource; static bus_deactivate_resource_t pcib_deactivate_resource; static bus_map_resource_t pcib_map_resource; static bus_unmap_resource_t pcib_unmap_resource; -#endif static int pcib_reset_child(device_t dev, device_t child, int flags); static int pcib_power_for_sleep(device_t pcib, device_t dev, @@ -101,7 +98,7 @@ static device_method_t pcib_methods[] = { DEVMETHOD(device_attach, pcib_attach), DEVMETHOD(device_detach, pcib_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, pcib_suspend), + DEVMETHOD(device_suspend, bus_generic_suspend), DEVMETHOD(device_resume, pcib_resume), /* Bus interface */ @@ -109,19 +106,12 @@ static device_method_t pcib_methods[] = { DEVMETHOD(bus_read_ivar, pcib_read_ivar), DEVMETHOD(bus_write_ivar, pcib_write_ivar), DEVMETHOD(bus_alloc_resource, pcib_alloc_resource), -#ifdef NEW_PCIB DEVMETHOD(bus_adjust_resource, pcib_adjust_resource), DEVMETHOD(bus_release_resource, pcib_release_resource), DEVMETHOD(bus_activate_resource, pcib_activate_resource), DEVMETHOD(bus_deactivate_resource, pcib_deactivate_resource), DEVMETHOD(bus_map_resource, pcib_map_resource), DEVMETHOD(bus_unmap_resource, pcib_unmap_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), DEVMETHOD(bus_reset_child, pcib_reset_child), @@ -150,11 +140,8 @@ static device_method_t pcib_methods[] = { DEFINE_CLASS_0(pcib, pcib_driver, pcib_methods, sizeof(struct pcib_softc)); EARLY_DRIVER_MODULE(pcib, pci, pcib_driver, NULL, NULL, BUS_PASS_BUS); -#if defined(NEW_PCIB) || defined(PCI_HP) SYSCTL_DECL(_hw_pci); -#endif -#ifdef NEW_PCIB static int pci_clear_pcib; SYSCTL_INT(_hw_pci, OID_AUTO, clear_pcib, CTLFLAG_RDTUN, &pci_clear_pcib, 0, "Clear firmware-assigned resources for PCI-PCI bridge I/O windows."); @@ -808,140 +795,6 @@ pcib_alloc_subbus(struct pcib_secbus *bus, device_t child, int *rid, } #endif -#else - -/* - * Is the prefetch window open (eg, can we allocate memory in it?) - */ -static int -pcib_is_prefetch_open(struct pcib_softc *sc) -{ - return (sc->pmembase > 0 && sc->pmembase < sc->pmemlimit); -} - -/* - * Is the nonprefetch window open (eg, can we allocate memory in it?) - */ -static int -pcib_is_nonprefetch_open(struct pcib_softc *sc) -{ - return (sc->membase > 0 && sc->membase < sc->memlimit); -} - -/* - * Is the io window open (eg, can we allocate ports in it?) - */ -static int -pcib_is_io_open(struct pcib_softc *sc) -{ - return (sc->iobase > 0 && sc->iobase < sc->iolimit); -} - -/* - * Get current I/O decode. - */ -static void -pcib_get_io_decode(struct pcib_softc *sc) -{ - device_t dev; - uint32_t iolow; - - dev = sc->dev; - - iolow = pci_read_config(dev, PCIR_IOBASEL_1, 1); - if ((iolow & PCIM_BRIO_MASK) == PCIM_BRIO_32) - sc->iobase = PCI_PPBIOBASE( - pci_read_config(dev, PCIR_IOBASEH_1, 2), iolow); - else - sc->iobase = PCI_PPBIOBASE(0, iolow); - - iolow = pci_read_config(dev, PCIR_IOLIMITL_1, 1); - if ((iolow & PCIM_BRIO_MASK) == PCIM_BRIO_32) - sc->iolimit = PCI_PPBIOLIMIT( - pci_read_config(dev, PCIR_IOLIMITH_1, 2), iolow); - else - sc->iolimit = PCI_PPBIOLIMIT(0, iolow); -} - -/* - * Get current memory decode. - */ -static void -pcib_get_mem_decode(struct pcib_softc *sc) -{ - device_t dev; - pci_addr_t pmemlow; - - dev = sc->dev; - - sc->membase = PCI_PPBMEMBASE(0, - pci_read_config(dev, PCIR_MEMBASE_1, 2)); - sc->memlimit = PCI_PPBMEMLIMIT(0, - pci_read_config(dev, PCIR_MEMLIMIT_1, 2)); - - pmemlow = pci_read_config(dev, PCIR_PMBASEL_1, 2); - if ((pmemlow & PCIM_BRPM_MASK) == PCIM_BRPM_64) - sc->pmembase = PCI_PPBMEMBASE( - pci_read_config(dev, PCIR_PMBASEH_1, 4), pmemlow); - else - sc->pmembase = PCI_PPBMEMBASE(0, pmemlow); - - pmemlow = pci_read_config(dev, PCIR_PMLIMITL_1, 2); - if ((pmemlow & PCIM_BRPM_MASK) == PCIM_BRPM_64) - sc->pmemlimit = PCI_PPBMEMLIMIT( - pci_read_config(dev, PCIR_PMLIMITH_1, 4), pmemlow); - else - sc->pmemlimit = PCI_PPBMEMLIMIT(0, pmemlow); -} - -/* - * Restore previous I/O decode. - */ -static void -pcib_set_io_decode(struct pcib_softc *sc) -{ - device_t dev; - uint32_t iohi; - - dev = sc->dev; - - iohi = sc->iobase >> 16; - if (iohi > 0) - pci_write_config(dev, PCIR_IOBASEH_1, iohi, 2); - pci_write_config(dev, PCIR_IOBASEL_1, sc->iobase >> 8, 1); - - iohi = sc->iolimit >> 16; - if (iohi > 0) - pci_write_config(dev, PCIR_IOLIMITH_1, iohi, 2); - pci_write_config(dev, PCIR_IOLIMITL_1, sc->iolimit >> 8, 1); -} - -/* - * Restore previous memory decode. - */ -static void -pcib_set_mem_decode(struct pcib_softc *sc) -{ - device_t dev; - pci_addr_t pmemhi; - - dev = sc->dev; - - pci_write_config(dev, PCIR_MEMBASE_1, sc->membase >> 16, 2); *** 719 LINES SKIPPED ***