diff options
| author | cgd <cgd@NetBSD.org> | 1995-04-17 12:06:30 +0000 |
|---|---|---|
| committer | cgd <cgd@NetBSD.org> | 1995-04-17 12:06:30 +0000 |
| commit | 8a640328edd60eb5a19fc29a8847efd3baeb4fa8 (patch) | |
| tree | 8f8ab3df0b9f5b324f7c9ac9288e1c3123eb36a5 /sys | |
| parent | 78ec8e770169b76edc642d16e220a93f577713f9 (diff) | |
clean up several ISA device interfaces: autoconfiguration, header
inclusion, and interrupt configuration. more work still needs to be done,
but it's getting better...
Diffstat (limited to 'sys')
77 files changed, 1254 insertions, 1455 deletions
diff --git a/sys/arch/i386/conf/Makefile.i386 b/sys/arch/i386/conf/Makefile.i386 index a90bf30b005..5a4f7118173 100644 --- a/sys/arch/i386/conf/Makefile.i386 +++ b/sys/arch/i386/conf/Makefile.i386 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.i386,v 1.53 1995/04/17 07:30:54 cgd Exp $ +# $NetBSD: Makefile.i386,v 1.54 1995/04/17 12:06:30 cgd Exp $ # @(#)Makefile.hp300 8.2 (Berkeley) 1/23/94 # # Makefile for NetBSD @@ -114,7 +114,7 @@ lint: /tmp param.c locore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h locore.o: machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s locore.o: $S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h -locore.o: ${I386}/isa/icu.h ${I386}/isa/isareg.h $S/net/netisr.h +locore.o: ${I386}/isa/icu.h $S/dev/isa/isareg.h $S/net/netisr.h ${CPP} -DLOCORE ${COPTS} ${I386}/i386/locore.s | ${AS} -o locore.o # the following is necessary because autoconf.o depends on #if GENERIC diff --git a/sys/arch/i386/conf/files.i386.newconf b/sys/arch/i386/conf/files.i386.newconf index 4edfff34f8e..b1b759f9818 100644 --- a/sys/arch/i386/conf/files.i386.newconf +++ b/sys/arch/i386/conf/files.i386.newconf @@ -1,4 +1,4 @@ -# $NetBSD: files.i386.newconf,v 1.48 1995/04/17 07:45:29 cgd Exp $ +# $NetBSD: files.i386.newconf,v 1.49 1995/04/17 12:06:34 cgd Exp $ # # new style config file for i386 architecture # @@ -69,12 +69,12 @@ device pci at root {[bus = -1], [dev = -1]} # # ISA and mixed ISA+EISA or ISA+PCI drivers # -file arch/i386/isa/isa.c isa needs-flag +file dev/isa/isa.c isa needs-flag +file arch/i386/isa/isa_machdep.c isa file arch/i386/isa/clock.c isa -define dma -file arch/i386/isa/dma.c dma needs-flag -file arch/i386/isa/intr.c isa +define isadma +file dev/isa/isadma.c isadma needs-flag device npx at isa file arch/i386/isa/npx.c npx needs-flag @@ -111,21 +111,21 @@ file arch/i386/isa/mms.c mms needs-flag device pms at isa file arch/i386/isa/pms.c pms needs-flag -device aha at isa: scsi, dma +device aha at isa: scsi, isadma file dev/isa/aha1542.c aha -device aic at isa: scsi, dma +device aic at isa: scsi, isadma file dev/isa/aic6360.c aic -device bt at isa: scsi, dma +device bt at isa: scsi, isadma file dev/isa/bt742a.c bt -device sea at isa: scsi, dma +device sea at isa: scsi, isadma file dev/isa/seagate.c sea -device uha at isa: scsi, dma +device uha at isa: scsi, isadma file dev/isa/ultra14f.c uha -device wds at isa: scsi, dma +device wds at isa: scsi, isadma file dev/isa/wd7000.c wds device fdc at isa {drive = -1} -device fd at fdc: disk, dma +device fd at fdc: disk, isadma file arch/i386/isa/fd.c fdc needs-flag major {fd = 2} device mcd at isa: disk @@ -135,10 +135,10 @@ device scd at isa: disk file dev/isa/t/scd.c scd needs-flag major {scd = 15} device wdc at isa {drive = -1} -device wd at wdc: disk, dma +device wd at wdc: disk, isadma file dev/isa/wd.c wdc needs-flag major {wd = 0} -device wt at isa: tape, dma +device wt at isa: tape, isadma file dev/isa/wt.c wt needs-flag major {wt = 3} @@ -159,14 +159,14 @@ device ie at isa: ether, ifnet, elink file dev/isa/if_ie.c ie device ix at isa: ether, ifnet file dev/isa/if_ix.c ix -device le at isa: ether, ifnet, dma +device le at isa: ether, ifnet, isadma file dev/isa/if_le.c le define sbdsp file arch/i386/isa/sbdsp.c sbdsp -device sb at isa: audio, dma, sbdsp +device sb at isa: audio, isadma, sbdsp file arch/i386/isa/sb.c sb needs-flag -device pas at isa: audio, dma, sbdsp +device pas at isa: audio, isadma, sbdsp file arch/i386/isa/pas.c pas needs-flag define ad1848 @@ -174,9 +174,9 @@ file arch/i386/isa/ad1848.c ad1848 device pss at isa {[port = -1], [size = 0], [iomem = -1], [iosiz = 0], [irq = -1], [drq = -1]} -device sp at pss: audio, dma, ad1848 +device sp at pss: audio, isadma, ad1848 file arch/i386/isa/pss.c pss needs-flag -device wss at isa: audio, dma, ad1848 +device wss at isa: audio, isadma, ad1848 file arch/i386/isa/wss.c wss needs-flag device spkr at isa: tty diff --git a/sys/arch/i386/i386/genassym.c b/sys/arch/i386/i386/genassym.c index 135745eb93f..2e1124e3a17 100644 --- a/sys/arch/i386/i386/genassym.c +++ b/sys/arch/i386/i386/genassym.c @@ -1,4 +1,4 @@ -/* $NetBSD: genassym.c,v 1.35 1995/04/12 15:38:09 mycroft Exp $ */ +/* $NetBSD: genassym.c,v 1.36 1995/04/17 12:06:39 cgd Exp $ */ /*- * Copyright (c) 1982, 1990 The Regents of the University of California. @@ -62,7 +62,7 @@ #include "isa.h" #if NISA > 0 -#include <i386/isa/isavar.h> +#include <i386/isa/isa_machdep.h> #endif main() @@ -96,11 +96,6 @@ main() def("VM_MAXUSER_ADDRESS", VM_MAXUSER_ADDRESS); - def("UPAGES", UPAGES); - def("USPACE", USPACE); - def("PGSHIFT", PGSHIFT); - def("PDSHIFT", PDSHIFT); - def("P_ADDR", &p->p_addr); def("P_BACK", &p->p_back); def("P_FORW", &p->p_forw); diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 1f62a0f9473..061d1d53316 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.145 1995/04/13 20:48:27 mycroft Exp $ */ +/* $NetBSD: machdep.c,v 1.146 1995/04/17 12:06:43 cgd Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles Hannum. @@ -83,8 +83,9 @@ #include <machine/reg.h> #include <machine/specialreg.h> -#include <i386/isa/isareg.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isareg.h> +#include <dev/isa/isavar.h> +#include <i386/isa/isa_machdep.h> #include <i386/isa/rtc.h> #include "isa.h" diff --git a/sys/arch/i386/i386/microtime.s b/sys/arch/i386/i386/microtime.s index 9f08e3d1913..95ef8dc1a8a 100644 --- a/sys/arch/i386/i386/microtime.s +++ b/sys/arch/i386/i386/microtime.s @@ -1,4 +1,4 @@ -/* $NetBSD: microtime.s,v 1.15 1994/11/06 22:05:08 mycroft Exp $ */ +/* $NetBSD: microtime.s,v 1.16 1995/04/17 12:06:47 cgd Exp $ */ /*- * Copyright (c) 1993 The Regents of the University of California. @@ -34,7 +34,7 @@ */ #include <machine/asm.h> -#include <i386/isa/isareg.h> +#include <dev/isa/isareg.h> #include <i386/isa/timerreg.h> #define IRQ_BIT(irq_num) (1 << ((irq_num) % 8)) diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index 2fe985435db..08c4966fbbe 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.28 1995/04/10 12:42:02 mycroft Exp $ */ +/* $NetBSD: pmap.c,v 1.29 1995/04/17 12:06:49 cgd Exp $ */ /* * Copyright (c) 1993, 1994 Charles Hannum. @@ -89,7 +89,8 @@ #include <machine/cpu.h> -#include <i386/isa/isareg.h> +#include <dev/isa/isareg.h> +#include <i386/isa/isa_machdep.h> #include "isa.h" diff --git a/sys/arch/i386/isa/ad1848.c b/sys/arch/i386/isa/ad1848.c index d0892f2c802..63be64a2ec7 100644 --- a/sys/arch/i386/isa/ad1848.c +++ b/sys/arch/i386/isa/ad1848.c @@ -1,4 +1,4 @@ -/* $NetBSD: ad1848.c,v 1.2 1995/03/25 00:00:53 mycroft Exp $ */ +/* $NetBSD: ad1848.c,v 1.3 1995/04/17 12:06:55 cgd Exp $ */ /* * Copyright (c) 1994 John Brezak @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ad1848.c,v 1.2 1995/03/25 00:00:53 mycroft Exp $ + * $Id: ad1848.c,v 1.3 1995/04/17 12:06:55 cgd Exp $ */ /* @@ -87,8 +87,8 @@ #include <sys/audioio.h> #include <dev/audio_if.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isadmavar.h> #include <i386/isa/icu.h> #include <i386/isa/ad1848reg.h> @@ -1341,9 +1341,10 @@ ad1848_dma_output(addr, p, cc, intr, arg) } int -ad1848_intr(sc) - register struct ad1848_softc *sc; +ad1848_intr(arg) + void *arg; { + register struct ad1848_softc *sc = arg; int retval = 0; u_char status; diff --git a/sys/arch/i386/isa/ad1848var.h b/sys/arch/i386/isa/ad1848var.h index 70a5c1639f0..d72815e3a87 100644 --- a/sys/arch/i386/isa/ad1848var.h +++ b/sys/arch/i386/isa/ad1848var.h @@ -1,4 +1,4 @@ -/* $NetBSD: ad1848var.h,v 1.3 1995/03/28 18:17:42 jtc Exp $ */ +/* $NetBSD: ad1848var.h,v 1.4 1995/04/17 12:06:57 cgd Exp $ */ /* * Copyright (c) 1994 John Brezak @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ad1848var.h,v 1.3 1995/03/28 18:17:42 jtc Exp $ + * $Id: ad1848var.h,v 1.4 1995/04/17 12:06:57 cgd Exp $ */ #define AD1848_NPORT 8 @@ -46,7 +46,7 @@ struct ad1848_volume { struct ad1848_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ void *parent; @@ -88,7 +88,7 @@ struct ad1848_softc { u_char format_bits; u_long sc_interrupts; /* number of interrupts taken */ - void (*sc_intr)(void*); /* dma completion intr handler */ + void (*sc_intr)(void *); /* dma completion intr handler */ void *sc_arg; /* arg for sc_intr() */ }; @@ -135,7 +135,7 @@ int ad1848_halt_out_dma __P((void *)); int ad1848_cont_in_dma __P((void *)); int ad1848_cont_out_dma __P((void *)); -int ad1848_intr __P((struct ad1848_softc *)); +int ad1848_intr __P((void *)); int ad1848_set_rec_port __P((struct ad1848_softc *, int)); int ad1848_get_rec_port __P((struct ad1848_softc *)); diff --git a/sys/arch/i386/isa/clock.c b/sys/arch/i386/isa/clock.c index d0545301e18..73ad3eca772 100644 --- a/sys/arch/i386/isa/clock.c +++ b/sys/arch/i386/isa/clock.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.29 1995/01/03 01:30:26 mycroft Exp $ */ +/* $NetBSD: clock.c,v 1.30 1995/04/17 12:06:59 cgd Exp $ */ /*- * Copyright (c) 1993, 1994 Charles Hannum. @@ -98,8 +98,8 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <machine/pio.h> #include <machine/cpufunc.h> -#include <i386/isa/isareg.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isareg.h> +#include <dev/isa/isavar.h> #include <i386/isa/clock.h> #include <i386/isa/rtc.h> #include <i386/isa/timerreg.h> @@ -128,9 +128,10 @@ startrtclock() } int -clockintr(frame) - struct clockframe *frame; +clockintr(arg) + void *arg; { + struct clockframe *frame = arg; /* not strictly necessary */ hardclock(frame); return -1; @@ -275,12 +276,13 @@ findcpuspeed() void cpu_initclocks() { - static struct intrhand clockhand; - clockhand.ih_fun = clockintr; - clockhand.ih_arg = 0; - clockhand.ih_level = IPL_CLOCK; - intr_establish(0, IST_PULSE, &clockhand); + /* + * XXX If you're doing strange things with multiple clocks, you might + * want to keep track of clock handlers. + */ + (void)isa_intr_establish(0, ISA_IST_PULSE, ISA_IPL_CLOCK, + clockintr, 0); } void diff --git a/sys/arch/i386/isa/dma.c b/sys/arch/i386/isa/dma.c deleted file mode 100644 index 41b7ddac5d9..00000000000 --- a/sys/arch/i386/isa/dma.c +++ /dev/null @@ -1,273 +0,0 @@ -/* $NetBSD: dma.c,v 1.11 1995/04/10 13:14:54 mycroft Exp $ */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/file.h> -#include <sys/buf.h> -#include <sys/syslog.h> -#include <sys/malloc.h> -#include <sys/uio.h> - -#include <vm/vm.h> - -#include <machine/pio.h> - -#include <i386/isa/isareg.h> -#include <i386/isa/dmavar.h> -#include <i386/isa/dmareg.h> - -/* region of physical memory known to be contiguous */ -vm_offset_t isaphysmem; -static caddr_t dma_bounce[8]; /* XXX */ -static char bounced[8]; /* XXX */ -#define MAXDMASZ 512 /* XXX */ - -/* high byte of address is stored in this port for i-th dma channel */ -static int dmapageport[8] = - { 0x87, 0x83, 0x81, 0x82, 0x8f, 0x8b, 0x89, 0x8a }; - -/* - * isa_dmacascade(): program 8237 DMA controller channel to accept - * external dma control by a board. - */ -void -isa_dmacascade(chan) - int chan; -{ - -#ifdef DIAGNOSTIC - if (chan < 0 || chan > 7) - panic("isa_dmacascade: impossible request"); -#endif - - /* set dma channel mode, and set dma channel mode */ - if ((chan & 4) == 0) { - outb(DMA1_MODE, DMA37MD_CASCADE | chan); - outb(DMA1_SMSK, chan); - } else { - outb(DMA2_MODE, DMA37MD_CASCADE | (chan & 3)); - outb(DMA2_SMSK, chan & 3); - } -} - -/* - * isa_dmastart(): program 8237 DMA controller channel, avoid page alignment - * problems by using a bounce buffer. - */ -void -isa_dmastart(flags, addr, nbytes, chan) - int flags; - caddr_t addr; - vm_size_t nbytes; - int chan; -{ - vm_offset_t phys; - int waport; - caddr_t newaddr; - -#ifdef DIAGNOSTIC - if (chan < 0 || chan > 7 || - ((chan & 4) ? (nbytes >= (1<<17) || nbytes & 1 || (u_int)addr & 1) : - (nbytes >= (1<<16)))) - panic("isa_dmastart: impossible request"); -#endif - - if (isa_dmarangecheck(addr, nbytes, chan)) { - if (dma_bounce[chan] == 0) - dma_bounce[chan] = - /*(caddr_t)malloc(MAXDMASZ, M_TEMP, M_WAITOK);*/ - (caddr_t) isaphysmem + NBPG*chan; - bounced[chan] = 1; - newaddr = dma_bounce[chan]; - *(int *) newaddr = 0; /* XXX */ - /* copy bounce buffer on write */ - if ((flags & B_READ) == 0) - bcopy(addr, newaddr, nbytes); - addr = newaddr; - } - - /* translate to physical */ - phys = pmap_extract(pmap_kernel(), (vm_offset_t)addr); - - if ((chan & 4) == 0) { - /* - * Program one of DMA channels 0..3. These are - * byte mode channels. - */ - /* set dma channel mode, and reset address ff */ - if (flags & B_READ) - outb(DMA1_MODE, chan | DMA37MD_SINGLE | DMA37MD_WRITE); - else - outb(DMA1_MODE, chan | DMA37MD_SINGLE | DMA37MD_READ); - outb(DMA1_FFC, 0); - - /* send start address */ - waport = DMA1_CHN(chan); - outb(waport, phys); - outb(waport, phys>>8); - outb(dmapageport[chan], phys>>16); - - /* send count */ - outb(waport + 1, --nbytes); - outb(waport + 1, nbytes>>8); - - /* unmask channel */ - outb(DMA1_SMSK, chan | DMA37SM_CLEAR); - } else { - /* - * Program one of DMA channels 4..7. These are - * word mode channels. - */ - /* set dma channel mode, and reset address ff */ - if (flags & B_READ) - outb(DMA2_MODE, (chan & 3) | DMA37MD_SINGLE | DMA37MD_WRITE); - else - outb(DMA2_MODE, (chan & 3) | DMA37MD_SINGLE | DMA37MD_READ); - outb(DMA2_FFC, 0); - - /* send start address */ - waport = DMA2_CHN(chan & 3); - outb(waport, phys>>1); - outb(waport, phys>>9); - outb(dmapageport[chan], phys>>16); - - /* send count */ - nbytes >>= 1; - outb(waport + 2, --nbytes); - outb(waport + 2, nbytes>>8); - - /* unmask channel */ - outb(DMA2_SMSK, (chan & 3) | DMA37SM_CLEAR); - } -} - -void -isa_dmaabort(chan) - int chan; -{ - -#ifdef DIAGNOSTIC - if (chan < 0 || chan > 7) - panic("isa_dmaabort: impossible request"); -#endif - - bounced[chan] = 0; - - /* mask channel */ - if ((chan & 4) == 0) - outb(DMA1_SMSK, DMA37SM_SET | chan); - else - outb(DMA2_SMSK, DMA37SM_SET | (chan & 3)); -} - -void -isa_dmadone(flags, addr, nbytes, chan) - int flags; - caddr_t addr; - vm_size_t nbytes; - int chan; -{ - u_char tc; - -#ifdef DIAGNOSTIC - if (chan < 0 || chan > 7) - panic("isa_dmadone: impossible request"); -#endif - - /* check that the terminal count was reached */ - if ((chan & 4) == 0) - tc = inb(DMA1_SR) & (1 << chan); - else - tc = inb(DMA2_SR) & (1 << (chan & 3)); - if (tc == 0) - /* XXX probably should panic or something */ - log(LOG_ERR, "dma channel %d not finished\n", chan); - - /* mask channel */ - if ((chan & 4) == 0) - outb(DMA1_SMSK, DMA37SM_SET | chan); - else - outb(DMA2_SMSK, DMA37SM_SET | (chan & 3)); - - /* copy bounce buffer on read */ - if (bounced[chan]) { - bcopy(dma_bounce[chan], addr, nbytes); - bounced[chan] = 0; - } -} - -/* - * Check for problems with the address range of a DMA transfer - * (non-contiguous physical pages, outside of bus address space, - * crossing DMA page boundaries). - * Return true if special handling needed. - */ -int -isa_dmarangecheck(va, length, chan) - vm_offset_t va; - u_long length; - int chan; -{ - vm_offset_t phys, priorpage = 0, endva; - u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1); - - endva = round_page(va + length); - for (; va < endva ; va += NBPG) { - phys = trunc_page(pmap_extract(pmap_kernel(), va)); - if (phys == 0) - panic("isa_dmacheck: no physical page present"); - if (phys >= (1<<24)) - return 1; - if (priorpage) { - if (priorpage + NBPG != phys) - return 1; - /* check if crossing a DMA page boundary */ - if ((priorpage ^ phys) & dma_pgmsk) - return 1; - } - priorpage = phys; - } - return 0; -} - -/* head of queue waiting for physmem to become available */ -struct buf isa_physmemq; - -/* blocked waiting for resource to become free for exclusive use */ -static isaphysmemflag; -/* if waited for and call requested when free (B_CALL) */ -static void (*isaphysmemunblock)(); /* needs to be a list */ - -/* - * Allocate contiguous physical memory for transfer, returning - * a *virtual* address to region. May block waiting for resource. - * (assumed to be called at splbio()) - */ -caddr_t -isa_allocphysmem(caddr_t va, unsigned length, void (*func)()) { - - isaphysmemunblock = func; - while (isaphysmemflag & B_BUSY) { - isaphysmemflag |= B_WANTED; - sleep((caddr_t)&isaphysmemflag, PRIBIO); - } - isaphysmemflag |= B_BUSY; - - return((caddr_t)isaphysmem); -} - -/* - * Free contiguous physical memory used for transfer. - * (assumed to be called at splbio()) - */ -void -isa_freephysmem(caddr_t va, unsigned length) { - - isaphysmemflag &= ~B_BUSY; - if (isaphysmemflag & B_WANTED) { - isaphysmemflag &= B_WANTED; - wakeup((caddr_t)&isaphysmemflag); - if (isaphysmemunblock) - (*isaphysmemunblock)(); - } -} diff --git a/sys/arch/i386/isa/dmareg.h b/sys/arch/i386/isa/dmareg.h deleted file mode 100644 index d8006a23382..00000000000 --- a/sys/arch/i386/isa/dmareg.h +++ /dev/null @@ -1,21 +0,0 @@ -/* $NetBSD: dmareg.h,v 1.3 1995/01/29 02:58:25 cgd Exp $ */ - -#include <dev/ic/i8237.h> - -/* - * Register definitions for DMA controller 1 (channels 0..3): - */ -#define DMA1_CHN(c) (IO_DMA1 + 1*(2*(c))) /* addr reg for channel c */ -#define DMA1_SR (IO_DMA1 + 1*8) /* status register */ -#define DMA1_SMSK (IO_DMA1 + 1*10) /* single mask register */ -#define DMA1_MODE (IO_DMA1 + 1*11) /* mode register */ -#define DMA1_FFC (IO_DMA1 + 1*12) /* clear first/last FF */ - -/* - * Register definitions for DMA controller 2 (channels 4..7): - */ -#define DMA2_CHN(c) (IO_DMA2 + 2*(2*(c))) /* addr reg for channel c */ -#define DMA2_SR (IO_DMA2 + 2*8) /* status register */ -#define DMA2_SMSK (IO_DMA2 + 2*10) /* single mask register */ -#define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */ -#define DMA2_FFC (IO_DMA2 + 2*12) /* clear first/last FF */ diff --git a/sys/arch/i386/isa/dmavar.h b/sys/arch/i386/isa/dmavar.h deleted file mode 100644 index dd9cf9b62cc..00000000000 --- a/sys/arch/i386/isa/dmavar.h +++ /dev/null @@ -1,6 +0,0 @@ -/* $NetBSD: dmavar.h,v 1.2 1994/10/27 04:17:09 cgd Exp $ */ - -void isa_dmacascade __P((int)); -void isa_dmastart __P((int, caddr_t, vm_size_t, int)); -void isa_dmaabort __P((int)); -void isa_dmadone __P((int, caddr_t, vm_size_t, int)); diff --git a/sys/arch/i386/isa/fd.c b/sys/arch/i386/isa/fd.c index 257684c2814..e2aa7015fa5 100644 --- a/sys/arch/i386/isa/fd.c +++ b/sys/arch/i386/isa/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.72 1995/04/10 04:18:14 mycroft Exp $ */ +/* $NetBSD: fd.c,v 1.73 1995/04/17 12:07:06 cgd Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles Hannum. @@ -57,8 +57,8 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isadmavar.h> #include <i386/isa/fdreg.h> #ifdef NEWCONFIG #include <i386/isa/nvram.h> @@ -94,7 +94,7 @@ enum fdc_state { struct fdc_softc { struct device sc_dev; /* boilerplate */ struct isadev sc_id; - struct intrhand sc_ih; + void *sc_ih; int sc_iobase; int sc_drq; @@ -199,7 +199,7 @@ void fdcstart __P((struct fdc_softc *fdc)); void fdcstatus __P((struct device *dv, int n, char *s)); void fdctimeout __P((void *arg)); void fdcpseudointr __P((void *arg)); -int fdcintr __P((struct fdc_softc *)); +int fdcintr __P((void *)); void fdcretry __P((struct fdc_softc *fdc)); void fdfinish __P((struct fd_softc *fd, struct buf *bp)); @@ -307,10 +307,8 @@ fdcattach(parent, self, aux) at_setup_dmachan(fdc->sc_drq, FDC_MAXIOSIZE); isa_establish(&fdc->sc_id, &fdc->sc_dev); #endif - fdc->sc_ih.ih_fun = fdcintr; - fdc->sc_ih.ih_arg = fdc; - fdc->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &fdc->sc_ih); + fdc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + fdcintr, fdc); /* * The NVRAM info only tells us about the first two disks on the @@ -800,19 +798,19 @@ void fdcpseudointr(arg) void *arg; { - struct fdc_softc *fdc = arg; int s; /* Just ensure it has the right spl. */ s = splbio(); - (void) fdcintr(fdc); + (void) fdcintr(arg); splx(s); } int -fdcintr(fdc) - struct fdc_softc *fdc; +fdcintr(arg) + void *arg; { + struct fdc_softc *fdc = arg; #define st0 fdc->sc_status[0] #define cyl fdc->sc_status[1] struct fd_softc *fd; diff --git a/sys/arch/i386/isa/isa.c b/sys/arch/i386/isa/isa.c deleted file mode 100644 index 4d1861b1d5f..00000000000 --- a/sys/arch/i386/isa/isa.c +++ /dev/null @@ -1,120 +0,0 @@ -/* $NetBSD: isa.c,v 1.71 1995/01/16 10:36:26 mycroft Exp $ */ - -/*- - * Copyright (c) 1993, 1994 Charles Hannum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Charles Hannum. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/conf.h> -#include <sys/malloc.h> -#include <sys/device.h> - -#include <i386/isa/isareg.h> -#include <i386/isa/isavar.h> - -#include <machine/limits.h> - -/* sorry, has to be here, no place else really suitable */ -#include <machine/pc/display.h> -u_short *Crtat = (u_short *)MONO_BUF; - -int isamatch __P((struct device *, void *, void *)); -void isaattach __P((struct device *, struct device *, void *)); - -struct cfdriver isacd = { - NULL, "isa", isamatch, isaattach, DV_DULL, sizeof(struct device), 1 -}; - -int -isamatch(parent, match, aux) - struct device *parent; - void *match, *aux; -{ - - return (1); -} - -int -isaprint(aux, isa) - void *aux; - char *isa; -{ - struct isa_attach_args *ia = aux; - - 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); - return (UNCONF); -} - -void -isascan(parent, match) - struct device *parent; - void *match; -{ - struct device *dev = match; - struct cfdata *cf = dev->dv_cfdata; - struct isa_attach_args ia; - - if (cf->cf_fstate == FSTATE_STAR) - panic("not bloody likely"); - - ia.ia_iobase = cf->cf_loc[0]; - ia.ia_iosize = 0x666; - ia.ia_maddr = cf->cf_loc[2]; - ia.ia_msize = cf->cf_loc[3]; - ia.ia_irq = cf->cf_loc[4] == 2 ? 9 : cf->cf_loc[4]; - ia.ia_drq = cf->cf_loc[5]; - - if ((*cf->cf_driver->cd_match)(parent, dev, &ia) > 0) - config_attach(parent, dev, &ia, isaprint); - else - free(dev, M_DEVBUF); -} - -void -isaattach(parent, self, aux) - struct device *parent, *self; - void *aux; -{ - - printf("\n"); - - config_scan(isascan, self); -} diff --git a/sys/arch/i386/isa/isa_machdep.c b/sys/arch/i386/isa/isa_machdep.c new file mode 100644 index 00000000000..e71d26f523d --- /dev/null +++ b/sys/arch/i386/isa/isa_machdep.c @@ -0,0 +1,325 @@ +/* $NetBSD: isa_machdep.c,v 1.1 1995/04/17 12:07:11 cgd Exp $ */ + +/*- + * Copyright (c) 1993, 1994 Charles Hannum. + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)isa.c 7.2 (Berkeley) 5/13/91 + */ + +#include <sys/param.h> +#include <sys/syslog.h> +#include <sys/device.h> +#include <sys/malloc.h> + +#include <machine/pio.h> +#include <machine/cpufunc.h> + +#include <dev/isa/isareg.h> +#include <dev/isa/isavar.h> +#include <i386/isa/isa_machdep.h> +#include <i386/isa/icu.h> + +/* XXX NO BETTER PLACE TO PUT IT. */ +#include <machine/pc/display.h> +u_short *Crtat = (u_short *)MONO_BUF; +/* XXX end */ + +#define IDTVEC(name) __CONCAT(X,name) +/* default interrupt vector table entries */ +extern IDTVEC(wild), IDTVEC(intr)[], IDTVEC(fast)[]; +extern struct gate_descriptor idt[]; + +/* + * Fill in default interrupt table (in case of spuruious interrupt + * during configuration of kernel, setup interrupt control unit + */ +void +isa_defaultirq() +{ + int i; + + imask[IPL_BIO] |= SIR_CLOCKMASK; + imask[IPL_NET] |= SIR_NETMASK; + imask[IPL_TTY] |= SIR_TTYMASK; + imask[IPL_CLOCK] |= SIR_CLOCKMASK; + + /* icu vectors */ + for (i = 0; i < ICU_LEN; i++) + setgate(&idt[ICU_OFFSET + i], IDTVEC(intr)[i], 0, SDT_SYS386IGT, + SEL_KPL); + + /* initialize 8259's */ + outb(IO_ICU1, 0x11); /* reset; program device, four bytes */ + outb(IO_ICU1+1, ICU_OFFSET); /* starting at this vector index */ + outb(IO_ICU1+1, 1 << IRQ_SLAVE); /* slave on line 2 */ +#ifdef AUTO_EOI_1 + outb(IO_ICU1+1, 2 | 1); /* auto EOI, 8086 mode */ +#else + outb(IO_ICU1+1, 1); /* 8086 mode */ +#endif + outb(IO_ICU1+1, 0xff); /* leave interrupts masked */ + outb(IO_ICU1, 0x68); /* special mask mode (if available) */ + outb(IO_ICU1, 0x0a); /* Read IRR by default. */ +#ifdef REORDER_IRQ + outb(IO_ICU1, 0xc0 | (3 - 1)); /* pri order 3-7, 0-2 (com2 first) */ +#endif + + outb(IO_ICU2, 0x11); /* reset; program device, four bytes */ + outb(IO_ICU2+1, ICU_OFFSET+8); /* staring at this vector index */ + outb(IO_ICU2+1, IRQ_SLAVE); +#ifdef AUTO_EOI_2 + outb(IO_ICU2+1, 2 | 1); /* auto EOI, 8086 mode */ +#else + outb(IO_ICU2+1, 1); /* 8086 mode */ +#endif + outb(IO_ICU2+1, 0xff); /* leave interrupts masked */ + outb(IO_ICU2, 0x68); /* special mask mode (if available) */ + outb(IO_ICU2, 0x0a); /* Read IRR by default. */ +} + +/* + * Handle a NMI, possibly a machine check. + * return true to panic system, false to ignore. + */ +int +isa_nmi() +{ + + log(LOG_CRIT, "NMI port 61 %x, port 70 %x\n", inb(0x61), inb(0x70)); + return(0); +} + +/* + * Caught a stray interrupt, notify + */ +void +isa_strayintr(irq) + int irq; +{ + static u_long strays; + + /* + * Stray interrupts on irq 7 occur when an interrupt line is raised + * and then lowered before the CPU acknowledges it. This generally + * means either the device is screwed or something is cli'ing too + * long and it's timing out. + */ + if (++strays <= 5) + log(LOG_ERR, "stray interrupt %d%s\n", irq, + strays >= 5 ? "; stopped logging" : ""); +} + +int fastvec; +int intrtype[ICU_LEN], intrmask[ICU_LEN], intrlevel[ICU_LEN]; +struct intrhand *intrhand[ICU_LEN]; + +/* + * Recalculate the interrupt masks from scratch. + * We could code special registry and deregistry versions of this function that + * would be faster, but the code would be nastier, and we don't expect this to + * happen very much anyway. + */ +void +intr_calculatemasks() +{ + int irq, level; + struct intrhand *q; + + /* First, figure out which levels each IRQ uses. */ + for (irq = 0; irq < ICU_LEN; irq++) { + register int levels = 0; + for (q = intrhand[irq]; q; q = q->ih_next) + if (q->ih_level != IPL_NONE) + levels |= 1 << q->ih_level; + intrlevel[irq] = levels; + } + + /* Then figure out which IRQs use each level. */ + for (level = 0; level < 4; level++) { + register int irqs = 0; + for (irq = 0; irq < ICU_LEN; irq++) + if (intrlevel[irq] & (1 << level)) + irqs |= 1 << irq; + /* Preserve any softintr dependencies we set up earlier. */ + imask[level] = (imask[level] & -(1 << ICU_LEN)) | irqs; + } + +#include "sl.h" +#include "ppp.h" +#if NSL > 0 || NPPP > 0 + /* In the presence of SLIP or PPP, splimp > spltty. */ + imask[IPL_NET] |= imask[IPL_TTY]; +#endif + + /* And eventually calculate the complete masks. */ + for (irq = 0; irq < ICU_LEN; irq++) { + register int irqs = 1 << irq; + for (q = intrhand[irq]; q; q = q->ih_next) + if (q->ih_level != IPL_NONE) + irqs |= imask[q->ih_level]; + intrmask[irq] = irqs; + } + + /* Lastly, determine which IRQs are actually in use. */ + { + register int irqs = 0; + for (irq = 0; irq < ICU_LEN; irq++) + if (intrhand[irq]) + irqs |= 1 << irq; + if (irqs >= 0x100) /* any IRQs >= 8 in use */ + irqs |= 1 << IRQ_SLAVE; + imen = ~irqs; + SET_ICUS(); + } +} + +int +fakeintr(arg) + void *arg; +{ + + return 0; +} + +/* + * Set up an interrupt handler to start being called. + * XXX PRONE TO RACE CONDITIONS, UGLY, 'INTERESTING' INSERTION ALGORITHM. + */ +void * +isa_intr_establish(irq, type, level, ih_fun, ih_arg) + int irq; + isa_intrtype type; + isa_intrlevel level; + int (*ih_fun) __P((void *)); + void *ih_arg; +{ + int mask; + struct intrhand **p, *q, *ih; + static struct intrhand fakehand = {fakeintr}; + extern int cold; + + /* no point in sleeping unless someone can free memory. */ + ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); + if (ih == NULL) + panic("isa_intr_establish: can't malloc handler info"); + + mask = 1 << irq; + + if (irq < 0 || irq > ICU_LEN || type == ISA_IST_NONE) + panic("intr_establish: bogus irq or type"); + if (fastvec & mask) + panic("intr_establish: irq is already fast vector"); + + switch (intrtype[irq]) { + case ISA_IST_EDGE: + case ISA_IST_LEVEL: + if (type == intrtype[irq]) + break; + case ISA_IST_PULSE: + if (type != ISA_IST_NONE) + panic("intr_establish: can't share %s with %s", + isa_intr_typename(intrtype[irq]), + isa_intr_typename(type)); + break; + } + + /* + * Figure out where to put the handler. + * This is O(N^2), but we want to preserve the order, and N is + * generally small. + */ + for (p = &intrhand[irq]; (q = *p) != NULL; p = &q->ih_next) + ; + + /* + * Actually install a fake handler momentarily, since we might be doing + * this with interrupts enabled and don't want the real routine called + * until masking is set up. + */ + fakehand.ih_level = level; + *p = &fakehand; + + intr_calculatemasks(); + + /* + * Poke the real handler in now. + */ + ih->ih_fun = ih_fun; + ih->ih_arg = ih_arg; + ih->ih_count = 0; + ih->ih_next = NULL; + ih->ih_level = level; + ih->ih_irq = irq; + *p = ih; + + return (ih); +} + +/* + * Deregister an interrupt handler. + */ +void +intr_disestablish(ih) + struct intrhand *ih; +{ + int irq, mask; + struct intrhand **p, *q; + + irq = ih->ih_irq; + mask = 1 << irq; + + if (irq < 0 || irq > ICU_LEN) + panic("intr_disestablish: bogus irq"); + if (fastvec & mask) + fastvec &= ~mask; + + /* + * Remove the handler from the chain. + * This is O(n^2), too. + */ + for (p = &intrhand[irq]; (q = *p) != NULL && q != ih; p = &q->ih_next) + ; + if (q) + *p = q->ih_next; + else + panic("intr_disestablish: handler not registered"); + free(ih, M_DEVBUF); + + intr_calculatemasks(); + + if (intrhand[irq] == NULL) + intrtype[irq] = ISA_IST_NONE; +} diff --git a/sys/arch/i386/isa/isa_machdep.h b/sys/arch/i386/isa/isa_machdep.h new file mode 100644 index 00000000000..277421b4d9a --- /dev/null +++ b/sys/arch/i386/isa/isa_machdep.h @@ -0,0 +1,138 @@ +/* $NetBSD: isa_machdep.h,v 1.1 1995/04/17 12:07:12 cgd Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)isa.h 5.7 (Berkeley) 5/9/91 + */ + +/* + * XXX THIS FILE IS A MESS. copyright: berkeley's probably. + * contents from isavar.h and isareg.h, mostly the latter. + * perhaps charles's? + * + * copyright from berkeley's isa.h which is now dev/isa/isareg.h. + */ + + +/* + * XXX Various seemingly PC-specific constants, some of which may be + * unnecessary anyway. + */ + +/* + * RAM Physical Address Space (ignoring the above mentioned "hole") + */ +#define RAM_BEGIN 0x0000000 /* Start of RAM Memory */ +#define RAM_END 0x1000000 /* End of RAM Memory */ +#define RAM_SIZE (RAM_END - RAM_BEGIN) + +/* + * Oddball Physical Memory Addresses + */ +#define COMPAQ_RAMRELOC 0x80c00000 /* Compaq RAM relocation/diag */ +#define COMPAQ_RAMSETUP 0x80c00002 /* Compaq RAM setup */ +#define WEITEK_FPU 0xC0000000 /* WTL 2167 */ +#define CYRIX_EMC 0xC0000000 /* Cyrix EMC */ + +/* + * stuff that used to be in pccons.c + */ +#define MONO_BASE 0x3B4 +#define MONO_BUF (KERNBASE + 0xB0000) +#define CGA_BASE 0x3D4 +#define CGA_BUF (KERNBASE + 0xB8000) +#define IOPHYSMEM 0xA0000 + + +/* + * Interrupt handler chains. isa_intr_establish() inserts a handler into + * the list. The handler is called with its (single) argument. + */ + +struct intrhand { + int (*ih_fun)(); + void *ih_arg; + u_long ih_count; + struct intrhand *ih_next; + int ih_level; + int ih_irq; +}; + + +/* + * ISA DMA bounce buffers. + * XXX should be made partially machine- and bus-mapping-independent. + * + * DMA_BOUNCE is the number of pages of low-addressed physical memory + * to acquire for ISA bounce buffers. + * + * isaphysmem is the location of those bounce buffers. (They are currently + * assumed to be contiguous. + */ + +#ifndef DMA_BOUNCE +#define DMA_BOUNCE 8 /* one buffer per channel */ +#endif + +extern vm_offset_t isaphysmem; + + +/* + * Variables and macros to deal with the ISA I/O hole. + * XXX These should be converted to machine- and bus-mapping-independent + * function definitions, invoked through the softc. + */ + +extern int atdevbase; /* kernel virtual address of "hole" */ + +/* + * Given a kernel virtual address for some location + * in the "hole" I/O space, return a physical address. + */ +#define ISA_PHYSADDR(v) ((caddr_t) ((u_long)(v) - atdevbase + IOM_BEGIN)) + +/* + * Given a physical address in the "hole", + * return a kernel virtual address. + */ +#define ISA_HOLE_VADDR(p) ((caddr_t) ((u_long)(p) - IOM_BEGIN + atdevbase)) + + +/* + * Miscellanous functions. + */ +unsigned char rtcin __P((int)); /* read a value from the RTC */ +void sysbeep __P((int, int)); /* beep with the system speaker */ diff --git a/sys/arch/i386/isa/isareg.h b/sys/arch/i386/isa/isareg.h deleted file mode 100644 index 194706f2585..00000000000 --- a/sys/arch/i386/isa/isareg.h +++ /dev/null @@ -1,211 +0,0 @@ -/* $NetBSD: isareg.h,v 1.4 1994/10/27 04:17:49 cgd Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)isa.h 5.7 (Berkeley) 5/9/91 - */ - -/* - * ISA Bus conventions - */ - -#ifndef LOCORE -#include <sys/cdefs.h> - -unsigned char rtcin __P((int)); -void sysbeep __P((int, int)); -unsigned kbd_8042cmd __P((int)); -#endif /* !LOCORE */ - - -/* - * Input / Output Port Assignments - */ - -#ifndef IO_BEGIN -#define IO_ISABEGIN 0x000 /* 0x000 - Beginning of I/O Registers */ - - /* CPU Board */ -#define IO_DMA1 0x000 /* 8237A DMA Controller #1 */ -#define IO_ICU1 0x020 /* 8259A Interrupt Controller #1 */ -#define IO_PMP1 0x026 /* 82347 Power Management Peripheral */ -#define IO_TIMER1 0x040 /* 8253 Timer #1 */ -#define IO_TIMER2 0x048 /* 8253 Timer #2 (EISA only) */ -#define IO_KBD 0x060 /* 8042 Keyboard */ -#define IO_PPI 0x061 /* Programmable Peripheral Interface */ -#define IO_RTC 0x070 /* RTC */ -#define IO_NMI IO_RTC /* NMI Control */ -#define IO_DMAPG 0x080 /* DMA Page Registers */ -#define IO_ICU2 0x0A0 /* 8259A Interrupt Controller #2 */ -#define IO_DMA2 0x0C0 /* 8237A DMA Controller #2 */ -#define IO_NPX 0x0F0 /* Numeric Coprocessor */ - - /* Cards */ - /* 0x100 - 0x16F Open */ - -#define IO_WD2 0x170 /* Secondary Fixed Disk Controller */ -#define IO_PMP2 0x178 /* 82347 Power Management Peripheral */ - - /* 0x17A - 0x1EF Open */ - -#define IO_WD1 0x1f0 /* Primary Fixed Disk Controller */ -#define IO_GAME 0x200 /* Game Controller */ - - /* 0x208 - 0x237 Open */ - -#define IO_BMS2 0x238 /* secondary InPort Bus Mouse */ -#define IO_BMS1 0x23c /* primary InPort Bus Mouse */ - - /* 0x240 - 0x277 Open */ - -#define IO_LPT2 0x278 /* Parallel Port #2 */ - - /* 0x280 - 0x2E7 Open */ - -#define IO_COM4 0x2e8 /* COM4 i/o address */ - - /* 0x2F0 - 0x2F7 Open */ - -#define IO_COM2 0x2f8 /* COM2 i/o address */ - - /* 0x300 - 0x32F Open */ - -#define IO_BT0 0x330 /* bustek 742a default addr. */ -#define IO_AHA0 0x330 /* adaptec 1542 default addr. */ -#define IO_UHA0 0x330 /* ultrastore 14f default addr. */ -#define IO_BT1 0x334 /* bustek 742a default addr. */ -#define IO_AHA1 0x334 /* adaptec 1542 default addr. */ - - /* 0x338 - 0x34F Open */ - -#define IO_WDS 0x350 /* WD7000 scsi */ - - /* 0x354 - 0x36F Open */ - -#define IO_FD2 0x370 /* secondary base i/o address */ -#define IO_LPT1 0x378 /* Parallel Port #1 */ - - /* 0x380 - 0x3AF Open */ - -#define IO_MDA 0x3B0 /* Monochome Adapter */ -#define IO_LPT3 0x3BC /* Monochome Adapter Printer Port */ -#define IO_VGA 0x3C0 /* E/VGA Ports */ -#define IO_CGA 0x3D0 /* CGA Ports */ - - /* 0x3E0 - 0x3E7 Open */ - -#define IO_COM3 0x3e8 /* COM3 i/o address */ -#define IO_FD1 0x3f0 /* primary base i/o address */ -#define IO_COM1 0x3f8 /* COM1 i/o address */ - -#define IO_ISAEND 0x3FF /* - 0x3FF End of I/O Registers */ -#endif /* !IO_ISABEGIN */ - -/* - * Input / Output Port Sizes - these are from several sources, and tend - * to be the larger of what was found, ie COM ports can be 4, but some - * boards do not fully decode the address, thus 8 ports are used. - */ - -#ifndef IO_ISASIZES -#define IO_ISASIZES - -#define IO_COMSIZE 8 /* 8250, 16X50 com controllers (*/ -#define IO_CGASIZE 16 /* CGA controllers */ -#define IO_DMASIZE 16 /* 8237 DMA controllers */ -#define IO_DPGSIZE 32 /* 74LS612 DMA page reisters */ -#define IO_FDCSIZE 8 /* Nec765 floppy controllers */ -#define IO_WDCSIZE 8 /* WD compatible disk controller */ -#define IO_GAMSIZE 16 /* AT compatible game controller */ -#define IO_ICUSIZE 16 /* 8259A interrupt controllers */ -#define IO_KBDSIZE 16 /* 8042 Keyboard controllers */ -#define IO_LPTSIZE 8 /* LPT controllers, some use onl */ -#define IO_MDASIZE 16 /* Monochrome display controller */ -#define IO_RTCSIZE 16 /* CMOS real time clock, NMI con */ -#define IO_TMRSIZE 16 /* 8253 programmable timers */ -#define IO_NPXSIZE 16 /* 80387/80487 NPX registers */ -#define IO_VGASIZE 16 /* VGA controllers */ -#define IO_PMPSIZE 2 /* 82347 Power Management Peripheral */ -#endif /* !IO_ISASIZES */ - -/* - * Input / Output Memory Physical Addresses - */ - -#ifndef IOM_BEGIN -#define IOM_BEGIN 0x0a0000 /* Start of I/O Memory "hole" */ -#define IOM_END 0x100000 /* End of I/O Memory "hole" */ -#define IOM_SIZE (IOM_END - IOM_BEGIN) -#endif /* !IOM_BEGIN */ - -/* - * RAM Physical Address Space (ignoring the above mentioned "hole") - */ - -#ifndef RAM_BEGIN -#define RAM_BEGIN 0x0000000 /* Start of RAM Memory */ -#define RAM_END 0x1000000 /* End of RAM Memory */ -#define RAM_SIZE (RAM_END - RAM_BEGIN) -#endif /* !RAM_BEGIN */ - -/* - * Oddball Physical Memory Addresses - */ -#ifndef COMPAQ_RAMRELOC -#define COMPAQ_RAMRELOC 0x80c00000 /* Compaq RAM relocation/diag */ -#define COMPAQ_RAMSETUP 0x80c00002 /* Compaq RAM setup */ -#define WEITEK_FPU 0xC0000000 /* WTL 2167 */ -#define CYRIX_EMC 0xC0000000 /* Cyrix EMC */ -#endif /* !COMPAQ_RAMRELOC */ - -/* stuff that used to be in pccons.c */ -#define MONO_BASE 0x3B4 -#define MONO_BUF (KERNBASE + 0xB0000) -#define CGA_BASE 0x3D4 -#define CGA_BUF (KERNBASE + 0xB8000) -#define IOPHYSMEM 0xA0000 - -/* - * size of dma bounce buffer in pages - * - currently 1 page per channel - */ -#ifndef DMA_BOUNCE -#define DMA_BOUNCE 8 -#endif - -#ifndef LOCORE -extern vm_offset_t isaphysmem; -#endif /* !LOCORE */ diff --git a/sys/arch/i386/isa/isavar.h b/sys/arch/i386/isa/isavar.h deleted file mode 100644 index 15e9d11f160..00000000000 --- a/sys/arch/i386/isa/isavar.h +++ /dev/null @@ -1,114 +0,0 @@ -/* $NetBSD: isavar.h,v 1.14 1995/01/03 03:14:35 mycroft Exp $ */ - -/* - * Copyright (c) 1992 Berkeley Software Design, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Berkeley Software - * Design, Inc. - * 4. The name of Berkeley Software Design must not be used to endorse - * or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * BSDI Id: isavar.h,v 1.5 1992/12/01 18:06:00 karels Exp - */ - -/* - * ISA driver attach arguments - */ -struct isa_attach_args { - 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_maddr; /* physical i/o mem addr */ - u_int ia_msize; /* size of i/o memory */ - void *ia_aux; /* driver specific */ -}; - -#define IOBASEUNK -1 /* i/o address is unknown */ -#define IRQUNK -1 /* interrupt request line is unknown */ -#define DRQUNK -1 /* DMA request line is unknown */ -#define MADDRUNK -1 /* shared memory address is unknown */ - -/* - * per-device ISA variables - */ -struct isadev { - struct device *id_dev; /* back pointer to generic */ - struct isadev *id_bchain; /* forward link in bus chain */ -}; - -/* - * ISA masterbus - */ -struct isa_softc { - struct device sc_dev; /* base device */ - struct isadev *sc_isadev; /* list of all children */ -}; - -#define cf_iobase cf_loc[0] -#define cf_iosize cf_loc[1] -#define cf_maddr cf_loc[2] -#define cf_msize cf_loc[3] -#define cf_irq cf_loc[4] -#define cf_drq cf_loc[5] - -/* - * Interrupt handler chains. Interrupt handlers should return 0 for - * `not I', 1 (`I took care of it'), or -1 (`I guess it was mine, but - * I wasn't expecting it'). intr_establish() inserts a handler into - * the list. The handler is called with its (single) argument. - */ -struct intrhand { - int (*ih_fun)(); - void *ih_arg; - u_long ih_count; - struct intrhand *ih_next; - int ih_level; -}; - -void intr_establish __P((int intr, int type, struct intrhand *)); -void intr_disestablish __P((int intr, struct intrhand *)); -void isa_establish __P((struct isadev *, struct device *)); - -/* - * software conventions - */ -typedef enum { BUS_ISA, BUS_EISA, BUS_MCA } isa_type; - -extern int atdevbase; /* kernel virtual address of "hole" */ -extern isa_type isa_bustype; /* type of bus */ - -/* - * Given a kernel virtual address for some location - * in the "hole" I/O space, return a physical address. - */ -#define ISA_PHYSADDR(v) ((caddr_t) ((u_long)(v) - atdevbase + IOM_BEGIN)) -/* - * Given a physical address in the "hole", - * return a kernel virtual address. - */ -#define ISA_HOLE_VADDR(p) ((caddr_t) ((u_long)(p) - IOM_BEGIN + atdevbase)) diff --git a/sys/arch/i386/isa/lms.c b/sys/arch/i386/isa/lms.c index e2ec584a72a..52d06454e77 100644 --- a/sys/arch/i386/isa/lms.c +++ b/sys/arch/i386/isa/lms.c @@ -1,4 +1,4 @@ -/* $NetBSD: lms.c,v 1.18 1995/01/03 01:30:49 mycroft Exp $ */ +/* $NetBSD: lms.c,v 1.19 1995/04/17 12:07:17 cgd Exp $ */ /*- * Copyright (c) 1993, 1994 Charles Hannum. @@ -40,7 +40,7 @@ #include <machine/pio.h> #include <machine/mouse.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #define LMS_DATA 0 /* offset for data port, read-only */ #define LMS_SIGN 1 /* offset for signature port, read-write */ @@ -54,7 +54,7 @@ struct lms_softc { /* driver status information */ struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; struct clist sc_q; struct selinfo sc_rsel; @@ -68,7 +68,7 @@ struct lms_softc { /* driver status information */ int lmsprobe __P((struct device *, void *, void *)); void lmsattach __P((struct device *, struct device *, void *)); -int lmsintr __P((struct lms_softc *)); +int lmsintr __P((void *)); struct cfdriver lmscd = { NULL, "lms", lmsprobe, lmsattach, DV_TTY, sizeof(struct lms_softc) @@ -119,10 +119,8 @@ lmsattach(parent, self, aux) sc->sc_iobase = iobase; sc->sc_state = 0; - sc->sc_ih.ih_fun = lmsintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_NONE; - intr_establish(ia->ia_irq, IST_PULSE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_PULSE, ISA_IPL_NONE, + lmsintr, sc); } int @@ -272,9 +270,10 @@ lmsioctl(dev, cmd, addr, flag) } int -lmsintr(sc) - struct lms_softc *sc; +lmsintr(arg) + void *arg; { + struct lms_softc *sc = arg; int iobase = sc->sc_iobase; u_char hi, lo, buttons, changed; char dx, dy; diff --git a/sys/arch/i386/isa/mms.c b/sys/arch/i386/isa/mms.c index ad0cecb509f..020c56ee44f 100644 --- a/sys/arch/i386/isa/mms.c +++ b/sys/arch/i386/isa/mms.c @@ -1,4 +1,4 @@ -/* $NetBSD: mms.c,v 1.17 1995/01/03 01:30:51 mycroft Exp $ */ +/* $NetBSD: mms.c,v 1.18 1995/04/17 12:07:19 cgd Exp $ */ /*- * Copyright (c) 1993, 1994 Charles Hannum. @@ -40,7 +40,7 @@ #include <machine/pio.h> #include <machine/mouse.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #define MMS_ADDR 0 /* offset for register select */ #define MMS_DATA 1 /* offset for InPort data */ @@ -52,7 +52,7 @@ struct mms_softc { /* driver status information */ struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; struct clist sc_q; struct selinfo sc_rsel; @@ -66,7 +66,7 @@ struct mms_softc { /* driver status information */ int mmsprobe __P((struct device *, void *, void *)); void mmsattach __P((struct device *, struct device *, void *)); -int mmsintr __P((struct mms_softc *)); +int mmsintr __P((void *)); struct cfdriver mmscd = { NULL, "mms", mmsprobe, mmsattach, DV_TTY, sizeof(struct mms_softc) @@ -109,10 +109,8 @@ mmsattach(parent, self, aux) sc->sc_iobase = iobase; sc->sc_state = 0; - sc->sc_ih.ih_fun = mmsintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_NONE; - intr_establish(ia->ia_irq, IST_PULSE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_PULSE, ISA_IPL_NONE, + mmsintr, sc); } int @@ -263,9 +261,10 @@ mmsioctl(dev, cmd, addr, flag) } int -mmsintr(sc) - struct mms_softc *sc; +mmsintr(arg) + void *arg; { + struct mms_softc *sc = arg; int iobase = sc->sc_iobase; u_char buttons, changed, status; char dx, dy; diff --git a/sys/arch/i386/isa/npx.c b/sys/arch/i386/isa/npx.c index b400c18b60a..887152a3ef4 100644 --- a/sys/arch/i386/isa/npx.c +++ b/sys/arch/i386/isa/npx.c @@ -1,4 +1,4 @@ -/* $NetBSD: npx.c,v 1.34 1995/01/26 06:35:42 mycroft Exp $ */ +/* $NetBSD: npx.c,v 1.35 1995/04/17 12:07:21 cgd Exp $ */ /*- * Copyright (c) 1994, 1995 Charles Hannum. @@ -54,8 +54,8 @@ #include <machine/specialreg.h> #include <i386/isa/icu.h> -#include <i386/isa/isavar.h> -#include <i386/isa/isareg.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isareg.h> /* * 387 and 287 Numeric Coprocessor Extension (NPX) Driver. @@ -86,13 +86,13 @@ extern struct gate_descriptor idt[]; int npxdna __P((void)); void npxexit __P((void)); void npxinit __P((void)); -int npxintr __P((struct intrframe *frame)); +int npxintr __P((void *)); void npxsave __P((struct save87 *addr)); int npxprobe1 __P((struct isa_attach_args *)); struct npx_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; }; int npxprobe __P((struct device *, void *, void *)); @@ -324,10 +324,8 @@ npxattach(parent, self, aux) switch (npx_type) { case NPX_INTERRUPT: printf("\n"); - sc->sc_ih.ih_fun = npxintr; - sc->sc_ih.ih_arg = 0; - sc->sc_ih.ih_level = IPL_NONE; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, + ISA_IPL_NONE, npxintr, 0); break; case NPX_EXCEPTION: printf(": using exception 16\n"); @@ -363,11 +361,12 @@ npxattach(parent, self, aux) * IRQ13 exception handling makes exceptions even less precise than usual. */ int -npxintr(frame) - struct intrframe *frame; +npxintr(arg) + void *arg; { register struct proc *p = npxproc; register struct save87 *addr; + struct intrframe *frame = arg; int code; cnt.v_trap++; diff --git a/sys/arch/i386/isa/pas.c b/sys/arch/i386/isa/pas.c index 3270a7d5492..683221b73ef 100644 --- a/sys/arch/i386/isa/pas.c +++ b/sys/arch/i386/isa/pas.c @@ -1,4 +1,4 @@ -/* $NetBSD: pas.c,v 1.4 1995/03/25 00:01:19 mycroft Exp $ */ +/* $NetBSD: pas.c,v 1.5 1995/04/17 12:07:23 cgd Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pas.c,v 1.4 1995/03/25 00:01:19 mycroft Exp $ + * $Id: pas.c,v 1.5 1995/04/17 12:07:23 cgd Exp $ */ /* * Todo: @@ -54,8 +54,8 @@ #include <sys/audioio.h> #include <dev/audio_if.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isadmavar.h> #include <i386/isa/icu.h> #include <i386/isa/sbdspvar.h> @@ -89,7 +89,7 @@ int pasdebug = 0; struct pas_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ u_short sc_iobase; /* PAS iobase */ u_short sc_irq; /* PAS irq */ @@ -439,10 +439,8 @@ pasattach(parent, self, aux) #ifdef NEWCONFIG isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih.ih_fun = sbdsp_intr; - sc->sc_ih.ih_arg = &sc->sc_sbdsp; - sc->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + sbdsp_intr, &sc->sc_sbdsp); #ifdef NEWCONFIG /* diff --git a/sys/arch/i386/isa/pccons.c b/sys/arch/i386/isa/pccons.c index 9f5e0134c2d..04903842474 100644 --- a/sys/arch/i386/isa/pccons.c +++ b/sys/arch/i386/isa/pccons.c @@ -1,4 +1,4 @@ -/* $NetBSD: pccons.c,v 1.80 1995/04/10 01:04:33 mycroft Exp $ */ +/* $NetBSD: pccons.c,v 1.81 1995/04/17 12:07:26 cgd Exp $ */ /*- * Copyright (c) 1993, 1994 Charles Hannum. @@ -66,8 +66,9 @@ #include <machine/pc/display.h> #include <machine/pccons.h> -#include <i386/isa/isareg.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isareg.h> +#include <dev/isa/isavar.h> +#include <i386/isa/isa_machdep.h> #include <i386/isa/kbdreg.h> #define XFREE86_BUG_COMPAT @@ -113,7 +114,7 @@ static struct video_state { int pcprobe __P((struct device *, void *, void *)); void pcattach __P((struct device *, struct device *, void *)); -int pcintr __P((void)); +int pcintr __P((void *)); struct cfdriver pccd = { NULL, "pc", pcprobe, pcattach, DV_TTY, sizeof(struct device) @@ -462,15 +463,12 @@ pcattach(parent, self, aux) void *aux; { struct isa_attach_args *ia = aux; - static struct intrhand pchand; printf(": %s\n", vs.color ? "color" : "mono"); do_async_update(1); - pchand.ih_fun = pcintr; - pchand.ih_arg = 0; - pchand.ih_level = IPL_TTY; - intr_establish(ia->ia_irq, IST_EDGE, &pchand); + (void)isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_TTY, + pcintr, 0); } int @@ -554,7 +552,8 @@ pcwrite(dev, uio, flag) * Catch the character, and see who it goes to. */ int -pcintr() +pcintr(arg) + void *arg; { register struct tty *tp = pc_tty[0]; /* XXX */ u_char *cp; @@ -762,7 +761,7 @@ pccnpollc(dev, on) * won't get any further interrupts. */ s = spltty(); - pcintr(); + pcintr(0); splx(s); } } diff --git a/sys/arch/i386/isa/pms.c b/sys/arch/i386/isa/pms.c index 7015c1bfacc..440351e40cd 100644 --- a/sys/arch/i386/isa/pms.c +++ b/sys/arch/i386/isa/pms.c @@ -1,4 +1,4 @@ -/* $NetBSD: pms.c,v 1.19 1995/01/07 22:48:29 mycroft Exp $ */ +/* $NetBSD: pms.c,v 1.20 1995/04/17 12:07:31 cgd Exp $ */ /*- * Copyright (c) 1994 Charles Hannum. @@ -89,7 +89,7 @@ struct pms_softc { /* driver status information */ struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; struct clist sc_q; struct selinfo sc_rsel; @@ -102,7 +102,7 @@ struct pms_softc { /* driver status information */ int pmsprobe __P((struct device *, void *, void *)); void pmsattach __P((struct device *, struct device *, void *)); -int pmsintr __P((struct pms_softc *)); +int pmsintr __P((void *)); struct cfdriver pmscd = { NULL, "pms", pmsprobe, pmsattach, DV_TTY, sizeof(struct pms_softc) @@ -192,10 +192,8 @@ pmsattach(parent, self, aux) /* Other initialization was done by pmsprobe. */ sc->sc_state = 0; - sc->sc_ih.ih_fun = pmsintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_NONE; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_NONE, + pmsintr, sc); } int @@ -362,9 +360,10 @@ pmsioctl(dev, cmd, addr, flag) #define PS2MBUTMASK 0x04 int -pmsintr(sc) - struct pms_softc *sc; +pmsintr(arg) + void *arg; { + struct pms_softc *sc = arg; static int state = 0; static u_char buttons; u_char changed; diff --git a/sys/arch/i386/isa/pss.c b/sys/arch/i386/isa/pss.c index ca65ef4898e..6413b38b78e 100644 --- a/sys/arch/i386/isa/pss.c +++ b/sys/arch/i386/isa/pss.c @@ -1,4 +1,4 @@ -/* $NetBSD: pss.c,v 1.3 1995/03/25 00:01:10 mycroft Exp $ */ +/* $NetBSD: pss.c,v 1.4 1995/04/17 12:07:34 cgd Exp $ */ /* * Copyright (c) 1994 John Brezak @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pss.c,v 1.3 1995/03/25 00:01:10 mycroft Exp $ + * $Id: pss.c,v 1.4 1995/04/17 12:07:34 cgd Exp $ */ /* @@ -66,7 +66,7 @@ #include <sys/audioio.h> #include <dev/audio_if.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <i386/isa/dmavar.h> #include <i386/isa/icu.h> @@ -107,40 +107,40 @@ struct pss_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ u_short sc_iobase; /* I/O port base address */ - u_short sc_drq; /* dma channel */ + u_short sc_drq; /* dma channel */ - struct ad1848_softc *ad1848_sc; + struct ad1848_softc *ad1848_sc; - int out_port; + int out_port; - struct ad1848_volume master_volume; - int master_mode; + struct ad1848_volume master_volume; + int master_mode; - int monitor_treble; - int monitor_bass; + int monitor_treble; + int monitor_bass; - int mic_mute, cd_mute, dac_mute; + int mic_mute, cd_mute, dac_mute; }; struct mpu_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ - u_short sc_iobase; /* MIDI I/O port base address */ - u_short sc_irq; /* MIDI interrupt */ + u_short sc_iobase; /* MIDI I/O port base address */ + u_short sc_irq; /* MIDI interrupt */ }; struct cd_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ - u_short sc_iobase; /* CD I/O port base address */ - u_short sc_irq; /* CD interrupt */ + u_short sc_iobase; /* CD I/O port base address */ + u_short sc_irq; /* CD interrupt */ }; #define DEBUG /*XXX*/ @@ -165,8 +165,8 @@ void pcdattach __P((struct device *, struct device *, void *)); int spopen __P((dev_t, int)); -int pssintr __P((struct pss_softc *)); -int mpuintr __P((struct mpu_softc *)); +int pssintr __P((void *)); +int mpuintr __P((void *)); int pss_speaker_ctl __P((void *, int)); @@ -1004,10 +1004,8 @@ pssattach(parent, self, aux) #endif /* Setup interrupt handler for PSS */ - sc->sc_ih.ih_fun = pssintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_CLOCK; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_CLOCK, + pssintr, sc); vers = (inw(sc->sc_iobase+PSS_ID_VERS)&0xff) - 1; printf(": esc614%c\n", (vers > 0)?'A'+vers:' '); @@ -1041,10 +1039,8 @@ spattach(parent, self, aux) isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih.ih_fun = ad1848_intr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_CLOCK; - intr_establish(cf->cf_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(cf->cf_irq, ISA_IST_EDGE, ISA_IPL_CLOCK, + ad1848_intr, sc); /* XXX might use pssprint func ?? */ printf(" port 0x%x-0x%x irq %d drq %d", @@ -1071,10 +1067,8 @@ mpuattach(parent, self, aux) isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih.ih_fun = mpuintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_CLOCK; - intr_establish(cf->cf_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(cf->cf_irq, ISA_IST_EDGE, ISA_IPL_CLOCK, + mpuintr, sc); /* XXX might use pssprint func ?? */ printf(" port 0x%x-0x%x irq %d\n", @@ -1304,9 +1298,10 @@ pss_speaker_ctl(addr, newstate) } int -pssintr(sc) - register struct pss_softc *sc; +pssintr(arg) + void *arg; { + register struct pss_softc *sc = arg; u_short sr; sr = inw(sc->sc_iobase+PSS_STATUS); @@ -1326,9 +1321,10 @@ pssintr(sc) } int -mpuintr(sc) - register struct mpu_softc *sc; +mpuintr(arg) + void *arg; { + register struct mpu_softc *sc = arg; u_char sr; sr = inb(sc->sc_iobase+MIDI_STATUS_REG); diff --git a/sys/arch/i386/isa/sb.c b/sys/arch/i386/isa/sb.c index 7dd70c3f42f..f0d876d5ad6 100644 --- a/sys/arch/i386/isa/sb.c +++ b/sys/arch/i386/isa/sb.c @@ -1,4 +1,4 @@ -/* $NetBSD: sb.c,v 1.22 1995/03/25 00:01:23 mycroft Exp $ */ +/* $NetBSD: sb.c,v 1.23 1995/04/17 12:07:37 cgd Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sb.c,v 1.22 1995/03/25 00:01:23 mycroft Exp $ + * $Id: sb.c,v 1.23 1995/04/17 12:07:37 cgd Exp $ */ #include <sys/param.h> @@ -49,8 +49,8 @@ #include <sys/audioio.h> #include <dev/audio_if.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isadmavar.h> #include <i386/isa/icu.h> #include <i386/isa/sbdspvar.h> @@ -67,9 +67,9 @@ int sbdebug = 0; struct sb_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ - struct sbdsp_softc sc_sbdsp; + struct sbdsp_softc sc_sbdsp; }; int sbprobe(); @@ -277,10 +277,8 @@ sbattach(parent, self, aux) #ifdef NEWCONFIG isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih.ih_fun = sbdsp_intr; - sc->sc_ih.ih_arg = &sc->sc_sbdsp; - sc->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + sbdsp_intr, &sc->sc_sbdsp); sbdsp_attach(&sc->sc_sbdsp); diff --git a/sys/arch/i386/isa/sbdsp.c b/sys/arch/i386/isa/sbdsp.c index cbccd510e56..9e7488a3d85 100644 --- a/sys/arch/i386/isa/sbdsp.c +++ b/sys/arch/i386/isa/sbdsp.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbdsp.c,v 1.5 1995/03/25 00:01:00 mycroft Exp $ */ +/* $NetBSD: sbdsp.c,v 1.6 1995/04/17 12:07:41 cgd Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sbdsp.c,v 1.5 1995/03/25 00:01:00 mycroft Exp $ + * $Id: sbdsp.c,v 1.6 1995/04/17 12:07:41 cgd Exp $ */ /* * SoundBlaster Pro code provided by John Kohl, based on lots of @@ -57,8 +57,8 @@ #include <sys/audioio.h> #include <dev/audio_if.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isadmavar.h> #include <i386/isa/icu.h> #include <i386/isa/sbreg.h> @@ -1123,9 +1123,10 @@ sbdsp_dma_output(addr, p, cc, intr, arg) * exclusive so we know a priori which event has occurred. */ int -sbdsp_intr(sc) - register struct sbdsp_softc *sc; +sbdsp_intr(arg) + void *arg; { + register struct sbdsp_softc *sc = arg; #ifdef DEBUG if (sbdspdebug > 1) diff --git a/sys/arch/i386/isa/sbdspvar.h b/sys/arch/i386/isa/sbdspvar.h index 2d642148116..dc16d9e049b 100644 --- a/sys/arch/i386/isa/sbdspvar.h +++ b/sys/arch/i386/isa/sbdspvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sbdspvar.h,v 1.4 1995/03/28 18:17:49 jtc Exp $ */ +/* $NetBSD: sbdspvar.h,v 1.5 1995/04/17 12:07:44 cgd Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sbdspvar.h,v 1.4 1995/03/28 18:17:49 jtc Exp $ + * $Id: sbdspvar.h,v 1.5 1995/04/17 12:07:44 cgd Exp $ */ #define SB_MIC_PORT 0 @@ -74,7 +74,7 @@ struct sbdsp_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ u_short sc_iobase; /* I/O port base address */ u_short sc_irq; /* interrupt */ @@ -184,7 +184,7 @@ void sbdsp_spkroff __P((struct sbdsp_softc *)); int sbdsp_wdsp(u_short iobase, int v); int sbdsp_rdsp(u_short iobase); -int sbdsp_intr __P((struct sbdsp_softc *)); +int sbdsp_intr __P((void *)); short sbversion __P((struct sbdsp_softc *)); int sbdsp_set_sr __P((struct sbdsp_softc *, u_long *, int)); diff --git a/sys/arch/i386/isa/vector.s b/sys/arch/i386/isa/vector.s index 63539361d88..71005d98f87 100644 --- a/sys/arch/i386/isa/vector.s +++ b/sys/arch/i386/isa/vector.s @@ -1,4 +1,4 @@ -/* $NetBSD: vector.s,v 1.24 1994/11/18 22:22:41 mycroft Exp $ */ +/* $NetBSD: vector.s,v 1.25 1995/04/17 12:07:47 cgd Exp $ */ /* * Copyright (c) 1993, 1994 Charles Hannum. All rights reserved. @@ -30,7 +30,7 @@ */ #include <i386/isa/icu.h> -#include <i386/isa/isareg.h> +#include <dev/isa/isareg.h> /* * These macros are fairly self explanatory. If SPECIAL_MASK_MODE is defined, diff --git a/sys/arch/i386/isa/wss.c b/sys/arch/i386/isa/wss.c index 463ca2da351..3fcd3b3491f 100644 --- a/sys/arch/i386/isa/wss.c +++ b/sys/arch/i386/isa/wss.c @@ -1,4 +1,4 @@ -/* $NetBSD: wss.c,v 1.2 1995/03/25 00:01:07 mycroft Exp $ */ +/* $NetBSD: wss.c,v 1.3 1995/04/17 12:07:50 cgd Exp $ */ /* * Copyright (c) 1994 John Brezak @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: wss.c,v 1.2 1995/03/25 00:01:07 mycroft Exp $ + * $Id: wss.c,v 1.3 1995/04/17 12:07:50 cgd Exp $ */ #include <sys/param.h> @@ -51,8 +51,8 @@ #include <sys/audioio.h> #include <dev/audio_if.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isadmavar.h> #include <i386/isa/icu.h> #include <i386/isa/ad1848var.h> @@ -89,14 +89,14 @@ int wssdebug = 0; struct wss_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ struct ad1848_softc sc_ad1848; #define wss_iobase sc_ad1848.sc_iobase #define wss_irq sc_ad1848.sc_irq #define wss_drq sc_ad1848.sc_drq - int mic_mute, cd_mute, dac_mute; + int mic_mute, cd_mute, dac_mute; }; struct audio_device wss_device = { @@ -251,10 +251,8 @@ wssattach(parent, self, aux) #ifdef NEWCONFIG isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih.ih_fun = ad1848_intr; - sc->sc_ih.ih_arg = &sc->sc_ad1848; - sc->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + ad1848_intr, &sc->sc_ad1848); ad1848_attach(&sc->sc_ad1848); diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c index 34eb4d760ec..560b653689e 100644 --- a/sys/arch/i386/pci/pci_machdep.c +++ b/sys/arch/i386/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.11 1995/04/10 13:15:02 mycroft Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.12 1995/04/17 12:07:58 cgd Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -54,11 +54,14 @@ #include <machine/pio.h> #include <i386/isa/icu.h> +#include <dev/isa/isavar.h> #include <dev/pci/pcivar.h> #include <dev/pci/pcireg.h> int pci_mode = -1; +static isa_intrlevel pcilevel_to_isa __P((pci_intrlevel level)); + int pcimatch(parent, match, aux) struct device *parent; @@ -328,10 +331,12 @@ pci_map_mem(tag, reg, vap, pap) return 0; } -int -pci_map_int(tag, ih) +void * +pci_map_int(tag, level, func, arg) pcitag_t tag; - struct intrhand *ih; + pci_intrlevel level; + int (*func) __P((void *)); + void *arg; { pcireg_t data; int pin, line; @@ -348,7 +353,7 @@ pci_map_int(tag, ih) if (pin > 4) { printf("pci_map_int: bad interrupt pin %d\n", pin); - return EINVAL; + return NULL; } /* @@ -366,11 +371,11 @@ pci_map_int(tag, ih) */ if (line == 0 || line == 255) { printf("pci_map_int: no mapping for pin %c\n", '@' + pin); - return EINVAL; + return NULL; } else { if (line >= ICU_LEN) { printf("pci_map_int: bad interrupt line %d\n", line); - return EINVAL; + return NULL; } if (line == 2) { printf("pci_map_int: changed line 2 to line 9\n"); @@ -382,6 +387,32 @@ pci_map_int(tag, ih) printf("pci_map_int: pin %c mapped to line %d\n", '@' + pin, line); #endif - intr_establish(line, IST_LEVEL, ih); - return 0; + return isa_intr_establish(line, ISA_IST_LEVEL, pcilevel_to_isa(level), + func, arg); +} + +static isa_intrlevel +pcilevel_to_isa(level) + pci_intrlevel level; +{ + + switch (level) { + case PCI_IPL_NONE: + return (ISA_IPL_NONE); + + case PCI_IPL_BIO: + return (ISA_IPL_BIO); + + case PCI_IPL_NET: + return (ISA_IPL_NET); + + case PCI_IPL_TTY: + return (ISA_IPL_TTY); + + case PCI_IPL_CLOCK: + return (ISA_IPL_CLOCK); + + default: + panic("pcilevel_to_isa: unknown level %d\n", level); + } } diff --git a/sys/arch/i386/pci/pci_machdep.h b/sys/arch/i386/pci/pci_machdep.h index 838631fb2ef..56708780ab6 100644 --- a/sys/arch/i386/pci/pci_machdep.h +++ b/sys/arch/i386/pci/pci_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.h,v 1.2 1994/10/27 04:21:40 cgd Exp $ */ +/* $NetBSD: pci_machdep.h,v 1.3 1995/04/17 12:08:00 cgd Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -35,9 +35,6 @@ * See the comments in pci_machdep.c for more explanation. */ -/* Need this for struct intrhand. */ -#include <i386/isa/isavar.h> - /* * Configuration tag; created from a {bus,device,function} triplet by * pci_make_tag(), and passed to pci_conf_read() and pci_conf_write(). diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index d945e394a78..0ae8f6eb282 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wd.c,v 1.138 1995/04/15 05:02:56 mycroft Exp $ */ +/* $NetBSD: wd.c,v 1.139 1995/04/17 12:09:31 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -54,7 +54,7 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <dev/isa/wdreg.h> #define WAITTIME (4 * hz) /* time to wait for a completion */ @@ -120,7 +120,7 @@ struct wd_softc { struct wdc_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; int sc_iobase; /* I/O port base */ int sc_drq; /* DMA channel */ @@ -158,7 +158,7 @@ void wdstart __P((struct wd_softc *)); struct dkdriver wddkdriver = { wdstrategy }; void wdfinish __P((struct wd_softc *, struct buf *)); -int wdcintr __P((struct wdc_softc *)); +int wdcintr __P((void *)); void wdcstart __P((struct wdc_softc *)); int wdcommand __P((struct wd_softc *, int, int, int, int, int)); int wdcommandshort __P((struct wdc_softc *, int, int)); @@ -249,10 +249,8 @@ wdcattach(parent, self, aux) printf("\n"); - wdc->sc_ih.ih_fun = wdcintr; - wdc->sc_ih.ih_arg = wdc; - wdc->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &wdc->sc_ih); + wdc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + wdcintr, wdc); for (wa.wa_drive = 0; wa.wa_drive < 2; wa.wa_drive++) (void)config_found(self, (void *)&wa, wdprint); @@ -700,9 +698,10 @@ loop: * the next chunk if so. */ int -wdcintr(wdc) - struct wdc_softc *wdc; +wdcintr(arg) + void *arg; { + struct wdc_softc *wdc = arg; struct wd_softc *wd; struct buf *bp; diff --git a/sys/dev/eisa/aha1742.c b/sys/dev/eisa/aha1742.c index 02fbf79afe6..6e50a1ad652 100644 --- a/sys/dev/eisa/aha1742.c +++ b/sys/dev/eisa/aha1742.c @@ -1,4 +1,4 @@ -/* $NetBSD: aha1742.c,v 1.45 1995/04/13 04:16:16 cgd Exp $ */ +/* $NetBSD: aha1742.c,v 1.46 1995/04/17 12:08:19 cgd Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -60,7 +60,9 @@ #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/eisa/eisareg.h> +#include <dev/eisa/eisavar.h> + #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> @@ -262,7 +264,7 @@ struct ahb_ecb { struct ahb_softc { struct device sc_dev; struct isadev sc_id; - struct intrhand sc_ih; + void *sc_ih; int sc_iobase; int sc_irq; @@ -278,7 +280,7 @@ struct ahb_softc { void ahb_send_mbox __P((struct ahb_softc *, int, struct ahb_ecb *)); int ahb_poll __P((struct ahb_softc *, struct scsi_xfer *, int)); void ahb_send_immed __P((struct ahb_softc *, int, u_long)); -int ahbintr __P((struct ahb_softc *)); +int ahbintr __P((void *)); void ahb_done __P((struct ahb_softc *, struct ahb_ecb *)); void ahb_free_ecb __P((struct ahb_softc *, struct ahb_ecb *, int)); struct ahb_ecb *ahb_get_ecb __P((struct ahb_softc *, int)); @@ -539,10 +541,8 @@ ahbattach(parent, self, aux) #ifdef NEWCONFIG isa_establish(&ahb->sc_id, &ahb->sc_dev); #endif - ahb->sc_ih.ih_fun = ahbintr; - ahb->sc_ih.ih_arg = ahb; - ahb->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_LEVEL, &ahb->sc_ih); + ahb->sc_ih = eisa_intr_establish(ia->ia_irq, EISA_IST_LEVEL, + EISA_IPL_BIO, ahbintr, ahb); /* * ask the adapter what subunits are present @@ -554,9 +554,10 @@ ahbattach(parent, self, aux) * Catch an interrupt from the adaptor */ int -ahbintr(ahb) - struct ahb_softc *ahb; +ahbintr(arg) + void *arg; { + struct ahb_softc *ahb = arg; struct ahb_ecb *ecb; u_char ahbstat; u_long mboxval; diff --git a/sys/dev/eisa/eisareg.h b/sys/dev/eisa/eisareg.h new file mode 100644 index 00000000000..1d53a1d5a16 --- /dev/null +++ b/sys/dev/eisa/eisareg.h @@ -0,0 +1,36 @@ +/* $NetBSD: eisareg.h,v 1.1 1995/04/17 12:08:21 cgd Exp $ */ + +/* + * Copyright (c) 1995 Christopher G. Demetriou + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * XXX something should go here. nothing does, yet. + */ diff --git a/sys/dev/eisa/eisavar.h b/sys/dev/eisa/eisavar.h new file mode 100644 index 00000000000..85cf6cb4294 --- /dev/null +++ b/sys/dev/eisa/eisavar.h @@ -0,0 +1,63 @@ +/* $NetBSD: eisavar.h,v 1.1 1995/04/17 12:08:23 cgd Exp $ */ + +/* + * Copyright (c) 1995 Christopher G. Demetriou + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * XXX + * XXX EISA AUTOCONFIG SHOULD BE SEPERATED FROM ISA AUTOCONFIG!!! + * XXX + */ + +/* + * pull in the ISA definitions + */ +#include <dev/isa/isavar.h> + +/* + * and bend them to our twisted ways: + * map the functions, etc. that are used + */ + +#define eisa_attach_args isa_attach_args /* XXX */ +#define eisadev isadev /* XXX */ +#define eisa_intr_establish isa_intr_establish /* XXX */ +#define eisa_intr_disestablish isa_intr_disestablish /* XXX */ + +#define EISA_IPL_NONE ISA_IPL_NONE /* XXX */ +#define EISA_IPL_BIO ISA_IPL_BIO /* XXX */ +#define EISA_IPL_NET ISA_IPL_NET /* XXX */ +#define EISA_IPL_TTY ISA_IPL_TTY /* XXX */ +#define EISA_IPL_CLOCK ISA_IPL_CLOCK /* XXX */ + +#define EISA_IST_PULSE ISA_IST_PULSE /* XXX */ +#define EISA_IST_EDGE ISA_IST_EDGE /* XXX */ +#define EISA_IST_LEVEL ISA_IST_LEVEL /* XXX */ diff --git a/sys/dev/ic/aic6360.c b/sys/dev/ic/aic6360.c index 53e5ce8edf9..12bf11b8f5a 100644 --- a/sys/dev/ic/aic6360.c +++ b/sys/dev/ic/aic6360.c @@ -1,4 +1,4 @@ -/* $NetBSD: aic6360.c,v 1.30 1995/02/02 21:08:42 mycroft Exp $ */ +/* $NetBSD: aic6360.c,v 1.31 1995/04/17 12:08:32 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Charles Hannum. All rights reserved. @@ -129,7 +129,7 @@ #include <scsi/scsi_message.h> #include <scsi/scsiconf.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> /* Definitions, most of them has turned out to be unneccesary, but here they * are anyway. @@ -486,7 +486,7 @@ struct aic_tinfo { struct aic_softc { struct device sc_dev; struct isadev sc_id; - struct intrhand sc_ih; + void *sc_ih; int sc_iobase; int sc_irq, sc_drq; @@ -575,7 +575,7 @@ int aic_debug = 0x00; /* AIC_SHOWSTART|AIC_SHOWMISC|AIC_SHOWTRACE; /**/ int aicprobe __P((struct device *, void *, void *)); void aicattach __P((struct device *, struct device *, void *)); void aic_minphys __P((struct buf *)); -int aicintr __P((struct aic_softc *)); +int aicintr __P((void *)); void aic_init __P((struct aic_softc *)); void aic_done __P((struct aic_softc *, struct aic_acb *)); void aic_dequeue __P((struct aic_softc *, struct aic_acb *)); @@ -763,10 +763,8 @@ aicattach(parent, self, aux) #ifdef NEWCONFIG isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih.ih_fun = aicintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + aicintr, sc); config_found(self, &sc->sc_link, aicprint); } @@ -2047,9 +2045,10 @@ phasechange: * 1) always uses programmed I/O */ int -aicintr(sc) - register struct aic_softc *sc; +aicintr(arg) + void *arg; { + register struct aic_softc *sc = arg; u_char sstat0, sstat1; register struct aic_acb *acb; register struct scsi_link *sc_link; diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 65581425085..32d791a9566 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.48 1995/04/10 01:05:55 mycroft Exp $ */ +/* $NetBSD: com.c,v 1.49 1995/04/17 12:08:44 cgd Exp $ */ /*- * Copyright (c) 1993, 1994 Charles Hannum. @@ -60,13 +60,13 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <dev/isa/comreg.h> #include <dev/ic/ns16550.h> struct com_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; int sc_overflows; int sc_iobase; @@ -89,7 +89,7 @@ void comattach __P((struct device *, struct device *, void *)); int comopen __P((dev_t, int, int, struct proc *)); int comclose __P((dev_t, int, int, struct proc *)); void comdiag __P((void *)); -int comintr __P((struct com_softc *)); +int comintr __P((void *)); int comparam __P((struct tty *, struct termios *)); void comstart __P((struct tty *)); @@ -211,12 +211,9 @@ comattach(parent, self, aux) outb(iobase + com_ier, 0); outb(iobase + com_mcr, 0); - if (ia->ia_irq != IRQUNK) { - sc->sc_ih.ih_fun = comintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_TTY; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); - } + if (ia->ia_irq != IRQUNK) + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, + ISA_IPL_TTY, comintr, sc); #ifdef KGDB if (kgdb_dev == makedev(commajor, unit)) { @@ -768,9 +765,10 @@ comdiag(arg) } int -comintr(sc) - struct com_softc *sc; +comintr(arg) + void *arg; { + struct com_softc *sc = arg; int iobase = sc->sc_iobase; struct tty *tp; u_char code; diff --git a/sys/dev/ic/lpt.c b/sys/dev/ic/lpt.c index 9423e799293..aee3a5be153 100644 --- a/sys/dev/ic/lpt.c +++ b/sys/dev/ic/lpt.c @@ -1,4 +1,4 @@ -/* $NetBSD: lpt.c,v 1.29 1995/01/29 07:37:10 cgd Exp $ */ +/* $NetBSD: lpt.c,v 1.30 1995/04/17 12:09:17 cgd Exp $ */ /* * Copyright (c) 1993, 1994 Charles Hannum. @@ -67,7 +67,7 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <dev/isa/lptreg.h> #define TIMEOUT hz*16 /* wait up to 16 seconds for a ready */ @@ -85,7 +85,7 @@ int lptdebug = 1; struct lpt_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; size_t sc_count; struct buf *sc_inbuf; @@ -107,7 +107,7 @@ struct lpt_softc { int lptprobe __P((struct device *, void *, void *)); void lptattach __P((struct device *, struct device *, void *)); -int lptintr __P((struct lpt_softc *)); +int lptintr __P((void *)); struct cfdriver lptcd = { NULL, "lpt", lptprobe, lptattach, DV_TTY, sizeof(struct lpt_softc) @@ -237,12 +237,9 @@ lptattach(parent, self, aux) sc->sc_state = 0; outb(iobase + lpt_control, LPC_NINIT); - if (ia->ia_irq != IRQUNK) { - sc->sc_ih.ih_fun = lptintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_NONE; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); - } + if (ia->ia_irq != IRQUNK) + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, + ISA_IPL_NONE, lptintr, sc); } /* @@ -482,9 +479,10 @@ lptwrite(dev, uio) * another char. */ int -lptintr(sc) - struct lpt_softc *sc; +lptintr(arg) + void *arg; { + struct lpt_softc *sc = arg; int iobase = sc->sc_iobase; #if 0 diff --git a/sys/dev/ic/lptvar.h b/sys/dev/ic/lptvar.h index d87e984863c..87ee438dfec 100644 --- a/sys/dev/ic/lptvar.h +++ b/sys/dev/ic/lptvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: lptvar.h,v 1.29 1995/01/29 07:37:10 cgd Exp $ */ +/* $NetBSD: lptvar.h,v 1.30 1995/04/17 12:09:17 cgd Exp $ */ /* * Copyright (c) 1993, 1994 Charles Hannum. @@ -67,7 +67,7 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <dev/isa/lptreg.h> #define TIMEOUT hz*16 /* wait up to 16 seconds for a ready */ @@ -85,7 +85,7 @@ int lptdebug = 1; struct lpt_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; size_t sc_count; struct buf *sc_inbuf; @@ -107,7 +107,7 @@ struct lpt_softc { int lptprobe __P((struct device *, void *, void *)); void lptattach __P((struct device *, struct device *, void *)); -int lptintr __P((struct lpt_softc *)); +int lptintr __P((void *)); struct cfdriver lptcd = { NULL, "lpt", lptprobe, lptattach, DV_TTY, sizeof(struct lpt_softc) @@ -237,12 +237,9 @@ lptattach(parent, self, aux) sc->sc_state = 0; outb(iobase + lpt_control, LPC_NINIT); - if (ia->ia_irq != IRQUNK) { - sc->sc_ih.ih_fun = lptintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_NONE; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); - } + if (ia->ia_irq != IRQUNK) + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, + ISA_IPL_NONE, lptintr, sc); } /* @@ -482,9 +479,10 @@ lptwrite(dev, uio) * another char. */ int -lptintr(sc) - struct lpt_softc *sc; +lptintr(arg) + void *arg; { + struct lpt_softc *sc = arg; int iobase = sc->sc_iobase; #if 0 diff --git a/sys/dev/isa/ad1848.c b/sys/dev/isa/ad1848.c index d0892f2c802..63be64a2ec7 100644 --- a/sys/dev/isa/ad1848.c +++ b/sys/dev/isa/ad1848.c @@ -1,4 +1,4 @@ -/* $NetBSD: ad1848.c,v 1.2 1995/03/25 00:00:53 mycroft Exp $ */ +/* $NetBSD: ad1848.c,v 1.3 1995/04/17 12:06:55 cgd Exp $ */ /* * Copyright (c) 1994 John Brezak @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ad1848.c,v 1.2 1995/03/25 00:00:53 mycroft Exp $ + * $Id: ad1848.c,v 1.3 1995/04/17 12:06:55 cgd Exp $ */ /* @@ -87,8 +87,8 @@ #include <sys/audioio.h> #include <dev/audio_if.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isadmavar.h> #include <i386/isa/icu.h> #include <i386/isa/ad1848reg.h> @@ -1341,9 +1341,10 @@ ad1848_dma_output(addr, p, cc, intr, arg) } int -ad1848_intr(sc) - register struct ad1848_softc *sc; +ad1848_intr(arg) + void *arg; { + register struct ad1848_softc *sc = arg; int retval = 0; u_char status; diff --git a/sys/dev/isa/ad1848var.h b/sys/dev/isa/ad1848var.h index 70a5c1639f0..d72815e3a87 100644 --- a/sys/dev/isa/ad1848var.h +++ b/sys/dev/isa/ad1848var.h @@ -1,4 +1,4 @@ -/* $NetBSD: ad1848var.h,v 1.3 1995/03/28 18:17:42 jtc Exp $ */ +/* $NetBSD: ad1848var.h,v 1.4 1995/04/17 12:06:57 cgd Exp $ */ /* * Copyright (c) 1994 John Brezak @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ad1848var.h,v 1.3 1995/03/28 18:17:42 jtc Exp $ + * $Id: ad1848var.h,v 1.4 1995/04/17 12:06:57 cgd Exp $ */ #define AD1848_NPORT 8 @@ -46,7 +46,7 @@ struct ad1848_volume { struct ad1848_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ void *parent; @@ -88,7 +88,7 @@ struct ad1848_softc { u_char format_bits; u_long sc_interrupts; /* number of interrupts taken */ - void (*sc_intr)(void*); /* dma completion intr handler */ + void (*sc_intr)(void *); /* dma completion intr handler */ void *sc_arg; /* arg for sc_intr() */ }; @@ -135,7 +135,7 @@ int ad1848_halt_out_dma __P((void *)); int ad1848_cont_in_dma __P((void *)); int ad1848_cont_out_dma __P((void *)); -int ad1848_intr __P((struct ad1848_softc *)); +int ad1848_intr __P((void *)); int ad1848_set_rec_port __P((struct ad1848_softc *, int)); int ad1848_get_rec_port __P((struct ad1848_softc *)); diff --git a/sys/dev/isa/aha1542.c b/sys/dev/isa/aha1542.c index aaa4ed87de8..6e4b17c1a6e 100644 --- a/sys/dev/isa/aha1542.c +++ b/sys/dev/isa/aha1542.c @@ -1,4 +1,4 @@ -/* $NetBSD: aha1542.c,v 1.41 1995/01/13 14:46:44 mycroft Exp $ */ +/* $NetBSD: aha1542.c,v 1.42 1995/04/17 12:08:28 cgd Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -62,7 +62,7 @@ #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> @@ -313,7 +313,7 @@ int aha_debug = 1; struct aha_softc { struct device sc_dev; struct isadev sc_id; - struct intrhand sc_ih; + void *sc_ih; int sc_iobase; int sc_irq, sc_drq; @@ -327,7 +327,7 @@ struct aha_softc { }; int aha_cmd(); /* XXX must be varargs to prototype */ -int ahaintr __P((struct aha_softc *)); +int ahaintr __P((void *)); void aha_free_ccb __P((struct aha_softc *, struct aha_ccb *, int)); struct aha_ccb *aha_get_ccb __P((struct aha_softc *, int)); struct aha_ccb *aha_ccb_phys_kv __P((struct aha_softc *, u_long)); @@ -581,10 +581,8 @@ ahaattach(parent, self, aux) #ifdef NEWCONFIG isa_establish(&aha->sc_id, &aha->sc_dev); #endif - aha->sc_ih.ih_fun = ahaintr; - aha->sc_ih.ih_arg = aha; - aha->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &aha->sc_ih); + aha->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + ahaintr, aha); /* * ask the adapter what subunits are present @@ -596,9 +594,10 @@ ahaattach(parent, self, aux) * Catch an interrupt from the adaptor */ int -ahaintr(aha) - struct aha_softc *aha; +ahaintr(arg) + void *arg; { + struct aha_softc *aha = arg; struct aha_mbx_in *wmbi; struct aha_mbx *wmbx; struct aha_ccb *ccb; diff --git a/sys/dev/isa/aic6360.c b/sys/dev/isa/aic6360.c index 53e5ce8edf9..12bf11b8f5a 100644 --- a/sys/dev/isa/aic6360.c +++ b/sys/dev/isa/aic6360.c @@ -1,4 +1,4 @@ -/* $NetBSD: aic6360.c,v 1.30 1995/02/02 21:08:42 mycroft Exp $ */ +/* $NetBSD: aic6360.c,v 1.31 1995/04/17 12:08:32 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Charles Hannum. All rights reserved. @@ -129,7 +129,7 @@ #include <scsi/scsi_message.h> #include <scsi/scsiconf.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> /* Definitions, most of them has turned out to be unneccesary, but here they * are anyway. @@ -486,7 +486,7 @@ struct aic_tinfo { struct aic_softc { struct device sc_dev; struct isadev sc_id; - struct intrhand sc_ih; + void *sc_ih; int sc_iobase; int sc_irq, sc_drq; @@ -575,7 +575,7 @@ int aic_debug = 0x00; /* AIC_SHOWSTART|AIC_SHOWMISC|AIC_SHOWTRACE; /**/ int aicprobe __P((struct device *, void *, void *)); void aicattach __P((struct device *, struct device *, void *)); void aic_minphys __P((struct buf *)); -int aicintr __P((struct aic_softc *)); +int aicintr __P((void *)); void aic_init __P((struct aic_softc *)); void aic_done __P((struct aic_softc *, struct aic_acb *)); void aic_dequeue __P((struct aic_softc *, struct aic_acb *)); @@ -763,10 +763,8 @@ aicattach(parent, self, aux) #ifdef NEWCONFIG isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih.ih_fun = aicintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + aicintr, sc); config_found(self, &sc->sc_link, aicprint); } @@ -2047,9 +2045,10 @@ phasechange: * 1) always uses programmed I/O */ int -aicintr(sc) - register struct aic_softc *sc; +aicintr(arg) + void *arg; { + register struct aic_softc *sc = arg; u_char sstat0, sstat1; register struct aic_acb *acb; register struct scsi_link *sc_link; diff --git a/sys/dev/isa/ast.c b/sys/dev/isa/ast.c index 093cf693b8d..e270df805bd 100644 --- a/sys/dev/isa/ast.c +++ b/sys/dev/isa/ast.c @@ -1,4 +1,4 @@ -/* $NetBSD: ast.c,v 1.16 1995/01/04 00:47:53 mycroft Exp $ */ +/* $NetBSD: ast.c,v 1.17 1995/04/17 12:08:36 cgd Exp $ */ /* * Copyright (c) 1995 Charles Hannum. All rights reserved. @@ -37,11 +37,11 @@ #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> struct ast_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; int sc_iobase; int sc_alive; /* mask of slave units attached */ @@ -50,7 +50,7 @@ struct ast_softc { int astprobe(); void astattach(); -int astintr __P((struct ast_softc *)); +int astintr __P((void *)); struct cfdriver astcd = { NULL, "ast", astprobe, astattach, DV_TTY, sizeof(struct ast_softc) @@ -137,16 +137,15 @@ astattach(parent, self, aux) } } - sc->sc_ih.ih_fun = astintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_TTY; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_TTY, + astintr, sc); } int -astintr(sc) - struct ast_softc *sc; +astintr(arg) + void *arg; { + struct ast_softc *sc = arg; int iobase = sc->sc_iobase; int alive = sc->sc_alive; int bits; diff --git a/sys/dev/isa/boca.c b/sys/dev/isa/boca.c index 51adfbdb701..8bc15038581 100644 --- a/sys/dev/isa/boca.c +++ b/sys/dev/isa/boca.c @@ -1,4 +1,4 @@ -/* $NetBSD: boca.c,v 1.3 1995/01/04 00:47:54 mycroft Exp $ */ +/* $NetBSD: boca.c,v 1.4 1995/04/17 12:08:37 cgd Exp $ */ /* * Copyright (c) 1995 Charles Hannum. All rights reserved. @@ -37,11 +37,11 @@ #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> struct boca_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; int sc_iobase; int sc_alive; /* mask of slave units attached */ @@ -50,7 +50,7 @@ struct boca_softc { int bocaprobe(); void bocaattach(); -int bocaintr __P((struct boca_softc *)); +int bocaintr __P((void *)); struct cfdriver bocacd = { NULL, "boca", bocaprobe, bocaattach, DV_TTY, sizeof(struct boca_softc) @@ -132,16 +132,15 @@ bocaattach(parent, self, aux) } } - sc->sc_ih.ih_fun = bocaintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_TTY; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_TTY, + bocaintr, sc); } int -bocaintr(sc) - struct boca_softc *sc; +bocaintr(arg) + void *arg; { + struct boca_softc *sc = arg; int iobase = sc->sc_iobase; int alive = sc->sc_alive; int bits; diff --git a/sys/dev/isa/bt742a.c b/sys/dev/isa/bt742a.c index 3d5e870882f..5785cd64c94 100644 --- a/sys/dev/isa/bt742a.c +++ b/sys/dev/isa/bt742a.c @@ -1,4 +1,4 @@ -/* $NetBSD: bt742a.c,v 1.38 1995/01/13 14:46:51 mycroft Exp $ */ +/* $NetBSD: bt742a.c,v 1.39 1995/04/17 12:08:39 cgd Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -62,8 +62,8 @@ #include <machine/pio.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isadmavar.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> @@ -333,7 +333,7 @@ struct bt_config { struct bt_softc { struct device sc_dev; struct isadev sc_id; - struct intrhand sc_ih; + void *sc_ih; int sc_iobase; int sc_irq, bt_drq; @@ -354,7 +354,7 @@ struct bt_softc { int bt_debug = 0; int bt_cmd(); /* XXX must be varargs to prototype */ -int btintr __P((struct bt_softc *)); +int btintr __P((void *)); void bt_free_ccb __P((struct bt_softc *, struct bt_ccb *, int)); struct bt_ccb *bt_get_ccb __P((struct bt_softc *, int)); struct bt_ccb *bt_ccb_phys_kv __P((struct bt_softc *, u_long)); @@ -608,10 +608,8 @@ btattach(parent, self, aux) #ifdef NEWCONFIG isa_establish(&bt->sc_id, &bt->sc_dev); #endif - bt->sc_ih.ih_fun = btintr; - bt->sc_ih.ih_arg = bt; - bt->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &bt->sc_ih); + bt->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + btintr, bt); /* * ask the adapter what subunits are present @@ -623,9 +621,10 @@ btattach(parent, self, aux) * Catch an interrupt from the adaptor */ int -btintr(bt) - struct bt_softc *bt; +btintr(arg) + void *arg; { + struct bt_softc *bt = arg; struct bt_mbx_in *wmbi; struct bt_mbx *wmbx; struct bt_ccb *ccb; diff --git a/sys/dev/isa/com.c b/sys/dev/isa/com.c index 65581425085..32d791a9566 100644 --- a/sys/dev/isa/com.c +++ b/sys/dev/isa/com.c @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.48 1995/04/10 01:05:55 mycroft Exp $ */ +/* $NetBSD: com.c,v 1.49 1995/04/17 12:08:44 cgd Exp $ */ /*- * Copyright (c) 1993, 1994 Charles Hannum. @@ -60,13 +60,13 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <dev/isa/comreg.h> #include <dev/ic/ns16550.h> struct com_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; int sc_overflows; int sc_iobase; @@ -89,7 +89,7 @@ void comattach __P((struct device *, struct device *, void *)); int comopen __P((dev_t, int, int, struct proc *)); int comclose __P((dev_t, int, int, struct proc *)); void comdiag __P((void *)); -int comintr __P((struct com_softc *)); +int comintr __P((void *)); int comparam __P((struct tty *, struct termios *)); void comstart __P((struct tty *)); @@ -211,12 +211,9 @@ comattach(parent, self, aux) outb(iobase + com_ier, 0); outb(iobase + com_mcr, 0); - if (ia->ia_irq != IRQUNK) { - sc->sc_ih.ih_fun = comintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_TTY; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); - } + if (ia->ia_irq != IRQUNK) + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, + ISA_IPL_TTY, comintr, sc); #ifdef KGDB if (kgdb_dev == makedev(commajor, unit)) { @@ -768,9 +765,10 @@ comdiag(arg) } int -comintr(sc) - struct com_softc *sc; +comintr(arg) + void *arg; { + struct com_softc *sc = arg; int iobase = sc->sc_iobase; struct tty *tp; u_char code; diff --git a/sys/dev/isa/cy.c b/sys/dev/isa/cy.c index 1056b038663..f9d0fec3859 100644 --- a/sys/dev/isa/cy.c +++ b/sys/dev/isa/cy.c @@ -1,4 +1,6 @@ -/* $NetBSD: cy.c,v 1.10 1995/01/29 02:58:24 cgd Exp $ */ +/* $NetBSD: cy.c,v 1.11 1995/04/17 12:08:46 cgd Exp $ */ + +/* XXX THIS DRIVER IS BROKEN. IT WILL NOT EVEN COMPILE. */ /* * cyclades cyclom-y serial driver @@ -77,7 +79,7 @@ #include <machine/pio.h> #include <machine/cpufunc.h> -#include <i386/isa/isa_device.h> +#include <i386/isa/isa_device.h> /* XXX BROKEN */ #include <dev/ic/cd1400.h> #define RxFifoThreshold 3 /* 3 characters (out of 12) in the receive diff --git a/sys/dev/isa/if_ed.c b/sys/dev/isa/if_ed.c index b83a4f732d6..48c8e5800e1 100644 --- a/sys/dev/isa/if_ed.c +++ b/sys/dev/isa/if_ed.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ed.c,v 1.72 1995/04/11 04:46:09 mycroft Exp $ */ +/* $NetBSD: if_ed.c,v 1.73 1995/04/17 12:08:50 cgd Exp $ */ /* * Device driver for National Semiconductor DS8390/WD83C690 based ethernet @@ -54,8 +54,9 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isareg.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isareg.h> +#include <dev/isa/isavar.h> +#include <i386/isa/isa_machdep.h> /* XXX USES ISA HOLE DIRECTLY */ #include <dev/ic/dp8390.h> #include <dev/isa/if_edreg.h> @@ -64,7 +65,7 @@ */ struct ed_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; struct arpcom sc_arpcom; /* ethernet common */ @@ -110,10 +111,10 @@ struct ed_softc { int edprobe __P((struct device *, void *, void *)); void edattach __P((struct device *, struct device *, void *)); -int edintr __P((struct ed_softc *)); +int edintr __P((void *)); int ed_ioctl __P((struct ifnet *, u_long, caddr_t)); void ed_start __P((struct ifnet *)); -void ed_watchdog __P((/* short */)); +void ed_watchdog __P((int)); void ed_reset __P((struct ed_softc *)); void ed_init __P((struct ed_softc *)); void ed_stop __P((struct ed_softc *)); @@ -121,15 +122,15 @@ void ed_getmcaf __P((struct arpcom *, u_long *)); #define inline /* XXX for debugging porpoises */ -void ed_get_packet __P((/* struct ed_softc *, caddr_t, u_short */)); +void ed_get_packet __P((struct ed_softc *, caddr_t, u_short)); static inline void ed_rint __P((struct ed_softc *)); static inline void ed_xmit __P((struct ed_softc *)); -static inline caddr_t ed_ring_copy __P((/* struct ed_softc *, caddr_t, caddr_t, - u_short */)); +static inline caddr_t ed_ring_copy __P((struct ed_softc *, caddr_t, caddr_t, + u_short)); -void ed_pio_readmem __P((/* struct ed_softc *, u_short, caddr_t, u_short */)); -void ed_pio_writemem __P((/* struct ed_softc *, caddr_t, u_short, u_short */)); -u_short ed_pio_write_mbufs __P((/* struct ed_softc *, struct mbuf *, u_short */)); +void ed_pio_readmem __P((struct ed_softc *, u_short, caddr_t, u_short)); +void ed_pio_writemem __P((struct ed_softc *, caddr_t, u_short, u_short)); +u_short ed_pio_write_mbufs __P((struct ed_softc *, struct mbuf *, u_short)); struct cfdriver edcd = { NULL, "ed", edprobe, edattach, DV_IFNET, sizeof(struct ed_softc) @@ -1091,10 +1092,8 @@ edattach(parent, self, aux) bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif - sc->sc_ih.ih_fun = edintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_NET; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_NET, + edintr, sc); } /* @@ -1138,7 +1137,7 @@ ed_stop(sc) */ void ed_watchdog(unit) - short unit; + int unit; { struct ed_softc *sc = edcd.cd_devs[unit]; @@ -1443,7 +1442,7 @@ outloop: break; } } else - len = ed_pio_write_mbufs(sc, m, (u_short)buffer); + len = ed_pio_write_mbufs(sc, m, (long)buffer); sc->txb_len[sc->txb_new] = max(len, ETHER_MIN_LEN); sc->txb_inuse++; @@ -1511,7 +1510,7 @@ loop: if (sc->mem_shared) packet_hdr = *(struct ed_ring *)packet_ptr; else - ed_pio_readmem(sc, (u_short)packet_ptr, + ed_pio_readmem(sc, (long)packet_ptr, (caddr_t) &packet_hdr, sizeof(packet_hdr)); len = packet_hdr.count; @@ -1586,9 +1585,10 @@ loop: /* Ethernet interface interrupt processor. */ int -edintr(sc) - struct ed_softc *sc; +edintr(arg) + void *arg; { + struct ed_softc *sc = arg; u_char isr; /* Set NIC to page 0 registers. */ @@ -1916,7 +1916,7 @@ ed_get_packet(sc, buf, len) if (sc->mem_shared) bcopy(buf, mtod(m, caddr_t), sizeof(struct ether_header)); else - ed_pio_readmem(sc, (u_short)buf, mtod(m, caddr_t), + ed_pio_readmem(sc, (long)buf, mtod(m, caddr_t), sizeof(struct ether_header)); buf += sizeof(struct ether_header); m->m_len += sizeof(struct ether_header); @@ -2171,7 +2171,7 @@ ed_ring_copy(sc, src, dst, amount) if (sc->mem_shared) bcopy(src, dst, tmp_amount); else - ed_pio_readmem(sc, (u_short)src, dst, tmp_amount); + ed_pio_readmem(sc, (long)src, dst, tmp_amount); amount -= tmp_amount; src = sc->mem_ring; @@ -2181,7 +2181,7 @@ ed_ring_copy(sc, src, dst, amount) if (sc->mem_shared) bcopy(src, dst, amount); else - ed_pio_readmem(sc, (u_short)src, dst, amount); + ed_pio_readmem(sc, (long)src, dst, amount); return (src + amount); } diff --git a/sys/dev/isa/if_eg.c b/sys/dev/isa/if_eg.c index fd3a902274e..69d9a9db1c7 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.11 1995/04/11 05:10:20 mycroft Exp $ */ +/* $NetBSD: if_eg.c,v 1.12 1995/04/17 12:08:53 cgd Exp $ */ /* * Copyright (c) 1993 Dean Huxley <dean@fsa.ca> @@ -73,7 +73,7 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <dev/isa/if_egreg.h> #include <dev/isa/elink.h> @@ -96,7 +96,7 @@ */ struct eg_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; struct arpcom sc_arpcom; /* Ethernet common part */ int eg_cmd; /* Command register R/W */ int eg_ctl; /* Control register R/W (EG_CTL_*) */ @@ -118,7 +118,7 @@ struct cfdriver egcd = { NULL, "eg", egprobe, egattach, DV_IFNET, sizeof(struct eg_softc) }; -int egintr __P((struct eg_softc *)); +int egintr __P((void *)); static void eginit __P((struct eg_softc *)); static int egioctl __P((struct ifnet *, u_long, caddr_t)); static int egrecv __P((struct eg_softc *)); @@ -404,11 +404,9 @@ egattach(parent, self, aux) #if NBPFILTER > 0 bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif - - sc->sc_ih.ih_fun = egintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_NET; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_NET, + egintr, sc); } static void @@ -556,9 +554,10 @@ egstart(ifp) } int -egintr(sc) - register struct eg_softc *sc; +egintr(arg) + void *arg; { + register struct eg_softc *sc = arg; int i, len; short *ptr; diff --git a/sys/dev/isa/if_el.c b/sys/dev/isa/if_el.c index e569e0ff439..b9569833df3 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.22 1995/04/11 05:10:24 mycroft Exp $ */ +/* $NetBSD: if_el.c,v 1.23 1995/04/17 12:08:56 cgd Exp $ */ /* * Copyright (c) 1994, Matthew E. Kimmel. Permission is hereby granted @@ -53,7 +53,7 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <dev/isa/if_elreg.h> #define ETHER_MIN_LEN 64 @@ -72,7 +72,7 @@ */ struct el_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; struct arpcom sc_arpcom; /* ethernet common */ int sc_iobase; /* base I/O addr */ @@ -82,7 +82,7 @@ struct el_softc { /* * prototypes */ -int elintr __P((struct el_softc *)); +int elintr __P((void *)); static int el_init __P((struct el_softc *)); static int el_ioctl __P((struct ifnet *, u_long, caddr_t)); static void el_start __P((struct ifnet *)); @@ -206,10 +206,8 @@ elattach(parent, self, aux) bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif - sc->sc_ih.ih_fun = elintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_NET; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_NET, + elintr, sc); dprintf(("elattach() finished.\n")); } @@ -451,9 +449,10 @@ el_xmit(sc, len) * Controller interrupt. */ int -elintr(sc) - register struct el_softc *sc; +elintr(arg) + void *arg; { + register struct el_softc *sc = arg; int iobase = sc->sc_iobase; int stat, rxstat, len, done; diff --git a/sys/dev/isa/if_ep.c b/sys/dev/isa/if_ep.c index e3b476ae7ab..bcec73aa43f 100644 --- a/sys/dev/isa/if_ep.c +++ b/sys/dev/isa/if_ep.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ep.c,v 1.71 1995/04/11 05:10:26 mycroft Exp $ */ +/* $NetBSD: if_ep.c,v 1.72 1995/04/17 12:08:59 cgd Exp $ */ /* * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca> @@ -68,7 +68,7 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <dev/isa/if_epreg.h> #include <dev/isa/elink.h> @@ -80,7 +80,7 @@ */ struct ep_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; struct arpcom sc_arpcom; /* Ethernet common part */ int ep_iobase; /* i/o bus address */ @@ -102,7 +102,7 @@ struct cfdriver epcd = { NULL, "ep", epprobe, epattach, DV_IFNET, sizeof(struct ep_softc) }; -int epintr __P((struct ep_softc *)); +int epintr __P((void *)); static void epxstat __P((struct ep_softc *)); static int epstatus __P((struct ep_softc *)); static void epinit __P((struct ep_softc *)); @@ -337,10 +337,8 @@ epattach(parent, self, aux) sc->tx_start_thresh = 20; /* probably a good starting point. */ - sc->sc_ih.ih_fun = epintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_NET; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_NET, + epintr, sc); } /* @@ -675,9 +673,10 @@ eptxstat(sc) } int -epintr(sc) - register struct ep_softc *sc; +epintr(arg) + void *arg; { + register struct ep_softc *sc = arg; struct ifnet *ifp = &sc->sc_arpcom.ac_if; u_short status; int ret = 0; @@ -1041,7 +1040,7 @@ epwatchdog(unit) log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); epreset(sc); - return 0; + return; } static void diff --git a/sys/dev/isa/if_hp.c b/sys/dev/isa/if_hp.c index 02f84baf759..d0117ae2839 100644 --- a/sys/dev/isa/if_hp.c +++ b/sys/dev/isa/if_hp.c @@ -1,4 +1,6 @@ -/* $NetBSD: if_hp.c,v 1.19 1995/01/29 07:37:06 cgd Exp $ */ +/* $NetBSD: if_hp.c,v 1.20 1995/04/17 12:09:01 cgd Exp $ */ + +/* XXX THIS DRIVER IS BROKEN. IT WILL NOT EVEN COMPILE. */ /*- * Copyright (c) 1990, 1991 William F. Jolitz. @@ -90,9 +92,9 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isa_device.h> +#include <i386/isa/isa_device.h> /* XXX BROKEN */ #include <dev/isa/if_nereg.h> -#include <i386/isa/icu.h> +#include <i386/isa/icu.h> /* XXX BROKEN */ int hpprobe(), hpattach(), hpintr(); int hpstart(), hpinit(), ether_output(), hpioctl(); diff --git a/sys/dev/isa/if_ie.c b/sys/dev/isa/if_ie.c index aef8c99ad8a..3ecde1a2120 100644 --- a/sys/dev/isa/if_ie.c +++ b/sys/dev/isa/if_ie.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ie.c,v 1.37 1995/04/07 22:27:42 mycroft Exp $ */ +/* $NetBSD: if_ie.c,v 1.38 1995/04/17 12:09:03 cgd Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles Hannum. @@ -143,8 +143,9 @@ iomem, and to make 16-pointers, we subtract sc_maddr and and with 0xffff. #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isareg.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isareg.h> +#include <dev/isa/isavar.h> +#include <i386/isa/isa_machdep.h> /* XXX USES ISA HOLE DIRECTLY */ #include <dev/ic/i82586.h> #include <dev/isa/if_ieatt.h> #include <dev/isa/if_ie507.h> @@ -218,7 +219,7 @@ const char *ie_hardware_names[] = { */ struct ie_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; int sc_iobase; caddr_t sc_maddr; @@ -256,8 +257,8 @@ struct ie_softc { #endif }; -void iewatchdog __P((/* short */)); -int ieintr __P((struct ie_softc *)); +void iewatchdog __P((int)); +int ieintr __P((void *)); void iestop __P((struct ie_softc *)); int ieinit __P((struct ie_softc *)); int ieioctl __P((struct ifnet *, u_long, caddr_t)); @@ -553,10 +554,8 @@ ieattach(parent, self, aux) sizeof(struct ether_header)); #endif - sc->sc_ih.ih_fun = ieintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_NET; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_NET, + ieintr, sc); } /* @@ -565,7 +564,7 @@ ieattach(parent, self, aux) */ void iewatchdog(unit) - short unit; + int unit; { struct ie_softc *sc = iecd.cd_devs[unit]; @@ -578,9 +577,10 @@ iewatchdog(unit) * What to do upon receipt of an interrupt. */ int -ieintr(sc) - struct ie_softc *sc; +ieintr(arg) + void *arg; { + struct ie_softc *sc = arg; register u_short status; /* Clear the interrupt latch on the 3C507. */ diff --git a/sys/dev/isa/if_le.c b/sys/dev/isa/if_le.c index f608e64bf43..3170298d002 100644 --- a/sys/dev/isa/if_le.c +++ b/sys/dev/isa/if_le.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le.c,v 1.24 1995/04/10 18:21:52 mycroft Exp $ */ +/* $NetBSD: if_le.c,v 1.25 1995/04/17 12:09:06 cgd Exp $ */ /* * LANCE Ethernet driver @@ -52,9 +52,10 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isareg.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isareg.h> +#include <dev/isa/isavar.h> +#include <i386/isa/isa_machdep.h> /* XXX USES ISA HOLE DIRECTLY */ +#include <dev/isa/isadmavar.h> #include <dev/isa/if_lereg.h> @@ -75,7 +76,7 @@ char *chip_type[] = {"unknown", "Am7990 LANCE", "Am79960 PCnet-ISA"}; */ struct le_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; struct arpcom sc_arpcom; /* Ethernet common part */ int sc_iobase; /* IO base address of card */ @@ -92,12 +93,12 @@ struct le_softc { #endif }; -int leintr __P((struct le_softc *)); +int leintr __P((void *)); int leioctl __P((struct ifnet *, u_long, caddr_t)); void lestart __P((struct ifnet *)); -void lewatchdog __P((/* short */)); -static inline void lewrcsr __P((/* struct le_softc *, u_short, u_short */)); -static inline u_short lerdcsr __P((/* struct le_softc *, u_short */)); +void lewatchdog __P((short)); +static inline void lewrcsr __P((struct le_softc *, u_short, u_short)); +static inline u_short lerdcsr __P((struct le_softc *, u_short)); void leinit __P((struct le_softc *)); void lememinit __P((struct le_softc *)); void lereset __P((struct le_softc *)); @@ -416,10 +417,8 @@ leattach(parent, self, aux) bpfattach(&sc->sc_arpcom.ac_if.if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif - sc->sc_ih.ih_fun = leintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_NET; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_NET, + leintr, sc); } void @@ -581,9 +580,10 @@ leinit(sc) * Controller interrupt. */ int -leintr(sc) - register struct le_softc *sc; +leintr(arg) + void *arg; { + register struct le_softc *sc = arg; register u_short isr; isr = lerdcsr(sc, 0); diff --git a/sys/dev/isa/isa.c b/sys/dev/isa/isa.c index 4d1861b1d5f..1774d44ee13 100644 --- a/sys/dev/isa/isa.c +++ b/sys/dev/isa/isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: isa.c,v 1.71 1995/01/16 10:36:26 mycroft Exp $ */ +/* $NetBSD: isa.c,v 1.72 1995/04/17 12:09:09 cgd Exp $ */ /*- * Copyright (c) 1993, 1994 Charles Hannum. All rights reserved. @@ -36,14 +36,8 @@ #include <sys/malloc.h> #include <sys/device.h> -#include <i386/isa/isareg.h> -#include <i386/isa/isavar.h> - -#include <machine/limits.h> - -/* sorry, has to be here, no place else really suitable */ -#include <machine/pc/display.h> -u_short *Crtat = (u_short *)MONO_BUF; +#include <dev/isa/isareg.h> +#include <dev/isa/isavar.h> int isamatch __P((struct device *, void *, void *)); void isaattach __P((struct device *, struct device *, void *)); @@ -113,8 +107,29 @@ isaattach(parent, self, aux) struct device *parent, *self; void *aux; { + struct isa_softc *sc = (struct isa_softc *)self; printf("\n"); + TAILQ_INIT(&sc->sc_subdevs); config_scan(isascan, self); } + +char * +isa_intr_typename(type) + isa_intrtype type; +{ + + switch (type) { + case ISA_IST_NONE : + return ("none"); + case ISA_IST_PULSE: + return ("pulsed"); + case ISA_IST_EDGE: + return ("edge-triggered"); + case ISA_IST_LEVEL: + return ("level-triggered"); + default: + panic("isa_intr_typename: invalid type %d", type); + } +} diff --git a/sys/dev/isa/isadma.c b/sys/dev/isa/isadma.c index 877cf5e3c04..bcb72cc085b 100644 --- a/sys/dev/isa/isadma.c +++ b/sys/dev/isa/isadma.c @@ -1,4 +1,4 @@ -/* $NetBSD: isadma.c,v 1.11 1995/04/10 13:14:54 mycroft Exp $ */ +/* $NetBSD: isadma.c,v 1.12 1995/04/17 12:09:11 cgd Exp $ */ #include <sys/param.h> #include <sys/systm.h> @@ -12,9 +12,9 @@ #include <machine/pio.h> -#include <i386/isa/isareg.h> -#include <i386/isa/dmavar.h> -#include <i386/isa/dmareg.h> +#include <dev/isa/isareg.h> +#include <dev/isa/isadmavar.h> +#include <dev/isa/isadmareg.h> /* region of physical memory known to be contiguous */ vm_offset_t isaphysmem; diff --git a/sys/dev/isa/isareg.h b/sys/dev/isa/isareg.h index 194706f2585..311ed697c37 100644 --- a/sys/dev/isa/isareg.h +++ b/sys/dev/isa/isareg.h @@ -1,4 +1,4 @@ -/* $NetBSD: isareg.h,v 1.4 1994/10/27 04:17:49 cgd Exp $ */ +/* $NetBSD: isareg.h,v 1.5 1995/04/17 12:09:13 cgd Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -42,20 +42,11 @@ * ISA Bus conventions */ -#ifndef LOCORE -#include <sys/cdefs.h> - -unsigned char rtcin __P((int)); -void sysbeep __P((int, int)); -unsigned kbd_8042cmd __P((int)); -#endif /* !LOCORE */ - - /* * Input / Output Port Assignments */ -#ifndef IO_BEGIN +#ifndef IO_ISABEGIN #define IO_ISABEGIN 0x000 /* 0x000 - Beginning of I/O Registers */ /* CPU Board */ @@ -143,7 +134,7 @@ unsigned kbd_8042cmd __P((int)); #ifndef IO_ISASIZES #define IO_ISASIZES -#define IO_COMSIZE 8 /* 8250, 16X50 com controllers (*/ +#define IO_COMSIZE 8 /* 8250, 16X50 com controllers */ #define IO_CGASIZE 16 /* CGA controllers */ #define IO_DMASIZE 16 /* 8237 DMA controllers */ #define IO_DPGSIZE 32 /* 74LS612 DMA page reisters */ @@ -170,42 +161,3 @@ unsigned kbd_8042cmd __P((int)); #define IOM_END 0x100000 /* End of I/O Memory "hole" */ #define IOM_SIZE (IOM_END - IOM_BEGIN) #endif /* !IOM_BEGIN */ - -/* - * RAM Physical Address Space (ignoring the above mentioned "hole") - */ - -#ifndef RAM_BEGIN -#define RAM_BEGIN 0x0000000 /* Start of RAM Memory */ -#define RAM_END 0x1000000 /* End of RAM Memory */ -#define RAM_SIZE (RAM_END - RAM_BEGIN) -#endif /* !RAM_BEGIN */ - -/* - * Oddball Physical Memory Addresses - */ -#ifndef COMPAQ_RAMRELOC -#define COMPAQ_RAMRELOC 0x80c00000 /* Compaq RAM relocation/diag */ -#define COMPAQ_RAMSETUP 0x80c00002 /* Compaq RAM setup */ -#define WEITEK_FPU 0xC0000000 /* WTL 2167 */ -#define CYRIX_EMC 0xC0000000 /* Cyrix EMC */ -#endif /* !COMPAQ_RAMRELOC */ - -/* stuff that used to be in pccons.c */ -#define MONO_BASE 0x3B4 -#define MONO_BUF (KERNBASE + 0xB0000) -#define CGA_BASE 0x3D4 -#define CGA_BUF (KERNBASE + 0xB8000) -#define IOPHYSMEM 0xA0000 - -/* - * size of dma bounce buffer in pages - * - currently 1 page per channel - */ -#ifndef DMA_BOUNCE -#define DMA_BOUNCE 8 -#endif - -#ifndef LOCORE -extern vm_offset_t isaphysmem; -#endif /* !LOCORE */ diff --git a/sys/dev/isa/isavar.h b/sys/dev/isa/isavar.h index 15e9d11f160..8a6976e100e 100644 --- a/sys/dev/isa/isavar.h +++ b/sys/dev/isa/isavar.h @@ -1,6 +1,7 @@ -/* $NetBSD: isavar.h,v 1.14 1995/01/03 03:14:35 mycroft Exp $ */ +/* $NetBSD: isavar.h,v 1.15 1995/04/17 12:09:15 cgd Exp $ */ /* + * Copyright (c) 1995 Chris G. Demetriou * Copyright (c) 1992 Berkeley Software Design, Inc. * All rights reserved. * @@ -36,6 +37,12 @@ */ /* + * Definitions for ISA autoconfiguration. + */ + +#include <sys/queue.h> + +/* * ISA driver attach arguments */ struct isa_attach_args { @@ -54,19 +61,21 @@ struct isa_attach_args { #define MADDRUNK -1 /* shared memory address is unknown */ /* - * per-device ISA variables + * Per-device ISA variables */ struct isadev { struct device *id_dev; /* back pointer to generic */ - struct isadev *id_bchain; /* forward link in bus chain */ + TAILQ_ENTRY(isadev) + id_bchain; /* bus chain */ }; /* - * ISA masterbus + * ISA master bus */ struct isa_softc { struct device sc_dev; /* base device */ - struct isadev *sc_isadev; /* list of all children */ + TAILQ_HEAD(, isadev) + sc_subdevs; /* list of all children */ }; #define cf_iobase cf_loc[0] @@ -77,38 +86,54 @@ struct isa_softc { #define cf_drq cf_loc[5] /* - * Interrupt handler chains. Interrupt handlers should return 0 for - * `not I', 1 (`I took care of it'), or -1 (`I guess it was mine, but - * I wasn't expecting it'). intr_establish() inserts a handler into - * the list. The handler is called with its (single) argument. + * ISA interrupt handler manipulation. + * + * To establish an ISA interrupt handler, a driver calls isa_intr_establish() + * with the interrupt number, type, level, function, and function argument of + * the interrupt it wants to handle. Isa_intr_establish() returns an opaque + * handle to an event descriptor if it succeeds, and invokes panic() if it + * fails. (XXX It should return NULL, then drivers should handle that, but + * what should they do?) Interrupt handlers should return 0 for "interrupt + * not for me", 1 for "I took care of it", or -1 for "I guess it was mine, + * but I wasn't expecting it." + * + * To remove an interrupt handler, the driver calls isa_intr_disestablish() + * with the handle returned by isa_intr_establish() for that handler. */ -struct intrhand { - int (*ih_fun)(); - void *ih_arg; - u_long ih_count; - struct intrhand *ih_next; - int ih_level; -}; -void intr_establish __P((int intr, int type, struct intrhand *)); -void intr_disestablish __P((int intr, struct intrhand *)); -void isa_establish __P((struct isadev *, struct device *)); +/* ISA interrupt sharing types */ +typedef enum { + ISA_IST_NONE = 0, /* not yet assigned */ + ISA_IST_PULSE, /* pulsed */ + ISA_IST_EDGE, /* edge-triggered */ + ISA_IST_LEVEL /* level-triggered */ +} isa_intrtype; -/* - * software conventions - */ -typedef enum { BUS_ISA, BUS_EISA, BUS_MCA } isa_type; +/* ISA interrupt levels; system interrupt levels for ISA bus use */ +typedef enum { + ISA_IPL_NONE, /* block only the interrupt's IRQ*/ + ISA_IPL_BIO, /* block I/O interrupts */ + ISA_IPL_NET, /* network */ + ISA_IPL_TTY, /* terminal */ + ISA_IPL_CLOCK, /* clock */ +} isa_intrlevel; -extern int atdevbase; /* kernel virtual address of "hole" */ -extern isa_type isa_bustype; /* type of bus */ +void *isa_intr_establish __P((int intr, isa_intrtype type, + isa_intrlevel level, int (*ih_fun)(void *), + void *ih_arg)); +void isa_intr_disestablish __P((void *handler)); +char *isa_intr_typename __P((isa_intrtype type)); +#ifdef NEWCONFIG /* - * Given a kernel virtual address for some location - * in the "hole" I/O space, return a physical address. + * Establish a device as being on the ISA bus (XXX NOT IMPLEMENTED). */ -#define ISA_PHYSADDR(v) ((caddr_t) ((u_long)(v) - atdevbase + IOM_BEGIN)) +void isa_establish __P((struct isadev *, struct device *)); +#endif + /* - * Given a physical address in the "hole", - * return a kernel virtual address. + * software conventions */ -#define ISA_HOLE_VADDR(p) ((caddr_t) ((u_long)(p) - IOM_BEGIN + atdevbase)) +typedef enum { BUS_ISA, BUS_EISA } isa_type; + +extern isa_type isa_bustype; /* type of bus; XXX should be in softc */ diff --git a/sys/dev/isa/lpt.c b/sys/dev/isa/lpt.c index 9423e799293..aee3a5be153 100644 --- a/sys/dev/isa/lpt.c +++ b/sys/dev/isa/lpt.c @@ -1,4 +1,4 @@ -/* $NetBSD: lpt.c,v 1.29 1995/01/29 07:37:10 cgd Exp $ */ +/* $NetBSD: lpt.c,v 1.30 1995/04/17 12:09:17 cgd Exp $ */ /* * Copyright (c) 1993, 1994 Charles Hannum. @@ -67,7 +67,7 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <dev/isa/lptreg.h> #define TIMEOUT hz*16 /* wait up to 16 seconds for a ready */ @@ -85,7 +85,7 @@ int lptdebug = 1; struct lpt_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; size_t sc_count; struct buf *sc_inbuf; @@ -107,7 +107,7 @@ struct lpt_softc { int lptprobe __P((struct device *, void *, void *)); void lptattach __P((struct device *, struct device *, void *)); -int lptintr __P((struct lpt_softc *)); +int lptintr __P((void *)); struct cfdriver lptcd = { NULL, "lpt", lptprobe, lptattach, DV_TTY, sizeof(struct lpt_softc) @@ -237,12 +237,9 @@ lptattach(parent, self, aux) sc->sc_state = 0; outb(iobase + lpt_control, LPC_NINIT); - if (ia->ia_irq != IRQUNK) { - sc->sc_ih.ih_fun = lptintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_NONE; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); - } + if (ia->ia_irq != IRQUNK) + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, + ISA_IPL_NONE, lptintr, sc); } /* @@ -482,9 +479,10 @@ lptwrite(dev, uio) * another char. */ int -lptintr(sc) - struct lpt_softc *sc; +lptintr(arg) + void *arg; { + struct lpt_softc *sc = arg; int iobase = sc->sc_iobase; #if 0 diff --git a/sys/dev/isa/lpt_isa.c b/sys/dev/isa/lpt_isa.c index ddd561fca96..f0cfc85a43d 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.29 1995/01/29 07:37:10 cgd Exp $ */ +/* $NetBSD: lpt_isa.c,v 1.30 1995/04/17 12:09:17 cgd Exp $ */ /* * Copyright (c) 1993, 1994 Charles Hannum. @@ -67,7 +67,7 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <dev/isa/lptreg.h> #define TIMEOUT hz*16 /* wait up to 16 seconds for a ready */ @@ -85,7 +85,7 @@ int lptdebug = 1; struct lpt_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; size_t sc_count; struct buf *sc_inbuf; @@ -107,7 +107,7 @@ struct lpt_softc { int lptprobe __P((struct device *, void *, void *)); void lptattach __P((struct device *, struct device *, void *)); -int lptintr __P((struct lpt_softc *)); +int lptintr __P((void *)); struct cfdriver lptcd = { NULL, "lpt", lptprobe, lptattach, DV_TTY, sizeof(struct lpt_softc) @@ -237,12 +237,9 @@ lptattach(parent, self, aux) sc->sc_state = 0; outb(iobase + lpt_control, LPC_NINIT); - if (ia->ia_irq != IRQUNK) { - sc->sc_ih.ih_fun = lptintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_NONE; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); - } + if (ia->ia_irq != IRQUNK) + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, + ISA_IPL_NONE, lptintr, sc); } /* @@ -482,9 +479,10 @@ lptwrite(dev, uio) * another char. */ int -lptintr(sc) - struct lpt_softc *sc; +lptintr(arg) + void *arg; { + struct lpt_softc *sc = arg; int iobase = sc->sc_iobase; #if 0 diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c index ea25c106f32..ff076c76e17 100644 --- a/sys/dev/isa/mcd.c +++ b/sys/dev/isa/mcd.c @@ -1,4 +1,4 @@ -/* $NetBSD: mcd.c,v 1.36 1995/04/15 05:02:53 mycroft Exp $ */ +/* $NetBSD: mcd.c,v 1.37 1995/04/17 12:09:20 cgd Exp $ */ /* * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -75,7 +75,7 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <dev/isa/mcdreg.h> #ifndef MCDDEBUG @@ -108,7 +108,7 @@ struct mcd_mbx { struct mcd_softc { struct device sc_dev; struct dkdevice sc_dk; - struct intrhand sc_ih; + void *sc_ih; int iobase; int irq, drq; @@ -221,10 +221,8 @@ mcdattach(parent, self, aux) sc->sc_dk.dk_driver = &mcddkdriver; - sc->sc_ih.ih_fun = mcdintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + mcdintr, sc); } /* diff --git a/sys/dev/isa/pas.c b/sys/dev/isa/pas.c index 3270a7d5492..683221b73ef 100644 --- a/sys/dev/isa/pas.c +++ b/sys/dev/isa/pas.c @@ -1,4 +1,4 @@ -/* $NetBSD: pas.c,v 1.4 1995/03/25 00:01:19 mycroft Exp $ */ +/* $NetBSD: pas.c,v 1.5 1995/04/17 12:07:23 cgd Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pas.c,v 1.4 1995/03/25 00:01:19 mycroft Exp $ + * $Id: pas.c,v 1.5 1995/04/17 12:07:23 cgd Exp $ */ /* * Todo: @@ -54,8 +54,8 @@ #include <sys/audioio.h> #include <dev/audio_if.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isadmavar.h> #include <i386/isa/icu.h> #include <i386/isa/sbdspvar.h> @@ -89,7 +89,7 @@ int pasdebug = 0; struct pas_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ u_short sc_iobase; /* PAS iobase */ u_short sc_irq; /* PAS irq */ @@ -439,10 +439,8 @@ pasattach(parent, self, aux) #ifdef NEWCONFIG isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih.ih_fun = sbdsp_intr; - sc->sc_ih.ih_arg = &sc->sc_sbdsp; - sc->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + sbdsp_intr, &sc->sc_sbdsp); #ifdef NEWCONFIG /* diff --git a/sys/dev/isa/pss.c b/sys/dev/isa/pss.c index ca65ef4898e..6413b38b78e 100644 --- a/sys/dev/isa/pss.c +++ b/sys/dev/isa/pss.c @@ -1,4 +1,4 @@ -/* $NetBSD: pss.c,v 1.3 1995/03/25 00:01:10 mycroft Exp $ */ +/* $NetBSD: pss.c,v 1.4 1995/04/17 12:07:34 cgd Exp $ */ /* * Copyright (c) 1994 John Brezak @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pss.c,v 1.3 1995/03/25 00:01:10 mycroft Exp $ + * $Id: pss.c,v 1.4 1995/04/17 12:07:34 cgd Exp $ */ /* @@ -66,7 +66,7 @@ #include <sys/audioio.h> #include <dev/audio_if.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <i386/isa/dmavar.h> #include <i386/isa/icu.h> @@ -107,40 +107,40 @@ struct pss_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ u_short sc_iobase; /* I/O port base address */ - u_short sc_drq; /* dma channel */ + u_short sc_drq; /* dma channel */ - struct ad1848_softc *ad1848_sc; + struct ad1848_softc *ad1848_sc; - int out_port; + int out_port; - struct ad1848_volume master_volume; - int master_mode; + struct ad1848_volume master_volume; + int master_mode; - int monitor_treble; - int monitor_bass; + int monitor_treble; + int monitor_bass; - int mic_mute, cd_mute, dac_mute; + int mic_mute, cd_mute, dac_mute; }; struct mpu_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ - u_short sc_iobase; /* MIDI I/O port base address */ - u_short sc_irq; /* MIDI interrupt */ + u_short sc_iobase; /* MIDI I/O port base address */ + u_short sc_irq; /* MIDI interrupt */ }; struct cd_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ - u_short sc_iobase; /* CD I/O port base address */ - u_short sc_irq; /* CD interrupt */ + u_short sc_iobase; /* CD I/O port base address */ + u_short sc_irq; /* CD interrupt */ }; #define DEBUG /*XXX*/ @@ -165,8 +165,8 @@ void pcdattach __P((struct device *, struct device *, void *)); int spopen __P((dev_t, int)); -int pssintr __P((struct pss_softc *)); -int mpuintr __P((struct mpu_softc *)); +int pssintr __P((void *)); +int mpuintr __P((void *)); int pss_speaker_ctl __P((void *, int)); @@ -1004,10 +1004,8 @@ pssattach(parent, self, aux) #endif /* Setup interrupt handler for PSS */ - sc->sc_ih.ih_fun = pssintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_CLOCK; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_CLOCK, + pssintr, sc); vers = (inw(sc->sc_iobase+PSS_ID_VERS)&0xff) - 1; printf(": esc614%c\n", (vers > 0)?'A'+vers:' '); @@ -1041,10 +1039,8 @@ spattach(parent, self, aux) isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih.ih_fun = ad1848_intr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_CLOCK; - intr_establish(cf->cf_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(cf->cf_irq, ISA_IST_EDGE, ISA_IPL_CLOCK, + ad1848_intr, sc); /* XXX might use pssprint func ?? */ printf(" port 0x%x-0x%x irq %d drq %d", @@ -1071,10 +1067,8 @@ mpuattach(parent, self, aux) isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih.ih_fun = mpuintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_CLOCK; - intr_establish(cf->cf_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(cf->cf_irq, ISA_IST_EDGE, ISA_IPL_CLOCK, + mpuintr, sc); /* XXX might use pssprint func ?? */ printf(" port 0x%x-0x%x irq %d\n", @@ -1304,9 +1298,10 @@ pss_speaker_ctl(addr, newstate) } int -pssintr(sc) - register struct pss_softc *sc; +pssintr(arg) + void *arg; { + register struct pss_softc *sc = arg; u_short sr; sr = inw(sc->sc_iobase+PSS_STATUS); @@ -1326,9 +1321,10 @@ pssintr(sc) } int -mpuintr(sc) - register struct mpu_softc *sc; +mpuintr(arg) + void *arg; { + register struct mpu_softc *sc = arg; u_char sr; sr = inb(sc->sc_iobase+MIDI_STATUS_REG); diff --git a/sys/dev/isa/rtfps.c b/sys/dev/isa/rtfps.c index 2c6d9899343..af1f506f778 100644 --- a/sys/dev/isa/rtfps.c +++ b/sys/dev/isa/rtfps.c @@ -1,4 +1,4 @@ -/* $NetBSD: rtfps.c,v 1.11 1995/01/04 00:47:58 mycroft Exp $ */ +/* $NetBSD: rtfps.c,v 1.12 1995/04/17 12:09:22 cgd Exp $ */ /* * Copyright (c) 1995 Charles Hannum. All rights reserved. @@ -37,11 +37,11 @@ #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> struct rtfps_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; int sc_iobase; int sc_irqport; @@ -51,7 +51,7 @@ struct rtfps_softc { int rtfpsprobe(); void rtfpsattach(); -int rtfpsintr __P((struct rtfps_softc *)); +int rtfpsintr __P((void *)); struct cfdriver rtfpscd = { NULL, "rtfps", rtfpsprobe, rtfpsattach, DV_TTY, sizeof(struct rtfps_softc) @@ -145,16 +145,15 @@ rtfpsattach(parent, self, aux) } } - sc->sc_ih.ih_fun = rtfpsintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_TTY; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_TTY, + rtfpsintr, sc); } int -rtfpsintr(sc) - struct rtfps_softc *sc; +rtfpsintr(arg) + void *arg; { + struct rtfps_softc *sc = arg; int iobase = sc->sc_iobase; int alive = sc->sc_alive; diff --git a/sys/dev/isa/sb.c b/sys/dev/isa/sb.c index 7dd70c3f42f..f0d876d5ad6 100644 --- a/sys/dev/isa/sb.c +++ b/sys/dev/isa/sb.c @@ -1,4 +1,4 @@ -/* $NetBSD: sb.c,v 1.22 1995/03/25 00:01:23 mycroft Exp $ */ +/* $NetBSD: sb.c,v 1.23 1995/04/17 12:07:37 cgd Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sb.c,v 1.22 1995/03/25 00:01:23 mycroft Exp $ + * $Id: sb.c,v 1.23 1995/04/17 12:07:37 cgd Exp $ */ #include <sys/param.h> @@ -49,8 +49,8 @@ #include <sys/audioio.h> #include <dev/audio_if.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isadmavar.h> #include <i386/isa/icu.h> #include <i386/isa/sbdspvar.h> @@ -67,9 +67,9 @@ int sbdebug = 0; struct sb_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ - struct sbdsp_softc sc_sbdsp; + struct sbdsp_softc sc_sbdsp; }; int sbprobe(); @@ -277,10 +277,8 @@ sbattach(parent, self, aux) #ifdef NEWCONFIG isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih.ih_fun = sbdsp_intr; - sc->sc_ih.ih_arg = &sc->sc_sbdsp; - sc->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + sbdsp_intr, &sc->sc_sbdsp); sbdsp_attach(&sc->sc_sbdsp); diff --git a/sys/dev/isa/sbdsp.c b/sys/dev/isa/sbdsp.c index cbccd510e56..9e7488a3d85 100644 --- a/sys/dev/isa/sbdsp.c +++ b/sys/dev/isa/sbdsp.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbdsp.c,v 1.5 1995/03/25 00:01:00 mycroft Exp $ */ +/* $NetBSD: sbdsp.c,v 1.6 1995/04/17 12:07:41 cgd Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sbdsp.c,v 1.5 1995/03/25 00:01:00 mycroft Exp $ + * $Id: sbdsp.c,v 1.6 1995/04/17 12:07:41 cgd Exp $ */ /* * SoundBlaster Pro code provided by John Kohl, based on lots of @@ -57,8 +57,8 @@ #include <sys/audioio.h> #include <dev/audio_if.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isadmavar.h> #include <i386/isa/icu.h> #include <i386/isa/sbreg.h> @@ -1123,9 +1123,10 @@ sbdsp_dma_output(addr, p, cc, intr, arg) * exclusive so we know a priori which event has occurred. */ int -sbdsp_intr(sc) - register struct sbdsp_softc *sc; +sbdsp_intr(arg) + void *arg; { + register struct sbdsp_softc *sc = arg; #ifdef DEBUG if (sbdspdebug > 1) diff --git a/sys/dev/isa/sbdspvar.h b/sys/dev/isa/sbdspvar.h index 2d642148116..dc16d9e049b 100644 --- a/sys/dev/isa/sbdspvar.h +++ b/sys/dev/isa/sbdspvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sbdspvar.h,v 1.4 1995/03/28 18:17:49 jtc Exp $ */ +/* $NetBSD: sbdspvar.h,v 1.5 1995/04/17 12:07:44 cgd Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sbdspvar.h,v 1.4 1995/03/28 18:17:49 jtc Exp $ + * $Id: sbdspvar.h,v 1.5 1995/04/17 12:07:44 cgd Exp $ */ #define SB_MIC_PORT 0 @@ -74,7 +74,7 @@ struct sbdsp_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ u_short sc_iobase; /* I/O port base address */ u_short sc_irq; /* interrupt */ @@ -184,7 +184,7 @@ void sbdsp_spkroff __P((struct sbdsp_softc *)); int sbdsp_wdsp(u_short iobase, int v); int sbdsp_rdsp(u_short iobase); -int sbdsp_intr __P((struct sbdsp_softc *)); +int sbdsp_intr __P((void *)); short sbversion __P((struct sbdsp_softc *)); int sbdsp_set_sr __P((struct sbdsp_softc *, u_long *, int)); diff --git a/sys/dev/isa/seagate.c b/sys/dev/isa/seagate.c index 5455fef98b1..6b9417f3a91 100644 --- a/sys/dev/isa/seagate.c +++ b/sys/dev/isa/seagate.c @@ -81,8 +81,9 @@ #include <scsi/scsi_message.h> #include <scsi/scsiconf.h> -#include <i386/isa/isareg.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isareg.h> +#include <dev/isa/isavar.h> +#include <i386/isa/isa_machdep.h> /* XXX USES ISA HOLE DIRECTLY */ #define SEA_SCB_MAX 32 /* allow maximally 8 scsi control blocks */ #define SCB_TABLE_SIZE 8 /* start with 8 scb entries in table */ @@ -186,7 +187,7 @@ struct sea_scb { struct sea_softc { struct device sc_dev; struct isadev sc_id; - struct intrhand sc_ih; + void *sc_ih; int type; /* board type */ caddr_t maddr; /* Base address for card */ @@ -266,7 +267,7 @@ static const char *bases[] = { #define nbases (sizeof(bases) / sizeof(bases[0])) -int seaintr __P((struct sea_softc *)); +int seaintr __P((void *)); int sea_scsi_cmd __P((struct scsi_xfer *)); void sea_timeout __P((void *)); void seaminphys __P((struct buf *)); @@ -430,10 +431,8 @@ seaattach(parent, self, aux) #ifdef NEWCONFIG isa_establish(&sea->sc_id, &sea->sc_deV); #endif - sea->sc_ih.ih_fun = seaintr; - sea->sc_ih.ih_arg = sea; - sea->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &sea->sc_ih); + sea->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + seaintr, sea); /* * ask the adapter what subunits are present @@ -445,9 +444,10 @@ seaattach(parent, self, aux) * Catch an interrupt from the adaptor */ int -seaintr(sea) - struct sea_softc *sea; +seaintr(arg) + void *arg; { + struct sea_softc *sea = arg; #ifdef DEBUG /* extra overhead, and only needed for intr debugging */ if ((STATUS & STAT_PARITY) == 0 && diff --git a/sys/dev/isa/ultra14f.c b/sys/dev/isa/ultra14f.c index 516000fe14c..3e311031a44 100644 --- a/sys/dev/isa/ultra14f.c +++ b/sys/dev/isa/ultra14f.c @@ -1,4 +1,4 @@ -/* $NetBSD: ultra14f.c,v 1.48 1995/03/14 02:35:11 mycroft Exp $ */ +/* $NetBSD: ultra14f.c,v 1.49 1995/04/17 12:09:27 cgd Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -65,7 +65,7 @@ #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> @@ -259,7 +259,7 @@ struct uha_mscp { struct uha_softc { struct device sc_dev; struct isadev sc_id; - struct intrhand sc_ih; + void *sc_ih; int sc_iobase; int sc_irq, sc_drq; @@ -285,8 +285,8 @@ int u14_abort __P((struct uha_softc *, struct uha_mscp *)); int u24_abort __P((struct uha_softc *, struct uha_mscp *)); int u14_poll __P((struct uha_softc *, struct scsi_xfer *, int)); int u24_poll __P((struct uha_softc *, struct scsi_xfer *, int)); -int u14intr __P((struct uha_softc *)); -int u24intr __P((struct uha_softc *)); +int u14intr __P((void *)); +int u24intr __P((void *)); void uha_done __P((struct uha_softc *, struct uha_mscp *)); void uha_free_mscp __P((struct uha_softc *, struct uha_mscp *, int flags)); struct uha_mscp *uha_get_mscp __P((struct uha_softc *, int)); @@ -604,10 +604,8 @@ uhaattach(parent, self, aux) #ifdef NEWCONFIG isa_establish(&uha->sc_id, &uha->sc_dev); #endif - uha->sc_ih.ih_fun = uha->intr; - uha->sc_ih.ih_arg = uha; - uha->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &uha->sc_ih); + uha->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + uha->intr, uha); /* * ask the adapter what subunits are present @@ -619,9 +617,10 @@ uhaattach(parent, self, aux) * Catch an interrupt from the adaptor */ int -u14intr(uha) - struct uha_softc *uha; +u14intr(arg) + void *arg; { + struct uha_softc *uha = arg; struct uha_mscp *mscp; u_char uhastat; u_long mboxval; @@ -665,9 +664,10 @@ u14intr(uha) } int -u24intr(uha) - struct uha_softc *uha; +u24intr(arg) + void *arg; { + struct uha_softc *uha = arg; struct uha_mscp *mscp; u_char uhastat; u_long mboxval; diff --git a/sys/dev/isa/wd.c b/sys/dev/isa/wd.c index d945e394a78..0ae8f6eb282 100644 --- a/sys/dev/isa/wd.c +++ b/sys/dev/isa/wd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wd.c,v 1.138 1995/04/15 05:02:56 mycroft Exp $ */ +/* $NetBSD: wd.c,v 1.139 1995/04/17 12:09:31 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -54,7 +54,7 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isavar.h> +#include <dev/isa/isavar.h> #include <dev/isa/wdreg.h> #define WAITTIME (4 * hz) /* time to wait for a completion */ @@ -120,7 +120,7 @@ struct wd_softc { struct wdc_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; int sc_iobase; /* I/O port base */ int sc_drq; /* DMA channel */ @@ -158,7 +158,7 @@ void wdstart __P((struct wd_softc *)); struct dkdriver wddkdriver = { wdstrategy }; void wdfinish __P((struct wd_softc *, struct buf *)); -int wdcintr __P((struct wdc_softc *)); +int wdcintr __P((void *)); void wdcstart __P((struct wdc_softc *)); int wdcommand __P((struct wd_softc *, int, int, int, int, int)); int wdcommandshort __P((struct wdc_softc *, int, int)); @@ -249,10 +249,8 @@ wdcattach(parent, self, aux) printf("\n"); - wdc->sc_ih.ih_fun = wdcintr; - wdc->sc_ih.ih_arg = wdc; - wdc->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &wdc->sc_ih); + wdc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + wdcintr, wdc); for (wa.wa_drive = 0; wa.wa_drive < 2; wa.wa_drive++) (void)config_found(self, (void *)&wa, wdprint); @@ -700,9 +698,10 @@ loop: * the next chunk if so. */ int -wdcintr(wdc) - struct wdc_softc *wdc; +wdcintr(arg) + void *arg; { + struct wdc_softc *wdc = arg; struct wd_softc *wd; struct buf *bp; diff --git a/sys/dev/isa/wd7000.c b/sys/dev/isa/wd7000.c index 3df977602ba..119dd10767d 100644 --- a/sys/dev/isa/wd7000.c +++ b/sys/dev/isa/wd7000.c @@ -1,4 +1,6 @@ -/* $NetBSD: wd7000.c,v 1.19 1994/11/18 22:03:49 mycroft Exp $ */ +/* $NetBSD: wd7000.c,v 1.20 1995/04/17 12:09:35 cgd Exp $ */ + +/* XXX THIS DRIVER IS BROKEN. IT WILL NOT EVEN COMPILE. */ /* * UNFINISHED! UNFINISHED! UNFINISHED! UNFINISHED! UNFINISHED! UNFINISHED! @@ -38,7 +40,7 @@ #include <machine/cpu.h> #include <machine/pio.h> -#include <i386/isa/isa_device.h> +#include <i386/isa/isa_device.h> /* XXX BROKEN */ extern int delaycount; /* from clock setup code */ diff --git a/sys/dev/isa/wss.c b/sys/dev/isa/wss.c index 463ca2da351..3fcd3b3491f 100644 --- a/sys/dev/isa/wss.c +++ b/sys/dev/isa/wss.c @@ -1,4 +1,4 @@ -/* $NetBSD: wss.c,v 1.2 1995/03/25 00:01:07 mycroft Exp $ */ +/* $NetBSD: wss.c,v 1.3 1995/04/17 12:07:50 cgd Exp $ */ /* * Copyright (c) 1994 John Brezak @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: wss.c,v 1.2 1995/03/25 00:01:07 mycroft Exp $ + * $Id: wss.c,v 1.3 1995/04/17 12:07:50 cgd Exp $ */ #include <sys/param.h> @@ -51,8 +51,8 @@ #include <sys/audioio.h> #include <dev/audio_if.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isadmavar.h> #include <i386/isa/icu.h> #include <i386/isa/ad1848var.h> @@ -89,14 +89,14 @@ int wssdebug = 0; struct wss_softc { struct device sc_dev; /* base device */ struct isadev sc_id; /* ISA device */ - struct intrhand sc_ih; /* interrupt vectoring */ + void *sc_ih; /* interrupt vectoring */ struct ad1848_softc sc_ad1848; #define wss_iobase sc_ad1848.sc_iobase #define wss_irq sc_ad1848.sc_irq #define wss_drq sc_ad1848.sc_drq - int mic_mute, cd_mute, dac_mute; + int mic_mute, cd_mute, dac_mute; }; struct audio_device wss_device = { @@ -251,10 +251,8 @@ wssattach(parent, self, aux) #ifdef NEWCONFIG isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih.ih_fun = ad1848_intr; - sc->sc_ih.ih_arg = &sc->sc_ad1848; - sc->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + ad1848_intr, &sc->sc_ad1848); ad1848_attach(&sc->sc_ad1848); diff --git a/sys/dev/isa/wt.c b/sys/dev/isa/wt.c index 246ef7af332..de9c1d69e80 100644 --- a/sys/dev/isa/wt.c +++ b/sys/dev/isa/wt.c @@ -1,4 +1,4 @@ -/* $NetBSD: wt.c,v 1.23 1995/01/29 07:37:18 cgd Exp $ */ +/* $NetBSD: wt.c,v 1.24 1995/04/17 12:09:37 cgd Exp $ */ /* * Streamer tape driver. @@ -64,8 +64,8 @@ #include <machine/pio.h> -#include <i386/isa/isavar.h> -#include <i386/isa/dmavar.h> +#include <dev/isa/isavar.h> +#include <dev/isa/isadmavar.h> #include <dev/isa/wtreg.h> /* @@ -126,7 +126,7 @@ enum wttype { struct wt_softc { struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; enum wttype type; /* type of controller */ int sc_iobase; /* base i/o port */ @@ -165,7 +165,7 @@ u_char wtpoll __P((struct wt_softc *sc, int mask, int bits)); int wtprobe __P((struct device *, void *, void *)); void wtattach __P((struct device *, struct device *, void *)); -int wtintr __P((struct wt_softc *sc)); +int wtintr __P((void *sc)); struct cfdriver wtcd = { NULL, "wt", wtprobe, wtattach, DV_TAPE, sizeof(struct wt_softc) @@ -249,10 +249,8 @@ wtattach(parent, self, aux) sc->flags = TPSTART; /* tape is rewound */ sc->dens = -1; /* unknown density */ - sc->sc_ih.ih_fun = wtintr; - sc->sc_ih.ih_arg = sc; - sc->sc_ih.ih_level = IPL_BIO; - intr_establish(ia->ia_irq, IST_EDGE, &sc->sc_ih); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, + wtintr, sc); } int @@ -598,9 +596,10 @@ xit: * Interrupt routine. */ int -wtintr(sc) - struct wt_softc *sc; +wtintr(arg) + void *arg; { + struct wt_softc *sc = arg; u_char x; x = inb(sc->STATPORT); /* get status */ diff --git a/sys/dev/pci/ncr.c b/sys/dev/pci/ncr.c index fa2ddfb5527..ed3f85a00ef 100644 --- a/sys/dev/pci/ncr.c +++ b/sys/dev/pci/ncr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ncr.c,v 1.13 1995/03/28 20:00:53 jtc Exp $ */ +/* $NetBSD: ncr.c,v 1.14 1995/04/17 12:09:43 cgd Exp $ */ /************************************************************************** ** @@ -907,7 +907,7 @@ struct ccb { struct ncb { #ifdef __NetBSD__ struct device sc_dev; - struct intrhand sc_ih; + void *sc_ih; #else /* !__NetBSD__ */ int unit; #endif /* __NetBSD__ */ @@ -1157,7 +1157,7 @@ ccb_p ncr_get_ccb (ncb_p np, u_long flags, u_long t,u_long l); U_INT32 ncr_info (int unit); #endif /* !__NetBSD__ */ void ncr_init (ncb_p np, char * msg, u_long code); -int ncr_intr (ncb_p np); +int ncr_intr (void *); void ncr_int_ma (ncb_p np); void ncr_int_sir (ncb_p np); void ncr_int_sto (ncb_p np); @@ -1204,7 +1204,7 @@ void ncr_attach (pcici_t tag, int unit); static char ident[] = - "\n$Id: ncr.c,v 1.13 1995/03/28 20:00:53 jtc Exp $\n"; + "\n$Id: ncr.c,v 1.14 1995/04/17 12:09:43 cgd Exp $\n"; u_long ncr_version = NCR_VERSION + (u_long) sizeof (struct ncb) @@ -3280,11 +3280,8 @@ void ncr_attach (pcici_t config_id, int unit) }; #ifdef __NetBSD__ - np->sc_ih.ih_fun = ncr_intr; - np->sc_ih.ih_arg = np; - np->sc_ih.ih_level = IPL_BIO; - - if (pci_map_int(pa->pa_tag, &np->sc_ih)) + np->sc_ih = pci_map_int(pa->pa_tag, PCI_IPL_BIO, ncr_intr, np); + if (np->sc_ih == NULL) return; #else /* !__NetBSD__ */ /* @@ -3314,7 +3311,7 @@ void ncr_attach (pcici_t config_id, int unit) ncr_name (np)); DELAY (1000000); #endif - printf ("%s scanning for targets 0..%d ($Revision: 1.13 $)\n", + printf ("%s scanning for targets 0..%d ($Revision: 1.14 $)\n", ncr_name (np), MAX_TARGET-1); /* @@ -3366,9 +3363,10 @@ void ncr_attach (pcici_t config_id, int unit) */ int -ncr_intr(np) - ncb_p np; +ncr_intr(arg) + void *arg; { + ncb_p np = arg; int n = 0; if (DEBUG_FLAGS & DEBUG_TINY) printf ("["); diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h index d3c843ae2cd..f128fc12e40 100644 --- a/sys/dev/pci/pcivar.h +++ b/sys/dev/pci/pcivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: pcivar.h,v 1.4 1995/01/27 05:44:33 cgd Exp $ */ +/* $NetBSD: pcivar.h,v 1.5 1995/04/17 12:09:47 cgd Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -45,6 +45,14 @@ ERROR: COMPILING FOR UNSUPPORTED MACHINE, OR MORE THAN ONE. #include <i386/pci/pci_machdep.h> #endif +/* PCI interrupt levels; system interrupt levels for PCI bus use */ +typedef enum { + PCI_IPL_NONE, /* block only the interrupt's IRQ*/ + PCI_IPL_BIO, /* block I/O interrupts */ + PCI_IPL_NET, /* network */ + PCI_IPL_TTY, /* terminal */ + PCI_IPL_CLOCK, /* clock */ +} pci_intrlevel; struct pci_attach_args { int pa_bus; @@ -57,4 +65,4 @@ pcitag_t pci_make_tag __P((int, int, int)); pcireg_t pci_conf_read __P((pcitag_t, int)); void pci_conf_write __P((pcitag_t, int, pcireg_t)); int pci_map_mem __P((pcitag_t, int, vm_offset_t *, vm_offset_t *)); -int pci_map_int __P((pcitag_t, struct intrhand *)); +void *pci_map_int __P((pcitag_t, pci_intrlevel, int (*)(void *), void *)); |
