diff --git a/sys/alpha/pci/apecs.c b/sys/alpha/pci/apecs.c index ba71978df273..4b30176a9bca 100644 --- a/sys/alpha/pci/apecs.c +++ b/sys/alpha/pci/apecs.c @@ -69,7 +69,6 @@ #include #include -#include #include #include #include @@ -151,12 +150,6 @@ apecs_write_hae(u_int64_t hae) static int apecs_probe(device_t dev); static int apecs_attach(device_t dev); -static struct resource *apecs_alloc_resource(device_t bus, device_t child, - int type, int *rid, u_long start, - u_long end, u_long count, - u_int flags); -static int apecs_release_resource(device_t bus, device_t child, - int type, int rid, struct resource *r); static int apecs_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_intr_t *intr, void *arg, void **cookiep); @@ -169,10 +162,6 @@ static device_method_t apecs_methods[] = { DEVMETHOD(device_attach, apecs_attach), /* Bus interface */ - DEVMETHOD(bus_alloc_resource, apecs_alloc_resource), - DEVMETHOD(bus_release_resource, apecs_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), DEVMETHOD(bus_setup_intr, apecs_setup_intr), DEVMETHOD(bus_teardown_intr, apecs_teardown_intr), @@ -280,7 +269,6 @@ apecs_probe(device_t dev) } apecs_hae_mem = REGVAL(EPIC_HAXR1); - pci_init_resources(); isa_init_intr(); apecs_init_sgmap(); @@ -314,29 +302,6 @@ apecs_attach(device_t dev) return 0; } -static struct resource * -apecs_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) -{ - if ((hwrpb->rpb_type == ST_DEC_2100_A50) && - (type == SYS_RES_IRQ)) - return isa_alloc_intr(bus, child, start); - else - return pci_alloc_resource(bus, child, type, rid, - start, end, count, flags); -} - -static int -apecs_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - if ((hwrpb->rpb_type == ST_DEC_2100_A50) && - (type == SYS_RES_IRQ)) - return isa_release_intr(bus, child, r); - else - return pci_release_resource(bus, child, type, rid, r); -} - static void apecs_disable_intr(int vector) { diff --git a/sys/alpha/pci/apecs_pci.c b/sys/alpha/pci/apecs_pci.c index 2190748e98eb..e18daa647bda 100644 --- a/sys/alpha/pci/apecs_pci.c +++ b/sys/alpha/pci/apecs_pci.c @@ -36,9 +36,13 @@ #include #include #include +#include +#include #include #include +#include +#include #include "alphapci_if.h" #include "pcib_if.h" @@ -52,6 +56,7 @@ apecs_pcib_probe(device_t dev) { device_set_desc(dev, "2107x PCI host bus adapter"); + pci_init_resources(); device_add_child(dev, "pci", 0); return 0; @@ -67,6 +72,29 @@ apecs_pcib_read_ivar(device_t dev, device_t child, int which, u_long *result) return ENOENT; } +static struct resource * +apecs_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) +{ + if ((hwrpb->rpb_type == ST_DEC_2100_A50) && + (type == SYS_RES_IRQ)) + return isa_alloc_intr(bus, child, start); + else + return pci_alloc_resource(bus, child, type, rid, + start, end, count, flags); +} + +static int +apecs_pcib_release_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + if ((hwrpb->rpb_type == ST_DEC_2100_A50) && + (type == SYS_RES_IRQ)) + return isa_release_intr(bus, child, r); + else + return pci_release_resource(bus, child, type, rid, r); +} + static void * apecs_pcib_cvt_dense(device_t dev, vm_offset_t addr) { @@ -175,10 +203,10 @@ static device_method_t apecs_pcib_methods[] = { /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, apecs_pcib_read_ivar), - 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), + DEVMETHOD(bus_alloc_resource, apecs_pcib_alloc_resource), + DEVMETHOD(bus_release_resource, apecs_pcib_release_resource), + DEVMETHOD(bus_activate_resource, pci_activate_resource), + DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), diff --git a/sys/alpha/pci/cia.c b/sys/alpha/pci/cia.c index f48c66314f7e..c02130f005d4 100644 --- a/sys/alpha/pci/cia.c +++ b/sys/alpha/pci/cia.c @@ -105,7 +105,6 @@ #include #include -#include #include #include #include @@ -196,10 +195,6 @@ static device_method_t cia_methods[] = { /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_alloc_resource, pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), DEVMETHOD(bus_setup_intr, cia_setup_intr), DEVMETHOD(bus_teardown_intr, cia_teardown_intr), @@ -393,7 +388,6 @@ cia_probe(device_t dev) cia0 = dev; device_set_desc(dev, "2117x Core Logic chipset"); /* XXX */ - pci_init_resources(); isa_init_intr(); cia_rev = REGVAL(CIA_CSR_REV) & REV_MASK; diff --git a/sys/alpha/pci/cia_pci.c b/sys/alpha/pci/cia_pci.c index 2a36ba207849..a5ae95bbe85f 100644 --- a/sys/alpha/pci/cia_pci.c +++ b/sys/alpha/pci/cia_pci.c @@ -103,6 +103,8 @@ #include #include +#include +#include #include "alphapci_if.h" #include "pcib_if.h" @@ -116,6 +118,7 @@ cia_pcib_probe(device_t dev) { device_set_desc(dev, "2117x PCI host bus adapter"); + pci_init_resources(); device_add_child(dev, "pci", 0); return 0; @@ -395,10 +398,10 @@ static device_method_t cia_pcib_methods[] = { /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, cia_pcib_read_ivar), - 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), + DEVMETHOD(bus_alloc_resource, pci_alloc_resource), + DEVMETHOD(bus_release_resource, pci_release_resource), + DEVMETHOD(bus_activate_resource, pci_activate_resource), + DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), DEVMETHOD(bus_setup_intr, alpha_platform_pci_setup_intr), DEVMETHOD(bus_teardown_intr, alpha_platform_pci_teardown_intr), diff --git a/sys/alpha/pci/irongate.c b/sys/alpha/pci/irongate.c index b1ba10dcf931..17bdd33c2481 100644 --- a/sys/alpha/pci/irongate.c +++ b/sys/alpha/pci/irongate.c @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -100,10 +99,6 @@ static device_method_t irongate_methods[] = { /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_alloc_resource, pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), DEVMETHOD(bus_setup_intr, isa_setup_intr), DEVMETHOD(bus_teardown_intr, isa_teardown_intr), @@ -131,8 +126,8 @@ irongate_init() bwx_init_space(&io_space, KV(IRONGATE_IO)); bwx_init_space(&mem_space, KV(IRONGATE_MEM)); - busspace_isa_io = (kobj_t) &io_space; - busspace_isa_mem = (kobj_t) &mem_space; + busspace_isa_io = (struct alpha_busspace *) &io_space; + busspace_isa_mem = (struct alpha_busspace *) &mem_space; if (platform.pci_intr_init) platform.pci_intr_init(); @@ -146,7 +141,6 @@ irongate_probe(device_t dev) return ENXIO; irongate0 = dev; device_set_desc(dev, "AMD 751 Core Logic chipset"); - pci_init_resources(); isa_init_intr(); device_add_child(dev, "pcib", 0); return 0; diff --git a/sys/alpha/pci/irongate_pci.c b/sys/alpha/pci/irongate_pci.c index 49505474f6ee..ab0c27b6db73 100644 --- a/sys/alpha/pci/irongate_pci.c +++ b/sys/alpha/pci/irongate_pci.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "alphapci_if.h" #include "pcib_if.h" @@ -54,6 +55,7 @@ irongate_pcib_probe(device_t dev) device_set_desc(dev, "AMD 751 PCI host bus adapter"); + pci_init_resources(); device_add_child(dev, "pci", 0); /* @@ -187,10 +189,10 @@ static device_method_t irongate_pcib_methods[] = { /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, irongate_pcib_read_ivar), - 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), + DEVMETHOD(bus_alloc_resource, pci_alloc_resource), + DEVMETHOD(bus_release_resource, pci_release_resource), + DEVMETHOD(bus_activate_resource, pci_activate_resource), + DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), diff --git a/sys/alpha/pci/lca.c b/sys/alpha/pci/lca.c index 3b942f7a9d33..b1bfa15bd48c 100644 --- a/sys/alpha/pci/lca.c +++ b/sys/alpha/pci/lca.c @@ -38,10 +38,8 @@ #include #include -#include #include #include -#include #include #include #include @@ -114,23 +112,12 @@ lca_write_hae(u_int64_t hae) static int lca_probe(device_t dev); static int lca_attach(device_t dev); -static struct resource *lca_alloc_resource(device_t bus, device_t child, - int type, int *rid, u_long start, - u_long end, u_long count, - u_int flags); -static int lca_release_resource(device_t bus, device_t child, - int type, int rid, struct resource *r); - static device_method_t lca_methods[] = { /* Device interface */ DEVMETHOD(device_probe, lca_probe), DEVMETHOD(device_attach, lca_attach), /* Bus interface */ - DEVMETHOD(bus_alloc_resource, lca_alloc_resource), - DEVMETHOD(bus_release_resource, lca_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), DEVMETHOD(bus_setup_intr, isa_setup_intr), DEVMETHOD(bus_teardown_intr, isa_teardown_intr), @@ -237,7 +224,6 @@ lca_probe(device_t dev) lca0 = dev; device_set_desc(dev, "21066 Core Logic chipset"); /* XXX */ - pci_init_resources(); isa_init_intr(); lca_init_sgmap(); @@ -264,26 +250,5 @@ lca_attach(device_t dev) return 0; } -static struct resource * -lca_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) -{ - if (type == SYS_RES_IRQ) - return isa_alloc_intr(bus, child, start); - else - return pci_alloc_resource(bus, child, type, rid, - start, end, count, flags); -} - -static int -lca_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - if (type == SYS_RES_IRQ) - return isa_release_intr(bus, child, r); - else - return pci_release_resource(bus, child, type, rid, r); -} - DRIVER_MODULE(lca, root, lca_driver, lca_devclass, 0, 0); diff --git a/sys/alpha/pci/lca_pci.c b/sys/alpha/pci/lca_pci.c index f139b59ab3a5..70c873a574e5 100644 --- a/sys/alpha/pci/lca_pci.c +++ b/sys/alpha/pci/lca_pci.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -39,6 +40,8 @@ #include #include +#include +#include #include "alphapci_if.h" #include "pcib_if.h" @@ -52,6 +55,7 @@ lca_pcib_probe(device_t dev) { device_set_desc(dev, "21066 PCI host bus adapter"); + pci_init_resources(); device_add_child(dev, "pci", 0); return 0; @@ -67,6 +71,27 @@ lca_pcib_read_ivar(device_t dev, device_t child, int which, u_long *result) return ENOENT; } +static struct resource * +lca_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) +{ + if (type == SYS_RES_IRQ) + return isa_alloc_intr(bus, child, start); + else + return pci_alloc_resource(bus, child, type, rid, + start, end, count, flags); +} + +static int +lca_pcib_release_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + if (type == SYS_RES_IRQ) + return isa_release_intr(bus, child, r); + else + return pci_release_resource(bus, child, type, rid, r); +} + static void * lca_pcib_cvt_dense(device_t dev, vm_offset_t addr) { @@ -171,10 +196,10 @@ static device_method_t lca_pcib_methods[] = { /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, lca_pcib_read_ivar), - 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), + DEVMETHOD(bus_alloc_resource, lca_pcib_alloc_resource), + DEVMETHOD(bus_release_resource, lca_pcib_release_resource), + DEVMETHOD(bus_activate_resource, pci_activate_resource), + DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), diff --git a/sys/alpha/pci/t2.c b/sys/alpha/pci/t2.c index 5a80b6e5456e..05c0a0b027e8 100644 --- a/sys/alpha/pci/t2.c +++ b/sys/alpha/pci/t2.c @@ -66,7 +66,6 @@ #include #include -#include #include #include #include @@ -165,10 +164,6 @@ static device_method_t t2_methods[] = { DEVMETHOD(device_attach, t2_attach), /* Bus interface */ - DEVMETHOD(bus_alloc_resource, pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), DEVMETHOD(bus_setup_intr, t2_setup_intr), DEVMETHOD(bus_teardown_intr, t2_teardown_intr), @@ -303,8 +298,8 @@ t2_init() swiz_init_space_hae(&mem_space, KV(T2_PCI_SPARSE), t2_set_hae_mem, 0); - busspace_isa_io = (kobj_t) &io_space; - busspace_isa_mem = (kobj_t) &mem_space; + busspace_isa_io = (struct alpha_busspace *) &io_space; + busspace_isa_mem = (struct alpha_busspace *) &mem_space; chipset = t2_chipset; @@ -350,8 +345,6 @@ t2_probe(device_t dev) /* t2_num_hoses = 2; XXX not ready for this yet */ } - pci_init_resources(); - for (h = 0; h < t2_num_hoses; h++) t2_csr_init(h); diff --git a/sys/alpha/pci/t2_pci.c b/sys/alpha/pci/t2_pci.c index cd0bf06466f2..82a650bdfa0e 100644 --- a/sys/alpha/pci/t2_pci.c +++ b/sys/alpha/pci/t2_pci.c @@ -39,6 +39,7 @@ #include #include +#include #include "alphapci_if.h" #include "pcib_if.h" @@ -54,6 +55,8 @@ t2_pcib_probe(device_t dev) device_set_desc(dev, "T2 PCI host bus adapter"); + pci_init_resources(); + child = device_add_child(dev, "pci", 0); device_set_ivars(child, 0); @@ -177,10 +180,10 @@ static device_method_t t2_pcib_methods[] = { /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, t2_pcib_read_ivar), - 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), + DEVMETHOD(bus_alloc_resource, pci_alloc_resource), + DEVMETHOD(bus_release_resource, pci_release_resource), + DEVMETHOD(bus_activate_resource, pci_activate_resource), + DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), diff --git a/sys/alpha/pci/tsunami.c b/sys/alpha/pci/tsunami.c index feacfa2a9cd4..3aac951be158 100644 --- a/sys/alpha/pci/tsunami.c +++ b/sys/alpha/pci/tsunami.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -248,8 +247,8 @@ tsunami_init() bwx_init_space(&io_space, KV(TSUNAMI_IO(0))); bwx_init_space(&mem_space, KV(TSUNAMI_MEM(0))); - busspace_isa_io = (kobj_t) &io_space; - busspace_isa_mem = (kobj_t) &mem_space; + busspace_isa_io = (struct alpha_busspace *) &io_space; + busspace_isa_mem = (struct alpha_busspace *) &mem_space; chipset = tsunami_chipset; platform.pci_intr_enable = tsunami_intr_enable; @@ -274,7 +273,6 @@ tsunami_probe(device_t dev) else tsunami_num_pchips = 1; - pci_init_resources(); isa_init_intr(); for(i = 0; i < tsunami_num_pchips; i++) { diff --git a/sys/alpha/pci/tsunami_pci.c b/sys/alpha/pci/tsunami_pci.c index b77754a85d21..495161c2d971 100644 --- a/sys/alpha/pci/tsunami_pci.c +++ b/sys/alpha/pci/tsunami_pci.c @@ -63,6 +63,7 @@ tsunami_pcib_probe(device_t dev) device_set_desc(dev, "21271 PCI host bus adapter"); + pci_init_resources(); /* XXX probably don't need */ child = device_add_child(dev, "pci", -1); bwx_init_space(&sc->io, KV(TSUNAMI_IO(device_get_unit(dev)))); @@ -89,8 +90,8 @@ tsunami_pcib_probe(device_t dev) * isn't stictly necessary but it keeps things tidy. */ if (device_get_unit(dev) == 0) { - busspace_isa_io = (kobj_t) &sc->io; - busspace_isa_mem = (kobj_t) &sc->mem; + busspace_isa_io = (struct alpha_busspace *) &sc->io; + busspace_isa_mem = (struct alpha_busspace *) &sc->mem; } return 0;