Skip to content

Commit

Permalink
x86: Use pci_domain_[de]activate_bus for PCI_RES_BUS resources
Browse files Browse the repository at this point in the history
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43430
  • Loading branch information
bsdjhb committed Jan 23, 2024
1 parent e9eb353 commit 31e15e5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
4 changes: 4 additions & 0 deletions sys/x86/include/legacyvar.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
22 changes: 21 additions & 1 deletion sys/x86/pci/pci_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand All @@ -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),

Expand Down
4 changes: 3 additions & 1 deletion sys/x86/pci/qpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down
4 changes: 3 additions & 1 deletion sys/x86/x86/mptable_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down

0 comments on commit 31e15e5

Please sign in to comment.