Module Name: src
Committed By: tsutsui
Date: Tue Feb 15 10:32:57 UTC 2011
Modified Files:
src/sys/arch/hp700/conf: GENERIC files.hp700
Added Files:
src/sys/arch/hp700/gsc: hil_gsc.c
src/sys/arch/hp700/include: hil_machdep.h
Log Message:
Add MI HIL (keyboard/mouse) support from OpenBSD.
Tested on 735/125 and ok'ed by skrll@.
To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/hp700/conf/GENERIC
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/hp700/conf/files.hp700
cvs rdiff -u -r0 -r1.1 src/sys/arch/hp700/gsc/hil_gsc.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/hp700/include/hil_machdep.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/hp700/conf/GENERIC
diff -u src/sys/arch/hp700/conf/GENERIC:1.105 src/sys/arch/hp700/conf/GENERIC:1.106
--- src/sys/arch/hp700/conf/GENERIC:1.105 Tue Nov 23 11:13:59 2010
+++ src/sys/arch/hp700/conf/GENERIC Tue Feb 15 10:32:56 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.105 2010/11/23 11:13:59 hannken Exp $
+# $NetBSD: GENERIC,v 1.106 2011/02/15 10:32:56 tsutsui Exp $
#
# GENERIC machine description file
#
@@ -23,7 +23,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel
-#ident "GENERIC-$Revision: 1.105 $"
+#ident "GENERIC-$Revision: 1.106 $"
maxusers 32 # estimated number of users
@@ -296,9 +296,10 @@
# Console Devices
# Human Interface Loop
-#hil* at gsc?
-#hkbd* at hil? code 0 # keyboard
-#hms* at hil? code 1 # mice & trackballs
+hil* at gsc? irq 1 # Human Interface Loop, kbd and mouse
+hilkbd* at hil? # keyboard, knob and buttons
+hilms* at hil? # mouse and tablets
+hilid* at hil? # ID module
# wscons
gsckbc* at gsc? # pc keyboard controller
@@ -306,8 +307,8 @@
pms* at gsckbc? # PS/2 mouse for wsmouse
wskbd* at pckbd? console ?
wsmouse* at pms? mux 0
-#wskbd* at hkbd? console ?
-#wsmouse* at hms? mux 0
+wskbd* at hilkbd? console ?
+wsmouse* at hilms? mux 0
wsdisplay* at sti?
# Serial Devices
Index: src/sys/arch/hp700/conf/files.hp700
diff -u src/sys/arch/hp700/conf/files.hp700:1.24 src/sys/arch/hp700/conf/files.hp700:1.25
--- src/sys/arch/hp700/conf/files.hp700:1.24 Tue Nov 9 12:24:47 2010
+++ src/sys/arch/hp700/conf/files.hp700 Tue Feb 15 10:32:56 2011
@@ -1,4 +1,4 @@
-# $NetBSD: files.hp700,v 1.24 2010/11/09 12:24:47 skrll Exp $
+# $NetBSD: files.hp700,v 1.25 2011/02/15 10:32:56 tsutsui Exp $
#
# $OpenBSD: files.hp700,v 1.31 2001/06/26 02:41:25 mickey Exp $
#
@@ -53,6 +53,11 @@
#
include "dev/eisa/files.eisa"
+#
+# HIL Human Interface Loop devices
+#
+include "dev/hil/files.hil"
+
#
# Gonzo System Connect Bus
@@ -213,9 +218,8 @@
attach oosiop at gsc with oosiop_gsc
file arch/hp700/gsc/oosiop_gsc.c oosiop_gsc
-device hil: tty
-attach hil at gsc
-file arch/hp700/gsc/hil.c hil
+attach hil at gsc with hil_gsc
+file arch/hp700/gsc/hil_gsc.c hil_gsc
device gsckbc: pckbport
attach gsckbc at gsc
Added files:
Index: src/sys/arch/hp700/gsc/hil_gsc.c
diff -u /dev/null src/sys/arch/hp700/gsc/hil_gsc.c:1.1
--- /dev/null Tue Feb 15 10:32:57 2011
+++ src/sys/arch/hp700/gsc/hil_gsc.c Tue Feb 15 10:32:56 2011
@@ -0,0 +1,99 @@
+/* $NetBSD: hil_gsc.c,v 1.1 2011/02/15 10:32:56 tsutsui Exp $ */
+/* $OpenBSD: hil_gsc.c,v 1.5 2005/12/22 07:09:52 miod Exp $ */
+/*
+ * Copyright (c) 2003, Miodrag Vallat.
+ * 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.
+ *
+ * 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/device.h>
+#include <sys/cpu.h>
+#include <sys/bus.h>
+
+#include <machine/intr.h>
+#include <machine/iomod.h>
+#include <machine/autoconf.h>
+
+#include <hp700/dev/cpudevs.h>
+#include <hp700/gsc/gscbusvar.h>
+#include <hp700/hp700/machdep.h>
+
+#include <machine/hil_machdep.h>
+
+#include <dev/hil/hilvar.h>
+
+int hil_gsc_match(device_t, cfdata_t, void *);
+void hil_gsc_attach(device_t, device_t, void *);
+
+struct hil_gsc_softc {
+ struct hil_softc sc_hs;
+ int sc_hil_console;
+ void *sc_ih;
+};
+
+CFATTACH_DECL_NEW(hil_gsc, sizeof(struct hil_gsc_softc),
+ hil_gsc_match, hil_gsc_attach, NULL, NULL);
+
+int
+hil_gsc_match(device_t parent, cfdata_t cf, void *aux)
+{
+ struct gsc_attach_args *ga = aux;
+
+ if (ga->ga_type.iodc_type != HPPA_TYPE_FIO ||
+ ga->ga_type.iodc_sv_model != HPPA_FIO_HIL)
+ return (0);
+
+ return (1);
+}
+
+void
+hil_gsc_attach(device_t parent, device_t self, void *aux)
+{
+ struct hil_gsc_softc *gsc = device_private(self);
+ struct hil_softc *sc = &gsc->sc_hs;
+ struct gsc_attach_args *ga = aux;
+ int pagezero_cookie;
+
+ sc->sc_dev = self;
+ sc->sc_bst = ga->ga_iot;
+ if (bus_space_map(ga->ga_iot, ga->ga_hpa,
+ HILMAPSIZE, 0, &sc->sc_bsh)) {
+ printf(": couldn't map hil controller\n");
+ return;
+ }
+
+ pagezero_cookie = hp700_pagezero_map();
+ gsc->sc_hil_console = ga->ga_dp.dp_mod == PAGE0->mem_kbd.pz_dp.dp_mod &&
+ memcmp(ga->ga_dp.dp_bc, PAGE0->mem_kbd.pz_dp.dp_bc, 6) == 0;
+ hp700_pagezero_unmap(pagezero_cookie);
+
+ hil_attach(sc, &gsc->sc_hil_console);
+
+ gsc->sc_ih = hp700_intr_establish(IPL_TTY, hil_intr, sc,
+ ga->ga_ir, ga->ga_irq);
+
+ config_interrupts(self, hil_attach_deferred);
+}
Index: src/sys/arch/hp700/include/hil_machdep.h
diff -u /dev/null src/sys/arch/hp700/include/hil_machdep.h:1.1
--- /dev/null Tue Feb 15 10:32:57 2011
+++ src/sys/arch/hp700/include/hil_machdep.h Tue Feb 15 10:32:57 2011
@@ -0,0 +1,56 @@
+/* $NetBSD: hil_machdep.h,v 1.1 2011/02/15 10:32:57 tsutsui Exp $ */
+/* $OpenBSD: hil_machdep.h,v 1.2 2003/06/02 23:27:46 millert Exp $ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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. 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.
+ *
+ * from: Utah $Hdr: hilreg.h 1.10 92/01/21$
+ *
+ * @(#)hilreg.h 8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * HP 9000/700-series specific HIL definitions
+ */
+
+#define HILP_RSTHOLD 0 /* (W) reset hold (and serial #3) */
+#define HILP_DATA 2048 /* (R/W) data port */
+#define HILP_CMD 2049 /* (R/W) status and control port */
+#define HILP_STAT HILP_CMD
+#define HILP_RSTREL 3072 /* (W) reset release (and serial #3) */
+
+#define HILMAPSIZE 4096 /* size for bus_space_map() call */
+
+#define HILBUFSIZE 40 /* size of interrupt poll buffer */
+
+#define splhil spltty