CVS commit: [netbsd-6] src/sys/arch/luna68k

2014-11-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Nov  9 07:34:12 UTC 2014

Modified Files:
src/sys/arch/luna68k/conf [netbsd-6]: GENERIC files.luna68k
src/sys/arch/luna68k/dev [netbsd-6]: lunafb.c lunaws.c omrasops.c
omrasopsvar.h
Added Files:
src/sys/arch/luna68k/dev [netbsd-6]: omkbdmap.c omkbdmap.h

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1182):
sys/arch/luna68k/conf/files.luna68k: revision 1.24
sys/arch/luna68k/conf/GENERIC: revision 1.113 via patch
sys/arch/luna68k/dev/omrasops.c: revision 1.17-1.19
sys/arch/luna68k/dev/lunaws.c: revision 1.30
sys/arch/luna68k/dev/omkbdmap.c: revision 1.1-1.2
sys/arch/luna68k/dev/omkbdmap.h: revision 1.1
sys/arch/luna68k/dev/lunafb.c: revision 1.31-1.36
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
- Setup Bt458 color palette to support ANSI color text on 8bpp framebuffer.
  Mostly taken from OpenBSD/luna88k.  Also sync some comments.
  Tested on LUNA-II, and mlterm-fb with 8bpp wallpaper also works fine.
  Thanks to Kenji Aoyama (OpenBSD/luna88k maintainer) for providing
  his spare 8bpp board.
- Use C99 struct initialization for wsdisplay_accessops.
- Use kmem(9) instead of malloc(9).
- Pull LUNA's keyboard driver changes from OpenBSD/luna88k. Now LUNA's
  keyboard works on Xorg server without tweaks by xmodmap(1) etc.
  - split keyboard mapping definitions to new files, omkbdmap.[ch]
  - add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
 converts MD code into PS/2 one as raw keycode on x86 for Xorg server)
  - allow to enter into ddb by CTRL+ALT(zenmen)+ESC
  - remove unnecessary return values
- Add consistent prefix to a softc member name.
- Implement WSDISPLAYIO_SMODE ioctl for proper mmap and colormap handling.
  Tested on LUNA with 4bpp framebuffer.
  - allow mmap framebuffer memories only in WSDISPLAYIO_DUMBFB
  - initialize palette for ANSI text colors on back to WSDISPLAYIO_MODE_EMUL
- Pull readability changes from OpenBSD/luna88k.
  Tested on LUNA-II with 8bpp framebuffer.
  - prepare and use unpack_attr() function to get fg and bg from attribute
  - use proper variable names to clarify meanings
- Put dumb optimizations to avoid conditionals in putchar drawing loops.
  ~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
- Fix unintended RCS Id substitution.
- Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
  This Makes 4bpp wscons putchar ~30% on LUNA-II.
  http://marc.info/?l=openbsd-cvsm=141199909120631w=2
   Use raster(logic) operation, or ROP, function on LUNA frame buffer.
   It makes 4bpp wscons putchar ~20% faster.
  Also use the similar ROP in 1bpp putchar and cursor functions
  and the 1bpp putchar is also ~5% faster.
  While here, reduce diffs from OpenBSD a bit.
  Tested on all 1bpp/4bpp/8bpp framebuffers.
- Add options WSDISPLAY_COMPAT_RAWKBD for Xorg server.


To generate a diff of this commit:
cvs rdiff -u -r1.97.2.2 -r1.97.2.3 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.23 -r1.23.6.1 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r1.25.8.2 -r1.25.8.3 src/sys/arch/luna68k/dev/lunafb.c
cvs rdiff -u -r1.23.8.2 -r1.23.8.3 src/sys/arch/luna68k/dev/lunaws.c
cvs rdiff -u -r0 -r1.2.2.2 src/sys/arch/luna68k/dev/omkbdmap.c
cvs rdiff -u -r0 -r1.1.8.2 src/sys/arch/luna68k/dev/omkbdmap.h
cvs rdiff -u -r1.11.8.2 -r1.11.8.3 src/sys/arch/luna68k/dev/omrasops.c
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/luna68k/dev/omrasopsvar.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/luna68k/conf/GENERIC
diff -u src/sys/arch/luna68k/conf/GENERIC:1.97.2.2 src/sys/arch/luna68k/conf/GENERIC:1.97.2.3
--- src/sys/arch/luna68k/conf/GENERIC:1.97.2.2	Sun Jan 12 12:08:36 2014
+++ src/sys/arch/luna68k/conf/GENERIC	Sun Nov  9 07:34:12 2014
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.97.2.2 2014/01/12 12:08:36 bouyer Exp $
+# $NetBSD: GENERIC,v 1.97.2.3 2014/11/09 07:34:12 msaitoh Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include		arch/luna68k/conf/std.luna68k
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.97.2.2 $
+#ident 		GENERIC-$Revision: 1.97.2.3 $
 
 maxusers	8
 
@@ -138,6 +138,7 @@ options 	NFS_BOOT_DHCP	# superset of BOO
 
 # WS console uses SUN or VT100 terminal emulation
 options 	WSEMUL_VT100
