sti@sgc on hp300 netbsd-5-1 with wskbd@hil

KIYOHARA Takashi <[email protected]> Thu, 16 Aug 2012 21:51:11 +0900 (JST)
Newsgroups gmane.os.netbsd.ports.hp300,gmane.os.netbsd.ports.hp700
Message-ID <[email protected]>
----Next_Part(Thu_Aug_16_21_51_11_2012_332)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi! all,


I just return from summer vacation.  My vacation is fighting to
hp300 425t. :-)

The sti@sgc and wskbd@hil works on my 425t with two patches.  I found
a problem.  The frame buffer don't scroll when over the last line.  I
don't know this reason now.

sti*[ch] was imported from OpenBSD.  However this patch support
to netbsd-5-1 only.
I very wish to merge to netbsd-5-1.  Also to -current (and
netbsd-6) too.   But I can't test current kernel at my room.
425t not exist here.  X-<

Thanks,
--
kiyohara

----Next_Part(Thu_Aug_16_21_51_11_2012_332)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="dmesg.boot.hp300"

Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 5.1.0_PATCH (HOD) #22: Sun Aug 12 22:44:46 JST 2012
	dagger@hod:/usr/src/sys/arch/hp300/compile/HOD
HP 9000/425t (25MHz MC68040 CPU+MMU+FPU, 4k on-chip physical I/D caches)
total memory = 81908 KB
avail memory = 76724 KB
timecounter: Timecounters tick every 10.000 msec
mainbus0 (root)
intio0 at mainbus0
rtc0 at intio0 addr 0x420000
frodo0 at intio0 addr 0x41c000 ipl 5
dnkbd at frodo0 offset 0x0 not configured
com1 at frodo0 offset 0x40: ns8250 or ns16450, no fifo
com2 at frodo0 offset 0x60: ns8250 or ns16450, no fifo
hil0 at intio0 addr 0x428000 ipl 1
dma0 at intio0 addr 0x500000 ipl 1: 98620C, 2 channels, 32-bit DMA
dio0 at mainbus0
com0 at dio0 scode 9 ipl 5: ns16550a, working fifo
com0: console
internal parallel at dio0 scode 12 ipl 3 not configured
spc0 at dio0 scode 14 ipl 4: 98265A SCSI, HPSCSI_ID 0x7, 32-bit DMA, SCSI ID 4
scsibus0 at spc0: 8 targets, 8 luns per target
le0 at dio0 scode 21 ipl 5: address 08:00:09:25:53:42
le0: 8 receive buffers, 2 transmit buffers
sgc0 at mainbus0
sti0 at sgc0 slot 3: HPA1659A rev 8.02;10, ID 0x2A99000000000000
sti0: 2048x1024 frame buffer, 1280x1024x8 display, offset 1280x1024
sti0: 10x20 font type 1, 40 bpc, charset 0-255
timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
timecounter: Timecounter "mc6840" frequency 250000 Hz quality 100
scsibus0: waiting 2 seconds for devices to settle...
hil0 device 1: US ASCII keyboard
wskbd0 at hil0 mux 1
wsdisplay0 at sti0 kbdmux 1
wsmux1: connecting to wsdisplay0
wskbd0: connecting to wsdisplay0
sd2 at scsibus0 target 0 lun 0: <MELCO, DSC-UE4.3G, 1.05> disk fixed
sd2: 4103 MB, 12968 cyl, 6 head, 108 sec, 512 bytes/sect x 8403264 sectors
sd2: async, 8-bit transfers
sd1 at scsibus0 target 5 lun 0: <QUANTUM, PD210S, 528_> disk fixed
sd1: 199 MB, 1156 cyl, 7 head, 50 sec, 512 bytes/sect x 408574 sectors
sd1: async, 8-bit transfers
sd0 at scsibus0 target 6 lun 0: <QUANTUM, PD210S, 528_> disk fixed
sd0: 199 MB, 1156 cyl, 7 head, 50 sec, 512 bytes/sect x 408574 sectors
sd0: async, 8-bit transfers
boot device: sd0
root on sd0a dumps on sd0b
root file system type: ffs
wsdisplay0: screen 1 added (default, vt100 emulation)

----Next_Part(Thu_Aug_16_21_51_11_2012_332)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="hp300-sti-wsdisplay-5-1.diff"

? arch/hp300/dev/sgc.c
? arch/hp300/dev/sgcreg.h
? arch/hp300/dev/sgcvar.h
? arch/hp300/dev/sti_sgc.c
Index: arch/hp300/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/conf/GENERIC,v
retrieving revision 1.147
diff -u -r1.147 GENERIC
--- arch/hp300/conf/GENERIC	10 Aug 2008 15:31:20 -0000	1.147
+++ arch/hp300/conf/GENERIC	12 Aug 2012 14:02:40 -0000
@@ -173,6 +173,11 @@
 #options 	SCSIVERBOSE	# Verbose SCSI errors
 options 	DIOVERBOSE	# recognize "unknown" DIO devices
 
+# wscons options
+# builtin terminal emulations
+#options 	WSEMUL_SUN		# sun terminal emulation
+options 	WSEMUL_VT100		# VT100 / VT220 emulation
+
 config		netbsd root on ? type ?
 
 #
@@ -183,6 +188,7 @@
 
 intio0		at mainbus0		# internal i/o space
 dio0		at mainbus0		# DIO/DIO-II bus
+sgc0		at mainbus0		# SGC bus on some 4xx models
 
 rtc*		at intio?		# real-time clock (not optional)
 dma* 		at intio?		# DMA controller
@@ -219,6 +225,9 @@
 
 ite*		at grf?			# Internal Terminal Emulator
 
