CVS commit: src/sys/dev/pad

2017-05-27 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat May 27 10:02:26 UTC 2017

Modified Files:
src/sys/dev/pad: pad.c padvar.h

Log Message:
Rework of previous.
Math for BYTESTOSLEEP and TIMENEXTREAD is now correct.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/pad/pad.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pad/padvar.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/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.28 src/sys/dev/pad/pad.c:1.29
--- src/sys/dev/pad/pad.c:1.28	Thu Feb 23 23:13:27 2017
+++ src/sys/dev/pad/pad.c	Sat May 27 10:02:26 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.28 2017/02/23 23:13:27 nat Exp $ */
+/* $NetBSD: pad.c,v 1.29 2017/05/27 10:02:26 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.28 2017/02/23 23:13:27 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.29 2017/05/27 10:02:26 nat Exp $");
 
 #include 
 #include 
@@ -321,6 +321,8 @@ pad_open(dev_t dev, int flags, int fmt, 
 	}
 	
 	getmicrotime(&sc->sc_last);
+	sc->sc_bytes_count = 0;
+	sc->sc_remainder = 0;
 
 	return 0;
 }
@@ -340,8 +342,9 @@ pad_close(dev_t dev, int flags, int fmt,
 	return 0;
 }
 
-#define PAD_BYTES_PER_SEC (44100 * sizeof(int16_t) * 2)
-#define TIMENEXTREAD	(PAD_BLKSIZE * 1000 / PAD_BYTES_PER_SEC)
+#define PAD_BYTES_PER_SEC   (44100 * sizeof(int16_t) * 2)
+#define TIMENEXTREAD	(PAD_BLKSIZE * 100 / PAD_BYTES_PER_SEC)
+#define BYTESTOSLEEP 	(PAD_BLKSIZE)
 
 int
 pad_read(dev_t dev, struct uio *uio, int flags)
@@ -369,18 +372,28 @@ pad_read(dev_t dev, struct uio *uio, int
 		nowusec = (now.tv_sec * 100) + now.tv_usec;
 		lastusec = (sc->sc_last.tv_sec * 100) +
 		 sc->sc_last.tv_usec;
-		if (lastusec + TIMENEXTREAD > nowusec) {
-			wait_ticks = (hz * ((lastusec + TIMENEXTREAD) -
-			 nowusec)) / 100;
+		if (lastusec + TIMENEXTREAD > nowusec &&
+		 sc->sc_bytes_count >= BYTESTOSLEEP) {
+			sc->sc_remainder +=
+			((lastusec + TIMENEXTREAD) - nowusec);
+			
+			wait_ticks = (hz * sc->sc_remainder) / 100;
 			if (wait_ticks > 0) {
+sc->sc_remainder -= wait_ticks * 100 / hz;
 kpause("padwait", TRUE, wait_ticks,
 &sc->sc_lock);
 			}
+
+			sc->sc_bytes_count -= BYTESTOSLEEP;
+			getmicrotime(&sc->sc_last);
+		} else if (sc->sc_bytes_count >= BYTESTOSLEEP) {
+			sc->sc_bytes_count -= BYTESTOSLEEP;
+			getmicrotime(&sc->sc_last);
+		} else if (lastusec + TIMENEXTREAD <= nowusec) {
+			getmicrotime(&sc->sc_last);
+			sc->sc_remainder = 0;
 		}
-		sc->sc_last.tv_sec =
-			(lastusec + TIMENEXTREAD) / 100;
-		sc->sc_last.tv_usec =
-			(lastusec + TIMENEXTREAD) % 100;
+
 		err = pad_get_block(sc, &pb, min(uio->uio_resid, PAD_BLKSIZE));
 		if (!err) {
 			mutex_exit(&sc->sc_lock);
@@ -422,6 +435,8 @@ pad_audio_open(void *opaque, int flags)
 		return EIO;
 
 	getmicrotime(&sc->sc_last);
+	sc->sc_remainder = 0;
+
 	return 0;
 }
 

Index: src/sys/dev/pad/padvar.h
diff -u src/sys/dev/pad/padvar.h:1.7 src/sys/dev/pad/padvar.h:1.8
--- src/sys/dev/pad/padvar.h:1.7	Thu Feb 23 23:13:27 2017
+++ src/sys/dev/pad/padvar.h	Sat May 27 10:02:26 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: padvar.h,v 1.7 2017/02/23 23:13:27 nat Exp $ */
+/* $NetBSD: padvar.h,v 1.8 2017/05/27 10:02:26 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -52,6 +52,8 @@ typedef struct pad_softc {
 
 	uint8_t		sc_swvol;
 	struct timeval	sc_last;
+	int		sc_bytes_count;
+	uint32_t	sc_remainder;
 } pad_softc_t;
 
 #endif /* !_SYS_DEV_PAD_PADVAR_H */



CVS commit: src/usr.sbin/bta2dpd/bta2dpd

2017-05-27 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat May 27 10:04:57 UTC 2017

Modified Files:
src/usr.sbin/bta2dpd/bta2dpd: bta2dpd.c sbc_encode.c

Log Message:
Streaming channel is now opened in blocking mode again.
Removal of a hack in sbc_encode now that pad(4) is fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c \
src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.2 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.3
--- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.2	Sun Feb 12 08:25:31 2017
+++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c	Sat May 27 10:04:57 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: bta2dpd.c,v 1.2 2017/02/12 08:25:31 nat Exp $ */
+/* $NetBSD: bta2dpd.c,v 1.3 2017/05/27 10:04:57 nat Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -615,7 +615,7 @@ do_ctlreq(int fd, short ev, void *arg)
 	static uint8_t trans;
 	uint8_t buff[1024];
 	static size_t offset = 0;
-	int result, flags;
+	int result;
 
 	if(avdtpCheckResponse(fd, &isCommand, &trans, &signal, NULL, buff,
 	&bufflen, &sep) == ENOMEM) {
@@ -775,8 +775,6 @@ opened_connection:
 			err(EXIT_FAILURE, "recv_ev");
 		state = 7;
 	} else {
-		flags = fcntl(sc, F_GETFL, 0);
-		fcntl(sc, F_SETFL, flags | O_NONBLOCK);
 		event_set(&interrupt_ev, audfile, EV_READ | EV_PERSIST,
 		do_interrupt, NULL);
 		if (event_add(&interrupt_ev, NULL) < 0)
Index: src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.2 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.3
--- src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.2	Sun Feb 12 08:25:31 2017
+++ src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	Sat May 27 10:04:57 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sbc_encode.c,v 1.2 2017/02/12 08:25:31 nat Exp $ */
+/* $NetBSD: sbc_encode.c,v 1.3 2017/05/27 10:04:57 nat Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -944,9 +944,6 @@ send_again:
 
 	free(whole);
 
-	if (seqnumber % 96 == 95)
-		usleep(1);
-
 	return len;
 }
 



CVS commit: src/sys/dev/pad

2017-05-27 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat May 27 10:43:30 UTC 2017

Modified Files:
src/sys/dev/pad: pad.c

Log Message:
Add missing sc_bytes_count.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/pad/pad.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/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.29 src/sys/dev/pad/pad.c:1.30
--- src/sys/dev/pad/pad.c:1.29	Sat May 27 10:02:26 2017
+++ src/sys/dev/pad/pad.c	Sat May 27 10:43:30 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.29 2017/05/27 10:02:26 nat Exp $ */
+/* $NetBSD: pad.c,v 1.30 2017/05/27 10:43:30 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.29 2017/05/27 10:02:26 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.30 2017/05/27 10:43:30 nat Exp $");
 
 #include 
 #include 
@@ -396,6 +396,7 @@ pad_read(dev_t dev, struct uio *uio, int
 
 		err = pad_get_block(sc, &pb, min(uio->uio_resid, PAD_BLKSIZE));
 		if (!err) {
+			sc->sc_bytes_count += pb.pb_len;
 			mutex_exit(&sc->sc_lock);
 			err = uiomove(pb.pb_ptr, pb.pb_len, uio);
 			continue;



CVS commit: src/sys/dev

2017-05-27 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat May 27 10:54:47 UTC 2017

Modified Files:
src/sys/dev: audiobell.c
Added Files:
src/sys/dev: audiobelldata.h

Log Message:
The audio bell is now in 16 bit slinear format.

It is possible to use a frequency of 44.1 kHz as apposed to 8 kHz if
you specifiy:

options HIRES_BELL

in your kernel config file.

Changes to the way in which the wave is generated help reducing pops and
ticks in the bell.

The output of the high resolution bell has been tested extensively using
frequency spectographs generated by pkgsrc package audio/audacity.

This addresses PR kern/51784.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/audiobell.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/audiobelldata.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/dev/audiobell.c
diff -u src/sys/dev/audiobell.c:1.16 src/sys/dev/audiobell.c:1.17
--- src/sys/dev/audiobell.c:1.16	Mon Feb 27 23:31:00 2017
+++ src/sys/dev/audiobell.c	Sat May 27 10:54:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiobell.c,v 1.16 2017/02/27 23:31:00 mrg Exp $	*/
+/*	$NetBSD: audiobell.c,v 1.17 2017/05/27 10:54:47 nat Exp $	*/
 
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.16 2017/02/27 23:31:00 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.17 2017/05/27 10:54:47 nat Exp $");
 
 #include 
 #include 
