summaryrefslogtreecommitdiff
path: root/sys/arch/alpha/isa
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1997-01-24 19:58:34 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1997-01-24 19:58:34 +0000
commit0ef244d8476654749f2eaf9441dc06b2fd4d4f7b (patch)
tree270851bce850e6dddd96484e78fa648cb8bec296 /sys/arch/alpha/isa
parenta77b8c21d70779c5365903c1f86d3c3126549212 (diff)
Sync with NetBSD 961207
Diffstat (limited to 'sys/arch/alpha/isa')
-rw-r--r--sys/arch/alpha/isa/isa_machdep.c70
-rw-r--r--sys/arch/alpha/isa/isa_machdep.h10
-rw-r--r--sys/arch/alpha/isa/mcclock_isa.c31
-rw-r--r--sys/arch/alpha/isa/pckbd.c418
-rw-r--r--sys/arch/alpha/isa/pcppi.c194
-rw-r--r--sys/arch/alpha/isa/pcppivar.h44
-rw-r--r--sys/arch/alpha/isa/pms.c85
-rw-r--r--sys/arch/alpha/isa/vga_isa.c145
-rw-r--r--sys/arch/alpha/isa/vga_isavar.h31
9 files changed, 769 insertions, 259 deletions
diff --git a/sys/arch/alpha/isa/isa_machdep.c b/sys/arch/alpha/isa/isa_machdep.c
new file mode 100644
index 00000000000..a758abd46b5
--- /dev/null
+++ b/sys/arch/alpha/isa/isa_machdep.c
@@ -0,0 +1,70 @@
+/* $NetBSD: isa_machdep.c,v 1.5 1996/11/23 06:38:49 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 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.
+ */
+
+/*
+ * Machine-specific functions for PCI autoconfiguration.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/systm.h>
+#include <sys/errno.h>
+#include <sys/device.h>
+#include <vm/vm.h>
+
+#include <dev/isa/isavar.h>
+
+#include "vga_isa.h"
+#if NVGA_ISA
+#include <alpha/isa/vga_isavar.h>
+#endif
+
+struct {
+ int (*probe) __P((bus_space_tag_t, bus_space_tag_t));
+ void (*console) __P((bus_space_tag_t, bus_space_tag_t));
+} isa_display_console_devices[] = {
+#if NVGA_ISA
+ { vga_isa_console_match, vga_isa_console_attach },
+#endif
+ { },
+};
+
+void
+isa_display_console(iot, memt)
+ bus_space_tag_t iot, memt;
+{
+ int i = 0;
+
+ while (isa_display_console_devices[i].probe != NULL)
+ if ((*isa_display_console_devices[i].probe)(iot, memt)) {
+ (*isa_display_console_devices[i].console)(iot, memt);
+ break;
+ }
+}
diff --git a/sys/arch/alpha/isa/isa_machdep.h b/sys/arch/alpha/isa/isa_machdep.h
index 75d6cbe4020..4fa25b19952 100644
--- a/sys/arch/alpha/isa/isa_machdep.h
+++ b/sys/arch/alpha/isa/isa_machdep.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: isa_machdep.h,v 1.3 1996/10/30 22:39:37 niklas Exp $ */
-/* $NetBSD: isa_machdep.h,v 1.2 1996/04/12 05:39:02 cgd Exp $ */
+/* $OpenBSD: isa_machdep.h,v 1.4 1997/01/24 19:57:24 niklas Exp $ */
+/* $NetBSD: isa_machdep.h,v 1.3 1996/11/19 04:53:07 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -52,3 +52,9 @@ struct alpha_isa_chipset {
(*(c)->ic_intr_establish)((c)->ic_v, (i), (t), (l), (f), (a), (nm))
#define isa_intr_disestablish(c, h) \
(*(c)->ic_intr_disestablish)((c)->ic_v, (h))
+
+/*
+ * alpha-specific ISA functions.
+ * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
+ */
+void isa_display_console __P((bus_space_tag_t, bus_space_tag_t));
diff --git a/sys/arch/alpha/isa/mcclock_isa.c b/sys/arch/alpha/isa/mcclock_isa.c
index ef6b8acc696..392a63842b6 100644
--- a/sys/arch/alpha/isa/mcclock_isa.c
+++ b/sys/arch/alpha/isa/mcclock_isa.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: mcclock_isa.c,v 1.5 1996/12/08 00:20:27 niklas Exp $ */
-/* $NetBSD: mcclock_isa.c,v 1.3 1996/10/23 04:12:19 cgd Exp $ */
+/* $OpenBSD: mcclock_isa.c,v 1.6 1997/01/24 19:57:24 niklas Exp $ */
+/* $NetBSD: mcclock_isa.c,v 1.5 1996/12/05 01:39:29 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -47,7 +47,11 @@ struct mcclock_isa_softc {
bus_space_handle_t sc_ioh;
};
+#ifdef __BROKEN_INDIRECT_CONFIG
int mcclock_isa_match __P((struct device *, void *, void *));
+#else
+int mcclock_isa_match __P((struct device *, struct cfdata *, void *));
+#endif
void mcclock_isa_attach __P((struct device *, struct device *, void *));
struct cfattach mcclock_isa_ca = {
@@ -65,16 +69,29 @@ const struct mcclock_busfns mcclock_isa_busfns = {
int
mcclock_isa_match(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
struct isa_attach_args *ia = aux;
+ bus_space_handle_t ioh;
+
+ if ((ia->ia_iobase != IOBASEUNK && ia->ia_iobase != 0x70) ||
+ /* (ia->ia_iosize != 0 && ia->ia_iosize != 0x2) || XXX isa.c */
+ ia->ia_maddr != MADDRUNK || ia->ia_msize != 0 ||
+ ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK)
+ return (0);
- if (ia->ia_iobase != 0x70 && ia->ia_iobase != -1)
+ if (bus_space_map(ia->ia_iot, 0x70, 0x2, 0, &ioh))
return (0);
- ia->ia_iobase = 0x70; /* XXX */
- ia->ia_iosize = 2; /* XXX */
- ia->ia_msize = 0;
+ bus_space_unmap(ia->ia_iot, ioh, 0x2);
+
+ ia->ia_iobase = 0x70;
+ ia->ia_iosize = 0x2;
return (1);
}
diff --git a/sys/arch/alpha/isa/pckbd.c b/sys/arch/alpha/isa/pckbd.c
index f255e2b82e1..b23ee96cb32 100644
--- a/sys/arch/alpha/isa/pckbd.c
+++ b/sys/arch/alpha/isa/pckbd.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pckbd.c,v 1.8 1996/12/08 00:20:28 niklas Exp $ */
-/* $NetBSD: pckbd.c,v 1.10 1996/10/23 04:12:20 cgd Exp $ */
+/* $OpenBSD: pckbd.c,v 1.9 1997/01/24 19:57:26 niklas Exp $ */
+/* $NetBSD: pckbd.c,v 1.14 1996/12/05 01:39:30 cgd Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved.
@@ -62,11 +62,23 @@
#include <alpha/isa/spkrreg.h>
#include <alpha/isa/timerreg.h>
#include <machine/wsconsio.h>
+#include <alpha/isa/pcppivar.h>
#include <alpha/wscons/wsconsvar.h>
#include <alpha/wscons/kbd.h>
#include "wscons.h"
+#undef KBDATAP
+#undef KBOUTP
+#undef KBSTATP
+#undef KBCMDP
+#undef PITAUX_PORT
+#define KBDATAP 0x0 /* kbd data port (I) */
+#define KBOUTP 0x0 /* kbd data port (O) */
+#define KBSTATP 0x4 /* kbd controller status port (I) */
+#define KBCMDP 0x4 /* kbd controller port (O) */
+#define PITAUX_PORT 0x1 /* port B of PPI */
+
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 */
@@ -77,12 +89,8 @@ static u_char lock_state = 0x00, /* all off */
bus_space_tag_t pckbd_iot;
isa_chipset_tag_t pckbd_ic;
-bus_space_handle_t pckbd_data_ioh;
-#define pckbd_out_ioh pckbd_data_ioh
-bus_space_handle_t pckbd_status_ioh;
-#define pckbd_cmd_ioh pckbd_status_ioh
+bus_space_handle_t pckbd_ioh;
bus_space_handle_t pckbd_timer_ioh;
-bus_space_handle_t pckbd_pitaux_ioh;
bus_space_handle_t pckbd_delay_ioh;
struct pckbd_softc {
@@ -93,7 +101,11 @@ struct pckbd_softc {
int sc_bellpitch; /* last pitch programmed */
};
+#ifdef __BROKEN_INDIRECT_CONFIG
int pckbdprobe __P((struct device *, void *, void *));
+#else
+int pckbdprobe __P((struct device *, struct cfdata *, void *));
+#endif
void pckbdattach __P((struct device *, struct device *, void *));
int pckbdintr __P((void *));
@@ -108,9 +120,8 @@ struct cfdriver pckbd_cd = {
int pckbd_cngetc __P((struct device *));
void pckbd_cnpollc __P((struct device *, int));
void pckbd_bell __P((struct device *, struct wsconsio_bell_data *));
-int pckbd_ioctl __P((struct device *, u_long, caddr_t, int,
+int pckbd_ioctl __P((void *, u_long, caddr_t, int,
struct proc *));
-
char *pckbd_translate __P((struct device *dev, int c));
#if NWSCONS
@@ -126,12 +137,15 @@ struct wscons_idev_spec pckbd_wscons_idev = {
#endif
void pckbd_bell_stop __P((void *));
-
static __inline int kbd_wait_output __P((void));
static __inline int kbd_wait_input __P((void));
static __inline void kbd_flush_input __P((void));
-u_char kbc_get8042cmd __P((void));
-int kbc_put8042cmd __P((u_char));
+u_char kbc_get8042cmd __P((void));
+int kbc_put8042cmd __P((u_char));
+int kbd_cmd __P((u_char, u_char));
+void do_async_update __P((void *));
+void async_update __P((void));
+
int kbd_cmd __P((u_char, u_char));
void do_async_update __P((void *));
void async_update __P((void));
@@ -165,7 +179,7 @@ kbd_wait_output()
u_int i;
for (i = 100000; i; i--)
- if ((bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_IBF)
+ if ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_IBF)
== 0) {
KBD_DELAY;
return 1;
@@ -179,7 +193,7 @@ kbd_wait_input()
u_int i;
for (i = 100000; i; i--)
- if ((bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_DIB)
+ if ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB)
!= 0) {
KBD_DELAY;
return 1;
@@ -193,11 +207,11 @@ kbd_flush_input()
u_int i;
for (i = 10; i; i--) {
- if ((bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_DIB)
+ if ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB)
== 0)
return;
KBD_DELAY;
- (void) bus_space_read_1(pckbd_iot, pckbd_data_ioh, 0);
+ (void) bus_space_read_1(pckbd_iot, pckbd_ioh, KBDATAP);
}
}
@@ -211,10 +225,10 @@ kbc_get8042cmd()
if (!kbd_wait_output())
return -1;
- bus_space_write_1(pckbd_iot, pckbd_cmd_ioh, 0, K_RDCMDBYTE);
+ bus_space_write_1(pckbd_iot, pckbd_ioh, KBCMDP, K_RDCMDBYTE);
if (!kbd_wait_input())
return -1;
- return bus_space_read_1(pckbd_iot, pckbd_data_ioh, 0);
+ return bus_space_read_1(pckbd_iot, pckbd_ioh, KBDATAP);
}
#endif
@@ -228,10 +242,10 @@ kbc_put8042cmd(val)
if (!kbd_wait_output())
return 0;
- bus_space_write_1(pckbd_iot, pckbd_cmd_ioh, 0, K_LDCMDBYTE);
+ bus_space_write_1(pckbd_iot, pckbd_ioh, KBCMDP, K_LDCMDBYTE);
if (!kbd_wait_output())
return 0;
- bus_space_write_1(pckbd_iot, pckbd_out_ioh, 0, val);
+ bus_space_write_1(pckbd_iot, pckbd_ioh, KBOUTP, val);
return 1;
}
@@ -250,16 +264,16 @@ kbd_cmd(val, polling)
if (!kbd_wait_output())
return 0;
ack = nak = 0;
- bus_space_write_1(pckbd_iot, pckbd_out_ioh, 0, val);
+ bus_space_write_1(pckbd_iot, pckbd_ioh, KBOUTP, val);
if (polling)
for (i = 100000; i; i--) {
if (bus_space_read_1(pckbd_iot,
- pckbd_status_ioh, 0) & KBS_DIB) {
+ pckbd_ioh, KBSTATP) & KBS_DIB) {
register u_char c;
KBD_DELAY;
c = bus_space_read_1(pckbd_iot,
- pckbd_data_ioh, 0);
+ pckbd_ioh, KBDATAP);
if (c == KBR_ACK || c == KBR_ECHO) {
ack = 1;
return 1;
@@ -277,7 +291,7 @@ kbd_cmd(val, polling)
else
for (i = 100000; i; i--) {
(void) bus_space_read_1(pckbd_iot,
- pckbd_status_ioh, 0);
+ pckbd_ioh, KBSTATP);
if (ack)
return 1;
if (nak)
@@ -295,28 +309,34 @@ kbd_cmd(val, polling)
int
pckbdprobe(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
- struct isa_attach_args *ia = aux;
- u_int i;
-
- pckbd_iot = ia->ia_iot;
- pckbd_ic = ia->ia_ic;
+ struct pcppi_attach_args *pa = aux;
+ u_int i, rv;
- if (bus_space_map(pckbd_iot, KBDATAP, 1, 0, &pckbd_data_ioh) ||
- bus_space_map(pckbd_iot, KBSTATP, 1, 0, &pckbd_status_ioh) ||
- bus_space_map(pckbd_iot, IO_TIMER1, 4, 0, &pckbd_timer_ioh) ||
- bus_space_map(pckbd_iot, PITAUX_PORT, 1, 0, &pckbd_pitaux_ioh))
+ if (pa->pa_slot != PCPPI_KBD_SLOT)
return 0;
- pckbd_delay_ioh = ia->ia_delaybah;
+ rv = 0;
+
+ pckbd_iot = pa->pa_iot;
+ pckbd_ic = pa->pa_ic;
+ pckbd_ioh = pa->pa_ioh;
+ pckbd_timer_ioh = pa->pa_pit_ioh;
+ pckbd_delay_ioh = pa->pa_delaybah;
/* Enable interrupts and keyboard, etc. */
if (!kbc_put8042cmd(CMDBYTE)) {
printf("pcprobe: command error\n");
- return 0;
+ goto lose;
}
+ rv = 1; /* from here one out, we let it succeed */
#if 1
/* Flush any garbage. */
kbd_flush_input();
@@ -326,12 +346,12 @@ pckbdprobe(parent, match, aux)
goto lose;
}
for (i = 600000; i; i--)
- if ((bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_DIB)
+ if ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB)
!= 0) {
KBD_DELAY;
break;
}
- if (i == 0 || bus_space_read_1(pckbd_iot, pckbd_data_ioh, 0)
+ if (i == 0 || bus_space_read_1(pckbd_iot, pckbd_ioh, KBDATAP)
!= KBR_RSTDONE) {
printf("pcprobe: reset error %d\n", 2);
goto lose;
@@ -382,9 +402,7 @@ lose:
*/
#endif
- ia->ia_iobase = 16;
- ia->ia_iosize = 0;
- return 1;
+ return rv;
}
void
@@ -393,21 +411,16 @@ pckbdattach(parent, self, aux)
void *aux;
{
struct pckbd_softc *sc = (void *)self;
- struct isa_attach_args *ia = aux;
-
- pckbd_iot = ia->ia_iot;
- pckbd_ic = ia->ia_ic;
+ struct pcppi_attach_args *pa = aux;
- if (bus_space_map(pckbd_iot, KBDATAP, 1, 0, &pckbd_data_ioh) ||
- bus_space_map(pckbd_iot, KBSTATP, 1, 0, &pckbd_status_ioh) ||
- bus_space_map(pckbd_iot, IO_TIMER1, 4, 0, &pckbd_timer_ioh) ||
- bus_space_map(pckbd_iot, PITAUX_PORT, 1, 0, &pckbd_pitaux_ioh))
- panic("pckbdattach couldn't map");
+ pckbd_iot = pa->pa_iot;
+ pckbd_ic = pa->pa_ic;
+ pckbd_ioh = pa->pa_ioh;
+ pckbd_timer_ioh = pa->pa_pit_ioh;
+ pckbd_delay_ioh = pa->pa_delaybah;
- pckbd_delay_ioh = ia->ia_delaybah;
-
- sc->sc_ih = isa_intr_establish(pckbd_ic, ia->ia_irq, IST_EDGE,
- IPL_TTY, pckbdintr, sc, sc->sc_dev.dv_xname);
+ sc->sc_ih = isa_intr_establish(pckbd_ic, 1, IST_EDGE, IPL_TTY,
+ pckbdintr, sc, sc->sc_dev.dv_xname);
sc->sc_bellactive = sc->sc_bellpitch = 0;
@@ -431,13 +444,13 @@ pckbdintr(arg)
u_char data;
static u_char last;
- if ((bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_DIB) == 0)
+ if ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB) == 0)
return 0;
if (polling)
return 1;
do {
KBD_DELAY;
- data = bus_space_read_1(pckbd_iot, pckbd_data_ioh, 0);
+ data = bus_space_read_1(pckbd_iot, pckbd_ioh, KBDATAP);
switch (data) {
case KBR_ACK:
@@ -456,15 +469,15 @@ pckbdintr(arg)
#endif
break;
}
- } while (bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_DIB);
+ } while (bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB);
return 1;
}
void
-do_async_update(vp)
- void *vp;
+do_async_update(v)
+ void *v;
{
- int poll = *(int *)vp;
+ u_long poll = (u_long)v;
async = 0;
@@ -489,24 +502,21 @@ do_async_update(vp)
void
async_update()
{
- static int nopoll = 0;
- static int poll = 1;
-
if (kernel || polling) {
if (async)
- untimeout(do_async_update, &nopoll);
- do_async_update(&poll);
+ untimeout(do_async_update, NULL);
+ do_async_update((void *)1);
} else {
if (async)
return;
async = 1;
- timeout(do_async_update, &nopoll, 1);
+ timeout(do_async_update, NULL, 1);
}
}
int
-pckbd_ioctl(dev, cmd, data, flag, p)
- struct device *dev;
+pckbd_ioctl(v, cmd, data, flag, p)
+ void *v;
u_long cmd;
caddr_t data;
int flag;
@@ -592,138 +602,136 @@ typedef struct {
char shift[CODE_SIZE];
char ctl[CODE_SIZE];
} Scan_def;
-
static Scan_def scan_codes[] = {
- { NONE, "", "", "" }, /* 0 unused */
- { ASCII, "\033", "\033", "\033" }, /* 1 ESCape */
- { ASCII, "1", "!", "!" }, /* 2 1 */
- { ASCII, "2", "@", "\000" }, /* 3 2 */
- { ASCII, "3", "#", "#" }, /* 4 3 */
- { ASCII, "4", "$", "$" }, /* 5 4 */
- { ASCII, "5", "%", "%" }, /* 6 5 */
- { ASCII, "6", "^", "\036" }, /* 7 6 */
- { ASCII, "7", "&", "&" }, /* 8 7 */
- { ASCII, "8", "*", "\010" }, /* 9 8 */
- { ASCII, "9", "(", "(" }, /* 10 9 */
- { ASCII, "0", ")", ")" }, /* 11 0 */
- { ASCII, "-", "_", "\037" }, /* 12 - */
- { ASCII, "=", "+", "+" }, /* 13 = */
- { ASCII, "\177", "\177", "\010" }, /* 14 backspace */
- { ASCII, "\t", "\177\t", "\t" }, /* 15 tab */
- { ASCII, "q", "Q", "\021" }, /* 16 q */
- { ASCII, "w", "W", "\027" }, /* 17 w */
- { ASCII, "e", "E", "\005" }, /* 18 e */
- { ASCII, "r", "R", "\022" }, /* 19 r */
- { ASCII, "t", "T", "\024" }, /* 20 t */
- { ASCII, "y", "Y", "\031" }, /* 21 y */
- { ASCII, "u", "U", "\025" }, /* 22 u */
- { ASCII, "i", "I", "\011" }, /* 23 i */
- { ASCII, "o", "O", "\017" }, /* 24 o */
- { ASCII, "p", "P", "\020" }, /* 25 p */
- { ASCII, "[", "{", "\033" }, /* 26 [ */
- { ASCII, "]", "}", "\035" }, /* 27 ] */
- { ASCII, "\r", "\r", "\n" }, /* 28 return */
- { CTL, "", "", "" }, /* 29 control */
- { ASCII, "a", "A", "\001" }, /* 30 a */
- { ASCII, "s", "S", "\023" }, /* 31 s */
- { ASCII, "d", "D", "\004" }, /* 32 d */
- { ASCII, "f", "F", "\006" }, /* 33 f */
- { ASCII, "g", "G", "\007" }, /* 34 g */
- { ASCII, "h", "H", "\010" }, /* 35 h */
- { ASCII, "j", "J", "\n" }, /* 36 j */
- { ASCII, "k", "K", "\013" }, /* 37 k */
- { ASCII, "l", "L", "\014" }, /* 38 l */
- { ASCII, ";", ":", ";" }, /* 39 ; */
- { ASCII, "'", "\"", "'" }, /* 40 ' */
- { ASCII, "`", "~", "`" }, /* 41 ` */
- { SHIFT, "", "", "" }, /* 42 shift */
- { ASCII, "\\", "|", "\034" }, /* 43 \ */
- { ASCII, "z", "Z", "\032" }, /* 44 z */
- { ASCII, "x", "X", "\030" }, /* 45 x */
- { ASCII, "c", "C", "\003" }, /* 46 c */
- { ASCII, "v", "V", "\026" }, /* 47 v */
- { ASCII, "b", "B", "\002" }, /* 48 b */
- { ASCII, "n", "N", "\016" }, /* 49 n */
- { ASCII, "m", "M", "\r" }, /* 50 m */
- { ASCII, ",", "<", "<" }, /* 51 , */
- { ASCII, ".", ">", ">" }, /* 52 . */
- { ASCII, "/", "?", "\037" }, /* 53 / */
- { SHIFT, "", "", "" }, /* 54 shift */
- { KP, "*", "*", "*" }, /* 55 kp * */
- { ALT, "", "", "" }, /* 56 alt */
- { ASCII, " ", " ", "\000" }, /* 57 space */
- { CAPS, "", "", "" }, /* 58 caps */
- { FUNC, "\033[M", "\033[Y", "\033[k" }, /* 59 f1 */
- { FUNC, "\033[N", "\033[Z", "\033[l" }, /* 60 f2 */
- { FUNC, "\033[O", "\033[a", "\033[m" }, /* 61 f3 */
- { FUNC, "\033[P", "\033[b", "\033[n" }, /* 62 f4 */
- { FUNC, "\033[Q", "\033[c", "\033[o" }, /* 63 f5 */
- { FUNC, "\033[R", "\033[d", "\033[p" }, /* 64 f6 */
- { FUNC, "\033[S", "\033[e", "\033[q" }, /* 65 f7 */
- { FUNC, "\033[T", "\033[f", "\033[r" }, /* 66 f8 */
- { FUNC, "\033[U", "\033[g", "\033[s" }, /* 67 f9 */
- { FUNC, "\033[V", "\033[h", "\033[t" }, /* 68 f10 */
- { NUM, "", "", "" }, /* 69 num lock */
- { SCROLL, "", "", "" }, /* 70 scroll lock */
- { KP, "7", "\033[H", "7" }, /* 71 kp 7 */
- { KP, "8", "\033[A", "8" }, /* 72 kp 8 */
- { KP, "9", "\033[I", "9" }, /* 73 kp 9 */
- { KP, "-", "-", "-" }, /* 74 kp - */
- { KP, "4", "\033[D", "4" }, /* 75 kp 4 */
- { KP, "5", "\033[E", "5" }, /* 76 kp 5 */
- { KP, "6", "\033[C", "6" }, /* 77 kp 6 */
- { KP, "+", "+", "+" }, /* 78 kp + */
- { KP, "1", "\033[F", "1" }, /* 79 kp 1 */
- { KP, "2", "\033[B", "2" }, /* 80 kp 2 */
- { KP, "3", "\033[G", "3" }, /* 81 kp 3 */
- { KP, "0", "\033[L", "0" }, /* 82 kp 0 */
- { KP, ".", "\177", "." }, /* 83 kp . */
- { NONE, "", "", "" }, /* 84 0 */
- { NONE, "100", "", "" }, /* 85 0 */
- { NONE, "101", "", "" }, /* 86 0 */
- { FUNC, "\033[W", "\033[i", "\033[u" }, /* 87 f11 */
- { FUNC, "\033[X", "\033[j", "\033[v" }, /* 88 f12 */
- { NONE, "102", "", "" }, /* 89 0 */
- { NONE, "103", "", "" }, /* 90 0 */
- { NONE, "", "", "" }, /* 91 0 */
- { NONE, "", "", "" }, /* 92 0 */
- { NONE, "", "", "" }, /* 93 0 */
- { NONE, "", "", "" }, /* 94 0 */
- { NONE, "", "", "" }, /* 95 0 */
- { NONE, "", "", "" }, /* 96 0 */
- { NONE, "", "", "" }, /* 97 0 */
- { NONE, "", "", "" }, /* 98 0 */
- { NONE, "", "", "" }, /* 99 0 */
- { NONE, "", "", "" }, /* 100 */
- { NONE, "", "", "" }, /* 101 */
- { NONE, "", "", "" }, /* 102 */
- { NONE, "", "", "" }, /* 103 */
- { NONE, "", "", "" }, /* 104 */
- { NONE, "", "", "" }, /* 105 */
- { NONE, "", "", "" }, /* 106 */
- { NONE, "", "", "" }, /* 107 */
- { NONE, "", "", "" }, /* 108 */
- { NONE, "", "", "" }, /* 109 */
- { NONE, "", "", "" }, /* 110 */
- { NONE, "", "", "" }, /* 111 */
- { NONE, "", "", "" }, /* 112 */
- { NONE, "", "", "" }, /* 113 */
- { NONE, "", "", "" }, /* 114 */
- { NONE, "", "", "" }, /* 115 */
- { NONE, "", "", "" }, /* 116 */
- { NONE, "", "", "" }, /* 117 */
- { NONE, "", "", "" }, /* 118 */
- { NONE, "", "", "" }, /* 119 */
- { NONE, "", "", "" }, /* 120 */
- { NONE, "", "", "" }, /* 121 */
- { NONE, "", "", "" }, /* 122 */
- { NONE, "", "", "" }, /* 123 */
- { NONE, "", "", "" }, /* 124 */
- { NONE, "", "", "" }, /* 125 */
- { NONE, "", "", "" }, /* 126 */
- { NONE, "", "", "" } /* 127 */
+ { NONE, "", "", "", }, /* 0 unused */
+ { ASCII, "\033", "\033", "\033", }, /* 1 ESCape */
+ { ASCII, "1", "!", "!", }, /* 2 1 */
+ { ASCII, "2", "@", "\000", }, /* 3 2 */
+ { ASCII, "3", "#", "#", }, /* 4 3 */
+ { ASCII, "4", "$", "$", }, /* 5 4 */
+ { ASCII, "5", "%", "%", }, /* 6 5 */
+ { ASCII, "6", "^", "\036", }, /* 7 6 */
+ { ASCII, "7", "&", "&", }, /* 8 7 */
+ { ASCII, "8", "*", "\010", }, /* 9 8 */
+ { ASCII, "9", "(", "(", }, /* 10 9 */
+ { ASCII, "0", ")", ")", }, /* 11 0 */
+ { ASCII, "-", "_", "\037", }, /* 12 - */
+ { ASCII, "=", "+", "+", }, /* 13 = */
+ { ASCII, "\177", "\177", "\010", }, /* 14 backspace */
+ { ASCII, "\t", "\177\t", "\t", }, /* 15 tab */
+ { ASCII, "q", "Q", "\021", }, /* 16 q */
+ { ASCII, "w", "W", "\027", }, /* 17 w */
+ { ASCII, "e", "E", "\005", }, /* 18 e */
+ { ASCII, "r", "R", "\022", }, /* 19 r */
+ { ASCII, "t", "T", "\024", }, /* 20 t */
+ { ASCII, "y", "Y", "\031", }, /* 21 y */
+ { ASCII, "u", "U", "\025", }, /* 22 u */
+ { ASCII, "i", "I", "\011", }, /* 23 i */
+ { ASCII, "o", "O", "\017", }, /* 24 o */
+ { ASCII, "p", "P", "\020", }, /* 25 p */
+ { ASCII, "[", "{", "\033", }, /* 26 [ */
+ { ASCII, "]", "}", "\035", }, /* 27 ] */
+ { ASCII, "\r", "\r", "\n", }, /* 28 return */
+ { CTL, "", "", "", }, /* 29 control */
+ { ASCII, "a", "A", "\001", }, /* 30 a */
+ { ASCII, "s", "S", "\023", }, /* 31 s */
+ { ASCII, "d", "D", "\004", }, /* 32 d */
+ { ASCII, "f", "F", "\006", }, /* 33 f */
+ { ASCII, "g", "G", "\007", }, /* 34 g */
+ { ASCII, "h", "H", "\010", }, /* 35 h */
+ { ASCII, "j", "J", "\n", }, /* 36 j */
+ { ASCII, "k", "K", "\013", }, /* 37 k */
+ { ASCII, "l", "L", "\014", }, /* 38 l */
+ { ASCII, ";", ":", ";", }, /* 39 ; */
+ { ASCII, "'", "\"", "'", }, /* 40 ' */
+ { ASCII, "`", "~", "`", }, /* 41 ` */
+ { SHIFT, "", "", "", }, /* 42 shift */
+ { ASCII, "\\", "|", "\034", }, /* 43 \ */
+ { ASCII, "z", "Z", "\032", }, /* 44 z */
+ { ASCII, "x", "X", "\030", }, /* 45 x */
+ { ASCII, "c", "C", "\003", }, /* 46 c */
+ { ASCII, "v", "V", "\026", }, /* 47 v */
+ { ASCII, "b", "B", "\002", }, /* 48 b */
+ { ASCII, "n", "N", "\016", }, /* 49 n */
+ { ASCII, "m", "M", "\r", }, /* 50 m */
+ { ASCII, ",", "<", "<", }, /* 51 , */
+ { ASCII, ".", ">", ">", }, /* 52 . */
+ { ASCII, "/", "?", "\037", }, /* 53 / */
+ { SHIFT, "", "", "", }, /* 54 shift */
+ { KP, "*", "*", "*", }, /* 55 kp * */
+ { ALT, "", "", "", }, /* 56 alt */
+ { ASCII, " ", " ", "\000", }, /* 57 space */
+ { CAPS, "", "", "", }, /* 58 caps */
+ { FUNC, "\033[M", "\033[Y", "\033[k", }, /* 59 f1 */
+ { FUNC, "\033[N", "\033[Z", "\033[l", }, /* 60 f2 */
+ { FUNC, "\033[O", "\033[a", "\033[m", }, /* 61 f3 */
+ { FUNC, "\033[P", "\033[b", "\033[n", }, /* 62 f4 */
+ { FUNC, "\033[Q", "\033[c", "\033[o", }, /* 63 f5 */
+ { FUNC, "\033[R", "\033[d", "\033[p", }, /* 64 f6 */
+ { FUNC, "\033[S", "\033[e", "\033[q", }, /* 65 f7 */
+ { FUNC, "\033[T", "\033[f", "\033[r", }, /* 66 f8 */
+ { FUNC, "\033[U", "\033[g", "\033[s", }, /* 67 f9 */
+ { FUNC, "\033[V", "\033[h", "\033[t", }, /* 68 f10 */
+ { NUM, "", "", "", }, /* 69 num lock */
+ { SCROLL, "", "", "", }, /* 70 scroll lock */
+ { KP, "7", "\033[H", "7", }, /* 71 kp 7 */
+ { KP, "8", "\033[A", "8", }, /* 72 kp 8 */
+ { KP, "9", "\033[I", "9", }, /* 73 kp 9 */
+ { KP, "-", "-", "-", }, /* 74 kp - */
+ { KP, "4", "\033[D", "4", }, /* 75 kp 4 */
+ { KP, "5", "\033[E", "5", }, /* 76 kp 5 */
+ { KP, "6", "\033[C", "6", }, /* 77 kp 6 */
+ { KP, "+", "+", "+", }, /* 78 kp + */
+ { KP, "1", "\033[F", "1", }, /* 79 kp 1 */
+ { KP, "2", "\033[B", "2", }, /* 80 kp 2 */
+ { KP, "3", "\033[G", "3", }, /* 81 kp 3 */
+ { KP, "0", "\033[L", "0", }, /* 82 kp 0 */
+ { KP, ".", "\177", ".", }, /* 83 kp . */
+ { NONE, "", "", "", }, /* 84 0 */
+ { NONE, "100", "", "", }, /* 85 0 */
+ { NONE, "101", "", "", }, /* 86 0 */
+ { FUNC, "\033[W", "\033[i", "\033[u", }, /* 87 f11 */
+ { FUNC, "\033[X", "\033[j", "\033[v", }, /* 88 f12 */
+ { NONE, "102", "", "", }, /* 89 0 */
+ { NONE, "103", "", "", }, /* 90 0 */
+ { NONE, "", "", "", }, /* 91 0 */
+ { NONE, "", "", "", }, /* 92 0 */
+ { NONE, "", "", "", }, /* 93 0 */
+ { NONE, "", "", "", }, /* 94 0 */
+ { NONE, "", "", "", }, /* 95 0 */
+ { NONE, "", "", "", }, /* 96 0 */
+ { NONE, "", "", "", }, /* 97 0 */
+ { NONE, "", "", "", }, /* 98 0 */
+ { NONE, "", "", "", }, /* 99 0 */
+ { NONE, "", "", "", }, /* 100 */
+ { NONE, "", "", "", }, /* 101 */
+ { NONE, "", "", "", }, /* 102 */
+ { NONE, "", "", "", }, /* 103 */
+ { NONE, "", "", "", }, /* 104 */
+ { NONE, "", "", "", }, /* 105 */
+ { NONE, "", "", "", }, /* 106 */
+ { NONE, "", "", "", }, /* 107 */
+ { NONE, "", "", "", }, /* 108 */
+ { NONE, "", "", "", }, /* 109 */
+ { NONE, "", "", "", }, /* 110 */
+ { NONE, "", "", "", }, /* 111 */
+ { NONE, "", "", "", }, /* 112 */
+ { NONE, "", "", "", }, /* 113 */
+ { NONE, "", "", "", }, /* 114 */
+ { NONE, "", "", "", }, /* 115 */
+ { NONE, "", "", "", }, /* 116 */
+ { NONE, "", "", "", }, /* 117 */
+ { NONE, "", "", "", }, /* 118 */
+ { NONE, "", "", "", }, /* 119 */
+ { NONE, "", "", "", }, /* 120 */
+ { NONE, "", "", "", }, /* 121 */
+ { NONE, "", "", "", }, /* 122 */
+ { NONE, "", "", "", }, /* 123 */
+ { NONE, "", "", "", }, /* 124 */
+ { NONE, "", "", "", }, /* 125 */
+ { NONE, "", "", "", }, /* 126 */
+ { NONE, "", "", "", }, /* 127 */
};
-
/*
* Get characters from the keyboard. If none are present, return NULL.
*/
@@ -863,18 +871,18 @@ int
pckbd_cngetc(dev)
struct device *dev;
{
- register char *cp;
+ register char *cp = NULL;
u_char data;
static u_char last;
do {
/* wait for byte */
- while ((bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_DIB)
+ while ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB)
== 0)
KBD_DELAY;
KBD_DELAY;
- data = bus_space_read_1(pckbd_iot, pckbd_data_ioh, 0);
+ data = bus_space_read_1(pckbd_iot, pckbd_ioh, KBDATAP);
if (data == KBR_ACK) {
ack = 1;
@@ -953,8 +961,8 @@ pckbd_bell(dev, wbd)
bus_space_write_1(pckbd_iot, pckbd_timer_ioh, TIMER_CNTR2,
TIMER_DIV(pitch) / 256);
/* enable speaker */
- bus_space_write_1(pckbd_iot, pckbd_pitaux_ioh, 0,
- bus_space_read_1(pckbd_iot, pckbd_pitaux_ioh, 0) |
+ bus_space_write_1(pckbd_iot, pckbd_ioh, PITAUX_PORT,
+ bus_space_read_1(pckbd_iot, pckbd_ioh, PITAUX_PORT) |
PIT_SPKR);
splx(s);
}
@@ -972,8 +980,8 @@ pckbd_bell_stop(arg)
/* disable bell */
s = splhigh();
- bus_space_write_1(pckbd_iot, pckbd_pitaux_ioh, 0,
- bus_space_read_1(pckbd_iot, pckbd_pitaux_ioh, 0) & ~PIT_SPKR);
+ bus_space_write_1(pckbd_iot, pckbd_ioh, PITAUX_PORT,
+ bus_space_read_1(pckbd_iot, pckbd_ioh, PITAUX_PORT) & ~PIT_SPKR);
sc->sc_bellactive = 0;
splx(s);
}
diff --git a/sys/arch/alpha/isa/pcppi.c b/sys/arch/alpha/isa/pcppi.c
new file mode 100644
index 00000000000..e00b4d24118
--- /dev/null
+++ b/sys/arch/alpha/isa/pcppi.c
@@ -0,0 +1,194 @@
+/* $NetBSD: pcppi.c,v 1.3 1996/12/05 01:39:31 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 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/device.h>
+#include <sys/malloc.h>
+
+#include <machine/bus.h>
+
+#include <dev/isa/isareg.h>
+#include <dev/isa/isavar.h>
+#include <alpha/isa/pcppivar.h>
+
+struct pcppi_softc {
+ struct device sc_dv;
+
+ bus_space_tag_t sc_iot;
+ bus_space_handle_t sc_pit1_ioh, sc_ppi_ioh;
+};
+
+#ifdef __BROKEN_INDIRECT_CONFIG
+int pcppi_match __P((struct device *, void *, void *));
+#else
+int pcppi_match __P((struct device *, struct cfdata *, void *));
+#endif
+void pcppi_attach __P((struct device *, struct device *, void *));
+
+struct cfattach pcppi_ca = {
+ sizeof(struct pcppi_softc), pcppi_match, pcppi_attach,
+};
+
+struct cfdriver pcppi_cd = {
+ NULL, "pcppi", DV_DULL,
+};
+
+int pcppiprint __P((void *, const char *));
+
+int
+pcppi_match(parent, match, aux)
+ struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
+{
+ struct isa_attach_args *ia = aux;
+ bus_space_handle_t ppi_ioh, pit1_ioh;
+ int have_pit1, have_ppi, rv;
+ u_int8_t v, nv;
+
+ /* If values are hardwired to something that they can't be, punt. */
+ if (ia->ia_iobase != IOBASEUNK || /* ia->ia_iosize != 0 || XXX isa.c */
+ ia->ia_maddr != MADDRUNK || ia->ia_msize != 0 ||
+ ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK)
+ return (0);
+
+ rv = 0;
+ have_pit1 = have_ppi = 0;
+
+ if (bus_space_map(ia->ia_iot, 0x40, 4, 0, &pit1_ioh)) /* XXX */
+ goto lose;
+ have_pit1 = 1;
+ if (bus_space_map(ia->ia_iot, 0x60, 4, 0, &ppi_ioh)) /* XXX */
+ goto lose;
+ have_ppi = 1;
+
+ /*
+ * Check for existence of PPI. Realistically, this is either going to
+ * be here or nothing is going to be here.
+ *
+ * We don't want to have any chance of changing speaker output (which
+ * this test might, if it crashes in the middle, or something;
+ * normally it's be to quick to produce anthing audible), but
+ * many "combo chip" mock-PPI's don't seem to support the top bit
+ * of Port B as a settable bit. The bottom bit has to be settable,
+ * since the speaker driver hardware still uses it.
+ */
+ v = bus_space_read_1(ia->ia_iot, ppi_ioh, 1); /* XXX */
+ bus_space_write_1(ia->ia_iot, ppi_ioh, 1, v ^ 0x01); /* XXX */
+ nv = bus_space_read_1(ia->ia_iot, ppi_ioh, 1); /* XXX */
+ if (((nv ^ v) & 0x01) == 0x01)
+ rv = 1;
+ bus_space_write_1(ia->ia_iot, ppi_ioh, 1, v); /* XXX */
+ nv = bus_space_read_1(ia->ia_iot, ppi_ioh, 1); /* XXX */
+ if (((nv ^ v) & 0x01) != 0x00)
+ rv = 0;
+
+ /*
+ * We assume that the programmable interval timer is there.
+ */
+
+lose:
+ if (have_pit1)
+ bus_space_unmap(ia->ia_iot, pit1_ioh, 4);
+ if (have_ppi)
+ bus_space_unmap(ia->ia_iot, ppi_ioh, 4);
+ if (rv) {
+ ia->ia_iobase = 0x60;
+ ia->ia_iosize = 0x5;
+ ia->ia_msize = 0x0;
+ }
+ return (rv);
+}
+
+void
+pcppi_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct pcppi_softc *sc = (struct pcppi_softc *)self;
+ struct isa_attach_args *ia = aux;
+ struct pcppi_attach_args pa;
+ bus_space_tag_t iot;
+
+ sc->sc_iot = iot = ia->ia_iot;
+ if (bus_space_map(iot, 0x40, 4, 0, &sc->sc_pit1_ioh) || /*XXX*/
+ bus_space_map(iot, 0x60, 5, 0, &sc->sc_ppi_ioh)) /*XXX*/
+ panic("pcppi_attach: couldn't map");
+
+ printf("\n");
+
+ pa.pa_slot = PCPPI_KBD_SLOT;
+ pa.pa_iot = iot; /* XXX */
+ pa.pa_ioh = sc->sc_ppi_ioh; /* XXX */
+ pa.pa_pit_ioh = sc->sc_pit1_ioh; /* XXX */
+ pa.pa_delaybah = ia->ia_delaybah; /* XXX */
+ pa.pa_ic = ia->ia_ic; /* XXX */
+ config_found(self, &pa, pcppiprint);
+
+ /* XXX SHOULD ONLY ATTACH IF SOMETHING IS THERE */
+ pa.pa_slot = PCPPI_AUX_SLOT;
+ pa.pa_iot = iot; /* XXX */
+ pa.pa_ioh = sc->sc_ppi_ioh; /* XXX */
+ pa.pa_pit_ioh = sc->sc_pit1_ioh; /* XXX */
+ pa.pa_delaybah = ia->ia_delaybah; /* XXX */
+ pa.pa_ic = ia->ia_ic; /* XXX */
+ config_found(self, &pa, pcppiprint);
+}
+
+int
+pcppiprint(aux, pnp)
+ void *aux;
+ const char *pnp;
+{
+ struct pcppi_attach_args *pa = aux;
+ const char *type;
+
+ switch (pa->pa_slot) {
+ case PCPPI_KBD_SLOT:
+ type = "pckbd";
+ break;
+ case PCPPI_AUX_SLOT:
+ type = "pms";
+ /* XXX XXX XXX should make sure it's there before configuring */
+ return (QUIET);
+ break;
+ default:
+ panic("pcppiprint: bad slot");
+ }
+
+ if (pnp)
+ printf("%s at %s", type, pnp);
+ return (UNCONF);
+}
diff --git a/sys/arch/alpha/isa/pcppivar.h b/sys/arch/alpha/isa/pcppivar.h
new file mode 100644
index 00000000000..3d87996776e
--- /dev/null
+++ b/sys/arch/alpha/isa/pcppivar.h
@@ -0,0 +1,44 @@
+/* $NetBSD: pcppivar.h,v 1.1 1996/11/25 03:26:37 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 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 pcppi_attach_args {
+ unsigned int pa_slot;
+ /* XXX should have a device type number */
+ /* XXX should have a cookie to be passed to callbacks */
+
+ /* XXX THESE DO NOT BELONG */
+ bus_space_tag_t pa_iot;
+ bus_space_handle_t pa_ioh;
+ bus_space_handle_t pa_pit_ioh;
+ bus_space_handle_t pa_delaybah;
+ isa_chipset_tag_t pa_ic;
+};
+
+#define PCPPI_KBD_SLOT 0
+#define PCPPI_AUX_SLOT 1
diff --git a/sys/arch/alpha/isa/pms.c b/sys/arch/alpha/isa/pms.c
index abeb21fc768..a011a2a0022 100644
--- a/sys/arch/alpha/isa/pms.c
+++ b/sys/arch/alpha/isa/pms.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pms.c,v 1.4 1996/12/08 00:20:29 niklas Exp $ */
-/* $NetBSD: pms.c,v 1.4 1996/10/23 04:12:21 cgd Exp $ */
+/* $OpenBSD: pms.c,v 1.5 1997/01/24 19:57:28 niklas Exp $ */
+/* $NetBSD: pms.c,v 1.7 1996/12/05 01:39:31 cgd Exp $ */
/*-
* Copyright (c) 1994 Charles Hannum.
@@ -32,15 +32,11 @@
* may result in dropped characters and/or corrupted mouse events.
*/
-#include "pms.h"
-#if NPMS > 1
-#error Only one PS/2 style mouse may be configured into your system.
-#endif
-
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/buf.h>
+#include <sys/conf.h>
#include <sys/malloc.h>
#include <sys/ioctl.h>
#include <sys/tty.h>
@@ -54,10 +50,11 @@
#include <dev/isa/isavar.h>
#include <alpha/wscons/wsconsvar.h>
#include <alpha/wscons/ms.h>
+#include <alpha/isa/pcppivar.h>
-#define PMS_DATA 0x60 /* offset for data port, read-write */
-#define PMS_CNTRL 0x64 /* offset for control port, write-only */
-#define PMS_STATUS 0x64 /* offset for status port, read-only */
+#define PMS_DATA 0x0 /* offset for data port, read-write */
+#define PMS_CNTRL 0x4 /* offset for control port, write-only */
+#define PMS_STATUS 0x4 /* offset for status port, read-only */
#define PMS_NPORTS 8
/* status bits */
@@ -100,12 +97,14 @@ struct pms_softc { /* driver status information */
};
bus_space_tag_t pms_iot;
+bus_space_handle_t pms_ioh;
isa_chipset_tag_t pms_ic;
-bus_space_handle_t pms_cntrl_ioh;
-#define pms_status_ioh pms_cntrl_ioh
-bus_space_handle_t pms_data_ioh;
+#ifdef __BROKEN_INDIRECT_CONFIG
int pmsprobe __P((struct device *, void *, void *));
+#else
+int pmsprobe __P((struct device *, struct cfdata *, void *));
+#endif
void pmsattach __P((struct device *, struct device *, void *));
int pmsintr __P((void *));
@@ -137,12 +136,13 @@ pms_flush()
{
u_char c;
- while ((c = bus_space_read_1(pms_iot, pms_status_ioh, 0) & 0x03) != 0)
+ while ((c = bus_space_read_1(pms_iot, pms_ioh, PMS_STATUS) & 0x03) !=
+ 0)
if ((c & PMS_OBUF_FULL) == PMS_OBUF_FULL) {
/* XXX - delay is needed to prevent some keyboards from
wedging when the system boots */
delay(6);
- (void) bus_space_read_1(pms_iot, pms_data_ioh, 0);
+ (void) bus_space_read_1(pms_iot, pms_ioh, PMS_DATA);
}
}
@@ -152,9 +152,9 @@ pms_dev_cmd(value)
{
pms_flush();
- bus_space_write_1(pms_iot, pms_cntrl_ioh, 0, 0xd4);
+ bus_space_write_1(pms_iot, pms_ioh, PMS_CNTRL, 0xd4);
pms_flush();
- bus_space_write_1(pms_iot, pms_data_ioh, 0, value);
+ bus_space_write_1(pms_iot, pms_ioh, PMS_DATA, value);
}
static __inline void
@@ -163,7 +163,7 @@ pms_aux_cmd(value)
{
pms_flush();
- bus_space_write_1(pms_iot, pms_cntrl_ioh, 0, value);
+ bus_space_write_1(pms_iot, pms_ioh, PMS_CNTRL, value);
}
static __inline void
@@ -172,38 +172,38 @@ pms_pit_cmd(value)
{
pms_flush();
- bus_space_write_1(pms_iot, pms_cntrl_ioh, 0, 0x60);
+ bus_space_write_1(pms_iot, pms_ioh, PMS_CNTRL, 0x60);
pms_flush();
- bus_space_write_1(pms_iot, pms_data_ioh, 0, value);
+ bus_space_write_1(pms_iot, pms_ioh, PMS_DATA, value);
}
int
pmsprobe(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
- struct isa_attach_args *ia = aux;
+ struct pcppi_attach_args *pa = aux;
u_char x;
- pms_iot = ia->ia_iot;
-
- if (ia->ia_iobase != 0x60)
+ if (pa->pa_slot != PCPPI_AUX_SLOT)
return 0;
- if (bus_space_map(pms_iot, PMS_DATA, 1, 0, &pms_data_ioh) ||
- bus_space_map(pms_iot, PMS_CNTRL, 1, 0, &pms_cntrl_ioh))
- return 0;
+ pms_iot = pa->pa_iot;
+ pms_ioh = pa->pa_ioh;
pms_dev_cmd(PMS_RESET);
pms_aux_cmd(PMS_AUX_TEST);
delay(1000);
- x = bus_space_read_1(pms_iot, pms_data_ioh, 0);
+ x = bus_space_read_1(pms_iot, pms_ioh, PMS_DATA);
pms_pit_cmd(PMS_INT_DISABLE);
if (x & 0x04)
return 0;
- ia->ia_iosize = PMS_NPORTS;
- ia->ia_msize = 0;
return 1;
}
@@ -213,16 +213,11 @@ pmsattach(parent, self, aux)
void *aux;
{
struct pms_softc *sc = (void *)self;
- struct isa_attach_args *ia = aux;
+ struct pcppi_attach_args *pa = aux;
- pms_iot = ia->ia_iot;
- pms_ic = ia->ia_ic;
-
- if (bus_space_map(pms_iot, PMS_DATA, 1, 0, &pms_data_ioh) ||
- bus_space_map(pms_iot, PMS_CNTRL, 1, 0, &pms_cntrl_ioh)) {
- printf(": can't map I/O ports!\n");
- return;
- }
+ pms_iot = pa->pa_iot;
+ pms_ioh = pa->pa_ioh;
+ pms_ic = pa->pa_ic;
msattach(self, &pms_mdev_spec);
@@ -231,8 +226,8 @@ pmsattach(parent, self, aux)
/* Other initialization was done by pmsprobe. */
sc->sc_state = 0;
- sc->sc_ih = isa_intr_establish(pms_ic, ia->ia_irq, IST_EDGE, IPL_TTY,
- pmsintr, sc, sc->sc_dev.dv_xname);
+ sc->sc_ih = isa_intr_establish(pms_ic, 12, IST_EDGE, IPL_TTY, pmsintr,
+ sc, sc->sc_dev.dv_xname);
}
int
@@ -304,20 +299,20 @@ pmsintr(arg)
switch (state) {
case 0:
- buttons = bus_space_read_1(pms_iot, pms_data_ioh, 0);
+ buttons = bus_space_read_1(pms_iot, pms_ioh, PMS_DATA);
if ((buttons & 0xc0) == 0)
++state;
break;
case 1:
- dx = bus_space_read_1(pms_iot, pms_data_ioh, 0);
+ dx = bus_space_read_1(pms_iot, pms_ioh, PMS_DATA);
/* Bounding at -127 avoids a bug in XFree86. */
dx = (dx == -128) ? -127 : dx;
++state;
break;
case 2:
- dy = bus_space_read_1(pms_iot, pms_data_ioh, 0);
+ dy = bus_space_read_1(pms_iot, pms_ioh, PMS_DATA);
dy = (dy == -128) ? -127 : dy;
state = 0;
diff --git a/sys/arch/alpha/isa/vga_isa.c b/sys/arch/alpha/isa/vga_isa.c
new file mode 100644
index 00000000000..615f16590a5
--- /dev/null
+++ b/sys/arch/alpha/isa/vga_isa.c
@@ -0,0 +1,145 @@
+/* $NetBSD: vga_isa.c,v 1.4 1996/12/05 01:39:32 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 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/device.h>
+#include <sys/malloc.h>
+
+#include <machine/autoconf.h>
+#include <machine/pte.h>
+
+#include <dev/isa/isavar.h>
+
+#include <alpha/common/vgavar.h>
+#include <alpha/isa/vga_isavar.h>
+
+struct vga_isa_softc {
+ struct device sc_dev;
+
+ struct vga_config *sc_vc; /* VGA configuration */
+};
+
+#ifdef __BROKEN_INDIRECT_CONFIG
+int vga_isa_match __P((struct device *, void *, void *));
+#else
+int vga_isa_match __P((struct device *, struct cfdata *, void *));
+#endif
+void vga_isa_attach __P((struct device *, struct device *, void *));
+
+struct cfattach vga_isa_ca = {
+ sizeof(struct vga_isa_softc), vga_isa_match, vga_isa_attach,
+};
+
+int vga_isa_console_tag; /* really just a boolean. */
+struct vga_config vga_isa_console_vc;
+
+int
+vga_isa_match(parent, match, aux)
+ struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
+{
+ struct isa_attach_args *ia = aux;
+ int rv;
+
+ /* If values are hardwired to something that they can't be, punt. */
+ if (ia->ia_iobase != IOBASEUNK || /* ia->ia_iosize != 0 || XXX isa.c */
+ (ia->ia_maddr != MADDRUNK && ia->ia_maddr != 0xb8000) ||
+ (ia->ia_msize != 0 && ia->ia_msize != 0x8000) ||
+ ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK)
+ return (0);
+
+ if (vga_isa_console_tag)
+ return (1);
+
+ rv = vga_common_probe(ia->ia_iot, ia->ia_memt);
+
+ if (rv) {
+ ia->ia_iobase = 0x3b0;
+ ia->ia_iosize = 0x30;
+ ia->ia_maddr = 0xb8000;
+ ia->ia_msize = 0x8000;
+ }
+ return (rv);
+}
+
+void
+vga_isa_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct isa_attach_args *ia = aux;
+ struct vga_isa_softc *sc = (struct vga_isa_softc *)self;
+ struct vga_config *vc;
+ int console;
+
+ console = vga_isa_console_tag;
+ if (console)
+ vc = sc->sc_vc = &vga_isa_console_vc;
+ else {
+ vc = sc->sc_vc = (struct vga_config *)
+ malloc(sizeof(struct vga_config), M_DEVBUF, M_WAITOK);
+
+ /* set up bus-independent VGA configuration */
+ vga_common_setup(ia->ia_iot, ia->ia_memt, vc);
+ }
+
+ printf("\n");
+
+ vga_wscons_attach(self, vc, console);
+}
+
+int
+vga_isa_console_match(iot, memt)
+ bus_space_tag_t iot, memt;
+{
+
+ return (vga_common_probe(iot, memt));
+}
+
+void
+vga_isa_console_attach(iot, memt)
+ bus_space_tag_t iot, memt;
+{
+ struct vga_config *vc = &vga_isa_console_vc;
+
+ /* for later recognition */
+ vga_isa_console_tag = 1;
+
+ /* set up bus-independent VGA configuration */
+ vga_common_setup(iot, memt, vc);
+
+ vga_wscons_console(vc);
+}
diff --git a/sys/arch/alpha/isa/vga_isavar.h b/sys/arch/alpha/isa/vga_isavar.h
new file mode 100644
index 00000000000..618eb26b51b
--- /dev/null
+++ b/sys/arch/alpha/isa/vga_isavar.h
@@ -0,0 +1,31 @@
+/* $NetBSD: vga_isavar.h,v 1.2 1996/11/23 06:06:45 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 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.
+ */
+
+int vga_isa_console_match __P((bus_space_tag_t, bus_space_tag_t));
+void vga_isa_console_attach __P((bus_space_tag_t, bus_space_tag_t));