+sti*		at sgc?	slot ?		# SGC framebuffer
+wsdisplay*	at sti?
+
 com0		at dio0 scode 9		# DCA serial interfaces
 com*		at dio? scode ?
 
Index: arch/hp300/conf/files.hp300
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/conf/files.hp300,v
retrieving revision 1.78
diff -u -r1.78 files.hp300
--- arch/hp300/conf/files.hp300	31 Dec 2007 13:38:48 -0000	1.78
+++ arch/hp300/conf/files.hp300	12 Aug 2012 14:02:40 -0000
@@ -43,6 +43,14 @@
 file	arch/hp300/dev/dio.c		dio
 
 #
+# SGC bus
+#
+
+device	sgc { slot = -1 }
+attach	sgc at mainbus
+file	arch/hp300/dev/sgc.c		sgc
+
+#
 # Devices in Internal i/o space
 #
 
@@ -108,6 +116,9 @@
 attach	rbox at intio with rbox_intio
 attach	topcat at intio with topcat_intio
 
+attach	sti at sgc with sti_sgc
+file	arch/hp300/dev/sti_sgc.c	sti_sgc needs-flag
+
 #
 # Devices on the DIO bus
 #
Index: arch/hp300/conf/majors.hp300
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/conf/majors.hp300,v
retrieving revision 1.21
diff -u -r1.21 majors.hp300
--- arch/hp300/conf/majors.hp300	31 Dec 2007 15:31:54 -0000	1.21
+++ arch/hp300/conf/majors.hp300	12 Aug 2012 14:02:40 -0000
@@ -35,11 +35,11 @@
 device-major	scsibus		char 34			scsibus
 device-major	raid		char 35  block 15	raid
 device-major	svr4_net	char 36			compat_svr4
-#device-major	wsdisplay	char 37			wsdisplay
-#device-major	wskbd		char 38			wskbd
-#device-major	wsmouse		char 39			wsmouse
-#device-major	wsmux		char 40			wsmux
-#device-major	wsfont		char 41			wsfont
+device-major	wsdisplay	char 37			wsdisplay
+device-major	wskbd		char 38			wskbd
+device-major	wsmouse		char 39			wsmouse
+device-major	wsmux		char 40			wsmux
+device-major	wsfont		char 41			wsfont
 device-major	clockctl	char 42			clockctl
 device-major	cgd		char 44  block 16	cgd
 device-major	ksyms		char 45			ksyms
Index: arch/hp300/hp300/bus_space.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/hp300/bus_space.c,v
retrieving revision 1.17
diff -u -r1.17 bus_space.c
--- arch/hp300/hp300/bus_space.c	28 Apr 2008 20:23:19 -0000	1.17
+++ arch/hp300/hp300/bus_space.c	12 Aug 2012 14:02:41 -0000
@@ -65,7 +65,8 @@
 		return 0;
 	}
 
-	if (t->bustype != HP300_BUS_SPACE_DIO)
+	if (t->bustype != HP300_BUS_SPACE_DIO &&
+	    t->bustype != HP300_BUS_SPACE_SGC)
 		panic("bus_space_map: bad space tag");
 
 	/*
@@ -129,7 +130,8 @@
 		return;
 	}
 
-	if (t->bustype != HP300_BUS_SPACE_DIO)
+	if (t->bustype != HP300_BUS_SPACE_DIO &&
+	    t->bustype != HP300_BUS_SPACE_SGC)
 		panic("bus_space_map: bad space tag");
 
 	kva = m68k_trunc_page(bsh);
Index: arch/hp300/include/bus.h
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/include/bus.h,v
retrieving revision 1.15
diff -u -r1.15 bus.h
--- arch/hp300/include/bus.h	28 Apr 2008 20:23:19 -0000	1.15
+++ arch/hp300/include/bus.h	12 Aug 2012 14:02:44 -0000
@@ -64,6 +64,7 @@
  */
 #define	HP300_BUS_SPACE_INTIO	0	/* space is intio space */
 #define	HP300_BUS_SPACE_DIO	1	/* space is dio space */
+#define	HP300_BUS_SPACE_SGC	2	/* space is sgc space */
 
 /*
  * Bus address and size types
Index: arch/hp700/dev/sti_sgc.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hp700/dev/sti_sgc.c,v
retrieving revision 1.13
diff -u -r1.13 sti_sgc.c
--- arch/hp700/dev/sti_sgc.c	29 Mar 2008 15:59:26 -0000	1.13
+++ arch/hp700/dev/sti_sgc.c	12 Aug 2012 14:02:46 -0000
@@ -260,5 +260,5 @@
 	if (ca->ca_hpa == (hppa_hpa_t)PAGE0->mem_cons.pz_hpa)
 		sc->sc_flags |= STI_CONSOLE;
 	hp700_pagezero_unmap(pagezero_cookie);
-	sti_attach_common(sc);
+	sti_attach_common(sc, STI_PACODE_BASE);	/* XXX: 32bit only... */
 }
Index: conf/files
===================================================================
RCS file: /cvsroot/src/sys/conf/files,v
retrieving revision 1.924.4.6
diff -u -r1.924.4.6 files
--- conf/files	8 Oct 2009 09:47:09 -0000	1.924.4.6
+++ conf/files	12 Aug 2012 14:04:43 -0000
@@ -1065,7 +1065,7 @@
 
 # STI (hp graphics)
 device	sti: wsemuldisplaydev
-file	dev/ic/sti.c		sti & (sti_pci | sti_gedoens)
+file	dev/ic/sti.c		sti & (sti_pci | sti_gedoens | sti_sgc)
 
 include "dev/wscons/files.wscons"
 include "dev/rasops/files.rasops"