@@ -50,63 +50,44 @@ __KERNEL_RCSID(0, "$NetBSD: audiobell.c,
 #include 
 #include 
 #include 
+#ifdef HIRES_BELL
+#include 
 
-/* Convert a %age volume to an amount to add to u-law values */
-/* XXX Probably highly inaccurate -- should be regenerated */
-static const uint8_t volmap[] = {
-	0x7f, 0x67, 0x5b, 0x53, 0x49, 0x45, 0x41, 0x3e, 0x3a, 0x38,
-	0x36, 0x32, 0x30, 0x2f, 0x2e, 0x2c, 0x2b, 0x2a, 0x28, 0x27,
-	0x26, 0x25, 0x23, 0x22, 0x21, 0x1f, 0x1f, 0x1e, 0x1e, 0x1d,
-	0x1c, 0x1c, 0x1b, 0x1a, 0x1a, 0x19, 0x18, 0x18, 0x17, 0x17,
-	0x16, 0x15, 0x15, 0x14, 0x13, 0x13, 0x12, 0x11, 0x11, 0x10,
-	0x0f, 0x0f, 0x0f, 0x0f, 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d,
-	0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x09,
-	0x09, 0x09, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x07, 0x06,
-	0x06, 0x06, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04,	0x03, 0x03,
-	0x03, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
-	0x00
-};
+/* 44.1 kHz should reduce hum at higher pitches. */
+#define BELL_SAMPLE_RATE	44100
+#define BELL_SHIFT		19
+#else
+#define BELL_SAMPLE_RATE	8000
+#define BELL_SHIFT		24
+#endif
 
+#ifndef HIRES_BELL
 /* 1/4 cycle sine wave in u-law */
 /* XXX Probably highly inaccurate -- should be regenerated */
-static const uint8_t sinewave[] = {
-	0xff, 0xd3, 0xc5, 0xbc, 0xb6, 0xb0, 0xad, 0xaa,
-	0xa7, 0xa3, 0xa0, 0x9e, 0x9d, 0x9b, 0x9a, 0x98,
-	0x97, 0x96, 0x94, 0x93, 0x91, 0x90, 0x8f, 0x8e,
-	0x8e, 0x8d, 0x8c, 0x8c, 0x8b, 0x8b, 0x8a, 0x89,
-	0x89, 0x88, 0x88, 0x87, 0x87, 0x86, 0x86, 0x85,
-	0x85, 0x84, 0x84, 0x84, 0x83, 0x83, 0x83, 0x82,
-	0x82, 0x82, 0x81, 0x81, 0x81, 0x81, 0x80, 0x80,
-	0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
-	0x80,
+static const int16_t sinewave[] = {
+	0x, 0x0324, 0x0647, 0x096a, 0x0c8b, 0x0fab, 0x12c8, 0x15e2, 
+	0x18f8, 0x1c0b, 0x1f19, 0x2223, 0x2528, 0x2826, 0x2b1f, 0x2e11, 
+	0x30fb, 0x33de, 0x36ba, 0x398c, 0x3c56, 0x3f17, 0x41ce, 0x447a, 
+	0x471c, 0x49b4, 0x4c3f, 0x4ebf, 0x5133, 0x539b, 0x55f5, 0x5842, 
+	0x5a82, 0x5cb4, 0x5ed7, 0x60ec, 0x62f2, 0x64e8, 0x66cf, 0x68a6, 
+	0x6a6d, 0x6c24, 0x6dca, 0x6f5f, 0x70e2, 0x7255, 0x73b5, 0x7504, 
+	0x7641, 0x776c, 0x7884, 0x798a, 0x7a7d, 0x7b5d, 0x7c29, 0x7ce3, 
+	0x7d8a, 0x7e1d, 0x7e9d, 0x7f09, 0x7f62, 0x7fa7, 0x7fd8, 0x7ff6, 
 };
-
-static inline uint8_t
-audiobell_ulawscale(uint8_t val, uint8_t vol)
-{
-	uint8_t result;
-
-	result = val + vol;
-	/* Spot underflow and just return silence */
-	if ((result ^ val) & 0x80)
-		return 0x7f;
-	return result;
-}
+#endif
 
 static inline void
-audiobell_expandwave(uint8_t *buf, int volume)
+audiobell_expandwave(int16_t *buf, int volume)
 {
 	u_int i;
-	int uvol;
 
 	KASSERT(volume >= 0 && volume <= 100);
-	uvol = volmap[volume];
-	for (i = 0; i < 65; i++)
-		buf[i] = audiobell_ulawscale(sinewave[i], uvol);
-	for (i = 65; i < 128; i++)
-		 buf[i] = buf[128 - i];
-	for (i = 128; i < 256; i++)
-		buf[i] = buf[i - 128] ^ 0x80;
+	for (i = 0; i < __arraycount(sinewave); i++)
+		buf[i] = (int32_t)sinewave[i] * (int32_t)volume / 100;
+	for (i = __arraycount(sinewave); i < __arraycount(sinewave) * 2; i++)
+		 buf[i] = buf[__arraycount(sinewave) * 2 - i - 1];
+	for (i = __arraycount(sinewave) * 2; i < __arraycount(sinewave) * 4; i++)
+		buf[i] = -buf[__arraycount(sinewave) * 4 - i - 1];
 }
 
 /*
@@ -114,21 +95,21 @@ audiobell_expandwave(uint8_t *buf, int v
  * Reference Manual (pp1624--1628).
  */
 static inline int
-audiobell_synthesize(uint8_t *buf, u_int pitch, u_int period, u_int volume)
+audiobell_synthesize(int16_t *buf, u_int 

CVS commit: src/share/man/man4

2017-05-27 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat May 27 11:10:24 UTC 2017

Modified Files:
src/share/man/man4: speaker.4

Log Message:
Document the HIRES_BELL option.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/share/man/man4/speaker.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/speaker.4
diff -u src/share/man/man4/speaker.4:1.18 src/share/man/man4/speaker.4:1.19
--- src/share/man/man4/speaker.4:1.18	Sat Feb 18 22:39:00 2017
+++ src/share/man/man4/speaker.4	Sat May 27 11:10:24 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: speaker.4,v 1.18 2017/02/18 22:39:00 wiz Exp $
+.\" $NetBSD: speaker.4,v 1.19 2017/05/27 11:10:24 nat Exp $
 .\"
 .\" Copyright (c) 2016 Nathanial Sloss 
 .\" All rights reserved.
@@ -35,7 +35,7 @@
 .\"
 .\" <>
 .\"
-.Dd November 23, 2016
+.Dd May 27, 2017
 .Dt SPEAKER 4
 .Os
 .Sh NAME
@@ -46,6 +46,7 @@
 .Cd "spkr0	at pcppi?"
 .Pp
 .Cd "options	VAUDIOSPEAKER"
+.Cd "options	HIRES_BELL"
 .Cd "spkr0	at audio?"
 .Pp
 .In machine/spkr.h
@@ -168,6 +169,9 @@ dotted twice, it is held 9/4, and three 
 .Pp
 Whitespace in play strings is simply skipped and may be used to separate
 melody sections.
+.Pp
+The option HIRES_BELL for the audio synthesized speaker allows you to have a
+high reslution (44.1 kHz) bell.
 .Sh FILES
 .Bl -tag -width Pa -compact
 .It Pa /dev/speaker



CVS commit: src/bin/sh

2017-05-27 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat May 27 11:19:57 UTC 2017

Modified Files:
src/bin/sh: parser.c sh.1 shell.h var.c

Log Message:
More standard (and saner) implementation of the ! reserved word.
Unless the shell is compiled with the (compilation time) option
BOGUS_NOT_COMMAND (as in CFLAGS+=-DBOGUS_NOT_COMMAND) which it
will not normally be, the ! command (reserved word) will only
be permitted at the start of a pipeline (which includes the
degenerate pipeline with no '|'s in it of course - ie: a simple cmd)
and not in the middle of a pipeline sequence (no "cmd | ! cmd" nonsense.)
If the latter is really required, then "cmd | { ! cmd; }" works as
a standard equivalent.

In POSIX mode, permit only one !  ("! pipeline" is ok. "! ! pipeline" is not).
Again, if needed (and POSIX conformance is wanted) "! { ! pipeline; }"
works as an alternative - and is safer, some shells treat "! ! cmd" as
being identical to "cmd" (this one did until recently.)


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/bin/sh/parser.c
cvs rdiff -u -r1.144 -r1.145 src/bin/sh/sh.1
cvs rdiff -u -r1.21 -r1.22 src/bin/sh/shell.h
cvs rdiff -u -r1.54 -r1.55 src/bin/sh/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.128 src/bin/sh/parser.c:1.129
--- src/bin/sh/parser.c:1.128	Sun May 14 11:17:04 2017
+++ src/bin/sh/parser.c	Sat May 27 11:19:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.128 2017/05/14 11:17:04 kre Exp $	*/
+/*	$NetBSD: parser.c,v 1.129 2017/05/27 11:19:57 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.128 2017/05/14 11:17:04 kre Exp $");
+__RCSID("$NetBSD: parser.c,v 1.129 2017/05/27 11:19:57 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -264,6 +264,10 @@ pipeline(void)
 	checkkwd = 2;
 	while (readtoken() == TNOT) {
 		TRACE(("pipeline: TNOT recognized\n"));
+#ifndef BOGUS_NOT_COMMAND
+		if (posix && negate)
+			synerror("2nd \"!\" unexpected");
+#endif
 		negate++;
 	}
 	tokpushback++;
@@ -304,7 +308,10 @@ command(void)
 	union node *ap, **app;
 	union node *cp, **cpp;
 	union node *redir, **rpp;
-	int t, negate = 0;
+	int t;
+#ifdef BOGUS_NOT_COMMAND
+	int negate = 0;
+#endif
 
 	TRACE(("command: entered\n"));
 
@@ -321,11 +328,13 @@ command(void)
 	}
 	tokpushback++;
 
+#ifdef BOGUS_NOT_COMMAND		/* only in pileline() */
 	while (readtoken() == TNOT) {
 		TRACE(("command: TNOT recognized\n"));
 		negate++;
 	}
 	tokpushback++;
+#endif
 
 	switch (readtoken()) {
 	case TIF:
@@ -568,6 +577,7 @@ TRACE(("expecting DO got %s %s\n", tokna
 	}
 
  checkneg:
+#ifdef BOGUS_NOT_COMMAND
 	if (negate) {
 		TRACE(("%snegate command\n", (negate&1) ? "" : "double "));
 		n2 = stalloc(sizeof(struct nnot));
@@ -576,6 +586,7 @@ TRACE(("expecting DO got %s %s\n", tokna
 		return n2;
 	}
 	else
+#endif
 		return n1;
 }
 
@@ -584,8 +595,11 @@ STATIC union node *
 simplecmd(union node **rpp, union node *redir)
 {
 	union node *args, **app;
-	union node *n = NULL, *n2;
+	union node *n = NULL;
+#ifdef BOGUS_NOT_COMMAND
+	union node *n2;
 	int negate = 0;
+#endif
 
 	/* If we don't have any redirections already, then we must reset */
 	/* rpp to be the address of the local redir variable.  */
@@ -595,11 +609,13 @@ simplecmd(union node **rpp, union node *
 	args = NULL;
 	app = &args;
 
+#ifdef BOGUS_NOT_COMMAND	/* pipelines get negated, commands do not */
 	while (readtoken() == TNOT) {
 		TRACE(("simplcmd: TNOT recognized\n"));
 		negate++;
 	}
 	tokpushback++;
+#endif
 
 	for (;;) {
 		if (readtoken() == TWORD) {
@@ -643,6 +659,7 @@ simplecmd(union node **rpp, union node *
 	n->ncmd.redirect = redir;
 
  checkneg:
+#ifdef BOGUS_NOT_COMMAND
 	if (negate) {
 		TRACE(("%snegate simplecmd\n", (negate&1) ? "" : "double "));
 		n2 = stalloc(sizeof(struct nnot));
@@ -651,6 +668,7 @@ simplecmd(union node **rpp, union node *
 		return n2;
 	}
 	else
+#endif
 		return n;
 }
 

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.144 src/bin/sh/sh.1:1.145
--- src/bin/sh/sh.1:1.144	Sat May 27 06:32:12 2017
+++ src/bin/sh/sh.1	Sat May 27 11:19:57 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.144 2017/05/27 06:32:12 kre Exp $
+.\"	$NetBSD: sh.1,v 1.145 2017/05/27 11:19:57 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -385,13 +385,18 @@ variable is read at startup by a non-int
 It also controls whether file descriptors greater than 2
 opened using the
 .Ic exec
-built-in command are passed on to utilities executed,
+built-in command are passed on to utilities executed
+.Dq ( yes
+in posix mode),
 and whether the shell treats
-an empty compound statement as a syntax error (required
-by posix) or permits it.
-Empty compound statements
+an empty brace-list compound state

CVS commit: src/sys/dev

2017-05-27 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat May 27 12:04:44 UTC 2017

Modified Files:
src/sys/dev: audiobell.c

Log Message:
The high resolution bell is the only option.  The 8 kHz version has been
removed.

Suggested by jmcneill@.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/audiobell.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/dev/audiobell.c
diff -u src/sys/dev/audiobell.c:1.17 src/sys/dev/audiobell.c:1.18
--- src/sys/dev/audiobell.c:1.17	Sat May 27 10:54:47 2017
+++ src/sys/dev/audiobell.c	Sat May 27 12:04:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiobell.c,v 1.17 2017/05/27 10:54:47 nat Exp $	*/
+/*	$NetBSD: audiobell.c,v 1.18 2017/05/27 12:04:44 nat Exp $	*/
 
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.17 2017/05/27 10:54:47 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.18 2017/05/27 12:04:44 nat Exp $");
 
 #include 
 #include 
@@ -50,31 +50,11 @@ __KERNEL_RCSID(0, "$NetBSD: audiobell.c,
 #include 
 #include 
 #include 
-#ifdef HIRES_BELL
 #include 
 
 /* 44.1 kHz should reduce hum at higher pitches. */
 #define BELL_SAMPLE_RATE	44100
 #define BELL_SHIFT		19
-#else
-#define BELL_SAMPLE_RATE	8000
-#define BELL_SHIFT		24
-#endif
-
-#ifndef HIRES_BELL
-/* 1/4 cycle sine wave in u-law */
-/* XXX Probably highly inaccurate -- should be regenerated */
-static const int16_t sinewave[] = {
-	0x, 0x0324, 0x0647, 0x096a, 0x0c8b, 0x0fab, 0x12c8, 0x15e2, 
-	0x18f8, 0x1c0b, 0x1f19, 0x2223, 0x2528, 0x2826, 0x2b1f, 0x2e11, 
-	0x30fb, 0x33de, 0x36ba, 0x398c, 0x3c56, 0x3f17, 0x41ce, 0x447a, 
-	0x471c, 0x49b4, 0x4c3f, 0x4ebf, 0x5133, 0x539b, 0x55f5, 0x5842, 
-	0x5a82, 0x5cb4, 0x5ed7, 0x60ec, 0x62f2, 0x64e8, 0x66cf, 0x68a6, 
-	0x6a6d, 0x6c24, 0x6dca, 0x6f5f, 0x70e2, 0x7255, 0x73b5, 0x7504, 
-	0x7641, 0x776c, 0x7884, 0x798a, 0x7a7d, 0x7b5d, 0x7c29, 0x7ce3, 
-	0x7d8a, 0x7e1d, 0x7e9d, 0x7f09, 0x7f62, 0x7fa7, 0x7fd8, 0x7ff6, 
-};
-#endif
 
 static inline void
 audiobell_expandwave(int16_t *buf, int volume)



CVS commit: src/share/man/man4

2017-05-27 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat May 27 12:15:34 UTC 2017

Modified Files:
src/share/man/man4: speaker.4

Log Message:
Revert to previous as what was the HIRES_BELL option is now the only
choice.

Suggested by jmcneill@.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/share/man/man4/speaker.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/speaker.4
diff -u src/share/man/man4/speaker.4:1.19 src/share/man/man4/speaker.4:1.20
--- src/share/man/man4/speaker.4:1.19	Sat May 27 11:10:24 2017
+++ src/share/man/man4/speaker.4	Sat May 27 12:15:34 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: speaker.4,v 1.19 2017/05/27 11:10:24 nat Exp $
+.\" $NetBSD: speaker.4,v 1.20 2017/05/27 12:15:34 nat Exp $
 .\"
 .\" Copyright (c) 2016 Nathanial Sloss 
 .\" All rights reserved.
@@ -35,7 +35,7 @@
 .\"
 .\" <>
 .\"
-.Dd May 27, 2017
+.Dd November 23, 2016
 .Dt SPEAKER 4
 .Os
 .Sh NAME
@@ -46,7 +46,6 @@
 .Cd "spkr0	at pcppi?"
 .Pp
 .Cd "options	VAUDIOSPEAKER"
-.Cd "options	HIRES_BELL"
 .Cd "spkr0	at audio?"
 .Pp
 .In machine/spkr.h
@@ -169,9 +168,6 @@ dotted twice, it is held 9/4, and three 
 .Pp
 Whitespace in play strings is simply skipped and may be used to separate
 melody sections.
-.Pp
-The option HIRES_BELL for the audio synthesized speaker allows you to have a
-high reslution (44.1 kHz) bell.
 .Sh FILES
 .Bl -tag -width Pa -compact
 .It Pa /dev/speaker



CVS commit: src/tests/bin/sh

2017-05-27 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat May 27 13:11:50 UTC 2017

Modified Files:
src/tests/bin/sh: t_redircloexec.sh

Log Message:
Skip the test of non-posix behaviour if we are deliberately trying
to be posix compatible (POSIXLY_CORRECT is set).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/bin/sh/t_redircloexec.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/bin/sh/t_redircloexec.sh
diff -u src/tests/bin/sh/t_redircloexec.sh:1.4 src/tests/bin/sh/t_redircloexec.sh:1.5
--- src/tests/bin/sh/t_redircloexec.sh:1.4	Sun May 14 17:28:46 2017
+++ src/tests/bin/sh/t_redircloexec.sh	Sat May 27 13:11:50 2017
@@ -1,4 +1,4 @@
-# $NetBSD: t_redircloexec.sh,v 1.4 2017/05/14 17:28:46 kre Exp $
+# $NetBSD: t_redircloexec.sh,v 1.5 2017/05/27 13:11:50 kre Exp $
 #
 # Copyright (c) 2016 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -50,6 +50,8 @@ exec_redir_closed_head() {
 }
 exec_redir_closed_body() {
 
+	[ -n "${POSIXLY_CORRECT+set}" ] && atf_skip "tests non-posix behaviour"
+
 	mkhelper exec 6 \
 		"exec 6> out; echo exec1 >&6; ${TEST_SH} exec2; exec 6>&-"
 



CVS commit: src/sys/dev

2017-05-27 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat May 27 13:55:58 UTC 2017

Modified Files:
src/sys/dev: audio.c

Log Message:
Be even more carefull with devices that support only play back OR capture.

Addresses PR kern/52256.


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 src/sys/dev/audio.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/dev/audio.c
diff -u src/sys/dev/audio.c:1.352 src/sys/dev/audio.c:1.353
--- src/sys/dev/audio.c:1.352	Tue May 23 07:57:26 2017
+++ src/sys/dev/audio.c	Sat May 27 13:55:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.352 2017/05/23 07:57:26 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.353 2017/05/27 13:55:58 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.352 2017/05/23 07:57:26 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.353 2017/05/27 13:55:58 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -2011,8 +2011,8 @@ audio_initbufs(struct audio_softc *sc, s
 	struct audio_chan *chan;
 	int error;
 
+	chan = SIMPLEQ_FIRST(&sc->sc_audiochan);
 	if (vc == NULL) {
-		chan = SIMPLEQ_FIRST(&sc->sc_audiochan);
 		vc = chan->vc;
 		sc->sc_pr.blksize = vc->sc_mrr.blksize;
 		sc->sc_rr.blksize = vc->sc_mrr.blksize;
@@ -2020,7 +2020,8 @@ audio_initbufs(struct audio_softc *sc, s
 
 	DPRINTF(("audio_initbufs: mode=0x%x\n", vc->sc_mode));
 	hw = sc->hw_if;
-	if (audio_can_capture(sc) || (vc->sc_open & AUOPEN_READ)) {
+	if (audio_can_capture(sc) &&
+		((vc->sc_open & AUOPEN_READ) || vc == chan->vc)) {
 		audio_init_ringbuffer(sc, &vc->sc_mrr,
 		AUMODE_RECORD);
 		if (sc->sc_opens == 0 && hw->init_input &&
@@ -2034,7 +2035,8 @@ audio_initbufs(struct audio_softc *sc, s
 	if (vc == SIMPLEQ_FIRST(&sc->sc_audiochan)->vc)
 		sc->sc_rr.blksize = vc->sc_mrr.blksize;
 
-	if (audio_can_playback(sc) || (vc->sc_open & AUOPEN_WRITE)) {
+	if (audio_can_playback(sc) &&
+		((vc->sc_open & AUOPEN_WRITE) || vc == chan->vc)) {
 		audio_init_ringbuffer(sc, &vc->sc_mpr,
 		AUMODE_PLAY);
 		vc->sc_sil_count = 0;
@@ -2191,8 +2193,10 @@ audio_open(dev_t dev, struct audio_softc
 			}
 		}
 		audio_initbufs(sc, NULL);
-		audio_init_ringbuffer(sc, &sc->sc_pr, AUMODE_PLAY);
-		audio_init_ringbuffer(sc, &sc->sc_rr, AUMODE_RECORD);
+		if (audio_can_playback(sc))
+			audio_init_ringbuffer(sc, &sc->sc_pr, AUMODE_PLAY);
+		if (audio_can_capture(sc))
+			audio_init_ringbuffer(sc, &sc->sc_rr, AUMODE_RECORD);
 		sc->schedule_wih = false;
 		sc->schedule_rih = false;
 		sc->sc_last_drops = 0;



CVS commit: src/sys/arch

2017-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May 27 20:26:27 UTC 2017

Modified Files:
src/sys/arch/arm/nvidia: tegra_soc.c
src/sys/arch/evbarm/tegra: tegra_machdep.c

Log Message:
GC unused tegra_dma_bootstrap function.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/nvidia/tegra_soc.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/evbarm/tegra/tegra_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/arm/nvidia/tegra_soc.c
diff -u src/sys/arch/arm/nvidia/tegra_soc.c:1.11 src/sys/arch/arm/nvidia/tegra_soc.c:1.12
--- src/sys/arch/arm/nvidia/tegra_soc.c:1.11	Thu May 25 23:26:48 2017
+++ src/sys/arch/arm/nvidia/tegra_soc.c	Sat May 27 20:26:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_soc.c,v 1.11 2017/05/25 23:26:48 jmcneill Exp $ */
+/* $NetBSD: tegra_soc.c,v 1.12 2017/05/27 20:26:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_soc.c,v 1.11 2017/05/25 23:26:48 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_soc.c,v 1.12 2017/05/27 20:26:27 jmcneill Exp $");
 
 #define	_ARM32_BUS_DMA_PRIVATE
 #include 
@@ -84,11 +84,6 @@ tegra_bootstrap(void)
 	tegra_mpinit();
 }
 
-void
-tegra_dma_bootstrap(psize_t psize)
-{
-}
-
 static void
 tegra_mpinit(void)
 {

Index: src/sys/arch/evbarm/tegra/tegra_machdep.c
diff -u src/sys/arch/evbarm/tegra/tegra_machdep.c:1.42 src/sys/arch/evbarm/tegra/tegra_machdep.c:1.43
--- src/sys/arch/evbarm/tegra/tegra_machdep.c:1.42	Fri May 26 18:58:55 2017
+++ src/sys/arch/evbarm/tegra/tegra_machdep.c	Sat May 27 20:26:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_machdep.c,v 1.42 2017/05/26 18:58:55 jmcneill Exp $ */
+/* $NetBSD: tegra_machdep.c,v 1.43 2017/05/27 20:26:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.42 2017/05/26 18:58:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.43 2017/05/27 20:26:27 jmcneill Exp $");
 
 #include "opt_tegra.h"
 #include "opt_machdep.h"
@@ -323,9 +323,6 @@ initarm(void *arg)
 	KASSERTMSG(ram_size > 0, "RAM size unknown and MEMSIZE undefined");
 #endif
 
-	/* DMA tag setup */
-	tegra_dma_bootstrap(ram_size);
-
 	/* Fake bootconfig structure for the benefit of pmap.c. */
 	bootconfig.dramblocks = 1;
 	bootconfig.dram[0].address = (bus_addr_t)memory_addr;



CVS commit: src/sys/arch/arm/nvidia

2017-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May 27 20:26:44 UTC 2017

Modified Files:
src/sys/arch/arm/nvidia: tegra_var.h

Log Message:
tegra_dma_bootstrap is no more


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/nvidia/tegra_var.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/arm/nvidia/tegra_var.h
diff -u src/sys/arch/arm/nvidia/tegra_var.h:1.35 src/sys/arch/arm/nvidia/tegra_var.h:1.36
--- src/sys/arch/arm/nvidia/tegra_var.h:1.35	Thu May 25 23:26:48 2017
+++ src/sys/arch/arm/nvidia/tegra_var.h	Sat May 27 20:26:44 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_var.h,v 1.35 2017/05/25 23:26:48 jmcneill Exp $ */
+/* $NetBSD: tegra_var.h,v 1.36 2017/05/27 20:26:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -51,7 +51,6 @@ extern struct arm32_bus_dma_tag tegra_dm
 u_int	tegra_chip_id(void);
 const char *tegra_chip_name(void);
 void	tegra_bootstrap(void);
-void	tegra_dma_bootstrap(psize_t);
 
 struct tegra_gpio_pin;
 struct tegra_gpio_pin *tegra_gpio_acquire(const char *, u_int);



CVS commit: src/doc

2017-05-27 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat May 27 21:05:02 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
Note can(4)


To generate a diff of this commit:
cvs rdiff -u -r1.2285 -r1.2286 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2285 src/doc/CHANGES:1.2286
--- src/doc/CHANGES:1.2285	Thu May 25 00:12:34 2017
+++ src/doc/CHANGES	Sat May 27 21:05:02 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2285 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2286 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -519,3 +519,5 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	src: Remove MKCRYPTO option and always include cryptography.
 		[riastradh 20170521]
 	file(1): Upgraded to 5.31. [christos 20170524]
+	can(4): Added a socketcan implementation, a socket layer for
+		CAN busses. [bouyer 20170527]



CVS commit: src/doc

2017-05-27 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat May 27 21:06:26 UTC 2017

Modified Files:
src/doc: BRANCHES

Log Message:
Update status of bouyer-socketcan


To generate a diff of this commit:
cvs rdiff -u -r1.340 -r1.341 src/doc/BRANCHES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/BRANCHES
diff -u src/doc/BRANCHES:1.340 src/doc/BRANCHES:1.341
--- src/doc/BRANCHES:1.340	Wed Apr 26 10:07:45 2017
+++ src/doc/BRANCHES	Sat May 27 21:06:26 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: BRANCHES,v 1.340 2017/04/26 10:07:45 pgoyette Exp $
+#	$NetBSD: BRANCHES,v 1.341 2017/05/27 21:06:26 bouyer Exp $
 #
 # This file contains a list of branches that exist in the NetBSD CVS
 # tree and their current state.
@@ -396,9 +396,9 @@ Notes:		This code was on a branch becaus
 
 Branch:		bouyer-socketcan
 Description:	Implement a CAN socket layer compatible with linux SocketCAN
-Status:		Active
+Status:		Terminated
 Start Date:	Sun Jan 15 2017
-End Date:
+End Date:	May 27 2017
 Base Tag:	bouyer-socketcan-base
 Maintainer:	Manuel Bouyer 
 Scope:		src/



CVS commit: src/sys/arch

2017-05-27 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat May 27 22:53:29 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: ALL GENERIC
src/sys/arch/evbarm/conf: OLIMEXLIME2
src/sys/arch/i386/conf: ALL GENERIC

Log Message:
Add options CAN and pseudo-device canloop to ALL kernel configs.
Add the same commented out to i386/amd64 GENERIC and OLIMEXLIME2 (A20-based).
Also add commented out awincan0 in OLIMEXLIME2.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.458 -r1.459 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/OLIMEXLIME2
cvs rdiff -u -r1.418 -r1.419 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1155 -r1.1156 src/sys/arch/i386/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/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.58 src/sys/arch/amd64/conf/ALL:1.59
--- src/sys/arch/amd64/conf/ALL:1.58	Thu May 25 05:54:29 2017
+++ src/sys/arch/amd64/conf/ALL	Sat May 27 22:53:29 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.58 2017/05/25 05:54:29 para Exp $
+# $NetBSD: ALL,v 1.59 2017/05/27 22:53:29 bouyer Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.58 $"
+#ident		"ALL-$Revision: 1.59 $"
 
 maxusers	64		# estimated number of users
 
@@ -230,6 +230,7 @@ options 	MPLS		# MultiProtocol Label Swi
 options 	MROUTING	# IP multicast routing
 options 	PIM		# Protocol Independent Multicast
 options 	NETATALK	# AppleTalk networking protocols
+options 	CAN		# Controller Area Network protocol
 options 	DCCP		# Datagram Congestion Control Protocol
 options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
 options 	PPP_DEFLATE	# Deflate compression support for PPP
@@ -1631,6 +1632,8 @@ pseudo-device	etherip			# EtherIP
 # srt is EXPERIMENTAL
 pseudo-device	srt			# source-address-based routing
 
+pseudo-device	canloop			# CAN loopback interface
+
 #
 # accept filters, built as module(7)s by default
 pseudo-device	accf_data		# "dataready" accept filter

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.458 src/sys/arch/amd64/conf/GENERIC:1.459
--- src/sys/arch/amd64/conf/GENERIC:1.458	Thu May 25 05:54:29 2017
+++ src/sys/arch/amd64/conf/GENERIC	Sat May 27 22:53:29 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.458 2017/05/25 05:54:29 para Exp $
+# $NetBSD: GENERIC,v 1.459 2017/05/27 22:53:29 bouyer Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.458 $"
+#ident		"GENERIC-$Revision: 1.459 $"
 
 maxusers	64		# estimated number of users
 
@@ -196,6 +196,7 @@ options 	IPSEC		# IP security
 #options 	MROUTING	# IP multicast routing
 #options 	PIM		# Protocol Independent Multicast
 options 	NETATALK	# AppleTalk networking protocols
+#options 	CAN		# Controller Area Network protocol
 options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
 options 	PPP_DEFLATE	# Deflate compression support for PPP
 options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
@@ -1283,6 +1284,8 @@ pseudo-device	l2tp			# L2TPv3 interface
 #pseudo-device	pfsync			# PF sync if
 #pseudo-device	npf			# NPF packet filter
 
+#pseudo-device	canloop			# CAN loopback interface
+
 #
 # accept filters
 pseudo-device	accf_data		# "dataready" accept filter

Index: src/sys/arch/evbarm/conf/OLIMEXLIME2
diff -u src/sys/arch/evbarm/conf/OLIMEXLIME2:1.1 src/sys/arch/evbarm/conf/OLIMEXLIME2:1.2
--- src/sys/arch/evbarm/conf/OLIMEXLIME2:1.1	Wed Jun  3 10:01:56 2015
+++ src/sys/arch/evbarm/conf/OLIMEXLIME2	Sat May 27 22:53:29 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: OLIMEXLIME2,v 1.1 2015/06/03 10:01:56 jmcneill Exp $
+#	$NetBSD: OLIMEXLIME2,v 1.2 2017/05/27 22:53:29 bouyer Exp $
 #
 #	OLIMEXLIME2 - Olimex A20-OLinuXino-LIME2
 #
@@ -11,3 +11,8 @@ makeoptions	BOARDTYPE="olimexlime2"
 no options 	ALLWINNER_A10
 no makeoptions	CPUFLAGS
 makeoptions	CPUFLAGS="-mcpu=cortex-a7 -mfpu=neon"
+
+# CAN bus support
+#options 	CAN		# Controller Area Network protocol
+#pseudo-device	canloop		# CAN loopback interface
+#awincan0	at awinio0 port ? flags 1

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.418 src/sys/arch/i386/conf/ALL:1.419
--- src/sys/arch/i386/conf/ALL:1.418	Wed May 24 20:23:04 2017
+++ src/sys/arch/i386/conf/ALL	Sat May 27 22:53:29 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.418 2017/05/24 20:23:04 christos Exp $
+# $NetBSD: ALL,v 1.419 2017/05/27 22:53:29 bouyer Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i38

CVS commit: src/sys/dev/fdt

2017-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun May 28 00:28:17 UTC 2017

Modified Files:
src/sys/dev/fdt: fdtbus.c

Log Message:
Change first pass from 1 to 0.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/fdt/fdtbus.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/dev/fdt/fdtbus.c
diff -u src/sys/dev/fdt/fdtbus.c:1.12 src/sys/dev/fdt/fdtbus.c:1.13
--- src/sys/dev/fdt/fdtbus.c:1.12	Sat Apr 29 12:49:05 2017
+++ src/sys/dev/fdt/fdtbus.c	Sun May 28 00:28:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.12 2017/04/29 12:49:05 jmcneill Exp $ */
+/* $NetBSD: fdtbus.c,v 1.13 2017/05/28 00:28:17 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.12 2017/04/29 12:49:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.13 2017/05/28 00:28:17 jmcneill Exp $");
 
 #include 
 #include 
@@ -161,7 +161,7 @@ fdt_attach(device_t parent, device_t sel
 	}
 
 	/* Scan devices */
-	for (int pass = 1; pass <= FDTCF_PASS_DEFAULT; pass++)
+	for (int pass = 0; pass <= FDTCF_PASS_DEFAULT; pass++)
 		fdt_scan(sc, pass);
 }
 



CVS commit: src/sys/arch/arm/cortex

2017-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun May 28 00:29:55 UTC 2017

Modified Files:
src/sys/arch/arm/cortex: gtmr.c

Log Message:
If the "frequency" property is not specified, try to use the value in
CNTFRQ. Firmware should have already set this for us.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/cortex/gtmr.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/arm/cortex/gtmr.c
diff -u src/sys/arch/arm/cortex/gtmr.c:1.16 src/sys/arch/arm/cortex/gtmr.c:1.17
--- src/sys/arch/arm/cortex/gtmr.c:1.16	Mon Apr 20 20:19:52 2015
+++ src/sys/arch/arm/cortex/gtmr.c	Sun May 28 00:29:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmr.c,v 1.16 2015/04/20 20:19:52 matt Exp $	*/
+/*	$NetBSD: gtmr.c,v 1.17 2017/05/28 00:29:55 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.16 2015/04/20 20:19:52 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.17 2017/05/28 00:29:55 jmcneill Exp $");
 
 #include 
 #include 
@@ -103,7 +103,9 @@ gtmr_attach(device_t parent, device_t se
 	/*
 	 * This runs at a fixed frequency of 1 to 50MHz.
 	 */
-	prop_dictionary_get_uint32(dict, "frequency", &sc->sc_freq);
+	if (!prop_dictionary_get_uint32(dict, "frequency", &sc->sc_freq))
+		sc->sc_freq = armreg_cnt_frq_read();
+
 	KASSERT(sc->sc_freq != 0);
 
 	humanize_number(freqbuf, sizeof(freqbuf), sc->sc_freq, "Hz", 1000);



CVS commit: src/sys/arch/evbarm/evbarm

2017-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun May 28 00:30:49 UTC 2017

Modified Files:
src/sys/arch/evbarm/evbarm: autoconf.c

Log Message:
Don't assume that the root autoconfiguration device is named "mainbus".


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/evbarm/autoconf.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/evbarm/evbarm/autoconf.c
diff -u src/sys/arch/evbarm/evbarm/autoconf.c:1.19 src/sys/arch/evbarm/evbarm/autoconf.c:1.20
--- src/sys/arch/evbarm/evbarm/autoconf.c:1.19	Sat Mar  5 07:33:58 2016
+++ src/sys/arch/evbarm/evbarm/autoconf.c	Sun May 28 00:30:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.19 2016/03/05 07:33:58 mlelstv Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.20 2017/05/28 00:30:49 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.19 2016/03/05 07:33:58 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.20 2017/05/28 00:30:49 jmcneill Exp $");
 
 #include "opt_md.h"
 
@@ -50,6 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 void	(*evbarm_device_register)(device_t, void *);
 void	(*evbarm_device_register_post_config)(device_t, void *);
 
+extern struct cfdata cfdata[];
+
 #ifndef MEMORY_DISK_IS_ROOT
 static int get_device(char *name, device_t *, int *);
 static void set_root_device(void);
@@ -164,13 +166,18 @@ void
 cpu_configure(void)
 {
 	struct mainbus_attach_args maa;
+	struct cfdata *cf;
 
 	(void) splhigh();
 	(void) splserial();	/* XXX need an splextreme() */
 
-	maa.ma_name = "mainbus";
-
-	config_rootfound("mainbus", &maa);
+	for (cf = &cfdata[0]; cf->cf_name; cf++) {
+		if (cf->cf_pspec == NULL) {
+			maa.ma_name = cf->cf_name;
+			if (config_rootfound(cf->cf_name, &maa) != NULL)
+break;
+		}
+	}
 
 	/* Time to start taking interrupts so lets open the flood gates  */
 	spl0();



CVS commit: src/sys/arch/arm/cortex

2017-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun May 28 00:32:46 UTC 2017

Modified Files:
src/sys/arch/arm/cortex: files.cortex

Log Message:
Move children of armperiph to the "mpcorebus" interface attribute and have
armperiph declare support for it.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/cortex/files.cortex

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/arm/cortex/files.cortex
diff -u src/sys/arch/arm/cortex/files.cortex:1.5 src/sys/arch/arm/cortex/files.cortex:1.6
--- src/sys/arch/arm/cortex/files.cortex:1.5	Wed Feb 19 22:20:03 2014
+++ src/sys/arch/arm/cortex/files.cortex	Sun May 28 00:32:46 2017
@@ -1,35 +1,37 @@
-# $NetBSD: files.cortex,v 1.5 2014/02/19 22:20:03 matt Exp $
+# $NetBSD: files.cortex,v 1.6 2017/05/28 00:32:46 jmcneill Exp $
 
 defflag opt_cpu_in_cksum.h			NEON_IN_CKSUM
 
 file	arch/arm/cortex/cpu_in_cksum_neon.c	(inet | inet6) & neon_in_cksum
 file	arch/arm/cortex/cpu_in_cksum_asm_neon.S	(inet | inet6) & neon_in_cksum
 
-device	armperiph {}
+define	mpcorebus {}
+
+device	armperiph: mpcorebus
 attach	armperiph at mainbus
 file	arch/arm/cortex/armperiph.c		armperiph
 
 # ARM Generic Interrupt Controller (initially on Cortex-A9)
 device	armgic: pic, pic_splfuncs
-attach	armgic at armperiph
+attach	armgic at mpcorebus
 file	arch/arm/cortex/gic.c			armgic
 
 # ARM PL310 L2 Cache Controller(initially on Cortex-A9)
 device	arml2cc
-attach	arml2cc at armperiph
+attach	arml2cc at mpcorebus
 file	arch/arm/cortex/pl310.c			arml2cc	needs-flag
 
 # ARMv7 Generic Timer
 device	armgtmr
-attach	armgtmr at armperiph
+attach	armgtmr at mpcorebus
 file	arch/arm/cortex/gtmr.c			armgtmr
 
 # A9 MPCore Global Timer
 device	a9tmr
-attach	a9tmr at armperiph
+attach	a9tmr at mpcorebus
 file	arch/arm/cortex/a9tmr.c			a9tmr
 
 # A9 MPcore Watchdog Timer
 device	a9wdt: sysmon_wdog
-attach	a9wdt at armperiph
+attach	a9wdt at mpcorebus
 file	arch/arm/cortex/a9wdt.c			a9wdt



CVS commit: src/sys/arch/arm/arm32

2017-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun May 28 00:34:51 UTC 2017

Added Files:
src/sys/arch/arm/arm32: armv7_generic_dma.c

Log Message:
Add a generic armv7 bus dma tag.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/arm32/armv7_generic_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/arch/arm/arm32/armv7_generic_dma.c
diff -u /dev/null src/sys/arch/arm/arm32/armv7_generic_dma.c:1.1
--- /dev/null	Sun May 28 00:34:51 2017
+++ src/sys/arch/arm/arm32/armv7_generic_dma.c	Sun May 28 00:34:51 2017
@@ -0,0 +1,40 @@
+/* $NetBSD: armv7_generic_dma.c,v 1.1 2017/05/28 00:34:51 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill 
+ * 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 
+__KERNEL_RCSID(0, "$NetBSD: armv7_generic_dma.c,v 1.1 2017/05/28 00:34:51 jmcneill Exp $");
+
+#define	_ARM32_BUS_DMA_PRIVATE
+#include 
+#include 
+
+struct arm32_bus_dma_tag armv7_generic_dma_tag = {
+	_BUS_DMAMAP_FUNCS,
+	_BUS_DMAMEM_FUNCS,
+	_BUS_DMATAG_FUNCS,
+};



CVS commit: src/bin/sh

2017-05-27 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun May 28 00:38:01 UTC 2017

Modified Files:
src/bin/sh: Makefile expand.c options.h
Added Files:
src/bin/sh: mkoptions.sh option.list

Log Message:
Arrange for set -o and $- output to be sorted, rather than more
or less random (and becoming worse as more options are added.)
Since the data is known at compile time, sort at compile time,
rather than at run time.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/bin/sh/Makefile
cvs rdiff -u -r1.105 -r1.106 src/bin/sh/expand.c
cvs rdiff -u -r0 -r1.1 src/bin/sh/mkoptions.sh src/bin/sh/option.list
cvs rdiff -u -r1.26 -r1.27 src/bin/sh/options.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/Makefile
diff -u src/bin/sh/Makefile:1.107 src/bin/sh/Makefile:1.108
--- src/bin/sh/Makefile:1.107	Mon May 15 18:34:56 2017
+++ src/bin/sh/Makefile	Sun May 28 00:38:01 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.107 2017/05/15 18:34:56 kre Exp $
+#	$NetBSD: Makefile,v 1.108 2017/05/28 00:38:01 kre Exp $
 #	@(#)Makefile	8.4 (Berkeley) 5/5/95
 
 .include 
@@ -9,7 +9,7 @@ SHSRCS=	alias.c arith_token.c arithmetic
 	miscbltin.c mystring.c options.c parser.c redir.c show.c trap.c \
 	output.c var.c test.c kill.c syntax.c
 GENSRCS=builtins.c init.c nodes.c
-GENHDRS=builtins.h nodes.h token.h nodenames.h
+GENHDRS=builtins.h nodes.h token.h nodenames.h optinit.h
 SRCS=	${SHSRCS} ${GENSRCS}
 
 DPSRCS+=${GENHDRS}
@@ -77,6 +77,10 @@ nodenames.h: mknodenames.sh nodes.h
 	${_MKTARGET_CREATE}
 	${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} > ${.TARGET}
 
+optinit.h: mkoptions.sh option.list
+	${_MKTARGET_CREATE}
+	${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} ${.TARGET} ${.OBJDIR}
+
 .if ${USETOOLS} == "yes"
 NBCOMPATLIB=   -L${TOOLDIR}/lib -lnbcompat
 .endif

Index: src/bin/sh/expand.c
diff -u src/bin/sh/expand.c:1.105 src/bin/sh/expand.c:1.106
--- src/bin/sh/expand.c:1.105	Wed Apr 26 17:43:33 2017
+++ src/bin/sh/expand.c	Sun May 28 00:38:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: expand.c,v 1.105 2017/04/26 17:43:33 christos Exp $	*/
+/*	$NetBSD: expand.c,v 1.106 2017/05/28 00:38:01 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)expand.c	8.5 (Berkeley) 5/15/95";
 #else
-__RCSID("$NetBSD: expand.c,v 1.105 2017/04/26 17:43:33 christos Exp $");
+__RCSID("$NetBSD: expand.c,v 1.106 2017/05/28 00:38:01 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -941,9 +941,9 @@ numvar:
 		expdest = cvtnum(num, expdest);
 		break;
 	case '-':
-		for (i = 0; optlist[i].name || optlist[i].letter; i++) {
-			if (optlist[i].val && optlist[i].letter)
-STPUTC(optlist[i].letter, expdest);
+		for (i = 0; i < option_flags; i++) {
+			if (optlist[optorder[i]].val)
+STPUTC(optlist[optorder[i]].letter, expdest);
 		}
 		break;
 	case '@':

Index: src/bin/sh/options.h
diff -u src/bin/sh/options.h:1.26 src/bin/sh/options.h:1.27
--- src/bin/sh/options.h:1.26	Thu May 18 13:53:18 2017
+++ src/bin/sh/options.h	Sun May 28 00:38:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.h,v 1.26 2017/05/18 13:53:18 kre Exp $	*/
+/*	$NetBSD: options.h,v 1.27 2017/05/28 00:38:01 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -55,79 +55,7 @@ struct optent {
 	unsigned char dflt;		/* default value of flag */
 };
 
-/* Those marked [U] are required by posix, but have no effect! */
-
-#ifdef DEFINE_OPTIONS
-#define DEF_OPTS_D(name,letter,opt_set,dflt) {name, letter, opt_set, 0, dflt },
-struct optent optlist[] = {
-#else
-#define DEF_OPTS_D(name,letter,opt_set,dflt)
-#endif
-#define DEF_OPTS(name,letter,opt_set)	DEF_OPTS_D(name, letter, opt_set, 0)
-#define DEF_OPT(name,letter)		DEF_OPTS_D(name, letter, 0, 0)
-#define DEF_OPT_D(name,letter,dflt)	DEF_OPTS_D(name, letter, 0, dflt)
-
-DEF_OPT( "errexit",	'e' )	/* exit on error */
-#define eflag optlist[0].val
-DEF_OPT( "noglob",	'f' )	/* no pathname expansion */
-#define fflag optlist[1].val
-DEF_OPT( "ignoreeof",	'I' )	/* do not exit on EOF */
-#define Iflag optlist[2].val
-DEF_OPT( "interactive",'i' )	/* interactive shell */
-#define iflag optlist[3].val
-DEF_OPT( "monitor",	'm' )	/* job control */
-#define mflag optlist[4].val
-DEF_OPT( "noexec",	'n' )	/* do not exec commands */
-#define nflag optlist[5].val
-DEF_OPT( "stdin",	's' )	/* read from stdin */
-#define sflag optlist[6].val
-DEF_OPT( "xtrace",	'x' )	/* trace after expansion */
-#define xflag optlist[7].val
-DEF_OPT( "verbose",	'v' )	/* trace read input */
-#define vflag optlist[8].val
-DEF_OPTS( "vi",		'V', 'V' )	/* vi style editing */
-#define Vflag optlist[9].val
-DEF_OPTS( "emacs",	'E', 'V' )	/* emacs style editing */
-#define	Eflag optlist[10].val
-DEF_OPT( "noclobber",	'C' )	/* do not overwrite files with > */
-#define	Cflag optlist[11].val
-DEF_OPT( "allexport",	'a' )	/* export all variables */
-#define	aflag optlist[12].val
-DEF_OPT( "notify",	'b' )	/* [U] report completion of background jobs 

CVS commit: src/sys/dev/fdt

2017-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun May 28 00:38:40 UTC 2017

Modified Files:
src/sys/dev/fdt: files.fdt
Added Files:
src/sys/dev/fdt: cpus.c

Log Message:
Add CPUs ("/cpus" node) driver. CPUs is a container of cpu nodes.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/cpus.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/fdt/files.fdt

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/fdt/files.fdt
diff -u src/sys/dev/fdt/files.fdt:1.12 src/sys/dev/fdt/files.fdt:1.13
--- src/sys/dev/fdt/files.fdt:1.12	Sat Apr 29 11:00:56 2017
+++ src/sys/dev/fdt/files.fdt	Sun May 28 00:38:40 2017
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.12 2017/04/29 11:00:56 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.13 2017/05/28 00:38:40 jmcneill Exp $
 
 include	"external/bsd/libfdt/conf/files.libfdt"
 
@@ -33,3 +33,7 @@ file	dev/fdt/fdt_regulator.c			fdtbus
 file	dev/fdt/fdt_reset.c			fdtbus
 file	dev/fdt/fdt_rtc.c			fdtbus
 file	dev/fdt/fdt_pinctrl.c			fdtbus
+
+device	cpus { } : fdtbus
+attach	cpus at fdt
+file	dev/fdt/cpus.ccpus

Added files:

Index: src/sys/dev/fdt/cpus.c
diff -u /dev/null src/sys/dev/fdt/cpus.c:1.1
--- /dev/null	Sun May 28 00:38:40 2017
+++ src/sys/dev/fdt/cpus.c	Sun May 28 00:38:40 2017
@@ -0,0 +1,76 @@
+/* $NetBSD: cpus.c,v 1.1 2017/05/28 00:38:40 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill 
+ * 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 
+__KERNEL_RCSID(0, "$NetBSD: cpus.c,v 1.1 2017/05/28 00:38:40 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+static int	cpus_match(device_t, cfdata_t, void *);
+static void	cpus_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(cpus, 0, cpus_match, cpus_attach, NULL, NULL);
+
+static int
+cpus_match(device_t parent, cfdata_t cf, void *aux)
+{
+	struct fdt_attach_args * const faa = aux;
+
+	return OF_finddevice("/cpus") == faa->faa_phandle;
+}
+
+static void
+cpus_attach(device_t parent, device_t self, void *aux)
+{
+	struct fdt_attach_args * const faa = aux;
+	const int phandle = faa->faa_phandle;
+	int child;
+
+	aprint_naive("\n");
+	aprint_normal("\n");
+
+	for (child = OF_child(phandle); child; child = OF_peer(child)) {
+		if (!fdtbus_status_okay(child))
+			continue;
+
+		struct fdt_attach_args cfaa = *faa;
+		cfaa.faa_phandle = child;
+		cfaa.faa_name = "cpu";
+		cfaa.faa_quiet = 0;
+
+		config_found(self, &cfaa, fdtbus_print);
+	}
+}



CVS commit: src/sys/arch

2017-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun May 28 00:40:21 UTC 2017

Modified Files:
src/sys/arch/arm/fdt: files.fdt gic_fdt.c
src/sys/arch/arm/nvidia: files.tegra tegra_var.h
src/sys/arch/evbarm/conf: TEGRA
src/sys/arch/evbarm/tegra: tegra_machdep.c
Added Files:
src/sys/arch/arm/fdt: armv7_fdt.c cpu_fdt.c gtmr_fdt.c
Removed Files:
src/sys/arch/arm/nvidia: tegra_fdt.c

Log Message:
Enumerate CPUs, GIC, and generic timer using FDT data instead of relying
on hard-coded tables in mainbus.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/fdt/armv7_fdt.c \
src/sys/arch/arm/fdt/cpu_fdt.c src/sys/arch/arm/fdt/gtmr_fdt.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/fdt/files.fdt
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/fdt/gic_fdt.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/arm/nvidia/files.tegra \
src/sys/arch/arm/nvidia/tegra_var.h
cvs rdiff -u -r1.5 -r0 src/sys/arch/arm/nvidia/tegra_fdt.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/conf/TEGRA
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/evbarm/tegra/tegra_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/arm/fdt/files.fdt
diff -u src/sys/arch/arm/fdt/files.fdt:1.1 src/sys/arch/arm/fdt/files.fdt:1.2
--- src/sys/arch/arm/fdt/files.fdt:1.1	Sun Dec 13 17:45:37 2015
+++ src/sys/arch/arm/fdt/files.fdt	Sun May 28 00:40:20 2017
@@ -1,5 +1,16 @@
-# $NetBSD: files.fdt,v 1.1 2015/12/13 17:45:37 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.2 2017/05/28 00:40:20 jmcneill Exp $
 
-device  gic
+device	armv7fdt { }: bus_space_generic, fdtbus
+attach	armv7fdt at root with armv7_fdt
+file	arch/arm/fdt/armv7_fdt.c		armv7_fdt
+
+attach	cpu at cpus with cpu_fdt
+file	arch/arm/fdt/cpu_fdt.c			cpu_fdt
+
+device	gtmr: mpcorebus
+attach	gtmr at fdt with gtmr_fdt
+file	arch/arm/fdt/gtmr_fdt.c			gtmr_fdt
+
+device  gic: mpcorebus
 attach  gic at fdt with gic_fdt
 filearch/arm/fdt/gic_fdt.c 	gic_fdt

Index: src/sys/arch/arm/fdt/gic_fdt.c
diff -u src/sys/arch/arm/fdt/gic_fdt.c:1.2 src/sys/arch/arm/fdt/gic_fdt.c:1.3
--- src/sys/arch/arm/fdt/gic_fdt.c:1.2	Tue Jan  5 21:53:48 2016
+++ src/sys/arch/arm/fdt/gic_fdt.c	Sun May 28 00:40:20 2017
@@ -1,7 +1,7 @@
-/* $NetBSD: gic_fdt.c,v 1.2 2016/01/05 21:53:48 marty Exp $ */
+/* $NetBSD: gic_fdt.c,v 1.3 2017/05/28 00:40:20 jmcneill Exp $ */
 
 /*-
- * Copyright (c) 2015 Jared D. McNeill 
+ * Copyright (c) 2015-2017 Jared McNeill 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.2 2016/01/05 21:53:48 marty Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.3 2017/05/28 00:40:20 jmcneill Exp $");
 
 #include 
 #include 
@@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -83,6 +84,9 @@ gic_fdt_attach(device_t parent, device_t
 {
 	struct gic_fdt_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
+	bus_addr_t addr_d, addr_c;
+	bus_size_t size_d, size_c;
+	bus_space_handle_t bsh;
 	int error;
 
 	sc->sc_dev = self;
@@ -97,6 +101,34 @@ gic_fdt_attach(device_t parent, device_t
 
 	aprint_naive("\n");
 	aprint_normal(": GIC\n");
+
+	if (fdtbus_get_reg(sc->sc_phandle, 0, &addr_d, &size_d) != 0) {
+		aprint_error(": couldn't get distributor address\n");
+		return;
+	}
+	if (fdtbus_get_reg(sc->sc_phandle, 1, &addr_c, &size_c) != 0) {
+		aprint_error(": couldn't get cpu interface address\n");
+		return;
+	}
+
+	const bus_addr_t addr = addr_d;
+	const bus_size_t size = (addr_c + size_c) - addr_d;
+
+	error = bus_space_map(faa->faa_bst, addr, size, 0, &bsh);
+	if (error) {
+		aprint_error(": couldn't map registers: %d\n", error);
+		return;
+	}
+
+	struct mpcore_attach_args mpcaa = {
+		.mpcaa_name = "armgic",
+		.mpcaa_memt = faa->faa_bst,
+		.mpcaa_memh = bsh,
+		.mpcaa_off1 = 0,
+		.mpcaa_off2 = addr_c - addr_d
+	};
+
+	config_found(self, &mpcaa, NULL);
 }
 
 static void *

Index: src/sys/arch/arm/nvidia/files.tegra
diff -u src/sys/arch/arm/nvidia/files.tegra:1.36 src/sys/arch/arm/nvidia/files.tegra:1.37
--- src/sys/arch/arm/nvidia/files.tegra:1.36	Thu May 25 23:26:48 2017
+++ src/sys/arch/arm/nvidia/files.tegra	Sun May 28 00:40:20 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.tegra,v 1.36 2017/05/25 23:26:48 jmcneill Exp $
+#	$NetBSD: files.tegra,v 1.37 2017/05/28 00:40:20 jmcneill Exp $
 #
 # Configuration info for NVIDIA Tegra ARM Peripherals
 #
@@ -11,13 +11,9 @@ file	arch/arm/arm32/arm32_kvminit.c
 file	arch/arm/arm32/arm32_reboot.c
 file	arch/arm/arm32/irq_dispatch.S
 file	arch/arm/arm32/armv7_generic_space.c
+file	arch/arm/arm32/armv7_generic_dma.c
 file	arch/arm/arm/bus_space_a4x.S
 
-# Devicetree
-device	tegrafdt : bus_space_generic, fdtbus
-attach	tegrafdt at mainbus with tegra_fdt
-file	arch/arm/nvidia/tegra_fdt.c		t

CVS commit: src/sys/dev/bluetooth

2017-05-27 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun May 28 04:12:13 UTC 2017

Modified Files:
src/sys/dev/bluetooth: btsco.c

Log Message:
bt_lock is now used as the audio interrupt lock.  This is more appropriate
as the interrupt lock deals with the hardware.

btsco audio works again with the new audio changes.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/bluetooth/btsco.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/dev/bluetooth/btsco.c
diff -u src/sys/dev/bluetooth/btsco.c:1.34 src/sys/dev/bluetooth/btsco.c:1.35
--- src/sys/dev/bluetooth/btsco.c:1.34	Fri Jul 10 22:03:12 2015
+++ src/sys/dev/bluetooth/btsco.c	Sun May 28 04:12:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: btsco.c,v 1.34 2015/07/10 22:03:12 nat Exp $	*/
+/*	$NetBSD: btsco.c,v 1.35 2017/05/28 04:12:13 nat Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.34 2015/07/10 22:03:12 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.35 2017/05/28 04:12:13 nat Exp $");
 
 #include 
 #include 
@@ -97,7 +97,7 @@ struct btsco_softc {
 	device_t		 sc_audio;	/* MI audio device */
 	void			*sc_intr;	/* interrupt cookie */
 	kcondvar_t		 sc_connect;	/* connect wait */
-	kmutex_t		 sc_intr_lock;	/* for audio */
+	kmutex_t		 sc_lock;	/* for audio */
 
 	/* Bluetooth */
 	bdaddr_t		 sc_laddr;	/* local address */
@@ -295,7 +295,7 @@ btsco_attach(device_t parent, device_t s
 	sc->sc_state = BTSCO_CLOSED;
 	sc->sc_name = device_xname(self);
 	cv_init(&sc->sc_connect, "connect");
-	mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
 
 	/*
 	 * copy in our configuration info
@@ -382,10 +382,12 @@ btsco_detach(device_t self, int flags)
 		sc->sc_intr = NULL;
 	}
 
+	mutex_enter(bt_lock);
 	if (sc->sc_rx_mbuf != NULL) {
 		m_freem(sc->sc_rx_mbuf);
 		sc->sc_rx_mbuf = NULL;
 	}
+	mutex_exit(bt_lock);
 
 	if (sc->sc_tx_refcnt > 0) {
 		aprint_error_dev(self, "tx_refcnt=%d!\n", sc->sc_tx_refcnt);
@@ -395,7 +397,7 @@ btsco_detach(device_t self, int flags)
 	}
 
 	cv_destroy(&sc->sc_connect);
-	mutex_destroy(&sc->sc_intr_lock);
+	mutex_destroy(&sc->sc_lock);
 
 	return 0;
 }
@@ -462,7 +464,7 @@ btsco_sco_disconnected(void *arg, int er
 		 * has completed so that when it tries to send more, we
 		 * can indicate an error.
 		 */
-		mutex_enter(&sc->sc_intr_lock);
+		mutex_enter(bt_lock);
 		if (sc->sc_tx_pending > 0) {
 			sc->sc_tx_pending = 0;
 			(*sc->sc_tx_intr)(sc->sc_tx_intrarg);
@@ -471,7 +473,7 @@ btsco_sco_disconnected(void *arg, int er
 			sc->sc_rx_want = 0;
 			(*sc->sc_rx_intr)(sc->sc_rx_intrarg);
 		}
-		mutex_exit(&sc->sc_intr_lock);
+		mutex_exit(bt_lock);
 		break;
 
 	default:
@@ -505,13 +507,11 @@ btsco_sco_complete(void *arg, int count)
 
 	DPRINTFN(10, "%s count %d\n", sc->sc_name, count);
 
-	mutex_enter(&sc->sc_intr_lock);
 	if (sc->sc_tx_pending > 0) {
 		sc->sc_tx_pending -= count;
 		if (sc->sc_tx_pending == 0)
 			(*sc->sc_tx_intr)(sc->sc_tx_intrarg);
 	}
-	mutex_exit(&sc->sc_intr_lock);
 }
 
 static void
@@ -530,7 +530,6 @@ btsco_sco_input(void *arg, struct mbuf *
 
 	DPRINTFN(10, "%s len=%d\n", sc->sc_name, m->m_pkthdr.len);
 
-	mutex_enter(&sc->sc_intr_lock);
 	if (sc->sc_rx_want == 0) {
 		m_freem(m);
 	} else {
@@ -556,7 +555,6 @@ btsco_sco_input(void *arg, struct mbuf *
 		if (sc->sc_rx_want == 0)
 			(*sc->sc_rx_intr)(sc->sc_rx_intrarg);
 	}
-	mutex_exit(&sc->sc_intr_lock);
 }
 
 
@@ -777,7 +775,7 @@ btsco_round_blocksize(void *hdl, int bs,
 /*
  * Start Output
  *
- * We dont want to be calling the network stack with sc_intr_lock held
+ * We dont want to be calling the network stack with bt_lock held
  * so make a note of what is to be sent, and schedule an interrupt to
  * bundle it up and queue it.
  */
@@ -1079,8 +1077,8 @@ btsco_get_locks(void *hdl, kmutex_t **in
 {
 	struct btsco_softc *sc = hdl;
 
-	*intr = &sc->sc_intr_lock;
-	*thread = bt_lock;
+	*thread = &sc->sc_lock;
+	*intr = bt_lock;
 }
 
 /*
@@ -1141,12 +1139,12 @@ btsco_intr(void *arg)
 	if (sc->sc_sco == NULL)
 		return;		/* connection is lost */
 
+	mutex_enter(bt_lock);
 	block = sc->sc_tx_block;
 	size = sc->sc_tx_size;
 	sc->sc_tx_block = NULL;
 	sc->sc_tx_size = 0;
 
-	mutex_enter(bt_lock);
 	while (size > 0) {
 		MGETHDR(m, M_DONTWAIT, MT_DATA);
 		if (m == NULL)



CVS commit: src/sys/dev/pci

2017-05-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 28 05:27:14 UTC 2017

Modified Files:
src/sys/dev/pci: machfb.c

Log Message:
g/c some unused / #if 0-ed goop, support firmware-provided EDID, get rid of
private list of video modes
tested on macppc, should Just Work(tm) on sparc64


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/pci/machfb.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/dev/pci/machfb.c
diff -u src/sys/dev/pci/machfb.c:1.92 src/sys/dev/pci/machfb.c:1.93
--- src/sys/dev/pci/machfb.c:1.92	Mon Jul 11 11:31:51 2016
+++ src/sys/dev/pci/machfb.c	Sun May 28 05:27:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machfb.c,v 1.92 2016/07/11 11:31:51 msaitoh Exp $	*/
+/*	$NetBSD: machfb.c,v 1.93 2017/05/28 05:27:13 macallan Exp $	*/
 
 /*
  * Copyright (c) 2002 Bang Jun-Young
@@ -34,7 +34,7 @@
 
 #include 
 __KERNEL_RCSID(0,
-	"$NetBSD: machfb.c,v 1.92 2016/07/11 11:31:51 msaitoh Exp $");
+	"$NetBSD: machfb.c,v 1.93 2017/05/28 05:27:13 macallan Exp $");
 
 #include 
 #include 
@@ -124,6 +124,7 @@ struct mach64_softc {
 	int mem_freq;
 	int ramdac_freq;
 	int ref_freq;
+	int vclk_freq;
 
 	int ref_div;
 	int log2_vclk_post_div;
@@ -132,10 +133,12 @@ struct mach64_softc {
 	int mclk_post_div;
 	int mclk_fb_div;
 	int sc_clock;	/* which clock to use */
+	int minref, m;
 
 	struct videomode *sc_my_mode;
 	int sc_edid_size;
 	uint8_t sc_edid_data[1024];
+	struct edid_info sc_ei;
 
 	u_char sc_cmap_red[256];
 	u_char sc_cmap_green[256];
@@ -205,24 +208,6 @@ static const char *mach64_memtype_names[
 	"(unknown type)"
 };
 
-static struct videomode mach64_modes[] = {
-	/* 640x400 @ 70 Hz, 31.5 kHz */
-	{ 25175, 640, 664, 760, 800, 400, 409, 411, 450, 0, NULL, },
-	/* 640x480 @ 72 Hz, 36.5 kHz */
-	{ 25175, 640, 664, 760, 800, 480, 491, 493, 525, 0, NULL, },
-	/* 800x600 @ 72 Hz, 48.0 kHz */
-	{ 5, 800, 856, 976, 1040, 600, 637, 643, 666,
-	  VID_PHSYNC | VID_PVSYNC, NULL, },
-	/* 1024x768 @ 70 Hz, 56.5 kHz */
-	{ 75000, 1024, 1048, 1184, 1328, 768, 771, 777, 806,
-	  VID_NHSYNC | VID_NVSYNC, NULL, },
-	/* 1152x864 @ 70 Hz, 62.4 kHz */
-	{ 92000, 1152, 1208, 1368, 1474, 864, 865, 875, 895, 0, NULL, },
-	/* 1280x1024 @ 70 Hz, 74.59 kHz */
-	{ 126500, 1280, 1312, 1472, 1696, 1024, 1032, 1040, 1068,
-	  VID_NHSYNC | VID_NVSYNC, NULL, }
-};
-
 extern const u_char rasops_cmap[768];
 
 static int	mach64_match(device_t, cfdata_t, void *);
@@ -235,9 +220,7 @@ static void	mach64_init(struct mach64_so
 static int	mach64_get_memsize(struct mach64_softc *);
 static int	mach64_get_max_ramdac(struct mach64_softc *);
 
-#if defined(__sparc__) || defined(__powerpc__)
 static void	mach64_get_mode(struct mach64_softc *, struct videomode *);
-#endif
 
 static int	mach64_calc_crtcregs(struct mach64_softc *,
  struct mach64_crtcregs *,
@@ -256,8 +239,6 @@ static void	mach64_adjust_frame(struct m
 static void	mach64_init_lut(struct mach64_softc *);
 
 static void	mach64_init_screen(void *, struct vcons_screen *, int, long *);
-static int 	mach64_set_screentype(struct mach64_softc *,
-  const struct wsscreen_descr *);
 static int	mach64_is_console(struct mach64_softc *);
 
 static void	mach64_cursor(void *, int, int, int);
@@ -293,68 +274,13 @@ static struct wsscreen_descr mach64_defa
 	80, 30,
 	NULL,
 	8, 16,
-	WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
-	&default_mode
-}, mach64_80x25_screen = {
-	"80x25", 80, 25,
-	NULL,
-	8, 16,
-	WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
-	&mach64_modes[0]
-}, mach64_80x30_screen = {
-	"80x30", 80, 30,
-	NULL,
-	8, 16,
-	WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
-	&mach64_modes[1]
-}, mach64_80x40_screen = {
-	"80x40", 80, 40,
-	NULL,
-	8, 10,
-	WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
-	&mach64_modes[0]
-}, mach64_80x50_screen = {
-	"80x50", 80, 50,
-	NULL,
-	8, 8,
-	WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
-	&mach64_modes[0]
-}, mach64_100x37_screen = {
-	"100x37", 100, 37,
-	NULL,
-	8, 16,
-	WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
-	&mach64_modes[2]
-}, mach64_128x48_screen = {
-	"128x48", 128, 48,
-	NULL,
-	8, 16,
-	WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
-	&mach64_modes[3]
-}, mach64_144x54_screen = {
-	"144x54", 144, 54,
-	NULL,
-	8, 16,
-	WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
-	&mach64_modes[4]
-}, mach64_160x64_screen = {
-	"160x54", 160, 64,
-	NULL,
-	8, 16,
-	WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
-	&mach64_modes[5]
+	WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE
+	/* | WSSCREEN_RESIZE */,
+	NULL
 };
 
 static const struct wsscreen_descr *_mach64_scrlist[] = {
 	&mach64_defaultscreen,
-	&mach64_80x25_screen,
-	&mach64_80x30_screen,
-	&mach64_80x40_screen,
-	&mach64_80x50_screen,
-	&mach64_100x37_screen,
-	&mach64_128x48_screen,
-	&mach64_144x54_screen,
-	&mach64_160x64_screen
 };
 
 static struct wsscreen_list mach64_screenlist = {
@@ -366,11 +292,6 @@ static int	mach64_ioctl(void *, void *, 
 		 struct lwp *);
 static paddr_t	mach64_mmap(v