summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/powerpc/conf/files.powerpc20
-rw-r--r--sys/arch/powerpc/include/kbio.h118
-rw-r--r--sys/arch/powerpc/include/vuid_event.h88
-rw-r--r--sys/arch/powerpc/include/wsconsio.h62
-rw-r--r--sys/arch/powerpc/isa/pckbd.c1005
-rw-r--r--sys/arch/powerpc/isa/pckbdreg.h29
-rw-r--r--sys/arch/powerpc/isa/pcppi.c195
-rw-r--r--sys/arch/powerpc/isa/pcppivar.h45
-rw-r--r--sys/arch/powerpc/isa/pms.c330
-rw-r--r--sys/arch/powerpc/isa/spkrreg.h12
-rw-r--r--sys/arch/powerpc/isa/timerreg.h101
-rw-r--r--sys/arch/powerpc/powerpc/conf.c22
-rw-r--r--sys/arch/powerpc/powerpc/machdep.c53
-rw-r--r--sys/arch/powerpc/powerpc/ofw_machdep.c22
-rw-r--r--sys/conf/files7
-rw-r--r--sys/dev/ic/font_8x16.c556
-rw-r--r--sys/dev/ic/vgafb.c530
-rw-r--r--sys/dev/ic/vgafbvar.h61
-rw-r--r--sys/dev/pci/files.pci6
-rw-r--r--sys/dev/pci/vgafb_pci.c301
-rw-r--r--sys/dev/pci/vgafb_pcivar.h38
21 files changed, 3591 insertions, 10 deletions
diff --git a/sys/arch/powerpc/conf/files.powerpc b/sys/arch/powerpc/conf/files.powerpc
index 87a72a67e36..2ecab544e20 100644
--- a/sys/arch/powerpc/conf/files.powerpc
+++ b/sys/arch/powerpc/conf/files.powerpc
@@ -84,5 +84,23 @@ define pcmcia {} # XXX dummy decl...
include "../../../dev/isa/files.isa"
major { wd = 5 } # Not even in bdevsw XXX
+device pcppi { }
+attach pcppi at isa
+file arch/powerpc/isa/pcppi.c pcppi
+
+device pckbd
+attach pckbd at pcppi
+file arch/powerpc/isa/pckbd.c pckbd
+
+device pms
+attach pms at pcppi
+file arch/powerpc/isa/pms.c pms
+
include "../../../dev/isa/files.isapnp"
-file arch/arc/isa/isapnp_machdep.c isapnp
+file arch/powerpc/isa/isapnp_machdep.c isapnp
+
+#
+# "wprkstation cpnsole" routines
+#
+
+include "dev/wscons/files.wscons"
diff --git a/sys/arch/powerpc/include/kbio.h b/sys/arch/powerpc/include/kbio.h
new file mode 100644
index 00000000000..d6a3e38edf2
--- /dev/null
+++ b/sys/arch/powerpc/include/kbio.h
@@ -0,0 +1,118 @@
+/* $OpenBSD: kbio.h,v 1.1 1998/09/27 03:55:57 rahnds Exp $ */
+/* $NetBSD: kbio.h,v 1.1 1996/04/12 01:45:45 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * 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, Lawrence Berkeley Laboratory.
+ *
+ * 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.
+ *
+ * @(#)kbio.h 8.1 (Berkeley) 6/11/93
+ */
+
+#if 0 /* XXX */
+/*
+ * The following is a minimal emulation of Sun's `kio' structures
+ * and related operations necessary to make X11 happy (i.e., make it
+ * compile, and make old X11 binaries run).
+ */
+
+/*
+ * The kiockey structure apparently gets and/or sets keyboard mappings.
+ * It seems to be kind of useless, but X11 uses it (according to the
+ * comments) to figure out when a Sun 386i has a type-4 keyboard but
+ * claims to have a type-3 keyboard. We need just enough to cause the
+ * appropriate ioctl to return the appropriate magic value.
+ *
+ * KIOCGETKEY fills in kio_entry from kio_station. Not sure what tablemask
+ * is for; X sets it before the call, so it is not an output, but we do not
+ * care anyway. KIOCSDIRECT is supposed to tell the kernel whether to send
+ * keys to the console or to X; we just send them to X whenever the keyboard
+ * is open at all. (XXX may need to change this later)
+ *
+ * Keyboard commands and types are defined in kbd.h as they are actually
+ * real hardware commands and type numbers.
+ */
+struct okiockey { /* Out-dated key translation structure */
+ int kio_tablemask; /* whatever */
+ u_char kio_station; /* key number */
+ u_char kio_entry; /* HOLE if not present */
+ char kio_text[10]; /* the silly escape sequences (unsupported) */
+};
+
+struct kiockey {
+ int kio_tablemask; /* whatever */
+ u_char kio_station; /* key number */
+ u_short kio_entry; /* HOLE if not present */
+ char kio_text[10]; /* the silly escape sequences (unsupported) */
+};
+
+/*
+ * Values for kio_tablemask. These determine which table to read/modify
+ * in KIOC[SG]KEY ioctls. Currently, we only have "non-shift" and "shift"
+ * tables.
+ */
+#define KIOC_NOMASK 0x0
+#define KIOC_CAPSMASK 0x1
+#define KIOC_SHIFTMASK 0xe
+#define KIOC_CTRLMASK 0x30
+#define KIOC_ALTGMASK 0x200
+#define KIOC_NUMLMASK 0x800
+
+#define HOLE 0x302 /* value for kio_entry to say `really type 3' */
+
+#define KIOCTRANS _IOW('k', 0, int) /* set translation mode */
+ /* (we only accept TR_UNTRANS_EVENT) */
+#define KIOCGETKEY _IOWR('k', 2, struct okiockey) /* fill in kio_entry */
+#define KIOCGTRANS _IOR('k', 5, int) /* get translation mode */
+#define KIOCCMD _IOW('k', 8, int) /* X uses this to ring bell */
+#define KIOCTYPE _IOR('k', 9, int) /* get keyboard type */
+#endif /* 0 XXX */
+#define KIOCSDIRECT _IOW('k', 10, int) /* keys to console? */
+#if 0 /* XXX */
+#define KIOCSKEY _IOW('k', 12, struct kiockey) /* set xlat mode */
+#define KIOCGKEY _IOWR('k', 13, struct kiockey) /* get xlat mode */
+#define KIOCLAYOUT _IOR('k', 20, int) /* get keyboard layout */
+#define KIOCSLED _IOW('k', 14, char) /* set LED state */
+#define KIOCGLED _IOR('k', 15, char) /* get LED state */
+
+#define TR_NONE 0 /* X compat, unsupported */
+#define TR_ASCII 1 /* X compat, unsupported */
+#define TR_EVENT 2 /* X compat, unsupported */
+#define TR_UNTRANS_EVENT 3
+#endif /* 0 XXX */
diff --git a/sys/arch/powerpc/include/vuid_event.h b/sys/arch/powerpc/include/vuid_event.h
new file mode 100644
index 00000000000..21576cf8e26
--- /dev/null
+++ b/sys/arch/powerpc/include/vuid_event.h
@@ -0,0 +1,88 @@
+/* $OpenBSD: vuid_event.h,v 1.1 1998/09/27 03:55:57 rahnds Exp $ */
+/* $NetBSD: vuid_event.h,v 1.1 1996/04/12 01:45:47 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * 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, Lawrence Berkeley Laboratory.
+ *
+ * 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.
+ *
+ * @(#)vuid_event.h 8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * The following is a minimal emulation of Sun's `Firm_event' structures
+ * and related operations necessary to make X11 happy (i.e., make it
+ * compile, and make old X11 binaries run).
+ */
+typedef struct firm_event {
+ u_short id; /* key or MS_* or LOC_[XY]_DELTA */
+ u_short pad; /* unused, at least by X11 */
+ int value; /* VKEY_{UP,DOWN} or locator delta */
+ struct timeval time;
+} Firm_event;
+
+/*
+ * Special `id' fields. These weird numbers simply match the old binaries.
+ * Others are in 0..0x7f and are keyboard key numbers (keyboard dependent!).
+ */
+#define MS_LEFT 0x7f20 /* left mouse button */
+#define MS_MIDDLE 0x7f21 /* middle mouse button */
+#define MS_RIGHT 0x7f22 /* right mouse button */
+#define LOC_X_DELTA 0x7f80 /* mouse delta-X */
+#define LOC_Y_DELTA 0x7f81 /* mouse delta-Y */
+#define LOC_X_ABSOLUTE 0x7f82 /* X compat, unsupported */
+#define LOC_Y_ABSOLUTE 0x7f83 /* X compat, unsupported */
+
+/*
+ * Special `value' fields. These apply to keys and mouse buttons. The
+ * value of a mouse delta is the delta. Note that positive deltas are
+ * left and up (not left and down as you might expect).
+ */
+#define VKEY_UP 0 /* key or button went up */
+#define VKEY_DOWN 1 /* key or button went down */
+
+/*
+ * The following ioctls are clearly intended to take things in and out
+ * of `firm event' mode. Since we always run in this mode (as far as
+ * /dev/kbd and /dev/mouse are concerned, anyway), we always claim to
+ * be in this mode and reject anything else.
+ */
+#define VUIDSFORMAT _IOW('v', 1, int)
+#define VUIDGFORMAT _IOR('v', 2, int)
+#define VUID_FIRM_EVENT 1 /* the only format we support */
diff --git a/sys/arch/powerpc/include/wsconsio.h b/sys/arch/powerpc/include/wsconsio.h
new file mode 100644
index 00000000000..9fe9ba4c58d
--- /dev/null
+++ b/sys/arch/powerpc/include/wsconsio.h
@@ -0,0 +1,62 @@
+/* $OpenBSD: wsconsio.h,v 1.1 1998/09/27 03:55:57 rahnds Exp $ */
+/* $NetBSD: wsconsio.h,v 1.1 1996/04/12 01:43:06 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.
+ */
+
+/*
+ * Get keyboard type. Keyboard type definitions are below.
+ */
+#define WSCONSIO_KBD_GTYPE _IOR('W',100,int)
+#define KBD_TYPE_LK201 0 /* lk-201 */
+#define KBD_TYPE_LK401 1 /* lk-401 */
+#define KBD_TYPE_PC 2 /* pc-like */
+
+/*
+ * If arg is one, don't process scancodes into characters
+ */
+#define WSCONSIO_KBD_SCANCODES _IO('W',101,int)
+
+/*
+ * Bell ioctls.
+ */
+
+struct wsconsio_bell_data {
+ int wbd_flags;
+ int wbd_pitch; /* pitch, in Hz. */
+ int wbd_period; /* period, in milliseconds. */
+ int wbd_volume; /* percentage of maximum volume. */
+};
+
+#define WSCONSIO_BELLDATA_PITCH 0x01 /* pitch data present */
+#define WSCONSIO_BELLDATA_PERIOD 0x02 /* period data present */
+#define WSCONSIO_BELLDATA_VOLUME 0x04 /* volume data present */
+
+#define WSCONSIO_BELL _IO('W',102)
+#define WSCONSIO_COMPLEXBELL _IOW('W',103,struct wsconsio_bell_data)
+#define WSCONSIO_SETBELL _IOW('W',104,struct wsconsio_bell_data)
+#define WSCONSIO_GETBELL _IOR('W',105,struct wsconsio_bell_data)
diff --git a/sys/arch/powerpc/isa/pckbd.c b/sys/arch/powerpc/isa/pckbd.c
new file mode 100644
index 00000000000..d1ae14b6396
--- /dev/null
+++ b/sys/arch/powerpc/isa/pckbd.c
@@ -0,0 +1,1005 @@
+/* $OpenBSD: pckbd.c,v 1.1 1998/09/27 03:55:58 rahnds 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.
+ * 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 and Don Ahn.
+ *
+ * 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.
+ *
+ * @(#)pccons.c 5.11 (Berkeley) 5/21/91
+ */
+
+/*
+ * code to work keyboard & display for PC-style console
+ */
+
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/ioctl.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#ifdef DDB
+#include <ddb/db_var.h>
+#endif
+
+#include <machine/intr.h>
+#include <machine/bus.h>
+
+#include <dev/isa/isareg.h>
+#include <dev/isa/isavar.h>
+#include <powerpc/isa/pckbdreg.h>
+#include <powerpc/isa/spkrreg.h>
+#include <powerpc/isa/timerreg.h>
+#include <machine/wsconsio.h>
+#include <powerpc/isa/pcppivar.h>
+
+#include <dev/wscons/wsconsvar.h>
+#include <dev/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 */
+ old_lock_state = 0xff,
+ typematic_rate = 0xff, /* don't update until set by user */
+ old_typematic_rate = 0xff;
+
+bus_space_tag_t pckbd_iot;
+isa_chipset_tag_t pckbd_ic;
+
+bus_space_handle_t pckbd_ioh;
+bus_space_handle_t pckbd_timer_ioh;
+bus_space_handle_t pckbd_delay_ioh;
+
+struct pckbd_softc {
+ struct device sc_dev;
+ void *sc_ih;
+
+ int sc_bellactive; /* is the bell active? */
+ 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 *));
+
+struct cfattach pckbd_ca = {
+ sizeof(struct pckbd_softc), pckbdprobe, pckbdattach,
+};
+
+struct cfdriver pckbd_cd = {
+ NULL, "pckbd", DV_DULL,
+};
+
+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((void *, u_long, caddr_t, int,
+ struct proc *));
+char *pckbd_translate __P((struct device *dev, int c));
+
+#if NWSCONS
+struct wscons_idev_spec pckbd_wscons_idev = {
+ pckbd_cngetc,
+ pckbd_cnpollc,
+ pckbd_bell,
+ pckbd_ioctl,
+ pckbd_translate,
+ 0x7f, /* key data mask */
+ 0x80, /* key-up mask */
+};
+#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));
+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));
+
+/*
+ * DANGER WIL ROBINSON -- the values of SCROLL, NUM, CAPS, and ALT are
+ * important.
+ */
+#define SCROLL 0x0001 /* stop output */
+#define NUM 0x0002 /* numeric shift cursors vs. numeric */
+#define CAPS 0x0004 /* caps shift -- swaps case of letter */
+#define SHIFT 0x0008 /* keyboard shift */
+#define CTL 0x0010 /* control shift -- allows ctl function */
+#define ASCII 0x0020 /* ascii code for this key */
+#define ALT 0x0080 /* alternate shift -- alternate chars */
+#define FUNC 0x0100 /* function key */
+#define KP 0x0200 /* Keypad keys */
+#define NONE 0x0400 /* no function */
+
+#define KBD_DELAY \
+ do { \
+ bus_space_read_1(pckbd_iot, pckbd_delay_ioh, 0); \
+ bus_space_read_1(pckbd_iot, pckbd_delay_ioh, 0); \
+ bus_space_read_1(pckbd_iot, pckbd_delay_ioh, 0); \
+ bus_space_read_1(pckbd_iot, pckbd_delay_ioh, 0); \
+ bus_space_read_1(pckbd_iot, pckbd_delay_ioh, 0); \
+ bus_space_read_1(pckbd_iot, pckbd_delay_ioh, 0); \
+ bus_space_read_1(pckbd_iot, pckbd_delay_ioh, 0); \
+ bus_space_read_1(pckbd_iot, pckbd_delay_ioh, 0); \
+ } while(0)
+
+static __inline int
+kbd_wait_output()
+{
+ u_int i;
+
+ for (i = 100000; i; i--)
+ if ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_IBF)
+ == 0) {
+ KBD_DELAY;
+ return 1;
+ }
+ return 0;
+}
+
+static __inline int
+kbd_wait_input()
+{
+ u_int i;
+
+ for (i = 100000; i; i--)
+ if ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB)
+ != 0) {
+ KBD_DELAY;
+ return 1;
+ }
+ return 0;
+}
+
+static __inline void
+kbd_flush_input()
+{
+ u_int i;
+
+ for (i = 10; i; i--) {
+ if ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB)
+ == 0)
+ return;
+ KBD_DELAY;
+ (void) bus_space_read_1(pckbd_iot, pckbd_ioh, KBDATAP);
+ }
+}
+
+#if 1
+/*
+ * Get the current command byte.
+ */
+u_char
+kbc_get8042cmd()
+{
+
+ if (!kbd_wait_output())
+ return -1;
+ 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_ioh, KBDATAP);
+}
+#endif
+
+/*
+ * Pass command byte to keyboard controller (8042).
+ */
+int
+kbc_put8042cmd(val)
+ u_char val;
+{
+
+ if (!kbd_wait_output())
+ return 0;
+ bus_space_write_1(pckbd_iot, pckbd_ioh, KBCMDP, K_LDCMDBYTE);
+ if (!kbd_wait_output())
+ return 0;
+ bus_space_write_1(pckbd_iot, pckbd_ioh, KBOUTP, val);
+ return 1;
+}
+
+/*
+ * Pass command to keyboard itself
+ */
+int
+kbd_cmd(val, polling)
+ u_char val;
+ u_char polling;
+{
+ u_int retries = 3;
+ register u_int i;
+
+ do {
+ if (!kbd_wait_output())
+ return 0;
+ ack = nak = 0;
+ 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_ioh, KBSTATP) & KBS_DIB) {
+ register u_char c;
+
+ KBD_DELAY;
+ c = bus_space_read_1(pckbd_iot,
+ pckbd_ioh, KBDATAP);
+ if (c == KBR_ACK || c == KBR_ECHO) {
+ ack = 1;
+ return 1;
+ }
+ if (c == KBR_RESEND) {
+ nak = 1;
+ break;
+ }
+#ifdef DIAGNOSTIC
+ printf("kbd_cmd: input char %x lost\n",
+ c);
+#endif
+ }
+ }
+ else
+ for (i = 100000; i; i--) {
+ (void) bus_space_read_1(pckbd_iot,
+ pckbd_ioh, KBSTATP);
+ if (ack)
+ return 1;
+ if (nak)
+ break;
+ }
+ if (!nak)
+ return 0;
+ } while (--retries);
+ return 0;
+}
+
+/*
+ * these are both bad jokes
+ */
+int
+pckbdprobe(parent, match, aux)
+ struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
+{
+ struct pcppi_attach_args *pa = aux;
+ u_int i, rv;
+
+ if (pa->pa_slot != PCPPI_KBD_SLOT)
+ return 0;
+
+ 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");
+ goto lose;
+ }
+
+ rv = 1; /* from here one out, we let it succeed */
+#if 1
+ /* Flush any garbage. */
+ kbd_flush_input();
+ /* Reset the keyboard. */
+ if (!kbd_cmd(KBC_RESET, 1)) {
+ printf("pcprobe: reset error %d\n", 1);
+ goto lose;
+ }
+ for (i = 600000; i; i--)
+ 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_ioh, KBDATAP)
+ != KBR_RSTDONE) {
+ printf("pcprobe: reset error %d\n", 2);
+ goto lose;
+ }
+ /*
+ * Some keyboards seem to leave a second ack byte after the reset.
+ * This is kind of stupid, but we account for them anyway by just
+ * flushing the buffer.
+ */
+ kbd_flush_input();
+ /* Just to be sure. */
+ if (!kbd_cmd(KBC_ENABLE, 1)) {
+ printf("pcprobe: reset error %d\n", 3);
+ goto lose;
+ }
+
+ /*
+ * Some keyboard/8042 combinations do not seem to work if the keyboard
+ * is set to table 1; in fact, it would appear that some keyboards just
+ * ignore the command altogether. So by default, we use the AT scan
+ * codes and have the 8042 translate them. Unfortunately, this is
+ * known to not work on some PS/2 machines. We try desparately to deal
+ * with this by checking the (lack of a) translate bit in the 8042 and
+ * attempting to set the keyboard to XT mode. If this all fails, well,
+ * tough luck.
+ *
+ * XXX It would perhaps be a better choice to just use AT scan codes
+ * and not bother with this.
+ */
+ if (kbc_get8042cmd() & KC8_TRANS) {
+ /* The 8042 is translating for us; use AT codes. */
+ if (!kbd_cmd(KBC_SETTABLE, 1) || !kbd_cmd(2, 1)) {
+ printf("pcprobe: reset error %d\n", 4);
+ goto lose;
+ }
+ } else {
+ /* Stupid 8042; set keyboard to XT codes. */
+ if (!kbd_cmd(KBC_SETTABLE, 1) || !kbd_cmd(1, 1)) {
+ printf("pcprobe: reset error %d\n", 5);
+ goto lose;
+ }
+ }
+
+lose:
+ /*
+ * Technically, we should probably fail the probe. But we'll be nice
+ * and allow keyboard-less machines to boot with the console.
+ */
+#endif
+
+ return rv;
+}
+
+void
+pckbdattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct pckbd_softc *sc = (void *)self;
+ struct pcppi_attach_args *pa = aux;
+
+ 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;
+
+ 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;
+
+#if NWSCONS
+ printf("\n");
+ kbdattach(self, &pckbd_wscons_idev);
+#else
+ printf(": no wscons driver present; no input possible\n");
+#endif
+}
+
+/*
+ * Got a console receive interrupt -
+ * the console processor wants to give us a character.
+ * Catch the character, and see who it goes to.
+ */
+int
+pckbdintr(arg)
+ void *arg;
+{
+ u_char data;
+ static u_char last;
+
+ 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_ioh, KBDATAP);
+
+ switch (data) {
+ case KBR_ACK:
+ ack = 1;
+ break;
+ case KBR_RESEND:
+ nak = 1;
+ break;
+ default:
+ /* Always ignore typematic keys */
+ if (data == last)
+ break;
+ last = data;
+#if NWSCONS
+ kbd_input(data);
+#endif
+ break;
+ }
+ } while (bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB);
+ return 1;
+}
+
+void
+do_async_update(v)
+ void *v;
+{
+ u_long poll = (u_long)v;
+
+ async = 0;
+
+ if (lock_state != old_lock_state) {
+ old_lock_state = lock_state;
+ if (!kbd_cmd(KBC_MODEIND, poll) ||
+ !kbd_cmd(lock_state, poll)) {
+ printf("pc: timeout updating leds\n");
+ (void) kbd_cmd(KBC_ENABLE, poll);
+ }
+ }
+ if (typematic_rate != old_typematic_rate) {
+ old_typematic_rate = typematic_rate;
+ if (!kbd_cmd(KBC_TYPEMATIC, poll) ||
+ !kbd_cmd(typematic_rate, poll)) {
+ printf("pc: timeout updating typematic rate\n");
+ (void) kbd_cmd(KBC_ENABLE, poll);
+ }
+ }
+}
+
+void
+async_update()
+{
+ if (kernel || polling) {
+ if (async)
+ untimeout(do_async_update, NULL);
+ do_async_update((void *)1);
+ } else {
+ if (async)
+ return;
+ async = 1;
+ timeout(do_async_update, NULL, 1);
+ }
+}
+
+int
+pckbd_ioctl(v, cmd, data, flag, p)
+ void *v;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+
+ switch (cmd) {
+ case WSCONSIO_KBD_GTYPE:
+ *(int *)data = KBD_TYPE_PC;
+ return 0;
+ }
+ return ENOTTY;
+}
+
+#if 0
+int
+pcioctl(dev, cmd, data, flag, p)
+ dev_t dev;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ struct pc_softc *sc = pccd.cd_devs[PCUNIT(dev)];
+ int error;
+
+ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
+ if (error >= 0)
+ return error;
+ error = ttioctl(tp, cmd, data, flag, p);
+ if (error >= 0)
+ return error;
+
+ switch (cmd) {
+ case CONSOLE_X_MODE_ON:
+ pc_xmode_on();
+ return 0;
+ case CONSOLE_X_MODE_OFF:
+ pc_xmode_off();
+ return 0;
+ case CONSOLE_X_BELL:
+ /*
+ * If set, data is a pointer to a length 2 array of
+ * integers. data[0] is the pitch in Hz and data[1]
+ * is the duration in msec.
+ */
+ if (data)
+ sysbeep(((int*)data)[0],
+ (((int*)data)[1] * hz) / 1000);
+ else
+ sysbeep(BEEP_FREQ, BEEP_TIME);
+ return 0;
+ case CONSOLE_SET_TYPEMATIC_RATE: {
+ u_char rate;
+
+ if (!data)
+ return EINVAL;
+ rate = *((u_char *)data);
+ /*
+ * Check that it isn't too big (which would cause it to be
+ * confused with a command).
+ */
+ if (rate & 0x80)
+ return EINVAL;
+ typematic_rate = rate;
+ async_update();
+ return 0;
+ }
+ default:
+ return ENOTTY;
+ }
+
+#ifdef DIAGNOSTIC
+ panic("pcioctl: impossible");
+#endif
+}
+#endif
+
+#define CODE_SIZE 4 /* Use a max of 4 for now... */
+typedef struct {
+ u_short type;
+ char unshift[CODE_SIZE];
+ 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 */
+};
+/*
+ * Get characters from the keyboard. If none are present, return NULL.
+ */
+char *
+pckbd_translate(dev, c)
+ struct device *dev;
+ int c;
+{
+ u_char dt = c;
+ static u_char extended = 0, shift_state = 0;
+ static u_char capchar[2];
+
+ if (dt == KBR_EXTENDED) {
+ extended = 1;
+ return (NULL);
+ }
+
+#ifdef DDB
+ /*
+ * Check for cntl-alt-esc.
+ */
+ if ((dt == 1) && (shift_state & (CTL | ALT)) == (CTL | ALT)) {
+ if (db_console)
+ Debugger();
+ return (NULL);
+ }
+#endif
+
+ /*
+ * Check for make/break.
+ */
+ if (dt & 0x80) {
+ /*
+ * break
+ */
+ dt &= 0x7f;
+ switch (scan_codes[dt].type) {
+ case NUM:
+ shift_state &= ~NUM;
+ break;
+ case CAPS:
+ shift_state &= ~CAPS;
+ break;
+ case SCROLL:
+ shift_state &= ~SCROLL;
+ break;
+ case SHIFT:
+ shift_state &= ~SHIFT;
+ break;
+ case ALT:
+ shift_state &= ~ALT;
+ break;
+ case CTL:
+ shift_state &= ~CTL;
+ break;
+ }
+ } else {
+ /*
+ * make
+ */
+ switch (scan_codes[dt].type) {
+ /*
+ * locking keys
+ */
+ case NUM:
+ if (shift_state & NUM)
+ break;
+ shift_state |= NUM;
+ lock_state ^= NUM;
+ async_update();
+ break;
+ case CAPS:
+ if (shift_state & CAPS)
+ break;
+ shift_state |= CAPS;
+ lock_state ^= CAPS;
+ async_update();
+ break;
+ case SCROLL:
+ if (shift_state & SCROLL)
+ break;
+ shift_state |= SCROLL;
+ lock_state ^= SCROLL;
+ if ((lock_state & SCROLL) == 0)
+ wakeup((caddr_t)&lock_state);
+ async_update();
+ break;
+ /*
+ * non-locking keys
+ */
+ case SHIFT:
+ shift_state |= SHIFT;
+ break;
+ case ALT:
+ shift_state |= ALT;
+ break;
+ case CTL:
+ shift_state |= CTL;
+ break;
+ case ASCII:
+ /* control has highest priority */
+ if (shift_state & CTL)
+ capchar[0] = scan_codes[dt].ctl[0];
+ else if (shift_state & SHIFT)
+ capchar[0] = scan_codes[dt].shift[0];
+ else
+ capchar[0] = scan_codes[dt].unshift[0];
+ if ((lock_state & CAPS) && capchar[0] >= 'a' &&
+ capchar[0] <= 'z') {
+ capchar[0] -= ('a' - 'A');
+ }
+ capchar[0] |= (shift_state & ALT);
+ extended = 0;
+ return capchar;
+ case NONE:
+ break;
+ case FUNC: {
+ char *more_chars;
+ if (shift_state & SHIFT)
+ more_chars = scan_codes[dt].shift;
+ else if (shift_state & CTL)
+ more_chars = scan_codes[dt].ctl;
+ else
+ more_chars = scan_codes[dt].unshift;
+ extended = 0;
+ return more_chars;
+ }
+ case KP: {
+ char *more_chars;
+ if (shift_state & (SHIFT | CTL) ||
+ (lock_state & NUM) == 0 || extended)
+ more_chars = scan_codes[dt].shift;
+ else
+ more_chars = scan_codes[dt].unshift;
+ extended = 0;
+ return more_chars;
+ }
+ }
+ }
+
+ extended = 0;
+ return (NULL);
+}
+
+
+/* ARGSUSED */
+int
+pckbd_cngetc(dev)
+ struct device *dev;
+{
+ register char *cp = NULL;
+ u_char data;
+ static u_char last;
+
+ do {
+ /* wait for byte */
+ 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_ioh, KBDATAP);
+
+ if (data == KBR_ACK) {
+ ack = 1;
+ continue;
+ }
+ if (data == KBR_RESEND) {
+ nak = 1;
+ continue;
+ }
+
+ /* Ignore typematic keys */
+ if (data == last)
+ continue;
+ last = data;
+
+ cp = pckbd_translate(NULL, data);
+ } while (!cp);
+ if (*cp == '\r')
+ return '\n';
+ return *cp;
+}
+
+void
+pckbd_cnpollc(dev, on)
+ struct device *dev;
+ int on;
+{
+ struct pckbd_softc *sc = (struct pckbd_softc *)dev;
+
+ polling = on;
+ if (!on) {
+ int s;
+
+ /*
+ * If disabling polling on a device that's been configured,
+ * make sure there are no bytes left in the FIFO, holding up
+ * the interrupt line. Otherwise we won't get any further
+ * interrupts.
+ */
+ if (sc != 0) {
+ s = spltty();
+ pckbdintr(sc);
+ splx(s);
+ }
+ }
+}
+
+void
+pckbd_bell(dev, wbd)
+ struct device *dev;
+ struct wsconsio_bell_data *wbd;
+{
+ struct pckbd_softc *sc = (struct pckbd_softc *)dev;
+ int pitch, period;
+ int s;
+
+ pitch = wbd->wbd_pitch;
+ period = (wbd->wbd_period * hz) / 1000;
+ /* XXX volume ignored */
+
+ s = splhigh();
+ if (sc->sc_bellactive)
+ untimeout(pckbd_bell_stop, sc);
+ splx(s);
+ if (pitch == 0 || period == 0) {
+ pckbd_bell_stop(sc);
+ sc->sc_bellpitch = 0;
+ return;
+ }
+ if (!sc->sc_bellactive || sc->sc_bellpitch != pitch) {
+ s = splhigh();
+ bus_space_write_1(pckbd_iot, pckbd_timer_ioh, TIMER_MODE,
+ TIMER_SEL2 | TIMER_16BIT | TIMER_SQWAVE);
+ bus_space_write_1(pckbd_iot, pckbd_timer_ioh, TIMER_CNTR2,
+ TIMER_DIV(pitch) % 256);
+ bus_space_write_1(pckbd_iot, pckbd_timer_ioh, TIMER_CNTR2,
+ TIMER_DIV(pitch) / 256);
+ /* enable speaker */
+ bus_space_write_1(pckbd_iot, pckbd_ioh, PITAUX_PORT,
+ bus_space_read_1(pckbd_iot, pckbd_ioh, PITAUX_PORT) |
+ PIT_SPKR);
+ splx(s);
+ }
+ sc->sc_bellpitch = pitch;
+ sc->sc_bellactive = 1;
+ timeout(pckbd_bell_stop, sc, period);
+}
+
+void
+pckbd_bell_stop(arg)
+ void *arg;
+{
+ struct pckbd_softc *sc = arg;
+ int s;
+
+ /* disable bell */
+ s = splhigh();
+ 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/powerpc/isa/pckbdreg.h b/sys/arch/powerpc/isa/pckbdreg.h
new file mode 100644
index 00000000000..b0c1447f98f
--- /dev/null
+++ b/sys/arch/powerpc/isa/pckbdreg.h
@@ -0,0 +1,29 @@
+/* $OpenBSD: pckbdreg.h,v 1.1 1998/09/27 03:55:58 rahnds Exp $ */
+/* $NetBSD: pckbdreg.h,v 1.1 1995/08/03 00:48:30 cgd Exp $ */
+
+/*
+ * Keyboard definitions
+ */
+
+#include <dev/ic/i8042reg.h>
+
+/* keyboard commands */
+#define KBC_RESET 0xFF /* reset the keyboard */
+#define KBC_RESEND 0xFE /* request the keyboard resend the last byte */
+#define KBC_SETDEFAULT 0xF6 /* resets keyboard to its power-on defaults */
+#define KBC_DISABLE 0xF5 /* as per KBC_SETDEFAULT, but also disable key scanning */
+#define KBC_ENABLE 0xF4 /* enable key scanning */
+#define KBC_TYPEMATIC 0xF3 /* set typematic rate and delay */
+#define KBC_SETTABLE 0xF0 /* set scancode translation table */
+#define KBC_MODEIND 0xED /* set mode indicators (i.e. LEDs) */
+#define KBC_ECHO 0xEE /* request an echo from the keyboard */
+
+/* keyboard responses */
+#define KBR_EXTENDED 0xE0 /* extended key sequence */
+#define KBR_RESEND 0xFE /* needs resend of command */
+#define KBR_ACK 0xFA /* received a valid command */
+#define KBR_OVERRUN 0x00 /* flooded */
+#define KBR_FAILURE 0xFD /* diagnosic failure */
+#define KBR_BREAK 0xF0 /* break code prefix - sent on key release */
+#define KBR_RSTDONE 0xAA /* reset complete */
+#define KBR_ECHO 0xEE /* echo response */
diff --git a/sys/arch/powerpc/isa/pcppi.c b/sys/arch/powerpc/isa/pcppi.c
new file mode 100644
index 00000000000..66c0a310145
--- /dev/null
+++ b/sys/arch/powerpc/isa/pcppi.c
@@ -0,0 +1,195 @@
+/* $OpenBSD: pcppi.c,v 1.1 1998/09/27 03:55:58 rahnds Exp $ */
+/* $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 <powerpc/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/powerpc/isa/pcppivar.h b/sys/arch/powerpc/isa/pcppivar.h
new file mode 100644
index 00000000000..0b0ed0a88ea
--- /dev/null
+++ b/sys/arch/powerpc/isa/pcppivar.h
@@ -0,0 +1,45 @@
+/* $OpenBSD: pcppivar.h,v 1.1 1998/09/27 03:55:58 rahnds Exp $ */
+/* $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/powerpc/isa/pms.c b/sys/arch/powerpc/isa/pms.c
new file mode 100644
index 00000000000..ab0a9396c4f
--- /dev/null
+++ b/sys/arch/powerpc/isa/pms.c
@@ -0,0 +1,330 @@
+/* $OpenBSD: pms.c,v 1.1 1998/09/27 03:55:58 rahnds Exp $ */
+/* $NetBSD: pms.c,v 1.7 1996/12/05 01:39:31 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1994 Charles Hannum.
+ * Copyright (c) 1992, 1993 Erik Forsberg.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ``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 I 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.
+ */
+
+/*
+ * XXXX
+ * This is a hack. This driver should really be combined with the
+ * keyboard driver, since they go through the same buffer and use the
+ * same I/O ports. Frobbing the mouse and keyboard at the same time
+ * may result in dropped characters and/or corrupted mouse events.
+ */
+
+#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>
+#include <sys/file.h>
+#include <sys/select.h>
+#include <sys/proc.h>
+#include <sys/vnode.h>
+#include <sys/device.h>
+
+#include <machine/intr.h>
+#include <dev/isa/isavar.h>
+#include <dev/wscons/wsconsvar.h>
+#include <dev/wscons/ms.h>
+#include <powerpc/isa/pcppivar.h>
+
+#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 */
+#define PMS_OBUF_FULL 0x01
+#define PMS_IBUF_FULL 0x02
+
+/* controller commands */
+#define PMS_INT_ENABLE 0x47 /* enable controller interrupts */
+#define PMS_INT_DISABLE 0x65 /* disable controller interrupts */
+#define PMS_AUX_ENABLE 0xa8 /* enable auxiliary port */
+#define PMS_AUX_DISABLE 0xa7 /* disable auxiliary port */
+#define PMS_AUX_TEST 0xa9 /* test auxiliary port */
+
+#define PMS_8042_CMD 0x65
+
+/* mouse commands */
+#define PMS_SET_SCALE11 0xe6 /* set scaling 1:1 */
+#define PMS_SET_SCALE21 0xe7 /* set scaling 2:1 */
+#define PMS_SET_RES 0xe8 /* set resolution */
+#define PMS_GET_SCALE 0xe9 /* get scaling factor */
+#define PMS_SET_STREAM 0xea /* set streaming mode */
+#define PMS_SET_SAMPLE 0xf3 /* set sampling rate */
+#define PMS_DEV_ENABLE 0xf4 /* mouse on */
+#define PMS_DEV_DISABLE 0xf5 /* mouse off */
+#define PMS_RESET 0xff /* reset */
+
+#define PMS_CHUNK 128 /* chunk size for read */
+#define PMS_BSIZE 1020 /* buffer size */
+
+struct pms_softc { /* driver status information */
+ struct device sc_dev;
+
+ void *sc_ih;
+
+ u_int8_t sc_state; /* mouse driver state */
+#define PMS_OPEN 0x01 /* device is open */
+#define PMS_ASLP 0x02 /* waiting for mouse data */
+ u_int8_t sc_status; /* mouse button status */
+ int sc_x, sc_y; /* accumulated motion in the X,Y axis */
+};
+
+bus_space_tag_t pms_iot;
+bus_space_handle_t pms_ioh;
+isa_chipset_tag_t pms_ic;
+
+#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 *));
+
+struct cfattach pms_ca = {
+ sizeof(struct pms_softc), pmsprobe, pmsattach,
+};
+
+struct cfdriver pms_cd = {
+ NULL, "pms", DV_TTY,
+};
+
+#define PMSUNIT(dev) (minor(dev))
+
+int pms_enable __P((struct device *));
+int pms_disable __P((struct device *));
+
+struct wscons_mdev_spec pms_mdev_spec = {
+ pms_enable,
+ pms_disable,
+};
+
+static __inline void pms_flush __P((void));
+static __inline void pms_dev_cmd __P((u_int8_t));
+static __inline void pms_aux_cmd __P((u_int8_t));
+static __inline void pms_pit_cmd __P((u_int8_t));
+
+static __inline void
+pms_flush()
+{
+ u_int8_t c;
+
+ 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_ioh, PMS_DATA);
+ }
+}
+
+static __inline void
+pms_dev_cmd(value)
+ u_int8_t value;
+{
+
+ pms_flush();
+ bus_space_write_1(pms_iot, pms_ioh, PMS_CNTRL, 0xd4);
+ pms_flush();
+ bus_space_write_1(pms_iot, pms_ioh, PMS_DATA, value);
+}
+
+static __inline void
+pms_aux_cmd(value)
+ u_int8_t value;
+{
+
+ pms_flush();
+ bus_space_write_1(pms_iot, pms_ioh, PMS_CNTRL, value);
+}
+
+static __inline void
+pms_pit_cmd(value)
+ u_int8_t value;
+{
+
+ pms_flush();
+ bus_space_write_1(pms_iot, pms_ioh, PMS_CNTRL, 0x60);
+ pms_flush();
+ bus_space_write_1(pms_iot, pms_ioh, PMS_DATA, value);
+}
+
+int
+pmsprobe(parent, match, aux)
+ struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
+{
+ struct pcppi_attach_args *pa = aux;
+ u_int8_t x;
+
+ if (pa->pa_slot != PCPPI_AUX_SLOT)
+ 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_ioh, PMS_DATA);
+ pms_pit_cmd(PMS_INT_DISABLE);
+ if (x & 0x04)
+ return 0;
+
+ return 1;
+}
+
+void
+pmsattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct pms_softc *sc = (void *)self;
+ struct pcppi_attach_args *pa = aux;
+
+ pms_iot = pa->pa_iot;
+ pms_ioh = pa->pa_ioh;
+ pms_ic = pa->pa_ic;
+
+ msattach(self, &pms_mdev_spec);
+
+ printf("\n");
+
+ /* Other initialization was done by pmsprobe. */
+ sc->sc_state = 0;
+
+ sc->sc_ih = isa_intr_establish(pms_ic, 12, IST_EDGE, IPL_TTY, pmsintr,
+ sc, sc->sc_dev.dv_xname);
+}
+
+int
+pms_enable(dev)
+ struct device *dev;
+{
+ struct pms_softc *sc = (struct pms_softc *)dev;
+
+ if (sc->sc_state & PMS_OPEN)
+ return EBUSY;
+
+ sc->sc_state |= PMS_OPEN;
+ sc->sc_status = 0;
+ sc->sc_x = sc->sc_y = 0;
+
+ /* Enable interrupts. */
+ pms_dev_cmd(PMS_DEV_ENABLE);
+ pms_aux_cmd(PMS_AUX_ENABLE);
+#if 0
+ pms_dev_cmd(PMS_SET_RES);
+ pms_dev_cmd(3); /* 8 counts/mm */
+ pms_dev_cmd(PMS_SET_SCALE21);
+ pms_dev_cmd(PMS_SET_SAMPLE);
+ pms_dev_cmd(100); /* 100 samples/sec */
+ pms_dev_cmd(PMS_SET_STREAM);
+#endif
+ pms_pit_cmd(PMS_INT_ENABLE);
+
+ return 0;
+}
+
+int
+pms_disable(dev)
+ struct device *dev;
+{
+ struct pms_softc *sc = (struct pms_softc *)dev;
+
+ /* Disable interrupts. */
+ pms_dev_cmd(PMS_DEV_DISABLE);
+ pms_pit_cmd(PMS_INT_DISABLE);
+ pms_aux_cmd(PMS_AUX_DISABLE);
+
+ sc->sc_state &= ~PMS_OPEN;
+
+ return 0;
+}
+
+/* Masks for the first byte of a packet */
+#define PS2LBUTMASK 0x01
+#define PS2RBUTMASK 0x02
+#define PS2MBUTMASK 0x04
+
+int
+pmsintr(arg)
+ void *arg;
+{
+ struct pms_softc *sc = arg;
+ static int state = 0;
+ static u_int8_t buttons;
+ u_int8_t changed;
+ static int8_t dx, dy;
+
+ if ((sc->sc_state & PMS_OPEN) == 0) {
+ /* Interrupts are not expected. Discard the byte. */
+ pms_flush();
+ return 0;
+ }
+
+ switch (state) {
+
+ case 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_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_ioh, PMS_DATA);
+ dy = (dy == -128) ? -127 : dy;
+ state = 0;
+
+ buttons = ((buttons & PS2LBUTMASK) << 2) |
+ ((buttons & (PS2RBUTMASK | PS2MBUTMASK)) >> 1);
+ changed = (buttons ^ sc->sc_status);
+ sc->sc_status = buttons;
+
+ if (dx || dy || changed)
+ ms_event(buttons, dx, dy);
+ break;
+ }
+
+ return -1;
+}
diff --git a/sys/arch/powerpc/isa/spkrreg.h b/sys/arch/powerpc/isa/spkrreg.h
new file mode 100644
index 00000000000..ab9becf1fed
--- /dev/null
+++ b/sys/arch/powerpc/isa/spkrreg.h
@@ -0,0 +1,12 @@
+/* $OpenBSD: spkrreg.h,v 1.1 1998/09/27 03:55:58 rahnds Exp $ */
+/* $NetBSD: spkrreg.h,v 1.1 1996/04/12 01:54:46 cgd Exp $ */
+
+/*
+ * PIT port addresses and speaker control values
+ */
+
+#define PITAUX_PORT 0x61 /* port of Programmable Peripheral Interface */
+#define PIT_ENABLETMR2 0x01 /* Enable timer/counter 2 */
+#define PIT_SPKRDATA 0x02 /* Direct to speaker */
+
+#define PIT_SPKR (PIT_ENABLETMR2|PIT_SPKRDATA)
diff --git a/sys/arch/powerpc/isa/timerreg.h b/sys/arch/powerpc/isa/timerreg.h
new file mode 100644
index 00000000000..a2cda45b71a
--- /dev/null
+++ b/sys/arch/powerpc/isa/timerreg.h
@@ -0,0 +1,101 @@
+/* $OpenBSD: timerreg.h,v 1.1 1998/09/27 03:55:58 rahnds Exp $ */
+/* $NetBSD: timerreg.h,v 1.1 1996/04/12 01:54:56 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1993 The Regents of the University of California.
+ * 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 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.
+ */
+
+/*
+ * Register definitions for the Intel 8253 Programmable Interval Timer.
+ *
+ * This chip has three independent 16-bit down counters that can be
+ * read on the fly. There are three mode registers and three countdown
+ * registers. The countdown registers are addressed directly, via the
+ * first three I/O ports. The three mode registers are accessed via
+ * the fourth I/O port, with two bits in the mode byte indicating the
+ * register. (Why are hardware interfaces always so braindead?).
+ *
+ * To write a value into the countdown register, the mode register
+ * is first programmed with a command indicating the which byte of
+ * the two byte register is to be modified. The three possibilities
+ * are load msb (TMR_MR_MSB), load lsb (TMR_MR_LSB), or load lsb then
+ * msb (TMR_MR_BOTH).
+ *
+ * To read the current value ("on the fly") from the countdown register,
+ * you write a "latch" command into the mode register, then read the stable
+ * value from the corresponding I/O port. For example, you write
+ * TMR_MR_LATCH into the corresponding mode register. Presumably,
+ * after doing this, a write operation to the I/O port would result
+ * in undefined behavior (but hopefully not fry the chip).
+ * Reading in this manner has no side effects.
+ *
+ * The outputs of the three timers are connected as follows:
+ *
+ * timer 0 -> irq 0
+ * timer 1 -> dma chan 0 (for dram refresh)
+ * timer 2 -> speaker (via keyboard controller)
+ *
+ * Timer 0 is used to call hardclock.
+ * Timer 2 is used to generate console beeps.
+ */
+
+/*
+ * Frequency of all three count-down timers; (TIMER_FREQ/freq) is the
+ * appropriate count to generate a frequency of freq hz.
+ */
+#ifndef TIMER_FREQ
+#define TIMER_FREQ 1193182
+#endif
+#define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x))
+
+/*
+ * Macros for specifying values to be written into a mode register.
+ */
+#define TIMER_CNTR0 0 /* timer 0 counter port */
+#define TIMER_CNTR1 1 /* timer 1 counter port */
+#define TIMER_CNTR2 2 /* timer 2 counter port */
+#define TIMER_MODE 3 /* timer mode port */
+#define TIMER_SEL0 0x00 /* select counter 0 */
+#define TIMER_SEL1 0x40 /* select counter 1 */
+#define TIMER_SEL2 0x80 /* select counter 2 */
+#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */
+#define TIMER_ONESHOT 0x02 /* mode 1, one shot */
+#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
+#define TIMER_SQWAVE 0x06 /* mode 3, square wave */
+#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */
+#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */
+#define TIMER_LATCH 0x00 /* latch counter for reading */
+#define TIMER_LSB 0x10 /* r/w counter LSB */
+#define TIMER_MSB 0x20 /* r/w counter MSB */
+#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
+#define TIMER_BCD 0x01 /* count in BCD */
+
diff --git a/sys/arch/powerpc/powerpc/conf.c b/sys/arch/powerpc/powerpc/conf.c
index 7890663639a..2768cb6ed33 100644
--- a/sys/arch/powerpc/powerpc/conf.c
+++ b/sys/arch/powerpc/powerpc/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.12 1998/09/25 09:20:54 todd Exp $ */
+/* $OpenBSD: conf.c,v 1.13 1998/09/27 03:56:00 rahnds Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
@@ -104,6 +104,18 @@ cdev_decl(ofd);
#include "ofrtc.h"
cdev_decl(ofrtc);
+
+cdev_decl(kbd);
+cdev_decl(ms);
+
+#define cdev_wscons_init(c,n) { \
+ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
+ dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
+ dev_init(c,n,tty), ttselect /* ttpoll */, dev_init(c,n,mmap), D_TTY }
+
+#include "wscons.h"
+cdev_decl(wscons);
+
#include <sd.h>
#include <st.h>
#include <cd.h>
@@ -128,7 +140,7 @@ cdev_decl(random);
#ifdef XFS
#include <xfs/nxfs.h>
cdev_decl(xfs_dev);
-#endef
+#endif
#ifdef LKM
#define NLKM 1
@@ -173,12 +185,12 @@ struct cdevsw cdevsw[] = {
cdev_bpftun_init(NBPFILTER,bpf),/* 22: berkeley packet filter */
cdev_bpftun_init(NTUN,tun), /* 23: network tunnel */
cdev_lkm_init(NLKM,lkm), /* 24: loadable module driver */
- cdev_notdef(), /* 25 */
+ cdev_wscons_init(NWSCONS,wscons), /* 25: workstation console */
cdev_notdef(), /* 26 */
cdev_notdef(), /* 27 */
cdev_notdef(), /* 28 */
- cdev_notdef(), /* 29 */
- cdev_notdef(), /* 30 */
+ cdev_mouse_init(NWSCONS,kbd), /* 29 /dev/kbd XX */
+ cdev_mouse_init(NWSCONS,ms), /* 30 /dev/mouse XXX */
cdev_notdef(), /* 31 */
cdev_notdef(), /* 32 */
cdev_lkm_dummy(), /* 33 */
diff --git a/sys/arch/powerpc/powerpc/machdep.c b/sys/arch/powerpc/powerpc/machdep.c
index 90858d1feb1..838051cd5ec 100644
--- a/sys/arch/powerpc/powerpc/machdep.c
+++ b/sys/arch/powerpc/powerpc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.18 1998/09/20 22:11:48 rahnds Exp $ */
+/* $OpenBSD: machdep.c,v 1.19 1998/09/27 03:56:00 rahnds Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -892,3 +892,54 @@ ppc_intr_setup(intr_establish_t *establish, intr_disestablish_t *disestablish)
intr_establish_func = establish;
intr_disestablish_func = disestablish;
}
+/*
+ * probably should be ppc_space_copy
+ */
+
+#define _CONCAT(A,B) A ## B
+#define __C(A,B) _CONCAT(A,B)
+
+#define BUS_SPACE_COPY_N(BYTES,TYPE) \
+void \
+__C(bus_space_copy_,BYTES)(v, h1, o1, h2, o2, c) \
+ void *v; \
+ bus_space_handle_t h1, h2; \
+ bus_size_t o1, o2, c; \
+{ \
+ TYPE val; \
+ TYPE *src, *dst; \
+ int i; \
+ \
+ src = (TYPE *) (h1+o1); \
+ dst = (TYPE *) (h2+o2); \
+ \
+ if (h1 == h2 && o2 > o1) { \
+ for (i = c; i > 0; i--) { \
+ dst[i] = src[i]; \
+ } \
+ } else { \
+ for (i = 0; i < c; i++) { \
+ dst[i] = src[i]; \
+ } \
+ } \
+}
+BUS_SPACE_COPY_N(1,u_int8_t)
+BUS_SPACE_COPY_N(2,u_int16_t)
+BUS_SPACE_COPY_N(4,u_int32_t)
+
+#define BUS_SPACE_SET_REGION_N(BYTES,TYPE) \
+void \
+__C(bus_space_set_region_,BYTES)(v, h, o, val, c) \
+{ \
+ TYPE *src, *dst; \
+ int i; \
+ \
+ dst = (TYPE *) (h+o); \
+ for (i = 0; i < c; i++) { \
+ dst[i] = val; \
+ } \
+}
+
+BUS_SPACE_SET_REGION_N(1,u_int8_t)
+BUS_SPACE_SET_REGION_N(2,u_int16_t)
+BUS_SPACE_SET_REGION_N(4,u_int32_t)
diff --git a/sys/arch/powerpc/powerpc/ofw_machdep.c b/sys/arch/powerpc/powerpc/ofw_machdep.c
index 11b51155233..6aa925c6cfb 100644
--- a/sys/arch/powerpc/powerpc/ofw_machdep.c
+++ b/sys/arch/powerpc/powerpc/ofw_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_machdep.c,v 1.8 1998/09/20 22:11:48 rahnds Exp $ */
+/* $OpenBSD: ofw_machdep.c,v 1.9 1998/09/27 03:56:00 rahnds Exp $ */
/* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */
/*
@@ -226,6 +226,23 @@ ofwtrysercon(char *name, int qhandle)
ppc_console_serfreq=freq;
}
}
+static
+u_int32_t
+ofw_make_tag(cpv, bus, dev, fnc)
+ void *cpv;
+ int bus, dev, fnc;
+{
+ return (bus << 16) | (dev << 11) | (fnc << 8);
+}
+
+void
+ofwenablepcimemio(char *name, int qhandle)
+{
+ /* THIS PROBABLY IS A MAJOR HACK
+ * AND IT WOULD PREVENT ofdisk and ofnet from working
+ * on MCG, VI machines.
+ */
+}
#include <machine/bat.h>
/* HACK */
#include <powerpc/pci/mpc106reg.h>
@@ -240,6 +257,9 @@ ofwconprobe()
if (strcmp (name, "serial") == 0) {
ofwtrysercon (name, qhandle);
}
+ if (strcmp (name, "pci") == 0) {
+ ofwenablepcimemio (name, qhandle);
+ }
}
if (phandle = OF_child(qhandle))
diff --git a/sys/conf/files b/sys/conf/files
index e23cb7e52a9..d4662a29dc7 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.92 1998/09/27 03:38:40 downsj Exp $
+# $OpenBSD: files,v 1.93 1998/09/27 03:56:00 rahnds Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -102,6 +102,11 @@ file dev/ic/lpt.c lpt & (lpt_isa | lpt_pica | lpt_algor) needs-flag
device vga: wsconsdev
file dev/ic/vga.c vga & (vga_isa | vga_pci)
+# VGA framebuffer
+device vgafb: wsconsdev
+file dev/ic/vgafb.c vgafb & (vgafb_isa | vgafb_pci)
+file dev/ic/font_8x16.c vgafb & (vgafb_isa | vgafb_pci)
+
# Attributes which machine-independent bus support can be attached to.
# These should be defined here, because some of these busses can have
# devices which provide these attributes, and we'd like to avoid hairy
diff --git a/sys/dev/ic/font_8x16.c b/sys/dev/ic/font_8x16.c
new file mode 100644
index 00000000000..94ba9b590c7
--- /dev/null
+++ b/sys/dev/ic/font_8x16.c
@@ -0,0 +1,556 @@
+/* $NetBSD: font_8x16.c,v 1.2 1995/09/23 20:25:34 leo Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993, 1994 Hellmuth Michaelis and Joerg Wunsch
+ *
+ * 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
+ * Hellmuth Michaelis and Joerg Wunsch
+ * 4. The name authors may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
+ */
+
+/*
+ * Translated into compiler and human readable for for the Atari-TT port of
+ * NetBSD by Leo Weppelman.
+ *
+ * Reorganized and edited some chars to fit the iso-8859-1 fontset by
+ * Thomas Gerner
+ */
+
+const unsigned char fontdata_8x16[] = {
+/* 0x00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x01 */ 0x00, 0x18, 0x18, 0x3c, 0x3c, 0x7e, 0x7e, 0xff,
+ 0xff, 0x7e, 0x7e, 0x3c, 0x3c, 0x18, 0x18, 0x00,
+/* 0x02 */ 0x42, 0x99, 0x99, 0x42, 0x42, 0x99, 0x99, 0x42,
+ 0x42, 0x99, 0x99, 0x42, 0x42, 0x99, 0x99, 0x42,
+/* 0x03 */ 0x00, 0x00, 0x90, 0x90, 0xf0, 0x90, 0x90, 0x00,
+ 0x3e, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
+/* 0x04 */ 0x00, 0x00, 0xf0, 0x80, 0xe0, 0x80, 0x80, 0x00,
+ 0x1e, 0x10, 0x1c, 0x10, 0x10, 0x00, 0x00, 0x00,
+/* 0x05 */ 0x00, 0x00, 0x60, 0x90, 0x80, 0x90, 0x60, 0x00,
+ 0x1c, 0x12, 0x1c, 0x12, 0x12, 0x00, 0x00, 0x00,
+/* 0x06 */ 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0xf0, 0x00,
+ 0x1e, 0x10, 0x1c, 0x10, 0x10, 0x00, 0x00, 0x00,
+/* 0x07 */ 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x08 */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18,
+ 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
+/* 0x09 */ 0x00, 0x00, 0x88, 0x98, 0xa8, 0xc8, 0x88, 0x00,
+ 0x10, 0x10, 0x10, 0x10, 0x1e, 0x00, 0x00, 0x00,
+/* 0x0a */ 0x00, 0x00, 0x88, 0x88, 0x50, 0x50, 0x20, 0x00,
+ 0x3e, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
+/* 0x0b */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x0c */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+/* 0x0d */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+/* 0x0e */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x0f */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+/* 0x10 */ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x11 */ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x12 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x13 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
+/* 0x14 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
+/* 0x15 */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+/* 0x16 */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+/* 0x17 */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x18 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+/* 0x19 */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+/* 0x1a */ 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18,
+ 0x0c, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00,
+/* 0x1b */ 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18,
+ 0x30, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00,
+/* 0x1c */ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c,
+ 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
+/* 0x1d */ 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18,
+ 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x1e */ 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60,
+ 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00,
+/* 0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* ' ' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* '!' */ 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18,
+ 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
+/* '"' */ 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* '#' */ 0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c,
+ 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
+/* '$' */ 0x00, 0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c,
+ 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00,
+/* '%' */ 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18,
+ 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00,
+/* '&' */ 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* ''' */ 0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* '(' */ 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30,
+ 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
+/* ')' */ 0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
+/* '*' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff,
+ 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* '+' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e,
+ 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* ',' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
+/* '-' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* '.' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
+/* '/' */ 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18,
+ 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
+/* '0' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xce, 0xde, 0xf6,
+ 0xe6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* '1' */ 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
+/* '2' */ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30,
+ 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
+/* '3' */ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06,
+ 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* '4' */ 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe,
+ 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00,
+/* '5' */ 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06,
+ 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* '6' */ 0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* '7' */ 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18,
+ 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
+/* '8' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* '9' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06,
+ 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00,
+/* ':' */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
+ 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* ';' */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
+ 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
+/* '<' */ 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60,
+ 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00,
+/* '=' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00,
+ 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* '>' */ 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06,
+ 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
+/* '?' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18,
+ 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
+/* '@' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xde, 0xde,
+ 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 'A' */ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe,
+ 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 'B' */ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66,
+ 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,
+/* 'C' */ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0,
+ 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 'D' */ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00,
+/* 'E' */ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68,
+ 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
+/* 'F' */ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68,
+ 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
+/* 'G' */ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde,
+ 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00,
+/* 'H' */ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 'I' */ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 'J' */ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
+/* 'K' */ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78,
+ 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
+/* 'L' */ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60,
+ 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
+/* 'M' */ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 'N' */ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce,
+ 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 'O' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 'P' */ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60,
+ 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
+/* 'Q' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00,
+/* 'R' */ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c,
+ 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
+/* 'S' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c,
+ 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 'T' */ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 'U' */ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 'V' */ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
+/* 'W' */ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6,
+ 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00,
+/* 'X' */ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38,
+ 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 'Y' */ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 'Z' */ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30,
+ 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
+/* '[' */ 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30,
+ 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* '\' */ 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38,
+ 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
+/* ']' */ 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* '^' */ 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* '_' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
+/* '`' */ 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 'a' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* 'b' */ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66,
+ 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 'c' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0,
+ 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 'd' */ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* 'e' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe,
+ 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 'f' */ 0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60,
+ 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
+/* 'g' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc,
+ 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00,
+/* 'h' */ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66,
+ 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
+/* 'i' */ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 'j' */ 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00,
+/* 'k' */ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78,
+ 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
+/* 'l' */ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 'm' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6,
+ 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 'n' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
+/* 'o' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 'p' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00,
+/* 'q' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc,
+ 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00,
+/* 'r' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66,
+ 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
+/* 's' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60,
+ 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 't' */ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30,
+ 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
+/* 'u' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* 'v' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
+/* 'w' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6,
+ 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00,
+/* 'x' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38,
+ 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 'y' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00,
+/* 'z' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18,
+ 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
+/* '{' */ 0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18,
+ 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00,
+/* '|' */ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
+/* '}' */ 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18,
+ 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00,
+/* '~' */ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x7f */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6,
+ 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x80 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x81 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x82 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x83 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x84 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x85 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x86 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x88 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x89 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x8a */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x8b */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x8c */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x8d */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x8e */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x8f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x90 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x91 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x92 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x93 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x94 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x95 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x98 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x99 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x9a */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x9b */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x9c */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x9d */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x9e */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0x9f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xa0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xa1 */ 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18,
+ 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
+/* 0xa2 */ 0x00, 0x18, 0x18, 0x3c, 0x66, 0x60, 0x60, 0x60,
+ 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
+/* 0xa3 */ 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60,
+ 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00,
+/* 0xa4 */ 0xc3, 0x3c, 0x66, 0x42, 0x66, 0x3c, 0xc3, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xa5 */ 0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18,
+ 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
+/* 0xa6 */ 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00,
+ 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00,
+/* 0xa7 */ 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6,
+ 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00,
+/* 0xa8 */ 0x00, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xa9 */ 0x00, 0x7c, 0xc6, 0x82, 0x9a, 0xa6, 0xa2, 0xa6,
+ 0x9a, 0x82, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xaa */ 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xab */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8,
+ 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xac */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06,
+ 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xad */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xae */ 0x00, 0x7c, 0xc6, 0x82, 0xba, 0xa6, 0xba, 0xaa,
+ 0xa6, 0x82, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xaf */ 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xb0 */ 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xb1 */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18,
+ 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
+/* 0xb2 */ 0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xb3 */ 0x00, 0x70, 0xd8, 0x30, 0x30, 0xd8, 0x70, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xb4 */ 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xb5 */ 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
+/* 0xb6 */ 0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b,
+ 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00,
+/* 0xb7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xb8 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0x00,
+/* 0xb9 */ 0x00, 0x30, 0x70, 0xf0, 0x30, 0x30, 0x78, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xba */ 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xbb */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36,
+ 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xbc */ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30,
+ 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00, 0x00,
+/* 0xbd */ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30,
+ 0x60, 0xdc, 0x86, 0x0c, 0x18, 0x3e, 0x00, 0x00,
+/* 0xbe */ 0x00, 0xc0, 0x60, 0xc2, 0x66, 0xcc, 0x18, 0x30,
+ 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00, 0x00,
+/* 0xbf */ 0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60,
+ 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xc0 */ 0x18, 0x0c, 0x06, 0x00, 0x38, 0x6c, 0xc6, 0xc6,
+ 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 0xc1 */ 0x18, 0x30, 0x60, 0x00, 0x38, 0x6c, 0xc6, 0xc6,
+ 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 0xc2 */ 0x10, 0x38, 0x6c, 0x00, 0x38, 0x6c, 0xc6, 0xc6,
+ 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 0xc3 */ 0x76, 0xdc, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6,
+ 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 0xc4 */ 0xc6, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6,
+ 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 0xc5 */ 0x38, 0x6c, 0x38, 0x00, 0x38, 0x6c, 0xc6, 0xc6,
+ 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 0xc6 */ 0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc,
+ 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00,
+/* 0xc7 */ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0,
+ 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00,
+/* 0xc8 */ 0x18, 0x0c, 0x06, 0x00, 0xfe, 0x66, 0x60, 0x7c,
+ 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
+/* 0xc9 */ 0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c,
+ 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
+/* 0xca */ 0x10, 0x38, 0x6c, 0x00, 0xfe, 0x66, 0x60, 0x7c,
+ 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
+/* 0xcb */ 0x00, 0xc6, 0x00, 0xfe, 0x66, 0x60, 0x60, 0x7c,
+ 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
+/* 0xcc */ 0x18, 0x0c, 0x06, 0x00, 0x3c, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 0xcd */ 0x18, 0x30, 0x60, 0x00, 0x3c, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 0xce */ 0x10, 0x38, 0x6c, 0x00, 0x3c, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 0xcf */ 0x00, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 0xd0 */ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0xf6, 0x66,
+ 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00,
+/* 0xd1 */ 0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde,
+ 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
+/* 0xd2 */ 0x18, 0x0c, 0x06, 0x00, 0x7c, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xd3 */ 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xd4 */ 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xd5 */ 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xd6 */ 0xc6, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xd7 */ 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38,
+ 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xd8 */ 0x00, 0x06, 0x7e, 0xce, 0xce, 0xce, 0xd6, 0xd6,
+ 0xe6, 0xe6, 0xe6, 0xfc, 0xc0, 0x00, 0x00, 0x00,
+/* 0xd9 */ 0x18, 0x0c, 0x06, 0x00, 0xc6, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xda */ 0x18, 0x30, 0x60, 0x00, 0xc6, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xdb */ 0x10, 0x38, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xdc */ 0xc6, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xdd */ 0x18, 0x30, 0x60, 0x00, 0x66, 0x66, 0x66, 0x3c,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 0xde */ 0x00, 0xf0, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x7c,
+ 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
+/* 0xdf */ 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc,
+ 0xc6, 0xc6, 0xc6, 0xcc, 0x00, 0x00, 0x00, 0x00,
+/* 0xe0 */ 0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* 0xe1 */ 0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* 0xe2 */ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* 0xe3 */ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x78, 0x0c, 0x7c,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* 0xe4 */ 0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* 0xe5 */ 0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* 0xe6 */ 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xb2, 0x32,
+ 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00,
+/* 0xe7 */ 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60,
+ 0x66, 0x3c, 0x0c, 0x06, 0x3c, 0x00, 0x00, 0x00,
+/* 0xe8 */ 0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe,
+ 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xe9 */ 0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe,
+ 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xea */ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe,
+ 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xeb */ 0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xfe,
+ 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xec */ 0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 0xed */ 0x00, 0x0c, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 0xee */ 0x00, 0x18, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 0xef */ 0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
+/* 0xf0 */ 0x00, 0x00, 0x3e, 0x30, 0x18, 0x7c, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xf1 */ 0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
+/* 0xf2 */ 0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xf3 */ 0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xf4 */ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xf5 */ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xf6 */ 0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
+/* 0xf7 */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e,
+ 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0xf8 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x7e, 0xce, 0xce,
+ 0xd6, 0xe6, 0xe6, 0xfc, 0xc0, 0x00, 0x00, 0x00,
+/* 0xf9 */ 0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* 0xfa */ 0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* 0xfb */ 0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* 0xfc */ 0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc,
+ 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
+/* 0xfd */ 0x00, 0x18, 0x30, 0x60, 0x00, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00,
+/* 0xfe */ 0x00, 0x00, 0x00, 0xf0, 0x60, 0x7c, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00,
+/* 0xff */ 0x00, 0xc6, 0xc6, 0x00, 0x00, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00
+};
diff --git a/sys/dev/ic/vgafb.c b/sys/dev/ic/vgafb.c
new file mode 100644
index 00000000000..8bda3471d3a
--- /dev/null
+++ b/sys/dev/ic/vgafb.c
@@ -0,0 +1,530 @@
+/* $OpenBSD: vgafb.c,v 1.1 1998/09/27 03:55:59 rahnds Exp $ */
+/* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 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 <machine/bus.h>
+
+#include <dev/wscons/wsconsvar.h>
+#include <dev/ic/vgafbvar.h>
+
+
+struct cfdriver vgafb_cd = {
+ NULL, "vgafb", DV_DULL,
+};
+
+void vgafb_cursor __P((void *, int, int, int));
+void vgafb_putstr __P((void *, int, int, char *, int));
+void vgafb_copycols __P((void *, int, int, int, int));
+void vgafb_erasecols __P((void *, int, int, int));
+void vgafb_copyrows __P((void *, int, int, int));
+void vgafb_eraserows __P((void *, int, int));
+void vgafb_set_attr __P((void *, int));
+
+static void drawChar ( struct vgafb_config *vc, char ch, int cx,
+ int cy, char at);
+static void setPixel( struct vgafb_config *vc, int x, int y, int v);
+static void vgafb_invert_char ( struct vgafb_config *vc, int cx, int cy);
+extern const char fontdata_8x16[];
+
+struct wscons_emulfuncs vgafb_emulfuncs = {
+ vgafb_cursor,
+ vgafb_putstr,
+ vgafb_copycols,
+ vgafb_erasecols,
+ vgafb_copyrows,
+ vgafb_eraserows,
+ vgafb_set_attr,
+};
+
+int vgafb_print __P((void *, const char *));
+
+#define FONT_WIDTH 8
+#define FONT_HEIGHT 16
+
+/*
+ * The following functions implement back-end configuration grabbing
+ * and attachment.
+ */
+int
+vgafb_common_probe(iot, memt, iobase, membase, memsize)
+ bus_space_tag_t iot, memt;
+ u_int32_t iobase, membase;
+ size_t memsize;
+{
+ bus_space_handle_t ioh_b, ioh_c, ioh_d, memh;
+ u_int16_t vgadata;
+ int gotio_b, gotio_c, gotio_d, gotmem, rv;
+ int width;
+
+ gotio_b = gotio_c = gotio_d = gotmem = rv = 0;
+
+ if (bus_space_map(iot, iobase+0x3b0, 0xc, 0, &ioh_b))
+ goto bad;
+ gotio_b = 1;
+ if (bus_space_map(iot, iobase+0x3c0, 0x10, 0, &ioh_c))
+ goto bad;
+ gotio_c = 1;
+ if (bus_space_map(iot, iobase+0x3d0, 0x10, 0, &ioh_d))
+ goto bad;
+ gotio_d = 1;
+ if (bus_space_map(memt, membase, memsize, 0, &memh))
+ goto bad;
+ gotmem = 1;
+
+#if 0
+ /* CR1 - Horiz. Display End */
+ bus_space_write_1(iot, ioh_d, 4, 0x1);
+ width = bus_space_read_1(iot, ioh_d, 5);
+ /* this is not bit width yet */
+
+ /* use CR17 - mode control for this?? */
+ if ((width != 0xff) && (width < 600)) {
+ /* not accessable or in graphics mode? */
+ goto bad;
+ }
+#endif
+
+ vgadata = bus_space_read_2(memt, memh, 0);
+ bus_space_write_2(memt, memh, 0, 0xa55a);
+ rv = (bus_space_read_2(memt, memh, 0) == 0xa55a);
+ bus_space_write_2(memt, memh, 0, vgadata);
+
+bad:
+ if (gotio_b)
+ bus_space_unmap(iot, ioh_b, 0xc);
+ if (gotio_c)
+ bus_space_unmap(iot, ioh_c, 0x10);
+ if (gotio_d)
+ bus_space_unmap(iot, ioh_d, 0x10);
+ if (gotmem)
+ bus_space_unmap(memt, memh, memsize);
+
+ return (rv);
+}
+
+void
+vgafb_common_setup(iot, memt, vc, iobase, membase, memsize)
+ bus_space_tag_t iot, memt;
+ struct vgafb_config *vc;
+ u_int32_t iobase, membase;
+ size_t memsize;
+{
+ int cpos;
+ int width, height;
+
+ vc->vc_iot = iot;
+ vc->vc_memt = memt;
+
+ if (bus_space_map(vc->vc_iot, iobase+0x3b0, 0xc, 0, &vc->vc_ioh_b))
+ panic("vgafb_common_setup: couldn't map io b");
+ if (bus_space_map(vc->vc_iot, iobase+0x3c0, 0x10, 0, &vc->vc_ioh_c))
+ panic("vgafb_common_setup: couldn't map io c");
+ if (bus_space_map(vc->vc_iot, iobase+0x3d0, 0x10, 0, &vc->vc_ioh_d))
+ panic("vgafb_common_setup: couldn't map io d");
+ if (bus_space_map(vc->vc_memt, membase, memsize, 0, &vc->vc_memh))
+ panic("vgafb_common_setup: couldn't map memory");
+
+ /* CR1 - Horiz. Display End */
+ bus_space_write_1(iot, vc->vc_ioh_d, 4, 0x1);
+ width = bus_space_read_1(iot, vc->vc_ioh_d, 5);
+ /* (stored value + 1) * depth -> pixel width */
+ width = ( width + 1 ) * 8;
+ vc->vc_ncol = width / FONT_WIDTH;
+
+ /* CR1 - Horiz. Display End */
+ bus_space_write_1(iot, vc->vc_ioh_d, 4, 0x12);
+ {
+ u_int8_t t1, t2, t3;
+ bus_space_write_1(iot, vc->vc_ioh_d, 4, 0x12);
+ t1 = bus_space_read_1(iot, vc->vc_ioh_d, 5);
+
+ bus_space_write_1(iot, vc->vc_ioh_d, 4, 0x7);
+ t2 = bus_space_read_1(iot, vc->vc_ioh_d, 5);
+ height = t1 + ((t2&0x40) << 3)
+ + ((t2&0x02) << 7) + 1;
+ bus_space_write_1(iot, vc->vc_ioh_d, 4, 0x17);
+ t3 = bus_space_read_1(iot, vc->vc_ioh_d, 5);
+ if (t3 & 0x04) {
+ height *= 2;
+ }
+ }
+ vc->vc_nrow = height / FONT_HEIGHT;
+
+ printf("col %d row %d\n", vc->vc_ncol, vc->vc_nrow );
+#if 0
+ /* assume resolution is 640x480 */
+ vc->vc_nrow = 25;
+ vc->vc_ncol = 80;
+
+ bus_space_write_1(iot, vc->vc_ioh_d, VGA_IO_D_6845_ADDR, 14);
+ cpos = bus_space_read_1(iot, vc->vc_ioh_d, VGA_IO_D_6845_DATA) << 8;
+ bus_space_write_1(iot, vc->vc_ioh_d, VGA_IO_D_6845_ADDR, 15);
+ cpos |= bus_space_read_1(iot, vc->vc_ioh_d, VGA_IO_D_6845_DATA);
+ vc->vc_crow = cpos / vc->vc_ncol;
+ vc->vc_ccol = cpos % vc->vc_ncol;
+#endif
+
+ vc->vc_so = 0;
+
+ /* clear screen, frob cursor, etc.? */
+ vgafb_eraserows(vc, 0, vc->vc_nrow);
+#if defined(alpha)
+ /*
+ * XXX DEC HAS SWITCHED THE CODES FOR BLUE AND RED!!!
+ * XXX Therefore, though the comments say "blue bg", the code uses
+ * XXX the value for a red background!
+ */
+ vc->vc_at = 0x40 | 0x0f; /* blue bg|white fg */
+ vc->vc_so_at = 0x40 | 0x0f | 0x80; /* blue bg|white fg|blink */
+#else
+ vc->vc_at = 0x00 | 0xf; /* black bg|white fg */
+ vc->vc_so_at = 0x00 | 0xf | 0x80; /* black bg|white fg|blink */
+#endif
+}
+
+void
+vgafb_wscons_attach(parent, vc, console)
+ struct device *parent;
+ struct vgafb_config *vc;
+ int console;
+{
+ struct wscons_attach_args waa;
+ struct wscons_odev_spec *wo;
+
+ waa.waa_isconsole = console;
+ wo = &waa.waa_odev_spec;
+
+ wo->wo_emulfuncs = &vgafb_emulfuncs;
+ wo->wo_emulfuncs_cookie = vc;
+
+ wo->wo_ioctl = vc->vc_ioctl;
+ wo->wo_mmap = vc->vc_mmap;
+ wo->wo_miscfuncs_cookie = vc;
+
+ wo->wo_nrows = vc->vc_nrow;
+ wo->wo_ncols = vc->vc_ncol;
+ wo->wo_crow = vc->vc_crow;
+ wo->wo_ccol = vc->vc_ccol;
+
+ config_found(parent, &waa, vgafb_print);
+}
+
+void
+vgafb_wscons_console(vc)
+ struct vgafb_config *vc;
+{
+ struct wscons_odev_spec wo;
+
+ wo.wo_emulfuncs = &vgafb_emulfuncs;
+ wo.wo_emulfuncs_cookie = vc;
+
+ /* ioctl and mmap are unused until real attachment. */
+
+ wo.wo_nrows = vc->vc_nrow;
+ wo.wo_ncols = vc->vc_ncol;
+ wo.wo_crow = vc->vc_crow;
+ wo.wo_ccol = vc->vc_ccol;
+
+ wscons_attach_console(&wo);
+}
+
+int
+vgafb_print(aux, pnp)
+ void *aux;
+ const char *pnp;
+{
+
+ if (pnp)
+ printf("wscons at %s", pnp);
+ return (UNCONF);
+}
+
+int
+vgafbioctl(v, cmd, data, flag, p)
+ void *v;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ /*struct vgafb_config *vc = v;*/
+
+ /* XXX */
+ return -1;
+}
+
+int
+vgafbmmap(v, offset, prot)
+ void *v;
+ off_t offset;
+ int prot;
+{
+ struct vgafb_config *vc = v;
+ bus_space_handle_t h;
+ u_int32_t *port;
+
+ if (offset >= 0x00000 && offset < 0x100000) /* 1MB of mem */
+ h = vc->vc_memh + offset;
+ else if (offset >= 0x10000 && offset < 0x140000) /* 256KB of iohb */
+ h = vc->vc_ioh_b;
+ else if (offset >= 0x140000 && offset < 0x180000) /* 256KB of iohc */
+ h = vc->vc_ioh_c;
+ else if (offset >= 0x180000 && offset < 0x1c0000) /* 256KB of iohd */
+ h = vc->vc_ioh_d;
+ else
+ return (-1);
+
+ port = (u_int32_t *)(h << 5);
+#ifdef alpha
+ return alpha_btop(port); /* XXX */
+#elif defined(i386)
+ return i386_btop(port);
+#elif defined(__powerpc__)
+ return powerpc_btop(port);
+#endif
+}
+
+/*
+ * The following functions implement the MI ANSI terminal emulation on
+ * a VGA display.
+ */
+void
+vgafb_cursor(id, on, row, col)
+ void *id;
+ int on, row, col;
+{
+ struct vgafb_config *vc = id;
+ bus_space_tag_t iot = vc->vc_iot;
+ bus_space_handle_t ioh_d = vc->vc_ioh_d;
+ int pos;
+
+#if 0
+ printf("vgafb_cursor: %d %d\n", row, col);
+#endif
+ if (( vc->vc_crow != -1) && (vc->vc_ccol != -1)) {
+ vgafb_invert_char (vc, vc->vc_ccol, vc->vc_crow);
+ }
+ /* turn the cursor off */
+ if (!on) {
+ /* XXX disable cursor how??? */
+ vc->vc_crow = vc->vc_ccol = -1;
+ } else {
+ vc->vc_crow = row;
+
+ vc->vc_ccol = col;
+ vgafb_invert_char (vc, col, row);
+ }
+
+#if 0
+ pos = row * vc->vc_ncol + col;
+
+ bus_space_write_1(iot, ioh_d, VGA_IO_D_6845_ADDR, 14);
+ bus_space_write_1(iot, ioh_d, VGA_IO_D_6845_DATA, pos >> 8);
+ bus_space_write_1(iot, ioh_d, VGA_IO_D_6845_ADDR, 15);
+ bus_space_write_1(iot, ioh_d, VGA_IO_D_6845_DATA, pos);
+#endif
+}
+
+void
+vgafb_putstr(id, row, col, cp, len)
+ void *id;
+ int row, col;
+ char *cp;
+ int len;
+{
+ struct vgafb_config *vc = id;
+ bus_space_tag_t memt = vc->vc_memt;
+ bus_space_handle_t memh = vc->vc_memh;
+ int i, off;
+
+ for (i = 0; i < len; i++, cp++, col++) {
+ drawChar(vc, *cp, col, row, vc->vc_so ? vc->vc_so_at : vc->vc_at);
+ }
+}
+
+void
+vgafb_copycols(id, row, srccol, dstcol, ncols)
+ void *id;
+ int row, srccol, dstcol, ncols;
+{
+ struct vgafb_config *vc = id;
+ bus_size_t srcoff, dstoff;
+ int i;
+
+ srcoff = ((row*FONT_HEIGHT) * (vc->vc_ncol*FONT_WIDTH)
+ + srccol*FONT_WIDTH);
+ dstoff = ((row*FONT_HEIGHT) * (vc->vc_ncol*FONT_WIDTH)
+ + dstcol*FONT_WIDTH);
+ for (i = 0; i < FONT_HEIGHT; i++) {
+ bus_space_copy_1(vc->vc_memt, vc->vc_memh, srcoff,
+ vc->vc_memh, dstoff, ncols*FONT_WIDTH);
+ }
+}
+
+void
+vgafb_erasecols(id, row, startcol, ncols)
+ void *id;
+ int row, startcol, ncols;
+{
+ struct vgafb_config *vc = id;
+ bus_size_t off;
+ int i;
+
+ for (i=0; i < ncols; i++) {
+ drawChar( vc, ' ', startcol+i, row, vc->vc_at);
+ }
+}
+
+void
+vgafb_copyrows(id, srcrow, dstrow, nrows)
+ void *id;
+ int srcrow, dstrow, nrows;
+{
+ struct vgafb_config *vc = id;
+ bus_size_t srcoff, dstoff;
+
+ srcoff = ((srcrow*FONT_HEIGHT) * (vc->vc_ncol*FONT_WIDTH) + 0);
+ dstoff = ((dstrow*FONT_HEIGHT) * (vc->vc_ncol*FONT_WIDTH) + 0);
+
+ bus_space_copy_1(vc->vc_memt, vc->vc_memh, srcoff, vc->vc_memh, dstoff,
+ (nrows*FONT_HEIGHT) * (vc->vc_ncol*FONT_WIDTH));
+}
+
+void
+vgafb_eraserows(id, startrow, nrows)
+ void *id;
+ int startrow, nrows;
+{
+ struct vgafb_config *vc = id;
+ bus_size_t off, count;
+ u_int16_t val;
+
+ off = (startrow*FONT_HEIGHT) * (vc->vc_ncol*FONT_WIDTH) + 0;
+ count = (nrows*FONT_HEIGHT) * (vc->vc_ncol*FONT_WIDTH);
+
+ val = (vc->vc_at & 0xf);
+
+ bus_space_set_region_1(vc->vc_memt, vc->vc_memh, off, val, count);
+}
+
+void
+vgafb_set_attr(id, val)
+ void *id;
+ int val;
+{
+ struct vgafb_config *vc = id;
+
+ vc->vc_so = val;
+}
+
+static void
+setPixel(vc, x, y, v)
+ struct vgafb_config *vc;
+ int x, y, v;
+{
+ bus_space_tag_t memt = vc->vc_memt;
+ bus_space_handle_t memh = vc->vc_memh;
+
+ bus_space_write_1(memt, memh, x+(y*(vc->vc_ncol*FONT_WIDTH)), v);
+}
+static void
+invertPixel(vc, x, y)
+ struct vgafb_config *vc;
+ int x, y;
+{
+ bus_space_tag_t memt = vc->vc_memt;
+ bus_space_handle_t memh = vc->vc_memh;
+ u_int8_t v;
+
+ v = bus_space_read_1(memt, memh, x+(y*(vc->vc_ncol*FONT_WIDTH)));
+ v = ~v & 0xf;
+ bus_space_write_1(memt, memh, x+(y*(vc->vc_ncol*FONT_WIDTH)), v);
+}
+
+static void
+drawChar ( vc, ch, cx, cy, at)
+ struct vgafb_config *vc;
+ char ch;
+ int cx, cy;
+ char at;
+{
+ const char *cp;
+ unsigned char mask;
+ int i, j;
+ int x, y;
+
+ i = ch * FONT_HEIGHT;
+ cp = &fontdata_8x16[ i ];
+
+ if ((cx == vc->vc_ccol) && (cy == vc->vc_crow)) {
+ char tmp = at;
+ at = ((at & 0xf) << 4) | ((at >> 4) & 0xf);
+ }
+ x = cx*FONT_WIDTH; y = cy*FONT_HEIGHT;
+
+ for ( i = 0; i < FONT_HEIGHT; i++ )
+ {
+ for ( j = 0; j < FONT_WIDTH; j++)
+ {
+ mask = 0x80 >> j;
+ if ( *cp & mask )
+ setPixel(vc, x, y, (at >> 4) & 0xf );
+ else
+ setPixel(vc, x, y, at & 0xf );
+ x++;
+ }
+ cp++; y++; x = cx*FONT_WIDTH;
+ }
+}
+static void
+vgafb_invert_char ( vc, cx, cy)
+ struct vgafb_config *vc;
+ int cx, cy;
+{
+ const char *cp;
+ unsigned char mask;
+ int i, j;
+ int x, y;
+
+ x = cx*FONT_WIDTH; y = cy*FONT_HEIGHT;
+
+ for ( i = 0; i < FONT_HEIGHT; i++ )
+ {
+ for ( j = 0; j < FONT_WIDTH; j++)
+ {
+ invertPixel(vc, x, y);
+ x++;
+ }
+ cp++; y++; x = cx*FONT_WIDTH;
+ }
+}
diff --git a/sys/dev/ic/vgafbvar.h b/sys/dev/ic/vgafbvar.h
new file mode 100644
index 00000000000..4629a2ac337
--- /dev/null
+++ b/sys/dev/ic/vgafbvar.h
@@ -0,0 +1,61 @@
+/* $OpenBSD: vgafbvar.h,v 1.1 1998/09/27 03:55:59 rahnds Exp $ */
+/* $NetBSD: vgavar.h,v 1.2 1996/11/23 06:06:43 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.
+ */
+
+struct vgafb_config {
+ /*
+ * Filled in by front-ends.
+ */
+ bus_space_tag_t vc_iot, vc_memt;
+ bus_space_handle_t vc_ioh_b, vc_ioh_c, vc_ioh_d, vc_memh;
+
+ /*
+ * Private to back-end.
+ */
+ int vc_ncol, vc_nrow; /* screen width & height */
+ int vc_ccol, vc_crow; /* current cursor position */
+
+ char vc_so; /* in standout mode? */
+ char vc_at; /* normal attributes */
+ char vc_so_at; /* standout attributes */
+
+ int (*vc_ioctl) __P((void *, u_long,
+ caddr_t, int, struct proc *));
+ int (*vc_mmap) __P((void *, off_t, int));
+
+};
+
+int vgafb_common_probe __P((bus_space_tag_t, bus_space_tag_t, u_int32_t,
+ u_int32_t, size_t ));
+void vgafb_common_setup __P((bus_space_tag_t, bus_space_tag_t,
+ struct vgafb_config *, u_int32_t, u_int32_t, size_t));
+void vgafb_wscons_attach __P((struct device *, struct vgafb_config *, int));
+void vgafb_wscons_console __P((struct vgafb_config *));
+int vgafbioctl __P((void *, u_long, caddr_t, int, struct proc *));
+int vgafbmmap __P((void *, off_t, int));
diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci
index 2b7f5a524d4..f4ad2f30d94 100644
--- a/sys/dev/pci/files.pci
+++ b/sys/dev/pci/files.pci
@@ -1,4 +1,4 @@
-# $OpenBSD: files.pci,v 1.23 1998/09/27 03:38:09 downsj Exp $
+# $OpenBSD: files.pci,v 1.24 1998/09/27 03:55:59 rahnds Exp $
# $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $
#
# Config.new file and device description for machine-independent PCI code.
@@ -14,6 +14,10 @@ file dev/pci/pci_subr.c pci
attach vga at pci with vga_pci
file dev/pci/vga_pci.c vga_pci needs-flag
+# Generic VGA Framebuffer version
+attach vgafb at pci with vgafb_pci
+file dev/pci/vgafb_pci.c vgafb_pci needs-flag
+
# Adaptec 3940, 2940, and aic78[5678]0 SCSI controllers
# device declaration in sys/conf/files
attach ahc at pci with ahc_pci
diff --git a/sys/dev/pci/vgafb_pci.c b/sys/dev/pci/vgafb_pci.c
new file mode 100644
index 00000000000..ec10ab78a41
--- /dev/null
+++ b/sys/dev/pci/vgafb_pci.c
@@ -0,0 +1,301 @@
+/* $OpenBSD: vgafb_pci.c,v 1.1 1998/09/27 03:55:59 rahnds Exp $ */
+/* $NetBSD: vga_pci.c,v 1.4 1996/12/05 01:39:38 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>
+
+#ifndef i386
+#include <machine/autoconf.h>
+#endif
+#include <machine/pte.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
+
+#include <dev/ic/vgafbvar.h>
+#include <dev/pci/vgafb_pcivar.h>
+
+struct vgafb_pci_softc {
+ struct device sc_dev;
+
+ pcitag_t sc_pcitag; /* PCI tag, in case we need it. */
+ struct vgafb_config *sc_vc; /* VGA configuration */
+};
+
+#ifdef __BROKEN_INDIRECT_CONFIG
+int vgafb_pci_match __P((struct device *, void *, void *));
+#else
+int vgafb_pci_match __P((struct device *, struct cfdata *, void *));
+#endif
+void vgafb_pci_attach __P((struct device *, struct device *, void *));
+
+int vgafbpcimmap __P((void *, off_t, int));
+int vgafbpciioctl __P((void *, u_long, caddr_t, int, struct proc *));
+
+struct cfattach vgafb_pci_ca = {
+ sizeof(struct vgafb_pci_softc), (cfmatch_t)vgafb_pci_match, vgafb_pci_attach,
+};
+
+pcitag_t vgafb_pci_console_tag;
+struct vgafb_config vgafb_pci_console_vc;
+
+int
+vgafb_pci_match(parent, match, aux)
+ struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
+{
+ struct pci_attach_args *pa = aux;
+ u_int32_t memaddr, memsize;
+ u_int32_t ioaddr, iosize;
+ int potential;
+
+ potential = 0;
+
+ /*
+ * If it's prehistoric/vga or display/vga, we might match.
+ * For the console device, this is jut a sanity check.
+ */
+ if (PCI_CLASS(pa->pa_class) == PCI_CLASS_PREHISTORIC &&
+ PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_PREHISTORIC_VGA)
+ potential = 1;
+ if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY &&
+ PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_VGA)
+ potential = 1;
+
+ if (!potential)
+ return (0);
+
+ /* If it's the console, we have a winner! */
+ if (!bcmp(&pa->pa_tag, &vgafb_pci_console_tag, sizeof(pa->pa_tag)))
+ return (1);
+
+ /*
+ * If we might match, make sure that the card actually looks OK.
+ */
+ memaddr=0xb8000; /* default to isa addresses? */
+ ioaddr = 0; /* default to isa addresses? */
+ /* needs to do something like the mem_find
+ * below in the ifdef powerpc code.
+ * should really be done in a machine independant way
+ */
+#ifdef powerpc
+ {
+ int retval;
+ u_int32_t cacheable;
+ pci_chipset_tag_t pc = pa->pa_pc;
+
+ retval = pci_mem_find(pc, pa->pa_tag, 0x10,
+ &memaddr, &memsize, &cacheable);
+ if (retval) {
+ printf(": couldn't find memory region\n");
+ return 0;
+ }
+ printf("vga pci_mem_find returned retval %x A %x S %x C%x\n",
+ retval, memaddr, memsize, cacheable);
+
+{
+ int s;
+ u_int32_t sizedata;
+ /*
+ * Open Firmware (yuck) shuts down devices before entering a
+ * program so we need to bring them back 'online' to respond
+ * to bus accesses... so far this is true on the power.4e.
+ */
+ s = splhigh();
+ sizedata = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+ sizedata |= (PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_IO_ENABLE |
+ PCI_COMMAND_PARITY_ENABLE | PCI_COMMAND_SERR_ENABLE);
+ pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, sizedata);
+ splx(s);
+}
+ ioaddr = 0;
+ }
+#endif
+ if (!vgafb_common_probe(pa->pa_iot, pa->pa_memt,
+ ioaddr, memaddr, memsize))
+ {
+ printf("vgafb_pci_match: common_probe failed\n");
+ return (0);
+ }
+
+ return (1);
+}
+
+void
+vgafb_pci_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct pci_attach_args *pa = aux;
+ struct vgafb_pci_softc *sc = (struct vgafb_pci_softc *)self;
+ struct vgafb_config *vc;
+ u_int32_t memaddr, memsize;
+ u_int32_t ioaddr, iosize;
+ int console;
+
+ memaddr=0xb8000; /* default to isa addresses? */
+ ioaddr = 0; /* default to isa addresses? */
+#ifdef powerpc
+ {
+ int retval;
+ u_int32_t cacheable;
+ pci_chipset_tag_t pc = pa->pa_pc;
+
+ retval = pci_mem_find(pc, pa->pa_tag, 0x10,
+ &memaddr, &memsize, &cacheable);
+ if (retval) {
+ printf(": couldn't find memory region\n");
+ return;
+ }
+ }
+ /* powerpc specific hack */
+{
+ int s;
+ u_int32_t sizedata;
+ pci_chipset_tag_t pc = pa->pa_pc;
+ /*
+ * Open Firmware (yuck) shuts down devices before entering a
+ * program so we need to bring them back 'online' to respond
+ * to bus accesses... so far this is true on the power.4e.
+ */
+ s = splhigh();
+ sizedata = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+ sizedata |= (PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_IO_ENABLE |
+ PCI_COMMAND_PARITY_ENABLE | PCI_COMMAND_SERR_ENABLE);
+ pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, sizedata);
+ splx(s);
+}
+ ioaddr = 0;
+#endif
+ console = (!bcmp(&pa->pa_tag, &vgafb_pci_console_tag, sizeof(pa->pa_tag)));
+ if (console)
+ vc = sc->sc_vc = &vgafb_pci_console_vc;
+ else {
+ vc = sc->sc_vc = (struct vgafb_config *)
+ malloc(sizeof(struct vgafb_config), M_DEVBUF, M_WAITOK);
+
+ /* set up bus-independent VGA configuration */
+ vgafb_common_setup(pa->pa_iot, pa->pa_memt, vc,
+ ioaddr, memaddr, memsize);
+ }
+ vc->vc_mmap = vgafbpcimmap;
+ vc->vc_ioctl = vgafbpciioctl;
+
+ sc->sc_pcitag = pa->pa_tag;
+
+ printf("\n");
+
+ vgafb_wscons_attach(self, vc, console);
+}
+
+void
+vgafb_pci_console(iot, memt, pc, bus, device, function)
+ bus_space_tag_t iot, memt;
+ pci_chipset_tag_t pc;
+ int bus, device, function;
+{
+ struct vgafb_config *vc = &vgafb_pci_console_vc;
+ u_int32_t memaddr, memsize;
+ u_int32_t ioaddr, iosize;
+
+ /* for later recognition */
+ vgafb_pci_console_tag = pci_make_tag(pc, bus, device, function);
+
+/* XXX probe pci before pci bus config? */
+#if 0
+ int retval;
+ u_int32_t cacheable;
+ pci_chipset_tag_t pc = pa->pa_pc;
+
+ retval = pci_mem_find(pc, pa->pa_tag, 0x10,
+ &memaddr, &memsize, &cacheable);
+ if (retval) {
+ printf(": couldn't find memory region\n");
+ return 0;
+ }
+ printf("vga pci_mem_find returned retval %x A %x S %x C%x\n",
+ retval, memaddr, memsize, cacheable);
+
+{
+ int s;
+ u_int32_t sizedata;
+ /*
+ * Open Firmware (yuck) shuts down devices before entering a
+ * program so we need to bring them back 'online' to respond
+ * to bus accesses... so far this is true on the power.4e.
+ */
+ s = splhigh();
+ sizedata = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+ sizedata |= (PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_IO_ENABLE |
+ PCI_COMMAND_PARITY_ENABLE | PCI_COMMAND_SERR_ENABLE);
+ pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, sizedata);
+ splx(s);
+}
+ ioaddr = 0;
+#endif
+
+ /* set up bus-independent VGA configuration */
+ vgafb_common_setup(iot, memt, vc, ioaddr, memaddr, memsize);
+
+ vgafb_wscons_console(vc);
+}
+
+int
+vgafbpciioctl(v, cmd, data, flag, p)
+ void *v;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ struct vgafb_pci_softc *sc = v;
+
+ return (vgaioctl(sc->sc_vc, cmd, data, flag, p));
+}
+
+int
+vgafbpcimmap(v, offset, prot)
+ void *v;
+ off_t offset;
+ int prot;
+{
+ struct vgafb_pci_softc *sc = v;
+
+ return (vgammap(sc->sc_vc, offset, prot));
+}
diff --git a/sys/dev/pci/vgafb_pcivar.h b/sys/dev/pci/vgafb_pcivar.h
new file mode 100644
index 00000000000..836dca2897d
--- /dev/null
+++ b/sys/dev/pci/vgafb_pcivar.h
@@ -0,0 +1,38 @@
+/* $OpenBSD: vgafb_pcivar.h,v 1.1 1998/09/27 03:55:59 rahnds Exp $ */
+/* $NetBSD: vga_pcivar.h,v 1.1 1996/11/19 04:38:36 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.
+ */
+
+#define DEVICE_IS_VGA_PCI(class, id) \
+ (((PCI_CLASS(class) == PCI_CLASS_DISPLAY && \
+ PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_VGA) || \
+ (PCI_CLASS(class) == PCI_CLASS_PREHISTORIC && \
+ PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA)) ? 1 : 0)
+
+void vgafb_pci_console __P((bus_space_tag_t, bus_space_tag_t,
+ pci_chipset_tag_t, int, int, int));