Index: dev/ic/sti.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/sti.c,v
retrieving revision 1.9
diff -u -r1.9 sti.c
--- dev/ic/sti.c	8 Apr 2008 12:07:27 -0000	1.9
+++ dev/ic/sti.c	12 Aug 2012 14:04:51 -0000
@@ -120,7 +120,7 @@
 void sti_attach_deferred(struct device *);
 
 void
-sti_attach_common(struct sti_softc *sc)
+sti_attach_common(struct sti_softc *sc, u_int codebase)
 {
 	struct sti_inqconfout cfg;
 	struct sti_einqconfout ecfg;
@@ -170,25 +170,30 @@
 		dd->dd_eddst[2]= bus_space_read_1(sc->memt, sc->romh, 0xdf);
 		dd->dd_cfbaddr = parseword(0xe0) & ~3;
 
-		dd->dd_pacode[0x0] = parseword(0x100) & ~3;
-		dd->dd_pacode[0x1] = parseword(0x110) & ~3;
-		dd->dd_pacode[0x2] = parseword(0x120) & ~3;
-		dd->dd_pacode[0x3] = parseword(0x130) & ~3;
-		dd->dd_pacode[0x4] = parseword(0x140) & ~3;
-		dd->dd_pacode[0x5] = parseword(0x150) & ~3;
-		dd->dd_pacode[0x6] = parseword(0x160) & ~3;
-		dd->dd_pacode[0x7] = parseword(0x170) & ~3;
-		dd->dd_pacode[0x8] = parseword(0x180) & ~3;
-		dd->dd_pacode[0x9] = parseword(0x190) & ~3;
-		dd->dd_pacode[0xa] = parseword(0x1a0) & ~3;
-		dd->dd_pacode[0xb] = parseword(0x1b0) & ~3;
-		dd->dd_pacode[0xc] = parseword(0x1c0) & ~3;
-		dd->dd_pacode[0xd] = parseword(0x1d0) & ~3;
-		dd->dd_pacode[0xe] = parseword(0x1e0) & ~3;
-		dd->dd_pacode[0xf] = parseword(0x1f0) & ~3;
-	} else	/* STI_DEVTYPE4 */
+		codebase <<= 2;
+		dd->dd_pacode[0x0] = parseword(codebase + 0x00) & ~3;
+		dd->dd_pacode[0x1] = parseword(codebase + 0x10) & ~3;
+		dd->dd_pacode[0x2] = parseword(codebase + 0x20) & ~3;
+		dd->dd_pacode[0x3] = parseword(codebase + 0x30) & ~3;
+		dd->dd_pacode[0x4] = parseword(codebase + 0x40) & ~3;
+		dd->dd_pacode[0x5] = parseword(codebase + 0x50) & ~3;
+		dd->dd_pacode[0x6] = parseword(codebase + 0x60) & ~3;
+		dd->dd_pacode[0x7] = parseword(codebase + 0x70) & ~3;
+		dd->dd_pacode[0x8] = parseword(codebase + 0x80) & ~3;
+		dd->dd_pacode[0x9] = parseword(codebase + 0x90) & ~3;
+		dd->dd_pacode[0xa] = parseword(codebase + 0xa0) & ~3;
+		dd->dd_pacode[0xb] = parseword(codebase + 0xb0) & ~3;
+		dd->dd_pacode[0xc] = parseword(codebase + 0xc0) & ~3;
+		dd->dd_pacode[0xd] = parseword(codebase + 0xd0) & ~3;
+		dd->dd_pacode[0xe] = parseword(codebase + 0xe0) & ~3;
+		dd->dd_pacode[0xf] = parseword(codebase + 0xf0) & ~3;
+	} else { /* STI_DEVTYPE4 */
 		bus_space_read_region_4(sc->memt, sc->romh, 0, (u_int32_t *)dd,
 		    sizeof(*dd) / 4);
+		/* fix pacode... */
+		bus_space_read_region_4(sc->memt, sc->romh, codebase,
+		    (u_int32_t *)dd->dd_pacode, sizeof(*dd->dd_pacode) / 4);
+	}
 
 #ifdef STIDEBUG
 	printf("dd:\n"
Index: dev/ic/stireg.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/stireg.h,v
retrieving revision 1.2
diff -u -r1.2 stireg.h
--- dev/ic/stireg.h	11 Dec 2005 12:21:28 -0000	1.2
+++ dev/ic/stireg.h	12 Aug 2012 14:04:53 -0000
@@ -153,8 +153,10 @@
 	u_int32_t	dd_cfbaddr;	/* 0x3c CFB address, location of
 						X11 driver to be used for
 						servers w/o accel */
-	u_int32_t	dd_pacode[16];	/* 0x40 routines for pa-risc */
+	u_int32_t	dd_pacode[16];	/* 0x40 routines for pa-risc(32bit) */
 	u_int32_t	dd_altcode[16];	/* 0x80 routines for m68k/i386 */
+#define	STI_PACODE_BASE		0x40
+#define	STI_ALTCODE_BASE	0x80
 };
 
 /* after the last region there is one indirect list ptr */
Index: dev/ic/stivar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/stivar.h,v
retrieving revision 1.2
diff -u -r1.2 stivar.h
--- dev/ic/stivar.h	11 Dec 2005 12:21:28 -0000	1.2
+++ dev/ic/stivar.h	12 Aug 2012 14:04:53 -0000
@@ -76,7 +76,7 @@
 	sti_util_t	util;
 };
 
-void sti_attach_common(struct sti_softc *sc);
+void sti_attach_common(struct sti_softc *sc, u_int);
 int sti_intr(void *v);
 
 #endif /* _IC_STIVAR_H_ */
