Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arc vga/pckbc attachment for Jazz-Internal Bus of M...



details:   https://anonhg.NetBSD.org/src/rev/c1b16f81f8ab
branches:  trunk
changeset: 488059:c1b16f81f8ab
user:      soda <soda%NetBSD.org@localhost>
date:      Sat Jun 17 07:17:36 2000 +0000

description:
vga/pckbc attachment for Jazz-Internal Bus of Magnum derived machines
(including Pica, NEC RISCstation/RISCserver).

diffstat:

 sys/arch/arc/conf/files.arc         |   20 +++-
 sys/arch/arc/jazz/pckbc_jazzio.c    |  181 ++++++++++++++++++++++++++++++++++++
 sys/arch/arc/jazz/pckbc_jazzioreg.h |    3 +
 sys/arch/arc/jazz/vga_jazzio.c      |  147 +++++++++++++++++++++++++++++
 sys/arch/arc/jazz/vga_jazziovar.h   |   31 ++++++
 5 files changed, 380 insertions(+), 2 deletions(-)

diffs (truncated from 419 to 300 lines):

diff -r c6c077c84587 -r c1b16f81f8ab sys/arch/arc/conf/files.arc
--- a/sys/arch/arc/conf/files.arc       Sat Jun 17 07:11:50 2000 +0000
+++ b/sys/arch/arc/conf/files.arc       Sat Jun 17 07:17:36 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.arc,v 1.21 2000/06/09 05:33:03 soda Exp $
+#      $NetBSD: files.arc,v 1.22 2000/06/17 07:17:36 soda Exp $
 #      $OpenBSD: files.arc,v 1.21 1999/09/11 10:20:20 niklas Exp $
 #
 # maxpartitions must be first item in files.${ARCH}
@@ -118,6 +118,22 @@
 file   arch/arc/dev/fd.c               fdc     needs-flag
 major  {fd = 7}
 
+#      bus independent raster console glue
+device rasdisplay: wsemuldisplaydev, pcdisplayops
+file   arch/arc/dev/rasdisplay.c       rasdisplay
+
+#      raster console glue on PICA bus
+attach rasdisplay at pica with rasdisplay_jazzio
+file   arch/arc/jazz/rasdisplay_jazzio.c rasdisplay_jazzio needs-flag
+
+#      VGA display driver on PICA bus
+attach vga at pica with vga_jazzio
+file   arch/arc/jazz/vga_jazzio.c      vga_jazzio needs-flag
+
+#      PC keyboard controller on PICA bus
+attach  pckbc at pica with pckbc_jazzio
+file    arch/arc/jazz/pckbc_jazzio.c   pckbc_jazzio needs-flag
+
 #
 #      Stock ISA bus support
 #
@@ -142,7 +158,7 @@
 attach pc at isa with pc_isa
 device opms: tty
 attach opms at pica
-file   arch/arc/dev/pccons.c           pc & (pc_pica | pc_isa) needs-flag
+file   arch/arc/dev/pccons.c   pc & (pc_pica | pc_isa | opms) needs-flag
 
 #      BusLogic BT-445C VLB SCSI Controller. Special on TYNE local bus.
 device btl: scsi