+options 	WSDISPLAY_COMPAT_RAWKBD
 options 	FONT_OMRON12x20
 
 config		netbsd root on ? type ?

Index: src/sys/arch/luna68k/conf/files.luna68k
diff -u src/sys/arch/luna68k/conf/files.luna68k:1.23 src/sys/arch/luna68k/conf/files.luna68k:1.23.6.1
--- src/sys/arch/luna68k/conf/files.luna68k:1.23	Tue Nov 15 13:25:44 2011
+++ src/sys/arch/luna68k/conf/files.luna68k	Sun Nov  9 07:34:12 2014
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: files.luna68k,v 1.23 

CVS commit: [netbsd-6] src/sys/arch/luna68k/conf

2014-01-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jan 12 12:08:36 UTC 2014

Modified Files:
src/sys/arch/luna68k/conf [netbsd-6]: GENERIC

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1000):
sys/arch/luna68k/conf/GENERIC: revision 1.106
sys/arch/luna68k/conf/GENERIC: revision 1.109
sys/arch/luna68k/conf/GENERIC: revision 1.110
Enable cd at scsibus, just works on LUNA-II.
Add and enable wsmux(4) in GENERIC (for mlterm-fb demonstration).
Enable file-system CD9660 to make cd(4) actually usable.


To generate a diff of this commit:
cvs rdiff -u -r1.97.2.1 -r1.97.2.2 src/sys/arch/luna68k/conf/GENERIC

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/luna68k/conf/GENERIC
diff -u src/sys/arch/luna68k/conf/GENERIC:1.97.2.1 src/sys/arch/luna68k/conf/GENERIC:1.97.2.2
--- src/sys/arch/luna68k/conf/GENERIC:1.97.2.1	Wed Jul 25 21:30:34 2012
+++ src/sys/arch/luna68k/conf/GENERIC	Sun Jan 12 12:08:36 2014
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.97.2.1 2012/07/25 21:30:34 martin Exp $
+# $NetBSD: GENERIC,v 1.97.2.2 2014/01/12 12:08:36 bouyer Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include		arch/luna68k/conf/std.luna68k
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.97.2.1 $
+#ident 		GENERIC-$Revision: 1.97.2.2 $
 
 maxusers	8
 
@@ -79,7 +79,7 @@ file-system 	FFS		# ufs file system
 #file-system	LFS		# log-structured file system
 file-system 	NFS		# nfs client support
 file-system	MFS
-#file-system 	CD9660		# ISO 9660 + Rock Ridge file system
+file-system 	CD9660		# ISO 9660 + Rock Ridge file system
 #file-system	MSDOSFS		# MS-DOS FAT file system
 file-system 	KERNFS		# /kern
 file-system 	PROCFS		# /proc
@@ -160,8 +160,8 @@ fb0	at mainbus0		# 16 or 256 pseudo colo
 
 # Workstation Console attachments
 wsdisplay*	at fb?
-wskbd*		at ws? console ?
-wsmouse*	at ws?
+wskbd*		at ws? console ? mux 1
+wsmouse*	at ws? mux 0
 
 # SCSI bus support
 scsibus* at spc?
@@ -169,7 +169,7 @@ scsibus* at spc?
 # SCSI devices
 sd* at scsibus? target ? lun ?		# SCSI disks
 st* at scsibus? target ? lun ?		# SCSI tapes
-#cd* at scsibus? target ? lun ?		# SCSI CD-ROMs
+cd* at scsibus? target ? lun ?		# SCSI CD-ROMs
 #ch* at scsibus? target ? lun ?		# SCSI changer devices
 #ss* at scsibus? target ? lun ?		# SCSI scanners
 #uk* at scsibus? target ? lun ?		# unknown SCSI devices
@@ -206,6 +206,8 @@ pseudo-device	ksyms			# /dev/ksyms
 #pseudo-device	pf			# PF packet filter
 #pseudo-device	pflog			# PF log if
 
+pseudo-device	wsmux			# mouse  keyboard multiplexsor
+
 # Veriexec
 #
 # a pseudo device needed for veriexec



CVS commit: [netbsd-6] src/sys/arch/luna68k/luna68k

2014-01-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jan 12 12:12:58 UTC 2014

