diff options
| author | Peter Wemm <peter@FreeBSD.org> | 1999-04-16 21:22:55 +0000 |
|---|---|---|
| committer | Peter Wemm <peter@FreeBSD.org> | 1999-04-16 21:22:55 +0000 |
| commit | 6182fdbda82d66e069d86382987606cbba1972b1 (patch) | |
| tree | 8b86f578632961e1cd2aed57a2be13d993257d35 /sys/alpha/pci | |
| parent | 24c38be4da1f835f2125da7d5fa3632bc028131d (diff) | |
Notes
Diffstat (limited to 'sys/alpha/pci')
| -rw-r--r-- | sys/alpha/pci/apecs.c | 66 | ||||
| -rw-r--r-- | sys/alpha/pci/apecs_pci.c | 73 | ||||
| -rw-r--r-- | sys/alpha/pci/cia.c | 15 | ||||
| -rw-r--r-- | sys/alpha/pci/cia_pci.c | 73 | ||||
| -rw-r--r-- | sys/alpha/pci/lca.c | 50 | ||||
| -rw-r--r-- | sys/alpha/pci/lca_pci.c | 73 | ||||
| -rw-r--r-- | sys/alpha/pci/pcibus.c | 78 |
7 files changed, 386 insertions, 42 deletions
diff --git a/sys/alpha/pci/apecs.c b/sys/alpha/pci/apecs.c index 66bedcfcf03d..fb86dc97e315 100644 --- a/sys/alpha/pci/apecs.c +++ b/sys/alpha/pci/apecs.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: apecs.c,v 1.4 1998/12/04 22:54:42 archie Exp $ + * $Id: apecs.c,v 1.5 1999/01/18 20:15:07 gallatin Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -60,12 +60,15 @@ #include <sys/kernel.h> #include <sys/module.h> #include <sys/bus.h> +#include <machine/bus.h> #include <sys/rman.h> #include <alpha/pci/apecsreg.h> #include <alpha/pci/apecsvar.h> #include <alpha/pci/pcibus.h> +#include <alpha/isa/isavar.h> #include <machine/intr.h> +#include <machine/resource.h> #include <machine/intrcnt.h> #include <machine/cpuconf.h> #include <machine/swiz.h> @@ -75,7 +78,6 @@ static devclass_t apecs_devclass; static device_t apecs0; /* XXX only one for now */ -static device_t isa0; struct apecs_softc { vm_offset_t dmem_base; /* dense memory */ @@ -442,18 +444,25 @@ 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, driver_intr_t *intr, void *arg, void **cookiep); static int apecs_teardown_intr(device_t dev, device_t child, struct resource *irq, void *cookie); + static device_method_t apecs_methods[] = { /* Device interface */ DEVMETHOD(device_probe, apecs_probe), DEVMETHOD(device_attach, apecs_attach), /* Bus interface */ - DEVMETHOD(bus_alloc_resource, pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), + 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), @@ -499,29 +508,19 @@ apecs_probe(device_t dev) apecs_hae_mem = REGVAL(EPIC_HAXR1); pci_init_resources(); + isa_init_intr(); - isa0 = device_add_child(dev, "isa", 0, 0); + device_add_child(dev, "pcib", 0, 0); return 0; } -extern void isa_intr(void* frame, u_long vector); - static int apecs_attach(device_t dev) { struct apecs_softc* sc = APECS_SOFTC(dev); apecs_init(); - /* - * the avanti routes interrupts through the isa interrupt - * controller, so we need to special case it - */ - if(hwrpb->rpb_type == ST_DEC_2100_A50) - chipset.intrdev = isa0; - else - chipset.intrdev = apecs0; - sc->dmem_base = APECS_PCI_DENSE; sc->smem_base = APECS_PCI_SPARSE; sc->io_base = APECS_PCI_SIO; @@ -541,6 +540,27 @@ 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 (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 (type == SYS_RES_IRQ) + return isa_release_intr(bus, child, r); + else + return pci_release_resource(bus, child, type, rid, r); +} + static int apecs_setup_intr(device_t dev, device_t child, struct resource *irq, @@ -548,6 +568,13 @@ apecs_setup_intr(device_t dev, device_t child, { int error; + /* + * the avanti routes interrupts through the isa interrupt + * controller, so we need to special case it + */ + if(hwrpb->rpb_type == ST_DEC_2100_A50) + return isa_setup_intr(dev, child, irq, intr, arg, cookiep); + error = rman_activate_resource(irq); if (error) return error; @@ -567,6 +594,13 @@ static int apecs_teardown_intr(device_t dev, device_t child, struct resource *irq, void *cookie) { + /* + * the avanti routes interrupts through the isa interrupt + * controller, so we need to special case it + */ + if(hwrpb->rpb_type == ST_DEC_2100_A50) + return isa_teardown_intr(dev, child, irq, cookie); + alpha_teardown_intr(cookie); return rman_deactivate_resource(irq); } diff --git a/sys/alpha/pci/apecs_pci.c b/sys/alpha/pci/apecs_pci.c new file mode 100644 index 000000000000..fb0b339e5497 --- /dev/null +++ b/sys/alpha/pci/apecs_pci.c @@ -0,0 +1,73 @@ +/*- + * Copyright (c) 1998 Doug Rabson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPEAPECSL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/module.h> +#include <sys/bus.h> +#include <machine/bus.h> +#include <sys/rman.h> + +static devclass_t pcib_devclass; + +static int +apecs_pcib_probe(device_t dev) +{ + device_set_desc(dev, "2107x PCI host bus adapter"); + + device_add_child(dev, "pci", 0, 0); + + return 0; +} + +static device_method_t apecs_pcib_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, apecs_pcib_probe), + DEVMETHOD(device_attach, bus_generic_attach), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + 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_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + { 0, 0 } +}; + +static driver_t apecs_pcib_driver = { + "pcib", + apecs_pcib_methods, + DRIVER_TYPE_MISC, + 1, +}; + +DRIVER_MODULE(pcib, apecs, apecs_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/alpha/pci/cia.c b/sys/alpha/pci/cia.c index 350df0029758..e967493b5117 100644 --- a/sys/alpha/pci/cia.c +++ b/sys/alpha/pci/cia.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cia.c,v 1.14 1998/12/04 22:54:42 archie Exp $ + * $Id: cia.c,v 1.15 1999/03/28 17:52:17 dfr Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -96,6 +96,7 @@ #include <sys/kernel.h> #include <sys/module.h> #include <sys/bus.h> +#include <machine/bus.h> #include <sys/rman.h> #include <alpha/pci/ciareg.h> @@ -654,6 +655,7 @@ static device_method_t cia_methods[] = { DEVMETHOD(device_attach, cia_attach), /* 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), @@ -724,11 +726,12 @@ cia_probe(device_t dev) if (cia0) return ENXIO; cia0 = dev; - device_set_desc(dev, "2117x PCI adapter"); /* XXX */ + device_set_desc(dev, "2117x Core Logic chipset"); /* XXX */ pci_init_resources(); + isa_init_intr(); - device_add_child(dev, "isa", 0, 0); + device_add_child(dev, "pcib", 0, 0); return 0; } @@ -736,12 +739,10 @@ cia_probe(device_t dev) static int cia_attach(device_t dev) { - struct cia_softc* sc = CIA_SOFTC(dev); char* name; int pass; cia_init(); - chipset.intrdev = dev; name = cia_ispyxis ? "Pyxis" : "ALCOR/ALCOR2"; if (cia_ispyxis) { @@ -832,6 +833,9 @@ cia_setup_intr(device_t dev, device_t child, /* Enable PCI interrupt */ platform.pci_intr_enable(irq->r_start); + device_printf(child, "interrupting at CIA irq %d\n", + (int) irq->r_start); + return 0; } @@ -844,4 +848,3 @@ cia_teardown_intr(device_t dev, device_t child, } DRIVER_MODULE(cia, root, cia_driver, cia_devclass, 0, 0); - diff --git a/sys/alpha/pci/cia_pci.c b/sys/alpha/pci/cia_pci.c new file mode 100644 index 000000000000..e77c3b41722e --- /dev/null +++ b/sys/alpha/pci/cia_pci.c @@ -0,0 +1,73 @@ +/*- + * Copyright (c) 1998 Doug Rabson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/module.h> +#include <sys/bus.h> +#include <machine/bus.h> +#include <sys/rman.h> + +static devclass_t pcib_devclass; + +static int +cia_pcib_probe(device_t dev) +{ + device_set_desc(dev, "2117x PCI host bus adapter"); + + device_add_child(dev, "pci", 0, 0); + + return 0; +} + +static device_method_t cia_pcib_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, cia_pcib_probe), + DEVMETHOD(device_attach, bus_generic_attach), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + 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_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + { 0, 0 } +}; + +static driver_t cia_pcib_driver = { + "pcib", + cia_pcib_methods, + DRIVER_TYPE_MISC, + 1, +}; + +DRIVER_MODULE(pcib, cia, cia_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/alpha/pci/lca.c b/sys/alpha/pci/lca.c index f3b194da6332..b60fb3e7fda4 100644 --- a/sys/alpha/pci/lca.c +++ b/sys/alpha/pci/lca.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: lca.c,v 1.4 1998/11/15 18:25:16 dfr Exp $ + * $Id: lca.c,v 1.5 1998/12/04 22:54:42 archie Exp $ */ #include <sys/param.h> @@ -35,15 +35,16 @@ #include <alpha/pci/lcareg.h> #include <alpha/pci/lcavar.h> #include <alpha/pci/pcibus.h> -#include <machine/swiz.h> +#include <alpha/isa/isavar.h> #include <machine/intr.h> +#include <machine/resource.h> #include <machine/cpuconf.h> +#include <machine/swiz.h> #define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) static devclass_t lca_devclass; static device_t lca0; /* XXX only one for now */ -static device_t isa0; struct lca_softc { int junk; @@ -333,8 +334,12 @@ lca_write_hae(u_int64_t hae) static int lca_probe(device_t dev); static int lca_attach(device_t dev); -static void *lca_create_intr(device_t dev, device_t child, int irq, driver_intr_t *intr, void *arg); -static int lca_connect_intr(device_t dev, void* ih); +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 */ @@ -342,10 +347,12 @@ static device_method_t lca_methods[] = { DEVMETHOD(device_attach, lca_attach), /* Bus interface */ - DEVMETHOD(bus_alloc_resource, pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), + 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), { 0, 0 } }; @@ -380,9 +387,12 @@ lca_probe(device_t dev) if (lca0) return ENXIO; lca0 = dev; - device_set_desc(dev, "21066 PCI adapter"); /* XXX */ + device_set_desc(dev, "21066 Core Logic chipset"); /* XXX */ + + pci_init_resources(); + isa_init_intr(); - isa0 = device_add_child(dev, "isa", 0, 0); + device_add_child(dev, "pcib", 0, 0); return 0; } @@ -393,7 +403,6 @@ lca_attach(device_t dev) struct lca_softc* sc = LCA_SOFTC(dev); lca_init(); - chipset.intrdev = isa0; set_iointr(alpha_dispatch_intr); @@ -408,5 +417,26 @@ 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 new file mode 100644 index 000000000000..61e35257b784 --- /dev/null +++ b/sys/alpha/pci/lca_pci.c @@ -0,0 +1,73 @@ +/*- + * Copyright (c) 1998 Doug Rabson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPELCAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/module.h> +#include <sys/bus.h> +#include <machine/bus.h> +#include <sys/rman.h> + +static devclass_t pcib_devclass; + +static int +lca_pcib_probe(device_t dev) +{ + device_set_desc(dev, "21066 PCI host bus adapter"); + + device_add_child(dev, "pci", 0, 0); + + return 0; +} + +static device_method_t lca_pcib_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, lca_pcib_probe), + DEVMETHOD(device_attach, bus_generic_attach), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + 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_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + { 0, 0 } +}; + +static driver_t lca_pcib_driver = { + "pcib", + lca_pcib_methods, + DRIVER_TYPE_MISC, + 1, +}; + +DRIVER_MODULE(pcib, lca, lca_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/alpha/pci/pcibus.c b/sys/alpha/pci/pcibus.c index 697373cec37d..ffb726a3b417 100644 --- a/sys/alpha/pci/pcibus.c +++ b/sys/alpha/pci/pcibus.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.7 1998/11/18 23:53:12 dfr Exp $ + * $Id: pcibus.c,v 1.8 1998/12/27 18:03:29 dfr Exp $ * */ @@ -32,6 +32,7 @@ #include <sys/kernel.h> #include <sys/module.h> #include <sys/bus.h> +#include <machine/bus.h> #include <sys/interrupt.h> #include <sys/sysctl.h> #include <sys/rman.h> @@ -40,6 +41,7 @@ #include <machine/chipset.h> #include <machine/cpuconf.h> #include <machine/resource.h> +#include <alpha/pci/pcibus.h> char chipset_type[10]; int chipset_bwx = 0; @@ -129,6 +131,8 @@ pci_cvt_to_bwx(vm_offset_t sparse) return NULL; } +#if 0 + /* * These can disappear when I update the pci code to use the new * device framework. @@ -160,6 +164,8 @@ intr_connect(struct intrec *idesc) return 0; } +#endif + void alpha_platform_assign_pciintr(pcicfgregs *cfg) { @@ -167,6 +173,20 @@ alpha_platform_assign_pciintr(pcicfgregs *cfg) platform.pci_intr_map((void *)cfg); } +int +alpha_platform_setup_ide_intr(int chan, driver_intr_t *fn, void *arg) +{ + if (platform.pci_setup_ide_intr) + return platform.pci_setup_ide_intr(chan, fn, arg); + else { + int irqs[2] = { 14, 15 }; + void *junk; + struct resource *res; + res = isa_alloc_intr(0, 0, irqs[chan]); + return isa_setup_intr(0, 0, res, fn, arg, &junk); + } +} + static struct rman irq_rman, port_rman, mem_rman; void pci_init_resources() @@ -177,23 +197,23 @@ void pci_init_resources() irq_rman.rm_descr = "PCI Interrupt request lines"; if (rman_init(&irq_rman) || rman_manage_region(&irq_rman, 0, 31)) - panic("cia_probe irq_rman"); + panic("pci_init_resources irq_rman"); port_rman.rm_start = 0; - port_rman.rm_end = 0xffff; + port_rman.rm_end = ~0u; port_rman.rm_type = RMAN_ARRAY; port_rman.rm_descr = "I/O ports"; if (rman_init(&port_rman) - || rman_manage_region(&port_rman, 0, 0xffff)) - panic("cia_probe port_rman"); + || rman_manage_region(&port_rman, 0x0, (1L << 32))) + panic("pci_init_resources port_rman"); mem_rman.rm_start = 0; mem_rman.rm_end = ~0u; mem_rman.rm_type = RMAN_ARRAY; - mem_rman.rm_descr = "I/O memory addresses"; + mem_rman.rm_descr = "I/O memory"; if (rman_init(&mem_rman) || rman_manage_region(&mem_rman, 0x0, (1L << 32))) - panic("cia_probe mem_rman"); + panic("pci_init_resources mem_rman"); } /* @@ -205,6 +225,7 @@ pci_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { struct rman *rm; + struct resource *rv; switch (type) { case SYS_RES_IRQ: @@ -223,7 +244,20 @@ pci_alloc_resource(device_t bus, device_t child, int type, int *rid, return 0; } - return rman_reserve_resource(rm, start, end, count, flags, child); + rv = rman_reserve_resource(rm, start, end, count, flags, child); + if (rv == 0) + return 0; + + if (type == SYS_RES_MEMORY) { + rman_set_bustag(rv, ALPHA_BUS_SPACE_MEM); + rman_set_bushandle(rv, rv->r_start); + rman_set_virtual(rv, (void *) rv->r_start); /* XXX */ + } else if (type == SYS_RES_IOPORT) { + rman_set_bustag(rv, ALPHA_BUS_SPACE_IO); + rman_set_bushandle(rv, rv->r_start); + } + + return rv; } int @@ -266,12 +300,37 @@ memcpy_toio(u_int32_t d, void *s, size_t size) } void +memcpy_io(u_int32_t d, u_int32_t s, size_t size) +{ + while (size--) + writeb(d++, readb(s++)); +} + +void memset_io(u_int32_t d, int val, size_t size) { while (size--) writeb(d++, val); } +void +memsetw(void *d, int val, size_t size) +{ + u_int16_t *sp = d; + + while (size--) + *sp++ = val; +} + +void +memsetw_io(u_int32_t d, int val, size_t size) +{ + while (size--) { + writew(d, val); + d += sizeof(u_int16_t); + } +} + #include "opt_ddb.h" #ifdef DDB #include <ddb/ddb.h> @@ -280,7 +339,6 @@ DB_COMMAND(in, db_in) { int c; int size; - u_int32_t val; if (!have_addr) return; @@ -307,7 +365,7 @@ DB_COMMAND(in, db_in) if (count <= 0) count = 1; while (--count >= 0) { - db_printf("%08x:\t", addr); + db_printf("%08lx:\t", addr); switch (size) { case 1: db_printf("%02x\n", inb(addr)); |