diff -r c6c077c84587 -r c1b16f81f8ab sys/arch/arc/jazz/pckbc_jazzio.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arc/jazz/pckbc_jazzio.c  Sat Jun 17 07:17:36 2000 +0000
@@ -0,0 +1,181 @@
+/* $NetBSD: pckbc_jazzio.c,v 1.1 2000/06/17 07:17:38 soda Exp $ */
+/* NetBSD: pckbc_isa.c,v 1.2 2000/03/23 07:01:35 thorpej Exp  */
+
+/*
+ * Copyright (c) 1998
+ *     Matthias Drochner.  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 for the NetBSD Project
+ *     by Matthias Drochner.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/proc.h>
+#include <sys/device.h>
+#include <sys/malloc.h> 
+#include <sys/errno.h>
+#include <sys/queue.h>
+#include <sys/lock.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+#include <arc/pica/pica.h>
+
+#include <dev/ic/i8042reg.h>
+#include <dev/ic/pckbcvar.h>
+#include <arc/jazz/pckbc_jazzioreg.h>
+
+#define PICA_KBCMDP    (PICA_SYS_KBD + JAZZIO_KBCMDP)
+
+int    pckbc_jazzio_match __P((struct device *, struct cfdata *, void *));
+void   pckbc_jazzio_attach __P((struct device *, struct device *, void *));
+void   pckbc_jazzio_intr_establish __P((struct pckbc_softc *, pckbc_slot_t));
+
+struct pckbc_jazzio_softc {
+       struct pckbc_softc sc_pckbc;
+
+       struct confargs *sc_ca[PCKBC_NSLOTS];
+};
+
+struct cfattach pckbc_jazzio_ca = {
+       sizeof(struct pckbc_jazzio_softc),
+       pckbc_jazzio_match, pckbc_jazzio_attach,
+};
+
+extern struct arc_bus_space pica_bus; /* XXX */
+
+int
+pckbc_jazzio_match(parent, match, aux)
+       struct device *parent;
+       struct cfdata *match;
+       void *aux;
+{
+       struct confargs *ca = aux;
+       bus_space_tag_t iot = &pica_bus;
+       bus_space_handle_t ioh_d, ioh_c;
+       bus_addr_t addr;
+       int res, ok = 1;
+
+       if(!BUS_MATCHNAME(ca, "pckbd"))
+               return(0);
+
+       addr = (bus_addr_t)BUS_CVTADDR(ca);
+       if (pckbc_is_console(iot, addr) == 0) {
+               if (bus_space_map(iot, addr + KBDATAP, 1, 0, &ioh_d))
+                       return (0);
+               if (bus_space_map(iot, PICA_KBCMDP, 1, 0, &ioh_c)) {
+                       bus_space_unmap(iot, ioh_d, 1);
+                       return (0);
+               }
+
+               /* flush KBC */
+               (void) pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0);
+
+               /* KBC selftest */
+               if (pckbc_send_cmd(iot, ioh_c, KBC_SELFTEST) == 0) {
+                       ok = 0;
+                       goto out;
+               }
+               res = pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0);
+               if (res != 0x55) {
+                       printf("kbc selftest: %x\n", res);
+                       ok = 0;
+               }
+ out:
+               bus_space_unmap(iot, ioh_d, 1);
+               bus_space_unmap(iot, ioh_c, 1);
+       }
+
+       return (ok);
+}
+
+void
+pckbc_jazzio_attach(parent, self, aux)
+       struct device *parent, *self;
+       void *aux;
+{
+       struct confargs *ca = aux;
+       struct pckbc_jazzio_softc *jsc = (void *)self;
+       struct pckbc_softc *sc = &jsc->sc_pckbc;
+       struct pckbc_internal *t;
+       bus_space_tag_t iot = &pica_bus;
+       bus_space_handle_t ioh_d, ioh_c;
+       bus_addr_t addr;
+       static struct confargs pms_ca = { "pms", 8, NULL, }; /* XXX */
+
+       sc->intr_establish = pckbc_jazzio_intr_establish;
+
+       /*
+        * To establish interrupt handler
+        *
+        * XXX handcrafting "aux" slot...
+        */
+       pms_ca.ca_bus = ca->ca_bus;
+       jsc->sc_ca[PCKBC_KBD_SLOT] = ca;
+       jsc->sc_ca[PCKBC_AUX_SLOT] = &pms_ca;
+
+       addr = (bus_addr_t)BUS_CVTADDR(ca);
+       if (pckbc_is_console(iot, addr)) {
+               t = &pckbc_consdata;
+               ioh_d = t->t_ioh_d;
+               ioh_c = t->t_ioh_c;
+               pckbc_console_attached = 1;
+               /* t->t_cmdbyte was initialized by cnattach */
+       } else {
+               if (bus_space_map(iot, addr + KBDATAP, 1, 0, &ioh_d) ||
+                   bus_space_map(iot, PICA_KBCMDP, 1, 0, &ioh_c))
+                       panic("pckbc_attach: couldn't map");
+
+               t = malloc(sizeof(struct pckbc_internal), M_DEVBUF, M_WAITOK);
+               bzero(t, sizeof(struct pckbc_internal));
+               t->t_iot = iot;
+               t->t_ioh_d = ioh_d;
+               t->t_ioh_c = ioh_c;
+               t->t_addr = addr;
+               t->t_cmdbyte = KC8_CPU; /* Enable ports */
+               callout_init(&t->t_cleanup);
+       }
+
+       t->t_sc = sc;
+       sc->id = t;
+
+       printf("\n");
+
+       /* Finish off the attach. */
+       pckbc_attach(sc);
+}
+
+void
+pckbc_jazzio_intr_establish(sc, slot)
+       struct pckbc_softc *sc;
+       pckbc_slot_t slot;
+{
+       struct pckbc_jazzio_softc *jsc = (void *) sc;
+
+       BUS_INTR_ESTABLISH(jsc->sc_ca[slot], pckbcintr, sc);
+}
diff -r c6c077c84587 -r c1b16f81f8ab sys/arch/arc/jazz/pckbc_jazzioreg.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arc/jazz/pckbc_jazzioreg.h       Sat Jun 17 07:17:36 2000 +0000
@@ -0,0 +1,3 @@
+/*     $NetBSD: pckbc_jazzioreg.h,v 1.1 2000/06/17 07:17:38 soda Exp $ */
+
+#define JAZZIO_KBCMDP  1
diff -r c6c077c84587 -r c1b16f81f8ab sys/arch/arc/jazz/vga_jazzio.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arc/jazz/vga_jazzio.c    Sat Jun 17 07:17:36 2000 +0000
@@ -0,0 +1,147 @@
+/* $NetBSD: vga_jazzio.c,v 1.1 2000/06/17 07:17:37 soda Exp $ */
+/* NetBSD: vga_isa.c,v 1.3 1998/06/12 18:45:48 drochner 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@localhost
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+
+#include <dev/ic/mc6845reg.h>
+#include <dev/ic/pcdisplayvar.h>
+#include <dev/ic/vgareg.h>
+#include <dev/ic/vgavar.h>
+#include <arc/pica/pica.h>
+#include <arc/jazz/vga_jazziovar.h>
+
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsdisplayvar.h>
+
+#define WSDISPLAY_TYPE_JAZZVGA WSDISPLAY_TYPE_PCIVGA   /* XXX not really */
+
+struct vga_jazzio_softc {
+       struct device sc_dev; 
+#if 0
+       struct vga_config *sc_vc;       /* VGA configuration */
+#endif
+};
+
+void   vga_jazzio_init_tag __P((bus_space_tag_t *, bus_space_tag_t *));
+int    vga_jazzio_mmap __P((void *, off_t, int));
+int    vga_jazzio_match __P((struct device *, struct cfdata *, void *));
+void   vga_jazzio_attach __P((struct device *, struct device *, void *));
+



Home | Main Index | Thread Index | Old Index