--- arch/hp300/dev/sgc.c.orig	1970-01-01 09:00:00.000000000 +0900
+++ arch/hp300/dev/sgc.c	2009-05-01 18:51:19.000000000 +0900
@@ -0,0 +1,149 @@
+/*	$OpenBSD: sgc.c,v 1.5 2007/01/06 20:10:57 miod Exp $	*/
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat
+ *
+ * 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.
+ *
+ */
+
+/*
+ * SGC bus attachment and mapping glue.
+ */
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD$");
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/errno.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <machine/bus.h>
+#include <machine/hp300spu.h>
+
+#include <hp300/dev/sgcreg.h>
+#include <hp300/dev/sgcvar.h>
+
+static	int sgc_matched = 0;
+
+struct sgc_softc {
+	struct device sc_dev;
+	struct bus_space_tag sc_tag;
+};
+
+static int	sgcmatch(device_t, struct cfdata *, void *);
+static void	sgcattach(device_t, device_t, void *);
+static int	sgcprint(void *, const char *);
+
+CFATTACH_DECL(sgc, sizeof(struct sgc_softc), sgcmatch, sgcattach, NULL, NULL);
+
+static int
+sgcmatch(device_t parent, struct cfdata *match, void *aux)
+{
+
+	/* Allow only one instance. */
+	if (sgc_matched)
+		return 0;
+
+	/*
+	 * Leave out machines which can not have an SGC bus.
+	 */
+
+	if (machineid != HP_400 && machineid != HP_425 &&
+	    machineid != HP_433)
+		return 0;
+
+	return (sgc_matched = 1);
+}
+
+static void
+sgcattach(device_t parent, device_t self, void *aux)
+{
+	struct sgc_softc *sc = device_private(self);
+	struct sgc_attach_args saa;
+	bus_addr_t pa;
+	bus_space_tag_t bst = &sc->sc_tag;
+	bus_space_handle_t bsh;
+	int slot;
+	void *va;
+
+	aprint_normal("\n");
+	aprint_naive("\n");
+
+	memset(bst, 0, sizeof(struct bus_space_tag));
+	bst->bustype = HP300_BUS_SPACE_SGC;
+
+	for (slot = 0; slot < SGC_NSLOTS; slot++) {
+		pa = (bus_addr_t)sgc_slottopa(slot);
+		if (bus_space_map(bst, pa, PAGE_SIZE, 0, &bsh)) {
+			aprint_error("%s: can't map slot %d\n",
+			    device_xname(self), slot);
+			continue;
+		}
+		va = bus_space_vaddr(bst, bsh);
+
+		/* Check for hardware. */
+		if (badaddr(va)) {
+			bus_space_unmap(bst, bsh, PAGE_SIZE);
+			continue;
+		}
+		bus_space_unmap(bst, bsh, PAGE_SIZE);
+
+		bzero(&saa, sizeof(saa));
+		saa.saa_slot = slot;
+		saa.saa_iot = bst;
+
+		/* Attach matching device. */
+		config_found(self, &saa, sgcprint);
+	}
+}
+
+static int
+sgcprint(void *aux, const char *pnp)
+{
+	struct sgc_attach_args *saa = aux;
+
+	if (pnp)
+		printf("unknown SGC card at %s", pnp);
+	printf(" slot %d", saa->saa_slot);
+	return UNCONF;
+}
+
+/*
+ * Convert a slot number to a system physical address.
+ * This is needed for bus_space.
+ */
+void *
+sgc_slottopa(int slot)
+{
+	u_long rval;
+
+	if (slot < 0 || slot >= SGC_NSLOTS)
+		rval = 0;
+	else
+		rval = SGC_BASE + (slot * SGC_DEVSIZE);
+
+	return (void *)rval;
+}
--- arch/hp300/dev/sgcreg.h.orig	1970-01-01 09:00:00.000000000 +0900
+++ arch/hp300/dev/sgcreg.h	2009-01-03 08:22:34.000000000 +0900
@@ -0,0 +1,41 @@
+/*	$OpenBSD: sgcreg.h,v 1.1 2005/01/14 22:39:26 miod Exp $	*/
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat
+ *
+ * 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.
+ */
+
+/*
+ * Register definitions for the SGC bus.
+ */
+
+/*
+ * SGC ranges from slots 0-3 at physical addresses given by:
+ *	0x20000000 + slot * 0x04000000
+ */
+
+#define	SGC_BASE		0x20000000
+#define	SGC_END			0x30000000
+#define	SGC_DEVSIZE		0x04000000
+
+#define	SGC_NSLOTS		4
--- arch/hp300/dev/sgcvar.h.orig	1970-01-01 09:00:00.000000000 +0900
+++ arch/hp300/dev/sgcvar.h	2009-01-03 08:22:34.000000000 +0900
@@ -0,0 +1,41 @@
+/*	$OpenBSD: sgcvar.h,v 1.2 2007/01/06 20:09:12 miod Exp $	*/
+
+/*
+ * Copyright (c) 2005, 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.
+ *
+ */
+
+/*
+ * Autoconfiguration definitions and prototypes for the SGC bus.
+ */
+
+struct sgc_attach_args {
+	int	saa_slot;		/* slot number */
+	bus_space_tag_t	saa_iot;
+};
+
+#ifdef _KERNEL
+void	*sgc_slottopa(int);
+#endif /* _KERNEL */
--- arch/hp300/dev/sti_sgc.c.orig	1970-01-01 09:00:00.000000000 +0900
+++ arch/hp300/dev/sti_sgc.c	2009-01-03 08:43:14.000000000 +0900
@@ -0,0 +1,144 @@
+/*	$OpenBSD: sti_sgc.c,v 1.14 2007/05/26 00:36:03 krw Exp $	*/
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat
+ *
+ * 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/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD");
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/errno.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <machine/bus.h>
+
+#include <hp300/dev/sgcvar.h>
+
+#include <dev/ic/stireg.h>
+#include <dev/ic/stivar.h>
+
+
+static int sticonslot;
+
+
+static int sti_sgc_match(device_t, struct cfdata *, void *);
+static void sti_sgc_attach(device_t, device_t, void *);
+
+static int sti_sgc_probe(bus_space_tag_t, int);
+
+CFATTACH_DECL(sti_sgc, sizeof(struct sti_softc),
+    sti_sgc_match, sti_sgc_attach, NULL, NULL);
+
+
+
+static int
+sti_sgc_match(device_t parent, struct cfdata *cf, void *aux)
+{
+	struct sgc_attach_args *saa = aux;
+
+	/*
+	 * If we already probed it successfully as a console device, go ahead,
+	 * since we will not be able to bus_space_map() again.
+	 */
+	if (saa->saa_slot == sticonslot)
+		return (1);
+
+	return sti_sgc_probe(saa->saa_iot, saa->saa_slot);
+}
+
+static void
+sti_sgc_attach(device_t parent, device_t self, void *aux)
+{
+	struct sti_softc *sc = device_private(self);
+	struct sgc_attach_args *saa = aux;
+	bus_space_tag_t iot = saa->saa_iot;
+	bus_space_handle_t ioh;
+	u_int romend;
+	int devtype;
+
+	/* XXX: temporalily map before obtain romend. */
+#define STI_ROMSIZE_SAFE	(sizeof(struct sti_dd) * 4)
+	if (bus_space_map(iot, (bus_addr_t)sgc_slottopa(saa->saa_slot),
+	    STI_ROMSIZE_SAFE, 0, &ioh)) {
+		aprint_error(": can't map ROM");
+		return;
+	}
+	devtype = bus_space_read_1(iot, ioh, 3);
+	if (devtype == STI_DEVTYPE1)
+		romend =
+		    bus_space_read_1(iot, ioh, STI_DEV1_DD_ROMEND + 3) << 24 |
+		    bus_space_read_1(iot, ioh, STI_DEV1_DD_ROMEND + 7) << 16 |
+		    bus_space_read_1(iot, ioh, STI_DEV1_DD_ROMEND + 11) << 8 |
+		    bus_space_read_1(iot, ioh, STI_DEV1_DD_ROMEND + 15);
+	else if (devtype == STI_DEVTYPE4)
+		romend = bus_space_read_4(iot, ioh, STI_DEV4_DD_ROMEND);
+	else {
+		aprint_error("%s: unknown devtype 0x%x\n",
+		    device_xname(self), devtype);
+		bus_space_unmap(iot, ioh, sizeof(struct sti_dd));
+		return;
+	}
+	bus_space_unmap(iot, ioh, sizeof(struct sti_dd));
+
+	sc->memt = sc->iot = saa->saa_iot;
+	sc->base = (bus_addr_t)sgc_slottopa(saa->saa_slot);
+
+	if (bus_space_map(sc->iot, (bus_addr_t)sgc_slottopa(saa->saa_slot),
+	    romend, 0, &sc->romh)) {
+		aprint_error(": can't map ROM(2)");
+		return;
+	}
+	sc->sc_devtype = devtype;
+	if (saa->saa_slot == sticonslot)
+		sc->sc_flags |= STI_CONSOLE;
+
+	sti_attach_common(sc, STI_ALTCODE_BASE);
+}
+
+static int
+sti_sgc_probe(bus_space_tag_t iot, int slot)
+{
+	bus_space_handle_t ioh;
+	int devtype;
+
+	if (bus_space_map(iot, (bus_addr_t)sgc_slottopa(slot),
+	    PAGE_SIZE, 0, &ioh))
+		return 0;
+	devtype = bus_space_read_1(iot, ioh, 3);
+	bus_space_unmap(iot, ioh, PAGE_SIZE);
+
+	/*
+	 * This might not be reliable enough. On the other hand, non-STI
+	 * SGC cards will apparently not initialize in an hp300, to the
+	 * point of not even answering bus probes (checked with an
+	 * Harmony/FDDI SGC card).
+	 */
+	if (devtype != STI_DEVTYPE1 &&
+	    devtype != STI_DEVTYPE4)
+		return 0;
+	return 1;
+}