Modified Files:
src/sys/arch/luna68k/luna68k [netbsd-6]: disksubr.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1002):
sys/arch/luna68k/luna68k/disksubr.c: revision 1.30
Make the default disklabel (for disks without label) have saner value.
I.e. use d_secperunit for RAW_PART rather than 0x1fff for part a.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.18.1 src/sys/arch/luna68k/luna68k/disksubr.c

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/luna68k/luna68k/disksubr.c
diff -u src/sys/arch/luna68k/luna68k/disksubr.c:1.29 src/sys/arch/luna68k/luna68k/disksubr.c:1.29.18.1
--- src/sys/arch/luna68k/luna68k/disksubr.c:1.29	Mon Oct 26 19:16:56 2009
+++ src/sys/arch/luna68k/luna68k/disksubr.c	Sun Jan 12 12:12:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: disksubr.c,v 1.29 2009/10/26 19:16:56 cegger Exp $ */
+/* $NetBSD: disksubr.c,v 1.29.18.1 2014/01/12 12:12:58 bouyer Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -103,7 +103,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.29 2009/10/26 19:16:56 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.29.18.1 2014/01/12 12:12:58 bouyer Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -180,14 +180,20 @@ readdisklabel(dev_t dev, void (*strat)(s
 	struct disklabel *dlp;
 	struct sun_disklabel *slp;
 	int error;
+	int i;
 
 	/* minimal requirements for archtypal disk label */
 	if (lp-d_secperunit == 0)
 		lp-d_secperunit = 0x1fff;
-	lp-d_npartitions = 1;
-	if (lp-d_partitions[0].p_size == 0)
-		lp-d_partitions[0].p_size = 0x1fff;
-	lp-d_partitions[0].p_offset = 0;
+	if (lp-d_npartitions  RAW_PART + 1)
+		lp-d_npartitions = RAW_PART + 1;
+	for (i = 0; i  RAW_PART; i++) {
+		lp-d_partitions[i].p_size = 0;
+		lp-d_partitions[i].p_offset = 0;
+	}
+	if (lp-d_partitions[RAW_PART].p_size == 0)
+		lp-d_partitions[RAW_PART].p_size = lp-d_secperunit;
+	lp-d_partitions[RAW_PART].p_offset = 0;
 
 	/* obtain buffer to probe drive with */
 	bp = geteblk((int)lp-d_secsize);



CVS commit: [netbsd-6] src/sys/arch/luna68k/dev

2014-01-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jan 12 12:16:51 UTC 2014

Modified Files:
src/sys/arch/luna68k/dev [netbsd-6]: timekeeper.c timekeeper.h

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1003):
sys/arch/luna68k/dev/timekeeper.h: revision 1.3
sys/arch/luna68k/dev/timekeeper.c: revision 1.11
sys/arch/luna68k/dev/timekeeper.c: revision 1.12
sys/arch/luna68k/dev/timekeeper.c: revision 1.13
Whitespace cleanup.
Fix offset of DS1287A NVRAM address on LUNA-II.
Add an initialization function of DS1287A RTC and call it during attach.
It looks the boot firmware doesn't initialize the control registers
of DS1287A (while it resets NVRAM settings) and RTC oscillator is not
started properly after replacement.
Now my LUNA-II can keep RTC properly even after reboot.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.8.1 src/sys/arch/luna68k/dev/timekeeper.c
cvs rdiff -u -r1.2 -r1.2.40.1 src/sys/arch/luna68k/dev/timekeeper.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/luna68k/dev/timekeeper.c
diff -u src/sys/arch/luna68k/dev/timekeeper.c:1.10 src/sys/arch/luna68k/dev/timekeeper.c:1.10.8.1
--- src/sys/arch/luna68k/dev/timekeeper.c:1.10	Wed Jul 27 14:17:55 2011
+++ src/sys/arch/luna68k/dev/timekeeper.c	Sun Jan 12 12:16:51 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: timekeeper.c,v 1.10 2011/07/27 14:17:55 tsutsui Exp $ */
+/* $NetBSD: timekeeper.c,v 1.10.8.1 2014/01/12 12:16:51 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: timekeeper.c,v 1.10 2011/07/27 14:17:55 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: timekeeper.c,v 1.10.8.1 2014/01/12 12:16:51 bouyer Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -58,6 +58,7 @@ struct timekeeper_softc {
 
 static int  clock_match(device_t, cfdata_t, void *);
 static void clock_attach(device_t, device_t, void *);
+static void dsclock_init(struct timekeeper_softc *);
 
 CFATTACH_DECL_NEW(clock, sizeof (struct timekeeper_softc),
 clock_match, clock_attach, NULL, NULL);
@@ -93,16 +94,17 @@ clock_attach(device_t parent, device_t s
 		sc-sc_nvramsize = 2040;
 		sc-sc_todr.todr_gettime_ymdhms = mkclock_get;
 		sc-sc_todr.todr_settime_ymdhms = mkclock_set;
-		sc-sc_todr.cookie = sc; 
+		sc-sc_todr.cookie = sc;
 		aprint_normal(: mk48t02\n);
 		break;
 	case LUNA_II: /* Dallas DS1287A */
 		sc-sc_clock = (void *)ma-ma_addr;
-		sc-sc_nvram = (void *)(ma-ma_addr + 50);
+		sc-sc_nvram = (void *)(ma-ma_addr + MC_NREGS);
 		sc-sc_nvramsize = 50;
 		sc-sc_todr.todr_gettime_ymdhms = dsclock_get;
 		sc-sc_todr.todr_settime_ymdhms = dsclock_set;
-		sc-sc_todr.cookie = sc; 
+		sc-sc_todr.cookie = sc;
+		dsclock_init(sc);
 		aprint_normal(: ds1287a\n);
 		break;
 	}
