From 2434332d91b4f39ff3786b3aab3122174307715e Mon Sep 17 00:00:00 2001 From: dfr Date: Wed, 23 May 2001 19:44:17 +0000 Subject: Make sure that all resource allocation is handled in the pcib device, not the chipset. This is already how the multi-hose systems handle resource allocation and it fixes a bug where dense and bwx memory allocations were not handled properly. Reviewed by: gallatin --- sys/alpha/pci/apecs_pci.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'sys/alpha/pci/apecs_pci.c') diff --git a/sys/alpha/pci/apecs_pci.c b/sys/alpha/pci/apecs_pci.c index 2190748..e18daa6 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), -- cgit v1.1