diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-14 03:54:39 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-14 03:54:39 +0000 |
commit | f12226068d16673eea9adafe99388f1061d3309f (patch) | |
tree | 90cb542d279e793d072ffc6e9f1f1add1f07179e /sys/arch/alpha/isa | |
parent | 470d0389b66fade522060561cc0c6ba36e01e7cb (diff) |
update to netbsd
Diffstat (limited to 'sys/arch/alpha/isa')
-rw-r--r-- | sys/arch/alpha/isa/isa_dma.h | 47 | ||||
-rw-r--r-- | sys/arch/alpha/isa/isa_intr.h | 54 | ||||
-rw-r--r-- | sys/arch/alpha/isa/isa_machdep.c | 169 | ||||
-rw-r--r-- | sys/arch/alpha/isa/pckbd.c | 99 |
4 files changed, 66 insertions, 303 deletions
diff --git a/sys/arch/alpha/isa/isa_dma.h b/sys/arch/alpha/isa/isa_dma.h deleted file mode 100644 index 8c277908351..00000000000 --- a/sys/arch/alpha/isa/isa_dma.h +++ /dev/null @@ -1,47 +0,0 @@ -/* $NetBSD: isa_dma.h,v 1.1 1995/06/28 01:24:50 cgd Exp $ */ - -/* - * Copyright (c) 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -struct isadma_fcns { - int (*isadma_map) __P((caddr_t addr, vm_size_t size, - vm_offset_t *mappings, int flags)); - void (*isadma_unmap) __P((caddr_t addr, vm_size_t size, - int nmappings, vm_offset_t *mappings)); - void (*isadma_copytobuf) __P((caddr_t addr, vm_size_t size, - int nmappings, vm_offset_t *mappings)); - void (*isadma_copyfrombuf) __P((caddr_t addr, vm_size_t size, - int nmappings, vm_offset_t *mappings)); -}; - -/* - * Global which tells which set of functions are correct - * for this machine. - */ -struct isadma_fcns *isadma_fcns; - -struct isadma_fcns apecs_isadma_fcns; /* APECS DMA mapping */ diff --git a/sys/arch/alpha/isa/isa_intr.h b/sys/arch/alpha/isa/isa_intr.h deleted file mode 100644 index 8f53ab9f699..00000000000 --- a/sys/arch/alpha/isa/isa_intr.h +++ /dev/null @@ -1,54 +0,0 @@ -/* $NetBSD: isa_intr.h,v 1.1 1995/06/28 01:24:57 cgd Exp $ */ - -/* - * Copyright (c) 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -/* Prototypes for ISA-ish I/O interrupt functions. */ - -/* - * XXX - * XXX THIS WILL LIKELY HAVE TO BE COMPLETELY CHANGED. - * XXX - */ - -struct isa_intr_fcns { - void (*isa_intr_setup) __P((void)); - - void *(*isa_intr_establish) __P((int irq, isa_intrtype type, - isa_intrlevel level, int (*ih_fun)(void *), void *ih_arg)); - void (*isa_intr_disestablish) __P((void *handler)); - - void (*isa_iointr) __P((void *framep, int vec)); -}; - -/* - * Global which tells which set of functions are correct - * for this machine. - */ -struct isa_intr_fcns *isa_intr_fcns; - -struct isa_intr_fcns sio_intr_fcns; /* SIO ISA ICU handling */ diff --git a/sys/arch/alpha/isa/isa_machdep.c b/sys/arch/alpha/isa/isa_machdep.c deleted file mode 100644 index 9e3a63f7634..00000000000 --- a/sys/arch/alpha/isa/isa_machdep.c +++ /dev/null @@ -1,169 +0,0 @@ -/* $NetBSD: isa_machdep.c,v 1.2 1995/08/03 01:23:08 cgd Exp $ */ - -/* - * Copyright (c) 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#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 <machine/autoconf.h> -#include <machine/pio.h> -#include <machine/rpb.h> -#include <machine/vmparam.h> -#include <machine/pte.h> - -#include <dev/isa/isareg.h> -#include <dev/isa/isavar.h> -#include <dev/isa/isadmavar.h> - -#include <alpha/isa/isa_intr.h> -#include <alpha/isa/isa_dma.h> - -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 isa_softc), 1 -}; - -int -isamatch(parent, cfdata, aux) - struct device *parent; - void *cfdata, *aux; -{ - struct cfdata *cf = cfdata; - struct confargs *ca = aux; - -#if 0 /* XXX -- Assume that it's valid if unit number OK */ - /* It can only occur on the mainbus. */ - if (ca->ca_bus->ab_type != BUS_MAIN) - return (0); - - /* Make sure that we're looking for this type of device. */ - if (!BUS_MATCHNAME(ca, "isa")) - return (0); -#endif /* XXX */ - - /* See if the unit number is valid. */ - switch (hwrpb->rpb_type) { -#if defined(DEC_2100_A50) - case ST_DEC_2100_A50: - if (cf->cf_unit > 0) - return (0); - break; -#endif - default: - return (0); - } - - return (1); -} - -void -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); - - /* XXX set up ISA DMA controllers? */ - - config_scan(isascan, self); -} - -void * -isa_intr_establish(irq, type, level, ih_fun, ih_arg) - int irq; - isa_intrtype type; - isa_intrlevel level; - int (*ih_fun)(void *); - void *ih_arg; -{ - - return (*isa_intr_fcns->isa_intr_establish)(irq, type, level, - ih_fun, ih_arg); -} - -void -isa_intr_disestablish(handler) - void *handler; -{ - - (*isa_intr_fcns->isa_intr_disestablish)(handler); -} - -int -isadma_map(addr, size, mappings, flags) - caddr_t addr; - vm_size_t size; - vm_offset_t *mappings; - int flags; -{ - - (*isadma_fcns->isadma_map)(addr, size, mappings, flags); -} - -void -isadma_unmap(addr, size, nmappings, mappings) - caddr_t addr; - vm_size_t size; - int nmappings; - vm_offset_t *mappings; -{ - - (*isadma_fcns->isadma_unmap)(addr, size, nmappings, mappings); -} - -void -isadma_copytobuf(addr, size, nmappings, mappings) - caddr_t addr; - vm_size_t size; - int nmappings; - vm_offset_t *mappings; -{ - - (*isadma_fcns->isadma_copytobuf)(addr, size, nmappings, mappings); -} - -void -isadma_copyfrombuf(addr, size, nmappings, mappings) - caddr_t addr; - vm_size_t size; - int nmappings; - vm_offset_t *mappings; -{ - - (*isadma_fcns->isadma_copyfrombuf)(addr, size, nmappings, mappings); -} diff --git a/sys/arch/alpha/isa/pckbd.c b/sys/arch/alpha/isa/pckbd.c index 4dacd3f1d3b..cea8cd5f5de 100644 --- a/sys/arch/alpha/isa/pckbd.c +++ b/sys/arch/alpha/isa/pckbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: pckbd.c,v 1.1 1995/08/03 00:48:25 cgd Exp $ */ +/* $NetBSD: pckbd.c,v 1.2 1995/11/23 02:37:06 cgd Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved. @@ -53,12 +53,16 @@ #include <sys/device.h> #include <machine/cpu.h> -#include <machine/pio.h> #include <dev/isa/isareg.h> #include <dev/isa/isavar.h> #include <alpha/isa/pckbdreg.h> +#include "wsc.h" +#if NWSC +#include <alpha/pci/wsconsvar.h> +#endif + static volatile u_char ack, nak; /* Don't ask. */ static u_char async, kernel, polling; /* Really, you don't want to know. */ static u_char lock_state = 0x00, /* all off */ @@ -66,6 +70,11 @@ static u_char lock_state = 0x00, /* all off */ typematic_rate = 0xff, /* don't update until set by user */ old_typematic_rate = 0xff; +__const struct isa_intr_fns *pckbd_intr_fns; /* XXX */ +void *pckbd_intr_arg; /* XXX */ +__const struct isa_pio_fns *pckbd_pio_fns; /* XXX */ +void *pckbd_pio_arg; /* XXX */ + struct pckbd_softc { struct device sc_dev; void *sc_ih; @@ -100,10 +109,10 @@ void pccnpollc __P((void *, int)); #define NONE 0x0400 /* no function */ #define KBD_DELAY \ - { u_char x = inb(0x84); } \ - { u_char x = inb(0x84); } \ - { u_char x = inb(0x84); } \ - { u_char x = inb(0x84); } + { u_char x = INB(pckbd_pio_fns, pckbd_pio_arg, 0x84); } \ + { u_char x = INB(pckbd_pio_fns, pckbd_pio_arg, 0x84); } \ + { u_char x = INB(pckbd_pio_fns, pckbd_pio_arg, 0x84); } \ + { u_char x = INB(pckbd_pio_fns, pckbd_pio_arg, 0x84); } static inline int kbd_wait_output() @@ -111,7 +120,8 @@ kbd_wait_output() u_int i; for (i = 100000; i; i--) - if ((inb(KBSTATP) & KBS_IBF) == 0) { + if ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_IBF) + == 0) { KBD_DELAY; return 1; } @@ -124,7 +134,8 @@ kbd_wait_input() u_int i; for (i = 100000; i; i--) - if ((inb(KBSTATP) & KBS_DIB) != 0) { + if ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB) + != 0) { KBD_DELAY; return 1; } @@ -137,10 +148,11 @@ kbd_flush_input() u_int i; for (i = 10; i; i--) { - if ((inb(KBSTATP) & KBS_DIB) == 0) + if ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB) + == 0) return; KBD_DELAY; - (void) inb(KBDATAP); + (void) INB(pckbd_pio_fns, pckbd_pio_arg, KBDATAP); } } @@ -154,10 +166,10 @@ kbc_get8042cmd() if (!kbd_wait_output()) return -1; - outb(KBCMDP, K_RDCMDBYTE); + OUTB(pckbd_pio_fns, pckbd_pio_arg, KBCMDP, K_RDCMDBYTE); if (!kbd_wait_input()) return -1; - return inb(KBDATAP); + return INB(pckbd_pio_fns, pckbd_pio_arg, KBDATAP); } #endif @@ -171,10 +183,10 @@ kbc_put8042cmd(val) if (!kbd_wait_output()) return 0; - outb(KBCMDP, K_LDCMDBYTE); + OUTB(pckbd_pio_fns, pckbd_pio_arg, KBCMDP, K_LDCMDBYTE); if (!kbd_wait_output()) return 0; - outb(KBOUTP, val); + OUTB(pckbd_pio_fns, pckbd_pio_arg, KBOUTP, val); return 1; } @@ -193,14 +205,16 @@ kbd_cmd(val, polling) if (!kbd_wait_output()) return 0; ack = nak = 0; - outb(KBOUTP, val); + OUTB(pckbd_pio_fns, pckbd_pio_arg, KBOUTP, val); if (polling) for (i = 100000; i; i--) { - if (inb(KBSTATP) & KBS_DIB) { + if (INB(pckbd_pio_fns, pckbd_pio_arg, + KBSTATP) & KBS_DIB) { register u_char c; KBD_DELAY; - c = inb(KBDATAP); + c = INB(pckbd_pio_fns, pckbd_pio_arg, + KBDATAP); if (c == KBR_ACK || c == KBR_ECHO) { ack = 1; return 1; @@ -210,13 +224,15 @@ kbd_cmd(val, polling) break; } #ifdef DIAGNOSTIC - printf("kbd_cmd: input char %x lost\n", c); + printf("kbd_cmd: input char %x lost\n", + c); #endif } } else for (i = 100000; i; i--) { - (void) inb(KBSTATP); + (void) INB(pckbd_pio_fns, pckbd_pio_arg, + KBSTATP); if (ack) return 1; if (nak) @@ -236,9 +252,12 @@ pckbdprobe(parent, match, aux) struct device *parent; void *match, *aux; { - struct isa_attach_args *ia = aux; + struct isadev_attach_args *ida = aux; u_int i; + pckbd_pio_fns = ida->ida_piofns; /* XXX */ + pckbd_pio_arg = ida->ida_pioarg; /* XXX */ + /* Enable interrupts and keyboard, etc. */ if (!kbc_put8042cmd(CMDBYTE)) { printf("pcprobe: command error\n"); @@ -254,11 +273,13 @@ pckbdprobe(parent, match, aux) goto lose; } for (i = 600000; i; i--) - if ((inb(KBSTATP) & KBS_DIB) != 0) { + if ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB) + != 0) { KBD_DELAY; break; } - if (i == 0 || inb(KBDATAP) != KBR_RSTDONE) { + if (i == 0 || INB(pckbd_pio_fns, pckbd_pio_arg, KBDATAP) + != KBR_RSTDONE) { printf("pcprobe: reset error %d\n", 2); goto lose; } @@ -308,8 +329,8 @@ lose: */ #endif - ia->ia_iosize = 16; - ia->ia_msize = 0; + ida->ida_nports[0] = 16; + ida->ida_iosiz[0] = 0; return 1; } @@ -319,12 +340,21 @@ pckbdattach(parent, self, aux) void *aux; { struct pckbd_softc *sc = (void *)self; - struct isa_attach_args *ia = aux; - + struct isadev_attach_args *ida = aux; + + pckbd_intr_fns = ida->ida_intrfns; /* XXX */ + pckbd_intr_arg = ida->ida_intrarg; /* XXX */ + pckbd_pio_fns = ida->ida_piofns; /* XXX */ + pckbd_pio_arg = ida->ida_pioarg; /* XXX */ + + sc->sc_ih = ISA_INTR_ESTABLISH(pckbd_intr_fns, pckbd_intr_arg, + ida->ida_irq[0], ISA_IST_EDGE, ISA_IPL_TTY, pckbdintr, sc); +#if NWSC printf("\n"); - sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_TTY, - pckbdintr, sc); wscattach_input(self, self, pccngetc, pccnpollc); +#else + printf(": no wsc driver; no input possible\n"); +#endif } /* @@ -339,15 +369,17 @@ pckbdintr(arg) struct pckbd_softc *sc = arg; u_char *cp; - if ((inb(KBSTATP) & KBS_DIB) == 0) + if ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB) == 0) return 0; if (polling) return 1; do { cp = sget(); +#if NWSC if (cp) wscons_kbdinput(cp); - } while (inb(KBSTATP) & KBS_DIB); +#endif + } while (INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB); return 1; } @@ -609,7 +641,7 @@ sget() top: KBD_DELAY; - dt = inb(KBDATAP); + dt = INB(pckbd_pio_fns, pckbd_pio_arg, KBDATAP); switch (dt) { case KBR_ACK: @@ -806,7 +838,7 @@ top: extended = 0; loop: - if ((inb(KBSTATP) & KBS_DIB) == 0) + if ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB) == 0) return 0; goto top; } @@ -826,7 +858,8 @@ pccngetc(cookie) do { /* wait for byte */ - while ((inb(KBSTATP) & KBS_DIB) == 0); + while ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB) + == 0); /* see if it's worthwhile */ cp = sget(); } while (!cp); |