----Next_Part(Thu_Aug_16_21_51_11_2012_332)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="hp300-hil-wskbd-5-1.diff"

Index: arch/hp300/conf/files.hp300
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/conf/files.hp300,v
retrieving revision 1.78
diff -u -r1.78 files.hp300
--- arch/hp300/conf/files.hp300	31 Dec 2007 13:38:48 -0000	1.78
+++ arch/hp300/conf/files.hp300	12 Aug 2012 14:02:40 -0000
@@ -52,7 +60,7 @@
 file	arch/hp300/dev/rtc.c			rtc
 
 # Human (Hilarious) Interface Loop
-device	hil { }
+device	hil { }: wskbddev
 attach	hil at intio
 file	arch/hp300/dev/hil.c			hil	needs-flag
 file	arch/hp300/dev/hil_keymaps.c		hil
Index: arch/hp300/dev/hil.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/dev/Attic/hil.c,v
retrieving revision 1.82
diff -u -r1.82 hil.c
--- arch/hp300/dev/hil.c	13 Jun 2008 09:41:15 -0000	1.82
+++ arch/hp300/dev/hil.c	12 Aug 2012 14:02:41 -0000
@@ -86,6 +86,7 @@
 #include <sys/systm.h>
 #include <sys/conf.h>
 #include <sys/device.h>
