From nobody Thu Jul 18 17:56:27 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WQ0qH3P7Zz5Rq7N; Thu, 18 Jul 2024 17:56:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WQ0qH2zqXz4lW3; Thu, 18 Jul 2024 17:56:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721325387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ASS/AkQJBamgADECYD/FERyobeFDoS9ByA8DdYOXG+Q=; b=tIDXOBBETe9RNe5D/SRFGVJldc3KNomCgiBQiK1KuSyg06MqrHoyG89MIg8RBvx+1psFM0 o+sRVg+91jGZ2cT2UIC0HsY27am2L+LKKN8itw1Jr994iwkXlIN6zYNwqho9P6TQJGad0F 0545ZBnoqgpV2VlwUf66UTV/0keqx/YqC7HgFHVTrVHMXs7hSFa1FhazBnuDZytwLsvmsA NqkyKmjq+pU2Yc+K/l0fdt2mqrXst4REz7STld/bzBmpuACH4X3lQSDD+26yLMYUUqqx8P I1HfqbVfUU+67t7SArbbBVcp11/zJe96scmaLqtZ5zrA4vnDC2DUYv8nKB1waQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721325387; a=rsa-sha256; cv=none; b=R73t+ePFr+0ViVc94Epa+rAdt4idXPJNj6etW4ExERq2EQl70yx2TUzWeXqKnt+jxS81qb nWAGXjH1/BxKz8uRfOBYiej1IrIZYPKjNr6Z/Q4E9ThrkqKh+NVVSg8E8PdzwyBe5G03vg l1E4ViN5iQO4xmLrahcjD0lEiX9Sxn/rhMqSXX/NWYPzD6r5ujDFEZtbDCBs3cwbfDnapQ Ogb3aXQtDQaM8Qp38FDVp6AY1LZQ+lPwtHwUMp/g3Tkfg2NUB8x64Prpb7E//+gJTteb0k hQ5ePHazH5LBgxz+TGrBuIJXLf/i9xSw8tmSHRRuydNIPRumE0cpzHv7YDq0ZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721325387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ASS/AkQJBamgADECYD/FERyobeFDoS9ByA8DdYOXG+Q=; b=pWAc4Hk0YAGS2pUjV7MkPPIISt5JzL+lhsppW2d8eSDRpwDAALT6NEMpU7R089vlCWvuwC 0DTb/6/DFKzu0WuzSGiqqc5LDC7wBM61yp0u2AYNNAf/zCYNCtSIOXCyDNWiYsDf+0dGn9 taxZawFko4thFkODThgJF/UzRG/g5XhTi4EJ9BoGjFIMD9LxwAoMCS57aD+OIDMQR8F/4R irqKJh+ZhXcrh0z5+SOFPAlLs9foRlf22aNkXiHN1FCR5ZSfJwZk9te0Y3bdKpqbTTBW4F UzJ5Ot+6d4tQDtSSBWXgzaQK4Vho18o6KIh7VV/Te+G+AgJC8L8gVT9b67RhfA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WQ0qH2XwzzyXt; Thu, 18 Jul 2024 17:56:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46IHuRLk032251; Thu, 18 Jul 2024 17:56:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46IHuRhK032248; Thu, 18 Jul 2024 17:56:27 GMT (envelope-from git) Date: Thu, 18 Jul 2024 17:56:27 GMT Message-Id: <202407181756.46IHuRhK032248@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: e1d442a6db14 - main - Retire unused non-PCI_RES_BUS code List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e1d442a6db14adcfc11fc204225037da4332dd21 Auto-Submitted: auto-generated The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=e1d442a6db14adcfc11fc204225037da4332dd21 commit e1d442a6db14adcfc11fc204225037da4332dd21 Author: Jessica Clarke AuthorDate: 2024-07-18 17:55:33 +0000 Commit: Jessica Clarke CommitDate: 2024-07-18 17:55:33 +0000 Retire unused non-PCI_RES_BUS code All architectures define PCI_RES_BUS unconditionally now that only NEW_PCIB is supported, so we no longer need the legacy code. Reviewed by: jhb, andrew Differential Revision: https://reviews.freebsd.org/D32955 --- sys/arm/mv/mv_pci.c | 18 ----------- sys/arm64/cavium/thunder_pcie_pem.c | 18 ----------- sys/dev/acpica/acpi_pcib_acpi.c | 35 --------------------- sys/dev/cardbus/cardbus.c | 10 ------ sys/dev/cardbus/cardbusvar.h | 2 -- sys/dev/ofw/ofw_pcib.c | 20 ------------ sys/dev/pccbb/pccbb_pci.c | 46 ---------------------------- sys/dev/pci/pci.c | 18 ----------- sys/dev/pci/pci_host_generic.c | 26 ---------------- sys/dev/pci/pci_pci.c | 61 +------------------------------------ sys/dev/pci/pci_private.h | 2 -- sys/dev/pci/pci_subr.c | 2 -- sys/dev/pci/pcib_private.h | 4 --- sys/x86/pci/pci_bus.c | 11 ------- sys/x86/pci/qpi.c | 9 ------ sys/x86/x86/mptable_pci.c | 10 ------ 16 files changed, 1 insertion(+), 291 deletions(-) diff --git a/sys/arm/mv/mv_pci.c b/sys/arm/mv/mv_pci.c index eb1af5a4e237..87c6fbae3ca4 100644 --- a/sys/arm/mv/mv_pci.c +++ b/sys/arm/mv/mv_pci.c @@ -913,11 +913,9 @@ mv_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, 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)); @@ -941,20 +939,16 @@ static int mv_pcib_adjust_resource(device_t dev, device_t child, 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 (rman_get_type(r)) { case SYS_RES_IOPORT: case SYS_RES_MEMORY: return (bus_generic_rman_adjust_resource(dev, child, 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, r, start, end)); } @@ -963,18 +957,14 @@ mv_pcib_adjust_resource(device_t dev, device_t child, static int mv_pcib_release_resource(device_t dev, device_t child, struct resource *res) { -#ifdef PCI_RES_BUS struct mv_pcib_softc *sc = device_get_softc(dev); -#endif switch (rman_get_type(res)) { case SYS_RES_IOPORT: case SYS_RES_MEMORY: return (bus_generic_rman_release_resource(dev, child, res)); -#ifdef PCI_RES_BUS case PCI_RES_BUS: return (pci_domain_release_bus(sc->ap_segment, child, res)); -#endif default: return (bus_generic_release_resource(dev, child, res)); } @@ -983,18 +973,14 @@ mv_pcib_release_resource(device_t dev, device_t child, struct resource *res) static int mv_pcib_activate_resource(device_t dev, device_t child, struct resource *r) { -#ifdef PCI_RES_BUS struct mv_pcib_softc *sc = device_get_softc(dev); -#endif switch (rman_get_type(r)) { case SYS_RES_IOPORT: case SYS_RES_MEMORY: return (bus_generic_rman_activate_resource(dev, child, r)); -#ifdef PCI_RES_BUS case PCI_RES_BUS: return (pci_domain_activate_bus(sc->ap_segment, child, r)); -#endif default: return (bus_generic_activate_resource(dev, child, r)); } @@ -1003,18 +989,14 @@ mv_pcib_activate_resource(device_t dev, device_t child, struct resource *r) static int mv_pcib_deactivate_resource(device_t dev, device_t child, struct resource *r) { -#ifdef PCI_RES_BUS struct mv_pcib_softc *sc = device_get_softc(dev); -#endif switch (rman_get_type(r)) { case SYS_RES_IOPORT: case SYS_RES_MEMORY: return (bus_generic_rman_deactivate_resource(dev, child, r)); -#ifdef PCI_RES_BUS case PCI_RES_BUS: return (pci_domain_deactivate_bus(sc->ap_segment, child, r)); -#endif default: return (bus_generic_deactivate_resource(dev, child, r)); } diff --git a/sys/arm64/cavium/thunder_pcie_pem.c b/sys/arm64/cavium/thunder_pcie_pem.c index c334342afe4a..89393d9701d0 100644 --- a/sys/arm64/cavium/thunder_pcie_pem.c +++ b/sys/arm64/cavium/thunder_pcie_pem.c @@ -254,16 +254,12 @@ 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(PCI_RES_BUS) struct thunder_pem_softc *sc; sc = device_get_softc(dev); -#endif switch (rman_get_type(r)) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_activate_bus(sc->id, child, r)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_activate_resource(dev, child, r)); @@ -276,16 +272,12 @@ static int thunder_pem_deactivate_resource(device_t dev, device_t child, struct resource *r) { -#if defined(PCI_RES_BUS) struct thunder_pem_softc *sc; sc = device_get_softc(dev); -#endif switch (rman_get_type(r)) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_deactivate_bus(sc->id, child, r)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_deactivate_resource(dev, child, r)); @@ -350,16 +342,12 @@ 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(PCI_RES_BUS) struct thunder_pem_softc *sc; sc = device_get_softc(dev); -#endif switch (rman_get_type(res)) { -#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, res, start, @@ -671,11 +659,9 @@ thunder_pem_alloc_resource(device_t dev, device_t child, int type, int *rid, 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; @@ -718,15 +704,11 @@ static int thunder_pem_release_resource(device_t dev, device_t child, struct resource *res) { device_t parent_dev; -#if defined(PCI_RES_BUS) struct thunder_pem_softc *sc = device_get_softc(dev); -#endif switch (rman_get_type(res)) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_release_bus(sc->id, child, res)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_release_resource(dev, child, res)); diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c index 18fece293183..ff211102cc3c 100644 --- a/sys/dev/acpica/acpi_pcib_acpi.c +++ b/sys/dev/acpica/acpi_pcib_acpi.c @@ -96,14 +96,12 @@ static struct resource *acpi_pcib_acpi_alloc_resource(device_t dev, static int acpi_pcib_acpi_adjust_resource(device_t dev, device_t child, 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, struct resource *r); static int acpi_pcib_acpi_activate_resource(device_t dev, device_t child, struct resource *r); static int acpi_pcib_acpi_deactivate_resource(device_t dev, device_t child, 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); @@ -121,15 +119,9 @@ static device_method_t acpi_pcib_acpi_methods[] = { 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), @@ -243,11 +235,9 @@ acpi_pcib_producer_handler(ACPI_RESOURCE *res, void *context) 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); } @@ -282,7 +272,6 @@ acpi_pcib_producer_handler(ACPI_RESOURCE *res, void *context) 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) @@ -296,7 +285,6 @@ get_decoded_bus_range(struct acpi_hpcib_softc *sc, rman_res_t *startp, *endp = rle->end; return (true); } -#endif static int acpi_pcib_osc(struct acpi_hpcib_softc *sc, uint32_t osc_ctl) @@ -361,11 +349,9 @@ acpi_pcib_acpi_attach(device_t dev) 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; @@ -479,7 +465,6 @@ acpi_pcib_acpi_attach(device_t dev) } } -#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 @@ -524,18 +509,6 @@ acpi_pcib_acpi_attach(device_t dev) } } } -#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) @@ -566,9 +539,7 @@ acpi_pcib_acpi_attach(device_t dev) 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); } @@ -700,11 +671,9 @@ acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid, #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); @@ -728,15 +697,12 @@ acpi_pcib_acpi_adjust_resource(device_t dev, device_t child, struct acpi_hpcib_softc *sc; sc = device_get_softc(dev); -#ifdef PCI_RES_BUS if (rman_get_type(r) == 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, r, start, end)); } -#ifdef PCI_RES_BUS int acpi_pcib_acpi_release_resource(device_t dev, device_t child, struct resource *r) @@ -772,7 +738,6 @@ acpi_pcib_acpi_deactivate_resource(device_t dev, device_t child, return (pci_domain_deactivate_bus(sc->ap_segment, child, r)); return (bus_generic_deactivate_resource(dev, child, 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 index ffa90ebb6224..ff6a0992c6b9 100644 --- a/sys/dev/cardbus/cardbus.c +++ b/sys/dev/cardbus/cardbus.c @@ -93,13 +93,10 @@ static int 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 @@ cardbus_attach(device_t cbdev) 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 index 5ebedf2e2621..12ad42ee94f7 100644 --- a/sys/dev/cardbus/cardbusvar.h +++ b/sys/dev/cardbus/cardbusvar.h @@ -68,9 +68,7 @@ struct cardbus_devinfo 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 index 3f55e45f5b92..3dd90ab5002c 100644 --- a/sys/dev/ofw/ofw_pcib.c +++ b/sys/dev/ofw/ofw_pcib.c @@ -421,17 +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(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, @@ -445,16 +441,12 @@ 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(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); -#endif switch (rman_get_type(res)) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_release_bus(sc->sc_pci_domain, child, res)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_release_resource(bus, child, res)); @@ -505,16 +497,12 @@ 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(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); -#endif switch (rman_get_type(res)) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_activate_bus(sc->sc_pci_domain, child, res)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_activate_resource(bus, child, res)); @@ -621,17 +609,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(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); -#endif switch (rman_get_type(res)) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_deactivate_bus(sc->sc_pci_domain, child, res)); -#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: return (bus_generic_rman_deactivate_resource(bus, child, res)); @@ -644,17 +628,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(PCI_RES_BUS) struct ofw_pci_softc *sc; sc = device_get_softc(bus); -#endif switch (rman_get_type(res)) { -#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, res, diff --git a/sys/dev/pccbb/pccbb_pci.c b/sys/dev/pccbb/pccbb_pci.c index eca370d17ca5..263ef0fd8aa8 100644 --- a/sys/dev/pccbb/pccbb_pci.c +++ b/sys/dev/pccbb/pccbb_pci.c @@ -276,10 +276,6 @@ cbb_print_config(device_t dev) 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 @@ cbb_pci_attach(device_t brdev) 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 @@ cbb_pci_attach(device_t brdev) 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 @@ err: 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 @@ cbb_pci_filt(void *arg) 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) @@ -836,7 +796,6 @@ cbb_pci_release_resource(device_t bus, device_t child, struct resource *r) } return (cbb_release_resource(bus, child, r)); } -#endif /************************************************************************/ /* PCI compat methods */ @@ -931,14 +890,9 @@ static device_method_t cbb_methods[] = { /* 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 index efe017f9a3ba..bda6919e9552 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -405,11 +405,9 @@ 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(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, @@ -3706,7 +3704,6 @@ xhci_early_takeover(device_t self) 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) @@ -3862,7 +3859,6 @@ pci_alloc_secbus(device_t dev, device_t child, int *rid, rman_res_t start, 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) @@ -4118,13 +4114,11 @@ pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask) 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 * @@ -4470,14 +4464,11 @@ pci_attach_common(device_t dev) { 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); @@ -4485,7 +4476,6 @@ pci_attach_common(device_t dev) 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); @@ -4517,20 +4507,16 @@ pci_attach(device_t dev) 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)); } @@ -5111,10 +5097,8 @@ pci_child_detached(device_t dev, device_t child) 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); } @@ -5551,11 +5535,9 @@ pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, 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 index c3f4f03b76ad..b47a90348388 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -416,16 +416,12 @@ int pci_host_generic_core_release_resource(device_t dev, device_t child, struct resource *res) { -#if defined(PCI_RES_BUS) struct generic_pcie_core_softc *sc; sc = device_get_softc(dev); -#endif switch (rman_get_type(res)) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_release_bus(sc->ecam, child, res)); -#endif case SYS_RES_IOPORT: case SYS_RES_MEMORY: return (bus_generic_rman_release_resource(dev, child, res)); @@ -506,22 +502,16 @@ 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(PCI_RES_BUS) struct generic_pcie_core_softc *sc; -#endif struct resource *res; -#if defined(PCI_RES_BUS) sc = device_get_softc(dev); -#endif switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: res = pci_domain_alloc_bus(sc->ecam, child, rid, start, end, count, flags); break; -#endif case SYS_RES_IOPORT: case SYS_RES_MEMORY: res = bus_generic_rman_alloc_resource(dev, child, type, rid, @@ -543,16 +533,12 @@ 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(PCI_RES_BUS) struct generic_pcie_core_softc *sc; sc = device_get_softc(dev); -#endif switch (rman_get_type(r)) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_activate_bus(sc->ecam, child, r)); -#endif case SYS_RES_IOPORT: case SYS_RES_MEMORY: return (bus_generic_rman_activate_resource(dev, child, r)); @@ -565,16 +551,12 @@ static int generic_pcie_deactivate_resource(device_t dev, device_t child, struct resource *r) { -#if defined(PCI_RES_BUS) struct generic_pcie_core_softc *sc; sc = device_get_softc(dev); -#endif switch (rman_get_type(r)) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_deactivate_bus(sc->ecam, child, r)); -#endif case SYS_RES_IOPORT: case SYS_RES_MEMORY: return (bus_generic_rman_deactivate_resource(dev, child, r)); @@ -587,17 +569,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(PCI_RES_BUS) struct generic_pcie_core_softc *sc; sc = device_get_softc(dev); -#endif switch (rman_get_type(res)) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (pci_domain_adjust_bus(sc->ecam, child, res, start, end)); -#endif case SYS_RES_IOPORT: case SYS_RES_MEMORY: return (bus_generic_rman_adjust_resource(dev, child, res, @@ -619,10 +597,8 @@ generic_pcie_map_resource(device_t dev, device_t child, struct resource *r, type = rman_get_type(r); switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (EINVAL); -#endif case SYS_RES_IOPORT: case SYS_RES_MEMORY: break; @@ -658,10 +634,8 @@ generic_pcie_unmap_resource(device_t dev, device_t child, struct resource *r, type = rman_get_type(r); switch (type) { -#if defined(PCI_RES_BUS) case PCI_RES_BUS: return (EINVAL); -#endif case SYS_RES_IOPORT: case SYS_RES_MEMORY: break; diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index 7977b9148c9b..0d74cfcf907e 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -178,10 +178,8 @@ static int pcib_is_resource_managed(struct pcib_softc *sc, struct resource *r) { -#ifdef PCI_RES_BUS if (rman_get_type(r) == PCI_RES_BUS) return (rman_is_region_manager(r, &sc->bus.rman)); -#endif return (pcib_get_resource_window(sc, r) != NULL); } @@ -605,7 +603,6 @@ pcib_free_windows(struct pcib_softc *sc) 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 @@ -793,7 +790,6 @@ pcib_alloc_subbus(struct pcib_secbus *bus, device_t child, int *rid, flags)); return (NULL); } -#endif #ifdef PCI_HP /* @@ -1400,10 +1396,6 @@ pcib_attach_common(device_t dev) * 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); /* @@ -1431,20 +1423,6 @@ pcib_attach_common(device_t dev) * 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 @@ -1457,34 +1435,6 @@ pcib_attach_common(device_t dev) 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)) @@ -1508,9 +1458,7 @@ pcib_attach_common(device_t dev) #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) @@ -1617,9 +1565,7 @@ pcib_detach(device_t dev) if (error) return (error); pcib_free_windows(sc); -#ifdef PCI_RES_BUS pcib_free_secbus(dev, &sc->bus); -#endif return (0); } @@ -2097,11 +2043,9 @@ pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, } 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); @@ -2181,7 +2125,6 @@ pcib_adjust_resource(device_t bus, device_t child, struct resource *r, if (!pcib_is_resource_managed(sc, r)) return (bus_generic_adjust_resource(bus, child, r, start, end)); *** 210 LINES SKIPPED ***