git: 31e15e531c51 - main - x86: Use pci_domain_[de]activate_bus for PCI_RES_BUS resources
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 23 Jan 2024 17:45:51 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=31e15e531c51be35c6907bbb6b1a5ab125f08a0d commit 31e15e531c51be35c6907bbb6b1a5ab125f08a0d Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-01-23 17:35:47 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-01-23 17:35:47 +0000 x86: Use pci_domain_[de]activate_bus for PCI_RES_BUS resources Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D43430 --- sys/x86/include/legacyvar.h | 4 ++++ sys/x86/pci/pci_bus.c | 22 +++++++++++++++++++++- sys/x86/pci/qpi.c | 4 +++- sys/x86/x86/mptable_pci.c | 4 +++- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/sys/x86/include/legacyvar.h b/sys/x86/include/legacyvar.h index 2c9cf1391934..5627e9b90306 100644 --- a/sys/x86/include/legacyvar.h +++ b/sys/x86/include/legacyvar.h @@ -62,6 +62,10 @@ int legacy_pcib_adjust_resource(device_t dev, device_t child, int type, struct resource *r, rman_res_t start, rman_res_t end); int legacy_pcib_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); +int legacy_pcib_activate_resource(device_t dev, device_t child, int type, + int rid, struct resource *r); +int legacy_pcib_deactivate_resource(device_t dev, device_t child, int type, + int rid, struct resource *r); int legacy_pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs); int legacy_pcib_alloc_msix(device_t pcib, device_t dev, int *irq); diff --git a/sys/x86/pci/pci_bus.c b/sys/x86/pci/pci_bus.c index d06cfca53673..cfe0a3974187 100644 --- a/sys/x86/pci/pci_bus.c +++ b/sys/x86/pci/pci_bus.c @@ -625,6 +625,24 @@ legacy_pcib_release_resource(device_t dev, device_t child, int type, int rid, return (pci_domain_release_bus(0, child, rid, r)); return (bus_generic_release_resource(dev, child, type, rid, r)); } + +int +legacy_pcib_activate_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + if (type == PCI_RES_BUS) + return (pci_domain_activate_bus(0, child, rid, r)); + return (bus_generic_activate_resource(dev, child, type, rid, r)); +} + +int +legacy_pcib_deactivate_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + if (type == PCI_RES_BUS) + 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[] = { @@ -643,12 +661,14 @@ static device_method_t legacy_pcib_methods[] = { #if defined(NEW_PCIB) && 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), -#endif 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 index 9b31d7693798..38eed7f67f80 100644 --- a/sys/x86/pci/qpi.c +++ b/sys/x86/pci/qpi.c @@ -284,12 +284,14 @@ static device_method_t qpi_pcib_methods[] = { 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), -#endif 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 index 38a16673551f..5792b0cb7387 100644 --- a/sys/x86/x86/mptable_pci.c +++ b/sys/x86/x86/mptable_pci.c @@ -174,11 +174,13 @@ static device_method_t mptable_hostb_methods[] = { #endif #if defined(NEW_PCIB) && 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), -#endif 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),