+#include <sys/errno.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sys/kernel.h>
@@ -102,6 +103,12 @@
 #include <sys/rnd.h>
 #endif
 
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wskbdvar.h>
+#include <dev/wscons/wsksymdef.h>
+#include <dev/wscons/wsksymvar.h>
+#include "wskbd.h"
+
 #include <hp300/dev/intiovar.h>
 
 #include <hp300/dev/hilreg.h>
@@ -175,6 +182,26 @@
 static void	hilreport(struct hil_softc *);
 #endif /* DEBUG */
 
+#if NWSKBD > 0
+static int	hil_enable(void *, int);
+static void	hil_set_leds(void *, int);
+static int	hil_ioctl(void *, u_long, void *, int, struct lwp *);
+#endif
+
+struct wskbd_accessops hil_accessops = {
+#if NWSKBD > 0
+	hil_enable,
+	hil_set_leds,
+	hil_ioctl,
+#endif
+};
+extern const struct wscons_keydesc hil_keydesctab[];
+struct wskbd_mapdata hil_keymapdata = {
+	hil_keydesctab,
+	0
+};
+static int hilkbd_is_console = 0;
+
 static int
 hilmatch(device_t parent, cfdata_t cf, void *aux)
 {
@@ -252,17 +279,52 @@
 hilattach_deferred(device_t self)
 {
 	struct hil_softc *sc = device_private(self);
+	struct wskbddev_attach_args a;
+	struct cfdriver *cd;
+	int wskbd = 0;
 
 #ifdef DEBUG
 	if (hildebug & HDB_FOLLOW)
 		aprint_debug("hilinit(%p, %p)\n", sc, sc->sc_addr);
 #endif
+
+	/*
+	 * find attached sti(4).
+	 * wsdisplay/wskbd is supported by sti(4) only now.
+	 */
+	cd = config_cfdriver_lookup("sti");
+	if (cd != NULL && cd->cd_ndevs != 0)
+		wskbd = 1;
+
 	/*
 	 * Initialize hardware.
 	 * Reset the loop hardware, and collect keyboard/id info
 	 */
 	hilreset(sc);
 	hilinfo(sc);
+	if (sc->sc_kbddev && wskbd) {
+		switch (sc->sc_kbdlang) {
+		case KBD_US:
+			hil_keymapdata.layout = KB_US;
+			break;
+		case KBD_UK:
+			hil_keymapdata.layout = KB_UK;
+			break;
+		case KBD_SE:
+			hil_keymapdata.layout = KB_SV;
+			break;
+		default:
+			aprint_normal_dev(self, "unknwon lang %d, use KB_US",
+			    sc->sc_kbdlang);
+			hil_keymapdata.layout = KB_US;
+			break;
+		}
+		a.console = hilkbd_is_console;
+		a.keymap = &hil_keymapdata;
+		a.accessops = &hil_accessops;
+		a.accesscookie = sc; 
+		sc->sc_wskbddev = config_found(self, &a, wskbddevprint);
+	}
 	hilkbdenable(sc);
 }
 
@@ -845,15 +907,55 @@
 		printf("hilint: %x %x\n", stat, c);
 #endif
 
+#if NWSKBD > 0
+	/*
+	 * Check and issue dummy shift(126)/control(127) event.
+	 * Don't occur these in repeat-mode.
+	 */
+	switch ((stat>>HIL_SSHIFT) & HIL_SMASK) {
+	case HIL_SHIFT:
+		wskbd_input(sc->sc_wskbddev, WSCONS_EVENT_KEY_DOWN, 126);
+		break;
+	case HIL_CTRL:
+		wskbd_input(sc->sc_wskbddev, WSCONS_EVENT_KEY_DOWN, 127);
+		break;
+	case HIL_CTRLSHIFT:
+		wskbd_input(sc->sc_wskbddev, WSCONS_EVENT_KEY_DOWN, 127);
+		wskbd_input(sc->sc_wskbddev, WSCONS_EVENT_KEY_DOWN, 126);
+		break;
+	}
+#endif
+
 	/* the shift enables the compiler to generate a jump table */
 	switch ((stat>>HIL_SSHIFT) & HIL_SMASK) {
 
-#if NITE > 0
+#if NITE > 0 || NWSKBD > 0
 	case HIL_KEY:
 	case HIL_SHIFT:
 	case HIL_CTRL:
 	case HIL_CTRLSHIFT:
+#if NITE > 0
 		itefilter(stat, c);
+#endif
+#if NWSKBD > 0
+		if ((c & 0x7f) == 0x12 ||
+		    (c & 0x7f) == 0x13) {
+			int ev = (c & 0x80) ?
+			    WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;
+
+			wskbd_input(sc->sc_wskbddev, ev, c & 0x7f);
+			return;
+		}
+		wskbd_input(sc->sc_wskbddev, WSCONS_EVENT_KEY_DOWN, c);
+		/* key up is no event.  Also repeat automatic. */
+		wskbd_input(sc->sc_wskbddev, WSCONS_EVENT_KEY_UP, c);
+
+		/*
+		 * Always clear shift(126) and control(127) here.
+		 */
+		wskbd_input(sc->sc_wskbddev, WSCONS_EVENT_KEY_UP, 127);
+		wskbd_input(sc->sc_wskbddev, WSCONS_EVENT_KEY_UP, 126);
+#endif
 		return;
 #endif
 
@@ -1233,6 +1335,7 @@
 
 	va = bus_space_vaddr(bst, bsh);
 	hilkbd_cn_device = (struct hil_dev *)va;
+	hilkbd_is_console = 1;
 
 	/* Default to US-ASCII keyboard. */
 	hilkbd_cn_map.keymap = us_keymap;
@@ -1312,6 +1415,7 @@
 		for (km = kbd_map; km->kbd_code; km++)
 			if (km->kbd_code == sc->sc_kbdlang) {
 				aprint_normal("%s ", km->kbd_desc);
+				sc->sc_kbdmap = km;
 				break;
 			}
 		aprint_normal("keyboard\n");
@@ -1456,9 +1560,9 @@
 		    sc->sc_kbdlang, db);
 #endif
 	if (sc->sc_kbdlang != KBD_SPECIAL) {
+#if NITE > 0
 		struct kbdmap *km;
 
-#if NITE > 0
 		for (km = kbd_map; km->kbd_code; km++) {
 			if (km->kbd_code == db) {
 				sc->sc_kbdlang = db;
@@ -1466,11 +1570,11 @@
 				break;
 			}
 		}
-#endif
 		if (km->kbd_code == 0) {
 			printf("hilconfig: unknown keyboard type 0x%x, "
 			    "using default\n", db);
 		}
+#endif
 	}
 	splx(s);
 }
