diff --git a/sys/arch/algor/isa/mcclock_isa.c b/sys/arch/algor/isa/mcclock_isa.c index 09056eb2e9bd..d594b683be86 100644 --- a/sys/arch/algor/isa/mcclock_isa.c +++ b/sys/arch/algor/isa/mcclock_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: mcclock_isa.c,v 1.1 2001/05/28 16:22:21 thorpej Exp $ */ +/* $NetBSD: mcclock_isa.c,v 1.2 2002/01/07 21:46:56 thorpej Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.1 2001/05/28 16:22:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.2 2002/01/07 21:46:56 thorpej Exp $"); #include #include @@ -75,10 +75,21 @@ mcclock_isa_match(struct device *parent, struct cfdata *match, void *aux) struct isa_attach_args *ia = aux; bus_space_handle_t ioh; - if ((ia->ia_iobase != IOBASEUNK && ia->ia_iobase != 0x70) || - /* (ia->ia_iosize != 0 && ia->ia_iosize != 0x2) || XXX isa.c */ - ia->ia_maddr != MADDRUNK || ia->ia_msize != 0 || - ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK) + if (ia->ia_nio < 1 || + (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT && + ia->ia_io[0].ir_addr != 0x70)) + return (0); + + if (ia->ia_niomem > 0 && + (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT)) + return (0); + + if (ia->ia_nirq > 0 && + (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT)) + return (0); + + if (ia->ia_ndrq > 0 && + (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT)) return (0); if (bus_space_map(ia->ia_iot, 0x70, 0x2, 0, &ioh)) @@ -86,8 +97,13 @@ mcclock_isa_match(struct device *parent, struct cfdata *match, void *aux) bus_space_unmap(ia->ia_iot, ioh, 0x2); - ia->ia_iobase = 0x70; - ia->ia_iosize = 0x2; + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = 0x70; + ia->ia_io[0].ir_size = 0x02; + + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; return (1); } @@ -99,8 +115,8 @@ mcclock_isa_attach(struct device *parent, struct device *self, void *aux) struct mcclock_isa_softc *sc = (struct mcclock_isa_softc *)self; sc->sc_iot = ia->ia_iot; - if (bus_space_map(sc->sc_iot, ia->ia_iobase, ia->ia_iosize, 0, - &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &sc->sc_ioh)) panic("mcclock_isa_attach: couldn't map clock I/O space"); mcclock_attach(&sc->sc_mcclock, &mcclock_isa_busfns); diff --git a/sys/arch/alpha/isa/mcclock_isa.c b/sys/arch/alpha/isa/mcclock_isa.c index 997186f30084..70ef23245c83 100644 --- a/sys/arch/alpha/isa/mcclock_isa.c +++ b/sys/arch/alpha/isa/mcclock_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: mcclock_isa.c,v 1.10 1997/09/02 13:18:58 thorpej Exp $ */ +/* $NetBSD: mcclock_isa.c,v 1.11 2002/01/07 21:46:57 thorpej Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.10 1997/09/02 13:18:58 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.11 2002/01/07 21:46:57 thorpej Exp $"); #include #include @@ -74,19 +74,35 @@ mcclock_isa_match(parent, match, aux) struct isa_attach_args *ia = aux; bus_space_handle_t ioh; - if ((ia->ia_iobase != IOBASEUNK && ia->ia_iobase != 0x70) || - /* (ia->ia_iosize != 0 && ia->ia_iosize != 0x2) || XXX isa.c */ - ia->ia_maddr != MADDRUNK || ia->ia_msize != 0 || - ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK) - return (0); + if (ia->ia_nio < 1 || + (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT && + ia->ia_io[0].ir_addr != 0x70)) + return (0); + + if (ia->ia_niomem > 0 && + (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT)) + return (0); + + if (ia->ia_nirq > 0 && + (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT)) + return (0); + + if (ia->ia_ndrq > 0 && + (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT)) + return (0); if (bus_space_map(ia->ia_iot, 0x70, 0x2, 0, &ioh)) return (0); bus_space_unmap(ia->ia_iot, ioh, 0x2); - ia->ia_iobase = 0x70; - ia->ia_iosize = 0x2; + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = 0x70; + ia->ia_io[0].ir_size = 0x02; + + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; return (1); } @@ -100,8 +116,8 @@ mcclock_isa_attach(parent, self, aux) struct mcclock_isa_softc *sc = (struct mcclock_isa_softc *)self; sc->sc_iot = ia->ia_iot; - if (bus_space_map(sc->sc_iot, ia->ia_iobase, ia->ia_iosize, 0, - &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &sc->sc_ioh)) panic("mcclock_isa_attach: couldn't map clock I/O space"); mcclock_attach(&sc->sc_mcclock, &mcclock_isa_busfns); diff --git a/sys/arch/arc/isa/mcclock_isa.c b/sys/arch/arc/isa/mcclock_isa.c index 2b13c0ec9443..0970a11a3b00 100644 --- a/sys/arch/arc/isa/mcclock_isa.c +++ b/sys/arch/arc/isa/mcclock_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: mcclock_isa.c,v 1.1 2001/06/13 15:02:13 soda Exp $ */ +/* $NetBSD: mcclock_isa.c,v 1.2 2002/01/07 21:46:57 thorpej Exp $ */ /* $OpenBSD: clock_mc.c,v 1.9 1998/03/16 09:38:26 pefo Exp $ */ /* NetBSD: clock_mc.c,v 1.2 1995/06/28 04:30:30 cgd Exp */ @@ -58,8 +58,6 @@ #include #include -#define ARC_IO_RTCSIZE 2 - int mcclock_isa_match __P((struct device *, struct cfdata *, void *)); void mcclock_isa_attach __P((struct device *, struct device *, void *)); @@ -86,31 +84,39 @@ mcclock_isa_match(parent, match, aux) { struct isa_attach_args *ia = aux; bus_space_handle_t ioh; - bus_addr_t iobase = IO_RTC; - bus_size_t iosize = ARC_IO_RTCSIZE; - if (ia->ia_iobase != IOBASEUNK) - iobase = ia->ia_iobase; -#if 0 /* XXX isa.c */ - if (ia->ia_iosize != 0) - iosize = ia->ia_iosize; -#endif + if (ia->ia_nio < 1 || + (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT && + ia->ia_io[0].ir_addr != 0x70)) + return (0); - if (iobase != IO_RTC || iosize != ARC_IO_RTCSIZE || - ia->ia_maddr != MADDRUNK || ia->ia_msize != 0 || - ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK) + if (ia->ia_niomem > 0 && + (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT)) + return (0); + + if (ia->ia_nirq > 0 && + (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT)) + return (0); + + if (ia->ia_ndrq > 0 && + (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT)) return (0); if (!mcclock_isa_conf) return (0); - if (bus_space_map(ia->ia_iot, iobase, iosize, 0, &ioh)) + if (bus_space_map(ia->ia_iot, 0x70, 0x02, 0, &ioh)) return (0); - bus_space_unmap(ia->ia_iot, ioh, iosize); + bus_space_unmap(ia->ia_iot, ioh, 0x02); - ia->ia_iobase = iobase; - ia->ia_iosize = iosize; + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = 0x70; + ia->ia_io[0].ir_size = 0x02; + + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; return (1); } @@ -125,8 +131,8 @@ mcclock_isa_attach(parent, self, aux) struct isa_attach_args *ia = aux; sc->sc_iot = ia->ia_iot; - if (bus_space_map(sc->sc_iot, ia->ia_iobase, ia->ia_iosize, 0, - &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &sc->sc_ioh)) panic("mcclock_isa_attach: couldn't map clock I/O space"); mcclock_attach(sc, &mcclock_isa_busfns, 80); diff --git a/sys/arch/arc/isa/opms_isa.c b/sys/arch/arc/isa/opms_isa.c index ef85c2fb6351..0d1d5b306be0 100644 --- a/sys/arch/arc/isa/opms_isa.c +++ b/sys/arch/arc/isa/opms_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: opms_isa.c,v 1.1 2001/06/13 15:05:45 soda Exp $ */ +/* $NetBSD: opms_isa.c,v 1.2 2002/01/07 21:46:57 thorpej Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -60,14 +60,16 @@ opms_isa_match(parent, match, aux) bus_size_t iosize = IO_KBDSIZE; int irq = 12; - if (ia->ia_iobase != IOBASEUNK) - iobase = ia->ia_iobase; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT) + iobase = ia->ia_io[0].ir_addr; #if 0 /* XXX isa.c */ if (ia->ia_iosize != 0) iosize = ia->ia_iosize; #endif - if (ia->ia_irq != IRQUNK) - irq = ia->ia_irq; + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT) + irq = ia->ia_irq[0].ir_irq; #if 0 /* If values are hardwired to something that they can't be, punt. */ @@ -83,9 +85,16 @@ opms_isa_match(parent, match, aux) if (!opms_common_match(ia->ia_iot, pccons_isa_conf)) return (0); - ia->ia_iobase = iobase; - ia->ia_iosize = iosize; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = iobase; + ia->ia_io[0].ir_size = iosize; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = irq; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + return (1); } @@ -99,7 +108,7 @@ opms_isa_attach(parent, self, aux) printf("\n"); - isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, IPL_TTY, + isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_TTY, pcintr, self); opms_common_attach(sc, ia->ia_iot, pccons_isa_conf); } diff --git a/sys/arch/arc/isa/pccons_isa.c b/sys/arch/arc/isa/pccons_isa.c index 3222a921b113..91269311a893 100644 --- a/sys/arch/arc/isa/pccons_isa.c +++ b/sys/arch/arc/isa/pccons_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: pccons_isa.c,v 1.1 2001/06/13 15:05:45 soda Exp $ */ +/* $NetBSD: pccons_isa.c,v 1.2 2002/01/07 21:46:57 thorpej Exp $ */ /* NetBSD: vga_isa.c,v 1.4 2000/08/14 20:14:51 thorpej Exp */ /* @@ -61,18 +61,25 @@ pccons_isa_match(parent, match, aux) bus_size_t msize = 0x20000; int irq = 1; - if (ia->ia_iobase != IOBASEUNK) - iobase = ia->ia_iobase; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT) + iobase = ia->ia_io[0].ir_addr; #if 0 /* XXX isa.c */ if (ia->ia_iosize != 0) iosize = ia->ia_iosize; #endif - if (ia->ia_maddr != MADDRUNK) - maddr = ia->ia_maddr; - if (ia->ia_msize != 0) - msize = ia->ia_msize; - if (ia->ia_irq != IRQUNK) - irq = ia->ia_irq; + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT) + maddr = ia->ia_iomem[0].ir_addr; + if (ia->ia_iomem[0].ir_size != ISACF_IOSIZ_DEFAULT) + msize = ia->ia_iomem[0].ir_size; + + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT) + irq = ia->ia_irq[0].ir_irq; #if 0 /* If values are hardwired to something that they can't be, punt. */ @@ -89,10 +96,19 @@ pccons_isa_match(parent, match, aux) pccons_isa_conf)) return (0); - ia->ia_iobase = iobase; - ia->ia_iosize = iosize; - ia->ia_maddr = maddr; - ia->ia_msize = msize; + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = iobase; + ia->ia_io[0].ir_size = iosize; + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_addr = maddr; + ia->ia_iomem[0].ir_size = msize; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = irq; + + ia->ia_ndrq = 0; + return (1); } @@ -104,7 +120,7 @@ pccons_isa_attach(parent, self, aux) struct pc_softc *sc = (struct pc_softc *)self; struct isa_attach_args *ia = aux; - isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, IPL_TTY, + isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_TTY, pcintr, self); pccons_common_attach(sc, ia->ia_iot, ia->ia_memt, ia->ia_iot, pccons_isa_conf); diff --git a/sys/arch/arc/isa/timer_isa.c b/sys/arch/arc/isa/timer_isa.c index 73dccd12d1cf..7b28b449e84e 100644 --- a/sys/arch/arc/isa/timer_isa.c +++ b/sys/arch/arc/isa/timer_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: timer_isa.c,v 1.1 2001/06/13 15:02:14 soda Exp $ */ +/* $NetBSD: timer_isa.c,v 1.2 2002/01/07 21:46:58 thorpej Exp $ */ /* $OpenBSD: clock_mc.c,v 1.9 1998/03/16 09:38:26 pefo Exp $ */ /* NetBSD: clock_mc.c,v 1.2 1995/06/28 04:30:30 cgd Exp */ @@ -96,35 +96,40 @@ timer_isa_match(parent, match, aux) { struct isa_attach_args *ia = aux; bus_space_handle_t ioh; - bus_addr_t iobase = IO_TIMER1; - bus_size_t iosize = TIMER_IOSIZE; - int irq = TIMER_IRQ; - if (ia->ia_iobase != IOBASEUNK) - iobase = ia->ia_iobase; -#if 0 /* XXX isa.c */ - if (ia->ia_iosize != 0) - iosize = ia->ia_iosize; -#endif - if (ia->ia_irq != IRQUNK) - irq = ia->ia_irq; + if (ia->ia_nio < 1 || + (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT && + ia->ia_io[0].ir_addr != IO_TIMER1)) + return (0); - if (iobase != IO_TIMER1 || iosize != TIMER_IOSIZE || - ia->ia_maddr != MADDRUNK || ia->ia_msize != 0 || - irq != TIMER_IRQ || ia->ia_drq != DRQUNK) + if (ia->ia_niomem > 0 && + (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT)) + return (0); + + if (ia->ia_nirq > 0 && + (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != TIMER_IRQ)) + return (0); + + if (ia->ia_ndrq > 0 && + (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT)) return (0); if (!timer_isa_conf) return (0); - if (bus_space_map(ia->ia_iot, iobase, iosize, 0, &ioh)) + if (bus_space_map(ia->ia_iot, IO_TIMER1, TIMER_IOSIZE, 0, &ioh)) return (0); - bus_space_unmap(ia->ia_iot, ioh, iosize); + bus_space_unmap(ia->ia_iot, ioh, TIMER_IOSIZE); - ia->ia_iobase = iobase; - ia->ia_iosize = iosize; - ia->ia_irq = irq; + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = IO_TIMER1; + ia->ia_io[0].ir_size = TIMER_IOSIZE; + + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; return (1); } @@ -140,12 +145,13 @@ timer_isa_attach(parent, self, aux) void *ih; sc->sc_iot = ia->ia_iot; - if (bus_space_map(sc->sc_iot, ia->ia_iobase, ia->ia_iosize, 0, - &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &sc->sc_ioh)) panic("timer_isa_attach: couldn't map clock I/O space"); - ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_PULSE, IPL_CLOCK, - (int (*)(void *))hardclock, NULL /* clockframe is hardcoded */); + ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_PULSE, + IPL_CLOCK, (int (*)(void *))hardclock, + NULL /* clockframe is hardcoded */); if (ih == NULL) printf("%s: can't establish interrupt\n", sc->sc_dev.dv_xname); diff --git a/sys/arch/arm32/isa/dsrtc.c b/sys/arch/arm32/isa/dsrtc.c index 61d211c86cb9..3ab6836fa9b7 100644 --- a/sys/arch/arm32/isa/dsrtc.c +++ b/sys/arch/arm32/isa/dsrtc.c @@ -1,4 +1,4 @@ -/* $NetBSD: dsrtc.c,v 1.1 1998/10/05 01:20:58 mark Exp $ */ +/* $NetBSD: dsrtc.c,v 1.2 2002/01/07 21:46:58 thorpej Exp $ */ /* * Copyright (c) 1998 Mark Brinicombe. @@ -209,12 +209,16 @@ dsrtcmatch(parent, cf, aux) { struct isa_attach_args *ia = aux; - /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_nio < 1 || + ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) return (0); - ia->ia_iosize = NRTC_PORTS; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = NRTC_PORTS; + + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; return(1); } @@ -236,8 +240,8 @@ dsrtcattach(parent, self, aux) struct todclock_attach_args ta; sc->sc_iot = ia->ia_iot; - if (bus_space_map(sc->sc_iot, ia->ia_iobase, - NRTC_PORTS, 0, &sc->sc_ioh)) { + if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &sc->sc_ioh)) { printf(": cannot map I/O space\n"); return; } diff --git a/sys/arch/arm32/ofw/ofisapc.c b/sys/arch/arm32/ofw/ofisapc.c index 4ccf2b025a18..a89f10d1c3c7 100644 --- a/sys/arch/arm32/ofw/ofisapc.c +++ b/sys/arch/arm32/ofw/ofisapc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofisapc.c,v 1.5 1999/03/19 04:58:45 cgd Exp $ */ +/* $NetBSD: ofisapc.c,v 1.6 2002/01/07 21:46:59 thorpej Exp $ */ /* * Copyright 1997 @@ -89,6 +89,8 @@ ofisapcattach(parent, dev, aux) { struct ofbus_attach_args *oba = aux; static struct isa_attach_args ia; + struct isa_io ia_io[1]; + struct isa_irq ia_irq[1]; printf("\n"); @@ -105,12 +107,19 @@ ofisapcattach(parent, dev, aux) ia.ia_iot = &isa_io_bs_tag; ia.ia_memt = &isa_mem_bs_tag; ia.ia_ic = NULL; /* not used */ - ia.ia_iobase = BASE_KEYBOARD; - ia.ia_iosize = I8042_NPORTS; - ia.ia_irq = IRQ_KEYBOARD; - ia.ia_drq = DRQUNK; - ia.ia_maddr = MADDRUNK; - ia.ia_msize = 0; + + ia.ia_nio = 1; + ia.ia_io = ia_io; + ia.ia_io[0].ir_addr = BASE_KEYBOARD; + ia.ia_io[0].ir_size = I8042_NPORTS; + + ia.ia_nirq = 1; + ia.ia_irq = ia_irq; + ia.ia_irq[0].ir_irq = IRQ_KEYBOARD; + + ia.ia_niomem = 0; + ia.ia_ndrq = 0; + ia.ia_aux = (void *)oba->oba_phandle; config_found(dev, &ia, NULL); diff --git a/sys/arch/arm32/ofw/ofisascr.c b/sys/arch/arm32/ofw/ofisascr.c index cf6849570822..4d2cb6b14977 100644 --- a/sys/arch/arm32/ofw/ofisascr.c +++ b/sys/arch/arm32/ofw/ofisascr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofisascr.c,v 1.5 1999/03/19 04:58:45 cgd Exp $ */ +/* $NetBSD: ofisascr.c,v 1.6 2002/01/07 21:46:59 thorpej Exp $ */ /* * Copyright 1997 @@ -87,6 +87,7 @@ ofisascrattach(parent, dev, aux) { struct ofbus_attach_args *oba = aux; struct isa_attach_args ia; + struct isa_io ia_io[1]; printf("\n"); @@ -94,12 +95,16 @@ ofisascrattach(parent, dev, aux) ia.ia_iot = &isa_io_bs_tag; ia.ia_memt = &isa_mem_bs_tag; ia.ia_ic = NULL; /* not used */ - ia.ia_iobase = SEQUOIA_BASE; - ia.ia_iosize = SEQUOIA_NPORTS; - ia.ia_irq = IRQUNK; - ia.ia_drq = DRQUNK; - ia.ia_maddr = MADDRUNK; - ia.ia_msize = 0; + + ia.ia_nio = 1; + ia.ia_io = ia_io; + ia.ia_io[0].ir_addr = SEQUOIA_BASE; + ia.ia_io[0].ir_size = SEQUOIA_NPORTS; + + ia.ia_niomem = 0; + ia.ia_nirq = 0; + ia.ia_ndrq = 0; + ia.ia_aux = (void *)oba->oba_phandle; config_found(dev, &ia, NULL); diff --git a/sys/arch/arm32/shark/pccons.c b/sys/arch/arm32/shark/pccons.c index 715b6306805f..8e5504dca97f 100644 --- a/sys/arch/arm32/shark/pccons.c +++ b/sys/arch/arm32/shark/pccons.c @@ -1,4 +1,4 @@ -/* $NetBSD: pccons.c,v 1.17 2001/09/18 18:15:50 wiz Exp $ */ +/* $NetBSD: pccons.c,v 1.18 2002/01/07 21:46:59 thorpej Exp $ */ /* * Copyright 1997 @@ -858,9 +858,14 @@ pcprobe(struct device *parent, bus_space_tag_t iot; bus_space_handle_t ioh; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (actingConsole == FALSE) { - iobase = ia->ia_iobase; + iobase = ia->ia_io[0].ir_addr; iot = ia->ia_iot; /* Map register space @@ -890,8 +895,15 @@ pcprobe(struct device *parent, ** Fill in the isa structure with the number of ** ports used and mapped memory size. */ - ia->ia_iosize = I8042_NPORTS; - ia->ia_msize = 0; + if (probeOk) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = I8042_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + } return (probeOk); } /* End pcprobe() */ @@ -949,7 +961,7 @@ pcattach(struct device *parent, { KERN_DEBUG( pcdebug, KERN_DEBUG_INFO, ("\npcattach: mapping io space\n")); - iobase = ia->ia_iobase; + iobase = ia->ia_io[0].ir_addr; sc->sc_flags = 0x00; sc->kbd.sc_shift_state = 0x00; sc->kbd.sc_new_lock_state = 0x00; @@ -1026,8 +1038,8 @@ pcattach(struct device *parent, do_async_update(sc); /* Set up keyboard controller interrupt */ - sc->kbd.sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_LEVEL, - IPL_TTY, pcintr, sc); + sc->kbd.sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_LEVEL, IPL_TTY, pcintr, sc); /* ** Pass child devices our io handle so they can use ** the same io space as the keyboard. diff --git a/sys/arch/arm32/shark/scr.c b/sys/arch/arm32/shark/scr.c index 66c436e4ca6c..2975976cc227 100644 --- a/sys/arch/arm32/shark/scr.c +++ b/sys/arch/arm32/shark/scr.c @@ -1,4 +1,4 @@ -/* $NetBSD: scr.c,v 1.11 2001/11/23 19:36:48 thorpej Exp $ */ +/* $NetBSD: scr.c,v 1.12 2002/01/07 21:46:59 thorpej Exp $ */ /* * Copyright 1997 @@ -722,9 +722,10 @@ int scrprobe(parent, match, aux) devices++; /* tell the caller that we are not using any resource */ - ia->ia_iosize = -1; - ia->ia_irq = -1; - ia->ia_msize = 0; + ia->ia_nio = 0; + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; rv = 1; diff --git a/sys/arch/atari/isa/fdcisa.c b/sys/arch/atari/isa/fdcisa.c index e155de997602..467f68a0ed75 100644 --- a/sys/arch/atari/isa/fdcisa.c +++ b/sys/arch/atari/isa/fdcisa.c @@ -1,4 +1,4 @@ -/* $NetBSD: fdcisa.c,v 1.1 2001/03/16 21:31:56 leo Exp $ */ +/* $NetBSD: fdcisa.c,v 1.2 2002/01/07 21:47:00 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -111,6 +111,7 @@ fdc_isa_probe(parent, cfp, aux) static int fdc_matched = 0; bus_space_tag_t iot; bus_space_handle_t ioh, ctl_ioh, base_ioh; + int iobase; if (!atari_realconfig) return 0; @@ -121,15 +122,30 @@ fdc_isa_probe(parent, cfp, aux) iot = ia->ia_iot; - /* - * Disallow wildcarded i/o address and drq - */ - if ((ia->ia_iobase == IOBASEUNK) || (ia->ia_drq == DRQUNK)) - return 0; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + /* Disallow wildcarded I/O addresses. */ + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + + /* Don't allow wildcarded IRQ/DRQ. */ + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) + return (0); + + if (ia->ia_drq[0].ir_drq == ISACF_DRQ_DEFAULT) + return (0); /* Map the i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, 6 /* FDC_NPORT */, 0, - (caddr_t*)&base_ioh)) { + iobase = ia->ia_io[0].ir_addr; + if (bus_space_map(iot, iobase, 6 /* FDC_NPORT */, 0, &base_ioh)) { printf("fdcisaprobe: cannot map io-area\n"); return 0; } @@ -138,7 +154,7 @@ fdc_isa_probe(parent, cfp, aux) return (0); } - if (bus_space_map(iot, ia->ia_iobase + fdctl + 2, 1, 0, &ctl_ioh)) { + if (bus_space_map(iot, iobase + fdctl + 2, 1, 0, &ctl_ioh)) { bus_space_unmap(iot, base_ioh, 6); return (0); } @@ -158,8 +174,14 @@ fdc_isa_probe(parent, cfp, aux) out_fdc(iot, ioh, 2); fdc_matched = 1; - ia->ia_iosize = FDC_NPORT; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = FDC_NPORT; + + ia->ia_nirq = 1; + ia->ia_ndrq = 1; + + ia->ia_niomem = 0; + out: bus_space_unmap(iot, base_ioh, 6 /* FDC_NPORT */); @@ -178,10 +200,10 @@ void *aux; fdc->sc_iot = ia->ia_iot; fdc->sc_ic = ia->ia_ic; - fdc->sc_drq = ia->ia_drq; + fdc->sc_drq = ia->ia_drq[0].ir_drq; - if (bus_space_map(fdc->sc_iot, ia->ia_iobase, 6 /* FDC_NPORT */, 0, - &isc->sc_baseioh)) { + if (bus_space_map(fdc->sc_iot, ia->ia_io[0].ir_addr, + 6 /* FDC_NPORT */, 0, &isc->sc_baseioh)) { printf("%s: unable to map I/O space\n", fdc->sc_dev.dv_xname); return; } @@ -193,15 +215,15 @@ void *aux; return; } - if (bus_space_map(fdc->sc_iot, ia->ia_iobase + fdctl + 2, 1, 0, + if (bus_space_map(fdc->sc_iot, ia->ia_io[0].ir_addr + fdctl + 2, 1, 0, &fdc->sc_fdctlioh)) { printf("%s: unable to map CTL I/O space\n", fdc->sc_dev.dv_xname); return; } - fdc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_BIO, fdcintr, fdc); + fdc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_BIO, fdcintr, fdc); fdcattach(fdc); } diff --git a/sys/arch/i386/i386/autoconf.c b/sys/arch/i386/i386/autoconf.c index cd8a31778247..533d65cb9832 100644 --- a/sys/arch/i386/i386/autoconf.c +++ b/sys/arch/i386/i386/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.59 2001/11/15 07:03:28 lukem Exp $ */ +/* $NetBSD: autoconf.c,v 1.60 2002/01/07 21:47:00 thorpej Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.59 2001/11/15 07:03:28 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.60 2002/01/07 21:47:00 thorpej Exp $"); #include "opt_compat_oldboot.h" @@ -496,7 +496,9 @@ device_register(dev, aux) struct isa_attach_args *iaa = aux; /* compare IO base address */ - if (bin->addr.iobase == iaa->ia_iobase) + /* XXXJRT what about multiple I/O addrs? */ + if (iaa->ia_nio > 0 && + bin->addr.iobase == iaa->ia_io[0].ir_addr) goto found; } #if NPCI > 0 diff --git a/sys/arch/i386/isa/ahc_isa.c b/sys/arch/i386/isa/ahc_isa.c index c37f3f72621b..a92c6ff870a4 100644 --- a/sys/arch/i386/isa/ahc_isa.c +++ b/sys/arch/i386/isa/ahc_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: ahc_isa.c,v 1.15 2001/11/15 07:03:32 lukem Exp $ */ +/* $NetBSD: ahc_isa.c,v 1.16 2002/01/07 21:47:01 thorpej Exp $ */ /* * Product specific probe and attach routines for: @@ -117,7 +117,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahc_isa.c,v 1.15 2001/11/15 07:03:32 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahc_isa.c,v 1.16 2002/01/07 21:47:01 thorpej Exp $"); #include #include @@ -288,18 +288,24 @@ ahc_isa_match(ia, iobase) if (irq < 0) return (0); - if (ia->ia_irq != IRQUNK && - ia->ia_irq != irq) { + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != irq) { printf("ahc_isa_match: irq mismatch (kernel %d, card %d)\n", - ia->ia_irq, irq); + ia->ia_irq[0].ir_irq, irq); return (0); } /* We have a match */ - ia->ia_iobase = iobase; - ia->ia_irq = irq; - ia->ia_iosize = AHC_ISA_IOSIZE; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = iobase; + ia->ia_io[0].ir_size = AHC_ISA_IOSIZE; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = irq; + + ia->ia_ndrq = 0; + ia->ia_niomem = 0; + return (1); } @@ -322,8 +328,16 @@ ahc_isa_probe(parent, match, aux) ahc_isa_slot_initialized = 1; } - if (ia->ia_iobase != IOBASEUNK) - return (ahc_isa_match(ia, ia->ia_iobase)); + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + if (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT) + return (ahc_isa_match(ia, ia->ia_io[0].ir_addr)); /* * Find this bus's state. If we don't yet have a slot @@ -373,7 +387,8 @@ ahc_isa_attach(parent, self, aux) const char *intrtypestr; char idstring[EISA_IDSTRINGLEN]; - if (bus_space_map(iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, ia->ia_io[0].ir_size, + 0, &ioh)) { printf(": can't map i/o space\n"); return; } @@ -454,7 +469,7 @@ ahc_isa_attach(parent, self, aux) free_ahc: ahc_free(ahc); free_io: - bus_space_unmap(iot, ioh, ia->ia_iosize); + bus_space_unmap(iot, ioh, ia->ia_io[0].ir_size); } /* diff --git a/sys/arch/i386/isa/joy_isa.c b/sys/arch/i386/isa/joy_isa.c index 08dc61ac8dfa..500955d09c1a 100644 --- a/sys/arch/i386/isa/joy_isa.c +++ b/sys/arch/i386/isa/joy_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: joy_isa.c,v 1.5 2001/11/15 07:03:32 lukem Exp $ */ +/* $NetBSD: joy_isa.c,v 1.6 2002/01/07 21:47:01 thorpej Exp $ */ /*- * Copyright (c) 1995 Jean-Marc Zucconi @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: joy_isa.c,v 1.5 2001/11/15 07:03:32 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: joy_isa.c,v 1.6 2002/01/07 21:47:01 thorpej Exp $"); #include #include @@ -66,10 +66,13 @@ joy_isa_probe(parent, match, aux) bus_space_handle_t ioh; int rval = 0; - if (ia->ia_iobase == IOBASEUNK) + if (ia->ia_nio < 1) return (0); - if (bus_space_map(iot, ia->ia_iobase, JOY_NPORTS, 0, &ioh)) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + + if (bus_space_map(iot, ia->ia_io[0].ir_addr, JOY_NPORTS, 0, &ioh)) return (0); #ifdef WANT_JOYSTICK_CONNECTED @@ -83,8 +86,14 @@ joy_isa_probe(parent, match, aux) bus_space_unmap(iot, ioh, JOY_NPORTS); - ia->ia_iosize = JOY_NPORTS; - ia->ia_msize = 0; + if (rval) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = JOY_NPORTS; + + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; + } return (rval); } @@ -100,7 +109,7 @@ joy_isa_attach(parent, self, aux) sc->sc_iot = ia->ia_iot; - if (bus_space_map(sc->sc_iot, ia->ia_iobase, JOY_NPORTS, 0, + if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, JOY_NPORTS, 0, &sc->sc_ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; diff --git a/sys/arch/i386/isa/lms.c b/sys/arch/i386/isa/lms.c index 82d0d3ae8b17..8a31d3d482eb 100644 --- a/sys/arch/i386/isa/lms.c +++ b/sys/arch/i386/isa/lms.c @@ -1,4 +1,4 @@ -/* $NetBSD: lms.c,v 1.39 2001/11/15 07:03:32 lukem Exp $ */ +/* $NetBSD: lms.c,v 1.40 2002/01/07 21:47:01 thorpej Exp $ */ /*- * Copyright (c) 1993, 1994 Charles M. Hannum. @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lms.c,v 1.39 2001/11/15 07:03:32 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lms.c,v 1.40 2002/01/07 21:47:01 thorpej Exp $"); #include #include @@ -87,13 +87,23 @@ lmsprobe(parent, match, aux) bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; int rv; - + + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o base. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return 0; + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return 0; /* Map the i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, LMS_NPORTS, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, LMS_NPORTS, 0, &ioh)) return 0; rv = 0; @@ -114,8 +124,13 @@ lmsprobe(parent, match, aux) bus_space_write_1(iot, ioh, LMS_CNTRL, 0x10); rv = 1; - ia->ia_iosize = LMS_NPORTS; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = LMS_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; out: bus_space_unmap(iot, ioh, LMS_NPORTS); @@ -135,7 +150,7 @@ lmsattach(parent, self, aux) printf("\n"); - if (bus_space_map(iot, ia->ia_iobase, LMS_NPORTS, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, LMS_NPORTS, 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } @@ -145,8 +160,8 @@ lmsattach(parent, self, aux) sc->sc_ioh = ioh; sc->sc_enabled = 0; - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_PULSE, - IPL_TTY, lmsintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_PULSE, IPL_TTY, lmsintr, sc); a.accessops = &lms_accessops; a.accesscookie = sc; diff --git a/sys/arch/i386/isa/mms.c b/sys/arch/i386/isa/mms.c index d105096d60bb..a2ce01852131 100644 --- a/sys/arch/i386/isa/mms.c +++ b/sys/arch/i386/isa/mms.c @@ -1,4 +1,4 @@ -/* $NetBSD: mms.c,v 1.36 2001/11/15 07:03:32 lukem Exp $ */ +/* $NetBSD: mms.c,v 1.37 2002/01/07 21:47:01 thorpej Exp $ */ /*- * Copyright (c) 1993, 1994 Charles M. Hannum. @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mms.c,v 1.36 2001/11/15 07:03:32 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mms.c,v 1.37 2002/01/07 21:47:01 thorpej Exp $"); #include #include @@ -85,12 +85,23 @@ mmsprobe(parent, match, aux) bus_space_handle_t ioh; int rv; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return 0; + + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return 0; /* Map the i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, MMS_NPORTS, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, MMS_NPORTS, 0, &ioh)) return 0; rv = 0; @@ -103,8 +114,14 @@ mmsprobe(parent, match, aux) bus_space_write_1(iot, ioh, MMS_ADDR, 0x87); rv = 1; - ia->ia_iosize = MMS_NPORTS; - ia->ia_msize = 0; + + ia->ia_nio = 1; + ia->ia_io[0].ir_size = MMS_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; out: bus_space_unmap(iot, ioh, MMS_NPORTS); @@ -124,7 +141,7 @@ mmsattach(parent, self, aux) printf("\n"); - if (bus_space_map(iot, ia->ia_iobase, MMS_NPORTS, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, MMS_NPORTS, 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } @@ -134,8 +151,8 @@ mmsattach(parent, self, aux) sc->sc_ioh = ioh; sc->sc_enabled = 0; - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_PULSE, - IPL_TTY, mmsintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_PULSE, IPL_TTY, mmsintr, sc); a.accessops = &mms_accessops; a.accesscookie = sc; diff --git a/sys/arch/i386/isa/npx_isa.c b/sys/arch/i386/isa/npx_isa.c index ed6ab775a30d..393e2e8fc1dd 100644 --- a/sys/arch/i386/isa/npx_isa.c +++ b/sys/arch/i386/isa/npx_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: npx_isa.c,v 1.3 2001/11/15 07:03:33 lukem Exp $ */ +/* $NetBSD: npx_isa.c,v 1.4 2002/01/07 21:47:01 thorpej Exp $ */ /*- * Copyright (c) 1994, 1995, 1998 Charles M. Hannum. All rights reserved. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: npx_isa.c,v 1.3 2001/11/15 07:03:33 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: npx_isa.c,v 1.4 2002/01/07 21:47:01 thorpej Exp $"); #include #include @@ -68,25 +68,43 @@ npx_isa_probe(struct device *parent, struct cfdata *match, void *aux) bus_space_handle_t ioh; enum npx_type result; - ia->ia_iosize = 16; - ia->ia_msize = 0; - - if (bus_space_map(ia->ia_iot, 0xf0, ia->ia_iosize, 0, &ioh) != 0) + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) return (0); - result = npxprobe1(ia->ia_iot, ioh, ia->ia_irq); - if (result != NPX_INTERRUPT) - ia->ia_irq = IRQUNK; /* zap the interrupt */ + if (ISA_DIRECT_CONFIG(ia)) + return (0); - bus_space_unmap(ia->ia_iot, ioh, ia->ia_iosize); + if (bus_space_map(ia->ia_iot, 0xf0, 16, 0, &ioh) != 0) + return (0); - /* - * Remember our result -- we don't want to have to npxprobe1() - * again (especially if we've zapped the IRQ). - */ - ia->ia_aux = (void *)(u_long)result; + result = npxprobe1(ia->ia_iot, ioh, ia->ia_irq[0].ir_irq); - return (result != NPX_NONE); + bus_space_unmap(ia->ia_iot, ioh, 16); + + if (result != NPX_NONE) { + /* + * Remember our result -- we don't want to have to npxprobe1() + * again (especially if we've zapped the IRQ). + */ + ia->ia_aux = (void *)(u_long)result; + + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = 0xf0; + ia->ia_io[0].ir_size = 16; + + if (result != NPX_INTERRUPT) + ia->ia_nirq = 0; /* zap the interrupt */ + else + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + return (1); + } + + return (0); } void @@ -97,7 +115,7 @@ npx_isa_attach(struct device *parent, struct device *self, void *aux) sc->sc_iot = ia->ia_iot; - if (bus_space_map(sc->sc_iot, 0xf0, ia->ia_iosize, 0, &sc->sc_ioh)) { + if (bus_space_map(sc->sc_iot, 0xf0, 16, 0, &sc->sc_ioh)) { printf("\n"); panic("npxattach: unable to map I/O space"); } @@ -108,7 +126,7 @@ npx_isa_attach(struct device *parent, struct device *self, void *aux) case NPX_INTERRUPT: printf("\n"); lcr0(rcr0() & ~CR0_NE); - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_NONE, npxintr, 0); break; case NPX_EXCEPTION: diff --git a/sys/arch/i386/isa/olms.c b/sys/arch/i386/isa/olms.c index 453ad99dc1a7..750b22378b5e 100644 --- a/sys/arch/i386/isa/olms.c +++ b/sys/arch/i386/isa/olms.c @@ -1,4 +1,4 @@ -/* $NetBSD: olms.c,v 1.3 2001/11/15 07:03:33 lukem Exp $ */ +/* $NetBSD: olms.c,v 1.4 2002/01/07 21:47:01 thorpej Exp $ */ /*- * Copyright (c) 1993, 1994 Charles M. Hannum. @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: olms.c,v 1.3 2001/11/15 07:03:33 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: olms.c,v 1.4 2002/01/07 21:47:01 thorpej Exp $"); #include #include @@ -96,13 +96,23 @@ olmsprobe(parent, match, aux) bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; int rv; - + + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o base. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return 0; + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return 0; /* Map the i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, LMS_NPORTS, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, LMS_NPORTS, 0, &ioh)) return 0; rv = 0; @@ -123,8 +133,13 @@ olmsprobe(parent, match, aux) bus_space_write_1(iot, ioh, LMS_CNTRL, 0x10); rv = 1; - ia->ia_iosize = LMS_NPORTS; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = LMS_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; out: bus_space_unmap(iot, ioh, LMS_NPORTS); @@ -143,7 +158,7 @@ olmsattach(parent, self, aux) printf("\n"); - if (bus_space_map(iot, ia->ia_iobase, LMS_NPORTS, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, LMS_NPORTS, 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } @@ -153,8 +168,8 @@ olmsattach(parent, self, aux) sc->sc_ioh = ioh; sc->sc_state = 0; - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_PULSE, - IPL_TTY, olmsintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_PULSE, IPL_TTY, olmsintr, sc); } int diff --git a/sys/arch/i386/isa/omms.c b/sys/arch/i386/isa/omms.c index 0e530930d882..3ea7ec1c4b0e 100644 --- a/sys/arch/i386/isa/omms.c +++ b/sys/arch/i386/isa/omms.c @@ -1,4 +1,4 @@ -/* $NetBSD: omms.c,v 1.3 2001/11/15 07:03:33 lukem Exp $ */ +/* $NetBSD: omms.c,v 1.4 2002/01/07 21:47:02 thorpej Exp $ */ /*- * Copyright (c) 1993, 1994 Charles M. Hannum. @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omms.c,v 1.3 2001/11/15 07:03:33 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omms.c,v 1.4 2002/01/07 21:47:02 thorpej Exp $"); #include #include @@ -95,12 +95,22 @@ ommsprobe(parent, match, aux) bus_space_handle_t ioh; int rv; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return 0; + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return 0; /* Map the i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, MMS_NPORTS, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, MMS_NPORTS, 0, &ioh)) return 0; rv = 0; @@ -113,8 +123,13 @@ ommsprobe(parent, match, aux) bus_space_write_1(iot, ioh, MMS_ADDR, 0x87); rv = 1; - ia->ia_iosize = MMS_NPORTS; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = MMS_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; out: bus_space_unmap(iot, ioh, MMS_NPORTS); @@ -133,7 +148,7 @@ ommsattach(parent, self, aux) printf("\n"); - if (bus_space_map(iot, ia->ia_iobase, MMS_NPORTS, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, MMS_NPORTS, 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } @@ -143,8 +158,8 @@ ommsattach(parent, self, aux) sc->sc_ioh = ioh; sc->sc_state = 0; - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_PULSE, - IPL_TTY, ommsintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_PULSE, IPL_TTY, ommsintr, sc); } int diff --git a/sys/arch/i386/isa/pccons.c b/sys/arch/i386/isa/pccons.c index 60b0ae191bbb..997132b3f738 100644 --- a/sys/arch/i386/isa/pccons.c +++ b/sys/arch/i386/isa/pccons.c @@ -1,4 +1,4 @@ -/* $NetBSD: pccons.c,v 1.150 2001/11/15 07:03:33 lukem Exp $ */ +/* $NetBSD: pccons.c,v 1.151 2002/01/07 21:47:02 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -83,7 +83,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pccons.c,v 1.150 2001/11/15 07:03:33 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pccons.c,v 1.151 2002/01/07 21:47:02 thorpej Exp $"); #include "opt_ddb.h" #include "opt_xserver.h" @@ -574,6 +574,18 @@ pcprobe(parent, match, aux) int res; #endif + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + /* + * XXXJRT This is probably wrong, but then again, pccons is a + * XXXJRT total hack to begin with. + */ + if (ISA_DIRECT_CONFIG(ia)) + return (0); + #if (NPCCONSKBD == 0) /* Enable interrupts and keyboard, etc. */ if (!kbc_put8042cmd(CMDBYTE)) { @@ -709,11 +721,17 @@ lose: #endif /* 1 */ #if (NPCCONSKBD > 0) - ia->ia_iosize = 0; + ia->ia_nio = 0; + ia->ia_nirq = 0; #else - ia->ia_iosize = 16; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = 16; + ia->ia_nirq = 1; #endif - ia->ia_msize = 0; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + return (1); } @@ -736,8 +754,8 @@ pcattach(parent, self, aux) #if (NPCCONSKBD > 0) pckbc_set_inputhandler(kbctag, kbcslot, pcinput, sc, sc->sc_dev.dv_xname); #else - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_TTY, pcintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_TTY, pcintr, sc); /* * Look for children of the keyboard controller. diff --git a/sys/arch/prep/isa/joy_isa.c b/sys/arch/prep/isa/joy_isa.c index 31346c41f0ec..e1c9a1625d8a 100644 --- a/sys/arch/prep/isa/joy_isa.c +++ b/sys/arch/prep/isa/joy_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: joy_isa.c,v 1.2 2001/06/13 10:46:02 wiz Exp $ */ +/* $NetBSD: joy_isa.c,v 1.3 2002/01/07 21:47:03 thorpej Exp $ */ /*- * Copyright (c) 1995 Jean-Marc Zucconi @@ -63,10 +63,13 @@ joy_isa_probe(parent, cf, aux) bus_space_handle_t ioh; int rval = 0; - if (ia->ia_iobase == IOBASEUNK) + if (ia->ia_nio < 1) return (0); - if (bus_space_map(iot, ia->ia_iobase, JOY_NPORTS, 0, &ioh)) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + + if (bus_space_map(iot, ia->ia_io[0].ir_addr, JOY_NPORTS, 0, &ioh)) return (0); #ifdef WANT_JOYSTICK_CONNECTED @@ -80,8 +83,14 @@ joy_isa_probe(parent, cf, aux) bus_space_unmap(iot, ioh, JOY_NPORTS); - ia->ia_iosize = JOY_NPORTS; - ia->ia_msize = 0; + if (rval) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = JOY_NPORTS; + + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; + } return rval; } @@ -97,7 +106,7 @@ joy_isa_attach(parent, self, aux) sc->sc_iot = ia->ia_iot; - if (bus_space_map(sc->sc_iot, ia->ia_iobase, JOY_NPORTS, 0, + if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, JOY_NPORTS, 0, &sc->sc_ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; diff --git a/sys/arch/prep/isa/mcclock_isa.c b/sys/arch/prep/isa/mcclock_isa.c index f9b82fb9eea3..298cffdcde40 100644 --- a/sys/arch/prep/isa/mcclock_isa.c +++ b/sys/arch/prep/isa/mcclock_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: mcclock_isa.c,v 1.1 2000/02/29 15:21:43 nonaka Exp $ */ +/* $NetBSD: mcclock_isa.c,v 1.2 2002/01/07 21:47:03 thorpej Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -76,18 +76,36 @@ mcclock_isa_match(parent, match, aux) struct isa_attach_args *ia = aux; bus_space_handle_t ioh; - if ((ia->ia_iobase != IOBASEUNK && ia->ia_iobase != 0x70) || - /* (ia->ia_iosize != 0 && ia->ia_iosize != 0x2) || XXX isa.c */ - ia->ia_maddr != MADDRUNK || ia->ia_msize != 0 || - ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK) - return (0); + if (ia->ia_nio < 1 || + (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT && + ia->ia_io[0].ir_addr != 0x70)) + return (0); - if (bus_space_map(ia->ia_iot, ia->ia_iobase, MCCLOCK_NPORTS, 0, &ioh)) + if (ia->ia_niomem > 0 && + (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT)) + return (0); + + if (ia->ia_nirq > 0 && + (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT)) + return (0); + + if (ia->ia_ndrq > 0 && + (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT)) + return (0); + + if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &ioh)) return (0); bus_space_unmap(ia->ia_iot, ioh, MCCLOCK_NPORTS); - ia->ia_iosize = MCCLOCK_NPORTS; + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = 0x70; + ia->ia_io[0].ir_size = MCCLOCK_NPORTS; + + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; return (1); } @@ -101,8 +119,8 @@ mcclock_isa_attach(parent, self, aux) struct mcclock_isa_softc *sc = (struct mcclock_isa_softc *)self; sc->sc_iot = ia->ia_iot; - if (bus_space_map(sc->sc_iot, ia->ia_iobase, ia->ia_iosize, 0, - &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &sc->sc_ioh)) panic("mcclock_isa_attach: couldn't map clock I/O space"); mcclock_attach(&sc->sc_mcclock, &mcclock_isa_busfns); diff --git a/sys/dev/isa/addcom_isa.c b/sys/dev/isa/addcom_isa.c index ac2d72072b9f..92b642b04c47 100644 --- a/sys/dev/isa/addcom_isa.c +++ b/sys/dev/isa/addcom_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: addcom_isa.c,v 1.3 2001/11/13 08:01:09 lukem Exp $ */ +/* $NetBSD: addcom_isa.c,v 1.4 2002/01/07 21:47:03 thorpej Exp $ */ /* * Copyright (c) 2000 Michael Graff. All rights reserved. @@ -55,7 +55,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: addcom_isa.c,v 1.3 2001/11/13 08:01:09 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: addcom_isa.c,v 1.4 2002/01/07 21:47:03 thorpej Exp $"); #include #include @@ -118,10 +118,9 @@ int addcomprobe(struct device *parent, struct cfdata *self, void *aux) { struct isa_attach_args *ia = aux; - int iobase = ia->ia_iobase; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; - int i, rv = 1; + int i, iobase, rv = 1; /* * Do the normal com probe for the first UART and assume @@ -130,9 +129,21 @@ addcomprobe(struct device *parent, struct cfdata *self, void *aux) * XXX Needs more robustness. */ - /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_nio < 1) return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + /* Disallow wildcarded i/o address. */ + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) + return (0); + + iobase = ia->ia_io[0].ir_addr; /* if the first port is in use as console, then it. */ if (com_is_console(iot, iobase, 0)) @@ -162,8 +173,15 @@ checkmappings: } out: - if (rv) - ia->ia_iosize = NSLAVES * COM_NPORTS; + if (rv) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = NSLAVES * COM_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + } return (rv); } @@ -190,7 +208,7 @@ addcomattach(struct device *parent, struct device *self, void *aux) printf("\n"); sc->sc_iot = ia->ia_iot; - sc->sc_iobase = ia->ia_iobase; + sc->sc_iobase = ia->ia_io[0].ir_addr; if (bus_space_map(iot, STATUS_IOADDR, STATUS_SIZE, 0, &sc->sc_statusioh)) { @@ -225,8 +243,8 @@ addcomattach(struct device *parent, struct device *self, void *aux) sc->sc_alive |= 1 << i; } - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_SERIAL, addcomintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_SERIAL, addcomintr, sc); } int diff --git a/sys/dev/isa/adv_isa.c b/sys/dev/isa/adv_isa.c index 9593d5a6de13..dc9c390a8fcf 100644 --- a/sys/dev/isa/adv_isa.c +++ b/sys/dev/isa/adv_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: adv_isa.c,v 1.4 2001/11/15 09:48:09 lukem Exp $ */ +/* $NetBSD: adv_isa.c,v 1.5 2002/01/07 21:47:03 thorpej Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: adv_isa.c,v 1.4 2001/11/15 09:48:09 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: adv_isa.c,v 1.5 2002/01/07 21:47:03 thorpej Exp $"); #include #include @@ -121,51 +121,91 @@ adv_isa_probe(parent, match, aux) bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; int port_index; - int iobase; + int iobase, irq, drq; int rv = 0; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* - * Find io port + * If the I/O address is wildcarded, look for boards + * in ascending order. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) { - for(port_index=0; port_index < ASC_IOADR_TABLE_MAX_IX; - port_index++) { + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) { + for (port_index = 0; port_index < ASC_IOADR_TABLE_MAX_IX; + port_index++) { iobase = asc_ioport[port_index]; - if(iobase) { + if (iobase) { if (bus_space_map(iot, iobase, ASC_IOADR_GAP, - 0, &ioh)) + 0, &ioh)) continue; rv = AscFindSignature(iot, ioh); - - bus_space_unmap(iot, ioh, ASC_IOADR_GAP); if (rv) { - ia->ia_iobase = iobase; + ia->ia_io[0].ir_addr = iobase; break; } + + bus_space_unmap(iot, ioh, ASC_IOADR_GAP); } } + if (rv == 0) + return (0); } else { - if (bus_space_map(iot, ia->ia_iobase, ASC_IOADR_GAP, 0, &ioh)) + iobase = ia->ia_io[0].ir_addr; + if (bus_space_map(iot, iobase, ASC_IOADR_GAP, 0, &ioh)) return (0); rv = AscFindSignature(iot, ioh); - bus_space_unmap(iot, ioh, ASC_IOADR_GAP); + if (rv == 0) { + bus_space_unmap(iot, ioh, ASC_IOADR_GAP); + return (0); + } } - if (rv) { - ASC_SET_CHIP_CONTROL(iot, ioh, ASC_CC_HALT); - ASC_SET_CHIP_STATUS(iot, ioh, 0); + /* XXXJRT Probe routines should not have side-effects!! */ + ASC_SET_CHIP_CONTROL(iot, ioh, ASC_CC_HALT); + ASC_SET_CHIP_STATUS(iot, ioh, 0); - ia->ia_msize = 0; - ia->ia_iosize = ASC_IOADR_GAP; - ia->ia_irq = AscGetChipIRQ(iot, ioh, ASC_IS_ISA); - ia->ia_drq = AscGetIsaDmaChannel(iot, ioh); + irq = AscGetChipIRQ(iot, ioh, ASC_IS_ISA); + drq = AscGetIsaDmaChannel(iot, ioh); + + /* Verify that the IRQ/DRQ match (or are wildcarded). */ + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != irq) { + rv = 0; + goto out; + } + if (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT && + ia->ia_drq[0].ir_drq != drq) { + rv = 0; + goto out; } + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = iobase; + ia->ia_io[0].ir_size = ASC_IOADR_GAP; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = irq; + + ia->ia_ndrq = 1; + ia->ia_drq[0].ir_drq = drq; + + ia->ia_niomem = 0; + + out: + bus_space_unmap(iot, ioh, ASC_IOADR_GAP); return rv; } @@ -186,7 +226,7 @@ adv_isa_attach(parent, self, aux) sc->sc_flags = 0x0; - if (bus_space_map(iot, ia->ia_iobase, ASC_IOADR_GAP, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, ASC_IOADR_GAP, 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } @@ -210,14 +250,14 @@ adv_isa_attach(parent, self, aux) return; } - if ((error = isa_dmacascade(ic, ia->ia_drq)) != 0) { + if ((error = isa_dmacascade(ic, ia->ia_drq[0].ir_drq)) != 0) { printf("%s: unable to cascade DRQ, error = %d\n", sc->sc_dev.dv_xname, error); return; } - sc->sc_ih = isa_intr_establish(ic, ia->ia_irq, IST_EDGE, IPL_BIO, - adv_intr, sc); + sc->sc_ih = isa_intr_establish(ic, ia->ia_irq[0].ir_irq, IST_EDGE, + IPL_BIO, adv_intr, sc); if (sc->sc_ih == NULL) { printf("%s: couldn't establish interrupt\n", sc->sc_dev.dv_xname); diff --git a/sys/dev/isa/aha_isa.c b/sys/dev/isa/aha_isa.c index 66aa7ef32ef5..310aff557da3 100644 --- a/sys/dev/isa/aha_isa.c +++ b/sys/dev/isa/aha_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: aha_isa.c,v 1.13 2001/11/15 09:48:09 lukem Exp $ */ +/* $NetBSD: aha_isa.c,v 1.14 2002/01/07 21:47:03 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: aha_isa.c,v 1.13 2001/11/15 09:48:09 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aha_isa.c,v 1.14 2002/01/07 21:47:03 thorpej Exp $"); #include #include @@ -82,11 +82,21 @@ aha_isa_probe(parent, match, aux) struct aha_probe_data apd; int rv; - /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1) return (0); - if (bus_space_map(iot, ia->ia_iobase, AHA_ISA_IOSIZE, 0, &ioh)) + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + /* Disallow wildcarded i/o address. */ + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + + if (bus_space_map(iot, ia->ia_io[0].ir_addr, AHA_ISA_IOSIZE, 0, &ioh)) return (0); rv = aha_find(iot, ioh, &apd); @@ -94,14 +104,23 @@ aha_isa_probe(parent, match, aux) bus_space_unmap(iot, ioh, AHA_ISA_IOSIZE); if (rv) { - if (ia->ia_irq != -1 && ia->ia_irq != apd.sc_irq) + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != apd.sc_irq) return (0); - if (ia->ia_drq != -1 && ia->ia_drq != apd.sc_drq) + if (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT && + ia->ia_drq[0].ir_drq != apd.sc_drq) return (0); - ia->ia_irq = apd.sc_irq; - ia->ia_drq = apd.sc_drq; - ia->ia_msize = 0; - ia->ia_iosize = AHA_ISA_IOSIZE; + + ia->ia_nio = 1; + ia->ia_io[0].ir_size = AHA_ISA_IOSIZE; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = apd.sc_irq; + + ia->ia_ndrq = 1; + ia->ia_drq[0].ir_drq = apd.sc_drq; + + ia->ia_niomem = 0; } return (rv); } @@ -124,7 +143,7 @@ aha_isa_attach(parent, self, aux) printf("\n"); - if (bus_space_map(iot, ia->ia_iobase, AHA_ISA_IOSIZE, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, AHA_ISA_IOSIZE, 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } diff --git a/sys/dev/isa/aic_isa.c b/sys/dev/isa/aic_isa.c index ef035082b721..340acf4a5394 100644 --- a/sys/dev/isa/aic_isa.c +++ b/sys/dev/isa/aic_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: aic_isa.c,v 1.9 2001/11/15 09:48:09 lukem Exp $ */ +/* $NetBSD: aic_isa.c,v 1.10 2002/01/07 21:47:03 thorpej Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Charles M. Hannum. All rights reserved. @@ -51,7 +51,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: aic_isa.c,v 1.9 2001/11/15 09:48:09 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aic_isa.c,v 1.10 2002/01/07 21:47:03 thorpej Exp $"); #include #include @@ -109,11 +109,23 @@ aic_isa_probe(parent, match, aux) bus_space_handle_t ioh; int rv; - /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) return (0); - if (bus_space_map(iot, ia->ia_iobase, AIC_ISA_IOSIZE, 0, &ioh)) + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + /* Disallow wildcarded i/o address. */ + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + + /* Disallow wildcarded IRQ. */ + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) + return (0); + + if (bus_space_map(iot, ia->ia_io[0].ir_addr, AIC_ISA_IOSIZE, 0, &ioh)) return (0); AIC_TRACE(("aic_isa_probe: port 0x%x\n", ia->ia_iobase)); @@ -122,8 +134,13 @@ aic_isa_probe(parent, match, aux) bus_space_unmap(iot, ioh, AIC_ISA_IOSIZE); if (rv) { - ia->ia_msize = 0; - ia->ia_iosize = AIC_ISA_IOSIZE; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = AIC_ISA_IOSIZE; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; } return rv; } @@ -142,7 +159,7 @@ aic_isa_attach(parent, self, aux) printf("\n"); - if (bus_space_map(iot, ia->ia_iobase, AIC_ISA_IOSIZE, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, AIC_ISA_IOSIZE, 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } @@ -155,8 +172,8 @@ aic_isa_attach(parent, self, aux) return; } - isc->sc_ih = isa_intr_establish(ic, ia->ia_irq, IST_EDGE, IPL_BIO, - aicintr, sc); + isc->sc_ih = isa_intr_establish(ic, ia->ia_irq[0].ir_irq, IST_EDGE, + IPL_BIO, aicintr, sc); if (isc->sc_ih == NULL) { printf("%s: couldn't establish interrupt\n", sc->sc_dev.dv_xname); diff --git a/sys/dev/isa/aria.c b/sys/dev/isa/aria.c index e7e4f6cd0247..8fbba52b8e71 100644 --- a/sys/dev/isa/aria.c +++ b/sys/dev/isa/aria.c @@ -1,4 +1,4 @@ -/* $NetBSD: aria.c,v 1.11 2001/11/13 08:01:10 lukem Exp $ */ +/* $NetBSD: aria.c,v 1.12 2002/01/07 21:47:04 thorpej Exp $ */ /*- * Copyright (c) 1995, 1996, 1998 Roland C. Dowdeswell. All rights reserved. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: aria.c,v 1.11 2001/11/13 08:01:10 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aria.c,v 1.12 2002/01/07 21:47:04 thorpej Exp $"); #include #include @@ -252,17 +252,28 @@ ariaprobe(parent, cf, aux) bus_space_handle_t ioh; struct isa_attach_args *ia = aux; - if (!ARIA_BASE_VALID(ia->ia_iobase)) { - printf("aria: configured iobase %d invalid\n", ia->ia_iobase); + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + if (!ARIA_BASE_VALID(ia->ia_io[0].ir_addr)) { + printf("aria: configured iobase %d invalid\n", + ia->ia_io[0].ir_addr); return 0; } - if (!ARIA_IRQ_VALID(ia->ia_irq)) { - printf("aria: configured irq %d invalid\n", ia->ia_irq); + if (!ARIA_IRQ_VALID(ia->ia_irq[0].ir_irq)) { + printf("aria: configured irq %d invalid\n", + ia->ia_irq[0].ir_irq); return 0; } - if (bus_space_map(ia->ia_iot, ia->ia_iobase, ARIADSP_NPORT, 0, &ioh)) { + if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, ARIADSP_NPORT, + 0, &ioh)) { DPRINTF(("aria: aria probe failed\n")); return 0; } @@ -276,9 +287,16 @@ ariaprobe(parent, cf, aux) return 0; } - bus_space_unmap(ia->ia_iot, ioh, ARIADSP_NPORT); + bus_space_unmap(ia->ia_iot, ioh, ARIADSP_NPORT); + + ia->ia_nio = 1; + ia->ia_io[0].ir_size = ARIADSP_NPORT; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; - ia->ia_iosize = ARIADSP_NPORT; DPRINTF(("aria: aria probe succeeded\n")); return 1; } @@ -320,16 +338,17 @@ aria_prometheus_kludge(ia, ioh1) bus_space_write_2(iot, ioh, 0, 0x0f); bus_space_write_1(iot, ioh, 1, 0x00); bus_space_write_2(iot, ioh, 0, 0x02); - bus_space_write_1(iot, ioh, 1, ia->ia_iobase>>2); + bus_space_write_1(iot, ioh, 1, ia->ia_io[0].ir_addr>>2); /* * These next three lines set up the iobase * and the irq; and disable the drq. */ - aria_do_kludge(iot, ioh, ioh1, 0x111, ((ia->ia_iobase-0x280)>>2)+0xA0, - 0xbf, 0xa0); - aria_do_kludge(iot, ioh, ioh1, 0x011, ia->ia_irq-6, 0xf8, 0x00); + aria_do_kludge(iot, ioh, ioh1, 0x111, + ((ia->ia_io[0].ir_addr-0x280)>>2)+0xA0, 0xbf, 0xa0); + aria_do_kludge(iot, ioh, ioh1, 0x011, + ia->ia_irq[0].ir_irq-6, 0xf8, 0x00); aria_do_kludge(iot, ioh, ioh1, 0x011, 0x00, 0xef, 0x00); /* The rest of these lines just disable everything else */ @@ -397,15 +416,16 @@ ariaattach(parent, self, aux) struct isa_attach_args *ia = aux; u_short i; - if (bus_space_map(ia->ia_iot, ia->ia_iobase, ARIADSP_NPORT, 0, &ioh)) + if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, ARIADSP_NPORT, + 0, &ioh)) panic("%s: can map io port range", self->dv_xname); sc->sc_iot = ia->ia_iot; sc->sc_ioh = ioh; sc->sc_ic = ia->ia_ic; - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_AUDIO, aria_intr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_AUDIO, aria_intr, sc); DPRINTF(("isa_intr_establish() returns (%x)\n", (unsigned) sc->sc_ih)); diff --git a/sys/dev/isa/ast.c b/sys/dev/isa/ast.c index 740238e026db..e19d400f4912 100644 --- a/sys/dev/isa/ast.c +++ b/sys/dev/isa/ast.c @@ -1,4 +1,4 @@ -/* $NetBSD: ast.c,v 1.47 2001/11/13 08:01:10 lukem Exp $ */ +/* $NetBSD: ast.c,v 1.48 2002/01/07 21:47:04 thorpej Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ast.c,v 1.47 2001/11/13 08:01:10 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ast.c,v 1.48 2002/01/07 21:47:04 thorpej Exp $"); #include #include @@ -80,10 +80,9 @@ astprobe(parent, self, aux) void *aux; { struct isa_attach_args *ia = aux; - int iobase = ia->ia_iobase; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; - int i, rv = 1; + int i, iobase, rv = 1; /* * Do the normal com probe for the first UART and assume @@ -92,15 +91,26 @@ astprobe(parent, self, aux) * XXX Needs more robustness. */ + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return (0); /* if the first port is in use as console, then it. */ - if (com_is_console(iot, iobase, 0)) + if (com_is_console(iot, ia->ia_io[0].ir_addr, 0)) goto checkmappings; - if (bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, COM_NPORTS, 0, &ioh)) { rv = 0; goto out; } @@ -110,7 +120,7 @@ astprobe(parent, self, aux) goto out; checkmappings: - for (i = 1; i < NSLAVES; i++) { + for (i = 1, iobase = ia->ia_io[0].ir_addr; i < NSLAVES; i++) { iobase += COM_NPORTS; if (com_is_console(iot, iobase, 0)) @@ -124,8 +134,15 @@ checkmappings: } out: - if (rv) - ia->ia_iosize = NSLAVES * COM_NPORTS; + if (rv) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = NSLAVES * COM_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + } return (rv); } @@ -156,7 +173,7 @@ astattach(parent, self, aux) printf("\n"); sc->sc_iot = ia->ia_iot; - sc->sc_iobase = ia->ia_iobase; + sc->sc_iobase = ia->ia_io[0].ir_addr; for (i = 0; i < NSLAVES; i++) { iobase = sc->sc_iobase + i * COM_NPORTS; @@ -186,8 +203,8 @@ astattach(parent, self, aux) sc->sc_alive |= 1 << i; } - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_SERIAL, astintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_SERIAL, astintr, sc); } int diff --git a/sys/dev/isa/aztech.c b/sys/dev/isa/aztech.c index 855300d984d7..1c18689506a8 100644 --- a/sys/dev/isa/aztech.c +++ b/sys/dev/isa/aztech.c @@ -1,4 +1,4 @@ -/* $NetBSD: aztech.c,v 1.3 2002/01/03 18:13:19 augustss Exp $ */ +/* $NetBSD: aztech.c,v 1.4 2002/01/07 21:47:15 thorpej Exp $ */ /* $OpenBSD: aztech.c,v 1.2 2001/12/05 10:27:06 mickey Exp $ */ /* $RuOBSD: aztech.c,v 1.11 2001/10/20 13:23:47 pva Exp $ */ @@ -122,7 +122,15 @@ az_probe(struct device *parent, struct cfdata *cf, void *aux) bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; u_int r; - int iosize = 1, iobase = ia->ia_iobase; + int iosize = 1, iobase; + + if (ISA_DIRECT_CONFIG(ia)) + return 0; + + if (ia->ia_nio < 1) + return 0; + + iobase = ia->ia_io[0].ir_addr; if (!AZ_BASE_VALID(iobase)) { printf("az: configured iobase 0x%x invalid", iobase); @@ -136,9 +144,18 @@ az_probe(struct device *parent, struct cfdata *cf, void *aux) bus_space_unmap(iot, ioh, iosize); - ia->ia_iosize = iosize; + if (r != 0) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = iosize; - return (r != 0); + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; + + return (1); + } + + return (0); } void @@ -155,8 +172,8 @@ az_attach(struct device *parent, struct device *self, void *aux) sc->vol = 0; /* remap I/O */ - if (bus_space_map(sc->lm.iot, ia->ia_iobase, ia->ia_iosize, - 0, &sc->lm.ioh)) + if (bus_space_map(sc->lm.iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &sc->lm.ioh)) panic(": bus_space_map() of %s failed", sc->sc_dev.dv_xname); printf(": Aztech/PackardBell\n"); diff --git a/sys/dev/isa/bha_isa.c b/sys/dev/isa/bha_isa.c index 9e5bc6563fb2..431fab44fe38 100644 --- a/sys/dev/isa/bha_isa.c +++ b/sys/dev/isa/bha_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: bha_isa.c,v 1.20 2001/11/15 09:48:09 lukem Exp $ */ +/* $NetBSD: bha_isa.c,v 1.21 2002/01/07 21:47:04 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bha_isa.c,v 1.20 2001/11/15 09:48:09 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bha_isa.c,v 1.21 2002/01/07 21:47:04 thorpej Exp $"); #include #include @@ -81,11 +81,21 @@ bha_isa_probe(parent, match, aux) struct bha_probe_data bpd; int rv; - /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1) return (0); - if (bus_space_map(iot, ia->ia_iobase, BHA_ISA_IOSIZE, 0, &ioh)) + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + /* Disallow wildcarded i/o address. */ + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + + if (bus_space_map(iot, ia->ia_io[0].ir_addr, BHA_ISA_IOSIZE, 0, &ioh)) return (0); rv = bha_probe_inquiry(iot, ioh, &bpd); @@ -93,14 +103,23 @@ bha_isa_probe(parent, match, aux) bus_space_unmap(iot, ioh, BHA_ISA_IOSIZE); if (rv) { - if (ia->ia_irq != -1 && ia->ia_irq != bpd.sc_irq) + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != bpd.sc_irq) return (0); - if (ia->ia_drq != -1 && ia->ia_drq != bpd.sc_drq) + if (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT && + ia->ia_drq[0].ir_drq != bpd.sc_drq) return (0); - ia->ia_irq = bpd.sc_irq; - ia->ia_drq = bpd.sc_drq; - ia->ia_msize = 0; - ia->ia_iosize = BHA_ISA_IOSIZE; + + ia->ia_nio = 1; + ia->ia_io[0].ir_size = BHA_ISA_IOSIZE; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = bpd.sc_irq; + + ia->ia_ndrq = 1; + ia->ia_drq[0].ir_drq = bpd.sc_drq; + + ia->ia_niomem = 0; } return (rv); } @@ -123,7 +142,7 @@ bha_isa_attach(parent, self, aux) printf("\n"); - if (bus_space_map(iot, ia->ia_iobase, BHA_ISA_IOSIZE, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, BHA_ISA_IOSIZE, 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } diff --git a/sys/dev/isa/boca.c b/sys/dev/isa/boca.c index a57cf901202c..7c5a1f692989 100644 --- a/sys/dev/isa/boca.c +++ b/sys/dev/isa/boca.c @@ -1,4 +1,4 @@ -/* $NetBSD: boca.c,v 1.35 2001/11/13 08:01:10 lukem Exp $ */ +/* $NetBSD: boca.c,v 1.36 2002/01/07 21:47:04 thorpej Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: boca.c,v 1.35 2001/11/13 08:01:10 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: boca.c,v 1.36 2002/01/07 21:47:04 thorpej Exp $"); #include #include @@ -84,10 +84,9 @@ bocaprobe(parent, self, aux) void *aux; { struct isa_attach_args *ia = aux; - int iobase = ia->ia_iobase; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; - int i, rv = 1; + int i, iobase, rv = 1; /* * Do the normal com probe for the first UART and assume @@ -96,8 +95,18 @@ bocaprobe(parent, self, aux) * XXX Needs more robustness. */ + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return (0); /* if the first port is in use as console, then it. */ @@ -114,7 +123,7 @@ bocaprobe(parent, self, aux) goto out; checkmappings: - for (i = 1; i < NSLAVES; i++) { + for (i = 1, iobase = ia->ia_io[0].ir_addr; i < NSLAVES; i++) { iobase += COM_NPORTS; if (com_is_console(iot, iobase, 0)) @@ -128,8 +137,15 @@ checkmappings: } out: - if (rv) - ia->ia_iosize = NSLAVES * COM_NPORTS; + if (rv) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = NSLAVES * COM_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + } return (rv); } @@ -160,7 +176,7 @@ bocaattach(parent, self, aux) printf("\n"); sc->sc_iot = ia->ia_iot; - sc->sc_iobase = ia->ia_iobase; + sc->sc_iobase = ia->ia_io[0].ir_addr; for (i = 0; i < NSLAVES; i++) { iobase = sc->sc_iobase + i * COM_NPORTS; @@ -186,8 +202,8 @@ bocaattach(parent, self, aux) sc->sc_alive |= 1 << i; } - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_SERIAL, bocaintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_SERIAL, bocaintr, sc); callout_init(&sc->fixup); callout_reset(&sc->fixup, hz/10, boca_fixup, sc); } diff --git a/sys/dev/isa/cms.c b/sys/dev/isa/cms.c index 713970622afa..dc1d7cafb689 100644 --- a/sys/dev/isa/cms.c +++ b/sys/dev/isa/cms.c @@ -1,4 +1,4 @@ -/* $NetBSD: cms.c,v 1.3 2001/11/13 08:01:10 lukem Exp $ */ +/* $NetBSD: cms.c,v 1.4 2002/01/07 21:47:04 thorpej Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cms.c,v 1.3 2001/11/13 08:01:10 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cms.c,v 1.4 2002/01/07 21:47:04 thorpej Exp $"); #include #include @@ -138,10 +138,16 @@ cms_probe(parent, match, aux) iot = ia->ia_iot; - if (ia->ia_iobase == IOBASEUNK) + if (ia->ia_nio < 1) return 0; - if (bus_space_map(iot, ia->ia_iobase, CMS_IOSIZE, 0, &ioh)) + if (ISA_DIRECT_CONFIG(ia)) + return 0; + + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return 0; + + if (bus_space_map(iot, ia->ia_io[0].ir_addr, CMS_IOSIZE, 0, &ioh)) return 0; bus_space_write_1(iot, ioh, CMS_WREG, 0xaa); @@ -154,7 +160,12 @@ cms_probe(parent, match, aux) } found = 1; - ia->ia_iosize = CMS_IOSIZE; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = CMS_IOSIZE; + + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; out: bus_space_unmap(iot, ioh, CMS_IOSIZE); @@ -181,7 +192,7 @@ cms_attach(parent, self, aux) iot = ia->ia_iot; - if (bus_space_map(iot, ia->ia_iobase, CMS_IOSIZE, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, CMS_IOSIZE, 0, &ioh)) { printf(": can't map i/o space\n"); return; } diff --git a/sys/dev/isa/com_isa.c b/sys/dev/isa/com_isa.c index 164d5bfdb267..f0f9a9c4fd60 100644 --- a/sys/dev/isa/com_isa.c +++ b/sys/dev/isa/com_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: com_isa.c,v 1.16 2001/11/15 09:48:09 lukem Exp $ */ +/* $NetBSD: com_isa.c,v 1.17 2002/01/07 21:47:04 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: com_isa.c,v 1.16 2001/11/15 09:48:09 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: com_isa.c,v 1.17 2002/01/07 21:47:04 thorpej Exp $"); #include #include @@ -122,12 +122,24 @@ com_isa_probe(parent, match, aux) int rv = 1; struct isa_attach_args *ia = aux; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + + /* Don't allow wildcarded IRQ. */ + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return (0); iot = ia->ia_iot; - iobase = ia->ia_iobase; + iobase = ia->ia_io[0].ir_addr; /* if it's in use as console, it's there. */ if (!com_is_console(iot, iobase, 0)) { @@ -139,8 +151,13 @@ com_isa_probe(parent, match, aux) } if (rv) { - ia->ia_iosize = COM_NPORTS; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = COM_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; } return (rv); } @@ -159,7 +176,7 @@ com_isa_attach(parent, self, aux) /* * We're living on an isa. */ - iobase = sc->sc_iobase = ia->ia_iobase; + iobase = sc->sc_iobase = ia->ia_io[0].ir_addr; iot = sc->sc_iot = ia->ia_iot; if (!com_is_console(iot, iobase, &sc->sc_ioh) && bus_space_map(iot, iobase, COM_NPORTS, 0, &sc->sc_ioh)) { @@ -168,14 +185,12 @@ com_isa_attach(parent, self, aux) } sc->sc_frequency = COM_FREQ; - irq = ia->ia_irq; + irq = ia->ia_irq[0].ir_irq; com_attach_subr(sc); - if (irq != IRQUNK) { - isc->sc_ih = isa_intr_establish(ia->ia_ic, irq, - IST_EDGE, IPL_SERIAL, comintr, sc); - } + isc->sc_ih = isa_intr_establish(ia->ia_ic, irq, IST_EDGE, IPL_SERIAL, + comintr, sc); /* * Shutdown hook for buggy BIOSs that don't recognize the UART diff --git a/sys/dev/isa/cy_isa.c b/sys/dev/isa/cy_isa.c index 31d0eacc00d8..059defb926c6 100644 --- a/sys/dev/isa/cy_isa.c +++ b/sys/dev/isa/cy_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: cy_isa.c,v 1.13 2001/11/13 08:01:11 lukem Exp $ */ +/* $NetBSD: cy_isa.c,v 1.14 2002/01/07 21:47:04 thorpej Exp $ */ /* * cy.c @@ -10,7 +10,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cy_isa.c,v 1.13 2001/11/13 08:01:11 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cy_isa.c,v 1.14 2002/01/07 21:47:04 thorpej Exp $"); #include #include @@ -40,19 +40,23 @@ cy_isa_probe(struct device *parent, struct cfdata *match, void *aux) struct cy_softc sc; int found; + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + memcpy(&sc.sc_dev, match, sizeof(struct device)); sc.sc_memt = ia->ia_memt; sc.sc_bustype = CY_BUSTYPE_ISA; /* Disallow wildcarded memory address. */ - if (ia->ia_maddr == ISACF_IOMEM_DEFAULT) - return (0); - - if (ia->ia_irq == IRQUNK) + if (ia->ia_iomem[0].ir_addr == ISACF_IOMEM_DEFAULT) + return 0; + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return 0; - if (bus_space_map(ia->ia_memt, ia->ia_maddr, CY_MEMSIZE, 0, + if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, CY_MEMSIZE, 0, &sc.sc_bsh) != 0) return 0; @@ -61,10 +65,14 @@ cy_isa_probe(struct device *parent, struct cfdata *match, void *aux) bus_space_unmap(ia->ia_memt, sc.sc_bsh, CY_MEMSIZE); if (found) { - ia->ia_iosize = 0; - ia->ia_msize = CY_MEMSIZE; - } + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_size = CY_MEMSIZE; + ia->ia_nirq = 1; + + ia->ia_nio = 0; + ia->ia_ndrq = 0; + } return (found); } @@ -79,7 +87,7 @@ cy_isa_attach(struct device *parent, struct device *self, void *aux) printf(": Cyclades-Y multiport serial\n"); - if (bus_space_map(ia->ia_memt, ia->ia_maddr, CY_MEMSIZE, 0, + if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, CY_MEMSIZE, 0, &sc->sc_bsh) != 0) { printf("%s: unable to map device registers\n", sc->sc_dev.dv_xname); @@ -93,7 +101,7 @@ cy_isa_attach(struct device *parent, struct device *self, void *aux) cy_attach(sc); - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_TTY, cy_intr, sc); if (sc->sc_ih == NULL) printf("%s: unable to establish interrupt", diff --git a/sys/dev/isa/depca_isa.c b/sys/dev/isa/depca_isa.c index 757ec62b0378..987093b4074d 100644 --- a/sys/dev/isa/depca_isa.c +++ b/sys/dev/isa/depca_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: depca_isa.c,v 1.2 2001/11/13 08:01:12 lukem Exp $ */ +/* $NetBSD: depca_isa.c,v 1.3 2002/01/07 21:47:04 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc. @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: depca_isa.c,v 1.2 2001/11/13 08:01:12 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: depca_isa.c,v 1.3 2002/01/07 21:47:04 thorpej Exp $"); #include "opt_inet.h" #include "bpfilter.h" @@ -135,24 +135,39 @@ depca_isa_probe(struct device *parent, struct cfdata *match, void *aux) bus_space_handle_t memh; int rv = 0; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) + return (0); + /* Disallow impossible i/o address. */ - if (ia->ia_iobase != 0x200 && ia->ia_iobase != 0x300) + if (ia->ia_io[0].ir_addr != 0x200 && ia->ia_io[0].ir_addr != 0x300) return (0); /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, 16, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, 16, 0, &ioh)) return 0; - if (ia->ia_maddr == MADDRUNK || - (ia->ia_msize != 32*1024 && ia->ia_msize != 64*1024)) + if (ia->ia_iomem[0].ir_addr == ISACF_IOMEM_DEFAULT || + (ia->ia_iomem[0].ir_size != 32*1024 && + ia->ia_iomem[0].ir_size != 64*1024)) goto bad; /* Map card RAM. */ - if (bus_space_map(ia->ia_memt, ia->ia_maddr, ia->ia_msize, 0, &memh)) + if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, + ia->ia_iomem[0].ir_size, 0, &memh)) goto bad; /* Just needed to check mapability; don't need it anymore. */ - bus_space_unmap(ia->ia_memt, memh, ia->ia_msize); + bus_space_unmap(ia->ia_memt, memh, ia->ia_iomem[0].ir_size); /* Stop the LANCE chip and put it in a known state. */ bus_space_write_2(iot, ioh, DEPCA_RAP, LE_CSR0); @@ -171,7 +186,15 @@ depca_isa_probe(struct device *parent, struct cfdata *match, void *aux) if (depca_readprom(iot, ioh, NULL)) goto bad; - ia->ia_iosize = 16; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = 16; + + ia->ia_niomem = 1; + + ia->ia_nirq = 1; + + ia->ia_ndrq = 0; + rv = 1; bad: @@ -191,21 +214,21 @@ depca_isa_attach(struct device *parent, struct device *self, void *aux) sc->sc_iot = ia->ia_iot; sc->sc_memt = ia->ia_memt; - sc->sc_memsize = ia->ia_msize; + sc->sc_memsize = ia->ia_iomem[0].ir_size; - if (bus_space_map(sc->sc_iot, ia->ia_iobase, ia->ia_iosize, + if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, 16, 0, &sc->sc_ioh) != 0) { printf("%s: unable to map i/o space\n", sc->sc_dev.dv_xname); return; } - if (bus_space_map(sc->sc_memt, ia->ia_maddr, ia->ia_msize, - 0, &sc->sc_memh) != 0) { + if (bus_space_map(sc->sc_memt, ia->ia_iomem[0].ir_addr, + ia->ia_iomem[0].ir_size, 0, &sc->sc_memh) != 0) { printf("%s: unable to map memory space\n", sc->sc_dev.dv_xname); return; } isc->sc_ic = ia->ia_ic; - isc->sc_irq = ia->ia_irq; + isc->sc_irq = ia->ia_irq[0].ir_irq; sc->sc_intr_establish = depca_isa_intr_establish; depca_attach(sc); diff --git a/sys/dev/isa/dpt_isa.c b/sys/dev/isa/dpt_isa.c index 4c4f0f092341..ad9badf0416b 100644 --- a/sys/dev/isa/dpt_isa.c +++ b/sys/dev/isa/dpt_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: dpt_isa.c,v 1.6 2001/11/13 08:01:12 lukem Exp $ */ +/* $NetBSD: dpt_isa.c,v 1.7 2002/01/07 21:47:04 thorpej Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Andrew Doran @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dpt_isa.c,v 1.6 2001/11/13 08:01:12 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dpt_isa.c,v 1.7 2002/01/07 21:47:04 thorpej Exp $"); #include #include @@ -94,19 +94,28 @@ dpt_isa_wait(bus_space_handle_t ioh, bus_space_tag_t iot, u_int8_t mask, static int dpt_isa_match(struct device *parent, struct cfdata *match, void *aux) { - struct isa_attach_args *ia; + struct isa_attach_args *ia = aux; int i; - ia = aux; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1) + return (0); - if (ia->ia_iobase != ISACF_PORT_DEFAULT) - return (dpt_isa_probe(ia, ia->ia_iobase)); + if (ISA_DIRECT_CONFIG(ia)) + return (0); - for (i = 0; dpt_isa_iobases[i] != 0; i++) + if (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT) + return (dpt_isa_probe(ia, ia->ia_io[0].ir_addr)); + + for (i = 0; dpt_isa_iobases[i] != 0; i++) { if (dpt_isa_probe(ia, dpt_isa_iobases[i])) { - ia->ia_iobase = dpt_isa_iobases[i]; + ia->ia_io[0].ir_addr = dpt_isa_iobases[i]; return (1); } + } return (0); } @@ -120,7 +129,7 @@ dpt_isa_probe(struct isa_attach_args *ia, int iobase) struct eata_cfg ec; bus_space_handle_t ioh; bus_space_tag_t iot; - int i, j, stat; + int i, j, stat, irq, drq; u_int16_t *p; iot = ia->ia_iot; @@ -203,25 +212,34 @@ dpt_isa_probe(struct isa_attach_args *ia, int iobase) * configuration, use that value. If the HBA told us, use that * value. Otherwise, puke. */ - if (ia->ia_drq == -1) { + if ((drq = ia->ia_drq[0].ir_drq) == ISACF_DRQ_DEFAULT) { int dmanum = ((ec.ec_feat1 & EC_F1_DMA_NUM_MASK) >> EC_F1_DMA_NUM_SHIFT); if ((ec.ec_feat0 & EC_F0_DMA_NUM_VALID) == 0 || dmanum > 3) goto bad; - ia->ia_drq = "\0\7\6\5"[dmanum]; + drq = "\0\7\6\5"[dmanum]; } /* * Which IRQ to use: if it was hardwired in the kernel configuration, * use that value. Otherwise, use what the HBA told us. */ - if (ia->ia_irq == -1) - ia->ia_irq = ((ec.ec_feat1 & EC_F1_IRQ_NUM_MASK) >> + if ((irq = ia->ia_irq[0].ir_irq) == ISACF_IRQ_DEFAULT) + irq = ((ec.ec_feat1 & EC_F1_IRQ_NUM_MASK) >> EC_F1_IRQ_NUM_SHIFT); - ia->ia_msize = 0; - ia->ia_iosize = DPT_ISA_IOSIZE; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = DPT_ISA_IOSIZE; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = irq; + + ia->ia_ndrq = 1; + ia->ia_drq[0].ir_drq = drq; + + ia->ia_niomem = 0; + bus_space_unmap(iot, ioh, DPT_ISA_IOSIZE); return (1); bad: @@ -250,8 +268,8 @@ dpt_isa_attach(struct device *parent, struct device *self, void *aux) printf(": "); - if ((error = bus_space_map(iot, ia->ia_iobase, DPT_ISA_IOSIZE, 0, - &ioh)) != 0) { + if ((error = bus_space_map(iot, ia->ia_io[0].ir_addr, DPT_ISA_IOSIZE, + 0, &ioh)) != 0) { printf("can't map i/o space, error = %d\n", error); return; } @@ -260,14 +278,14 @@ dpt_isa_attach(struct device *parent, struct device *self, void *aux) sc->sc_ioh = ioh; sc->sc_dmat = ia->ia_dmat; - if ((error = isa_dmacascade(ic, ia->ia_drq)) != 0) { + if ((error = isa_dmacascade(ic, ia->ia_drq[0].ir_drq)) != 0) { printf("unable to cascade DRQ, error = %d\n", error); return; } /* Establish the interrupt. */ - sc->sc_ih = isa_intr_establish(ic, ia->ia_irq, IST_EDGE, IPL_BIO, - dpt_intr, sc); + sc->sc_ih = isa_intr_establish(ic, ia->ia_irq[0].ir_irq, IST_EDGE, + IPL_BIO, dpt_intr, sc); if (sc->sc_ih == NULL) { printf("can't establish interrupt\n"); return; diff --git a/sys/dev/isa/ess_isa.c b/sys/dev/isa/ess_isa.c index 4e19ae94fe4f..51b809cfa097 100644 --- a/sys/dev/isa/ess_isa.c +++ b/sys/dev/isa/ess_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: ess_isa.c,v 1.6 2001/11/13 08:01:13 lukem Exp $ */ +/* $NetBSD: ess_isa.c,v 1.7 2002/01/07 21:47:05 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ess_isa.c,v 1.6 2001/11/13 08:01:13 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ess_isa.c,v 1.7 2002/01/07 21:47:05 thorpej Exp $"); #include #include @@ -73,23 +73,34 @@ ess_isa_probe(parent, match, aux) int ret; struct isa_attach_args *ia = aux; struct ess_softc probesc, *sc= &probesc; - + + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + memset(sc, 0, sizeof *sc); sc->sc_ic = ia->ia_ic; sc->sc_iot = ia->ia_iot; - sc->sc_iobase = ia->ia_iobase; - if (bus_space_map(sc->sc_iot, sc->sc_iobase, ESS_NPORT, 0, &sc->sc_ioh)) { - DPRINTF(("ess_isa_probe: Couldn't map I/O region at %x, size %x\n", - sc->sc_iobase, ESS_NPORT)); - return 0; + sc->sc_iobase = ia->ia_io[0].ir_addr; + if (bus_space_map(sc->sc_iot, sc->sc_iobase, ESS_NPORT, 0, + &sc->sc_ioh)) { + DPRINTF(("ess_isa_probe: Couldn't map I/O region at %x, " + "size %x\n", sc->sc_iobase, ESS_NPORT)); + return 0; } - sc->sc_audio1.irq = ia->ia_irq; + sc->sc_audio1.irq = ia->ia_irq[0].ir_irq; sc->sc_audio1.ist = IST_EDGE; - sc->sc_audio1.drq = ia->ia_drq; + sc->sc_audio1.drq = ia->ia_drq[0].ir_drq; sc->sc_audio2.irq = -1; - sc->sc_audio2.drq = ia->ia_drq2; + sc->sc_audio2.drq = (ia->ia_ndrq > 1) ? ia->ia_drq[1].ir_drq : -1; ret = essmatch(sc); @@ -97,7 +108,18 @@ ess_isa_probe(parent, match, aux) if (ret) { DPRINTF(("ess_isa_probe succeeded (score %d)\n", ret)); - ia->ia_iosize = ESS_NPORT; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = ESS_NPORT; + + ia->ia_nirq = 1; + + if (ia->ia_ndrq > 1 && + ia->ia_drq[1].ir_drq != ISACF_DRQ_DEFAULT) + ia->ia_ndrq = 2; + else + ia->ia_ndrq = 1; + + ia->ia_niomem = 0; } else DPRINTF(("ess_isa_probe failed\n")); @@ -115,18 +137,19 @@ void ess_isa_attach(parent, self, aux) sc->sc_ic = ia->ia_ic; sc->sc_iot = ia->ia_iot; - sc->sc_iobase = ia->ia_iobase; - if (bus_space_map(sc->sc_iot, sc->sc_iobase, ESS_NPORT, 0, &sc->sc_ioh)) { - DPRINTF(("ess_isa_attach: Couldn't map I/O region at %x, size %x\n", - sc->sc_iobase, ESS_NPORT)); - return; + sc->sc_iobase = ia->ia_io[0].ir_addr; + if (bus_space_map(sc->sc_iot, sc->sc_iobase, ESS_NPORT, 0, + &sc->sc_ioh)) { + DPRINTF(("ess_isa_attach: Couldn't map I/O region at %x, " + "size %x\n", sc->sc_iobase, ESS_NPORT)); + return; } - sc->sc_audio1.irq = ia->ia_irq; + sc->sc_audio1.irq = ia->ia_irq[0].ir_irq; sc->sc_audio1.ist = IST_EDGE; - sc->sc_audio1.drq = ia->ia_drq; + sc->sc_audio1.drq = ia->ia_drq[0].ir_drq; sc->sc_audio2.irq = -1; - sc->sc_audio2.drq = ia->ia_drq2; + sc->sc_audio2.drq = ia->ia_ndrq > 1 ? ia->ia_drq[1].ir_drq : -1; printf("%s", sc->sc_dev.dv_xname); diff --git a/sys/dev/isa/fdc_isa.c b/sys/dev/isa/fdc_isa.c index 23b97b3a2b13..5a5d5bbd3739 100644 --- a/sys/dev/isa/fdc_isa.c +++ b/sys/dev/isa/fdc_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: fdc_isa.c,v 1.3 2001/11/13 08:01:14 lukem Exp $ */ +/* $NetBSD: fdc_isa.c,v 1.4 2002/01/07 21:47:05 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdc_isa.c,v 1.3 2001/11/13 08:01:14 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdc_isa.c,v 1.4 2002/01/07 21:47:05 thorpej Exp $"); #include "rnd.h" @@ -123,17 +123,35 @@ fdc_isa_probe(struct device *parent, struct isa_attach_args *ia = aux; bus_space_tag_t iot; bus_space_handle_t ioh, ctl_ioh, base_ioh; - int rv; + int rv, iobase; iot = ia->ia_iot; rv = 0; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded I/O addresses. */ - if (ia->ia_iobase == IOBASEUNK) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + + /* Don't allow wildcarded IRQ/DRQ. */ + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) + return (0); + + if (ia->ia_drq[0].ir_drq == ISACF_DRQ_DEFAULT) return (0); /* Map the I/O space. */ - if (bus_space_map(iot, ia->ia_iobase, 6 /* FDC_NPORT */, 0, &base_ioh)) + iobase = ia->ia_io[0].ir_addr; + if (bus_space_map(iot, iobase, 6 /* FDC_NPORT */, 0, &base_ioh)) return (0); if (bus_space_subregion(iot, base_ioh, 2, 4, &ioh)) { @@ -141,7 +159,7 @@ fdc_isa_probe(struct device *parent, return (0); } - if (bus_space_map(iot, ia->ia_iobase + fdctl + 2, 1, 0, &ctl_ioh)) { + if (bus_space_map(iot, iobase + fdctl + 2, 1, 0, &ctl_ioh)) { bus_space_unmap(iot, base_ioh, 6); return (0); } @@ -160,52 +178,20 @@ fdc_isa_probe(struct device *parent, out_fdc(iot, ioh, 0xdf); out_fdc(iot, ioh, 2); -#ifdef NEWCONFIG - if (ia->ia_iobase = IOBASEUNK || ia->ia_drq == DRQUNK) - return (0); - - if (ia->ia_irq == IRQUNK) { - ia->ia_irq = isa_discoverintr(fdc_isa_forceintr, aux); - if (ia->ia_irq == IRQNONE) - goto out; - - /* reset it again */ - bus_space_write_1(iot, ioh, fdout, 0); - delay(100); - bus_space_write_1(iot, ioh, fdout, FDO_FRST); - } -#endif - rv = 1; - ia->ia_iosize = FDC_NPORT; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = FDC_NPORT; + + ia->ia_nirq = 1; + ia->ia_ndrq = 1; + + ia->ia_niomem = 0; out: bus_space_unmap(iot, base_ioh, 6 /* FDC_NPORT */); return (rv); } -#ifdef NEWCONFIG -/* - * XXX This is broken, and needs fixing. In general, the interface needs - * XXX to change. - */ -void -fdc_isa_forceintr(void *aux) -{ - struct isa_attach_args *ia = aux; - int iobase = ia->ia_iobase; - - /* - * The motor is off; this should generate an error with or - * without a disk drive present. - */ - out_fdc(iot, ioh, NE7CMD_SEEK); - out_fdc(iot, ioh, 0); - out_fdc(iot, ioh, 0); -} -#endif - void fdc_isa_attach(struct device *parent, struct device *self, @@ -219,10 +205,10 @@ fdc_isa_attach(struct device *parent, fdc->sc_iot = ia->ia_iot; fdc->sc_ic = ia->ia_ic; - fdc->sc_drq = ia->ia_drq; + fdc->sc_drq = ia->ia_drq[0].ir_drq; - if (bus_space_map(fdc->sc_iot, ia->ia_iobase, 6 /* FDC_NPORT */, 0, - &isc->sc_baseioh)) { + if (bus_space_map(fdc->sc_iot, ia->ia_io[0].ir_addr, + 6 /* FDC_NPORT */, 0, &isc->sc_baseioh)) { printf("%s: unable to map I/O space\n", fdc->sc_dev.dv_xname); return; } @@ -234,15 +220,15 @@ fdc_isa_attach(struct device *parent, return; } - if (bus_space_map(fdc->sc_iot, ia->ia_iobase + fdctl + 2, 1, 0, + if (bus_space_map(fdc->sc_iot, ia->ia_io[0].ir_addr + fdctl + 2, 1, 0, &fdc->sc_fdctlioh)) { printf("%s: unable to map CTL I/O space\n", fdc->sc_dev.dv_xname); return; } - fdc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_BIO, fdcintr, fdc); + fdc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_BIO, fdcintr, fdc); fdcattach(fdc); } diff --git a/sys/dev/isa/gus.c b/sys/dev/isa/gus.c index 0a40b6424498..8cf0aa9d2c6e 100644 --- a/sys/dev/isa/gus.c +++ b/sys/dev/isa/gus.c @@ -1,4 +1,4 @@ -/* $NetBSD: gus.c,v 1.73 2001/11/13 08:01:14 lukem Exp $ */ +/* $NetBSD: gus.c,v 1.74 2002/01/07 21:47:05 thorpej Exp $ */ /*- * Copyright (c) 1996, 1999 The NetBSD Foundation, Inc. @@ -95,7 +95,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.73 2001/11/13 08:01:14 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.74 2002/01/07 21:47:05 thorpej Exp $"); #include "gus.h" #if NGUS > 0 @@ -453,11 +453,13 @@ struct cfattach gus_ca = { */ static const int gus_irq_map[] = { - IRQUNK, IRQUNK, 1, 3, IRQUNK, 2, IRQUNK, 4, IRQUNK, 1, IRQUNK, 5, 6, - IRQUNK, IRQUNK, 7 + ISACF_IRQ_DEFAULT, ISACF_IRQ_DEFAULT, 1, 3, ISACF_IRQ_DEFAULT, 2, + ISACF_IRQ_DEFAULT, 4, ISACF_IRQ_DEFAULT, 1, ISACF_IRQ_DEFAULT, 5, + 6, ISACF_IRQ_DEFAULT, ISACF_IRQ_DEFAULT, 7 }; static const int gus_drq_map[] = { - DRQUNK, 1, DRQUNK, 2, DRQUNK, 3, 4, 5 + ISACF_DRQ_DEFAULT, 1, ISACF_DRQ_DEFAULT, 2, ISACF_DRQ_DEFAULT, 3, + 4, 5 }; /* @@ -679,8 +681,23 @@ gusprobe(parent, match, aux) void *aux; { struct isa_attach_args *ia = aux; - int iobase = ia->ia_iobase; - int recdrq = ia->ia_drq2; + int iobase, recdrq; + + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + iobase = ia->ia_io[0].ir_addr; + if (ia->ia_ndrq > 1) + recdrq = ia->ia_drq[1].ir_drq; + else + recdrq = ISACF_DRQ_DEFAULT; /* * Before we do anything else, make sure requested IRQ and DRQ are @@ -688,25 +705,30 @@ gusprobe(parent, match, aux) */ /* XXX range check before indexing!! */ - if (ia->ia_irq == IRQUNK || gus_irq_map[ia->ia_irq] == IRQUNK) { - printf("gus: invalid irq %d, card not probed\n", ia->ia_irq); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT || + gus_irq_map[ia->ia_irq[0].ir_irq] == ISACF_IRQ_DEFAULT) { + printf("gus: invalid irq %d, card not probed\n", + ia->ia_irq[0].ir_irq); return 0; } - if (ia->ia_drq == DRQUNK || gus_drq_map[ia->ia_drq] == DRQUNK) { - printf("gus: invalid drq %d, card not probed\n", ia->ia_drq); + if (ia->ia_drq[0].ir_drq == ISACF_DRQ_DEFAULT || + gus_drq_map[ia->ia_drq[0].ir_drq] == ISACF_DRQ_DEFAULT) { + printf("gus: invalid drq %d, card not probed\n", + ia->ia_drq[0].ir_drq); return 0; } - if (recdrq != DRQUNK) { - if (recdrq > 7 || gus_drq_map[recdrq] == DRQUNK) { - printf("gus: invalid second DMA channel (%d), card not probed\n", recdrq); + if (recdrq != ISACF_DRQ_DEFAULT) { + if (recdrq > 7 || gus_drq_map[recdrq] == ISACF_DRQ_DEFAULT) { + printf("gus: invalid second DMA channel (%d), card not " + "probed\n", recdrq); return 0; } } else - recdrq = ia->ia_drq; + recdrq = ia->ia_drq[0].ir_drq; - if (iobase == IOBASEUNK) { + if (iobase == ISACF_PORT_DEFAULT) { int i; for(i = 0; i < gus_addrs; i++) if (gus_test_iobase(ia->ia_iot, gus_base_addrs[i])) { @@ -718,12 +740,20 @@ gusprobe(parent, match, aux) return 0; done: - if ((ia->ia_drq != -1 && !isa_drq_isfree(ia->ia_ic, ia->ia_drq)) || - (recdrq != -1 && !isa_drq_isfree(ia->ia_ic, recdrq))) + if (!isa_drq_isfree(ia->ia_ic, ia->ia_drq[0].ir_drq) || + (recdrq != ia->ia_drq[0].ir_drq && + !isa_drq_isfree(ia->ia_ic, recdrq))) return 0; - ia->ia_iobase = iobase; - ia->ia_iosize = GUS_NPORT1; + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = iobase; + ia->ia_io[0].ir_size = GUS_NPORT1; + + ia->ia_nirq = 1; + ia->ia_ndrq = (recdrq != ia->ia_drq[0].ir_drq) ? 2 : 1; + + ia->ia_niomem = 0; + return 1; } @@ -823,7 +853,7 @@ gusattach(parent, self, aux) sc->sc_iot = iot = ia->ia_iot; sc->sc_ic = ia->ia_ic; - iobase = ia->ia_iobase; + iobase = ia->ia_io[0].ir_addr; /* Map i/o space */ if (bus_space_map(iot, iobase, GUS_NPORT1, 0, &ioh1)) @@ -844,9 +874,10 @@ gusattach(parent, self, aux) sc->sc_ioh4 = ioh4; sc->sc_iobase = iobase; - sc->sc_irq = ia->ia_irq; - sc->sc_playdrq = ia->ia_drq; - sc->sc_recdrq = ia->ia_drq2; + sc->sc_irq = ia->ia_irq[0].ir_irq; + sc->sc_playdrq = ia->ia_drq[0].ir_drq; + sc->sc_recdrq = (ia->ia_ndrq == 2) ? + ia->ia_drq[1].ir_drq : ia->ia_drq[0].ir_drq; /* * Figure out our board rev, and see if we need to initialize the @@ -877,7 +908,8 @@ gusattach(parent, self, aux) m = GUSMASK_LINE_IN|GUSMASK_LINE_OUT; /* disable all */ - c = ((unsigned char) gus_irq_map[ia->ia_irq]) | GUSMASK_BOTH_RQ; + c = ((unsigned char) gus_irq_map[ia->ia_irq[0].ir_irq]) | + GUSMASK_BOTH_RQ; if (sc->sc_recdrq == sc->sc_playdrq) d = (unsigned char) (gus_drq_map[sc->sc_playdrq] | @@ -1015,8 +1047,8 @@ gusattach(parent, self, aux) /* XXX we shouldn't have to use splgus == splclock, nor should * we use IPL_CLOCK. */ - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_AUDIO, gusintr, sc /* sc->sc_gusdsp */); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_AUDIO, gusintr, sc /* sc->sc_gusdsp */); /* * Set some default values diff --git a/sys/dev/isa/i82365_isa.c b/sys/dev/isa/i82365_isa.c index 045390f29ed3..e58a37444df7 100644 --- a/sys/dev/isa/i82365_isa.c +++ b/sys/dev/isa/i82365_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: i82365_isa.c,v 1.16 2001/11/15 09:48:09 lukem Exp $ */ +/* $NetBSD: i82365_isa.c,v 1.17 2002/01/07 21:47:05 thorpej Exp $ */ /* * Copyright (c) 1997 Marc Horowitz. All rights reserved. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: i82365_isa.c,v 1.16 2001/11/15 09:48:09 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i82365_isa.c,v 1.17 2002/01/07 21:47:05 thorpej Exp $"); #define PCICISADEBUG @@ -95,20 +95,35 @@ pcic_isa_probe(parent, match, aux) struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh, memh; - int val, found; + int val, found, msize; + + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_iomem[0].ir_addr == ISACF_IOMEM_DEFAULT) return (0); - if (bus_space_map(iot, ia->ia_iobase, PCIC_IOSIZE, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, PCIC_IOSIZE, 0, &ioh)) return (0); - if (ia->ia_msize == -1) - ia->ia_msize = PCIC_MEMSIZE; + if (ia->ia_iomem[0].ir_size == ISACF_IOSIZ_DEFAULT) + msize = PCIC_MEMSIZE; + else + msize = ia->ia_iomem[0].ir_size; - if (bus_space_map(ia->ia_memt, ia->ia_maddr, ia->ia_msize, 0, &memh)) + if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, + msize, 0, &memh)) { + bus_space_unmap(iot, ioh, PCIC_IOSIZE); return (0); + } found = 0; @@ -150,12 +165,20 @@ pcic_isa_probe(parent, match, aux) bus_space_unmap(iot, ioh, PCIC_IOSIZE); - bus_space_unmap(ia->ia_memt, memh, ia->ia_msize); + bus_space_unmap(ia->ia_memt, memh, msize); if (!found) return (0); - ia->ia_iosize = PCIC_IOSIZE; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = PCIC_IOSIZE; + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_size = msize; + + /* IRQ is special. */ + + ia->ia_ndrq = 0; return (1); } @@ -175,19 +198,21 @@ pcic_isa_attach(parent, self, aux) bus_space_handle_t memh; /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, PCIC_IOSIZE, 0, &ioh)) { printf(": can't map i/o space\n"); return; } /* Map mem space. */ - if (bus_space_map(memt, ia->ia_maddr, ia->ia_msize, 0, &memh)) { + if (bus_space_map(memt, ia->ia_iomem[0].ir_addr, + ia->ia_iomem[0].ir_size, 0, &memh)) { printf(": can't map mem space\n"); return; } - sc->membase = ia->ia_maddr; - sc->subregionmask = (1 << (ia->ia_msize / PCIC_MEM_PAGESIZE)) - 1; + sc->membase = ia->ia_iomem[0].ir_addr; + sc->subregionmask = + (1 << (ia->ia_iomem[0].ir_size / PCIC_MEM_PAGESIZE)) - 1; isc->sc_ic = ic; sc->pct = (pcmcia_chipset_tag_t) & pcic_isa_functions; @@ -196,12 +221,16 @@ pcic_isa_attach(parent, self, aux) sc->ioh = ioh; sc->memt = memt; sc->memh = memh; - sc->irq = ia->ia_irq; + if (ia->ia_nirq > 0) + sc->irq = ia->ia_irq[0].ir_irq; + else + sc->irq = ISACF_IRQ_DEFAULT; printf("\n"); pcic_attach(sc); - pcic_isa_bus_width_probe(sc, iot, ioh, ia->ia_iobase, ia->ia_iosize); + pcic_isa_bus_width_probe(sc, iot, ioh, ia->ia_io[0].ir_addr, + PCIC_IOSIZE); pcic_attach_sockets(sc); config_interrupts(self, pcic_isa_config_interrupts); diff --git a/sys/dev/isa/if_ai.c b/sys/dev/isa/if_ai.c index e074de0507ad..d70a1d31a936 100644 --- a/sys/dev/isa/if_ai.c +++ b/sys/dev/isa/if_ai.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ai.c,v 1.13 2001/11/26 23:31:00 fredette Exp $ */ +/* $NetBSD: if_ai.c,v 1.14 2002/01/07 21:47:05 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.13 2001/11/26 23:31:00 fredette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.14 2002/01/07 21:47:05 thorpej Exp $"); #include #include @@ -245,11 +245,20 @@ ai_match(parent, cf, aux) struct isa_attach_args * const ia = aux; struct ai_softc asc; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); /* Punt if wildcarded port, IRQ or memory address */ - if (ia->ia_irq == ISACF_IRQ_DEFAULT || - ia->ia_maddr == ISACF_IOMEM_DEFAULT || - ia->ia_iobase == ISACF_PORT_DEFAULT) { + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT || + ia->ia_iomem[0].ir_addr == ISACF_IRQ_DEFAULT || + ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) { DPRINTF(( "ai_match: wildcarded IRQ, IOAddr, or memAddr, skipping\n")); return (0); @@ -261,7 +270,7 @@ ai_match(parent, cf, aux) * This probe is horribly bad, but I have no info on this card other * than the former driver, and it was just as bad! */ - if (bus_space_map(iot, ia->ia_iobase, + if (bus_space_map(iot, ia->ia_io[0].ir_addr, AI_IOSIZE, 0, &ioh) != 0) { DPRINTF(("ai_match: cannot map %d IO ports @ 0x%x\n", @@ -287,15 +296,15 @@ ai_match(parent, cf, aux) asc.sc_regt = iot; asc.sc_regh = ioh; - if ((memsize = ai_find_mem_size(&asc,ia->ia_memt,ia->ia_maddr)) == 0) { + if ((memsize = ai_find_mem_size(&asc, ia->ia_memt, + ia->ia_iomem[0].ir_addr)) == 0) { DPRINTF(("ai_match: cannot size memory of board @ 0x%x\n", - ia->ia_iobase)); + ia->ia_io[0].ir_addr)); goto out; } - if (!ia->ia_msize) - ia->ia_msize = memsize; - else if (ia->ia_msize != memsize) { + if (ia->ia_iomem[0].ir_size != 0 && + ia->ia_iomem[0].ir_size != memsize) { DPRINTF(( "ai_match: memsize of board @ 0x%x doesn't match config\n", ia->ia_iobase)); @@ -303,8 +312,17 @@ ai_match(parent, cf, aux) } rv = 1; - ia->ia_msize = memsize; - ia->ia_iosize = AI_IOSIZE; + + ia->ia_nio = 1; + ia->ia_io[0].ir_size = AI_IOSIZE; + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_size = memsize; + + ia->ia_nirq = 1; + + ia->ia_ndrq = 0; + DPRINTF(("ai_match: found board @ 0x%x\n", ia->ia_iobase)); out: @@ -327,20 +345,22 @@ ai_attach(parent, self, aux) u_int8_t ethaddr[ETHER_ADDR_LEN]; char name[80]; - if (bus_space_map(ia->ia_iot, ia->ia_iobase, - ia->ia_iosize, 0, &ioh) != 0) { + if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &ioh) != 0) { DPRINTF(("\n%s: can't map i/o space 0x%x-0x%x\n", sc->sc_dev.dv_xname, - ia->ia_iobase, ia->ia_iobase + ia->ia_iosize - 1)); + ia->ia_io[0].ir_addr, ia->ia_io[0].ir_addr + + ia->ia_io[0].ir_size - 1)); return; } - if (bus_space_map(ia->ia_memt, ia->ia_maddr, - ia->ia_msize, 0, &memh) != 0) { + if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, + ia->ia_iomem[0].ir_size, 0, &memh) != 0) { DPRINTF(("\n%s: can't map iomem space 0x%x-0x%x\n", sc->sc_dev.dv_xname, - ia->ia_maddr, ia->ia_maddr + ia->ia_msize - 1)); - bus_space_unmap(ia->ia_iot, ioh, ia->ia_iosize); + ia->ia_iomem[0].ir_addr, ia->ia_iomem[0].ir_addr + + ia->ia_iomem[0].ir_size - 1)); + bus_space_unmap(ia->ia_iot, ioh, ia->ia_io[0].ir_size); return; } @@ -369,7 +389,7 @@ ai_attach(parent, self, aux) sc->bh = memh; /* Map i/o space. */ - sc->sc_msize = ia->ia_msize; + sc->sc_msize = ia->ia_iomem[0].ir_size; sc->sc_maddr = (void *)memh; sc->sc_iobase = (char *)sc->sc_maddr + sc->sc_msize - (1 << 24); @@ -399,8 +419,8 @@ ai_attach(parent, self, aux) if (!i82586_proberam(sc)) { DPRINTF(("\n%s: can't talk to i82586!\n", sc->sc_dev.dv_xname)); - bus_space_unmap(ia->ia_iot, ioh, ia->ia_iosize); - bus_space_unmap(ia->ia_memt, memh, ia->ia_msize); + bus_space_unmap(ia->ia_iot, ioh, ia->ia_io[0].ir_size); + bus_space_unmap(ia->ia_memt, memh, ia->ia_iomem[0].ir_size); return; } @@ -412,8 +432,8 @@ ai_attach(parent, self, aux) i82586_attach(sc, name, ethaddr, NULL, 0, 0); - asc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, i82586_intr, sc); + asc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, i82586_intr, sc); if (asc->sc_ih == NULL) { DPRINTF(("\n%s: can't establish interrupt\n", sc->sc_dev.dv_xname)); diff --git a/sys/dev/isa/if_ate.c b/sys/dev/isa/if_ate.c index a23f521c5d6d..4fabcdeff2c4 100644 --- a/sys/dev/isa/if_ate.c +++ b/sys/dev/isa/if_ate.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ate.c,v 1.29 2001/11/21 19:01:33 wiz Exp $ */ +/* $NetBSD: if_ate.c,v 1.30 2002/01/07 21:47:06 thorpej Exp $ */ /* * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ate.c,v 1.29 2001/11/21 19:01:33 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ate.c,v 1.30 2002/01/07 21:47:06 thorpej Exp $"); #include #include @@ -112,15 +112,23 @@ ate_match(parent, match, aux) int i, iobase, irq, rv = 0; u_int8_t myea[ETHER_ADDR_LEN]; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded values. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) return (0); /* * See if the sepcified address is valid for MB86965A JLI mode. */ for (i = 0; i < NATE_IOMAP; i++) - if (ate_iomap[i] == ia->ia_iobase) + if (ate_iomap[i] == ia->ia_io[0].ir_addr) break; if (i == NATE_IOMAP) { #ifdef ATE_DEBUG @@ -130,10 +138,10 @@ ate_match(parent, match, aux) } /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, ATE_NPORTS, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, ATE_NPORTS, 0, &ioh)) { #ifdef ATE_DEBUG printf("ate_match: couldn't map iospace 0x%x\n", - ia->ia_iobase); + ia->ia_io[0].ir_addr); #endif return (0); } @@ -145,7 +153,7 @@ ate_match(parent, match, aux) goto out; } - if (iobase != ia->ia_iobase) { + if (iobase != ia->ia_io[0].ir_addr) { #ifdef ATE_DEBUG printf("ate_match: unexpected iobase in board: 0x%x\n", ia->ia_iobase); @@ -160,18 +168,24 @@ ate_match(parent, match, aux) goto out; } - if (ia->ia_irq != ISACF_IRQ_DEFAULT) { - if (ia->ia_irq != irq) { + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT) { + if (ia->ia_irq[0].ir_irq != irq) { printf("ate_match: irq mismatch; " "kernel configured %d != board configured %d\n", - ia->ia_irq, irq); + ia->ia_irq[0].ir_irq, irq); goto out; } } else - ia->ia_irq = irq; + ia->ia_irq[0].ir_irq = irq; + + ia->ia_nio = 1; + ia->ia_io[0].ir_size = ATE_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; - ia->ia_iosize = ATE_NPORTS; - ia->ia_msize = 0; rv = 1; out: @@ -373,7 +387,7 @@ ate_attach(parent, self, aux) printf("\n"); /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, ATE_NPORTS, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, ATE_NPORTS, 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } @@ -419,8 +433,8 @@ ate_attach(parent, self, aux) mb86960_config(sc, NULL, 0, 0); /* Establish the interrupt handler. */ - isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, mb86960_intr, sc); + isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, mb86960_intr, sc); if (isc->sc_ih == NULL) printf("%s: couldn't establish interrupt handler\n", sc->sc_dev.dv_xname); diff --git a/sys/dev/isa/if_cs_isa.c b/sys/dev/isa/if_cs_isa.c index 7b44d0819bb1..7266f79e20b7 100644 --- a/sys/dev/isa/if_cs_isa.c +++ b/sys/dev/isa/if_cs_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cs_isa.c,v 1.5 2001/11/26 19:17:06 yamt Exp $ */ +/* $NetBSD: if_cs_isa.c,v 1.6 2002/01/07 21:47:06 thorpej Exp $ */ /* * Copyright 1997 @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_cs_isa.c,v 1.5 2001/11/26 19:17:06 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cs_isa.c,v 1.6 2002/01/07 21:47:06 thorpej Exp $"); #include #include @@ -80,19 +80,32 @@ cs_isa_probe(parent, cf, aux) bus_space_handle_t ioh, memh; int rv = 0, have_io = 0, have_mem = 0; u_int16_t isa_cfg, isa_membase; - bus_addr_t maddr = ia->ia_maddr; - int irq = ia->ia_irq; + int maddr, irq; + + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); /* * Disallow wildcarded I/O base. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) return (0); + if (ia->ia_niomem > 0) + maddr = ia->ia_iomem[0].ir_addr; + else + maddr = ISACF_IOMEM_DEFAULT; + /* * Map the I/O space. */ - if (bus_space_map(ia->ia_iot, ia->ia_iobase, CS8900_IOSIZE, 0, &ioh)) + if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, CS8900_IOSIZE, + 0, &ioh)) goto out; have_io = 1; @@ -118,7 +131,8 @@ cs_isa_probe(parent, cf, aux) * If the IRQ or memory address were not specified, read the * ISA_CFG EEPROM location. */ - if (maddr == ISACF_IOMEM_DEFAULT || irq == ISACF_IRQ_DEFAULT) { + if (maddr == ISACF_IOMEM_DEFAULT || + ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) { if (cs_verify_eeprom(iot, ioh) == CS_ERROR) { printf("cs_isa_probe: EEPROM bad or missing\n"); goto out; @@ -133,13 +147,14 @@ cs_isa_probe(parent, cf, aux) /* * If the IRQ wasn't specified, get it from the EEPROM. */ - if (irq == ISACF_IRQ_DEFAULT) { + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) { irq = isa_cfg & ISA_CFG_IRQ_MASK; if (irq == 3) irq = 5; else irq += 10; - } + } else + irq = ia->ia_irq[0].ir_irq; /* * If the memory address wasn't specified, get it from the EEPROM. @@ -176,11 +191,19 @@ cs_isa_probe(parent, cf, aux) bus_space_unmap(memt, memh, CS8900_MEMSIZE); if (rv) { - ia->ia_iosize = CS8900_IOSIZE; - ia->ia_maddr = maddr; - ia->ia_irq = irq; - if (ia->ia_maddr != ISACF_IOMEM_DEFAULT) - ia->ia_msize = CS8900_MEMSIZE; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = CS8900_IOSIZE; + + if (maddr == ISACF_IOMEM_DEFAULT) + ia->ia_niomem = 0; + else { + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_addr = maddr; + ia->ia_iomem[0].ir_size = CS8900_MEMSIZE; + } + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = irq; } return (rv); } @@ -198,15 +221,19 @@ cs_isa_attach(parent, self, aux) sc->sc_iot = ia->ia_iot; sc->sc_memt = ia->ia_memt; - isc->sc_drq = ia->ia_drq; - sc->sc_irq = ia->ia_irq; + if (ia->ia_ndrq > 0) + isc->sc_drq = ia->ia_drq[0].ir_drq; + else + isc->sc_drq = -1; + + sc->sc_irq = ia->ia_irq[0].ir_irq; printf("\n"); /* * Map the device. */ - if (bus_space_map(sc->sc_iot, ia->ia_iobase, ia->ia_iosize, + if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, CS8900_IOSIZE, 0, &sc->sc_ioh)) { printf("%s: unable to map i/o space\n", sc->sc_dev.dv_xname); return; @@ -225,16 +252,16 @@ cs_isa_attach(parent, self, aux) * we set ourselves up to use memory mode forever. Otherwise, * we fall back on I/O mode. */ - if (ia->ia_maddr != ISACF_IOMEM_DEFAULT && - ia->ia_msize == CS8900_MEMSIZE && - CS8900_MEMBASE_ISVALID(ia->ia_maddr)) { - if (bus_space_map(sc->sc_memt, ia->ia_maddr, ia->ia_msize, - 0, &sc->sc_memh)) { + if (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT && + ia->ia_iomem[0].ir_size == CS8900_MEMSIZE && + CS8900_MEMBASE_ISVALID(ia->ia_iomem[0].ir_addr)) { + if (bus_space_map(sc->sc_memt, ia->ia_iomem[0].ir_addr, + CS8900_MEMSIZE, 0, &sc->sc_memh)) { printf("%s: unable to map memory space\n", sc->sc_dev.dv_xname); } else { sc->sc_cfgflags |= CFGFLG_MEM_MODE; - sc->sc_pktpgaddr = ia->ia_maddr; + sc->sc_pktpgaddr = ia->ia_iomem[0].ir_addr; } } diff --git a/sys/dev/isa/if_ec.c b/sys/dev/isa/if_ec.c index 625e02356498..086e51780ed6 100644 --- a/sys/dev/isa/if_ec.c +++ b/sys/dev/isa/if_ec.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ec.c,v 1.15 2001/11/13 08:01:16 lukem Exp $ */ +/* $NetBSD: if_ec.c,v 1.16 2002/01/07 21:47:06 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -55,7 +55,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.15 2001/11/13 08:01:16 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.16 2002/01/07 21:47:06 thorpej Exp $"); #include #include @@ -122,8 +122,8 @@ static const int ec_iobase[] = { #define NEC_IOBASE (sizeof(ec_iobase) / sizeof(ec_iobase[0])) static const int ec_membase[] = { - MADDRUNK, MADDRUNK, MADDRUNK, MADDRUNK, 0xc8000, 0xcc000, - 0xd8000, 0xdc000, + ISACF_IOMEM_DEFAULT, ISACF_IOMEM_DEFAULT, ISACF_IOMEM_DEFAULT, + ISACF_IOMEM_DEFAULT, 0xc8000, 0xcc000, 0xd8000, 0xdc000, }; #define NEC_MEMBASE (sizeof(ec_membase) / sizeof(ec_membase[0])) @@ -152,45 +152,55 @@ ec_probe(parent, match, aux) */ memsize = 8192; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o addresses. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) return (0); /* Disallow wildcarded mem address. */ - if (ia->ia_maddr == ISACF_IOMEM_DEFAULT) + if (ia->ia_iomem[0].ir_addr == ISACF_IOMEM_DEFAULT) return (0); /* Validate the i/o base. */ for (i = 0; i < NEC_IOBASE; i++) - if (ia->ia_iobase == ec_iobase[i]) + if (ia->ia_io[0].ir_addr == ec_iobase[i]) break; if (i == NEC_IOBASE) return (0); /* Validate the mem base. */ for (i = 0; i < NEC_MEMBASE; i++) { - if (ec_membase[i] == MADDRUNK) + if (ec_membase[i] == ISACF_IOMEM_DEFAULT) continue; - if (ia->ia_maddr == ec_membase[i]) + if (ia->ia_iomem[0].ir_addr == ec_membase[i]) break; } if (i == NEC_MEMBASE) return (0); /* Attempt to map the NIC space. */ - if (bus_space_map(nict, ia->ia_iobase + ELINK2_NIC_OFFSET, + if (bus_space_map(nict, ia->ia_io[0].ir_addr + ELINK2_NIC_OFFSET, ELINK2_NIC_PORTS, 0, &nich)) goto out; nich_valid = 1; /* Attempt to map the ASIC space. */ - if (bus_space_map(asict, ia->ia_iobase + ELINK2_ASIC_OFFSET, + if (bus_space_map(asict, ia->ia_io[0].ir_addr + ELINK2_ASIC_OFFSET, ELINK2_ASIC_PORTS, 0, &asich)) goto out; asich_valid = 1; /* Attempt to map the memory space. */ - if (bus_space_map(memt, ia->ia_maddr, memsize, 0, &memh)) + if (bus_space_map(memt, ia->ia_iomem[0].ir_addr, memsize, 0, &memh)) goto out; memh_valid = 1; @@ -206,7 +216,7 @@ ec_probe(parent, match, aux) if (x == 0 || (x & (x - 1)) != 0) goto out; i = ffs(x) - 1; - if (ia->ia_iobase != ec_iobase[i]) + if (ia->ia_io[0].ir_addr != ec_iobase[i]) goto out; /* @@ -217,12 +227,20 @@ ec_probe(parent, match, aux) if (x == 0 || (x & (x - 1)) != 0) goto out; i = ffs(x) - 1; - if (ia->ia_maddr != ec_membase[i]) + if (ia->ia_iomem[0].ir_addr != ec_membase[i]) goto out; /* So, we say we've found it! */ - ia->ia_iosize = ELINK2_NIC_PORTS; - ia->ia_msize = memsize; + ia->ia_nio = 1; /* XXX Really 2! */ + ia->ia_io[0].ir_size = ELINK2_NIC_PORTS; + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_size = memsize; + + ia->ia_nirq = 1; + + ia->ia_ndrq = 0; + rv = 1; out: @@ -258,10 +276,10 @@ ec_attach(parent, self, aux) * Hmm, a 16-bit card has 16k of memory, but only an 8k window * to it. */ - memsize = 8192; + memsize = ia->ia_iomem[0].ir_size; /* Map the NIC space. */ - if (bus_space_map(nict, ia->ia_iobase + ELINK2_NIC_OFFSET, + if (bus_space_map(nict, ia->ia_io[0].ir_addr + ELINK2_NIC_OFFSET, ELINK2_NIC_PORTS, 0, &nich)) { printf("%s: can't map nic i/o space\n", sc->sc_dev.dv_xname); @@ -269,7 +287,7 @@ ec_attach(parent, self, aux) } /* Map the ASIC space. */ - if (bus_space_map(asict, ia->ia_iobase + ELINK2_ASIC_OFFSET, + if (bus_space_map(asict, ia->ia_io[0].ir_addr + ELINK2_ASIC_OFFSET, ELINK2_ASIC_PORTS, 0, &asich)) { printf("%s: can't map asic i/o space\n", sc->sc_dev.dv_xname); @@ -277,7 +295,7 @@ ec_attach(parent, self, aux) } /* Map the memory space. */ - if (bus_space_map(memt, ia->ia_maddr, memsize, 0, &memh)) { + if (bus_space_map(memt, ia->ia_iomem[0].ir_addr, memsize, 0, &memh)) { printf("%s: can't map shared memory\n", sc->sc_dev.dv_xname); return; @@ -442,21 +460,21 @@ ec_attach(parent, self, aux) /* * Program the IRQ. */ - switch (ia->ia_irq) { + switch (ia->ia_irq[0].ir_irq) { case 9: tmp = ELINK2_IDCFR_IRQ2; break; case 3: tmp = ELINK2_IDCFR_IRQ3; break; case 4: tmp = ELINK2_IDCFR_IRQ4; break; case 5: tmp = ELINK2_IDCFR_IRQ5; break; break; - case IRQUNK: + case ISACF_IRQ_DEFAULT: printf("%s: wildcarded IRQ is not allowed\n", sc->sc_dev.dv_xname); return; default: printf("%s: invalid IRQ %d, must be 3, 4, 5, or 9\n", - sc->sc_dev.dv_xname, ia->ia_irq); + sc->sc_dev.dv_xname, ia->ia_irq[0].ir_irq); return; } @@ -488,8 +506,8 @@ ec_attach(parent, self, aux) } /* Establish interrupt handler. */ - esc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, dp8390_intr, sc); + esc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, dp8390_intr, sc); if (esc->sc_ih == NULL) printf("%s: can't establish interrupt\n", sc->sc_dev.dv_xname); } diff --git a/sys/dev/isa/if_ef.c b/sys/dev/isa/if_ef.c index 8585bc4082b4..d4bac4c98b9d 100644 --- a/sys/dev/isa/if_ef.c +++ b/sys/dev/isa/if_ef.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ef.c,v 1.11 2001/11/26 23:31:00 fredette Exp $ */ +/* $NetBSD: if_ef.c,v 1.12 2002/01/07 21:47:06 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.11 2001/11/26 23:31:00 fredette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.12 2002/01/07 21:47:06 thorpej Exp $"); #include #include @@ -364,14 +364,17 @@ ef_match(parent, cf, aux) bus_space_handle_t ioh; bus_space_tag_t iot = ia->ia_iot; + if (ISA_DIRECT_CONFIG(ia)) + return (0); + if (ef_isa_buses_inited == 0) { LIST_INIT(&ef_isa_buses); ef_isa_buses_inited = 1; } /* - * Probe this bus if we haven't done so already. - */ + * Probe this bus if we haven't done so already. + */ for (bus = ef_isa_buses.lh_first; bus != NULL; bus = bus->isa_link.le_next) { if (bus->isa_bus == parent) @@ -453,20 +456,27 @@ ef_match(parent, cf, aux) } } + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + for (idx = 0; idx < MAXCARDS_PER_ISABUS; idx++) { if (bus->isa_cards[idx].available != 1) continue; - if (ia->ia_iobase != IOBASEUNK && - ia->ia_iobase != bus->isa_cards[idx].iobase) + if (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT && + ia->ia_io[0].ir_addr != bus->isa_cards[idx].iobase) continue; - if (ia->ia_maddr != MADDRUNK && - ia->ia_maddr != bus->isa_cards[idx].maddr) + if (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT && + ia->ia_iomem[0].ir_addr != bus->isa_cards[idx].maddr) continue; - if (ia->ia_irq != IRQUNK && - ia->ia_irq != bus->isa_cards[idx].irq) + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != bus->isa_cards[idx].irq) continue; break; @@ -476,11 +486,20 @@ ef_match(parent, cf, aux) return (0); bus->isa_cards[idx].available++; - ia->ia_iobase = bus->isa_cards[idx].iobase; - ia->ia_irq = bus->isa_cards[idx].irq; - ia->ia_iosize = EF_IOSIZE; - ia->ia_maddr = bus->isa_cards[idx].maddr; - ia->ia_msize = bus->isa_cards[idx].msize; + + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = bus->isa_cards[idx].iobase; + ia->ia_io[0].ir_size = EF_IOSIZE; + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_addr = bus->isa_cards[idx].maddr; + ia->ia_iomem[0].ir_size = bus->isa_cards[idx].msize; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = bus->isa_cards[idx].irq; + + ia->ia_ndrq = 0; + return (1); } @@ -556,32 +575,32 @@ ef_attach(parent, self, aux) } /* Map i/o space. */ - if (bus_space_map(ia->ia_iot, ia->ia_iobase, - ia->ia_iosize, 0, &ioh) != 0) { + if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &ioh) != 0) { DPRINTF(("\n%s: can't map i/o space 0x%x-0x%x\n", - sc->sc_dev.dv_xname, ia->ia_iobase, - ia->ia_iobase + ia->ia_iosize - 1)); + sc->sc_dev.dv_xname, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_addr + ia->ia_io[0].ir_size - 1)); return; } esc->sc_regt = ia->ia_iot; esc->sc_regh = ioh; - if (bus_space_map(ia->ia_memt, ia->ia_maddr, - ia->ia_msize, 0, &memh) != 0) { + if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, + ia->ia_iomem[0].ir_size, 0, &memh) != 0) { DPRINTF(("\n%s: can't map iomem space 0x%x-0x%x\n", sc->sc_dev.dv_xname, ia->ia_maddr, ia->ia_maddr + ia->ia_msize - 1)); - bus_space_unmap(ia->ia_iot, ioh, ia->ia_iosize); + bus_space_unmap(ia->ia_iot, ioh, ia->ia_io[0].ir_size); return; } sc->bt = ia->ia_memt; sc->bh = memh; - sc->sc_msize = ia->ia_msize; + sc->sc_msize = ia->ia_iomem[0].ir_size; sc->sc_maddr = (void *)memh; sc->sc_iobase = (char *)sc->sc_maddr + sc->sc_msize - (1 << 24); @@ -611,8 +630,8 @@ ef_attach(parent, self, aux) if (!i82586_proberam(sc)) { DPRINTF(("\n%s: can't talk to i82586!\n", sc->sc_dev.dv_xname)); - bus_space_unmap(ia->ia_iot, ioh, ia->ia_iosize); - bus_space_unmap(ia->ia_memt, memh, ia->ia_msize); + bus_space_unmap(ia->ia_iot, ioh, ia->ia_io[0].ir_size); + bus_space_unmap(ia->ia_memt, memh, ia->ia_iomem[0].ir_size); return; } @@ -658,8 +677,8 @@ ef_attach(parent, self, aux) /* Clear the interrupt latch just in case. */ bus_space_write_1(esc->sc_regt, esc->sc_regh, EF_ICTRL, 1); - esc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, i82586_intr, sc); + esc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, i82586_intr, sc); if (esc->sc_ih == NULL) { DPRINTF(("\n%s: can't establish interrupt\n", sc->sc_dev.dv_xname)); diff --git a/sys/dev/isa/if_eg.c b/sys/dev/isa/if_eg.c index d7d6ca83152c..33bd8e470b68 100644 --- a/sys/dev/isa/if_eg.c +++ b/sys/dev/isa/if_eg.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_eg.c,v 1.56 2001/11/15 09:48:09 lukem Exp $ */ +/* $NetBSD: if_eg.c,v 1.57 2002/01/07 21:47:06 thorpej Exp $ */ /* * Copyright (c) 1993 Dean Huxley @@ -33,14 +33,14 @@ * Support for 3Com 3c505 Etherlink+ card. */ -/* To do: +/* + * To do: * - multicast * - promiscuous - * - get rid of isa indirect stuff */ #include -__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.56 2001/11/15 09:48:09 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.57 2002/01/07 21:47:06 thorpej Exp $"); #include "opt_inet.h" #include "opt_ns.h" @@ -335,17 +335,29 @@ egprobe(parent, match, aux) rval = 0; - if ((ia->ia_iobase & ~0x07f0) != 0) { - DPRINTF(("Weird iobase %x\n", ia->ia_iobase)); + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + /* Disallow wildcarded i/o address. */ + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + + /* Disallow wildcarded IRQ. */ + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) + return (0); + + if ((ia->ia_io[0].ir_addr & ~0x07f0) != 0) { + DPRINTF(("Weird iobase %x\n", ia->ia_io[0].ir_addr)); return 0; } - /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) - return (0); - /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, 0x08, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, 0x08, 0, &ioh)) { DPRINTF(("egprobe: can't map i/o space in probe\n")); return 0; } @@ -375,8 +387,14 @@ egprobe(parent, match, aux) goto out; } - ia->ia_iosize = 0x08; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = 0x08; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + rval = 1; out: @@ -399,7 +417,7 @@ egattach(parent, self, aux) printf("\n"); /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, 0x08, 0, &ioh)) { printf("%s: can't map i/o space\n", self->dv_xname); return; } @@ -489,8 +507,8 @@ egattach(parent, self, aux) if_attach(ifp); ether_ifattach(ifp, myaddr); - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, egintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, egintr, sc); #if NRND > 0 rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname, diff --git a/sys/dev/isa/if_el.c b/sys/dev/isa/if_el.c index f79ddae5e7e3..8721cb52d1f9 100644 --- a/sys/dev/isa/if_el.c +++ b/sys/dev/isa/if_el.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_el.c,v 1.65 2001/11/13 08:01:17 lukem Exp $ */ +/* $NetBSD: if_el.c,v 1.66 2002/01/07 21:47:07 thorpej Exp $ */ /* * Copyright (c) 1994, Matthew E. Kimmel. Permission is hereby granted @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.65 2001/11/13 08:01:17 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.66 2002/01/07 21:47:07 thorpej Exp $"); #include "opt_inet.h" #include "opt_ns.h" @@ -129,13 +129,28 @@ elprobe(parent, match, aux) struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; - int iobase = ia->ia_iobase; + int iobase; u_int8_t station_addr[ETHER_ADDR_LEN]; u_int8_t i; int rval; rval = 0; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + iobase = ia->ia_io[0].ir_addr; + + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) + return (0); + /* First check the base. */ if (iobase < 0x200 || iobase > 0x3f0) return 0; @@ -175,8 +190,14 @@ elprobe(parent, match, aux) } DPRINTF(("Vendor code ok.\n")); - ia->ia_iosize = 16; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = 16; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + rval = 1; out: @@ -207,7 +228,7 @@ elattach(parent, self, aux) DPRINTF(("Attaching %s...\n", sc->sc_dev.dv_xname)); /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, 16, 0, &ioh)) { printf("%s: can't map i/o space\n", self->dv_xname); return; } @@ -246,8 +267,8 @@ elattach(parent, self, aux) /* Print out some information for the user. */ printf("%s: address %s\n", self->dv_xname, ether_sprintf(myaddr)); - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, elintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, elintr, sc); #if NRND > 0 DPRINTF(("Attaching to random...\n")); diff --git a/sys/dev/isa/if_ep_isa.c b/sys/dev/isa/if_ep_isa.c index 5648759eb59e..81ca19cf4559 100644 --- a/sys/dev/isa/if_ep_isa.c +++ b/sys/dev/isa/if_ep_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ep_isa.c,v 1.29 2001/11/13 08:01:18 lukem Exp $ */ +/* $NetBSD: if_ep_isa.c,v 1.30 2002/01/07 21:47:07 thorpej Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -69,7 +69,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ep_isa.c,v 1.29 2001/11/13 08:01:18 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ep_isa.c,v 1.30 2002/01/07 21:47:07 thorpej Exp $"); #include #include @@ -170,6 +170,9 @@ ep_isa_probe(parent, match, aux) struct ep_isa_done_probe *er; int bus = parent->dv_unit; + if (ISA_DIRECT_CONFIG(ia)) + return (0); + if (ep_isa_probes_initialized == 0) { LIST_INIT(&ep_isa_all_probes); ep_isa_probes_initialized = 1; @@ -319,27 +322,42 @@ ep_isa_probe(parent, match, aux) bus_probed: + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + for (i = 0; i < nepcards; i++) { if (epcards[i].bus != bus) continue; if (epcards[i].available == 0) continue; - if (ia->ia_iobase != IOBASEUNK && - ia->ia_iobase != epcards[i].iobase) + + if (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT && + ia->ia_io[0].ir_addr != epcards[i].iobase) continue; - if (ia->ia_irq != IRQUNK && - ia->ia_irq != epcards[i].irq) + + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != epcards[i].irq) continue; + goto good; } return 0; good: epcards[i].available = 0; - ia->ia_iobase = epcards[i].iobase; - ia->ia_irq = epcards[i].irq; - ia->ia_iosize = 0x10; - ia->ia_msize = 0; + + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = epcards[i].iobase; + ia->ia_io[0].ir_size = 0x10; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = epcards[i].irq; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + ia->ia_aux = (void *)epcards[i].model; return 1; } @@ -356,7 +374,7 @@ ep_isa_attach(parent, self, aux) int chipset; /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, 0x10, 0, &ioh)) { printf(": can't map i/o space\n"); return; } @@ -382,6 +400,6 @@ ep_isa_attach(parent, self, aux) return; } - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, epintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, epintr, sc); } diff --git a/sys/dev/isa/if_fmv.c b/sys/dev/isa/if_fmv.c index cd1680d4e589..7de6c56ed15c 100644 --- a/sys/dev/isa/if_fmv.c +++ b/sys/dev/isa/if_fmv.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_fmv.c,v 1.25 2001/11/13 08:01:18 lukem Exp $ */ +/* $NetBSD: if_fmv.c,v 1.26 2002/01/07 21:47:07 thorpej Exp $ */ /* * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_fmv.c,v 1.25 2001/11/13 08:01:18 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_fmv.c,v 1.26 2002/01/07 21:47:07 thorpej Exp $"); #include #include @@ -111,15 +111,23 @@ fmv_match(parent, match, aux) int i, iobase, irq, rv = 0; u_int8_t myea[ETHER_ADDR_LEN]; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded values. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) return (0); /* * See if the sepcified address is valid for FMV-180 series. */ for (i = 0; i < NFMV_IOMAP; i++) - if (fmv_iomap[i] == ia->ia_iobase) + if (fmv_iomap[i] == ia->ia_io[0].ir_addr) break; if (i == NFMV_IOMAP) { #ifdef FMV_DEBUG @@ -129,10 +137,10 @@ fmv_match(parent, match, aux) } /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, FMV_NPORTS, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, FMV_NPORTS, 0, &ioh)) { #ifdef FMV_DEBUG printf("fmv_match: couldn't map iospace 0x%x\n", - ia->ia_iobase); + ia->ia_io[0].ir_addr); #endif return (0); } @@ -144,10 +152,10 @@ fmv_match(parent, match, aux) goto out; } - if (iobase != ia->ia_iobase) { + if (iobase != ia->ia_io[0].ir_addr) { #ifdef FMV_DEBUG printf("fmv_match: unexpected iobase in board: 0x%x\n", - ia->ia_iobase); + iobase); #endif goto out; } @@ -159,18 +167,24 @@ fmv_match(parent, match, aux) goto out; } - if (ia->ia_irq != ISACF_IRQ_DEFAULT) { - if (ia->ia_irq != irq) { + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT) { + if (ia->ia_irq[0].ir_irq != irq) { printf("fmv_match: irq mismatch; " "kernel configured %d != board configured %d\n", - ia->ia_irq, irq); + ia->ia_irq[0].ir_irq, irq); goto out; } } else - ia->ia_irq = irq; + ia->ia_irq[0].ir_irq = irq; + + ia->ia_nio = 1; + ia->ia_io[0].ir_size = FMV_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; - ia->ia_iosize = FMV_NPORTS; - ia->ia_msize = 0; rv = 1; out: @@ -323,7 +337,7 @@ fmv_attach(parent, self, aux) printf("\n"); /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, FMV_NPORTS, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, FMV_NPORTS, 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } @@ -376,8 +390,8 @@ fmv_attach(parent, self, aux) mb86960_config(sc, NULL, 0, 0); /* Establish the interrupt handler. */ - isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, mb86960_intr, sc); + isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, mb86960_intr, sc); if (isc->sc_ih == NULL) printf("%s: couldn't establish interrupt handler\n", sc->sc_dev.dv_xname); diff --git a/sys/dev/isa/if_ix.c b/sys/dev/isa/if_ix.c index 8444245ecd9b..9a6d9ea199ea 100644 --- a/sys/dev/isa/if_ix.c +++ b/sys/dev/isa/if_ix.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ix.c,v 1.12 2001/12/06 13:18:22 rafal Exp $ */ +/* $NetBSD: if_ix.c,v 1.13 2002/01/07 21:47:08 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ix.c,v 1.12 2001/12/06 13:18:22 rafal Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ix.c,v 1.13 2002/01/07 21:47:08 thorpej Exp $"); #include #include @@ -531,9 +531,22 @@ ix_match(parent, cf, aux) struct isa_attach_args * const ia = aux; short irq_translate[] = {0, 0x09, 0x03, 0x04, 0x05, 0x0a, 0x0b, 0}; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + iot = ia->ia_iot; - if (bus_space_map(iot, ia->ia_iobase, + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + + if (bus_space_map(iot, ia->ia_io[0].ir_addr, IX_IOSIZE, 0, &ioh) != 0) { DPRINTF(("Can't map io space at 0x%x\n", ia->ia_iobase)); return (0); @@ -615,18 +628,16 @@ ix_match(parent, cf, aux) goto out; } - if (ia->ia_maddr == ISACF_IOMEM_DEFAULT) - ia->ia_maddr = maddr; - else if (ia->ia_maddr != maddr) { + if (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT && + ia->ia_iomem[0].ir_addr != maddr) { DPRINTF(( "ix_match: memaddr of board @ 0x%x doesn't match config\n", ia->ia_iobase)); goto out; } - if (ia->ia_msize == ISACF_IOSIZ_DEFAULT) - ia->ia_msize = msize; - else if (ia->ia_msize != msize) { + if (ia->ia_iomem[0].ir_size != ISACF_IOSIZ_DEFAULT && + ia->ia_iomem[0].ir_size != msize) { DPRINTF(( "ix_match: memsize of board @ 0x%x doesn't match config\n", ia->ia_iobase)); @@ -655,7 +666,7 @@ ix_match(parent, cf, aux) if (msize != 0 && msize != 16384) { /* Set board up with memory-mapping info */ adjust = IX_MCTRL_FMCS16 | (pg & 0x3) << 2; - decode = ((1 << (ia->ia_msize / 16384)) - 1) << pg; + decode = ((1 << (ia->ia_iomem[0].ir_size / 16384)) - 1) << pg; edecode = ((~decode >> 4) & 0xF0) | (decode >> 8); bus_space_write_1(iot, ioh, IX_MEMDEC, decode & 0xFF); @@ -675,9 +686,8 @@ ix_match(parent, cf, aux) irq_encoded = ix_read_eeprom(iot, ioh, IX_EEPROM_CONFIG1); irq_encoded = (irq_encoded & IX_EEPROM_IRQ) >> IX_EEPROM_IRQ_SHIFT; irq = irq_translate[irq_encoded]; - if (ia->ia_irq == ISACF_IRQ_DEFAULT) - ia->ia_irq = irq; - else if (irq != ia->ia_irq) { + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + irq != ia->ia_irq[0].ir_irq) { DPRINTF(("board IRQ %d does not match config\n", irq)); goto out; } @@ -695,7 +705,17 @@ ix_match(parent, cf, aux) delay(100); rv = 1; - ia->ia_iosize = IX_IOSIZE; + + ia->ia_nio = 1; + ia->ia_io[0].ir_size = IX_IOSIZE; + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_addr = maddr; + ia->ia_iomem[0].ir_size = msize; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = irq; + DPRINTF(("ix_match: found board @ 0x%x\n", ia->ia_iobase)); out: @@ -730,25 +750,25 @@ ix_attach(parent, self, aux) * disable shared memory access if the board is in 16K mode. If * no memory is mapped, we have no choice but to use PIO */ - isc->use_pio = (ia->ia_msize <= (16 * 1024)); + isc->use_pio = (ia->ia_iomem[0].ir_size <= (16 * 1024)); - if (bus_space_map(iot, ia->ia_iobase, - ia->ia_iosize, 0, &ioh) != 0) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &ioh) != 0) { DPRINTF(("\n%s: can't map i/o space 0x%x-0x%x\n", - sc->sc_dev.dv_xname, ia->ia_iobase, - ia->ia_iobase + ia->ia_iosize - 1)); + sc->sc_dev.dv_xname, ia->ia_[0].ir_addr, + ia->ia_io[0].ir_addr + ia->ia_io[0].ir_size - 1)); return; } /* We map memory even if using PIO so something else doesn't grab it */ - if (ia->ia_msize) { - if (bus_space_map(ia->ia_memt, ia->ia_maddr, - ia->ia_msize, 0, &memh) != 0) { + if (ia->ia_iomem[0].ir_size) { + if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, + ia->ia_iomem[0].ir_size, 0, &memh) != 0) { DPRINTF(("\n%s: can't map iomem space 0x%x-0x%x\n", - sc->sc_dev.dv_xname, ia->ia_maddr, - ia->ia_maddr + ia->ia_msize - 1)); - bus_space_unmap(iot, ioh, ia->ia_iosize); + sc->sc_dev.dv_xname, ia->ia_iomem[0].ir_addr, + ia->ia_iomem[0].ir_addr + ia->ia_iomem[0].ir_size - 1)); + bus_space_unmap(iot, ioh, ia->ia_io[0].ir_size); return; } } @@ -885,7 +905,7 @@ ix_attach(parent, self, aux) if (memsize == 0) { DPRINTF(("\n%s: can't determine size of on-card RAM\n", sc->sc_dev.dv_xname)); - bus_space_unmap(iot, ioh, ia->ia_iosize); + bus_space_unmap(iot, ioh, ia->ia_io[0].ir_size); return; } @@ -898,7 +918,7 @@ ix_attach(parent, self, aux) sc->bt = ia->ia_memt; sc->bh = memh; - sc->sc_msize = ia->ia_msize; + sc->sc_msize = ia->ia_iomem[0].ir_size; sc->sc_maddr = (void *)memh; } @@ -949,10 +969,10 @@ ix_attach(parent, self, aux) if (!i82586_proberam(sc)) { DPRINTF(("\n%s: Can't talk to i82586!\n", sc->sc_dev.dv_xname)); - bus_space_unmap(iot, ioh, ia->ia_iosize); + bus_space_unmap(iot, ioh, ia->ia_io[0].ir_size); - if (ia->ia_msize) - bus_space_unmap(ia->ia_memt, memh, ia->ia_msize); + if (ia->ia_iomem[0].ir_size) + bus_space_unmap(ia->ia_memt, memh, ia->ia_iomem[0].ir_size); return; } @@ -983,7 +1003,8 @@ ix_attach(parent, self, aux) irq_encoded | IX_IRQ_ENABLE); /* Flush all writes to registers */ - bus_space_barrier(iot, ioh, 0, ia->ia_iosize, BUS_SPACE_BARRIER_WRITE); + bus_space_barrier(iot, ioh, 0, ia->ia_io[0].ir_size, + BUS_SPACE_BARRIER_WRITE); isc->irq_encoded = irq_encoded; @@ -993,8 +1014,8 @@ ix_attach(parent, self, aux) if (isc->use_pio) printf("%s: unsupported memory config, using PIO to access %d bytes of memory\n", sc->sc_dev.dv_xname, sc->sc_msize); - isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, i82586_intr, sc); + isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, i82586_intr, sc); if (isc->sc_ih == NULL) DPRINTF(("\n%s: can't establish interrupt\n", sc->sc_dev.dv_xname)); diff --git a/sys/dev/isa/if_iy.c b/sys/dev/isa/if_iy.c index 4a5a499960e1..04f8f93e2fa1 100644 --- a/sys/dev/isa/if_iy.c +++ b/sys/dev/isa/if_iy.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_iy.c,v 1.56 2001/11/13 08:01:19 lukem Exp $ */ +/* $NetBSD: if_iy.c,v 1.57 2002/01/07 21:47:08 thorpej Exp $ */ /* #define IYDEBUG */ /* #define IYMEMDEBUG */ @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.56 2001/11/13 08:01:19 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.57 2002/01/07 21:47:08 thorpej Exp $"); #include "opt_inet.h" #include "opt_ns.h" @@ -206,18 +206,25 @@ iyprobe(parent, match, aux) { struct isa_attach_args *ia = aux; u_int16_t eaddr[8]; - bus_space_tag_t iot; bus_space_handle_t ioh; - u_int8_t c, d; + int irq; + + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); iot = ia->ia_iot; - if (ia->ia_iobase == IOBASEUNK) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) return 0; - if (bus_space_map(iot, ia->ia_iobase, 16, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, 16, 0, &ioh)) return 0; /* try to find the round robin sig: */ @@ -261,13 +268,15 @@ iyprobe(parent, match, aux) if (eepromreadall(iot, ioh, eaddr, 8)) goto out; - if (ia->ia_irq == IRQUNK) - ia->ia_irq = eepro_irqmap[eaddr[EEPPW1] & EEPP_Int]; + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) + irq = eepro_irqmap[eaddr[EEPPW1] & EEPP_Int]; + else + irq = ia->ia_irq[0].ir_irq; - if (ia->ia_irq >= sizeof(eepro_revirqmap)) + if (irq >= sizeof(eepro_revirqmap)) goto out; - if (eepro_revirqmap[ia->ia_irq] == 0xff) + if (eepro_revirqmap[irq] == 0xff) goto out; /* now lets reset the chip */ @@ -275,7 +284,14 @@ iyprobe(parent, match, aux) bus_space_write_1(iot, ioh, COMMAND_REG, RESET_CMD); delay(200); - ia->ia_iosize = 16; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = 16; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = irq; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; bus_space_unmap(iot, ioh, 16); return 1; /* found */ @@ -301,7 +317,7 @@ iyattach(parent, self, aux) iot = ia->ia_iot; - if (bus_space_map(iot, ia->ia_iobase, 16, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, 16, 0, &ioh)) { printf(": can't map i/o space\n"); return; } @@ -309,7 +325,7 @@ iyattach(parent, self, aux) sc->sc_iot = iot; sc->sc_ioh = ioh; - sc->mappedirq = eepro_revirqmap[ia->ia_irq]; + sc->mappedirq = eepro_revirqmap[ia->ia_irq[0].ir_irq]; /* now let's reset the chip */ @@ -366,12 +382,12 @@ iyattach(parent, self, aux) sc->hard_vers, sc->sram/1024); eirq = eepro_irqmap[eaddr[EEPPW1] & EEPP_Int]; - if (eirq != ia->ia_irq) + if (eirq != ia->ia_irq[0].ir_irq) printf("%s: EEPROM irq setting %d ignored\n", sc->sc_dev.dv_xname, eirq); - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, iyintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, iyintr, sc); #if NRND > 0 rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname, diff --git a/sys/dev/isa/if_lc_isa.c b/sys/dev/isa/if_lc_isa.c index b5161a3bba52..3488f89d201f 100644 --- a/sys/dev/isa/if_lc_isa.c +++ b/sys/dev/isa/if_lc_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_lc_isa.c,v 1.12 2001/11/13 08:01:20 lukem Exp $ */ +/* $NetBSD: if_lc_isa.c,v 1.13 2002/01/07 21:47:08 thorpej Exp $ */ /*- * Copyright (c) 1994, 1995, 1997 Matt Thomas @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_lc_isa.c,v 1.12 2001/11/13 08:01:20 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_lc_isa.c,v 1.13 2002/01/07 21:47:08 thorpej Exp $"); #include #include @@ -81,26 +81,31 @@ lemac_isa_find(sc, ia, attach) bus_addr_t msize; int rv = 0, irq; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* * Disallow wildcarded i/o addresses. */ - if (ia->ia_iobase == IOBASEUNK) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) return 0; /* * Make sure this is a valid LEMAC address. */ - if (ia->ia_iobase & (LEMAC_IOSIZE - 1)) + if (ia->ia_io[0].ir_addr & (LEMAC_IOSIZE - 1)) return 0; sc->sc_iot = ia->ia_iot; - /* - * Map the LEMAC's port space for the probe sequence. - */ - ia->ia_iosize = LEMAC_IOSIZE; - - if (bus_space_map(sc->sc_iot, ia->ia_iobase, ia->ia_iosize, 0, + if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, LEMAC_IOSIZE, 0, &sc->sc_ioh)) { if (attach) printf(": can't map i/o space\n"); @@ -120,7 +125,8 @@ lemac_isa_find(sc, ia, attach) */ lemac_info_get(sc->sc_iot, sc->sc_ioh, &maddr, &msize, &irq); - if (ia->ia_maddr != maddr && ia->ia_maddr != MADDRUNK) + if (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT && + ia->ia_iomem[0].ir_addr != maddr) goto outio; sc->sc_memt = ia->ia_memt; @@ -134,9 +140,10 @@ lemac_isa_find(sc, ia, attach) /* * Double-check IRQ configuration. */ - if (ia->ia_irq != irq && ia->ia_irq != IRQUNK) + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != irq) printf("%s: overriding IRQ %d to %d\n", sc->sc_dv.dv_xname, - ia->ia_irq, irq); + ia->ia_irq[0].ir_irq, irq); if (attach) { sc->sc_ats = shutdownhook_establish(lemac_shutdown, sc); @@ -155,9 +162,17 @@ lemac_isa_find(sc, ia, attach) */ rv = 1; - ia->ia_maddr = maddr; - ia->ia_msize = msize; - ia->ia_irq = irq; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = LEMAC_IOSIZE; + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_addr = maddr; + ia->ia_iomem[0].ir_size = msize; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = irq; + + ia->ia_ndrq = 0; if (rv == 0 || !attach) bus_space_unmap(sc->sc_memt, sc->sc_memh, msize); diff --git a/sys/dev/isa/if_le_isa.c b/sys/dev/isa/if_le_isa.c index 32956d869296..4ce8a8a2c407 100644 --- a/sys/dev/isa/if_le_isa.c +++ b/sys/dev/isa/if_le_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_isa.c,v 1.28 2001/11/13 08:01:20 lukem Exp $ */ +/* $NetBSD: if_le_isa.c,v 1.29 2002/01/07 21:47:08 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_le_isa.c,v 1.28 2001/11/13 08:01:20 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_le_isa.c,v 1.29 2002/01/07 21:47:08 thorpej Exp $"); #include #include @@ -219,12 +219,26 @@ lance_isa_probe(ia, p) int rap, rdp; int rv = 0; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) + return (0); + if (ia->ia_drq[0].ir_drq == ISACF_DRQ_DEFAULT) return (0); /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, p->iosize, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, p->iosize, 0, &ioh)) return (0); rap = p->rap; @@ -242,7 +256,14 @@ lance_isa_probe(ia, p) bus_space_write_2(iot, ioh, rap, LE_CSR3); bus_space_write_2(iot, ioh, rdp, 0); - ia->ia_iosize = p->iosize; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = p->iosize; + + ia->ia_nirq = 1; + ia->ia_ndrq = 1; + + ia->ia_niomem = 0; + rv = 1; bad: @@ -301,7 +322,7 @@ le_isa_attach(parent, lesc, ia, p) printf(": %s Ethernet\n", p->name); - if (bus_space_map(iot, ia->ia_iobase, p->iosize, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_size, p->iosize, 0, &ioh)) panic("%s: can't map io", sc->sc_dev.dv_xname); /* @@ -366,16 +387,14 @@ le_isa_attach(parent, lesc, ia, p) sc->sc_wrcsr = le_isa_wrcsr; sc->sc_hwinit = NULL; - if (ia->ia_drq != DRQUNK) { - if ((error = isa_dmacascade(ia->ia_ic, ia->ia_drq)) != 0) { - printf("%s: unable to cascade DRQ, error = %d\n", - sc->sc_dev.dv_xname, error); - return; - } + if ((error = isa_dmacascade(ia->ia_ic, ia->ia_drq[0].ir_drq)) != 0) { + printf("%s: unable to cascade DRQ, error = %d\n", + sc->sc_dev.dv_xname, error); + return; } - lesc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, le_isa_intredge, sc); + lesc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, le_isa_intredge, sc); printf("%s", sc->sc_dev.dv_xname); am7990_config(&lesc->sc_am7990); diff --git a/sys/dev/isa/if_ne_isa.c b/sys/dev/isa/if_ne_isa.c index ade26975017d..8dc6da2cccca 100644 --- a/sys/dev/isa/if_ne_isa.c +++ b/sys/dev/isa/if_ne_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ne_isa.c,v 1.12 2001/11/13 08:01:20 lukem Exp $ */ +/* $NetBSD: if_ne_isa.c,v 1.13 2002/01/07 21:47:08 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ne_isa.c,v 1.12 2001/11/13 08:01:20 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ne_isa.c,v 1.13 2002/01/07 21:47:08 thorpej Exp $"); #include #include @@ -96,18 +96,26 @@ ne_isa_match(parent, match, aux) bus_space_handle_t asich; int rv = 0; - /* Disallow wildcarded values. */ - if (ia->ia_irq == ISACF_IRQ_DEFAULT) + if (ia->ia_nio < 1) return (0); - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + /* Disallow wildcarded values. */ + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return (0); /* Make sure this is a valid NE[12]000 i/o address. */ - if ((ia->ia_iobase & 0x1f) != 0) + if ((ia->ia_io[0].ir_addr & 0x1f) != 0) return (0); /* Map i/o space. */ - if (bus_space_map(nict, ia->ia_iobase, NE2000_NPORTS, 0, &nich)) + if (bus_space_map(nict, ia->ia_io[0].ir_addr, NE2000_NPORTS, 0, &nich)) return (0); asict = nict; @@ -118,8 +126,15 @@ ne_isa_match(parent, match, aux) /* Look for an NE2000-compatible card. */ rv = ne2000_detect(nict, nich, asict, asich); - if (rv) - ia->ia_iosize = NE2000_NPORTS; + if (rv) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = NE2000_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + } out: bus_space_unmap(nict, nich, NE2000_NPORTS); @@ -145,7 +160,8 @@ ne_isa_attach(parent, self, aux) printf("\n"); /* Map i/o space. */ - if (bus_space_map(nict, ia->ia_iobase, NE2000_NPORTS, 0, &nich)) { + if (bus_space_map(nict, ia->ia_io[0].ir_addr, NE2000_NPORTS, + 0, &nich)) { printf("%s: can't map i/o space\n", dsc->sc_dev.dv_xname); return; } @@ -208,8 +224,8 @@ ne_isa_attach(parent, self, aux) ne2000_attach(nsc, NULL); /* Establish the interrupt handler. */ - isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, dp8390_intr, dsc); + isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, dp8390_intr, dsc); if (isc->sc_ih == NULL) printf("%s: couldn't establish interrupt handler\n", dsc->sc_dev.dv_xname); diff --git a/sys/dev/isa/if_ntwoc_isa.c b/sys/dev/isa/if_ntwoc_isa.c index a2d50430ef85..670113e2c82e 100644 --- a/sys/dev/isa/if_ntwoc_isa.c +++ b/sys/dev/isa/if_ntwoc_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ntwoc_isa.c,v 1.2 2001/11/13 08:01:20 lukem Exp $ */ +/* $NetBSD: if_ntwoc_isa.c,v 1.3 2002/01/07 21:47:09 thorpej Exp $ */ /* * Copyright (c) 1999 Christian E. Hopps * Copyright (c) 1996 John Hay. @@ -29,11 +29,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ntwoc_isa.c,v 1.2 2001/11/13 08:01:20 lukem Exp $ + * $Id: if_ntwoc_isa.c,v 1.3 2002/01/07 21:47:09 thorpej Exp $ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ntwoc_isa.c,v 1.2 2001/11/13 08:01:20 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ntwoc_isa.c,v 1.3 2002/01/07 21:47:09 thorpej Exp $"); #include #include @@ -200,22 +200,32 @@ ntwoc_isa_probe(struct device *parent, struct cfdata *match, void *aux) iot = ia->ia_iot; memt = ia->ia_memt; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + memset(gotsca, 0, sizeof(gotsca)); gotmem = rv = 0; dbg = 0; /* disallow wildcarded I/O base */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) { + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) { printf("ntwoc_isa_probe: must specify port address\n"); return (0); } - if (ia->ia_irq == ISACF_IRQ_DEFAULT) { + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) { printf("ntwoc_isa_probe: must specify irq\n"); return (0); } - if (ia->ia_maddr == ISACF_IOMEM_DEFAULT) { + if (ia->ia_iomem[0].ir_addr == ISACF_IOMEM_DEFAULT) { printf("ntwoc_isa_probe: must specify iomem\n"); return (0); } @@ -227,14 +237,14 @@ ntwoc_isa_probe(struct device *parent, struct cfdata *match, void *aux) } /* map the isa io addresses */ - if ((tmp = bus_space_map(iot, ia->ia_iobase, NTWOC_SRC_IOPORT_SIZE, 0, - &ioh))) { + if ((tmp = bus_space_map(iot, ia->ia_io[0].ir_addr, + NTWOC_SRC_IOPORT_SIZE, 0, &ioh))) { printf("ntwoc_isa_probe: mapping port 0x%x sz %d failed: %d\n", - ia->ia_iobase, NTWOC_SRC_IOPORT_SIZE, tmp); + ia->ia_io[0].ir_addr, NTWOC_SRC_IOPORT_SIZE, tmp); return (0); } - ioport = ia->ia_iobase + 0x8000; + ioport = ia->ia_io[0].ir_addr + 0x8000; for (i = 0; i < 16; ioport += (0x10 << 6), i++) { /* map the isa io addresses */ if ((tmp = bus_space_map(iot, ioport, 16, 0, &sca_ioh[i]))) { @@ -248,10 +258,10 @@ ntwoc_isa_probe(struct device *parent, struct cfdata *match, void *aux) /* map the isa memory addresses */ /* XXX we really want the user to select this */ - if ((tmp = bus_space_map(ia->ia_memt, ia->ia_maddr, NTWOC_WIN_SIZE, 0, - &memh))) { + if ((tmp = bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, + NTWOC_WIN_SIZE, 0, &memh))) { printf("ntwoc_isa_probe: mapping mem 0x%x sz %d failed: %d\n", - ia->ia_maddr, NTWOC_WIN_SIZE, tmp); + ia->ia_iomem[0].ir_addr, NTWOC_WIN_SIZE, tmp); goto out; } gotmem = 1; @@ -343,8 +353,16 @@ ntwoc_isa_probe(struct device *parent, struct cfdata *match, void *aux) goto out; } - ia->ia_iosize = NTWOC_SRC_IOPORT_SIZE; - ia->ia_msize = NTWOC_WIN_SIZE; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = NTWOC_SRC_IOPORT_SIZE; + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_size = NTWOC_WIN_SIZE; + + ia->ia_nirq = 1; + + ia->ia_ndrq = 0; + rv = 1; out: /* turn off the card */ @@ -400,16 +418,16 @@ ntwoc_isa_attach(struct device *parent, struct device *self, void *aux) /* map the io */ sca->sc_iot = ia->ia_iot; - if ((rv = bus_space_map(ia->ia_iot, ia->ia_iobase, + if ((rv = bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, NTWOC_SRC_IOPORT_SIZE, 0, &sca->sc_ioh))) { printf("%s: can't map io 0x%x sz %d, %d\n", - sc->sc_dev.dv_xname, ia->ia_iobase, NTWOC_SRC_IOPORT_SIZE, - rv); + sc->sc_dev.dv_xname, ia->ia_io[0].ir_addr, + NTWOC_SRC_IOPORT_SIZE, rv); return; } /* support weird mapping (they used this to avoid 10-bit aliasing) */ - ioport = ia->ia_iobase + 0x8000; + ioport = ia->ia_io[0].ir_addr + 0x8000; for (i = 0; i < 16; ioport += (0x10 << 6), i++) { /* map the isa io addresses */ if ((tmp = bus_space_map(ia->ia_iot, ioport, 16, 0, @@ -444,10 +462,11 @@ ntwoc_isa_attach(struct device *parent, struct device *self, void *aux) tmp = NTWOC_PSR_WIN_128K; } sca->scu_pagemask = sca->scu_pagesize - 1; - if ((rv = bus_space_map(ia->ia_memt, ia->ia_maddr, sca->scu_pagesize, 0, - &sca->scu_memh))) { + if ((rv = bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, + sca->scu_pagesize, 0, &sca->scu_memh))) { printf("%s: can't map mem 0x%x sz %ld, %d\n", - sc->sc_dev.dv_xname, ia->ia_maddr, sca->scu_pagesize, rv); + sc->sc_dev.dv_xname, ia->ia_iomem[0].ir_addr, + sca->scu_pagesize, rv); return; } @@ -476,12 +495,12 @@ ntwoc_isa_attach(struct device *parent, struct device *self, void *aux) /* program the card with the io address */ bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR, - ((ia->ia_maddr >> 16) & NTWOC_PCR_16M_SEL) + ((ia->ia_iomem[0].ir_addr >> 16) & NTWOC_PCR_16M_SEL) | (bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR) & ~NTWOC_PCR_16M_SEL)); bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_BAR, - (ia->ia_maddr >> 12)); + (ia->ia_iomem[0].ir_addr >> 12)); /* enable the memory window */ ntwoc_isa_set_on(sca); @@ -524,8 +543,8 @@ ntwoc_isa_attach(struct device *parent, struct device *self, void *aux) #if 0 printf("%s: sca port 0x%x-0x%x dpram %ldk %d serial port%s\n", - sc->sc_dev.dv_xname, ia->ia_iobase | 0x8000, - (ia->ia_iobase | 0x8000) + NTWOC_SRC_ASIC_SIZE - 1, + sc->sc_dev.dv_xname, ia->ia_io[0].ir_addr | 0x8000, + (ia->ia_io[0].ir_addr | 0x8000) + NTWOC_SRC_ASIC_SIZE - 1, pgs * (sca->scu_pagesize / 1024), sca->sc_numports, (sca->sc_numports > 1 ? "s" : "")); #else @@ -543,8 +562,8 @@ ntwoc_isa_attach(struct device *parent, struct device *self, void *aux) | NTWOC_PSR_EN_SCA_DMA); /* now establish our irq -- perhaps sanity check the value */ - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, ntwoc_isa_intr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, ntwoc_isa_intr, sc); if (sc->sc_ih == NULL) { printf("%s: can't establish interrupt\n", sc->sc_dev.dv_xname); diff --git a/sys/dev/isa/if_sm_isa.c b/sys/dev/isa/if_sm_isa.c index 068b7b1db434..265aa9d1e19d 100644 --- a/sys/dev/isa/if_sm_isa.c +++ b/sys/dev/isa/if_sm_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_sm_isa.c,v 1.8 2001/11/13 08:01:20 lukem Exp $ */ +/* $NetBSD: if_sm_isa.c,v 1.9 2002/01/07 21:47:09 thorpej Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_sm_isa.c,v 1.8 2001/11/13 08:01:20 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_sm_isa.c,v 1.9 2002/01/07 21:47:09 thorpej Exp $"); #include #include @@ -93,14 +93,22 @@ sm_isa_match(parent, match, aux) int rv = 0; extern const char *smc91cxx_idstrs[]; - /* Disallow wildcarded values. */ - if (ia->ia_irq == -1) + if (ia->ia_nio < 1) return (0); - if (ia->ia_iobase == -1) + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + /* Disallow wildcarded values. */ + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return (0); /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, SMC_IOSIZE, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, SMC_IOSIZE, 0, &ioh)) return (0); /* Check that high byte of BANK_SELECT is what we expect. */ @@ -123,7 +131,7 @@ sm_isa_match(parent, match, aux) */ bus_space_write_2(iot, ioh, BANK_SELECT_REG_W, 1); tmp = bus_space_read_2(iot, ioh, BASE_ADDR_REG_W); - if (ia->ia_iobase != ((tmp >> 3) & 0x3e0)) + if (ia->ia_io[0].ir_addr != ((tmp >> 3) & 0x3e0)) goto out; /* @@ -138,7 +146,14 @@ sm_isa_match(parent, match, aux) /* * Assume we have an SMC91Cxx. */ - ia->ia_iosize = SMC_IOSIZE; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = SMC_IOSIZE; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + rv = 1; out: @@ -160,7 +175,7 @@ sm_isa_attach(parent, self, aux) printf("\n"); /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, SMC_IOSIZE, 0, &ioh)) panic("sm_isa_attach: can't map i/o space"); sc->sc_bst = iot; @@ -175,8 +190,8 @@ sm_isa_attach(parent, self, aux) smc91cxx_attach(sc, NULL); /* Establish the interrupt handler. */ - isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, smc91cxx_intr, sc); + isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, smc91cxx_intr, sc); if (isc->sc_ih == NULL) printf("%s: couldn't establish interrupt handler\n", sc->sc_dev.dv_xname); diff --git a/sys/dev/isa/if_tr_isa.c b/sys/dev/isa/if_tr_isa.c index 6e44d842e42d..b1802c045196 100644 --- a/sys/dev/isa/if_tr_isa.c +++ b/sys/dev/isa/if_tr_isa.c @@ -1,4 +1,6 @@ -/* $NetBSD: if_tr_isa.c,v 1.7 2001/11/13 08:01:21 lukem Exp $ */ +/* $NetBSD: if_tr_isa.c,v 1.8 2002/01/07 21:47:09 thorpej Exp $ */ + +/* XXXJRT changes isa_attach_args too early!! */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -37,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_tr_isa.c,v 1.7 2001/11/13 08:01:21 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tr_isa.c,v 1.8 2002/01/07 21:47:09 thorpej Exp $"); #undef TRISADEBUG @@ -95,7 +97,8 @@ bus_space_handle_t *pioh, *mmioh; bus_size_t mmio; u_int8_t s; - if (bus_space_map(ia->ia_iot, ia->ia_iobase, ia->ia_iosize, 0, pioh)) { + if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, pioh)) { printf("tr_isa_map_io: can't map PIO ports\n"); return 1; } @@ -105,7 +108,7 @@ bus_space_handle_t *pioh, *mmioh; if ((s & 0xfc) < ((TR_MMIO_MINADDR - TR_MMIO_OFFSET) >> 11) || (s & 0xfc) > ((TR_MMIO_MAXADDR - TR_MMIO_OFFSET) >> 11)) { - bus_space_unmap(ia->ia_iot, *pioh, ia->ia_iosize); + bus_space_unmap(ia->ia_iot, *pioh, ia->ia_io[0].ir_size); return 1; } @@ -113,7 +116,7 @@ bus_space_handle_t *pioh, *mmioh; if (bus_space_map(ia->ia_memt, mmio, TR_MMIO_SIZE, 0, mmioh)) { printf("tr_isa_map_io: can't map MMIO region 0x%05lx/%d\n", mmio, TR_MMIO_SIZE); - bus_space_unmap(ia->ia_iot, *pioh, ia->ia_iosize); + bus_space_unmap(ia->ia_iot, *pioh, ia->ia_io[0].ir_size); return 1; } return 0; @@ -125,7 +128,7 @@ struct isa_attach_args *ia; bus_space_handle_t pioh, mmioh; { bus_space_unmap(ia->ia_memt, mmioh, TR_MMIO_SIZE); - bus_space_unmap(ia->ia_iot, pioh, ia->ia_iosize); + bus_space_unmap(ia->ia_iot, pioh, ia->ia_io[0].ir_size); } static u_char tr_isa_id[] = { @@ -149,6 +152,16 @@ tr_isa_probe(parent, match, aux) int probecode; int matched = 0; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + for (i = 0; tr_isa_probe_list[i] != 0; i++) { probecode = tr_isa_probe_list[i](parent, match, aux); if (probecode < 0) @@ -175,11 +188,19 @@ tr_isa_probe(parent, match, aux) if (!matched) { return 0; } - if (bus_space_map(ia->ia_memt, ia->ia_maddr, ia->ia_msize, 0, &sramh)) { + if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, + ia->ia_iomem[0].ir_size, 0, &sramh)) { printf("tr_isa_probe: can't map shared ram\n"); return 0; } - bus_space_unmap(ia->ia_memt, sramh, ia->ia_msize); + bus_space_unmap(ia->ia_memt, sramh, ia->ia_iomem[0].ir_size); + + ia->ia_nio = 1; + ia->ia_niomem = 1; + ia->ia_nirq = 1; + + ia->ia_ndrq = 0; + return 1; } @@ -201,15 +222,15 @@ tr_isa_attach(parent, self, aux) printf("tr_isa_attach: IO space vanished\n"); return; } - if (bus_space_map(sc->sc_memt, ia->ia_maddr, ia->ia_msize, 0, - &sc->sc_sramh)) { + if (bus_space_map(sc->sc_memt, ia->ia_iomem[0].ir_addr, + ia->ia_iomem[0].ir_size, 0, &sc->sc_sramh)) { printf("tr_isa_attach: shared ram space vanished\n"); return; } /* set ACA offset */ sc->sc_aca = TR_ACA_OFFSET; - sc->sc_memwinsz = ia->ia_msize; - sc->sc_maddr = ia->ia_maddr; + sc->sc_memwinsz = ia->ia_iomem[0].ir_size; + sc->sc_maddr = ia->ia_iomem[0].ir_addr; /* * Determine total RAM on adapter and decide how much to use. * XXX Since we don't use RAM paging, use sc_memwinsz for now. @@ -235,8 +256,8 @@ tr_isa_attach(parent, self, aux) /* * XXX 3Com 619 can use LEVEL intr */ - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, tr_intr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, tr_intr, sc); } #ifdef TRISADEBUG diff --git a/sys/dev/isa/if_tribm_isa.c b/sys/dev/isa/if_tribm_isa.c index 9e78858dc2dc..5d336e3e0cb0 100644 --- a/sys/dev/isa/if_tribm_isa.c +++ b/sys/dev/isa/if_tribm_isa.c @@ -1,4 +1,6 @@ -/* $NetBSD: if_tribm_isa.c,v 1.3 2001/11/13 08:01:21 lukem Exp $ */ +/* $NetBSD: if_tribm_isa.c,v 1.4 2002/01/07 21:47:09 thorpej Exp $ */ + +/* XXXJRT changes isa_attach_args too early */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -37,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_tribm_isa.c,v 1.3 2001/11/13 08:01:21 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tribm_isa.c,v 1.4 2002/01/07 21:47:09 thorpej Exp $"); #include #include @@ -76,16 +78,30 @@ tribm_isa_probe(parent, match, aux) int i, irq; u_int8_t s; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + #ifdef notyet /* XXX Try both 0xa20 and 0xa24 and store that info like 3com */ if (ia->ia_iobase == IOBASEUNK) ia->ia_iobase = 0xa20; #else - if (ia->ia_iobase == IOBASEUNK) - return 0; + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); #endif - ia->ia_iosize = 4; + /* + * XXXJRT Should not modify attach_args unless we know we match! + */ + + ia->ia_io[0].ir_size = 4; ia->ia_aux = NULL; if (tr_isa_map_io(ia, &pioh, &mmioh)) @@ -109,7 +125,7 @@ tribm_isa_probe(parent, match, aux) case 0xF: case 0xE: case 0xD: - if (ia->ia_maddr == MADDRUNK) + if (ia->ia_iomem[0].ir_addr == ISACF_IOMEM_DEFAULT) #ifdef notyet ia->ia_maddr = TR_SRAM_DEFAULT; #else @@ -118,12 +134,12 @@ tribm_isa_probe(parent, match, aux) break; case 0xC: i = bus_space_read_1(memt, mmioh, TR_ACA_OFFSET) << 12; - if (ia->ia_maddr == MADDRUNK) - ia->ia_maddr = i; - else if (ia->ia_maddr != i) { + if (ia->ia_iomem[0].ir_addr == ISACF_IOMEM_DEFAULT) + ia->ia_iomem[0].ir_addr = i; + else if (ia->ia_iomem[0].ir_addr != i) { printf( "tribm_isa_probe: sram mismatch; kernel configured %x != board configured %x\n", - ia->ia_maddr, i); + ia->ia_iomem[0].ir_addr, i); tr_isa_unmap_io(ia, pioh, mmioh); return 0; } @@ -151,26 +167,33 @@ tribm_isa_probe(parent, match, aux) return 0; } - if (ia->ia_irq == IRQUNK) - ia->ia_irq = irq; - else if (ia->ia_irq != irq) { + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) + ia->ia_irq[0].ir_irq = irq; + else if (ia->ia_irq[0].ir_irq != irq) { printf( "tribm_isa_probe: irq mismatch; kernel configured %d != board configured %d\n", - ia->ia_irq, irq); + ia->ia_irq[0].ir_irq, irq); tr_isa_unmap_io(ia, pioh, mmioh); return 0; } /* * XXX 0x0c == MSIZEMASK (MSIZEBITS) */ - ia->ia_msize = 8192 << + ia->ia_iomem[0].ir_size = 8192 << ((bus_space_read_1(memt, mmioh, TR_ACA_OFFSET + 1) & 0x0c) >> 2); tr_isa_unmap_io(ia, pioh, mmioh); /* Check alignment of membase. */ - if ((ia->ia_maddr & (ia->ia_msize-1)) != 0) { + if ((ia->ia_iomem[0].ir_addr & (ia->ia_iomem[0].ir_size-1)) != 0) { printf("tribm_isa_probe: SRAM unaligned 0x%04x/%d\n", - ia->ia_maddr, ia->ia_msize); + ia->ia_iomem[0].ir_addr, ia->ia_iomem[0].ir_size); return 0; } + + ia->ia_nio = 1; + ia->ia_niomem = 1; + ia->ia_nirq = 1; + + ia->ia_ndrq = 0; + return 1; } diff --git a/sys/dev/isa/if_trtcm_isa.c b/sys/dev/isa/if_trtcm_isa.c index e44915ebe887..21b019b38357 100644 --- a/sys/dev/isa/if_trtcm_isa.c +++ b/sys/dev/isa/if_trtcm_isa.c @@ -1,4 +1,6 @@ -/* $NetBSD: if_trtcm_isa.c,v 1.4 2001/11/13 08:01:21 lukem Exp $ */ +/* $NetBSD: if_trtcm_isa.c,v 1.5 2002/01/07 21:47:09 thorpej Exp $ */ + +/* XXXJRT verify doens't change isa_attach_args too early */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -37,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_trtcm_isa.c,v 1.4 2001/11/13 08:01:21 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_trtcm_isa.c,v 1.5 2002/01/07 21:47:09 thorpej Exp $"); #undef TRTCMISADEBUG @@ -221,6 +223,9 @@ trtcm_isa_probe(parent, match, aux) struct tcm_isa_done_probe *tcm; static int irqs[] = { 7, 15, 6, 11, 3, 10, 9, 5 }; + if (ISA_DIRECT_CONFIG(ia)) + return (0); + if (tcm_isa_probes_initialized == 0) { LIST_INIT(&tcm_isa_all_probes); tcm_isa_probes_initialized = 1; @@ -329,16 +334,23 @@ trtcm_isa_probe(parent, match, aux) bus_probed: + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + for (i = 0; i < ntcmcards; i++) { if (tcmcards[i].bus != bus) continue; if (tcmcards[i].available == 0) continue; - if (ia->ia_iobase != IOBASEUNK && - ia->ia_iobase != tcmcards[i].iobase) + if (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT && + ia->ia_io[0].ir_addr != tcmcards[i].iobase) continue; - if (ia->ia_irq != IRQUNK && - ia->ia_irq != tcmcards[i].irq) + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != tcmcards[i].irq) continue; goto good; } @@ -348,15 +360,24 @@ good: tcmcards[i].available = 0; if (tcmcards[i].pnpmode) return -1; /* XXX Don't actually probe this card. */ - ia->ia_iobase = tcmcards[i].iobase; - ia->ia_irq = tcmcards[i].irq; + + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = tcmcards[i].iobase; /* XXX probably right, but ...... */ - if (ia->ia_iobase == 0xa20 || ia->ia_iobase == 0x0a24) - ia->ia_iosize = 4; + if (ia->ia_io[0].ir_addr == 0xa20 || ia->ia_io[0].ir_addr == 0xa24) + ia->ia_io[0].ir_size = 4; else - ia->ia_iosize = 16; - ia->ia_maddr = tcmcards[i].maddr; - ia->ia_msize = tcmcards[i].msize; + ia->ia_io[0].ir_size = 16; + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_addr = tcmcards[i].maddr; + ia->ia_iomem[0].ir_size = tcmcards[i].msize; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = tcmcards[i].irq; + + ia->ia_ndrq = 0; + ia->ia_aux = (void *) tcmcards[i].model; return 1; } diff --git a/sys/dev/isa/if_we_isa.c b/sys/dev/isa/if_we_isa.c index 4288a934db6a..9879d953d311 100644 --- a/sys/dev/isa/if_we_isa.c +++ b/sys/dev/isa/if_we_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_we_isa.c,v 1.4 2001/11/13 08:01:21 lukem Exp $ */ +/* $NetBSD: if_we_isa.c,v 1.5 2002/01/07 21:47:09 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -56,7 +56,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_we_isa.c,v 1.4 2001/11/13 08:01:21 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_we_isa.c,v 1.5 2002/01/07 21:47:09 thorpej Exp $"); #include #include @@ -108,7 +108,7 @@ static const int we_584_irq[] = { #define NWE_584_IRQ (sizeof(we_584_irq) / sizeof(we_584_irq[0])) static const int we_790_irq[] = { - IRQUNK, 9, 3, 5, 7, 10, 11, 15, + ISACF_IRQ_DEFAULT, 9, 3, 5, 7, 10, 11, 15, }; #define NWE_790_IRQ (sizeof(we_790_irq) / sizeof(we_790_irq[0])) @@ -162,16 +162,26 @@ we_isa_probe(parent, cf, aux) asich_valid = memh_valid = 0; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o addresses. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) return (0); /* Disallow wildcarded mem address. */ - if (ia->ia_maddr == ISACF_IOMEM_DEFAULT) + if (ia->ia_iomem[0].ir_addr == ISACF_IOMEM_DEFAULT) return (0); /* Attempt to map the device. */ - if (bus_space_map(asict, ia->ia_iobase, WE_NPORTS, 0, &asich)) + if (bus_space_map(asict, ia->ia_io[0].ir_addr, WE_NPORTS, 0, &asich)) goto out; asich_valid = 1; @@ -223,11 +233,11 @@ we_isa_probe(parent, cf, aux) goto out; /* Allow user to override probed value. */ - if (ia->ia_msize) - memsize = ia->ia_msize; + if (ia->ia_iomem[0].ir_size) + memsize = ia->ia_iomem[0].ir_size; /* Attempt to map the memory space. */ - if (bus_space_map(memt, ia->ia_maddr, memsize, 0, &memh)) + if (bus_space_map(memt, ia->ia_iomem[0].ir_addr, memsize, 0, &memh)) goto out; memh_valid = 1; @@ -249,27 +259,37 @@ we_isa_probe(parent, cf, aux) bus_space_write_1(asict, asich, WE790_HWR, hwr & ~WE790_HWR_SWH); - if (ia->ia_irq != IRQUNK && ia->ia_irq != we_790_irq[i]) - printf("%s%d: overriding IRQ %d to %d\n", - we_cd.cd_name, cf->cf_unit, ia->ia_irq, + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != we_790_irq[i]) + printf("%s%d: overriding configured IRQ %d to %d\n", + we_cd.cd_name, cf->cf_unit, ia->ia_irq[0].ir_irq, we_790_irq[i]); - ia->ia_irq = we_790_irq[i]; + ia->ia_irq[0].ir_irq = we_790_irq[i]; } else if (type & WE_SOFTCONFIG) { /* Assemble together the encoded interrupt number. */ i = (bus_space_read_1(asict, asich, WE_ICR) & WE_ICR_IR2) | ((bus_space_read_1(asict, asich, WE_IRR) & (WE_IRR_IR0 | WE_IRR_IR1)) >> 5); - if (ia->ia_irq != IRQUNK && ia->ia_irq != we_584_irq[i]) - printf("%s%d: overriding IRQ %d to %d\n", - we_cd.cd_name, cf->cf_unit, ia->ia_irq, + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != we_584_irq[i]) + printf("%s%d: overriding configured IRQ %d to %d\n", + we_cd.cd_name, cf->cf_unit, ia->ia_irq[0].ir_irq, we_584_irq[i]); - ia->ia_irq = we_584_irq[i]; + ia->ia_irq[0].ir_irq = we_584_irq[i]; } /* So, we say we've found it! */ - ia->ia_iosize = WE_NPORTS; - ia->ia_msize = memsize; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = WE_NPORTS; + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_size = memsize; + + ia->ia_nirq = 1; + + ia->ia_ndrq = 0; + rv = 1; out: @@ -298,7 +318,7 @@ we_isa_attach(parent, self, aux) memt = ia->ia_memt; /* Map the device. */ - if (bus_space_map(asict, ia->ia_iobase, WE_NPORTS, 0, &asich)) { + if (bus_space_map(asict, ia->ia_io[0].ir_addr, WE_NPORTS, 0, &asich)) { printf("%s: can't map nic i/o space\n", sc->sc_dev.dv_xname); return; @@ -322,7 +342,8 @@ we_isa_attach(parent, self, aux) * Map memory space. Note we use the size that might have * been overridden by the user. */ - if (bus_space_map(memt, ia->ia_maddr, ia->ia_msize, 0, &memh)) { + if (bus_space_map(memt, ia->ia_iomem[0].ir_addr, + ia->ia_iomem[0].ir_size, 0, &memh)) { printf("%s: can't map shared memory\n", sc->sc_dev.dv_xname); return; @@ -337,8 +358,8 @@ we_isa_attach(parent, self, aux) sc->sc_buft = memt; sc->sc_bufh = memh; - wsc->sc_maddr = ia->ia_maddr; - sc->mem_size = ia->ia_msize; + wsc->sc_maddr = ia->ia_iomem[0].ir_addr; + sc->mem_size = ia->ia_iomem[0].ir_size; /* Interface is always enabled. */ sc->sc_enabled = 1; @@ -356,15 +377,15 @@ we_isa_attach(parent, self, aux) else if (wsc->sc_type & WE_SOFTCONFIG) bus_space_write_1(asict, asich, WE_IRR, bus_space_read_1(asict, asich, WE_IRR) | WE_IRR_IEN); - else if (ia->ia_irq == IRQUNK) { + else if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) { printf("%s: can't wildcard IRQ on a %s\n", sc->sc_dev.dv_xname, typestr); return; } /* Establish interrupt handler. */ - wsc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_NET, dp8390_intr, sc); + wsc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_NET, dp8390_intr, sc); if (wsc->sc_ih == NULL) printf("%s: can't establish interrupt\n", sc->sc_dev.dv_xname); } diff --git a/sys/dev/isa/isa.c b/sys/dev/isa/isa.c index 4dbae9ba0d08..c348f15a9c0f 100644 --- a/sys/dev/isa/isa.c +++ b/sys/dev/isa/isa.c @@ -1,11 +1,11 @@ -/* $NetBSD: isa.c,v 1.109 2001/11/13 08:01:21 lukem Exp $ */ +/* $NetBSD: isa.c,v 1.110 2002/01/07 21:47:09 thorpej Exp $ */ /*- - * Copyright (c) 1998 The NetBSD Foundation, Inc. + * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation - * by Charles M. Hannum. + * by Charles M. Hannum; by Jason R. Thorpe of Wasabi Systems, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isa.c,v 1.109 2001/11/13 08:01:21 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isa.c,v 1.110 2002/01/07 21:47:09 thorpej Exp $"); #include #include @@ -59,21 +59,22 @@ __KERNEL_RCSID(0, "$NetBSD: isa.c,v 1.109 2001/11/13 08:01:21 lukem Exp $"); #include #endif -int isamatch __P((struct device *, struct cfdata *, void *)); -void isaattach __P((struct device *, struct device *, void *)); -int isaprint __P((void *, const char *)); +int isamatch(struct device *, struct cfdata *, void *); +void isaattach(struct device *, struct device *, void *); +int isaprint(void *, const char *); struct cfattach isa_ca = { sizeof(struct isa_softc), isamatch, isaattach }; -int isasearch __P((struct device *, struct cfdata *, void *)); +void isa_attach_knowndevs(struct isa_softc *); +void isa_free_knowndevs(struct isa_softc *); + +int isasubmatch(struct device *, struct cfdata *, void *); +int isasearch(struct device *, struct cfdata *, void *); int -isamatch(parent, cf, aux) - struct device *parent; - struct cfdata *cf; - void *aux; +isamatch(struct device *parent, struct cfdata *cf, void *aux) { struct isabus_attach_args *iba = aux; @@ -86,16 +87,19 @@ isamatch(parent, cf, aux) } void -isaattach(parent, self, aux) - struct device *parent, *self; - void *aux; +isaattach(struct device *parent, struct device *self, void *aux) { struct isa_softc *sc = (struct isa_softc *)self; struct isabus_attach_args *iba = aux; + TAILQ_INIT(&sc->sc_knowndevs); + sc->sc_dynamicdevs = 0; + isa_attach_hook(parent, self, iba); printf("\n"); + /* XXX Add code to fetch known-devices. */ + sc->sc_iot = iba->iba_iot; sc->sc_memt = iba->iba_memt; sc->sc_dmat = iba->iba_dmat; @@ -115,55 +119,264 @@ isaattach(parent, self, aux) isa_dmainit(sc->sc_ic, sc->sc_iot, sc->sc_dmat, self); #endif + /* Attach all direct-config children. */ + isa_attach_knowndevs(sc); + + /* + * If we don't support dynamic hello/goodbye of devices, + * then free the knowndevs info now. + */ + if (sc->sc_dynamicdevs == 0) + isa_free_knowndevs(sc); + + /* Attach all indrect-config children. */ config_search(isasearch, self, NULL); } +void +isa_attach_knowndevs(struct isa_softc *sc) +{ + struct isa_attach_args ia; + struct isa_knowndev *ik; + + if (TAILQ_EMPTY(&sc->sc_knowndevs)) + return; + + TAILQ_FOREACH(ik, &sc->sc_knowndevs, ik_list) { + if (ik->ik_claimed != NULL) + continue; + + ia.ia_iot = sc->sc_iot; + ia.ia_memt = sc->sc_memt; + ia.ia_dmat = sc->sc_dmat; + ia.ia_ic = sc->sc_ic; + + ia.ia_pnpname = ik->ik_pnpname; + ia.ia_pnpcompatnames = ik->ik_pnpcompatnames; + + ia.ia_io = ik->ik_io; + ia.ia_nio = ik->ik_nio; + + ia.ia_iomem = ik->ik_iomem; + ia.ia_niomem = ik->ik_niomem; + + ia.ia_irq = ik->ik_irq; + ia.ia_nirq = ik->ik_nirq; + + ia.ia_drq = ik->ik_drq; + ia.ia_ndrq = ik->ik_ndrq; + + ia.ia_aux = NULL; + + ik->ik_claimed = config_found_sm(&sc->sc_dev, &ia, + isaprint, isasubmatch); + } +} + +void +isa_free_knowndevs(struct isa_softc *sc) +{ + struct isa_knowndev *ik; + struct isa_pnpname *ipn; + +#define FREEIT(x) if (x != NULL) free(x, M_DEVBUF) + + while ((ik = TAILQ_FIRST(&sc->sc_knowndevs)) != NULL) { + TAILQ_REMOVE(&sc->sc_knowndevs, ik, ik_list); + FREEIT(ik->ik_pnpname); + while ((ipn = ik->ik_pnpcompatnames) != NULL) { + ik->ik_pnpcompatnames = ipn->ipn_next; + free(ipn->ipn_name, M_DEVBUF); + free(ipn, M_DEVBUF); + } + FREEIT(ik->ik_io); + FREEIT(ik->ik_iomem); + FREEIT(ik->ik_irq); + FREEIT(ik->ik_drq); + free(ik, M_DEVBUF); + } + +#undef FREEIT +} + int -isaprint(aux, isa) - void *aux; - const char *isa; +isasubmatch(struct device *parent, struct cfdata *cf, void *aux) { struct isa_attach_args *ia = aux; + int i; + + if (ia->ia_nio == 0) { + if (cf->cf_iobase != ISACF_PORT_DEFAULT) + return (0); + } else { + if (cf->cf_iobase != ISACF_PORT_DEFAULT && + cf->cf_iobase != ia->ia_io[0].ir_addr) + return (0); + } + + if (ia->ia_niomem == 0) { + if (cf->cf_maddr != ISACF_IOMEM_DEFAULT) + return (0); + } else { + if (cf->cf_maddr != ISACF_IOMEM_DEFAULT && + cf->cf_maddr != ia->ia_iomem[0].ir_addr) + return (0); + } + + if (ia->ia_nirq == 0) { + if (cf->cf_irq != ISACF_IRQ_DEFAULT) + return (0); + } else { + if (cf->cf_irq != ISACF_IRQ_DEFAULT && + cf->cf_irq != ia->ia_irq[0].ir_irq) + return (0); + } + + if (ia->ia_ndrq == 0) { + if (cf->cf_drq != ISACF_DRQ_DEFAULT) + return (0); + if (cf->cf_drq2 != ISACF_DRQ_DEFAULT) + return (0); + } else { + for (i = 0; i < 2; i++) { + if (i == ia->ia_ndrq) + break; + if (cf->cf_loc[ISACF_DRQ + i] != ISACF_DRQ_DEFAULT && + cf->cf_loc[ISACF_DRQ + i] != ia->ia_drq[i].ir_drq) + return (0); + } + for (; i < 2; i++) { + if (cf->cf_loc[ISACF_DRQ + i] != ISACF_DRQ_DEFAULT) + return (0); + } + } + + return ((*cf->cf_attach->ca_match)(parent, cf, aux)); +} + +int +isaprint(void *aux, const char *isa) +{ + struct isa_attach_args *ia = aux; + const char *sep; + int i; + + /* + * This block of code only fires if we have a direct-config'd + * device for which there is no driver match. + */ + if (isa != NULL) { + struct isa_pnpname *ipn; + + if (ia->ia_pnpname != NULL) + printf("%s", ia->ia_pnpname); + if ((ipn = ia->ia_pnpcompatnames) != NULL) { + printf(" ("); /* ) */ + for (sep = ""; ipn != NULL; + ipn = ipn->ipn_next, sep = " ") { + printf("%s%s", sep, ipn->ipn_name); + } + /* ( */ printf(")"); + } + printf(" at %s", isa); + } + + if (ia->ia_nio) { + sep = ""; + printf(" port "); + for (i = 0; i < ia->ia_nio; i++) { + if (ia->ia_io[i].ir_size == 0) + continue; + printf("%s0x%x", sep, ia->ia_io[i].ir_addr); + if (ia->ia_io[i].ir_size > 1) + printf("-0x%x", ia->ia_io[i].ir_addr + + ia->ia_io[i].ir_size - 1); + sep = ","; + } + } + + if (ia->ia_niomem) { + sep = ""; + printf(" iomem "); + for (i = 0; i < ia->ia_niomem; i++) { + if (ia->ia_iomem[i].ir_size == 0) + continue; + printf("%s0x%x", sep, ia->ia_iomem[i].ir_addr); + if (ia->ia_iomem[i].ir_size > 1) + printf("-0x%x", ia->ia_iomem[i].ir_addr + + ia->ia_iomem[i].ir_size - 1); + sep = ","; + } + } + + if (ia->ia_nirq) { + sep = ""; + printf(" irq "); + for (i = 0; i < ia->ia_nirq; i++) { + if (ia->ia_irq[i].ir_irq == ISACF_IRQ_DEFAULT) + continue; + printf("%s%d", sep, ia->ia_irq[i].ir_irq); + sep = ","; + } + } + + if (ia->ia_ndrq) { + sep = ""; + printf(" drq "); + for (i = 0; i < ia->ia_ndrq; i++) { + if (ia->ia_drq[i].ir_drq == ISACF_DRQ_DEFAULT) + continue; + printf("%s%d", sep, ia->ia_drq[i].ir_drq); + sep = ","; + } + } - if (ia->ia_iosize) - printf(" port 0x%x", ia->ia_iobase); - if (ia->ia_iosize > 1) - printf("-0x%x", ia->ia_iobase + ia->ia_iosize - 1); - if (ia->ia_msize) - printf(" iomem 0x%x", ia->ia_maddr); - if (ia->ia_msize > 1) - printf("-0x%x", ia->ia_maddr + ia->ia_msize - 1); - if (ia->ia_irq != IRQUNK) - printf(" irq %d", ia->ia_irq); - if (ia->ia_drq != DRQUNK) - printf(" drq %d", ia->ia_drq); - if (ia->ia_drq2 != DRQUNK) - printf(" drq2 %d", ia->ia_drq2); return (UNCONF); } int -isasearch(parent, cf, aux) - struct device *parent; - struct cfdata *cf; - void *aux; +isasearch(struct device *parent, struct cfdata *cf, void *aux) { + struct isa_io res_io[1]; + struct isa_iomem res_mem[1]; + struct isa_irq res_irq[1]; + struct isa_drq res_drq[2]; struct isa_softc *sc = (struct isa_softc *)parent; struct isa_attach_args ia; int tryagain; do { + ia.ia_pnpname = NULL; + ia.ia_pnpcompatnames = NULL; + + res_io[0].ir_addr = cf->cf_loc[ISACF_PORT]; + res_io[0].ir_size = 0; + + res_mem[0].ir_addr = cf->cf_loc[ISACF_IOMEM]; + res_mem[0].ir_size = cf->cf_loc[ISACF_IOSIZ]; + + res_irq[0].ir_irq = + cf->cf_loc[ISACF_IRQ] == 2 ? 9 : cf->cf_loc[ISACF_IRQ]; + + res_drq[0].ir_drq = cf->cf_loc[ISACF_DRQ]; + res_drq[1].ir_drq = cf->cf_loc[ISACF_DRQ2]; + ia.ia_iot = sc->sc_iot; ia.ia_memt = sc->sc_memt; ia.ia_dmat = sc->sc_dmat; ia.ia_ic = sc->sc_ic; - ia.ia_iobase = cf->cf_iobase; - ia.ia_iosize = 0x666; /* cf->cf_iosize; */ - ia.ia_maddr = cf->cf_maddr; - ia.ia_msize = cf->cf_msize; - ia.ia_irq = cf->cf_irq == 2 ? 9 : cf->cf_irq; - ia.ia_drq = cf->cf_drq; - ia.ia_drq2 = cf->cf_drq2; + + ia.ia_io = res_io; + ia.ia_nio = 1; + + ia.ia_iomem = res_mem; + ia.ia_niomem = 1; + + ia.ia_irq = res_irq; + ia.ia_nirq = 1; + + ia.ia_drq = res_drq; + ia.ia_ndrq = 2; tryagain = 0; if ((*cf->cf_attach->ca_match)(parent, cf, &ia) > 0) { @@ -176,8 +389,7 @@ isasearch(parent, cf, aux) } char * -isa_intr_typename(type) - int type; +isa_intr_typename(int type) { switch (type) { diff --git a/sys/dev/isa/isavar.h b/sys/dev/isa/isavar.h index 99b7b36b438a..fdb084acd786 100644 --- a/sys/dev/isa/isavar.h +++ b/sys/dev/isa/isavar.h @@ -1,12 +1,11 @@ -/* $NetBSD: isavar.h,v 1.38 2000/06/04 19:15:12 cgd Exp $ */ +/* $NetBSD: isavar.h,v 1.39 2002/01/07 21:47:10 thorpej Exp $ */ /*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. + * Copyright (c) 1997, 2001 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. + * by Jason R. Thorpe of Wasabi Systems, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -101,6 +100,76 @@ struct isabus_attach_args { isa_chipset_tag_t iba_ic; }; +/* + * ISA bus resources. + */ + +struct isa_io { + int ir_addr; + int ir_size; +}; + +struct isa_iomem { + int ir_addr; + int ir_size; +}; + +struct isa_irq { + int ir_irq; +}; + +struct isa_drq { + int ir_drq; +}; + +struct isa_pnpname { + struct isa_pnpname *ipn_next; + char *ipn_name; +}; + +/* + * Machine-dependent code provides a list of these to describe + * devices on the ISA bus which should be attached via direct + * configuration. + * + * All of this information is dynamically allocated, so that + * the ISA bus driver may free all of this information if the + * bus does not support dynamic attach/detach of devices (e.g. + * on a docking station). + * + * Some info on the "ik_key" field: This is a unique number for + * each knowndev node. If, when we need to re-enumerate the + * knowndevs, we discover that a node with key N is in the old + * list but not in the new, the device has disappeared. Similarly, + * if a node with key M is in the new list but not in the old, + * the device is new. Note that the knowndevs list must be + * sorted in ascending "key" order. + */ +struct isa_knowndev { + TAILQ_ENTRY(isa_knowndev) ik_list; + uintptr_t ik_key; + struct device *ik_claimed; + + /* + * The rest of these fields correspond to isa_attach_args + * fields. + */ + char *ik_pnpname; + struct isa_pnpname *ik_pnpcompatnames; + + struct isa_io *ik_io; + int ik_nio; + + struct isa_iomem *ik_iomem; + int ik_niomem; + + struct isa_irq *ik_irq; + int ik_nirq; + + struct isa_drq *ik_drq; + int ik_ndrq; +}; + /* * ISA driver attach arguments */ @@ -111,22 +180,38 @@ struct isa_attach_args { isa_chipset_tag_t ia_ic; - int ia_iobase; /* base i/o address */ - int ia_iosize; /* span of ports used */ - int ia_irq; /* interrupt request */ - int ia_drq; /* DMA request */ - int ia_drq2; /* second DMA request */ - int ia_maddr; /* physical i/o mem addr */ - u_int ia_msize; /* size of i/o memory */ + /* + * PNP (or other) names to with which we can match a device + * driver to a device that machine-dependent code tells us + * is there (i.e. support for direct-configuration of ISA + * devices). + */ + char *ia_pnpname; + struct isa_pnpname *ia_pnpcompatnames; + + struct isa_io *ia_io; /* I/O resources */ + int ia_nio; + + struct isa_iomem *ia_iomem; /* memory resources */ + int ia_niomem; + + struct isa_irq *ia_irq; /* IRQ resources */ + int ia_nirq; + + struct isa_drq *ia_drq; /* DRQ resources */ + int ia_ndrq; + void *ia_aux; /* driver specific */ }; -#include "locators.h" +/* + * Test to determine if a given call to an ISA device probe routine + * is actually an attempt to do direct configuration. + */ +#define ISA_DIRECT_CONFIG(ia) \ + ((ia)->ia_pnpname != NULL || (ia)->ia_pnpcompatnames != NULL) -#define IOBASEUNK ISACF_PORT_DEFAULT /* i/o address is unknown */ -#define IRQUNK ISACF_IRQ_DEFAULT /* interrupt request line is unknown */ -#define DRQUNK ISACF_DRQ_DEFAULT /* DMA request line is unknown */ -#define MADDRUNK ISACF_IOMEM_DEFAULT /* shared memory address is unknown */ +#include "locators.h" /* * ISA master bus @@ -139,6 +224,9 @@ struct isa_softc { bus_dma_tag_t sc_dmat; /* isa DMA tag */ isa_chipset_tag_t sc_ic; + + TAILQ_HEAD(, isa_knowndev) sc_knowndevs; + int sc_dynamicdevs; }; #define cf_iobase cf_loc[ISACF_PORT] diff --git a/sys/dev/isa/isic_isa.c b/sys/dev/isa/isic_isa.c index 51ebb547fbf8..6667c6159db0 100644 --- a/sys/dev/isa/isic_isa.c +++ b/sys/dev/isa/isic_isa.c @@ -1,3 +1,5 @@ +/* $NetBSD: isic_isa.c,v 1.7 2002/01/07 21:47:10 thorpej Exp $ */ + /* * Copyright (c) 1997-1999 Martin Husemann. All rights reserved. * @@ -33,7 +35,7 @@ * isic_isa.c - ISA bus frontend for i4b_isic driver * -------------------------------------------------- * - * $Id: isic_isa.c,v 1.6 2001/11/15 09:48:09 lukem Exp $ + * $Id: isic_isa.c,v 1.7 2002/01/07 21:47:10 thorpej Exp $ * * last edit-date: [Tue Jan 9 01:43:45 2001] * @@ -43,7 +45,7 @@ *---------------------------------------------------------------------------*/ #include -__KERNEL_RCSID(0, "$NetBSD: isic_isa.c,v 1.6 2001/11/15 09:48:09 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isic_isa.c,v 1.7 2002/01/07 21:47:10 thorpej Exp $"); #include #include @@ -137,18 +139,34 @@ isic_isa_probe(parent, cf, aux) bus_space_tag_t memt = ia->ia_memt, iot = ia->ia_iot; int flags = cf->cf_flags; struct isic_attach_args args; - int ret = 0; + int ret = 0, iobase, iosize, maddr, msize; #if 0 printf("isic%d: enter isic_isa_probe\n", cf->cf_unit); #endif + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* check irq */ - if (ia->ia_irq == IRQUNK) { + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) { printf("isic%d: config error: no IRQ specified\n", cf->cf_unit); return 0; } + iobase = ia->ia_io[0].ir_addr; + iosize = ia->ia_io[0].ir_size; + + maddr = ia->ia_iomem[0].ir_addr; + msize = ia->ia_iomem[0].ir_size; + /* setup MI attach args */ memset(&args, 0, sizeof(args)); args.ia_flags = flags; @@ -162,9 +180,9 @@ isic_isa_probe(parent, cf, aux) case FLAG_AVM_A1: case FLAG_USR_ISDN_TA_INT: case FLAG_ITK_IX1: - if (setup_io_map(flags, iot, memt, ia->ia_iobase, ia->ia_maddr, - &args.ia_num_mappings, &args.ia_maps[0], - &(ia->ia_iosize), &ia->ia_msize)) { + if (setup_io_map(flags, iot, memt, iobase, maddr, + &args.ia_num_mappings, &args.ia_maps[0], + &iosize, &msize)) { ret = 0; goto done; } @@ -224,27 +242,27 @@ isic_isa_probe(parent, cf, aux) default: /* No card type given, try to figure ... */ - if (ia->ia_iobase == IOBASEUNK) { + if (iobase == ISACF_PORT_DEFAULT) { ret = 0; #ifdef ISICISA_TEL_S0_8 /* only Teles S0/8 will work without IO */ args.ia_flags = FLAG_TELES_S0_8; - if (setup_io_map(args.ia_flags, iot, memt, ia->ia_iobase, ia->ia_maddr, - &args.ia_num_mappings, &args.ia_maps[0], - &(ia->ia_iosize), &(ia->ia_msize)) == 0) + if (setup_io_map(args.ia_flags, iot, memt, + iobase, maddr, &args.ia_num_mappings, + &args.ia_maps[0], &iosize, &msize) == 0) { ret = isic_probe_s08(&args); } #endif /* ISICISA_TEL_S0_8 */ - } else if (ia->ia_maddr == MADDRUNK) { + } else if (maddr == ISACF_IOMEM_DEFAULT) { ret = 0; #ifdef ISICISA_TEL_S0_16_3 /* no shared memory, only a 16.3 based card, AVM A1, the usr sportster or an ITK would work */ args.ia_flags = FLAG_TELES_S0_163; - if (setup_io_map(args.ia_flags, iot, memt, ia->ia_iobase, ia->ia_maddr, + if (setup_io_map(args.ia_flags, iot, memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], - &(ia->ia_iosize), &(ia->ia_msize)) == 0) + &iosize, &msize) == 0) { ret = isic_probe_s0163(&args); if (ret) @@ -254,9 +272,9 @@ isic_isa_probe(parent, cf, aux) #ifdef ISICISA_AVM_A1 args_unmap(&args.ia_num_mappings, &args.ia_maps[0]); args.ia_flags = FLAG_AVM_A1; - if (setup_io_map(args.ia_flags, iot, memt, ia->ia_iobase, ia->ia_maddr, + if (setup_io_map(args.ia_flags, iot, memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], - &(ia->ia_iosize), &(ia->ia_msize)) == 0) + &iosize, &msize) == 0) { ret = isic_probe_avma1(&args); if (ret) @@ -266,9 +284,9 @@ isic_isa_probe(parent, cf, aux) #ifdef ISICISA_USR_STI args_unmap(&args.ia_num_mappings, &args.ia_maps[0]); args.ia_flags = FLAG_USR_ISDN_TA_INT; - if (setup_io_map(args.ia_flags, iot, memt, ia->ia_iobase, ia->ia_maddr, + if (setup_io_map(args.ia_flags, iot, memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], - &(ia->ia_iosize), &(ia->ia_msize)) == 0) + &iosize, &msize) == 0) { ret = isic_probe_usrtai(&args); if (ret) @@ -279,9 +297,9 @@ isic_isa_probe(parent, cf, aux) #ifdef ISICISA_ITKIX1 args_unmap(&args.ia_num_mappings, &args.ia_maps[0]); args.ia_flags = FLAG_ITK_IX1; - if (setup_io_map(args.ia_flags, iot, memt, ia->ia_iobase, ia->ia_maddr, + if (setup_io_map(args.ia_flags, iot, memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], - &(ia->ia_iosize), &(ia->ia_msize)) == 0) + &iosize, &msize) == 0) { ret = isic_probe_itkix1(&args); if (ret) @@ -293,9 +311,9 @@ isic_isa_probe(parent, cf, aux) #ifdef ISICISA_TEL_S0_16_3 /* could be anything */ args.ia_flags = FLAG_TELES_S0_163; - if (setup_io_map(args.ia_flags, iot, memt, ia->ia_iobase, ia->ia_maddr, + if (setup_io_map(args.ia_flags, iot, memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], - &(ia->ia_iosize), &(ia->ia_msize)) == 0) + &iosize, &msize) == 0) { ret = isic_probe_s0163(&args); if (ret) @@ -305,9 +323,9 @@ isic_isa_probe(parent, cf, aux) #ifdef ISICISA_TEL_S0_16 args_unmap(&args.ia_num_mappings, &args.ia_maps[0]); args.ia_flags = FLAG_TELES_S0_16; - if (setup_io_map(args.ia_flags, iot, memt, ia->ia_iobase, ia->ia_maddr, + if (setup_io_map(args.ia_flags, iot, memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], - &(ia->ia_iosize), &(ia->ia_msize)) == 0) + &iosize, &msize) == 0) { ret = isic_probe_s016(&args); if (ret) @@ -317,9 +335,9 @@ isic_isa_probe(parent, cf, aux) #ifdef ISICISA_AVM_A1 args_unmap(&args.ia_num_mappings, &args.ia_maps[0]); args.ia_flags = FLAG_AVM_A1; - if (setup_io_map(args.ia_flags, iot, memt, ia->ia_iobase, ia->ia_maddr, + if (setup_io_map(args.ia_flags, iot, memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], - &(ia->ia_iosize), &(ia->ia_msize)) == 0) + &iosize, &msize) == 0) { ret = isic_probe_avma1(&args); if (ret) @@ -329,9 +347,9 @@ isic_isa_probe(parent, cf, aux) #ifdef ISICISA_TEL_S0_8 args_unmap(&args.ia_num_mappings, &args.ia_maps[0]); args.ia_flags = FLAG_TELES_S0_8; - if (setup_io_map(args.ia_flags, iot, memt, ia->ia_iobase, ia->ia_maddr, + if (setup_io_map(args.ia_flags, iot, memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], - &(ia->ia_iosize), &(ia->ia_msize)) == 0) + &iosize, &msize) == 0) { ret = isic_probe_s08(&args); } @@ -348,6 +366,22 @@ done: printf("isic%d: exit isic_isa_probe, return = %d\n", cf->cf_unit, ret); #endif + if (ret) { + if (iosize != 0) { + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = iobase; + ia->ia_io[0].ir_size = iosize; + } + if (msize != 0) { + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_addr = maddr; + ia->ia_iomem[0].ir_size = msize; + } + ia->ia_nirq = 1; + + ia->ia_ndrq = 0; + } + return ret; } @@ -789,13 +823,28 @@ isic_isa_attach(parent, self, aux) struct l1_softc *sc = (void *)self; struct isa_attach_args *ia = aux; int flags = sc->sc_dev.dv_cfdata->cf_flags; - int ret = 0; + int ret = 0, iobase, iosize, maddr, msize; struct isic_attach_args args; + if (ia->ia_nio > 0) { + iobase = ia->ia_io[0].ir_addr; + iosize = ia->ia_io[0].ir_size; + } else { + iobase = ISACF_PORT_DEFAULT; + iosize = 0; + } + if (ia->ia_niomem > 0) { + maddr = ia->ia_iomem[0].ir_addr; + msize = ia->ia_iomem[0].ir_size; + } else { + maddr = ISACF_IOMEM_DEFAULT; + msize = 0; + } + /* Setup parameters */ sc->sc_unit = sc->sc_dev.dv_unit; - sc->sc_irq = ia->ia_irq; - sc->sc_maddr = ia->ia_maddr; + sc->sc_irq = ia->ia_irq[0].ir_irq; + sc->sc_maddr = maddr; sc->sc_num_mappings = 0; sc->sc_maps = NULL; switch(flags) @@ -805,10 +854,10 @@ isic_isa_attach(parent, self, aux) case FLAG_TELES_S0_163: case FLAG_AVM_A1: case FLAG_USR_ISDN_TA_INT: - setup_io_map(flags, ia->ia_iot, ia->ia_memt, ia->ia_iobase, ia->ia_maddr, + setup_io_map(flags, ia->ia_iot, ia->ia_memt, iobase, maddr, &(sc->sc_num_mappings), NULL, NULL, NULL); MALLOC_MAPS(sc); - setup_io_map(flags, ia->ia_iot, ia->ia_memt, ia->ia_iobase, ia->ia_maddr, + setup_io_map(flags, ia->ia_iot, ia->ia_memt, iobase, maddr, &(sc->sc_num_mappings), &(sc->sc_maps[0]), NULL, NULL); break; @@ -820,25 +869,25 @@ isic_isa_attach(parent, self, aux) args.ia_flags = flags; /* Probe cards */ - if (ia->ia_iobase == IOBASEUNK) { + if (iobase == ISACF_PORT_DEFAULT) { ret = 0; #ifdef ISICISA_TEL_S0_8 /* only Teles S0/8 will work without IO */ args.ia_flags = FLAG_TELES_S0_8; - setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, ia->ia_iobase, ia->ia_maddr, + setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], NULL, NULL); ret = isic_probe_s08(&args); if (ret) goto found; args_unmap(&args.ia_num_mappings, &args.ia_maps[0]); #endif /* ISICISA_TEL_S0_8 */ - } else if (ia->ia_maddr == MADDRUNK) { + } else if (maddr == ISACF_IOMEM_DEFAULT) { /* no shared memory, only a 16.3 based card, AVM A1, the usr sportster or an ITK would work */ ret = 0; #ifdef ISICISA_TEL_S0_16_3 args.ia_flags = FLAG_TELES_S0_163; - setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, ia->ia_iobase, ia->ia_maddr, + setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], NULL, NULL); ret = isic_probe_s0163(&args); if (ret) @@ -847,7 +896,7 @@ isic_isa_attach(parent, self, aux) #endif /* ISICISA_TEL_S0_16_3 */ #ifdef ISICISA_AVM_A1 args.ia_flags = FLAG_AVM_A1; - setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, ia->ia_iobase, ia->ia_maddr, + setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], NULL, NULL); ret = isic_probe_avma1(&args); if (ret) @@ -856,7 +905,7 @@ isic_isa_attach(parent, self, aux) #endif /* ISICISA_AVM_A1 */ #ifdef ISICISA_USR_STI args.ia_flags = FLAG_USR_ISDN_TA_INT; - setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, ia->ia_iobase, ia->ia_maddr, + setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], NULL, NULL); ret = isic_probe_usrtai(&args); if (ret) @@ -865,7 +914,7 @@ isic_isa_attach(parent, self, aux) #endif /* ISICISA_USR_STI */ #ifdef ISICISA_ITKIX1 args.ia_flags = FLAG_ITK_IX1; - setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, ia->ia_iobase, ia->ia_maddr, + setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], NULL, NULL); ret = isic_probe_itkix1(&args); if (ret) @@ -877,7 +926,7 @@ isic_isa_attach(parent, self, aux) ret = 0; #ifdef ISICISA_TEL_S0_16_3 args.ia_flags = FLAG_TELES_S0_163; - setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, ia->ia_iobase, ia->ia_maddr, + setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], NULL, NULL); ret = isic_probe_s0163(&args); if (ret) @@ -886,7 +935,7 @@ isic_isa_attach(parent, self, aux) #endif /* ISICISA_TEL_S0_16_3 */ #ifdef ISICISA_TEL_S0_16 args.ia_flags = FLAG_TELES_S0_16; - setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, ia->ia_iobase, ia->ia_maddr, + setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], NULL, NULL); ret = isic_probe_s016(&args); if (ret) @@ -895,7 +944,7 @@ isic_isa_attach(parent, self, aux) #endif /* ISICISA_TEL_S0_16 */ #ifdef ISICISA_AVM_A1 args.ia_flags = FLAG_AVM_A1; - setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, ia->ia_iobase, ia->ia_maddr, + setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], NULL, NULL); ret = isic_probe_avma1(&args); if (ret) @@ -904,7 +953,7 @@ isic_isa_attach(parent, self, aux) #endif /* ISICISA_AVM_A1 */ #ifdef ISICISA_TEL_S0_8 args.ia_flags = FLAG_TELES_S0_8; - setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, ia->ia_iobase, ia->ia_maddr, + setup_io_map(args.ia_flags, ia->ia_iot, ia->ia_memt, iobase, maddr, &args.ia_num_mappings, &args.ia_maps[0], NULL, NULL); ret = isic_probe_s08(&args); if (ret) @@ -920,7 +969,7 @@ isic_isa_attach(parent, self, aux) args_unmap(&args.ia_num_mappings, &args.ia_maps[0]); if (ret) { MALLOC_MAPS(sc); - setup_io_map(flags, ia->ia_iot, ia->ia_memt, ia->ia_iobase, ia->ia_maddr, + setup_io_map(flags, ia->ia_iot, ia->ia_memt, iobase, maddr, &(sc->sc_num_mappings), &(sc->sc_maps[0]), NULL, NULL); } else { printf(": could not determine card type - not configured!\n"); @@ -946,9 +995,9 @@ isic_isa_attach(parent, self, aux) * work (like on NetBSD/Atari, try to establish an edge triggered * interrupt. */ - if (isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_LEVEL, + if (isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_LEVEL, IPL_NET, isicintr, sc) == NULL) { - if(isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, + if(isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_NET, isicintr, sc) == NULL) { args_unmap(&(sc->sc_num_mappings), &(sc->sc_maps[0])); free((sc)->sc_maps, M_DEVBUF); @@ -988,7 +1037,7 @@ setup_io_map(flags, iot, memt, iobase, maddr, num_mappings, maps, iosize, msize) switch(flags) { case FLAG_TELES_S0_8: - if (maddr == MADDRUNK) { + if (maddr == ISACF_IOMEM_DEFAULT) { printf("isic: config error: no shared memory specified for Teles S0/8!\n"); return 1; } @@ -1012,11 +1061,11 @@ setup_io_map(flags, iot, memt, iobase, maddr, num_mappings, maps, iosize, msize) break; case FLAG_TELES_S0_16: - if (iobase == IOBASEUNK) { + if (iobase == ISACF_PORT_DEFAULT) { printf("isic: config error: no i/o address specified for Teles S0/16!\n"); return 1; } - if (maddr == MADDRUNK) { + if (maddr == ISACF_IOMEM_DEFAULT) { printf("isic: config error: no shared memory specified for Teles S0/16!\n"); return 1; } @@ -1048,7 +1097,7 @@ setup_io_map(flags, iot, memt, iobase, maddr, num_mappings, maps, iosize, msize) break; case FLAG_TELES_S0_163: - if (iobase == IOBASEUNK) { + if (iobase == ISACF_PORT_DEFAULT) { printf("isic: config error: no i/o address specified for Teles S0/16!\n"); return 1; } @@ -1102,7 +1151,7 @@ setup_io_map(flags, iot, memt, iobase, maddr, num_mappings, maps, iosize, msize) break; case FLAG_AVM_A1: - if (iobase == IOBASEUNK) { + if (iobase == ISACF_PORT_DEFAULT) { printf("isic: config error: no i/o address specified for AVM A1/Fritz! card!\n"); return 1; } @@ -1175,7 +1224,7 @@ setup_io_map(flags, iot, memt, iobase, maddr, num_mappings, maps, iosize, msize) break; case FLAG_USR_ISDN_TA_INT: - if (iobase == IOBASEUNK) { + if (iobase == ISACF_PORT_DEFAULT) { printf("isic: config error: no I/O base specified for USR Sportster TA intern!\n"); return 1; } @@ -1247,7 +1296,7 @@ setup_io_map(flags, iot, memt, iobase, maddr, num_mappings, maps, iosize, msize) break; case FLAG_ITK_IX1: - if (iobase == IOBASEUNK) { + if (iobase == ISACF_PORT_DEFAULT) { printf("isic: config error: no I/O base specified for ITK ix1 micro!\n"); return 1; } diff --git a/sys/dev/isa/lm_isa.c b/sys/dev/isa/lm_isa.c index 72b7ced4ede6..393be523a077 100644 --- a/sys/dev/isa/lm_isa.c +++ b/sys/dev/isa/lm_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: lm_isa.c,v 1.4 2001/11/13 08:01:24 lukem Exp $ */ +/* $NetBSD: lm_isa.c,v 1.5 2002/01/07 21:47:10 thorpej Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lm_isa.c,v 1.4 2001/11/13 08:01:24 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lm_isa.c,v 1.5 2002/01/07 21:47:10 thorpej Exp $"); #include #include @@ -88,11 +88,17 @@ lm_isa_match(parent, match, aux) int rv; /* Must supply an address */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) - return 0; + if (ia->ia_nio < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); iot = ia->ia_iot; - iobase = ia->ia_iobase; + iobase = ia->ia_io[0].ir_addr; if (bus_space_map(iot, iobase, 8, 0, &ioh)) return (0); @@ -104,8 +110,12 @@ lm_isa_match(parent, match, aux) bus_space_unmap(iot, ioh, 8); if (rv) { - ia->ia_iosize = 8; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = 8; + + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; } return (rv); @@ -122,7 +132,7 @@ lm_isa_attach(parent, self, aux) bus_space_tag_t iot; struct isa_attach_args *ia = aux; - iobase = ia->ia_iobase; + iobase = ia->ia_io[0].ir_addr; iot = lmsc->lm_iot = ia->ia_iot; if (bus_space_map(iot, iobase, 8, 0, &lmsc->lm_ioh)) { diff --git a/sys/dev/isa/lpt_isa.c b/sys/dev/isa/lpt_isa.c index 5dd4366eff97..bfeb9c6537d2 100644 --- a/sys/dev/isa/lpt_isa.c +++ b/sys/dev/isa/lpt_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: lpt_isa.c,v 1.51 2001/11/13 08:01:24 lukem Exp $ */ +/* $NetBSD: lpt_isa.c,v 1.52 2002/01/07 21:47:10 thorpej Exp $ */ /* * Copyright (c) 1993, 1994 Charles M. Hannum. @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lpt_isa.c,v 1.51 2001/11/13 08:01:24 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lpt_isa.c,v 1.52 2002/01/07 21:47:10 thorpej Exp $"); #include #include @@ -167,12 +167,18 @@ lpt_isa_probe(parent, match, aux) #define ABORT goto out #endif + if (ia->ia_nio < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) return (0); iot = ia->ia_iot; - base = ia->ia_iobase; + base = ia->ia_io[0].ir_addr;; if (bus_space_map(iot, base, LPT_NPORTS, 0, &ioh)) return 0; @@ -202,8 +208,10 @@ lpt_isa_probe(parent, match, aux) bus_space_write_1(iot, ioh, lpt_data, 0); bus_space_write_1(iot, ioh, lpt_control, 0); - ia->ia_iosize = LPT_NPORTS; - ia->ia_msize = 0; + ia->ia_io[0].ir_size = LPT_NPORTS; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; rv = 1; @@ -223,15 +231,17 @@ lpt_isa_attach(parent, self, aux) bus_space_tag_t iot; bus_space_handle_t ioh; - if (ia->ia_irq != IRQUNK) - printf("\n"); - else + if (ia->ia_nirq < 1 || + ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) { + sc->sc_irq = -1; printf(": polled\n"); - - sc->sc_irq = ia->ia_irq; + } else { + sc->sc_irq = ia->ia_irq[0].ir_irq; + printf("\n"); + } iot = lsc->sc_iot = ia->ia_iot; - if (bus_space_map(iot, ia->ia_iobase, LPT_NPORTS, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, LPT_NPORTS, 0, &ioh)) { printf("%s: can't map i/o space\n", self->dv_xname); return; } @@ -239,8 +249,7 @@ lpt_isa_attach(parent, self, aux) lpt_attach_subr(lsc); - if (ia->ia_irq != IRQUNK) - lsc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_TTY, lptintr, lsc); + if (sc->sc_irq != -1) + lsc->sc_ih = isa_intr_establish(ia->ia_ic, sc->sc_irq, + IST_EDGE, IPL_TTY, lptintr, lsc); } - diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c index 4f88e63fd5dc..a8c7552880c5 100644 --- a/sys/dev/isa/mcd.c +++ b/sys/dev/isa/mcd.c @@ -1,4 +1,4 @@ -/* $NetBSD: mcd.c,v 1.73 2001/11/15 09:48:09 lukem Exp $ */ +/* $NetBSD: mcd.c,v 1.74 2002/01/07 21:47:11 thorpej Exp $ */ /* * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -56,7 +56,7 @@ /*static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";*/ #include -__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.73 2001/11/15 09:48:09 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.74 2002/01/07 21:47:11 thorpej Exp $"); #include #include @@ -235,7 +235,7 @@ mcdattach(parent, self, aux) struct mcd_mbox mbx; /* Map i/o space */ - if (bus_space_map(iot, ia->ia_iobase, MCD_NPORT, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, MCD_NPORT, 0, &ioh)) { printf(": can't map i/o space\n"); return; } @@ -274,8 +274,8 @@ mcdattach(parent, self, aux) mcd_soft_reset(sc); - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_BIO, mcdintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_BIO, mcdintr, sc); } /* @@ -953,12 +953,22 @@ mcdprobe(parent, match, aux) bus_space_handle_t ioh; int rv; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return (0); /* Map i/o space */ - if (bus_space_map(iot, ia->ia_iobase, MCD_NPORT, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, MCD_NPORT, 0, &ioh)) return 0; sc.debug = 0; @@ -969,8 +979,13 @@ mcdprobe(parent, match, aux) bus_space_unmap(iot, ioh, MCD_NPORT); if (rv) { - ia->ia_iosize = MCD_NPORT; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = MCD_NPORT; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; } return (rv); diff --git a/sys/dev/isa/moxa_isa.c b/sys/dev/isa/moxa_isa.c index 942f1678da65..46d1d53da9b3 100644 --- a/sys/dev/isa/moxa_isa.c +++ b/sys/dev/isa/moxa_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: moxa_isa.c,v 1.2 2001/11/13 08:01:25 lukem Exp $ */ +/* $NetBSD: moxa_isa.c,v 1.3 2002/01/07 21:47:11 thorpej Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: moxa_isa.c,v 1.2 2001/11/13 08:01:25 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: moxa_isa.c,v 1.3 2002/01/07 21:47:11 thorpej Exp $"); #include #include @@ -80,10 +80,9 @@ moxa_isaprobe(parent, self, aux) void *aux; { struct isa_attach_args *ia = aux; - int iobase = ia->ia_iobase; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; - int i, rv = 1; + int i, iobase, rv = 1; /* * Do the normal com probe for the first UART and assume @@ -92,15 +91,25 @@ moxa_isaprobe(parent, self, aux) * XXX Needs more robustness. */ + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return (0); /* if the first port is in use as console, then it. */ - if (com_is_console(iot, iobase, 0)) + if (com_is_console(iot, ia->ia_io[0].ir_addr, 0)) goto checkmappings; - if (bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, COM_NPORTS, 0, &ioh)) { rv = 0; goto out; } @@ -110,7 +119,7 @@ moxa_isaprobe(parent, self, aux) goto out; checkmappings: - for (i = 1; i < NSLAVES; i++) { + for (i = 1, iobase = ia->ia_io[0].ir_addr; i < NSLAVES; i++) { iobase += COM_NPORTS; if (com_is_console(iot, iobase, 0)) @@ -124,8 +133,15 @@ checkmappings: } out: - if (rv) - ia->ia_iosize = NSLAVES * COM_NPORTS; + if (rv) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = NSLAVES * COM_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + } return (rv); } @@ -156,7 +172,7 @@ moxa_isaattach(parent, self, aux) printf("\n"); sc->sc_iot = ia->ia_iot; - sc->sc_iobase = ia->ia_iobase; + sc->sc_iobase = ia->ia_io[0].ir_addr; for (i = 0; i < NSLAVES; i++) { iobase = sc->sc_iobase + i * COM_NPORTS; @@ -181,8 +197,8 @@ moxa_isaattach(parent, self, aux) sc->sc_alive |= 1 << i; } - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_SERIAL, moxa_isaintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_SERIAL, moxa_isaintr, sc); } int diff --git a/sys/dev/isa/mpu_isa.c b/sys/dev/isa/mpu_isa.c index b6a54a7c0302..6a85e0de3f42 100644 --- a/sys/dev/isa/mpu_isa.c +++ b/sys/dev/isa/mpu_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: mpu_isa.c,v 1.5 2001/11/13 08:01:26 lukem Exp $ */ +/* $NetBSD: mpu_isa.c,v 1.6 2002/01/07 21:47:11 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mpu_isa.c,v 1.5 2001/11/13 08:01:26 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mpu_isa.c,v 1.6 2002/01/07 21:47:11 thorpej Exp $"); #include #include @@ -77,16 +77,34 @@ mpu_isa_match(parent, match, aux) struct mpu_isa_softc sc; int r; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) + return (0); + memset(&sc, 0, sizeof sc); sc.sc_mpu.iot = ia->ia_iot; - if (bus_space_map(sc.sc_mpu.iot, ia->ia_iobase, MPU401_NPORT, 0, + if (bus_space_map(sc.sc_mpu.iot, ia->ia_io[0].ir_addr, MPU401_NPORT, 0, &sc.sc_mpu.ioh)) return (0); r = mpu_find(&sc.sc_mpu); bus_space_unmap(sc.sc_mpu.iot, sc.sc_mpu.ioh, MPU401_NPORT); if (r) { - ia->ia_iosize = MPU401_NPORT; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = MPU401_NPORT; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; } return (r); } @@ -102,16 +120,15 @@ mpu_isa_attach(parent, self, aux) printf("\n"); - if (bus_space_map(sc->sc_mpu.iot, ia->ia_iobase, MPU401_NPORT, 0, - &sc->sc_mpu.ioh)) { + if (bus_space_map(sc->sc_mpu.iot, ia->ia_io[0].ir_addr, MPU401_NPORT, + 0, &sc->sc_mpu.ioh)) { printf("mpu_isa_attach: bus_space_map failed\n"); return; } - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, IPL_AUDIO, - mpu_intr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_AUDIO, mpu_intr, sc); sc->sc_mpu.model = "Roland MPU-401 MIDI UART"; mpu_attach(&sc->sc_mpu); } - diff --git a/sys/dev/isa/nca_isa.c b/sys/dev/isa/nca_isa.c index 6319d63010a4..70a925a9b39c 100644 --- a/sys/dev/isa/nca_isa.c +++ b/sys/dev/isa/nca_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: nca_isa.c,v 1.8 2001/11/13 08:01:26 lukem Exp $ */ +/* $NetBSD: nca_isa.c,v 1.9 2002/01/07 21:47:11 thorpej Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nca_isa.c,v 1.8 2001/11/13 08:01:26 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nca_isa.c,v 1.9 2002/01/07 21:47:11 thorpej Exp $"); #include #include @@ -265,37 +265,46 @@ nca_isa_match(parent, match, aux) struct nca_isa_probe_data epd; int rv = 0; + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* See if we are looking for a port- or memory-mapped adapter */ - if (ia->ia_iobase != -1) { + if (ia->ia_nio > 0 || ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT) { /* Port-mapped card */ - if (bus_space_map(iot, ia->ia_iobase, NCA_ISA_IOSIZE, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, NCA_ISA_IOSIZE, + 0, &ioh)) return 0; /* See if a 53C80/53C400 is there */ rv = nca_isa_find(iot, ioh, 0x07, &epd); bus_space_unmap(iot, ioh, NCA_ISA_IOSIZE); - } else { + + if (rv) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = NCA_ISA_IOSIZE; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + } + } else if (ia->ia_niomem > 0) { /* Memory-mapped card */ - if (bus_space_map(memt, ia->ia_maddr, 0x4000, 0, &ioh)) + if (bus_space_map(memt, ia->ia_iomem[0].ir_addr, 0x4000, + 0, &ioh)) return 0; /* See if a 53C80/53C400 is somewhere in this para. */ rv = nca_isa_find(memt, ioh, 0x03ff0, &epd); bus_space_unmap(memt, ioh, 0x04000); - } - /* Adjust the attachment args if we found one */ - if (rv) { - if (ia->ia_iobase != -1) { - /* Port-mapped */ - ia->ia_iosize = NCA_ISA_IOSIZE; - } else { - /* Memory-mapped */ - ia->ia_maddr += epd.sc_reg_offset; - ia->ia_msize = NCA_ISA_IOSIZE; - ia->ia_iosize = 0; + if (rv) { + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_addr += epd.sc_reg_offset; + ia->ia_iomem[0].ir_size = NCA_ISA_IOSIZE; + + ia->ia_nio = 0; + ia->ia_ndrq = 0; } } @@ -320,16 +329,19 @@ nca_isa_attach(parent, self, aux) printf("\n"); - if (ia->ia_iobase != -1) { + if (ia->ia_nio > 0) { iot = ia->ia_iot; - if (bus_space_map(iot, ia->ia_iobase, NCA_ISA_IOSIZE, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, NCA_ISA_IOSIZE, + 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } } else { + KASSERT(ia->ia_niomem > 0); iot = ia->ia_memt; - if (bus_space_map(iot, ia->ia_maddr, NCA_ISA_IOSIZE, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_iomem[0].ir_addr, NCA_ISA_IOSIZE, + 0, &ioh)) { printf("%s: can't map mem space\n", sc->sc_dev.dv_xname); return; @@ -366,12 +378,12 @@ nca_isa_attach(parent, self, aux) sc->sc_rev = NCR_VARIANT_NCR53C400; break; case CTLR_PAS16: - printf("%s: ProAudio Spectrum 16 detected\n", sc->sc_dev.dv_xname); + printf("%s: ProAudio Spectrum 16 detected\n", + sc->sc_dev.dv_xname); sc->sc_rev = NCR_VARIANT_PAS16; break; } - /* * MD function pointers used by the MI code. */ @@ -387,11 +399,12 @@ nca_isa_attach(parent, self, aux) sc->sc_intr_on = NULL; sc->sc_intr_off = NULL; - if (ia->ia_irq != IRQUNK) { - esc->sc_ih = isa_intr_establish(ic, ia->ia_irq, IST_EDGE, - IPL_BIO, ncr5380_intr, esc); + if (ia->ia_nirq > 0 && ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT) { + esc->sc_ih = isa_intr_establish(ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_BIO, ncr5380_intr, esc); if (esc->sc_ih == NULL) { - printf("nca: couldn't establish interrupt\n"); + printf("%s: couldn't establish interrupt\n", + sc->sc_dev.dv_xname); return; } } else diff --git a/sys/dev/isa/opl_isa.c b/sys/dev/isa/opl_isa.c index c26a587d3744..3d46de9d0356 100644 --- a/sys/dev/isa/opl_isa.c +++ b/sys/dev/isa/opl_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: opl_isa.c,v 1.5 2001/11/13 08:01:27 lukem Exp $ */ +/* $NetBSD: opl_isa.c,v 1.6 2002/01/07 21:47:11 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: opl_isa.c,v 1.5 2001/11/13 08:01:27 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: opl_isa.c,v 1.6 2002/01/07 21:47:11 thorpej Exp $"); #include #include @@ -80,14 +80,29 @@ opl_isa_match(parent, match, aux) struct opl_softc sc; int r; + if (ia->ia_nio < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + memset(&sc, 0, sizeof sc); sc.iot = ia->ia_iot; - if (bus_space_map(sc.iot, ia->ia_iobase, OPL_SIZE, 0, &sc.ioh)) + if (bus_space_map(sc.iot, ia->ia_io[0].ir_addr, OPL_SIZE, 0, &sc.ioh)) return (0); r = opl_find(&sc); bus_space_unmap(sc.iot, sc.ioh, OPL_SIZE); - if (r != 0) - ia->ia_iosize = OPL_SIZE; + if (r != 0) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = OPL_SIZE; + + ia->ia_nirq = 0; + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + } return (r); } @@ -102,7 +117,8 @@ opl_isa_attach(parent, self, aux) sc->iot = ia->ia_iot; - if (bus_space_map(sc->iot, ia->ia_iobase, OPL_SIZE, 0, &sc->ioh)) { + if (bus_space_map(sc->iot, ia->ia_io[0].ir_addr, OPL_SIZE, + 0, &sc->ioh)) { printf("opl_isa_attach: bus_space_map failed\n"); return; } diff --git a/sys/dev/isa/pas.c b/sys/dev/isa/pas.c index f307cae1eff7..07e318668814 100644 --- a/sys/dev/isa/pas.c +++ b/sys/dev/isa/pas.c @@ -1,4 +1,4 @@ -/* $NetBSD: pas.c,v 1.51 2001/11/13 08:01:27 lukem Exp $ */ +/* $NetBSD: pas.c,v 1.52 2002/01/07 21:47:11 thorpej Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -57,7 +57,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pas.c,v 1.51 2001/11/13 08:01:27 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pas.c,v 1.52 2002/01/07 21:47:11 thorpej Exp $"); #include #include @@ -275,10 +275,20 @@ pasprobe(parent, match, aux) struct cfdata *match; void *aux; { + struct isa_attach_args *ia = aux; struct pas_softc probesc, *sc = &probesc; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + memset(sc, 0, sizeof *sc); - sc->sc_sbdsp.sc_dev.dv_cfdata = match; strcpy(sc->sc_sbdsp.sc_dev.dv_xname, "pas"); return pasfind(parent, sc, aux, PASPROBE); } @@ -298,8 +308,9 @@ pasfind(parent, sc, ia, probing) int rc = 0; /* failure */ /* ensure we can set this up as a sound blaster */ - if (!SB_BASE_VALID(ia->ia_iobase)) { - printf("pas: configured SB iobase 0x%x invalid\n", ia->ia_iobase); + if (!SB_BASE_VALID(ia->ia_io[0].ir_addr)) { + printf("pas: configured SB iobase 0x%x invalid\n", + ia->ia_io[0].ir_addr); return 0; } @@ -371,11 +382,12 @@ pasfind(parent, sc, ia, probing) } if (sc->model >= 0) { - if (ia->ia_irq == IRQUNK) { + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) { printf("pas: sb emulation requires known irq\n"); goto unmap1; } - pasconf(sc->model, ia->ia_iobase, ia->ia_irq, 1); + pasconf(sc->model, ia->ia_io[0].ir_addr, + ia->ia_irq[0].ir_irq, 1); } else { DPRINTF(("pas: could not probe pas\n")); goto unmap1; @@ -385,14 +397,14 @@ pasfind(parent, sc, ia, probing) * appropriately */ - sc->sc_sbdsp.sc_iobase = ia->ia_iobase; + sc->sc_sbdsp.sc_iobase = ia->ia_io[0].ir_addr; sc->sc_sbdsp.sc_iot = ia->ia_iot; /* Map i/o space [we map 24 ports which is the max of the sb and pro */ - if (bus_space_map(sc->sc_sbdsp.sc_iot, ia->ia_iobase, SBP_NPORT, 0, - &sc->sc_sbdsp.sc_ioh)) { + if (bus_space_map(sc->sc_sbdsp.sc_iot, ia->ia_io[0].ir_addr, + SBP_NPORT, 0, &sc->sc_sbdsp.sc_ioh)) { printf("pas: can't map i/o space 0x%x/%d in probe\n", - ia->ia_iobase, SBP_NPORT); + ia->ia_io[0].ir_addr, SBP_NPORT); goto unmap1; } @@ -404,30 +416,19 @@ pasfind(parent, sc, ia, probing) /* * Cannot auto-discover DMA channel. */ - if (!SB_DRQ_VALID(ia->ia_drq)) { - printf("pas: configured dma chan %d invalid\n", ia->ia_drq); + if (!SB_DRQ_VALID(ia->ia_drq[0].ir_drq)) { + printf("pas: configured dma chan %d invalid\n", + ia->ia_drq[0].ir_drq); goto unmap; } -#ifdef NEWCONFIG - /* - * If the IRQ wasn't compiled in, auto-detect it. - */ - if (ia->ia_irq == IRQUNK) { - ia->ia_irq = isa_discoverintr(pasforceintr, aux); - sbdsp_reset(&sc->sc_sbdsp); - if (!SB_IRQ_VALID(ia->ia_irq)) { - printf("pas: couldn't auto-detect interrupt"); - goto unmap; - } - } else -#endif - if (!SB_IRQ_VALID(ia->ia_irq)) { - printf("pas: configured irq chan %d invalid\n", ia->ia_irq); + if (!SB_IRQ_VALID(ia->ia_irq[0].ir_irq)) { + printf("pas: configured irq chan %d invalid\n", + ia->ia_drq[0].ir_drq); goto unmap; } - sc->sc_sbdsp.sc_irq = ia->ia_irq; - sc->sc_sbdsp.sc_drq8 = ia->ia_drq; + sc->sc_sbdsp.sc_irq = ia->ia_irq[0].ir_irq; + sc->sc_sbdsp.sc_drq8 = ia->ia_drq[0].ir_drq; sc->sc_sbdsp.sc_drq16 = -1; /* XXX */ if (sbdsp_probe(&sc->sc_sbdsp) == 0) { @@ -436,45 +437,27 @@ pasfind(parent, sc, ia, probing) } rc = 1; - ia->ia_iosize = SB_NPORT; + + if (probing) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = SBP_NPORT; + + ia->ia_nirq = 1; + ia->ia_ndrq = 1; + + ia->ia_niomem = 0; + } unmap: if (rc == 0 || probing) - bus_space_unmap(sc->sc_sbdsp.sc_iot, sc->sc_sbdsp.sc_ioh, SBP_NPORT); + bus_space_unmap(sc->sc_sbdsp.sc_iot, sc->sc_sbdsp.sc_ioh, + SBP_NPORT); unmap1: if (rc == 0 || probing) bus_space_unmap(sc->sc_sbdsp.sc_iot, PAS_DEFAULT_BASE, 1); return rc; } -#ifdef NEWCONFIG -void -pasforceintr(aux) - void *aux; -{ - static char dmabuf; - struct isa_attach_args *ia = aux; - int iobase = ia->ia_iobase; - - /* - * Set up a DMA read of one byte. - * XXX Note that at this point we haven't called - * at_setup_dmachan(). This is okay because it just - * allocates a buffer in case it needs to make a copy, - * and it won't need to make a copy for a 1 byte buffer. - * (I think that calling at_setup_dmachan() should be optional; - * if you don't call it, it will be called the first time - * it is needed (and you pay the latency). Also, you might - * never need the buffer anyway.) - */ - at_dma(DMAMODE_READ, &dmabuf, 1, ia->ia_drq); - if (pas_wdsp(iobase, SB_DSP_RDMA) == 0) { - (void)pas_wdsp(iobase, 0); - (void)pas_wdsp(iobase, 0); - } -} -#endif - /* * Attach hardware to driver, attach hardware driver to audio * pseudo-device driver . @@ -486,7 +469,7 @@ pasattach(parent, self, aux) { struct pas_softc *sc = (struct pas_softc *)self; struct isa_attach_args *ia = (struct isa_attach_args *)aux; - int iobase = ia->ia_iobase; + int iobase = ia->ia_io[0].ir_addr; if (!pasfind(parent, sc, ia, PASATTACH)) { printf("%s: pasfind failed\n", sc->sc_sbdsp.sc_dev.dv_xname); @@ -495,7 +478,7 @@ pasattach(parent, self, aux) sc->sc_sbdsp.sc_ic = ia->ia_ic; sc->sc_sbdsp.sc_iobase = iobase; - sc->sc_sbdsp.sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, + sc->sc_sbdsp.sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_AUDIO, sbdsp_intr, &sc->sc_sbdsp); printf(" ProAudio Spectrum %s [rev %d] ", pasnames[sc->model], diff --git a/sys/dev/isa/pcdisplay.c b/sys/dev/isa/pcdisplay.c index 066fcf85bf63..9eaa410d19d0 100644 --- a/sys/dev/isa/pcdisplay.c +++ b/sys/dev/isa/pcdisplay.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcdisplay.c,v 1.15 2001/12/16 22:33:35 thorpej Exp $ */ +/* $NetBSD: pcdisplay.c,v 1.16 2002/01/07 21:47:12 thorpej Exp $ */ /* * Copyright (c) 1998 @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcdisplay.c,v 1.15 2001/12/16 22:33:35 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcdisplay.c,v 1.16 2002/01/07 21:47:12 thorpej Exp $"); #include #include @@ -235,33 +235,57 @@ pcdisplay_match(parent, match, aux) struct isa_attach_args *ia = aux; int mono; + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* If values are hardwired to something that they can't be, punt. */ - if ((ia->ia_iobase != IOBASEUNK && - ia->ia_iobase != 0x3d0 && - ia->ia_iobase != 0x3b0) || - /* ia->ia_iosize != 0 || XXX isa.c */ - (ia->ia_maddr != MADDRUNK && - ia->ia_maddr != 0xb8000 && - ia->ia_maddr != 0xb0000) || - (ia->ia_msize != 0 && ia->ia_msize != 0x8000) || - ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK) + if (ia->ia_nio < 1 || + (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT && + ia->ia_io[0].ir_addr != 0x3d0 && + ia->ia_io[0].ir_addr != 0x3b0)) + return (0); + + if (ia->ia_niomem < 1 || + (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT && + ia->ia_iomem[0].ir_addr != 0xb8000 && + ia->ia_iomem[0].ir_addr != 0xb0000)) + return (0); + if (ia->ia_iomem[0].ir_size != 0 && + ia->ia_iomem[0].ir_size != 0x8000) + return (0); + + if (ia->ia_nirq > 0 && + ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT) + return (0); + + if (ia->ia_ndrq > 0 && + ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT) return (0); if (pcdisplay_is_console(ia->ia_iot)) mono = pcdisplay_console_dc.mono; - else if (ia->ia_iobase != 0x3b0 && ia->ia_maddr != 0xb0000 && + else if (ia->ia_io[0].ir_addr != 0x3b0 && + ia->ia_iomem[0].ir_addr != 0xb0000 && pcdisplay_probe_col(ia->ia_iot, ia->ia_memt)) mono = 0; - else if (ia->ia_iobase != 0x3d0 && ia->ia_maddr != 0xb8000 && + else if (ia->ia_io[0].ir_addr != 0x3d0 && + ia->ia_iomem[0].ir_addr != 0xb8000 && pcdisplay_probe_mono(ia->ia_iot, ia->ia_memt)) mono = 1; else return (0); - ia->ia_iobase = mono ? 0x3b0 : 0x3d0; - ia->ia_iosize = 0x10; - ia->ia_maddr = mono ? 0xb0000 : 0xb8000; - ia->ia_msize = 0x8000; + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = mono ? 0x3b0 : 0x3d0; + ia->ia_io[0].ir_size = 0x10; + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_size = mono ? 0xb0000 : 0xb8000; + ia->ia_iomem[0].ir_size = 0x8000; + + ia->ia_nirq = 0; + ia->ia_ndrq = 0; + return (1); } @@ -287,10 +311,12 @@ pcdisplay_attach(parent, self, aux) } else { dc = malloc(sizeof(struct pcdisplay_config), M_DEVBUF, M_WAITOK); - if (ia->ia_iobase != 0x3b0 && ia->ia_maddr != 0xb0000 && + if (ia->ia_io[0].ir_addr != 0x3b0 && + ia->ia_iomem[0].ir_addr != 0xb0000 && pcdisplay_probe_col(ia->ia_iot, ia->ia_memt)) pcdisplay_init(dc, ia->ia_iot, ia->ia_memt, 0); - else if (ia->ia_iobase != 0x3d0 && ia->ia_maddr != 0xb8000 && + else if (ia->ia_io[0].ir_addr != 0x3d0 && + ia->ia_iomem[0].ir_addr != 0xb8000 && pcdisplay_probe_mono(ia->ia_iot, ia->ia_memt)) pcdisplay_init(dc, ia->ia_iot, ia->ia_memt, 1); else diff --git a/sys/dev/isa/pckbc_isa.c b/sys/dev/isa/pckbc_isa.c index 85b850738a20..79c2ce95dba4 100644 --- a/sys/dev/isa/pckbc_isa.c +++ b/sys/dev/isa/pckbc_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: pckbc_isa.c,v 1.5 2001/11/13 08:01:28 lukem Exp $ */ +/* $NetBSD: pckbc_isa.c,v 1.6 2002/01/07 21:47:12 thorpej Exp $ */ /* * Copyright (c) 1998 @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pckbc_isa.c,v 1.5 2001/11/13 08:01:28 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pckbc_isa.c,v 1.6 2002/01/07 21:47:12 thorpej Exp $"); #include #include @@ -79,11 +79,26 @@ pckbc_isa_match(parent, match, aux) bus_space_handle_t ioh_d, ioh_c; int res, ok = 1; + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* If values are hardwired to something that they can't be, punt. */ - if ((ia->ia_iobase != IOBASEUNK && ia->ia_iobase != IO_KBD) || - ia->ia_maddr != MADDRUNK || - (ia->ia_irq != IRQUNK && ia->ia_irq != 1 /* XXX */) || - ia->ia_drq != DRQUNK) + if (ia->ia_nio < 1 || + (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT && + ia->ia_io[0].ir_addr != IO_KBD)) + return (0); + + if (ia->ia_niomem > 0 && + (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT)) + return (0); + + if (ia->ia_nirq < 1 || + (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != 1 /*XXX*/)) + return (0); + + if (ia->ia_ndrq > 0 && + (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT)) return (0); if (pckbc_is_console(iot, IO_KBD) == 0) { @@ -120,9 +135,13 @@ pckbc_isa_match(parent, match, aux) } if (ok) { - ia->ia_iobase = IO_KBD; - ia->ia_iosize = 5; - ia->ia_msize = 0x0; + ia->ia_io[0].ir_addr = IO_KBD; + ia->ia_io[0].ir_size = 5; + ia->ia_nio = 1; + + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; } return (ok); } @@ -142,13 +161,25 @@ pckbc_isa_attach(parent, self, aux) isc->sc_ic = ia->ia_ic; iot = ia->ia_iot; - /* - * Set up IRQs for "normal" ISA. - * - * XXX The "aux" slot is different (9) on the Alpha AXP150 Jensen. - */ - isc->sc_irq[PCKBC_KBD_SLOT] = 1; - isc->sc_irq[PCKBC_AUX_SLOT] = 12; + switch (ia->ia_nirq) { + case 1: + /* Both channels use the same IRQ. */ + isc->sc_irq[PCKBC_KBD_SLOT] = + isc->sc_irq[PCKBC_AUX_SLOT] = ia->ia_irq[0].ir_irq; + break; + + case 2: + /* First IRQ is kbd, second IRQ is aux port. */ + isc->sc_irq[PCKBC_KBD_SLOT] = ia->ia_irq[0].ir_irq; + isc->sc_irq[PCKBC_AUX_SLOT] = ia->ia_irq[1].ir_irq; + break; + + default: + /* Set up IRQs for "normal" ISA. */ + isc->sc_irq[PCKBC_KBD_SLOT] = 1; + isc->sc_irq[PCKBC_AUX_SLOT] = 12; + break; + } sc->intr_establish = pckbc_isa_intr_establish; diff --git a/sys/dev/isa/pcppi.c b/sys/dev/isa/pcppi.c index 598cee0de399..8cde77a34bca 100644 --- a/sys/dev/isa/pcppi.c +++ b/sys/dev/isa/pcppi.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcppi.c,v 1.5 2001/11/13 08:01:28 lukem Exp $ */ +/* $NetBSD: pcppi.c,v 1.6 2002/01/07 21:47:12 thorpej Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.5 2001/11/13 08:01:28 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.6 2002/01/07 21:47:12 thorpej Exp $"); #include #include @@ -90,10 +90,25 @@ pcppi_match(parent, match, aux) int have_pit1, have_ppi, rv; u_int8_t v, nv; + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* If values are hardwired to something that they can't be, punt. */ - if ((ia->ia_iobase != IOBASEUNK && ia->ia_iobase != IO_PPI) || - ia->ia_maddr != MADDRUNK || ia->ia_msize != 0 || - ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK) + if (ia->ia_nio < 1 || + (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT && + ia->ia_io[0].ir_addr != IO_PPI)) + return (0); + + if (ia->ia_niomem > 0 && + (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT)) + return (0); + + if (ia->ia_nirq > 0 && + (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT)) + return (0); + + if (ia->ia_ndrq > 0 && + (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT)) return (0); rv = 0; @@ -139,9 +154,13 @@ lose: if (have_ppi) bus_space_unmap(ia->ia_iot, ppi_ioh, 1); if (rv) { - ia->ia_iobase = IO_PPI; - ia->ia_iosize = 0x1; - ia->ia_msize = 0x0; + ia->ia_io[0].ir_addr = IO_PPI; + ia->ia_io[0].ir_size = 1; + ia->ia_nio = 1; + + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; } return (rv); } diff --git a/sys/dev/isa/pss.c b/sys/dev/isa/pss.c index 6801d6c73722..1ab3ad36e212 100644 --- a/sys/dev/isa/pss.c +++ b/sys/dev/isa/pss.c @@ -1,4 +1,6 @@ -/* $NetBSD: pss.c,v 1.58 2001/11/13 08:01:28 lukem Exp $ */ +/* $NetBSD: pss.c,v 1.59 2002/01/07 21:47:12 thorpej Exp $ */ + +/* XXX THIS DRIVER IS BROKEN. IT WILL NOT EVEN COMPILE. */ /* * Copyright (c) 1994 John Brezak @@ -51,7 +53,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pss.c,v 1.58 2001/11/13 08:01:28 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pss.c,v 1.59 2002/01/07 21:47:12 thorpej Exp $"); #include #include diff --git a/sys/dev/isa/radiotrack.c b/sys/dev/isa/radiotrack.c index 1932b6114033..0d0f2056ae7e 100644 --- a/sys/dev/isa/radiotrack.c +++ b/sys/dev/isa/radiotrack.c @@ -1,4 +1,4 @@ -/* $NetBSD: radiotrack.c,v 1.4 2002/01/03 18:13:19 augustss Exp $ */ +/* $NetBSD: radiotrack.c,v 1.5 2002/01/07 21:47:14 thorpej Exp $ */ /* $OpenBSD: radiotrack.c,v 1.1 2001/12/05 10:27:06 mickey Exp $ */ /* $RuOBSD: radiotrack.c,v 1.3 2001/10/18 16:51:36 pva Exp $ */ @@ -135,7 +135,15 @@ rt_probe(struct device *parent, struct cfdata *cf, void *aux) bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; u_int r; - int iosize = 1, iobase = ia->ia_iobase; + int iosize = 1, iobase; + + if (ISA_DIRECT_CONFIG(ia)) + return 0; + + if (ia->ia_nio < 1) + return (0); + + iobase = ia->ia_io[0].ir_addr; if (!RT_BASE_VALID(iobase)) { printf("rt: configured iobase 0x%x invalid\n", iobase); @@ -149,9 +157,18 @@ rt_probe(struct device *parent, struct cfdata *cf, void *aux) bus_space_unmap(iot, ioh, iosize); - ia->ia_iosize = iosize; + if (r != 0) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = iosize; - return (r != 0); + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; + + return (1); + } + + return (0); } void @@ -168,11 +185,11 @@ rt_attach(struct device *parent, struct device *self, void *aux) sc->vol = 0; /* remap I/O */ - if (bus_space_map(sc->lm.iot, ia->ia_iobase, ia->ia_iosize, - 0, &sc->lm.ioh)) + if (bus_space_map(sc->lm.iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &sc->lm.ioh)) panic(": bus_space_map() of %s failed", sc->sc_dev.dv_xname); - switch (sc->lm.iot) { + switch (ia->ia_io[0].ir_addr) { case 0x20C: /* FALLTHROUGH */ case 0x30C: diff --git a/sys/dev/isa/radiotrack2.c b/sys/dev/isa/radiotrack2.c index c6b894181681..f1c32711d7c9 100644 --- a/sys/dev/isa/radiotrack2.c +++ b/sys/dev/isa/radiotrack2.c @@ -1,4 +1,4 @@ -/* $NetBSD: radiotrack2.c,v 1.3 2002/01/03 18:13:19 augustss Exp $ */ +/* $NetBSD: radiotrack2.c,v 1.4 2002/01/07 21:47:14 thorpej Exp $ */ /* $OpenBSD: radiotrack2.c,v 1.1 2001/12/05 10:27:06 mickey Exp $ */ /* $RuOBSD: radiotrack2.c,v 1.2 2001/10/18 16:51:36 pva Exp $ */ @@ -125,7 +125,15 @@ rtii_probe(struct device *parent, struct cfdata *cf, void *aux) bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; u_int r; - int iosize = 1, iobase = ia->ia_iobase; + int iosize = 1, iobase; + + if (ISA_DIRECT_CONFIG(ia)) + return 0; + + if (ia->ia_nio < 1) + return 0; + + iobase = ia->ia_io[0].ir_addr; if (!RTII_BASE_VALID(iobase)) { printf("rtii: configured iobase 0x%x invalid\n", iobase); @@ -139,9 +147,18 @@ rtii_probe(struct device *parent, struct cfdata *cf, void *aux) bus_space_unmap(iot, ioh, iosize); - ia->ia_iosize = iosize; + if (r != 0) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = iosize; - return (r != 0); + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; + + return (1); + } + + return (0); } void @@ -158,8 +175,8 @@ rtii_attach(struct device *parent, struct device *self, void *aux) sc->lock = TEA5757_S030; /* remap I/O */ - if (bus_space_map(sc->tea.iot, ia->ia_iobase, ia->ia_iosize, - 0, &sc->tea.ioh)) + if (bus_space_map(sc->tea.iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &sc->tea.ioh)) panic("rtiiattach: bus_space_map() failed"); sc->tea.offset = 0; diff --git a/sys/dev/isa/rtfps.c b/sys/dev/isa/rtfps.c index b3ed0566dffa..7e9c6a32d0c5 100644 --- a/sys/dev/isa/rtfps.c +++ b/sys/dev/isa/rtfps.c @@ -1,4 +1,4 @@ -/* $NetBSD: rtfps.c,v 1.41 2001/11/13 08:01:29 lukem Exp $ */ +/* $NetBSD: rtfps.c,v 1.42 2002/01/07 21:47:12 thorpej Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtfps.c,v 1.41 2001/11/13 08:01:29 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtfps.c,v 1.42 2002/01/07 21:47:12 thorpej Exp $"); #include #include @@ -82,10 +82,9 @@ rtfpsprobe(parent, self, aux) void *aux; { struct isa_attach_args *ia = aux; - int iobase = ia->ia_iobase; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; - int i, rv = 1; + int i, iobase, rv = 1; /* * Do the normal com probe for the first UART and assume @@ -94,15 +93,22 @@ rtfpsprobe(parent, self, aux) * XXX Needs more robustness. */ + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return (0); /* if the first port is in use as console, then it. */ - if (com_is_console(iot, iobase, 0)) + if (com_is_console(iot, ia->ia_io[0].ir_addr, 0)) goto checkmappings; - if (bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, COM_NPORTS, 0, &ioh)) { rv = 0; goto out; } @@ -112,7 +118,7 @@ rtfpsprobe(parent, self, aux) goto out; checkmappings: - for (i = 1; i < NSLAVES; i++) { + for (i = 1, iobase = ia->ia_io[0].ir_addr; i < NSLAVES; i++) { iobase += COM_NPORTS; if (com_is_console(iot, iobase, 0)) @@ -126,8 +132,15 @@ checkmappings: } out: - if (rv) - ia->ia_iosize = NSLAVES * COM_NPORTS; + if (rv) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = NSLAVES * COM_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + } return (rv); } @@ -153,24 +166,27 @@ rtfpsattach(parent, self, aux) struct isa_attach_args *ia = aux; struct commulti_attach_args ca; static int irqport[] = { - IOBASEUNK, IOBASEUNK, IOBASEUNK, IOBASEUNK, - IOBASEUNK, IOBASEUNK, IOBASEUNK, IOBASEUNK, - IOBASEUNK, 0x2f2, 0x6f2, 0x6f3, - IOBASEUNK, IOBASEUNK, IOBASEUNK, IOBASEUNK + ISACF_PORT_DEFAULT, ISACF_PORT_DEFAULT, ISACF_PORT_DEFAULT, + ISACF_PORT_DEFAULT, ISACF_PORT_DEFAULT, ISACF_PORT_DEFAULT, + ISACF_PORT_DEFAULT, ISACF_PORT_DEFAULT, ISACF_PORT_DEFAULT, + 0x2f2, 0x6f2, 0x6f3, + ISACF_PORT_DEFAULT, ISACF_PORT_DEFAULT, ISACF_PORT_DEFAULT, + ISACF_PORT_DEFAULT }; bus_space_tag_t iot = ia->ia_iot; - int i, iobase; + int i, iobase, irq; printf("\n"); sc->sc_iot = ia->ia_iot; - sc->sc_iobase = ia->ia_iobase; + sc->sc_iobase = ia->ia_io[0].ir_addr; + irq = ia->ia_irq[0].ir_irq; - if (ia->ia_irq >= 16 || irqport[ia->ia_irq] == IOBASEUNK) { + if (irq >= 16 || irqport[irq] == ISACF_PORT_DEFAULT) { printf("%s: invalid irq\n", sc->sc_dev.dv_xname); return; } - sc->sc_irqport = irqport[ia->ia_irq]; + sc->sc_irqport = irqport[irq]; for (i = 0; i < NSLAVES; i++) { iobase = sc->sc_iobase + i * COM_NPORTS; @@ -202,7 +218,7 @@ rtfpsattach(parent, self, aux) sc->sc_alive |= 1 << i; } - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, + sc->sc_ih = isa_intr_establish(ia->ia_ic, irq, IST_EDGE, IPL_SERIAL, rtfpsintr, sc); } diff --git a/sys/dev/isa/satlink.c b/sys/dev/isa/satlink.c index d139812b4a2a..7b6b0b021982 100644 --- a/sys/dev/isa/satlink.c +++ b/sys/dev/isa/satlink.c @@ -1,4 +1,4 @@ -/* $NetBSD: satlink.c,v 1.14 2001/11/13 08:01:29 lukem Exp $ */ +/* $NetBSD: satlink.c,v 1.15 2002/01/07 21:47:12 thorpej Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: satlink.c,v 1.14 2001/11/13 08:01:29 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: satlink.c,v 1.15 2002/01/07 21:47:12 thorpej Exp $"); #include #include @@ -123,13 +123,21 @@ satlinkprobe(parent, match, aux) bus_space_handle_t ioh; int rv = 0; - /* Don't allow wildcarding of iobase or drq. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_nio < 1) return (0); - if (ia->ia_drq == ISACF_DRQ_DEFAULT) + if (ia->ia_ndrq < 1) return (0); - if (bus_space_map(iot, ia->ia_iobase, SATLINK_IOSIZE, 0, &ioh)) + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + /* Don't allow wildcarding of iobase or drq. */ + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_drq[0].ir_drq == ISACF_DRQ_DEFAULT) + return (0); + + if (bus_space_map(iot, ia->ia_io[0].ir_addr, SATLINK_IOSIZE, 0, &ioh)) return (0); /* @@ -137,8 +145,14 @@ satlinkprobe(parent, match, aux) */ rv = 1; - ia->ia_iosize = SATLINK_IOSIZE; - ia->ia_msize = 0; + + ia->ia_nio = 1; + ia->ia_io[0].ir_size = SATLINK_IOSIZE; + + ia->ia_ndrq = 1; + + ia->ia_nirq = 0; + ia->ia_niomem = 0; bus_space_unmap(iot, ioh, SATLINK_IOSIZE); return (rv); @@ -158,7 +172,7 @@ satlinkattach(parent, self, aux) printf("\n"); /* Map the card. */ - if (bus_space_map(iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, SATLINK_IOSIZE, 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } @@ -166,7 +180,7 @@ satlinkattach(parent, self, aux) sc->sc_iot = iot; sc->sc_ioh = ioh; sc->sc_ic = ia->ia_ic; - sc->sc_drq = ia->ia_drq; + sc->sc_drq = ia->ia_drq[0].ir_drq; /* Reset the card. */ bus_space_write_1(iot, ioh, SATLINK_COMMAND, SATLINK_CMD_RESET); diff --git a/sys/dev/isa/sb_isa.c b/sys/dev/isa/sb_isa.c index 5b747e929bbf..1ed2acc7f583 100644 --- a/sys/dev/isa/sb_isa.c +++ b/sys/dev/isa/sb_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: sb_isa.c,v 1.24 2001/11/13 08:01:30 lukem Exp $ */ +/* $NetBSD: sb_isa.c,v 1.25 2002/01/07 21:47:12 thorpej Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sb_isa.c,v 1.24 2001/11/13 08:01:30 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sb_isa.c,v 1.25 2002/01/07 21:47:12 thorpej Exp $"); #include #include @@ -60,7 +60,8 @@ __KERNEL_RCSID(0, "$NetBSD: sb_isa.c,v 1.24 2001/11/13 08:01:30 lukem Exp $"); #include -static int sbfind __P((struct device *, struct sbdsp_softc *, struct isa_attach_args *)); +static int sbfind __P((struct device *, struct sbdsp_softc *, int, + struct isa_attach_args *)); int sb_isa_match __P((struct device *, struct cfdata *, void *)); void sb_isa_attach __P((struct device *, struct device *, void *)); @@ -82,24 +83,36 @@ sb_isa_match(parent, match, aux) struct cfdata *match; void *aux; { + struct isa_attach_args *ia = aux; struct sbdsp_softc probesc, *sc = &probesc; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + memset(sc, 0, sizeof *sc); - sc->sc_dev.dv_cfdata = match; strcpy(sc->sc_dev.dv_xname, "sb"); - return sbfind(parent, sc, aux); + return sbfind(parent, sc, 1, aux); } static int -sbfind(parent, sc, ia) +sbfind(parent, sc, probing, ia) struct device *parent; struct sbdsp_softc *sc; + int probing; struct isa_attach_args *ia; { int rc = 0; - if (!SB_BASE_VALID(ia->ia_iobase)) { - printf("sb: configured iobase 0x%x invalid\n", ia->ia_iobase); + if (!SB_BASE_VALID(ia->ia_io[0].ir_addr)) { + printf("sb: configured iobase 0x%x invalid\n", + ia->ia_io[0].ir_addr); return 0; } @@ -107,32 +120,40 @@ sbfind(parent, sc, ia) sc->sc_iot = ia->ia_iot; /* Map i/o space [we map 24 ports which is the max of the sb and pro */ - if (bus_space_map(sc->sc_iot, ia->ia_iobase, SBP_NPORT, 0, + if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, SBP_NPORT, 0, &sc->sc_ioh)) return 0; /* XXX These are only for setting chip configuration registers. */ - sc->sc_iobase = ia->ia_iobase; - sc->sc_irq = ia->ia_irq; + sc->sc_iobase = ia->ia_io[0].ir_addr; + sc->sc_irq = ia->ia_irq[0].ir_irq; - sc->sc_drq8 = ia->ia_drq; - sc->sc_drq16 = ia->ia_drq2; + sc->sc_drq8 = ia->ia_drq[0].ir_drq; + sc->sc_drq16 = ia->ia_drq[1].ir_drq; if (!sbmatch(sc)) goto bad; - if (ISSBPROCLASS(sc)) - ia->ia_iosize = SBP_NPORT; - else - ia->ia_iosize = SB_NPORT; - - if (!ISSB16CLASS(sc) && sc->sc_model != SB_JAZZ) - ia->ia_drq2 = -1; - - ia->ia_irq = sc->sc_irq; - rc = 1; + if (probing) { + ia->ia_nio = 1; + if (ISSBPROCLASS(sc)) + ia->ia_io[0].ir_size = SBP_NPORT; + else + ia->ia_io[0].ir_size = SB_NPORT; + + if (!ISSB16CLASS(sc) && sc->sc_model != SB_JAZZ) + ia->ia_ndrq = 1; + else + ia->ia_ndrq = 2; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = sc->sc_irq; + + ia->ia_niomem = 0; + } + bad: bus_space_unmap(sc->sc_iot, sc->sc_ioh, SBP_NPORT); return rc; @@ -151,15 +172,15 @@ sb_isa_attach(parent, self, aux) struct sbdsp_softc *sc = (struct sbdsp_softc *)self; struct isa_attach_args *ia = aux; - if (!sbfind(parent, sc, ia) || - bus_space_map(sc->sc_iot, ia->ia_iobase, ia->ia_iosize, - 0, &sc->sc_ioh)) { + if (!sbfind(parent, sc, 0, ia) || + bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &sc->sc_ioh)) { printf("%s: sbfind failed\n", sc->sc_dev.dv_xname); return; } - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_AUDIO, sbdsp_intr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_AUDIO, sbdsp_intr, sc); sbattach(sc); } diff --git a/sys/dev/isa/seagate.c b/sys/dev/isa/seagate.c index 8919bd31ba73..5ef641631acf 100644 --- a/sys/dev/isa/seagate.c +++ b/sys/dev/isa/seagate.c @@ -1,4 +1,4 @@ -/* $NetBSD: seagate.c,v 1.44 2001/11/15 09:48:09 lukem Exp $ */ +/* $NetBSD: seagate.c,v 1.45 2002/01/07 21:47:13 thorpej Exp $ */ /* * ST01/02, Future Domain TMC-885, TMC-950 SCSI driver @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: seagate.c,v 1.44 2001/11/15 09:48:09 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: seagate.c,v 1.45 2002/01/07 21:47:13 thorpej Exp $"); #include #include @@ -338,20 +338,22 @@ seaprobe(parent, match, aux) int i, type = 0; caddr_t maddr; - /* - * Could try to find a board by looking through all possible addresses. - * This is not done the right way now, because I have not found a way - * to get a boards virtual memory address given its physical. There is - * a function that returns the physical address for a given virtual - * address, but not the other way around. - */ + if (ia->ia_niomem < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + if (ia->ia_iomem[0].ir_addr == ISACF_IOMEM_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) + return (0); + + /* XXX XXX XXX */ + maddr = ISA_HOLE_VADDR(ia->ia_iomem[0].ir_addr); - if (ia->ia_maddr == MADDRUNK) { - /* XXX */ - return 0; - } else - maddr = ISA_HOLE_VADDR(ia->ia_maddr); - /* check board type */ /* No way to define this through config */ for (i = 0; i < nsignatures; i++) if (!memcmp(maddr + signatures[i].offset, @@ -374,9 +376,14 @@ seaprobe(parent, match, aux) return 0; } - ia->ia_drq = DRQUNK; - ia->ia_msize = 0x2000; - ia->ia_iosize = 0; + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_size = 0x2000; + + ia->ia_nirq = 1; + + ia->ia_nio = 0; + ia->ia_ndrq = 0; + return 1; } @@ -394,7 +401,8 @@ seaattach(parent, self, aux) struct scsipi_channel *chan = &sea->sc_channel; int i; - sea->maddr = ISA_HOLE_VADDR(ia->ia_maddr); + /* XXX XXX XXX */ + sea->maddr = ISA_HOLE_VADDR(ia->ia_iomem[0].ir_addr); /* check board type */ /* No way to define this through config */ for (i = 0; i < nsignatures; i++) @@ -464,8 +472,8 @@ seaattach(parent, self, aux) printf("\n"); - sea->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_BIO, seaintr, sea); + sea->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_BIO, seaintr, sea); /* * ask the adapter what subunits are present diff --git a/sys/dev/isa/sf16fmr2.c b/sys/dev/isa/sf16fmr2.c index 077d88859d57..89b07064ec30 100644 --- a/sys/dev/isa/sf16fmr2.c +++ b/sys/dev/isa/sf16fmr2.c @@ -1,4 +1,4 @@ -/* $NetBSD: sf16fmr2.c,v 1.3 2002/01/03 18:13:20 augustss Exp $ */ +/* $NetBSD: sf16fmr2.c,v 1.4 2002/01/07 21:47:15 thorpej Exp $ */ /* $OpenBSD: sf16fmr2.c,v 1.3 2001/12/18 18:48:08 mickey Exp $ */ /* $RuOBSD: sf16fmr2.c,v 1.12 2001/10/18 16:51:36 pva Exp $ */ @@ -125,7 +125,15 @@ sf2r_probe(struct device *parent, struct cfdata *cf, void *aux) bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; u_int r; - int iosize = 1, iobase = ia->ia_iobase; + int iosize = 1, iobase; + + if (ISA_DIRECT_CONFIG(ia)) + return 0; + + if (ia->ia_nio < 1) + return 0; + + iobase = ia->ia_io[0].ir_addr; if (!SF16FMR2_BASE_VALID(iobase)) { printf("sf2r: configured iobase 0x%x invalid\n", iobase); @@ -139,9 +147,18 @@ sf2r_probe(struct device *parent, struct cfdata *cf, void *aux) bus_space_unmap(iot, ioh, iosize); - ia->ia_iosize = iosize; + if (r != 0) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = iosize; - return (r != 0); + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; + + return (1); + } + + return (0); } void @@ -158,8 +175,8 @@ sf2r_attach(struct device *parent, struct device *self, void *aux) sc->lock = TEA5757_S030; /* remap I/O */ - if (bus_space_map(sc->tea.iot, ia->ia_iobase, ia->ia_iosize, - 0, &sc->tea.ioh)) + if (bus_space_map(sc->tea.iot, ia->ia_io[0].ir_addr, + ia->ia_io[0].ir_size, 0, &sc->tea.ioh)) panic("sf2rattach: bus_space_map() failed"); sc->tea.offset = 0; diff --git a/sys/dev/isa/tcic2_isa.c b/sys/dev/isa/tcic2_isa.c index 8414c09132f5..d10742cdd05f 100644 --- a/sys/dev/isa/tcic2_isa.c +++ b/sys/dev/isa/tcic2_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcic2_isa.c,v 1.5 2001/11/15 09:48:10 lukem Exp $ */ +/* $NetBSD: tcic2_isa.c,v 1.6 2002/01/07 21:47:13 thorpej Exp $ */ /* * @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcic2_isa.c,v 1.5 2001/11/15 09:48:10 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcic2_isa.c,v 1.6 2002/01/07 21:47:13 thorpej Exp $"); #undef TCICISADEBUG @@ -148,20 +148,35 @@ tcic_isa_probe(parent, match, aux) struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh, memh; - int val, found; + int val, found, msize; + + if (ia->ia_nio < 1) + return (0); + if (ia->ia_niomem < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_iomem[0].ir_addr == ISACF_IOMEM_DEFAULT) return (0); - if (bus_space_map(iot, ia->ia_iobase, TCIC_IOSIZE, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, TCIC_IOSIZE, 0, &ioh)) return (0); - if (ia->ia_msize == -1) - ia->ia_msize = TCIC_MEMSIZE; + if (ia->ia_iomem[0].ir_size == ISACF_IOSIZ_DEFAULT) + msize = TCIC_MEMSIZE; + else + msize = ia->ia_iomem[0].ir_size; - if (bus_space_map(ia->ia_memt, ia->ia_maddr, ia->ia_msize, 0, &memh)) + if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, + msize, 0, &memh)) { + bus_space_unmap(iot, ioh, TCIC_IOSIZE); return (0); + } DPRINTF(("tcic probing 0x%03x\n", ia->ia_iobase)); found = 0; @@ -182,12 +197,20 @@ tcic_isa_probe(parent, match, aux) DPRINTF(("tcic: reserved bits didn't check OK\n")); bus_space_unmap(iot, ioh, TCIC_IOSIZE); - bus_space_unmap(ia->ia_memt, memh, ia->ia_msize); + bus_space_unmap(ia->ia_memt, memh, msize); if (!found) return (0); - ia->ia_iosize = TCIC_IOSIZE; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = TCIC_IOSIZE; + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_size = msize; + + /* IRQ is special. */ + + ia->ia_ndrq = 0; return (1); } @@ -206,20 +229,22 @@ tcic_isa_attach(parent, self, aux) bus_space_handle_t memh; /* Map i/o space. */ - if (bus_space_map(iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, TCIC_IOSIZE, 0, &ioh)) { printf(": can't map i/o space\n"); return; } /* Map mem space. */ - if (bus_space_map(memt, ia->ia_maddr, ia->ia_msize, 0, &memh)) { + if (bus_space_map(memt, ia->ia_iomem[0].ir_addr, + ia->ia_iomem[0].ir_size, 0, &memh)) { printf(": can't map mem space\n"); return; } - sc->membase = ia->ia_maddr; - sc->subregionmask = (1 << (ia->ia_msize / TCIC_MEM_PAGESIZE)) - 1; - sc->memsize2 = tcic_log2((u_int)ia->ia_msize); + sc->membase = ia->ia_iomem[0].ir_addr; + sc->subregionmask = + (1 << (ia->ia_iomem[0].ir_size / TCIC_MEM_PAGESIZE)) - 1; + sc->memsize2 = tcic_log2((u_int)ia->ia_iomem[0].ir_size); sc->intr_est = ic; sc->pct = (pcmcia_chipset_tag_t) & tcic_isa_functions; @@ -241,7 +266,11 @@ tcic_isa_attach(parent, self, aux) * scarce but for TCIC controllers very infrequent. */ - if ((sc->irq = ia->ia_irq) == IRQUNK) { + if (ia->ia_nirq < 1) + sc->irq = ISACF_IRQ_DEFAULT; + else + sc->irq = ia->ia_irq[0].ir_irq; + if (sc->irq == ISACF_IRQ_DEFAULT) { if (isa_intr_alloc(ic, sc->validirqs & (tcic_isa_intr_alloc_mask & 0xff00), IST_EDGE, &sc->irq)) { diff --git a/sys/dev/isa/tcom.c b/sys/dev/isa/tcom.c index b4c8511e2268..5da3f560e706 100644 --- a/sys/dev/isa/tcom.c +++ b/sys/dev/isa/tcom.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcom.c,v 1.2 2001/11/13 08:01:32 lukem Exp $ */ +/* $NetBSD: tcom.c,v 1.3 2002/01/07 21:47:13 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcom.c,v 1.2 2001/11/13 08:01:32 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcom.c,v 1.3 2002/01/07 21:47:13 thorpej Exp $"); #include #include @@ -126,10 +126,9 @@ tcomprobe(parent, self, aux) void *aux; { struct isa_attach_args *ia = aux; - int iobase = ia->ia_iobase; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; - int i, rv = 1; + int i, iobase, rv = 1; /* * Do the normal com probe for the first UART and assume @@ -138,15 +137,25 @@ tcomprobe(parent, self, aux) * XXX Needs more robustness. */ + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (1); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return (0); /* if the first port is in use as console, then it. */ - if (com_is_console(iot, iobase, 0)) + if (com_is_console(iot, ia->ia_io[0].ir_addr, 0)) goto checkmappings; - if (bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, COM_NPORTS, 0, &ioh)) { rv = 0; goto out; } @@ -156,7 +165,7 @@ tcomprobe(parent, self, aux) goto out; checkmappings: - for (i = 1; i < NSLAVES; i++) { + for (i = 1, iobase = ia->ia_io[0].ir_addr; i < NSLAVES; i++) { iobase += COM_NPORTS; if (com_is_console(iot, iobase, 0)) @@ -170,8 +179,15 @@ checkmappings: } out: - if (rv) - ia->ia_iosize = NSLAVES * COM_NPORTS; + if (rv) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = NSLAVES * COM_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; + ia->ia_ndrq = 0; + } return (rv); } @@ -202,7 +218,7 @@ tcomattach(parent, self, aux) printf("\n"); sc->sc_iot = ia->ia_iot; - sc->sc_iobase = ia->ia_iobase; + sc->sc_iobase = ia->ia_io[0].ir_addr; for (i = 0; i < NSLAVES; i++) { iobase = sc->sc_iobase + i * COM_NPORTS; @@ -215,7 +231,8 @@ tcomattach(parent, self, aux) } } - if (bus_space_map(iot, sc->sc_iobase + STATUS_OFFSET, STATUS_SIZE, 0, &sc->sc_statusioh)) { + if (bus_space_map(iot, sc->sc_iobase + STATUS_OFFSET, STATUS_SIZE, 0, + &sc->sc_statusioh)) { printf("%s: can't map status space\n", sc->sc_dev.dv_xname); return; } @@ -232,8 +249,8 @@ tcomattach(parent, self, aux) sc->sc_alive |= 1 << i; } - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_SERIAL, tcomintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_SERIAL, tcomintr, sc); } int diff --git a/sys/dev/isa/uha_isa.c b/sys/dev/isa/uha_isa.c index e2f1aa792eb1..284c1e6f61c8 100644 --- a/sys/dev/isa/uha_isa.c +++ b/sys/dev/isa/uha_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: uha_isa.c,v 1.21 2001/11/15 09:48:10 lukem Exp $ */ +/* $NetBSD: uha_isa.c,v 1.22 2002/01/07 21:47:13 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uha_isa.c,v 1.21 2001/11/15 09:48:10 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uha_isa.c,v 1.22 2002/01/07 21:47:13 thorpej Exp $"); #include "opt_ddb.h" @@ -98,11 +98,21 @@ uha_isa_probe(parent, match, aux) struct uha_probe_data upd; int rv; - /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1) return (0); - if (bus_space_map(iot, ia->ia_iobase, UHA_ISA_IOSIZE, 0, &ioh)) + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + /* Disallow wildcarded i/o address. */ + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + + if (bus_space_map(iot, ia->ia_io[0].ir_addr, UHA_ISA_IOSIZE, 0, &ioh)) return (0); rv = u14_find(iot, ioh, &upd); @@ -110,14 +120,23 @@ uha_isa_probe(parent, match, aux) bus_space_unmap(iot, ioh, UHA_ISA_IOSIZE); if (rv) { - if (ia->ia_irq != -1 && ia->ia_irq != upd.sc_irq) + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != upd.sc_irq) return (0); - if (ia->ia_drq != -1 && ia->ia_drq != upd.sc_drq) + if (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT && + ia->ia_drq[0].ir_drq != upd.sc_drq) return (0); - ia->ia_irq = upd.sc_irq; - ia->ia_drq = upd.sc_drq; - ia->ia_msize = 0; - ia->ia_iosize = UHA_ISA_IOSIZE; + + ia->ia_nio = 1; + ia->ia_io[0].ir_size = UHA_ISA_IOSIZE; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = upd.sc_irq; + + ia->ia_ndrq = 1; + ia->ia_drq[0].ir_drq = upd.sc_drq; + + ia->ia_niomem = 0; } return (rv); } @@ -141,7 +160,7 @@ uha_isa_attach(parent, self, aux) printf("\n"); - if (bus_space_map(iot, ia->ia_iobase, UHA_ISA_IOSIZE, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, UHA_ISA_IOSIZE, 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } diff --git a/sys/dev/isa/vga_isa.c b/sys/dev/isa/vga_isa.c index a926b0c843bd..348aff144dbb 100644 --- a/sys/dev/isa/vga_isa.c +++ b/sys/dev/isa/vga_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: vga_isa.c,v 1.6 2001/11/13 08:01:33 lukem Exp $ */ +/* $NetBSD: vga_isa.c,v 1.7 2002/01/07 21:47:13 thorpej Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vga_isa.c,v 1.6 2001/11/13 08:01:33 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vga_isa.c,v 1.7 2002/01/07 21:47:13 thorpej Exp $"); #include #include @@ -62,22 +62,46 @@ vga_isa_match(parent, match, aux) { struct isa_attach_args *ia = aux; + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* If values are hardwired to something that they can't be, punt. */ - if ((ia->ia_iobase != IOBASEUNK && ia->ia_iobase != 0x3b0) || - /* ia->ia_iosize != 0 || XXX isa.c */ - (ia->ia_maddr != MADDRUNK && ia->ia_maddr != 0xa0000) || - (ia->ia_msize != 0 && ia->ia_msize != 0x20000) || - ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK) + if (ia->ia_nio < 1 || + (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT && + ia->ia_io[0].ir_addr != 0x3b0)) + return (0); + + if (ia->ia_niomem < 1 || + (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT && + ia->ia_iomem[0].ir_addr != 0xa0000)) + return (0); + if (ia->ia_iomem[0].ir_size != 0 && + ia->ia_iomem[0].ir_size != 0x20000) + return (0); + + if (ia->ia_nirq > 0 && + ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT) + return (0); + + if (ia->ia_ndrq > 0 && + ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT) return (0); if (!vga_is_console(ia->ia_iot, WSDISPLAY_TYPE_ISAVGA) && !vga_common_probe(ia->ia_iot, ia->ia_memt)) return (0); - ia->ia_iobase = 0x3b0; /* XXX mono 0x3b0 color 0x3c0 */ - ia->ia_iosize = 0x30; /* XXX 0x20 */ - ia->ia_maddr = 0xa0000; - ia->ia_msize = 0x20000; + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = 0x3b0; /* XXX mono 0x3b0 color 0x3c0 */ + ia->ia_io[0].ir_size = 0x30; /* XXX 0x20 */ + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_addr = 0xa0000; + ia->ia_iomem[0].ir_size = 0x20000; + + ia->ia_nirq = 0; + ia->ia_ndrq = 0; + return (2); /* more than generic pcdisplay */ } diff --git a/sys/dev/isa/wdc_isa.c b/sys/dev/isa/wdc_isa.c index 3c6e987cc9b6..bc1995249b18 100644 --- a/sys/dev/isa/wdc_isa.c +++ b/sys/dev/isa/wdc_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_isa.c,v 1.23 2001/11/15 09:48:10 lukem Exp $ */ +/* $NetBSD: wdc_isa.c,v 1.24 2002/01/07 21:47:13 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wdc_isa.c,v 1.23 2001/11/15 09:48:10 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_isa.c,v 1.24 2002/01/07 21:47:13 thorpej Exp $"); #include #include @@ -94,22 +94,40 @@ wdc_isa_probe(parent, match, aux) struct isa_attach_args *ia = aux; int result = 0; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) + return (0); + memset(&ch, 0, sizeof(ch)); ch.cmd_iot = ia->ia_iot; - if (bus_space_map(ch.cmd_iot, ia->ia_iobase, WDC_ISA_REG_NPORTS, 0, - &ch.cmd_ioh)) + + if (bus_space_map(ch.cmd_iot, ia->ia_io[0].ir_addr, + WDC_ISA_REG_NPORTS, 0, &ch.cmd_ioh)) goto out; ch.ctl_iot = ia->ia_iot; - if (bus_space_map(ch.ctl_iot, ia->ia_iobase + WDC_ISA_AUXREG_OFFSET, - WDC_ISA_AUXREG_NPORTS, 0, &ch.ctl_ioh)) + if (bus_space_map(ch.ctl_iot, ia->ia_io[0].ir_addr + + WDC_ISA_AUXREG_OFFSET, WDC_ISA_AUXREG_NPORTS, 0, &ch.ctl_ioh)) goto outunmap; result = wdcprobe(&ch); if (result) { - ia->ia_iosize = WDC_ISA_REG_NPORTS; - ia->ia_msize = 0; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = WDC_ISA_REG_NPORTS; + + ia->ia_nirq = 1; + + ia->ia_niomem = 0; } bus_space_unmap(ch.ctl_iot, ch.ctl_ioh, WDC_ISA_AUXREG_NPORTS); @@ -132,22 +150,22 @@ wdc_isa_attach(parent, self, aux) sc->wdc_channel.cmd_iot = ia->ia_iot; sc->wdc_channel.ctl_iot = ia->ia_iot; sc->sc_ic = ia->ia_ic; - if (bus_space_map(sc->wdc_channel.cmd_iot, ia->ia_iobase, + if (bus_space_map(sc->wdc_channel.cmd_iot, ia->ia_io[0].ir_addr, WDC_ISA_REG_NPORTS, 0, &sc->wdc_channel.cmd_ioh) || bus_space_map(sc->wdc_channel.ctl_iot, - ia->ia_iobase + WDC_ISA_AUXREG_OFFSET, WDC_ISA_AUXREG_NPORTS, - 0, &sc->wdc_channel.ctl_ioh)) { + ia->ia_io[0].ir_addr + WDC_ISA_AUXREG_OFFSET, + WDC_ISA_AUXREG_NPORTS, 0, &sc->wdc_channel.ctl_ioh)) { printf("%s: couldn't map registers\n", sc->sc_wdcdev.sc_dev.dv_xname); } sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot; sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_ioh; - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_BIO, wdcintr, &sc->wdc_channel); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_BIO, wdcintr, &sc->wdc_channel); - if (ia->ia_drq != DRQUNK) { - sc->sc_drq = ia->ia_drq; + if (ia->ia_ndrq > 0 && ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT) { + sc->sc_drq = ia->ia_drq[0].ir_drq; sc->sc_wdcdev.cap |= WDC_CAPABILITY_DMA; sc->sc_wdcdev.dma_arg = sc; diff --git a/sys/dev/isa/wds.c b/sys/dev/isa/wds.c index 72d8975b52a9..ab6047a86e8e 100644 --- a/sys/dev/isa/wds.c +++ b/sys/dev/isa/wds.c @@ -1,4 +1,4 @@ -/* $NetBSD: wds.c,v 1.47 2001/11/15 09:48:10 lukem Exp $ */ +/* $NetBSD: wds.c,v 1.48 2002/01/07 21:47:14 thorpej Exp $ */ /* * XXX @@ -86,7 +86,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wds.c,v 1.47 2001/11/15 09:48:10 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wds.c,v 1.48 2002/01/07 21:47:14 thorpej Exp $"); #include "opt_ddb.h" @@ -267,11 +267,21 @@ wdsprobe(parent, match, aux) struct wds_probe_data wpd; int rv; - /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1) return (0); - if (bus_space_map(iot, ia->ia_iobase, WDS_ISA_IOSIZE, 0, &ioh)) + if (ISA_DIRECT_CONFIG(ia)) + return (0); + + /* Disallow wildcarded i/o address. */ + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + + if (bus_space_map(iot, ia->ia_io[0].ir_addr, WDS_ISA_IOSIZE, 0, &ioh)) return (0); rv = wds_find(iot, ioh, &wpd); @@ -280,20 +290,31 @@ wdsprobe(parent, match, aux) if (rv) { #ifdef notyet - if (ia->ia_irq != -1 && ia->ia_irq != wpd.sc_irq) + if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT && + ia->ia_irq[0].ir_irq != wpd.sc_irq) return (0); - if (ia->ia_drq != -1 && ia->ia_drq != wpd.sc_drq) + if (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT && + ia->ia_drq[0].ir_drq != wpd.sc_drq) return (0); - ia->ia_irq = wpd.sc_irq; - ia->ia_drq = wpd.sc_drq; + + ia->ia_nirq = 1; + ia->ia_irq[0].ir_irq = wpd.sc_irq; + + ia->ia_ndrq = 1; + ia->ia_drq[0].ir_drq = wpd.sc_drq; #else - if (ia->ia_irq == -1) + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return (0); - if (ia->ia_drq == -1) + if (ia->ia_drq[0].ir_drq == ISACF_DRQ_DEFAULT) return (0); + + ia->ia_nirq = 1; + ia->ia_ndrq = 1; #endif - ia->ia_msize = 0; - ia->ia_iosize = WDS_ISA_IOSIZE; + ia->ia_nio = 1; + ia->ia_io[0].ir_size = WDS_ISA_IOSIZE; + + ia->ia_niomem = 0; } return (rv); } @@ -316,7 +337,7 @@ wdsattach(parent, self, aux) printf("\n"); - if (bus_space_map(iot, ia->ia_iobase, WDS_ISA_IOSIZE, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, WDS_ISA_IOSIZE, 0, &ioh)) { printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); return; } @@ -342,16 +363,14 @@ wdsattach(parent, self, aux) sc->sc_ih = isa_intr_establish(ic, wpd.sc_irq, IST_EDGE, IPL_BIO, wdsintr, sc); #else - if (ia->ia_drq != -1) { - if ((error = isa_dmacascade(ic, ia->ia_drq)) != 0) { - printf("%s: unable to cascade DRQ, error = %d\n", - sc->sc_dev.dv_xname, error); - return; - } + if ((error = isa_dmacascade(ic, ia->ia_drq[0].ir_drq)) != 0) { + printf("%s: unable to cascade DRQ, error = %d\n", + sc->sc_dev.dv_xname, error); + return; } - sc->sc_ih = isa_intr_establish(ic, ia->ia_irq, IST_EDGE, IPL_BIO, - wdsintr, sc); + sc->sc_ih = isa_intr_establish(ic, ia->ia_irq[0].ir_irq, IST_EDGE, + IPL_BIO, wdsintr, sc); #endif if (sc->sc_ih == NULL) { printf("%s: couldn't establish interrupt\n", diff --git a/sys/dev/isa/wss_isa.c b/sys/dev/isa/wss_isa.c index 7abeac008dc8..bc156aa1d385 100644 --- a/sys/dev/isa/wss_isa.c +++ b/sys/dev/isa/wss_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: wss_isa.c,v 1.11 2001/11/13 08:01:35 lukem Exp $ */ +/* $NetBSD: wss_isa.c,v 1.12 2002/01/07 21:47:14 thorpej Exp $ */ /* * Copyright (c) 1994 John Brezak @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wss_isa.c,v 1.11 2001/11/13 08:01:35 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wss_isa.c,v 1.12 2002/01/07 21:47:14 thorpej Exp $"); #include #include @@ -71,7 +71,8 @@ extern int wssdebug; #define DPRINTF(x) #endif -static int wssfind __P((struct device *, struct wss_softc *, struct isa_attach_args *)); +static int wssfind __P((struct device *, struct wss_softc *, int, + struct isa_attach_args *)); static void madprobe __P((struct wss_softc *, int)); static void madunmap __P((struct wss_softc *)); @@ -93,12 +94,23 @@ wss_isa_probe(parent, match, aux) struct cfdata *match; void *aux; { + struct isa_attach_args *ia = aux; struct wss_softc probesc, *sc = &probesc; struct ad1848_softc *ac = (struct ad1848_softc *)&sc->sc_ad1848; + if (ia->ia_nio < 1) + return 0; + if (ia->ia_nirq < 1) + return 0; + if (ia->ia_ndrq < 1) + return 0; + + if (ISA_DIRECT_CONFIG(ia)) + return 0; + memset(sc, 0, sizeof *sc); ac->sc_dev.dv_cfdata = match; - if (wssfind(parent, sc, aux)) { + if (wssfind(parent, sc, 1, aux)) { bus_space_unmap(sc->sc_iot, sc->sc_ioh, WSS_CODEC); ad1848_isa_unmap(&sc->sc_ad1848); madunmap(sc); @@ -109,9 +121,10 @@ wss_isa_probe(parent, match, aux) } static int -wssfind(parent, sc, ia) +wssfind(parent, sc, probing, ia) struct device *parent; struct wss_softc *sc; + int probing; struct isa_attach_args *ia; { struct ad1848_softc *ac = &sc->sc_ad1848.sc_ad1848; @@ -119,66 +132,94 @@ wssfind(parent, sc, ia) -1, -1, -1, -1, -1, -1, -1, 0x08, -1, 0x10, 0x18, 0x20 }; static u_char dma_bits[4] = {1, 2, 0, 3}; - + int ndrq, playdrq, recdrq; + sc->sc_iot = ia->ia_iot; if (ac->sc_dev.dv_cfdata->cf_flags & 1) - madprobe(sc, ia->ia_iobase); + madprobe(sc, ia->ia_io[0].ir_addr); else sc->mad_chip_type = MAD_NONE; #if 0 - if (!WSS_BASE_VALID(ia->ia_iobase)) { + if (!WSS_BASE_VALID(ia->ia_io[0].ir_addr)) { DPRINTF(("wss: configured iobase %x invalid\n", ia->ia_iobase)); goto bad1; } #endif /* Map the ports upto the AD1848 port */ - if (bus_space_map(sc->sc_iot, ia->ia_iobase, WSS_CODEC, 0, &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, WSS_CODEC, + 0, &sc->sc_ioh)) goto bad1; ac->sc_iot = sc->sc_iot; /* Is there an ad1848 chip at (WSS iobase + WSS_CODEC)? */ - if (ad1848_isa_mapprobe(&sc->sc_ad1848, ia->ia_iobase + WSS_CODEC) == 0) + if (ad1848_isa_mapprobe(&sc->sc_ad1848, + ia->ia_io[0].ir_addr + WSS_CODEC) == 0) goto bad; - - ia->ia_iosize = WSS_NPORT; #if 0 /* Setup WSS interrupt and DMA */ - if (!WSS_DRQ_VALID(ia->ia_drq)) { - DPRINTF(("wss: configured dma chan %d invalid\n", ia->ia_drq)); + if (!WSS_DRQ_VALID(ia->ia_drq[0].ir_drq)) { + DPRINTF(("wss: configured dma chan %d invalid\n", + ia->ia_drq[0].ir_drq)); goto bad; } #endif - sc->wss_playdrq = ia->ia_drq; + sc->wss_playdrq = ia->ia_drq[0].ir_drq; sc->wss_ic = ia->ia_ic; - if (sc->wss_playdrq != DRQUNK && !isa_drq_isfree(sc->wss_ic, sc->wss_playdrq)) + if (sc->wss_playdrq != ISACF_DRQ_DEFAULT && + !isa_drq_isfree(sc->wss_ic, sc->wss_playdrq)) goto bad; #if 0 - if (!WSS_IRQ_VALID(ia->ia_irq)) { - DPRINTF(("wss: configured interrupt %d invalid\n", ia->ia_irq)); + if (!WSS_IRQ_VALID(ia->ia_irq[0].ir_irq)) { + DPRINTF(("wss: configured interrupt %d invalid\n", + ia->ia_irq[0].ir_irq)); goto bad; } #endif - sc->wss_irq = ia->ia_irq; + sc->wss_irq = ia->ia_irq[0].ir_irq; + + playdrq = ia->ia_drq[0].ir_drq; + if (ia->ia_ndrq > 1) { + ndrq = 2; + recdrq = ia->ia_drq[1].ir_drq; + } else { + ndrq = 1; + recdrq = ISACF_IRQ_DEFAULT; + } if (ac->mode <= 1) - ia->ia_drq2 = DRQUNK; + ndrq = 1; sc->wss_recdrq = - ac->mode > 1 && ia->ia_drq2 != DRQUNK ? - ia->ia_drq2 : ia->ia_drq; + ac->mode > 1 && ndrq > 1 && + recdrq != ISACF_DRQ_DEFAULT ? recdrq : playdrq; if (sc->wss_recdrq != sc->wss_playdrq && !isa_drq_isfree(sc->wss_ic, sc->wss_recdrq)) goto bad; + if (probing) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = WSS_NPORT; + + ia->ia_nirq = 1; + + ia->ia_ndrq = ndrq; + ia->ia_drq[0].ir_drq = playdrq; + if (ndrq > 1) + ia->ia_drq[1].ir_drq = recdrq; + + ia->ia_niomem = 0; + } + /* XXX recdrq */ bus_space_write_1(sc->sc_iot, sc->sc_ioh, WSS_CONFIG, - (interrupt_bits[ia->ia_irq] | dma_bits[ia->ia_drq])); + (interrupt_bits[ia->ia_irq[0].ir_irq] | + dma_bits[ia->ia_drq[0].ir_drq])); return 1; @@ -202,7 +243,7 @@ wss_isa_attach(parent, self, aux) struct ad1848_softc *ac = (struct ad1848_softc *)&sc->sc_ad1848; struct isa_attach_args *ia = (struct isa_attach_args *)aux; - if (!wssfind(parent, sc, ia)) { + if (!wssfind(parent, sc, 0, ia)) { printf("%s: wssfind failed\n", ac->sc_dev.dv_xname); return; } diff --git a/sys/dev/isa/wt.c b/sys/dev/isa/wt.c index 41a72336a3a4..8fda12cedf83 100644 --- a/sys/dev/isa/wt.c +++ b/sys/dev/isa/wt.c @@ -1,4 +1,4 @@ -/* $NetBSD: wt.c,v 1.53 2001/11/13 08:01:35 lukem Exp $ */ +/* $NetBSD: wt.c,v 1.54 2002/01/07 21:47:14 thorpej Exp $ */ /* * Streamer tape driver. @@ -51,7 +51,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wt.c,v 1.53 2001/11/13 08:01:35 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wt.c,v 1.54 2002/01/07 21:47:14 thorpej Exp $"); #include #include @@ -187,37 +187,56 @@ wtprobe(parent, match, aux) struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; - int rv = 0; + int rv = 0, iosize; + if (ia->ia_nio < 1) + return (0); + if (ia->ia_nirq < 1) + return (0); + if (ia->ia_ndrq < 1); /* Disallow wildcarded i/o address. */ - if (ia->ia_iobase == ISACF_PORT_DEFAULT) + if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) return (0); - if (ia->ia_drq < 1 || ia->ia_drq > 3) { - printf("wtprobe: Bad drq=%d, should be 1..3\n", ia->ia_drq); + if (ia->ia_drq[0].ir_drq < 1 || ia->ia_drq[0].ir_drq > 3) { + printf("wtprobe: Bad drq=%d, should be 1..3\n", + ia->ia_drq[0].ir_drq); return (0); } + iosize = AV_NPORT; + /* Map i/o space */ - if (bus_space_map(iot, ia->ia_iobase, AV_NPORT, 0, &ioh)) + if (bus_space_map(iot, ia->ia_io[0].ir_addr, iosize, 0, &ioh)) return 0; /* Try Wangtek. */ if (wtreset(iot, ioh, &wtregs)) { - ia->ia_iosize = WT_NPORT; /* XXX misleading */ + iosize = WT_NPORT; /* XXX misleading */ rv = 1; goto done; } /* Try Archive. */ if (wtreset(iot, ioh, &avregs)) { - ia->ia_iosize = AV_NPORT; + iosize = AV_NPORT; rv = 1; goto done; } done: + if (rv) { + ia->ia_nio = 1; + ia->ia_io[0].ir_size = iosize; + + ia->ia_nirq = 1; + ia->ia_ndrq = 1; + + ia->ia_niomem = 0; + } bus_space_unmap(iot, ioh, AV_NPORT); return rv; } @@ -237,7 +256,7 @@ wtattach(parent, self, aux) bus_size_t maxsize; /* Map i/o space */ - if (bus_space_map(iot, ia->ia_iobase, AV_NPORT, 0, &ioh)) { + if (bus_space_map(iot, ia->ia_io[0].ir_addr, AV_NPORT, 0, &ioh)) { printf(": can't map i/o space\n"); return; } @@ -274,7 +293,7 @@ ok: sc->flags = TPSTART; /* tape is rewound */ sc->dens = -1; /* unknown density */ - sc->chan = ia->ia_drq; + sc->chan = ia->ia_drq[0].ir_drq; if ((maxsize = isa_dmamaxsize(sc->sc_ic, sc->chan)) < MAXPHYS) { printf("%s: max DMA size %lu is less than required %d\n", @@ -289,8 +308,8 @@ ok: return; } - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, - IPL_BIO, wtintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, + IST_EDGE, IPL_BIO, wtintr, sc); } int diff --git a/sys/dev/isapnp/isapnp.c b/sys/dev/isapnp/isapnp.c index 8ba481dcb2e4..dc34416f7407 100644 --- a/sys/dev/isapnp/isapnp.c +++ b/sys/dev/isapnp/isapnp.c @@ -1,4 +1,4 @@ -/* $NetBSD: isapnp.c,v 1.35 2001/11/13 07:56:41 lukem Exp $ */ +/* $NetBSD: isapnp.c,v 1.36 2002/01/07 21:47:15 thorpej Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isapnp.c,v 1.35 2001/11/13 07:56:41 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isapnp.c,v 1.36 2002/01/07 21:47:15 thorpej Exp $"); #include "isadma.h" @@ -924,8 +924,12 @@ isapnp_match(parent, match, aux) * We always match. We must let all legacy ISA devices map * their address spaces before we look for a read port. */ - ia->ia_iobase = ISAPNP_ADDR; - ia->ia_iosize = 1; + ia->ia_io[0].ir_addr = ISAPNP_ADDR; + ia->ia_io[0].ir_size = 1; + + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; return (1); }