@@ -161,6 +163,28 @@ mkclock_set(todr_chip_handle_t tch, stru
 	return 0;
 }
 
+static void
+dsclock_init(struct timekeeper_softc *sc)
+{
+	volatile uint8_t *chiptime = (void *)sc-sc_clock;
+
+	/*
+	 * It looks the firmware ROM doesn't initialize DS1287 at all
+	 * even after the chip is replaced, so explicitly initialize
+	 * control registers here.
+	 */
+	chiptime = (void *)sc-sc_clock;
+
+	/* No DSE, 24HR, BINARY */
+	chiptime[MC_REGB] =
+	(chiptime[MC_REGB]  ~MC_REGB_DSE) |
+	(MC_REGB_24HR | MC_REGB_BINARY);
+
+	/* make sure to start integrated clock OSC */
+	chiptime[MC_REGA] =
+	(chiptime[MC_REGA]  ~MC_REGA_DVMASK) | MC_BASE_32_KHz;
+}
+
 /*
  * Get the time of day, based on the clock's value and/or the base value.
  */

Index: src/sys/arch/luna68k/dev/timekeeper.h
diff -u src/sys/arch/luna68k/dev/timekeeper.h:1.2 src/sys/arch/luna68k/dev/timekeeper.h:1.2.40.1
--- src/sys/arch/luna68k/dev/timekeeper.h:1.2	Mon Apr 28 20:23:26 2008
+++ src/sys/arch/luna68k/dev/timekeeper.h	Sun Jan 12 12:16:51 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: timekeeper.h,v 1.2 2008/04/28 20:23:26 martin Exp $ */
+/* $NetBSD: timekeeper.h,v 1.2.40.1 2014/01/12 12:16:51 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -62,6 +62,7 @@
 #define  MC_REGA_RSMASK 0x0f/* Interrupt rate select mask (see below) */
 #define  MC_REGA_DVMASK 0x70/* Divisor select mask (see below) */
 #define  MC_REGA_UIP0x80/* Update in progress; read only. */
+#define  MC_BASE_32_KHz	0x20/* 32 KHz crystal (enable OSC on DS1287) */
 
 #define MC_REGB 0xb /* Control register B */
 #define  MC_REGB_DSE0x01/* Daylight Savings Enable */



CVS commit: [netbsd-6] src/sys/arch/luna68k/dev

2014-01-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jan 12 12:21:16 UTC 2014

Modified Files:
src/sys/arch/luna68k/dev [netbsd-6]: lunaws.c siotty.c siovar.h

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1004):
sys/arch/luna68k/dev/siotty.c: revision 1.35
sys/arch/luna68k/dev/siotty.c: revision 1.36
sys/arch/luna68k/dev/siotty.c: revision 1.37
sys/arch/luna68k/dev/siotty.c: revision 1.38
sys/arch/luna68k/dev/lunaws.c: revision 1.25
sys/arch/luna68k/dev/lunaws.c: revision 1.26
sys/arch/luna68k/dev/lunaws.c: revision 1.27
sys/arch/luna68k/dev/siovar.h: revision 1.7
sys/arch/luna68k/dev/siotty.c: revision 1.34
struct device * - device_t, use device_xname()  (from chs@)
Whitespace cleanup.
Use softint(9) to pass received data into wskbd(9) and wsmouse(9) layers.
It might be problematic to call them from an interrupt handler at IPL_SERIAL.
Tab/space cleanup.
Use softint(9) properly to process TX/RX data between tty(4) layer.
It could cause possible locking issue to call tty(4) layer functions
from IPL_SERIAL interrupt handlers.
Changes details (mostly similar to com(4) and z8530tty(4)):
 - allocate RX buffer and put data and status into it in the interrupt handler
 - call t_linesw-l_rint from the software interrupt handler
 - set the only first byte in siottystart() and use t_outq buffer to send
   multiple TX data
 - call the next t_linesw-l_start on TX complete in the software interrupt
   handler
Also put more changes:
 - handle cnmagic(9) properly (now entering ddb(4) by console BREAK works)
 - allocate tty in the attach function as other drivers rather than first open
 - use proper variable types
Remove initialization of unused t_softc in struct tty (to make pullup easier).