@@ -1771,3 +1875,42 @@
 	splx(s);
 }
 #endif
+
+#if NWSKBD > 0
+static int
+hil_enable(void *v, int on)
+{
+
+	if (on) {
+		hilkbdenable(v);
+	} else {
+		if (hilkbd_is_console)
+			return EBUSY;
+		hilkbddisable(v);
+	}
+	return 0;
+}
+
+static void
+hil_set_leds(void *v, int on)
+{
+	/* Nothing */
+}
+
+static int
+hil_ioctl(void *v, u_long cmd, void *data, int flag, struct lwp *l)
+{
+
+	switch (cmd) {
+	case WSKBDIO_GTYPE:
+		*(int *)data = WSKBD_TYPE_HIL;
+		return 0;
+	case WSKBDIO_SETLEDS:
+		return 0;
+	case WSKBDIO_GETLEDS:
+		*(int *)data = 0;
+		return 0;
+	}
+	return EPASSTHROUGH;
+}
+#endif	/* NWSKBD > 0 */
Index: arch/hp300/dev/hil_keymaps.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/dev/Attic/hil_keymaps.c,v
retrieving revision 1.14
diff -u -r1.14 hil_keymaps.c
--- arch/hp300/dev/hil_keymaps.c	11 Dec 2005 12:17:14 -0000	1.14
+++ arch/hp300/dev/hil_keymaps.c	12 Aug 2012 14:02:41 -0000
@@ -103,6 +103,9 @@
 #include <sys/param.h>
 #include <hp300/dev/kbdmap.h>
 
+#include <dev/wscons/wsksymdef.h>
+#include <dev/wscons/wsksymvar.h>
+
 char	us_keymap[] = {
 	'\0',	'`',	'\\',	ESC,	'\0',	DEL,	'\0',	'\0',
 	'\n',	'\t',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
@@ -374,3 +377,164 @@
 
 	{ 0, "", NULL, NULL, NULL, NULL, NULL },
 };