To generate a diff of this commit:
cvs rdiff -u -r1.23.8.1 -r1.23.8.2 src/sys/arch/luna68k/dev/lunaws.c
cvs rdiff -u -r1.33 -r1.33.4.1 src/sys/arch/luna68k/dev/siotty.c
cvs rdiff -u -r1.6 -r1.6.8.1 src/sys/arch/luna68k/dev/siovar.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/luna68k/dev/lunaws.c
diff -u src/sys/arch/luna68k/dev/lunaws.c:1.23.8.1 src/sys/arch/luna68k/dev/lunaws.c:1.23.8.2
--- src/sys/arch/luna68k/dev/lunaws.c:1.23.8.1	Wed Jul 25 21:30:35 2012
+++ src/sys/arch/luna68k/dev/lunaws.c	Sun Jan 12 12:21:16 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.23.8.1 2012/07/25 21:30:35 martin Exp $ */
+/* $NetBSD: lunaws.c,v 1.23.8.2 2014/01/12 12:21:16 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: lunaws.c,v 1.23.8.1 2012/07/25 21:30:35 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: lunaws.c,v 1.23.8.2 2014/01/12 12:21:16 bouyer Exp $);
 
 #include wsmouse.h
 
@@ -51,6 +51,10 @@ __KERNEL_RCSID(0, $NetBSD: lunaws.c,v 1
 
 #include ioconf.h
 
+#define OMKBD_RXQ_LEN		64
+#define OMKBD_RXQ_LEN_MASK	(OMKBD_RXQ_LEN - 1)
+#define OMKBD_NEXTRXQ(x)	(((x) + 1)  OMKBD_RXQ_LEN_MASK)
+
 static const uint8_t ch1_regs[6] = {
 	WR0_RSTINT,/* Reset E/S Interrupt */
 	WR1_RXALLS,/* Rx per char, No Tx */
@@ -64,12 +68,16 @@ struct ws_softc {
 	device_t	sc_dev;
 	struct sioreg	*sc_ctl;
 	uint8_t		sc_wr[6];
-	struct device	*sc_wskbddev;
+	device_t	sc_wskbddev;
+	uint8_t		sc_rxq[OMKBD_RXQ_LEN];
+	u_int		sc_rxqhead;
+	u_int		sc_rxqtail;
 #if NWSMOUSE  0
-	struct device	*sc_wsmousedev;
+	device_t	sc_wsmousedev;
 	int		sc_msreport;
-	int		buttons, dx, dy;
+	int		sc_msbuttons, sc_msdx, sc_msdy;
 #endif
+	void		*sc_si;
 };
 
 static void omkbd_input(void *, int);
@@ -111,6 +119,7 @@ static const struct wsmouse_accessops om
 #endif
 
 static void wsintr(int);
+static void wssoftintr(void *);
 
 static int  wsmatch(device_t, cfdata_t, void *);
 static void wsattach(device_t, device_t, void *);