+
+
+#define KC(n) KS_KEYCODE(n)
+
+static const keysym_t hil_keydesc_us[] = {
+/*  pos      command		normal		shifted */
+    KC(1),			KS_Escape,
+    KC(2),			KS_bar,		KS_backslash,
+    KC(5),   KS_Cmd_Debugger,
+    KC(7),			KS_Select,
+    KC(8),			KS_KP_Enter,
+    KC(9),			KS_KP_Tab,
+    KC(15),			KS_Prior,
+    KC(16),			KS_Next,
+    KC(17),			KS_Print_Screen,
+    KC(18),  KS_Cmd2,		KS_Alt_L,
+    KC(19),  KS_Cmd2,		KS_Alt_R,
+    KC(21),			KS_Menu,
+    KC(23),			KS_Clear,
+    KC(24),			KS_Caps_Lock,
+    KC(25),			KS_Tab,
+    KC(27),			KS_f1,
+    KC(28),			KS_f2,
+    KC(29),			KS_f5,
+    KC(30),			KS_f6,
+    KC(31),			KS_f7,
+    KC(32),			KS_f3,
+    KC(33),			KS_f4,
+    KC(34),			KS_Down,
+    KC(35),			KS_Up,
+    KC(36),			KS_f8,
+    KC(38),			KS_Left,
+    KC(39),			KS_Right,
+    KC(41),			KS_Delete,
+    KC(45),			KS_Insert,
+    KC(46),			KS_BackSpace,
+    KC(57),			KS_Return,
+    KC(60),			KS_KP_0,
+    KC(63),			KS_KP_Add,
+    KC(64),			KS_KP_1,
+    KC(65),			KS_KP_2,
+    KC(66),			KS_KP_3,
+    KC(67),			KS_KP_Subtract,
+    KC(68),			KS_KP_4,
+    KC(69),			KS_KP_5,
+    KC(70),			KS_KP_6,
+    KC(71),			KS_KP_Multiply,
+    KC(72),			KS_KP_7,
+    KC(73),			KS_KP_8,
+    KC(74),			KS_KP_9,
+    KC(75),			KS_KP_Divide,
+
+    KC(80),			KS_1,		KS_exclam,
+    KC(81),			KS_2,		KS_at,
+    KC(82),			KS_3,		KS_numbersign,
+    KC(83),			KS_4,		KS_dollar,
+    KC(84),			KS_5,		KS_percent,
+    KC(85),			KS_6,		KS_asciicircum,
+    KC(86),			KS_7,		KS_ampersand,
+    KC(87),			KS_8,		KS_asterisk,
+    KC(88),			KS_9,		KS_parenleft,
+    KC(89),			KS_0,		KS_parenright,
+    KC(90),			KS_minus,	KS_underscore,
+    KC(91),			KS_equal,	KS_plus,
+    KC(92),			KS_braceleft,	KS_bracketleft,
+    KC(93),			KS_braceright,	KS_bracketright,
+    KC(94),			KS_semicolon,	KS_colon,
+    KC(95),			KS_apostrophe,	KS_quotedbl,
+    KC(96),			KS_comma,	KS_less,
+    KC(97),			KS_period,	KS_greater,
+    KC(98),			KS_slash,	KS_question,
+
+    KC(99),			KS_space,
+    KC(100), 			KS_o,		KS_O,
+    KC(101), 			KS_p,		KS_P,
+    KC(102), 			KS_k,		KS_K,
+    KC(103), 			KS_l,		KS_L,
+    KC(104), 			KS_q,		KS_Q,
+    KC(105), 			KS_w,		KS_W,
+    KC(106), 			KS_e,		KS_E,
+    KC(107), 			KS_r,		KS_R,
+    KC(108), 			KS_t,		KS_T,
+    KC(109), 			KS_y,		KS_Y,
+    KC(110), 			KS_u,		KS_U,
+    KC(111), 			KS_i,		KS_I,
+    KC(112), 			KS_a,		KS_A,
+    KC(113), 			KS_s,		KS_S,
+    KC(114), 			KS_d,		KS_D,
+    KC(115), 			KS_f,		KS_F,
+    KC(116), 			KS_g,		KS_G,
+    KC(117), 			KS_h,		KS_H,
+    KC(118), 			KS_j,		KS_J,
+    KC(119), 			KS_m,		KS_M,
+    KC(120), 			KS_z,		KS_Z,
+    KC(121), 			KS_x,		KS_X,
+    KC(122), 			KS_c,		KS_C,
+    KC(123), 			KS_v,		KS_V,
+    KC(124), 			KS_b,		KS_B,
+    KC(125), 			KS_n,		KS_N,
+
+    /*
+     * Shift and Control not input event in repeat-mode.
+     * Change state with dummy input, if these down/up.
+     */
+    KC(126),	KS_Cmd,		KS_Shift_L,
+    KC(127),	KS_Cmd1,	KS_Control_L,
+};
+
+static const keysym_t hil_keydesc_uk[] = {
+    KC(80),			KS_1,		KS_exclam,
+    KC(81),			KS_2,		KS_quotedbl,
+    KC(82),			KS_3,		KS_numbersign,
+    KC(83),			KS_4,		KS_dollar,
+    KC(84),			KS_5,		KS_percent,
+    KC(85),			KS_6,		KS_ampersand,
+    KC(86),			KS_7,		KS_asciicircum,
+    KC(87),			KS_8,		KS_parenleft,
+    KC(88),			KS_9,		KS_parenright,
+    KC(89),			KS_0,		KS_equal,
+    KC(90),			KS_plus,	KS_question,
+    KC(91),			KS_apostrophe,	KS_slash,
+    KC(92),			KS_braceleft,	KS_bracketleft,
+    KC(93),			KS_braceright,	KS_bracketright,
+    KC(94),			KS_asterisk,	KS_at,
+    KC(95),			KS_backslash,	KS_bar,
+    KC(96),			KS_comma,	KS_semicolon,
+    KC(97),			KS_period,	KS_colon,
+    KC(98),			KS_minus,	KS_underscore,
+};
+
+static const keysym_t hil_keydesc_se[] = {
+    KC(80),			KS_1,		KS_exclam,
+    KC(81),			KS_2,		KS_quotedbl,
+    KC(82),			KS_3,		KS_numbersign,
+    KC(83),			KS_4,		KS_dollar,
+    KC(84),			KS_5,		KS_percent,
+    KC(85),			KS_6,		KS_ampersand,
+    KC(86),			KS_7,		KS_slash,
+    KC(87),			KS_8,		KS_parenleft,
+    KC(88),			KS_9,		KS_parenright,
+    KC(89),			KS_0,		KS_equal,
+    KC(90),			KS_plus,	KS_question,
+    KC(91),			KS_grave,	KS_at,
+    KC(92),			KS_bracketright,KS_braceright,
+    KC(93),			KS_asciitilde,	KS_asciicircum,
+    KC(94),			KS_bar,		KS_backslash,
+    KC(95),			KS_bracketleft,	KS_braceleft,
+    KC(96),			KS_comma,	KS_semicolon,
+    KC(97),			KS_period,	KS_colon,
+    KC(98),			KS_minus,	KS_underscore,
+};
+
+#define KBD_MAP(name, base, map) \
+			{ name, base, sizeof(map)/sizeof(keysym_t), map }
+
+const struct wscons_keydesc hil_keydesctab[] = {
+	KBD_MAP(KB_US,			0,	hil_keydesc_us),
+	KBD_MAP(KB_UK,			KB_US,	hil_keydesc_uk),
+	KBD_MAP(KB_SV,			KB_US,	hil_keydesc_se),
+	{ 0, 0, 0, 0 }
+};
Index: arch/hp300/dev/hilvar.h
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/dev/Attic/hilvar.h,v
retrieving revision 1.25
diff -u -r1.25 hilvar.h
--- arch/hp300/dev/hilvar.h	29 Mar 2008 06:47:07 -0000	1.25
+++ arch/hp300/dev/hilvar.h	12 Aug 2012 14:02:41 -0000
@@ -141,6 +141,8 @@
 	uint8_t	sc_kbddev;		/* keyboard device on loop */
 	uint8_t	sc_kbdlang;		/* keyboard language */
 	uint8_t	sc_kbdflags;		/* keyboard state */
+	device_t sc_wskbddev;		/* workstation keyboard */
+	struct kbdmap *sc_kbdmap;	/* keyboard map */
 #if NRND > 0
 	rndsource_element_t rnd_source;
 #endif

----Next_Part(Thu_Aug_16_21_51_11_2012_332)----