@@ -143,7 +152,7 @@ wsattach(device_t parent, device_t self,
 	sc-sc_ctl = (struct sioreg *)scp-scp_ctl + 1;
 	memcpy(sc-sc_wr, ch1_regs, sizeof(ch1_regs));
 	scp-scp_intr[1] = wsintr;
-	
+
 	setsioreg(sc-sc_ctl, WR0, sc-sc_wr[WR0]);
 	setsioreg(sc-sc_ctl, WR4, sc-sc_wr[WR4]);
 	setsioreg(sc-sc_ctl, WR3, sc-sc_wr[WR3]);
@@ -153,6 +162,11 @@ wsattach(device_t parent, device_t self,
 
 	syscnputc((dev_t)1, 0x20); /* keep quiet mouse */
 
+	sc-sc_rxqhead = 0;
+	sc-sc_rxqtail = 0;
+
+	sc-sc_si = softint_establish(SOFTINT_SERIAL, wssoftintr, sc);
+
 	aprint_normal(\n);
 
 	a.console = (args-hwflags == 1);
@@ -165,7 +179,7 @@ wsattach(device_t parent, device_t self,
 	{
 	struct wsmousedev_attach_args b;
 	b.accessops = omms_accessops;
-	b.accesscookie = (void *)sc;	
+	b.accesscookie = (void *)sc;
 	sc-sc_wsmousedev =
 	config_found_ia(self, wsmousedev, b, wsmousedevprint);
 	sc-sc_msreport = 0;
@@ -179,7 +193,7 @@ wsintr(int chan)
 {
 	struct ws_softc *sc = device_lookup_private(ws_cd, 0);
 	struct sioreg 

CVS commit: [netbsd-6] src/sys/arch/luna68k/dev

2014-01-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jan 12 12:25:03 UTC 2014

Modified Files:
src/sys/arch/luna68k/dev [netbsd-6]: lunafb.c omrasops.c omrasopsvar.h

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1005):
sys/arch/luna68k/dev/omrasops.c: revision 1.15
sys/arch/luna68k/dev/omrasops.c: revision 1.16
sys/arch/luna68k/dev/lunafb.c: revision 1.27
sys/arch/luna68k/dev/lunafb.c: revision 1.28
sys/arch/luna68k/dev/lunafb.c: revision 1.29
sys/arch/luna68k/dev/lunafb.c: revision 1.30
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.2
sys/arch/luna68k/dev/omrasops.c: revision 1.14
Properly initialize the palette for while on black even on 1bpp framebuffer.
Preparing for demonstration in Open Source Conference 2013 Kyoto.
Fix off by one in copyrows() backward case.
Make omrasops copycols() op work even if columns are not 32 bit aligned.
This means command line editing works properly in any cases.
The bitcopy strategies for 1bpp copycols() op are taken from
recently fixed MI sys/dev/rasops/rasops_bitops.h.
GETBITS() and PUTBITS() m68k asm macro are taken from hp300.
Tested on both 1bpp (on LUNA-II) and 4bpp (on LUNA) framebuffers.
Initialize capabilities in struct wsscreen_descr per omrasops settings.
Now REVERSE characters are drawn properly.
Add preleminary support of 4bpp LUNA framebuffer.
Changes details:
- prepare and switch 4bpp rasops functions that read/write all 4 planes
  and also handle both fg and bg colors
- make 1bpp ops use first plane on write rather than common bitmap plane
  (which is prepared for multiple plane write with raster ops)
- prepare 4bpp allocattr function to handle ANSI 16 color text
- split omrasops_init() function for each bpp
- move struct hwcmap from softc to hwdevconfig to sync palette values
  on initialization
- allow mmap(2) against all available planes
Now we can use ANSI 16 color text console and also can
demonstrate mlterm-fb with color sixel graphics and wallpaper.
XXX: Xserver needs much more work.
Pull a fix of Bt458 (8bpp framebuffer) initialization from OpenBSD/luna88k.
http://marc.info/?l=openbsd-cvsm=138838884202196
 Correct initialization of Bt458, used in LUNA's 8bpp frame buffer.

 According to the manual, the address register does not automatically
 increment when we access to the control registers.  Also we disable
 overlay planes, because we do not use them.


To generate a diff of this commit:
cvs rdiff -u -r1.25.8.1 -r1.25.8.2 src/sys/arch/luna68k/dev/lunafb.c
cvs rdiff -u -r1.11.8.1 -r1.11.8.2 src/sys/arch/luna68k/dev/omrasops.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/luna68k/dev/omrasopsvar.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/luna68k/dev/lunafb.c
diff -u src/sys/arch/luna68k/dev/lunafb.c:1.25.8.1 src/sys/arch/luna68k/dev/lunafb.c:1.25.8.2
--- src/sys/arch/luna68k/dev/lunafb.c:1.25.8.1	Wed Jul 25 21:30:35 2012
+++ src/sys/arch/luna68k/dev/lunafb.c	Sun Jan 12 12:25:03 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.25.8.1 2012/07/25 21:30:35 martin Exp $ */
+/* $NetBSD: lunafb.c,v 1.25.8.2 2014/01/12 12:25:03 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: lunafb.c,v 1.25.8.1 2012/07/25 21:30:35 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: lunafb.c,v 1.25.8.2 2014/01/12 12:25:03 bouyer Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -82,27 +82,50 @@ struct bt458 {
 #define	OMFB_RAMDAC	0xC110	/* Bt454/Bt458 RAMDAC */
 #define	OMFB_SIZE	(0xB130 - 0xB108 + PAGE_SIZE)
 
+struct hwcmap {
+#define CMAP_SIZE 256
+	uint8_t r[CMAP_SIZE];
+	uint8_t g[CMAP_SIZE];
+	uint8_t b[CMAP_SIZE];
+};
+
+static const struct {
+	uint8_t r;
+	uint8_t g;
+	uint8_t b;
+} ansicmap[16] = {
+	{0,0,0},
+	{ 0x80,0,0},
+	{0, 0x80,0},
+	{ 0x80, 0x80,0},
+	{0,0, 0x80},
+	{ 0x80,0, 0x80},
+	{0, 0x80, 0x80},
+	{ 0xc0, 0xc0, 0xc0},
+	{ 0x80, 0x80, 0x80},
+	{ 0xff,0,0},
+	{0, 0xff,0},
+	{ 0xff, 0xff,0},
+	{0,0, 0xff},
+	{ 0xff,0, 0xff},
+	{0, 0xff, 0xff},
+	{ 0xff, 0xff, 0xff},
+};
+
 struct om_hwdevconfig {
 	int	dc_wid;			/* width of frame buffer */
 	int	dc_ht;			/* height of frame buffer */
 	int	dc_depth;		/* depth, bits per pixel */
 	int	dc_rowbytes;		/* bytes in a FB scan line */
 	int	dc_cmsize;		/* colormap size */
+	struct hwcmap dc_cmap;		/* software copy of colormap */
 	vaddr_t	dc_videobase;		/* base of flat frame buffer */
 	struct rasops_info dc_ri;	/* raster blitter variables */
 };
 
-struct hwcmap {
-#define CMAP_SIZE 256
-	uint8_t r[CMAP_SIZE];
-	uint8_t g[CMAP_SIZE];
-	uint8_t b[CMAP_SIZE];
-};
-
 struct omfb_softc {
 	device_t sc_dev;		/* base device */
 	struct om_hwdevconfig *sc_dc;	/* device 

CVS commit: [netbsd-6] src/sys/arch/luna68k/luna68k

2012-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 31 08:22:06 UTC 2012

Modified Files:
src/sys/arch/luna68k/luna68k [netbsd-6]: locore.s machdep.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #453):
sys/arch/luna68k/luna68k/machdep.c: revision 1.91
sys/arch/luna68k/luna68k/locore.s: revision 1.49
Handle bootarg strings passed from firmware prompt properly on LUNA-II.
LUNA-II seems to use a different vector from LUNA to pass bootargs.
Now we can specify RB_ASKNAME and RB_SINGLE at boot on LUNA-II.
Should be pulled up to netbsd-6.


To generate a diff of this commit:
cvs rdiff -u -r1.47.2.1 -r1.47.2.2 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.89 -r1.89.2.1 src/sys/arch/luna68k/luna68k/machdep.c

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/luna68k/luna68k/locore.s
diff -u src/sys/arch/luna68k/luna68k/locore.s:1.47.2.1 src/sys/arch/luna68k/luna68k/locore.s:1.47.2.2
--- src/sys/arch/luna68k/luna68k/locore.s:1.47.2.1	Wed Jul 25 21:30:35 2012
+++ src/sys/arch/luna68k/luna68k/locore.s	Tue Jul 31 08:22:06 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.47.2.1 2012/07/25 21:30:35 martin Exp $ */
+/* $NetBSD: locore.s,v 1.47.2.2 2012/07/31 08:22:06 martin Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -136,13 +136,6 @@ ASENTRY_NOPROFILE(start)
 	RELOC(hwplanemask,%a0)
 	movl	%d5,%a0@		| save hwplanemask
 
-	movl	#0x4100,%a0		| argument of 'x' command on boot
-	movl	%a0@(212),%a0		| (char *)base[53]
-	RELOC(bootarg,%a1)
-	movl	#63,%d0
-1:	movb	%a0@+,%a1@+		| copy to bootarg
-	dbra	%d0,1b			| upto 63 characters
-
 	movl	#CACHE_OFF,%d0
 	movc	%d0,%cacr		| clear and disable on-chip cache(s)
 
@@ -169,6 +162,23 @@ Lstart0:
 	movl	%d2,%a0@
 
 	/*
+	 * save argument of 'x' command on boot per machine type
+	 * XXX: assume CPU_68040 is LUNA-II
+	 */
+	movl	#0x4100,%a0
+	cmpl	#CPU_68040,%d0		| 68040?
+	jne	1f			| no, assume 68030 LUNA
+	movl	%a0@(8),%a0		| arg at (char *)base[2] on LUNA-II
+	jra	Lstart1
+1:
+	movl	%a0@(212),%a0		| arg at (char *)base[53] on LUNA
+Lstart1:
+	RELOC(bootarg,%a1)
+	movl	#63,%d0
+1:	movb	%a0@+,%a1@+		| copy to bootarg
+	dbra	%d0,1b			| upto 63 characters
+
+	/*
 	 * Now that we know what CPU we have, initialize the address error
 	 * and bus error handlers in the vector table:
 	 *

Index: src/sys/arch/luna68k/luna68k/machdep.c
diff -u src/sys/arch/luna68k/luna68k/machdep.c:1.89 src/sys/arch/luna68k/luna68k/machdep.c:1.89.2.1
--- src/sys/arch/luna68k/luna68k/machdep.c:1.89	Mon Dec 12 19:03:10 2011
+++ src/sys/arch/luna68k/luna68k/machdep.c	Tue Jul 31 08:22:06 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.89 2011/12/12 19:03:10 mrg Exp $ */
+/* $NetBSD: machdep.c,v 1.89.2.1 2012/07/31 08:22:06 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.89 2011/12/12 19:03:10 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.89.2.1 2012/07/31 08:22:06 martin Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -188,15 +188,17 @@ luna68k_init(void)
 	boothowto = 0;
 	i = 0;
 	/*
-	 * 'bootarg' has;
+	 * 'bootarg' on LUNA has:
 	 *   args of x command ENADDR=addr HOST=host SERVER=name
 	 * where addr is MAC address of which network loader used (not
 	 * necessarily same as one at 0x4101.FFE0), host and name
-	 * are the values of HOST and SERVER environment variables,
+	 * are the values of HOST and SERVER environment variables.
+	 *
+	 * 'bootarg' on LUNA-II has args of x command only.
 	 *
 	 * NetBSD/luna68k cares only the first argment; any of sda.
 	 */
-	for (cp = bootarg; *cp != ' '; cp++) {
+	for (cp = bootarg; *cp != ' '  *cp != 0; cp++) {
 		BOOT_FLAG(*cp, boothowto);
 		if (i++ = sizeof(bootarg))
 			break;



CVS commit: [netbsd-6] src/sys/arch/luna68k

2012-07-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 25 21:30:35 UTC 2012

Modified Files:
src/sys/arch/luna68k/conf [netbsd-6]: GENERIC INSTALL
src/sys/arch/luna68k/dev [netbsd-6]: lunafb.c lunaws.c omrasops.c
src/sys/arch/luna68k/luna68k [netbsd-6]: locore.s
Added Files:
src/sys/arch/luna68k/dev [netbsd-6]: omrasopsvar.h
Removed Files:
src/sys/arch/luna68k/dev [netbsd-6]: omron_rfont.h

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #444):
sys/arch/luna68k/conf/GENERIC: revision 1.99
sys/arch/luna68k/dev/lunafb.c: revision 1.26
sys/arch/luna68k/luna68k/locore.s: revision 1.48
sys/arch/luna68k/dev/lunaws.c: revision 1.24
sys/arch/luna68k/dev/omron_rfont.h: file removal
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.1
sys/arch/luna68k/dev/omrasops.c: revision 1.12
sys/arch/luna68k/dev/omrasops.c: revision 1.13
sys/arch/luna68k/conf/INSTALL: revision 1.6
Use  not  to mask bits.  From OpenBSD/luna88k
Fix typo in comment.  From OpenBSD/luna88k.
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4).  This allows options FONT_foo in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
Make reboot(2) actually work (don't access %sp after MMU is turned off).
Also cleanup spaces and #if 0'ed code.  Tested on both LUNA and LUNA-II.
Should be pulled up to netbsd-6.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.97.2.1 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/arch/luna68k/conf/INSTALL
cvs rdiff -u -r1.25 -r1.25.8.1 src/sys/arch/luna68k/dev/lunafb.c
cvs rdiff -u -r1.23 -r1.23.8.1 src/sys/arch/luna68k/dev/lunaws.c
cvs rdiff -u -r1.11 -r1.11.8.1 src/sys/arch/luna68k/dev/omrasops.c
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/luna68k/dev/omrasopsvar.h
cvs rdiff -u -r1.1 -r0 src/sys/arch/luna68k/dev/omron_rfont.h
cvs rdiff -u -r1.47 -r1.47.2.1 src/sys/arch/luna68k/luna68k/locore.s

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/luna68k/conf/GENERIC
diff -u src/sys/arch/luna68k/conf/GENERIC:1.97 src/sys/arch/luna68k/conf/GENERIC:1.97.2.1
--- src/sys/arch/luna68k/conf/GENERIC:1.97	Sun Dec 18 05:49:29 2011
+++ src/sys/arch/luna68k/conf/GENERIC	Wed Jul 25 21:30:34 2012
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.97 2011/12/18 05:49:29 dholland Exp $
+# $NetBSD: GENERIC,v 1.97.2.1 2012/07/25 21:30:34 martin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include		arch/luna68k/conf/std.luna68k
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.97 $
+#ident 		GENERIC-$Revision: 1.97.2.1 $
 
 maxusers	8
 
@@ -138,6 +138,7 @@ options 	NFS_BOOT_DHCP	# superset of BOO
 
 # WS console uses SUN or VT100 terminal emulation
 options 	WSEMUL_VT100
+options 	FONT_OMRON12x20
 
 config		netbsd root on ? type ?
 

Index: src/sys/arch/luna68k/conf/INSTALL
diff -u src/sys/arch/luna68k/conf/INSTALL:1.4 src/sys/arch/luna68k/conf/INSTALL:1.4.2.1
--- src/sys/arch/luna68k/conf/INSTALL:1.4	Sun Dec 18 05:49:29 2011
+++ src/sys/arch/luna68k/conf/INSTALL	Wed Jul 25 21:30:34 2012
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.4 2011/12/18 05:49:29 dholland Exp $
+# $NetBSD: INSTALL,v 1.4.2.1 2012/07/25 21:30:34 martin Exp $
 #
 # config for installation ramdisk kernel
 # 
@@ -124,6 +124,7 @@ options 	NFS_BOOT_DHCP	# superset of BOO
 
 # WS console uses SUN or VT100 terminal emulation
 options 	WSEMUL_VT100
+options 	FONT_OMRON12x20
 
 config		netbsd root on ? type ?
 

Index: src/sys/arch/luna68k/dev/lunafb.c
diff -u src/sys/arch/luna68k/dev/lunafb.c:1.25 src/sys/arch/luna68k/dev/lunafb.c:1.25.8.1
--- src/sys/arch/luna68k/dev/lunafb.c:1.25	Wed Jul 27 14:17:54 2011
+++ src/sys/arch/luna68k/dev/lunafb.c	Wed Jul 25 21:30:35 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.25 2011/07/27 14:17:54 tsutsui Exp $ */
+/* $NetBSD: lunafb.c,v 1.25.8.1 2012/07/25 21:30:35 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: lunafb.c,v 1.25 2011/07/27 14:17:54 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: lunafb.c,v 1.25.8.1 2012/07/25 21:30:35 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -47,14 +47,15 @@ __KERNEL_RCSID(0, $NetBSD: lunafb.c,v 1
 
 #include uvm/uvm_extern.h
 
-#include dev/rcons/raster.h
 #include dev/wscons/wsconsio.h
-#include dev/wscons/wscons_raster.h
 #include dev/wscons/wsdisplayvar.h
+#include dev/rasops/rasops.h
 
 #include machine/cpu.h
 #include machine/autoconf.h
 
+#include arch/luna68k/dev/omrasopsvar.h
+
 #include ioconf.h
 
 struct bt454 {
@@