CVS commit: src/sys/dev/pci

2021-08-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Aug  8 12:17:37 UTC 2021

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

Log Message:
radeonfb: use BUS_SPACE_MAP_PREFETCHABLE for the framebuffer mapping

Makes the driver work on cia(4) based alpha machines, which can only
do dense access to linear mappings with prefetch. ok macallan@


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/pci/radeonfb.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/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.116 src/sys/dev/pci/radeonfb.c:1.117
--- src/sys/dev/pci/radeonfb.c:1.116	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/radeonfb.c	Sun Aug  8 12:17:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.116 2021/08/07 16:19:14 thorpej Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.117 2021/08/08 12:17:37 tnn Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.116 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.117 2021/08/08 12:17:37 tnn Exp $");
 
 #include 
 #include 
@@ -799,7 +799,8 @@ radeonfb_attach(device_t parent, device_
 
 	sc->sc_memt = pa->pa_memt;
 	if (bus_space_map(sc->sc_memt, sc->sc_memaddr, sc->sc_memsz,
-		BUS_SPACE_MAP_LINEAR, >sc_memh) != 0) {
+		BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
+		>sc_memh) != 0) {
 		sc->sc_memsz = 0;
 		aprint_error("%s: Unable to map frame buffer\n", XNAME(sc));
 		goto error;
@@ -1098,7 +1099,8 @@ radeonfb_map(struct radeonfb_softc *sc)
 			return;
 		}
 		if (bus_space_map(sc->sc_memt, sc->sc_memaddr, sc->sc_memsz,
-		BUS_SPACE_MAP_LINEAR, >sc_memh) != 0) {
+		BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
+		>sc_memh) != 0) {
 			sc->sc_memsz = 0;
 			aprint_error_dev(sc->sc_dev,
 			"Unable to map frame buffer\n");



CVS commit: src/sys/dev/ic

2021-08-06 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug  6 18:15:48 UTC 2021

Modified Files:
src/sys/dev/ic: ssdfb.c

Log Message:
conditionally put back the include of 

This is a kludge to fix the build on some ports. According to pmap(9),
including  should be sufficient to use
"bool pmap_is_modified(struct vm_page *pg)". However, on several ports,
the function is implemented as a macro and depends on implementation
details of "struct vm_page *", which is normally an incomplete forward
declaration only. XXX revert when all ports are fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/ssdfb.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/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.19 src/sys/dev/ic/ssdfb.c:1.20
--- src/sys/dev/ic/ssdfb.c:1.19	Thu Aug  5 22:31:20 2021
+++ src/sys/dev/ic/ssdfb.c	Fri Aug  6 18:15:48 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.20 2021/08/06 18:15:48 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.20 2021/08/06 18:15:48 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -43,6 +43,9 @@ __KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.
 
 #include 
 #include 
+#ifdef pmap_is_modified
+#include 
+#endif
 
 #include 
 #include 



CVS commit: src/sys/dev

2021-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 22:31:20 UTC 2021

Modified Files:
src/sys/dev/i2c: ssdfb_i2c.c
src/sys/dev/ic: ssdfb.c ssdfbvar.h

Log Message:
ssdfb: revert rev 1.14

Can't run the worker thread MPSAFE with spi(4) yet because most controller
drivers still lack MP safety. Cause issues when using multiple displays.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/i2c/ssdfb_i2c.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/ssdfb.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/ssdfbvar.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/i2c/ssdfb_i2c.c
diff -u src/sys/dev/i2c/ssdfb_i2c.c:1.10 src/sys/dev/i2c/ssdfb_i2c.c:1.11
--- src/sys/dev/i2c/ssdfb_i2c.c:1.10	Fri Jul 30 13:44:09 2021
+++ src/sys/dev/i2c/ssdfb_i2c.c	Thu Aug  5 22:31:20 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $ */
+/* $NetBSD: ssdfb_i2c.c,v 1.11 2021/08/05 22:31:20 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.11 2021/08/05 22:31:20 tnn Exp $");
 
 #include 
 #include 
@@ -112,6 +112,7 @@ ssdfb_i2c_attach(device_t parent, device
 	if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN)
 		flags |= SSDFB_PRODUCT_SSD1306_GENERIC;
 
+	flags |= SSDFB_ATTACH_FLAG_MPSAFE;
 	sc->sc.sc_dev = self;
 	sc->sc_i2c_tag = ia->ia_tag;
 	sc->sc_i2c_addr = ia->ia_addr;

Index: src/sys/dev/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.18 src/sys/dev/ic/ssdfb.c:1.19
--- src/sys/dev/ic/ssdfb.c:1.18	Thu Aug  5 19:07:09 2021
+++ src/sys/dev/ic/ssdfb.c	Thu Aug  5 22:31:20 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -268,6 +268,7 @@ ssdfb_attach(struct ssdfb_softc *sc, int
 	int error = 0;
 	long defattr;
 	const struct ssdfb_product *p;
+	int kt_flags;
 
 	p = ssdfb_lookup_product(flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK);
 	if (p == NULL) {
@@ -393,11 +394,15 @@ ssdfb_attach(struct ssdfb_softc *sc, int
 	if (sc->sc_is_console)
 		ssdfb_set_usepoll(sc, true);
 
-	mutex_init(>sc_cond_mtx, MUTEX_DEFAULT, IPL_SCHED);
+	mutex_init(>sc_cond_mtx, MUTEX_DEFAULT,
+	ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE) ? IPL_SCHED : IPL_BIO);
 	cv_init(>sc_cond, "ssdfb");
-	error = kthread_create(PRI_SOFTCLOCK, KTHREAD_MUSTJOIN | KTHREAD_MPSAFE,
-	NULL, ssdfb_thread, sc,  >sc_thread, "%s",
-	device_xname(sc->sc_dev));
+	kt_flags = KTHREAD_MUSTJOIN;
+	/* XXX spi(4) is not MPSAFE yet. */
+	if (ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE))
+		kt_flags |= KTHREAD_MPSAFE;
+	error = kthread_create(PRI_SOFTCLOCK, kt_flags, NULL, ssdfb_thread, sc,
+	>sc_thread, "%s", device_xname(sc->sc_dev));
 	if (error) {
 		cv_destroy(>sc_cond);
 		mutex_destroy(>sc_cond_mtx);

Index: src/sys/dev/ic/ssdfbvar.h
diff -u src/sys/dev/ic/ssdfbvar.h:1.9 src/sys/dev/ic/ssdfbvar.h:1.10
--- src/sys/dev/ic/ssdfbvar.h:1.9	Thu Aug  5 19:07:09 2021
+++ src/sys/dev/ic/ssdfbvar.h	Thu Aug  5 22:31:20 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfbvar.h,v 1.9 2021/08/05 19:07:09 tnn Exp $ */
+/* $NetBSD: ssdfbvar.h,v 1.10 2021/08/05 22:31:20 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -36,6 +36,7 @@
 #define SSDFB_ATTACH_FLAG_UPSIDEDOWN		0x0100
 #define SSDFB_ATTACH_FLAG_INVERSE		0x0200
 #define SSDFB_ATTACH_FLAG_CONSOLE		0x0400
+#define SSDFB_ATTACH_FLAG_MPSAFE		0x0800
 
 /*
  * Fundamental commands



CVS commit: src/share/man/man4

2021-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 19:23:45 UTC 2021

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

Log Message:
ssdfb(4): note SSD1353 support


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/ssdfb.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/ssdfb.4
diff -u src/share/man/man4/ssdfb.4:1.6 src/share/man/man4/ssdfb.4:1.7
--- src/share/man/man4/ssdfb.4:1.6	Sun Aug  1 16:17:05 2021
+++ src/share/man/man4/ssdfb.4	Thu Aug  5 19:23:44 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ssdfb.4,v 1.6 2021/08/01 16:17:05 tnn Exp $
+.\"	$NetBSD: ssdfb.4,v 1.7 2021/08/05 19:23:44 tnn Exp $
 .\"
 .\" Copyright (c) 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 1, 2021
+.Dd August 5, 2021
 .Dt SSDFB 4
 .Os
 .Sh NAME
@@ -54,6 +54,8 @@ Solomon Systech Ltd SSD1306
 Sino Wealth Electronic Ltd SH1106
 .It
 Solomon Systech Ltd SSD1322
+.It
+Solomon Systech Ltd SSD1353
 .El
 .Pp
 The following products (controller + panel assemblies) are supported:
@@ -73,6 +75,12 @@ Adafruit Industries, LLC product 931 (12
 .It
 .Em 0x05 :
 Generic SSD1322 modules using default settings
+.It
+.Em 0x06 :
+Generic SSD1353 modules using default settings
+.It
+.Em 0x07 :
+Display Elektronik GmbH DEP 160128A(1)-RGB
 .El
 .Pp
 The flags value can contain one or more of the following, bitwise OR'ed:



CVS commit: src/sys/dev/spi

2021-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 19:17:22 UTC 2021

Modified Files:
src/sys/dev/spi: ssdfb_spi.c

Log Message:
ssdfb: fix some constant names. NFC because the same cmd code is used


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/spi/ssdfb_spi.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/spi/ssdfb_spi.c
diff -u src/sys/dev/spi/ssdfb_spi.c:1.8 src/sys/dev/spi/ssdfb_spi.c:1.9
--- src/sys/dev/spi/ssdfb_spi.c:1.8	Thu Aug  5 19:08:59 2021
+++ src/sys/dev/spi/ssdfb_spi.c	Thu Aug  5 19:17:22 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_spi.c,v 1.8 2021/08/05 19:08:59 tnn Exp $ */
+/* $NetBSD: ssdfb_spi.c,v 1.9 2021/08/05 19:17:22 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.8 2021/08/05 19:08:59 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.9 2021/08/05 19:17:22 tnn Exp $");
 
 #include 
 #include 
@@ -410,7 +410,7 @@ ssdfb_spi_xfer_rect_4wire_ssd1353(void *
 		return 0;
 
 	ssdfb_spi_4wire_set_dc(sc, 0);
-	cmd = SSD1322_CMD_SET_ROW_ADDRESS;
+	cmd = SSD1353_CMD_SET_ROW_ADDRESS;
 	error = spi_send(sc->sc_sh, sizeof(cmd), );
 	if (error)
 		return error;
@@ -427,7 +427,7 @@ ssdfb_spi_xfer_rect_4wire_ssd1353(void *
 		return error;
 
 	ssdfb_spi_4wire_set_dc(sc, 0);
-	cmd = SSD1322_CMD_SET_COLUMN_ADDRESS;
+	cmd = SSD1353_CMD_SET_COLUMN_ADDRESS;
 	error = spi_send(sc->sc_sh, sizeof(cmd), );
 	if (error)
 		return error;
@@ -439,7 +439,7 @@ ssdfb_spi_xfer_rect_4wire_ssd1353(void *
 		return error;
 
 	ssdfb_spi_4wire_set_dc(sc, 0);
-	cmd = SSD1322_CMD_WRITE_RAM;
+	cmd = SSD1353_CMD_WRITE_RAM;
 	error = spi_send(sc->sc_sh, sizeof(cmd), );
 	if (error)
 		return error;



CVS commit: src/sys/dev/spi

2021-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 19:08:59 UTC 2021

Modified Files:
src/sys/dev/spi: ssdfb_spi.c

Log Message:
ssdfb: support SSD1353 at spi(4)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/spi/ssdfb_spi.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/spi/ssdfb_spi.c
diff -u src/sys/dev/spi/ssdfb_spi.c:1.7 src/sys/dev/spi/ssdfb_spi.c:1.8
--- src/sys/dev/spi/ssdfb_spi.c:1.7	Tue Aug  3 11:30:25 2021
+++ src/sys/dev/spi/ssdfb_spi.c	Thu Aug  5 19:08:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_spi.c,v 1.7 2021/08/03 11:30:25 tnn Exp $ */
+/* $NetBSD: ssdfb_spi.c,v 1.8 2021/08/05 19:08:59 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.7 2021/08/03 11:30:25 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.8 2021/08/05 19:08:59 tnn Exp $");
 
 #include 
 #include 
@@ -70,6 +70,8 @@ static int	ssdfb_spi_xfer_rect_3wire_ssd
 static int	ssdfb_spi_cmd_4wire(void *, uint8_t *, size_t, bool);
 static int	ssdfb_spi_xfer_rect_4wire_ssd1322(void *, uint8_t, uint8_t,
 		uint8_t, uint8_t, uint8_t *, size_t, bool);
+static int	ssdfb_spi_xfer_rect_4wire_ssd1353(void *, uint8_t, uint8_t,
+		uint8_t, uint8_t, uint8_t *, size_t, bool);
 
 static void	ssdfb_bitstream_init(struct bs_state *, uint8_t *);
 static void	ssdfb_bitstream_append(struct bs_state *, uint8_t, uint8_t);
@@ -84,6 +86,8 @@ CFATTACH_DECL_NEW(ssdfb_spi, sizeof(stru
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "solomon,ssd1306",	.value = SSDFB_PRODUCT_SSD1306_GENERIC },
 	{ .compat = "solomon,ssd1322",	.value = SSDFB_PRODUCT_SSD1322_GENERIC },
+	{ .compat = "solomon,ssd1353",	.value = SSDFB_PRODUCT_SSD1353_GENERIC },
+	{ .compat = "dep160128a",	.value = SSDFB_PRODUCT_DEP_160128A_RGB },
 	DEVICE_COMPAT_EOL
 };
 
@@ -154,28 +158,32 @@ ssdfb_spi_attach(device_t parent, device
 	sc->sc_3wiremode = true;
 #endif
 
+	sc->sc.sc_cmd = sc->sc_3wiremode
+	? ssdfb_spi_cmd_3wire
+	: ssdfb_spi_cmd_4wire;
+
 	switch (flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) {
 	case SSDFB_PRODUCT_SSD1322_GENERIC:
-		if (sc->sc_3wiremode) {
-			sc->sc.sc_transfer_rect =
-			ssdfb_spi_xfer_rect_3wire_ssd1322;
-		} else {
-			sc->sc.sc_transfer_rect =
-			ssdfb_spi_xfer_rect_4wire_ssd1322;
-		}
+		sc->sc.sc_transfer_rect = sc->sc_3wiremode
+		? ssdfb_spi_xfer_rect_3wire_ssd1322
+		: ssdfb_spi_xfer_rect_4wire_ssd1322;
+		break;
+	case SSDFB_PRODUCT_SSD1353_GENERIC:
+	case SSDFB_PRODUCT_DEP_160128A_RGB:
+		sc->sc.sc_transfer_rect = sc->sc_3wiremode
+		? NULL /* not supported here */
+		: ssdfb_spi_xfer_rect_4wire_ssd1353;
 		break;
-	default:
-		panic("ssdfb_spi_attach: product not implemented");
 	}
-	if (sc->sc_3wiremode) {
-		sc->sc.sc_cmd = ssdfb_spi_cmd_3wire;
-	} else {
-		sc->sc.sc_cmd = ssdfb_spi_cmd_4wire;
+
+	if (!sc->sc.sc_transfer_rect) {
+		aprint_error(": sc_transfer_rect not implemented\n");
+		return;
 	}
 
 	ssdfb_attach(>sc, flags);
 
-	device_printf(sc->sc.sc_dev, "%d-wire SPI interface\n",
+	aprint_normal_dev(self, "%d-wire SPI interface\n",
 	sc->sc_3wiremode == true ? 3 : 4);
 }
 
@@ -381,3 +389,79 @@ ssdfb_spi_xfer_rect_4wire_ssd1322(void *
 
 	return 0;
 }
+
+static int
+ssdfb_spi_xfer_rect_4wire_ssd1353(void *cookie, uint8_t fromcol, uint8_t tocol,
+uint8_t fromrow, uint8_t torow, uint8_t *p, size_t stride, bool usepoll)
+{
+	struct ssdfb_spi_softc *sc = (struct ssdfb_spi_softc *)cookie;
+	uint8_t row;
+	size_t rlen = (tocol + 1 - fromcol) * 3;
+	uint8_t bitstream[160 * 3];
+	uint8_t *dstp, *srcp, *endp;
+	int error;
+	uint8_t cmd;
+	uint8_t data[2];
+
+	/*
+	 * Unlike iic(4), there is no way to force spi(4) to use polling.
+	 */
+	if (usepoll && !cold)
+		return 0;
+
+	ssdfb_spi_4wire_set_dc(sc, 0);
+	cmd = SSD1322_CMD_SET_ROW_ADDRESS;
+	error = spi_send(sc->sc_sh, sizeof(cmd), );
+	if (error)
+		return error;
+	ssdfb_spi_4wire_set_dc(sc, 1);
+	data[0] = fromrow;
+	data[1] = torow;
+	if (sc->sc.sc_upsidedown) {
+		/* fix picture outside frame on 160x128 panel */
+		data[0] += 132 - sc->sc.sc_p->p_height;
+		data[1] += 132 - sc->sc.sc_p->p_height;
+	}
+	error = spi_send(sc->sc_sh, sizeof(data), data);
+	if (error)
+		return error;
+
+	ssdfb_spi_4wire_set_dc(sc, 0);
+	cmd = SSD1322_CMD_SET_COLUMN_ADDRESS;
+	error = spi_send(sc->sc_sh, sizeof(cmd), );
+	if (error)
+		return error;
+	ssdfb_spi_4wire_set_dc(sc, 1);
+	data[0] = fromcol;
+	data[1] = tocol;
+	error = spi_send(sc->sc_sh, sizeof(data), data);
+	if (error)
+		return error;
+
+	ssdfb_spi_4wire_set_dc(sc, 0);
+	cmd = SSD1322_CMD_WRITE_RAM;
+	error = spi_send(sc->sc_sh, sizeof(cmd), );
+	if (error)
+		return error;
+
+	ssdfb_spi_4wire_set_dc(sc, 1);
+	KASSERT(rlen <= sizeof(bitstream));
+	for (row = fromrow; row <= torow; row++) {
+		/* downconvert each row from 

CVS commit: src/sys/dev/ic

2021-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 19:07:09 UTC 2021

Modified Files:
src/sys/dev/ic: ssdfb.c ssdfbvar.h

Log Message:
ssdfb: support the SSD1353 controller and the DEP 160128A(1)-RGB display

DEP 160128A is a 160x128 18-bit RGB OLED display module advertised as
having an 8-bit parallel I/O interface. The controller can however attach
serially via spi(4) by moving jumper resistors J1 and J2 to GND position.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/ssdfb.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/ssdfbvar.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/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.17 src/sys/dev/ic/ssdfb.c:1.18
--- src/sys/dev/ic/ssdfb.c:1.17	Thu Aug  5 00:16:36 2021
+++ src/sys/dev/ic/ssdfb.c	Thu Aug  5 19:07:09 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.17 2021/08/05 00:16:36 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.17 2021/08/05 00:16:36 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -75,6 +75,7 @@ static void	ssdfb_cursor(void *, int, in
 /* hardware interface */
 static int	ssdfb_init_ssd1306(struct ssdfb_softc *);
 static int	ssdfb_init_ssd1322(struct ssdfb_softc *);
+static int	ssdfb_init_ssd1353(struct ssdfb_softc *);
 static int	ssdfb_set_contrast(struct ssdfb_softc *, uint8_t, bool);
 static int	ssdfb_set_display_on(struct ssdfb_softc *, bool, bool);
 static int	ssdfb_set_mode(struct ssdfb_softc *, u_int);
@@ -89,6 +90,7 @@ static void	ssdfb_set_usepoll(struct ssd
 static int	ssdfb_sync(struct ssdfb_softc *, bool);
 static int	ssdfb_sync_ssd1306(struct ssdfb_softc *, bool);
 static int	ssdfb_sync_ssd1322(struct ssdfb_softc *, bool);
+static int	ssdfb_sync_ssd1353(struct ssdfb_softc *, bool);
 static uint64_t	ssdfb_transpose_block(uint8_t *, size_t);
 
 /* misc helpers */
@@ -104,7 +106,8 @@ static const char *ssdfb_controller_name
 	[SSDFB_CONTROLLER_UNKNOWN] =	"unknown",
 	[SSDFB_CONTROLLER_SSD1306] =	"Solomon Systech SSD1306",
 	[SSDFB_CONTROLLER_SH1106] =	"Sino Wealth SH1106",
-	[SSDFB_CONTROLLER_SSD1322] =	"Solomon Systech SSD1322"
+	[SSDFB_CONTROLLER_SSD1322] =	"Solomon Systech SSD1322",
+	[SSDFB_CONTROLLER_SSD1353] =	"Solomon Systech SSD1353"
 };
 
 /*
@@ -204,6 +207,44 @@ static const struct ssdfb_product ssdfb_
 		.p_multiplex_ratio =	0x3f,
 		.p_init =		ssdfb_init_ssd1322,
 		.p_sync =		ssdfb_sync_ssd1322
+	},
+	{
+		.p_product_id =		SSDFB_PRODUCT_SSD1353_GENERIC,
+		.p_controller_id =	SSDFB_CONTROLLER_SSD1353,
+		.p_name =		"generic",
+		.p_width =		160,
+		.p_height =		132,
+		.p_bits_per_pixel =	32,
+		.p_rgb = 		true,
+		.p_panel_shift =	0,
+		.p_compin_cfg = SSD1353_REMAP_RGB | SSD1353_REMAP_SPLIT_ODD_EVEN
+		| __SHIFTIN(2, SSD1353_REMAP_PIXEL_FORMAT_MASK),
+		.p_vcomh_deselect_level = SSD1353_DEFAULT_VCOMH,
+		.p_fosc =		SSD1353_DEFAULT_FREQUENCY,
+		.p_fosc_div =		SSD1353_DEFAULT_DIVIDER,
+		.p_default_contrast =	SSD1353_DEFAULT_CONTRAST_CONTROL,
+		.p_multiplex_ratio =	0x83,
+		.p_init =		ssdfb_init_ssd1353,
+		.p_sync =		ssdfb_sync_ssd1353
+	},
+	{
+		.p_product_id =		SSDFB_PRODUCT_DEP_160128A_RGB,
+		.p_controller_id =	SSDFB_CONTROLLER_SSD1353,
+		.p_name =		"Display Elektronik GmbH DEP 160128A(1)-RGB",
+		.p_width =		160,
+		.p_height =		128,
+		.p_bits_per_pixel =	32,
+		.p_rgb = 		true,
+		.p_panel_shift =	0,
+		.p_compin_cfg = SSD1353_REMAP_RGB | SSD1353_REMAP_SPLIT_ODD_EVEN
+		| __SHIFTIN(2, SSD1353_REMAP_PIXEL_FORMAT_MASK),
+		.p_vcomh_deselect_level = SSD1353_DEFAULT_VCOMH,
+		.p_fosc =		SSD1353_DEFAULT_FREQUENCY,
+		.p_fosc_div =		SSD1353_DEFAULT_DIVIDER,
+		.p_default_contrast =	SSD1353_DEFAULT_CONTRAST_CONTROL,
+		.p_multiplex_ratio =	0x83,
+		.p_init =		ssdfb_init_ssd1353,
+		.p_sync =		ssdfb_sync_ssd1353
 	}
 };
 
@@ -872,18 +913,148 @@ ssdfb_init_ssd1322(struct ssdfb_softc *s
 }
 
 static int
+ssdfb_init_ssd1353(struct ssdfb_softc *sc)
+{
+	int error;
+	uint8_t cmd[3];
+	bool usepoll = true;
+	uint8_t remap;
+
+	/*
+	 * Enter sleep.
+	 */
+	SSDFB_CMD2(SSD1353_CMD_SET_COMMAND_LOCK, SSD1353_COMMAND_UNLOCK_MAGIC);
+	if (error)
+		return error;
+	SSDFB_CMD1(SSD1353_CMD_RESET);
+	if (error)
+		return error;
+	SSDFB_CMD1(SSD1353_CMD_DEACTIVATE_SCROLL);
+	if (error)
+		return error;
+	SSDFB_CMD1(SSD1353_CMD_SET_DISPLAY_OFF);
+	if (error)
+		return error;
+
+	/*
+	 * Start charge pumps.
+	 */
+	SSDFB_CMD2(SSD1353_CMD_SET_VCOMH, sc->sc_p->p_vcomh_deselect_level);
+	if (error)
+		return error;
+	SSDFB_CMD2(SSD1353_CMD_SET_PRE_CHARGE_VOLTAGE_LEVEL,
+	SSD1353_DEFAULT_PRE_CHARGE_VOLTAGE_LEVEL);
+	if (error)
+		return error;
+
+	/*
+	 * Configure timing characteristics.
+	 */
+	SSDFB_CMD2(SSD1353_CMD_SET_FRONT_CLOCK_DIVIDER,
+	   

CVS commit: src/sys/dev/ic

2021-08-04 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 00:16:36 UTC 2021

Modified Files:
src/sys/dev/ic: ssdfb.c ssdfbvar.h

Log Message:
ssdfb: prepare for supporting rgb color displays


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/ssdfb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/ssdfbvar.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/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.16 src/sys/dev/ic/ssdfb.c:1.17
--- src/sys/dev/ic/ssdfb.c:1.16	Thu Aug  5 00:02:51 2021
+++ src/sys/dev/ic/ssdfb.c	Thu Aug  5 00:16:36 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.16 2021/08/05 00:02:51 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.17 2021/08/05 00:16:36 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.16 2021/08/05 00:02:51 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.17 2021/08/05 00:16:36 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -268,16 +268,35 @@ ssdfb_attach(struct ssdfb_softc *sc, int
 		goto out;
 	}
 #ifdef SSDFB_USE_NATIVE_DEPTH
-	ri->ri_depth =	sc->sc_p->p_bits_per_pixel;
+	ri->ri_depth = sc->sc_p->p_bits_per_pixel;
 #else
-	ri->ri_depth =	8;
+	if (sc->sc_p->p_rgb && sc->sc_p->p_bits_per_pixel == 32) {
+		ri->ri_depth = sc->sc_p->p_bits_per_pixel;
+		ri->ri_rnum = 8;
+		ri->ri_gnum = 8;
+		ri->ri_bnum = 8;
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+		ri->ri_rpos = 0;
+		ri->ri_gpos = 8;
+		ri->ri_bpos = 16;
+#else
+		ri->ri_rpos = 24;
+		ri->ri_gpos = 16;
+		ri->ri_bpos = 8;
+#endif
+	} else {
+		ri->ri_depth = 8;
+	}
 #endif
 	ri->ri_font =	sc->sc_font;
 	ri->ri_width =	sc->sc_p->p_width;
 	ri->ri_height =	sc->sc_p->p_height;
 	ri->ri_stride =	ri->ri_width * ri->ri_depth / 8;
 	ri->ri_hw =	sc;
-	ri->ri_flg =	RI_FULLCLEAR | RI_FORCEMONO;
+	ri->ri_flg =	RI_FULLCLEAR;
+	if (!sc->sc_p->p_rgb) {
+		ri->ri_flg |= RI_FORCEMONO;
+	}
 	sc->sc_ri_bits_len = round_page(ri->ri_stride * ri->ri_height);
 	ri->ri_bits	= (u_char *)uvm_km_alloc(kernel_map, sc->sc_ri_bits_len,
 		 0, UVM_KMF_WIRED);
@@ -290,7 +309,9 @@ ssdfb_attach(struct ssdfb_softc *sc, int
 	if (error)
 		goto out;
 
-	ri->ri_caps &= ~WSSCREEN_WSCOLORS;
+	if (!sc->sc_p->p_rgb) {
+		ri->ri_caps &= ~WSSCREEN_WSCOLORS;
+	}
 
 	/*
 	 * Save original emul ops & insert our damage notification hooks.
@@ -425,8 +446,10 @@ ssdfb_ioctl(void *v, void *vs, u_long cm
 	case WSDISPLAYIO_GET_FBINFO:
 		fbi = (struct wsdisplayio_fbinfo *)data;
 		error = wsdisplayio_get_fbinfo(>sc_ri, fbi);
-		fbi->fbi_subtype.fbi_cmapinfo.cmap_entries = cmaplen;
-		/* fbi->fbi_pixeltype = WSFB_GREYSCALE */;
+		if (!sc->sc_p->p_rgb) {
+			fbi->fbi_subtype.fbi_cmapinfo.cmap_entries = cmaplen;
+			/* fbi->fbi_pixeltype = WSFB_GREYSCALE */;
+		}
 		return error;
 	case WSDISPLAYIO_LINEBYTES:
 		*(u_int *)data = sc->sc_ri.ri_stride;
@@ -483,6 +506,8 @@ ssdfb_ioctl(void *v, void *vs, u_long cm
 		return 0;
 #endif
 	case WSDISPLAYIO_GETCMAP:
+		if (sc->sc_p->p_rgb)
+			return ENOTSUP;
 		wc = (struct wsdisplay_cmap *)data;
 		if (wc->index >= cmaplen ||
 		wc->count > cmaplen - wc->index)
@@ -1117,9 +1142,9 @@ ssdfb_sync_ssd1322(struct ssdfb_softc *s
 	 * Transfer rasops bitmap into gddram shadow buffer while keeping track
 	 * of the bounding box of the dirty region we scribbled over.
 	 */
-	x1 = sc->sc_p->p_width;
+	x1 = width;
 	x2 = -1;
-	y1 = sc->sc_p->p_height;
+	y1 = height;
 	y2 = -1;
 	blockp = (uint16_t*)sc->sc_gddram;
 	for (y = 0; y < height; y++) {

Index: src/sys/dev/ic/ssdfbvar.h
diff -u src/sys/dev/ic/ssdfbvar.h:1.7 src/sys/dev/ic/ssdfbvar.h:1.8
--- src/sys/dev/ic/ssdfbvar.h:1.7	Mon Aug  2 14:00:48 2021
+++ src/sys/dev/ic/ssdfbvar.h	Thu Aug  5 00:16:36 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfbvar.h,v 1.7 2021/08/02 14:00:48 tnn Exp $ */
+/* $NetBSD: ssdfbvar.h,v 1.8 2021/08/05 00:16:36 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -235,6 +235,13 @@
 #define SSD1353_CMD_SET_SECOND_PRECHARGE_SPEED		0x8a
 	#define SSD1353_DEFAULT_SECOND_PRECHARGE_SPEED	2
 #define SSD1353_CMD_REMAP_COLOR_DEPTH			0xa0
+	#define SSD1353_REMAP_NO_INCREMENT		__BIT(0)
+	#define SSD1353_REMAP_SEG_DIRECTION		__BIT(1)
+	#define SSD1353_REMAP_RGB			__BIT(2)
+	#define SSD1353_REMAP_LR			__BIT(3)
+	#define SSD1353_REMAP_COM_DIRECTION		__BIT(4)
+	#define SSD1353_REMAP_SPLIT_ODD_EVEN		__BIT(5)
+	#define SSD1353_REMAP_PIXEL_FORMAT_MASK		__BITS(7, 6)
 #define SSD1353_CMD_SET_DISPLAY_START_LINE		SSD1322_CMD_SET_DISPLAY_START_LINE
 #define SSD1353_CMD_SET_DISPLAY_OFFSET			SSD1322_CMD_SET_DISPLAY_OFFSET
 #define SSD1353_CMD_SET_VERTICAL_SCROLL_AREA		SSDFB_CMD_SET_VERTICAL_SCROLL_AREA
@@ -305,6 +312,7 @@ struct ssdfb_product {
 	intp_width;
 	intp_height;
 	intp_bits_per_pixel;
+	boolp_rgb;
 	intp_panel_shift;
 	uint8_tp_fosc;
 	uint8_tp_fosc_div;



CVS commit: src/sys/dev/ic

2021-08-04 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 00:02:51 UTC 2021

Modified Files:
src/sys/dev/ic: ssdfb.c

Log Message:
ssdfb: make it work on big-endian


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/ssdfb.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/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.15 src/sys/dev/ic/ssdfb.c:1.16
--- src/sys/dev/ic/ssdfb.c:1.15	Mon Aug  2 14:00:48 2021
+++ src/sys/dev/ic/ssdfb.c	Thu Aug  5 00:02:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.15 2021/08/02 14:00:48 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.16 2021/08/05 00:02:51 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.15 2021/08/02 14:00:48 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.16 2021/08/05 00:02:51 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -1126,24 +1126,27 @@ ssdfb_sync_ssd1322(struct ssdfb_softc *s
 		src = (uint16_t*)>ri_bits[y * ri->ri_stride];
 		src32 = (uint32_t*)src;
 		for (x = 0; x < width_in_blocks; x++) {
-#if _BYTE_ORDER == _LITTLE_ENDIAN
-#  ifdef SSDFB_USE_NATIVE_DEPTH
+#ifdef SSDFB_USE_NATIVE_DEPTH
 			raw_block =
 			((*src << 12) & 0xf000) |
-			((*src << 4) & 0x0f00) |
-			((*src >> 4) & 0x00f0) |
+			((*src << 4)  & 0x0f00) |
+			((*src >> 4)  & 0x00f0) |
 			((*src >> 12) & 0x000f);
 			src++;
-#  else
+#else
 			raw_block =
+#  if _BYTE_ORDER == _LITTLE_ENDIAN
 			((*src32 <<  8) & 0x0f00) |
 			((*src32 <<  4) & 0xf000) |
 			((*src32 >> 16) & 0x000f) |
 			((*src32 >> 20) & 0x00f0);
+#  else
+			((*src32 >> 24) & 0x000f) |
+			((*src32 >> 12) & 0x00f0) |
+			((*src32  ) & 0x0f00) |
+			((*src32 << 12) & 0xf000);
 #  endif
 			src32++;
-#else
-#  error please add big endian host support here
 #endif
 			if (raw_block != *blockp) {
 *blockp = raw_block;
@@ -1159,7 +1162,6 @@ ssdfb_sync_ssd1322(struct ssdfb_softc *s
 			blockp++;
 		}
 	}
-
 	blockp = (uint16_t*)sc->sc_gddram;
 	if (x2 != -1)
 		return sc->sc_transfer_rect(sc->sc_cookie,



CVS commit: src/sys/dev/spi

2021-08-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Aug  3 11:30:26 UTC 2021

Modified Files:
src/sys/dev/spi: ssdfb_spi.c

Log Message:
ssdfb: support having an optional reset pin


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/spi/ssdfb_spi.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/spi/ssdfb_spi.c
diff -u src/sys/dev/spi/ssdfb_spi.c:1.6 src/sys/dev/spi/ssdfb_spi.c:1.7
--- src/sys/dev/spi/ssdfb_spi.c:1.6	Sun Aug  1 14:56:18 2021
+++ src/sys/dev/spi/ssdfb_spi.c	Tue Aug  3 11:30:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_spi.c,v 1.6 2021/08/01 14:56:18 tnn Exp $ */
+/* $NetBSD: ssdfb_spi.c,v 1.7 2021/08/03 11:30:25 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.6 2021/08/01 14:56:18 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.7 2021/08/03 11:30:25 tnn Exp $");
 
 #include 
 #include 
@@ -55,6 +55,7 @@ struct ssdfb_spi_softc {
 	struct spi_handle	*sc_sh;
 #ifdef FDT
 	struct fdtbus_gpio_pin	*sc_gpio_dc;
+	struct fdtbus_gpio_pin	*sc_gpio_res;
 #endif
 	bool			sc_3wiremode;
 };
@@ -133,13 +134,22 @@ ssdfb_spi_attach(device_t parent, device
 	 * 4 wire mode sends 8 bit sequences and requires an auxiliary GPIO
 	 * pin for the command/data bit.
 	 */
-	sc->sc_3wiremode = true;
 #ifdef FDT
 	const int phandle = sa->sa_cookie;
-	sc->sc_gpio_dc = fdtbus_gpio_acquire(phandle, "dc-gpio", GPIO_PIN_OUTPUT);
+	sc->sc_gpio_dc =
+	fdtbus_gpio_acquire(phandle, "dc-gpio", GPIO_PIN_OUTPUT);
 	if (!sc->sc_gpio_dc)
-		sc->sc_gpio_dc = fdtbus_gpio_acquire(phandle, "cd-gpio", GPIO_PIN_OUTPUT);
+		sc->sc_gpio_dc =
+		fdtbus_gpio_acquire(phandle, "cd-gpio", GPIO_PIN_OUTPUT);
 	sc->sc_3wiremode = (sc->sc_gpio_dc == NULL);
+	sc->sc_gpio_res =
+	fdtbus_gpio_acquire(phandle, "res-gpio", GPIO_PIN_OUTPUT);
+	if (sc->sc_gpio_res) {
+		fdtbus_gpio_write_raw(sc->sc_gpio_res, 0);
+		DELAY(100);
+		fdtbus_gpio_write_raw(sc->sc_gpio_res, 1);
+		DELAY(100);
+	}
 #else
 	sc->sc_3wiremode = true;
 #endif



CVS commit: src/sys/dev/ic

2021-08-02 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  2 14:00:48 UTC 2021

Modified Files:
src/sys/dev/ic: ssdfb.c ssdfbvar.h

Log Message:
ssdfb: define SSD1353 command set

also adjust some SSD1322 command names


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/ssdfb.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/ssdfbvar.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/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.14 src/sys/dev/ic/ssdfb.c:1.15
--- src/sys/dev/ic/ssdfb.c:1.14	Fri Jul 30 13:44:09 2021
+++ src/sys/dev/ic/ssdfb.c	Mon Aug  2 14:00:48 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.14 2021/07/30 13:44:09 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.15 2021/08/02 14:00:48 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.14 2021/07/30 13:44:09 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.15 2021/08/02 14:00:48 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -271,7 +271,7 @@ ssdfb_attach(struct ssdfb_softc *sc, int
 	ri->ri_depth =	sc->sc_p->p_bits_per_pixel;
 #else
 	ri->ri_depth =	8;
-#endif	
+#endif
 	ri->ri_font =	sc->sc_font;
 	ri->ri_width =	sc->sc_p->p_width;
 	ri->ri_height =	sc->sc_p->p_height;
@@ -774,14 +774,14 @@ ssdfb_init_ssd1322(struct ssdfb_softc *s
 	if (error)
 		return error;
 	SSDFB_CMD2(SSD1322_CMD_SET_SECOND_PRECHARGE_PERIOD,
-	SSD1322_DEFAULT_SECOND_PRECHARGE);
+	SSD1322_DEFAULT_SECOND_PRECHARGE_PERIOD);
 	if (error)
 		return error;
 
 	/*
 	 * Configure physical display panel layout.
 	 */
-	SSDFB_CMD2(SSD1322_CMD_SET_MUX_RATIO, sc->sc_p->p_multiplex_ratio);
+	SSDFB_CMD2(SSD1322_CMD_SET_MULTIPLEX_RATIO, sc->sc_p->p_multiplex_ratio);
 	if (error)
 		return error;
 	if (sc->sc_upsidedown)

Index: src/sys/dev/ic/ssdfbvar.h
diff -u src/sys/dev/ic/ssdfbvar.h:1.6 src/sys/dev/ic/ssdfbvar.h:1.7
--- src/sys/dev/ic/ssdfbvar.h:1.6	Fri Jul 30 13:44:09 2021
+++ src/sys/dev/ic/ssdfbvar.h	Mon Aug  2 14:00:48 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfbvar.h,v 1.6 2021/07/30 13:44:09 tnn Exp $ */
+/* $NetBSD: ssdfbvar.h,v 1.7 2021/08/02 14:00:48 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -154,13 +154,12 @@
 #define SSD1322_CMD_SET_DISPLAY_START_LINE		0xa1
 #define SSD1322_CMD_SET_DISPLAY_OFFSET			0xa2
 
-/* These are the same as SSDFB generic commands */
-#define SSD1322_CMD_ENTIRE_DISPLAY_OFF			0xa4
-#define SSD1322_CMD_ENTIRE_DISPLAY_ON			0xa5
-#define SSD1322_CMD_NORMAL_DISPLAY			0xa6
-#define SSD1322_CMD_INVERSE_DISPLAY			0xa7
-#define SSD1322_CMD_SET_SLEEP_MODE_ON			0xae
-#define SSD1322_CMD_SET_SLEEP_MODE_OFF			0xaf
+#define SSD1322_CMD_ENTIRE_DISPLAY_OFF			SSDFB_CMD_ENTIRE_DISPLAY_OFF
+#define SSD1322_CMD_ENTIRE_DISPLAY_ON			SSDFB_CMD_ENTIRE_DISPLAY_ON
+#define SSD1322_CMD_NORMAL_DISPLAY			SSDFB_CMD_SET_NORMAL_DISPLAY
+#define SSD1322_CMD_INVERSE_DISPLAY			SSDFB_CMD_SET_INVERSE_DISPLAY
+#define SSD1322_CMD_SET_SLEEP_MODE_ON			SSDFB_CMD_SET_DISPLAY_OFF
+#define SSD1322_CMD_SET_SLEEP_MODE_OFF			SSDFB_CMD_SET_DISPLAY_ON
 
 #define SSD1322_CMD_ENABLE_PARTIAL_DISPLAY		0xa8
 #define SSD1322_CMD_EXIT_PARTIAL_DISPLAY		0xa9
@@ -190,7 +189,7 @@
 	#define SSD1322_GPIO1_LOW			__BIT(3)
 	#define SSD1322_GPIO1_HIGH			__BITS(3, 2)
 #define SSD1322_CMD_SET_SECOND_PRECHARGE_PERIOD		0xb6
-	#define SSD1322_DEFAULT_SECOND_PRECHARGE	8
+	#define SSD1322_DEFAULT_SECOND_PRECHARGE_PERIOD	8
 #define SSD1322_CMD_SET_GRAY_SCALE_TABLE		0xb8
 #define SSD1322_CMD_SET_DEFAULT_GRAY_SCALE_TABLE	0xb9
 #define SSD1322_CMD_SET_PRE_CHARGE_VOLTAGE_LEVEL	0xbb
@@ -201,13 +200,73 @@
 	#define SSD1322_DEFAULT_CONTRAST_CURRENT	0x7f
 #define SSD1322_CMD_MASTER_CONTRAST_CURRENT_CONTROL	0xc7
 	#define SSD1322_DEFAULT_MASTER_CONTRAST_CURRENT_CONTROL	0xf
-#define SSD1322_CMD_SET_MUX_RATIO			0xca
+#define SSD1322_CMD_SET_MULTIPLEX_RATIO			0xca
 #define SSD1322_CMD_DISPLAY_ENHANCEMENT_B		0xd1
 	#define SSD1322_DISPLAY_ENHANCEMENT_B_MAGIC1	0xa2
 	#define SSD1322_DISPLAY_ENHANCEMENT_B_MAGIC2	0x20
 #define SSD1322_CMD_SET_COMMAND_LOCK			0xfd
 	#define SSD1322_COMMAND_UNLOCK_MAGIC		0x12
 	#define SSD1322_COMMAND_LOCK_MAGIC		0x16
+/* undocumented on this chip, but works in practice */
+#define SSD1322_CMD_NOP	SSDFB_CMD_NOP
+
+/*
+ * SSD1353 command set
+ */
+#define SSD1353_CMD_SET_COLUMN_ADDRESS			SSD1322_CMD_SET_COLUMN_ADDRESS
+#define SSD1353_CMD_DRAW_LINE0x21
+#define SSD1353_CMD_DRAW_RECTANGLE			0x22
+#define SSD1353_CMD_COPY0x23
+#define SSD1353_CMD_DIM	0x24
+#define SSD1353_CMD_CLEAR_WINDOW			0x25
+#define SSD1353_CMD_FILL_ENABLE0x26
+#define SSD1353_CMD_SCROLLING_SETUP			0x27
+#define SSD1353_CMD_DEACTIVATE_SCROLL			SSDFB_CMD_DEACTIVATE_SCROLL
+#define SSD1353_CMD_ACTIVATE_SCROLL			SSDFB_CMD_ACTIVATE_SCROLL
+#define SSD1353_CMD_WRITE_RAMSSD1322_CMD_WRITE_RAM
+#define SD1353_CMD_READ_RAMSSD1322_CMD_READ_RAM
+#define 

CVS commit: src/share/man/man4

2021-08-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Aug  1 16:17:05 UTC 2021

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

Log Message:
ssdfb(4): add an iic fdt attachment example also


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/ssdfb.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/ssdfb.4
diff -u src/share/man/man4/ssdfb.4:1.5 src/share/man/man4/ssdfb.4:1.6
--- src/share/man/man4/ssdfb.4:1.5	Sun Aug  1 15:35:47 2021
+++ src/share/man/man4/ssdfb.4	Sun Aug  1 16:17:05 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ssdfb.4,v 1.5 2021/08/01 15:35:47 tnn Exp $
+.\"	$NetBSD: ssdfb.4,v 1.6 2021/08/01 16:17:05 tnn Exp $
 .\"
 .\" Copyright (c) 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -95,17 +95,32 @@ On most displays, the contrast setting c
 .Xr wsconsctl 8
 program.
 .Sh EXAMPLES
-To attach an SSD1322 display using the 4-wire SPI interface on an
+To attach an SSD1322 display using the 4-wire
+.Xr spi 4
+interface on an
 Allwinner A20 ARM single board computer, the following Device Tree overlay
 can be used:
 .Bd -literal -offset indent
  {
-ssdfb@0 {
-compatible = "solomon,ssd1322";
-reg = <0x00>;
-dc-gpio = <0x10 0x07 0x02 0x00>;
-status = "okay";
-};
+	ssdfb@0 {
+		compatible = "solomon,ssd1322";
+		reg = <0x00>;
+		dc-gpio = <0x10 0x07 0x02 0x00>;
+		status = "okay";
+	};
+};
+.Ed
+.Pp
+To attach an SSD1306 display using the
+.Xr iic 4
+interface on the same board, use:
+.Bd -literal -offset indent
+ {
+	ssdfb@3c {
+		compatible = "solomon,ssd1306fb-i2c";
+		reg = <0x3c>;
+		status = "okay";
+	};
 };
 .Ed
 .Sh SEE ALSO



CVS commit: src/share/man/man4

2021-08-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Aug  1 15:35:47 UTC 2021

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

Log Message:
ssdfb(4): nix BUGS section, add EXAMPLES section


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/ssdfb.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/ssdfb.4
diff -u src/share/man/man4/ssdfb.4:1.4 src/share/man/man4/ssdfb.4:1.5
--- src/share/man/man4/ssdfb.4:1.4	Sat Nov  2 14:47:35 2019
+++ src/share/man/man4/ssdfb.4	Sun Aug  1 15:35:47 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ssdfb.4,v 1.4 2019/11/02 14:47:35 tnn Exp $
+.\"	$NetBSD: ssdfb.4,v 1.5 2021/08/01 15:35:47 tnn Exp $
 .\"
 .\" Copyright (c) 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 2, 2019
+.Dd August 1, 2021
 .Dt SSDFB 4
 .Os
 .Sh NAME
@@ -90,6 +90,24 @@ enable inverse video
 .Em 0x400 :
 forcibly attach as console
 .El
+.Pp
+On most displays, the contrast setting can be adjusted with the
+.Xr wsconsctl 8
+program.
+.Sh EXAMPLES
+To attach an SSD1322 display using the 4-wire SPI interface on an
+Allwinner A20 ARM single board computer, the following Device Tree overlay
+can be used:
+.Bd -literal -offset indent
+ {
+ssdfb@0 {
+compatible = "solomon,ssd1322";
+reg = <0x00>;
+dc-gpio = <0x10 0x07 0x02 0x00>;
+status = "okay";
+};
+};
+.Ed
 .Sh SEE ALSO
 .Xr iic 4 ,
 .Xr wsdisplay 4
@@ -113,7 +131,3 @@ It was inspired by (and shares its name 
 driver written by
 .An Patrick Wildt Aq Mt patr...@blueri.se
 but does not share any code.
-.Sh BUGS
-The "4-wire SPI" MCU interface which requires an auxiliary
-.Xr gpio 4
-pin for the D/C# signal is currently not supported.



CVS commit: src/sys/dev/spi

2021-08-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Aug  1 14:56:18 UTC 2021

Modified Files:
src/sys/dev/spi: ssdfb_spi.c

Log Message:
ssdfb: support the 4-wire SPI interface


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/spi/ssdfb_spi.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/spi/ssdfb_spi.c
diff -u src/sys/dev/spi/ssdfb_spi.c:1.5 src/sys/dev/spi/ssdfb_spi.c:1.6
--- src/sys/dev/spi/ssdfb_spi.c:1.5	Wed Jan 27 02:32:31 2021
+++ src/sys/dev/spi/ssdfb_spi.c	Sun Aug  1 14:56:18 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_spi.c,v 1.5 2021/01/27 02:32:31 thorpej Exp $ */
+/* $NetBSD: ssdfb_spi.c,v 1.6 2021/08/01 14:56:18 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.5 2021/01/27 02:32:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.6 2021/08/01 14:56:18 tnn Exp $");
 
 #include 
 #include 
@@ -39,6 +39,10 @@ __KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,
 #include 
 #include 
 #include 
+#include "opt_fdt.h"
+#ifdef FDT
+#include 
+#endif
 
 struct bs_state {
 	uint8_t	*base;
@@ -49,6 +53,9 @@ struct bs_state {
 struct ssdfb_spi_softc {
 	struct ssdfb_softc	sc;
 	struct spi_handle	*sc_sh;
+#ifdef FDT
+	struct fdtbus_gpio_pin	*sc_gpio_dc;
+#endif
 	bool			sc_3wiremode;
 };
 
@@ -74,7 +81,8 @@ CFATTACH_DECL_NEW(ssdfb_spi, sizeof(stru
 ssdfb_spi_match, ssdfb_spi_attach, NULL, NULL);
 
 static const struct device_compatible_entry compat_data[] = {
-	{ .compat = "solomon,ssd1322" },
+	{ .compat = "solomon,ssd1306",	.value = SSDFB_PRODUCT_SSD1306_GENERIC },
+	{ .compat = "solomon,ssd1322",	.value = SSDFB_PRODUCT_SSD1322_GENERIC },
 	DEVICE_COMPAT_EOL
 };
 
@@ -108,8 +116,14 @@ ssdfb_spi_attach(device_t parent, device
 	sc->sc.sc_dev = self;
 	sc->sc_sh = sa->sa_handle;
 	sc->sc.sc_cookie = (void *)sc;
-	if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN)
-		flags |= SSDFB_PRODUCT_SSD1322_GENERIC;
+	if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN) {
+		const struct device_compatible_entry *dce =
+			device_compatible_lookup(sa->sa_compat, sa->sa_ncompat, compat_data);
+		if (dce)
+			flags |= (int)dce->value;
+		else
+			flags |= SSDFB_PRODUCT_SSD1322_GENERIC;
+	}
 	/*
 	 * Note on interface modes.
 	 *
@@ -117,11 +131,18 @@ ssdfb_spi_attach(device_t parent, device
 	 * the bit that determines if the lower 8 bits are command or data.
 	 *
 	 * 4 wire mode sends 8 bit sequences and requires an auxiliary GPIO
-	 * pin for the command/data bit. But in other to allocate a GPIO pin
-	 * we need to use fdt, so only support 3 wire mode in this frontend,
-	 * at least for now.
+	 * pin for the command/data bit.
 	 */
 	sc->sc_3wiremode = true;
+#ifdef FDT
+	const int phandle = sa->sa_cookie;
+	sc->sc_gpio_dc = fdtbus_gpio_acquire(phandle, "dc-gpio", GPIO_PIN_OUTPUT);
+	if (!sc->sc_gpio_dc)
+		sc->sc_gpio_dc = fdtbus_gpio_acquire(phandle, "cd-gpio", GPIO_PIN_OUTPUT);
+	sc->sc_3wiremode = (sc->sc_gpio_dc == NULL);
+#else
+	sc->sc_3wiremode = true;
+#endif
 
 	switch (flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) {
 	case SSDFB_PRODUCT_SSD1322_GENERIC:
@@ -141,7 +162,7 @@ ssdfb_spi_attach(device_t parent, device
 	} else {
 		sc->sc.sc_cmd = ssdfb_spi_cmd_4wire;
 	}
-	
+
 	ssdfb_attach(>sc, flags);
 
 	device_printf(sc->sc.sc_dev, "%d-wire SPI interface\n",
@@ -264,8 +285,11 @@ ssdfb_bitstream_final(struct bs_state *s
 static void
 ssdfb_spi_4wire_set_dc(struct ssdfb_spi_softc *sc, int value)
 {
-	/* TODO: this should toggle an auxilliary GPIO pin */
+#ifdef FDT
+	fdtbus_gpio_write_raw(sc->sc_gpio_dc, value);
+#else
 	panic("ssdfb_spi_4wire_set_dc");
+#endif
 }
 
 static int



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

2021-07-31 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jul 31 11:34:40 UTC 2021

Modified Files:
src/sys/arch/arm/sunxi: sunxi_platform.c

Log Message:
sunxi_platform: declare UART FIFO sizes for SoCs we support


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/arm/sunxi/sunxi_platform.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/sunxi/sunxi_platform.c
diff -u src/sys/arch/arm/sunxi/sunxi_platform.c:1.44 src/sys/arch/arm/sunxi/sunxi_platform.c:1.45
--- src/sys/arch/arm/sunxi/sunxi_platform.c:1.44	Fri Jul 30 12:46:46 2021
+++ src/sys/arch/arm/sunxi/sunxi_platform.c	Sat Jul 31 11:34:40 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_platform.c,v 1.44 2021/07/30 12:46:46 tnn Exp $ */
+/* $NetBSD: sunxi_platform.c,v 1.45 2021/07/31 11:34:40 tnn Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -31,7 +31,7 @@
 #include "opt_console.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.44 2021/07/30 12:46:46 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.45 2021/07/31 11:34:40 tnn Exp $");
 
 #include 
 #include 
@@ -241,11 +241,23 @@ sunxi_platform_device_register(device_t 
 
 	if (device_is_a(self, "com")) {
 		static const struct device_compatible_entry compat_data[] = {
-			{ .compat = "allwinner,sun7i-a20" },
+			{ .compat = "allwinner,sun4i-a10",	.value = 64 },
+			{ .compat = "allwinner,sun5i-a13",	.value = 64 },
+			{ .compat = "allwinner,sun6i-a31",	.value = 64 },
+			{ .compat = "allwinner,sun7i-a20",	.value = 64 },
+			{ .compat = "allwinner,sun8i-h2-plus",	.value = 64 },
+			{ .compat = "allwinner,sun8i-h3",	.value = 64 },
+			{ .compat = "allwinner,sun8i-a83t",	.value = 64 },
+			{ .compat = "allwinner,sun9i-a80",	.value = 64 },
+			{ .compat = "allwinner,sun50i-a64",	.value = 64 },
+			{ .compat = "allwinner,sun50i-h5",	.value = 64 },
+			{ .compat = "allwinner,sun50i-h6",	.value = 256 },
 			DEVICE_COMPAT_EOL
 		};
-		if (of_compatible_match(OF_finddevice("/"), compat_data))
-			prop_dictionary_set_uint(prop, "fifolen", 64);
+		const struct device_compatible_entry *dce =
+		of_compatible_lookup(OF_finddevice("/"), compat_data);
+		if (dce != NULL)
+			prop_dictionary_set_uint(prop, "fifolen", dce->value);
 	}
 }
 



CVS commit: src/sys/dev/ic

2021-07-31 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jul 31 10:04:13 UTC 2021

Modified Files:
src/sys/dev/ic: com.c

Log Message:
only read cpr register if we're going to use the value


To generate a diff of this commit:
cvs rdiff -u -r1.364 -r1.365 src/sys/dev/ic/com.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/ic/com.c
diff -u src/sys/dev/ic/com.c:1.364 src/sys/dev/ic/com.c:1.365
--- src/sys/dev/ic/com.c:1.364	Fri Jul 30 12:46:46 2021
+++ src/sys/dev/ic/com.c	Sat Jul 31 10:04:12 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.364 2021/07/30 12:46:46 tnn Exp $ */
+/* $NetBSD: com.c,v 1.365 2021/07/31 10:04:12 tnn Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.364 2021/07/30 12:46:46 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.365 2021/07/31 10:04:12 tnn Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -539,10 +539,11 @@ com_attach_subr(struct com_softc *sc)
 		goto fifodelay;
 
 	case COM_TYPE_DW_APB:
-		cpr = bus_space_read_4(sc->sc_regs.cr_iot, sc->sc_regs.cr_ioh,
-		DW_APB_UART_CPR);
-		if (!prop_dictionary_get_uint(dict, "fifolen", >sc_fifolen))
+		if (!prop_dictionary_get_uint(dict, "fifolen", >sc_fifolen)) {
+			cpr = bus_space_read_4(sc->sc_regs.cr_iot,
+			sc->sc_regs.cr_ioh, DW_APB_UART_CPR);
 			sc->sc_fifolen = __SHIFTOUT(cpr, UART_CPR_FIFO_MODE) * 16;
+		}
 		if (sc->sc_fifolen == 0) {
 			sc->sc_fifolen = 1;
 			fifo_msg = "DesignWare APB UART, no fifo";



CVS commit: src/sys/dev

2021-07-30 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Jul 30 13:44:09 UTC 2021

Modified Files:
src/sys/dev/i2c: ssdfb_i2c.c
src/sys/dev/ic: ssdfb.c ssdfbvar.h

Log Message:
ssdfb(4): remove code for dealing with non-MPSAFE attachment

spi(4) was marked MPSAFE some time ago, so we're always on an
MPSAFE parent device.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/i2c/ssdfb_i2c.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/ssdfb.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/ssdfbvar.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/i2c/ssdfb_i2c.c
diff -u src/sys/dev/i2c/ssdfb_i2c.c:1.9 src/sys/dev/i2c/ssdfb_i2c.c:1.10
--- src/sys/dev/i2c/ssdfb_i2c.c:1.9	Thu Jan 28 14:42:45 2021
+++ src/sys/dev/i2c/ssdfb_i2c.c	Fri Jul 30 13:44:09 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_i2c.c,v 1.9 2021/01/28 14:42:45 thorpej Exp $ */
+/* $NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.9 2021/01/28 14:42:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $");
 
 #include 
 #include 
@@ -112,7 +112,6 @@ ssdfb_i2c_attach(device_t parent, device
 	if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN)
 		flags |= SSDFB_PRODUCT_SSD1306_GENERIC;
 
-	flags |= SSDFB_ATTACH_FLAG_MPSAFE;
 	sc->sc.sc_dev = self;
 	sc->sc_i2c_tag = ia->ia_tag;
 	sc->sc_i2c_addr = ia->ia_addr;

Index: src/sys/dev/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.13 src/sys/dev/ic/ssdfb.c:1.14
--- src/sys/dev/ic/ssdfb.c:1.13	Sat Apr 24 23:36:55 2021
+++ src/sys/dev/ic/ssdfb.c	Fri Jul 30 13:44:09 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.13 2021/04/24 23:36:55 thorpej Exp $ */
+/* $NetBSD: ssdfb.c,v 1.14 2021/07/30 13:44:09 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.13 2021/04/24 23:36:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.14 2021/07/30 13:44:09 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -227,7 +227,6 @@ ssdfb_attach(struct ssdfb_softc *sc, int
 	int error = 0;
 	long defattr;
 	const struct ssdfb_product *p;
-	int kt_flags;
 
 	p = ssdfb_lookup_product(flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK);
 	if (p == NULL) {
@@ -332,15 +331,11 @@ ssdfb_attach(struct ssdfb_softc *sc, int
 	if (sc->sc_is_console)
 		ssdfb_set_usepoll(sc, true);
 
-	mutex_init(>sc_cond_mtx, MUTEX_DEFAULT,
-	ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE) ? IPL_SCHED : IPL_BIO);
+	mutex_init(>sc_cond_mtx, MUTEX_DEFAULT, IPL_SCHED);
 	cv_init(>sc_cond, "ssdfb");
-	kt_flags = KTHREAD_MUSTJOIN;
-	/* XXX spi(4) is not MPSAFE yet. */
-	if (ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE))
-		kt_flags |= KTHREAD_MPSAFE;
-	error = kthread_create(PRI_SOFTCLOCK, kt_flags, NULL, ssdfb_thread, sc,
-	>sc_thread, "%s", device_xname(sc->sc_dev));
+	error = kthread_create(PRI_SOFTCLOCK, KTHREAD_MUSTJOIN | KTHREAD_MPSAFE,
+	NULL, ssdfb_thread, sc,  >sc_thread, "%s",
+	device_xname(sc->sc_dev));
 	if (error) {
 		cv_destroy(>sc_cond);
 		mutex_destroy(>sc_cond_mtx);

Index: src/sys/dev/ic/ssdfbvar.h
diff -u src/sys/dev/ic/ssdfbvar.h:1.5 src/sys/dev/ic/ssdfbvar.h:1.6
--- src/sys/dev/ic/ssdfbvar.h:1.5	Sat Nov  2 14:18:36 2019
+++ src/sys/dev/ic/ssdfbvar.h	Fri Jul 30 13:44:09 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfbvar.h,v 1.5 2019/11/02 14:18:36 tnn Exp $ */
+/* $NetBSD: ssdfbvar.h,v 1.6 2021/07/30 13:44:09 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -36,7 +36,6 @@
 #define SSDFB_ATTACH_FLAG_UPSIDEDOWN		0x0100
 #define SSDFB_ATTACH_FLAG_INVERSE		0x0200
 #define SSDFB_ATTACH_FLAG_CONSOLE		0x0400
-#define SSDFB_ATTACH_FLAG_MPSAFE		0x0800
 
 /*
  * Fundamental commands



CVS commit: src/sys

2021-07-30 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Jul 30 12:46:46 UTC 2021

Modified Files:
src/sys/arch/arm/sunxi: sunxi_platform.c
src/sys/dev/ic: com.c

Log Message:
com(4): fix FIFO for DW_APB on Allwinner A20 (got broken by com.c 1.360)

Older DesignWare UARTs do not advertise their FIFO length so we must
provide it via device properties.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/sunxi/sunxi_platform.c
cvs rdiff -u -r1.363 -r1.364 src/sys/dev/ic/com.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/sunxi/sunxi_platform.c
diff -u src/sys/arch/arm/sunxi/sunxi_platform.c:1.43 src/sys/arch/arm/sunxi/sunxi_platform.c:1.44
--- src/sys/arch/arm/sunxi/sunxi_platform.c:1.43	Sat Apr 24 23:36:28 2021
+++ src/sys/arch/arm/sunxi/sunxi_platform.c	Fri Jul 30 12:46:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_platform.c,v 1.43 2021/04/24 23:36:28 thorpej Exp $ */
+/* $NetBSD: sunxi_platform.c,v 1.44 2021/07/30 12:46:46 tnn Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -31,7 +31,7 @@
 #include "opt_console.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.43 2021/04/24 23:36:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.44 2021/07/30 12:46:46 tnn Exp $");
 
 #include 
 #include 
@@ -238,6 +238,15 @@ sunxi_platform_device_register(device_t 
 			if (val)
 prop_dictionary_set_bool(prop, "nomodeset", true);
 	}
+
+	if (device_is_a(self, "com")) {
+		static const struct device_compatible_entry compat_data[] = {
+			{ .compat = "allwinner,sun7i-a20" },
+			DEVICE_COMPAT_EOL
+		};
+		if (of_compatible_match(OF_finddevice("/"), compat_data))
+			prop_dictionary_set_uint(prop, "fifolen", 64);
+	}
 }
 
 static u_int

Index: src/sys/dev/ic/com.c
diff -u src/sys/dev/ic/com.c:1.363 src/sys/dev/ic/com.c:1.364
--- src/sys/dev/ic/com.c:1.363	Thu Mar 25 05:34:49 2021
+++ src/sys/dev/ic/com.c	Fri Jul 30 12:46:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.363 2021/03/25 05:34:49 rin Exp $ */
+/* $NetBSD: com.c,v 1.364 2021/07/30 12:46:46 tnn Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.363 2021/03/25 05:34:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.364 2021/07/30 12:46:46 tnn Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -541,7 +541,8 @@ com_attach_subr(struct com_softc *sc)
 	case COM_TYPE_DW_APB:
 		cpr = bus_space_read_4(sc->sc_regs.cr_iot, sc->sc_regs.cr_ioh,
 		DW_APB_UART_CPR);
-		sc->sc_fifolen = __SHIFTOUT(cpr, UART_CPR_FIFO_MODE) * 16;
+		if (!prop_dictionary_get_uint(dict, "fifolen", >sc_fifolen))
+			sc->sc_fifolen = __SHIFTOUT(cpr, UART_CPR_FIFO_MODE) * 16;
 		if (sc->sc_fifolen == 0) {
 			sc->sc_fifolen = 1;
 			fifo_msg = "DesignWare APB UART, no fifo";



CVS commit: src/lib/libm

2021-07-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Wed Jul 21 12:05:02 UTC 2021

Modified Files:
src/lib/libm: Makefile

Log Message:
libm: build fma(3), fmaf(3), fmal(3) on alpha

Alpha has no hardware-assisted fused multiply-add, so the fallback
C implementation must be used. A basic smoke test shows the
implementation works for
"x * x - 1.0f" vs "fmaf(x, x, -1.0f)" with "volatile float x = 1.0008f;"


To generate a diff of this commit:
cvs rdiff -u -r1.213 -r1.214 src/lib/libm/Makefile

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

Modified files:

Index: src/lib/libm/Makefile
diff -u src/lib/libm/Makefile:1.213 src/lib/libm/Makefile:1.214
--- src/lib/libm/Makefile:1.213	Sun Apr 25 23:43:20 2021
+++ src/lib/libm/Makefile	Wed Jul 21 12:05:02 2021
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.213 2021/04/25 23:43:20 christos Exp $
+#  $NetBSD: Makefile,v 1.214 2021/07/21 12:05:02 tnn Exp $
 #
 #  @(#)Makefile 5.1beta 93/09/24
 #
@@ -71,6 +71,7 @@ COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
 .PATH: ${.CURDIR}/arch/alpha
 ARCH_SRCS = s_copysign.S s_copysignf.S lrint.S
 COMMON_SRCS+= fenv.c
+COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
 COPTS+=	-mfloat-ieee -mieee-with-inexact -mfp-trap-mode=sui -mtrap-precision=i
 
 .elif (${LIBC_MACHINE_CPU} == "arm")



CVS commit: src/usr.bin/xlint/lint1

2021-06-25 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Jun 25 20:17:56 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: Makefile

Log Message:
ensure defined(HAVE_GCC) before use of ${HAVE_GCC}


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/xlint/lint1/Makefile

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

Modified files:

Index: src/usr.bin/xlint/lint1/Makefile
diff -u src/usr.bin/xlint/lint1/Makefile:1.72 src/usr.bin/xlint/lint1/Makefile:1.73
--- src/usr.bin/xlint/lint1/Makefile:1.72	Wed Jun 23 07:11:41 2021
+++ src/usr.bin/xlint/lint1/Makefile	Fri Jun 25 20:17:56 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.72 2021/06/23 07:11:41 rillig Exp $
+#	$NetBSD: Makefile,v 1.73 2021/06/25 20:17:56 tnn Exp $
 
 .include 
 
@@ -28,7 +28,7 @@ CPPFLAGS+=	${DEBUG:D-DDEBUG}
 COPTS.err.c+=	${${ACTIVE_CC} == "clang":? -Wno-format-nonliteral :}
 
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101177
-.if ${HAVE_GCC} == 9 &&	\
+.if defined(HAVE_GCC) && ${HAVE_GCC} == 9 &&	\
 	(${MACHINE_ARCH} == "sh3el" || ${MACHINE_ARCH} == "sh3eb")
 COPTS.lex.c+=	-O0
 .endif



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

2021-05-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon May  3 18:56:38 UTC 2021

Modified Files:
src/sys/arch/arm/broadcom: bcm2838_pcie.c

Log Message:
bcm2838_pcie: match brcm,bcm2711-pcie


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm2838_pcie.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/broadcom/bcm2838_pcie.c
diff -u src/sys/arch/arm/broadcom/bcm2838_pcie.c:1.2 src/sys/arch/arm/broadcom/bcm2838_pcie.c:1.3
--- src/sys/arch/arm/broadcom/bcm2838_pcie.c:1.2	Sat Apr 24 23:36:26 2021
+++ src/sys/arch/arm/broadcom/bcm2838_pcie.c	Mon May  3 18:56:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2838_pcie.c,v 1.2 2021/04/24 23:36:26 thorpej Exp $ */
+/*	$NetBSD: bcm2838_pcie.c,v 1.3 2021/05/03 18:56:38 tnn Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2838_pcie.c,v 1.2 2021/04/24 23:36:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2838_pcie.c,v 1.3 2021/05/03 18:56:38 tnn Exp $");
 
 #include 
 #include 
@@ -156,6 +156,7 @@ stb_setbits(struct bcmstb_softc *sc, int
 
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "brcm,pci-plat-dev" },
+	{ .compat = "brcm,bcm2711-pcie" },
 	DEVICE_COMPAT_EOL
 };
 



CVS commit: src/sys/arch/alpha/alpha

2021-02-28 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Feb 28 21:34:34 UTC 2021

Modified Files:
src/sys/arch/alpha/alpha: sys_machdep.c

Log Message:
support building alpha kernel without PCI bus


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/sys_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/alpha/alpha/sys_machdep.c
diff -u src/sys/arch/alpha/alpha/sys_machdep.c:1.21 src/sys/arch/alpha/alpha/sys_machdep.c:1.22
--- src/sys/arch/alpha/alpha/sys_machdep.c:1.21	Mon Feb  6 02:14:12 2012
+++ src/sys/arch/alpha/alpha/sys_machdep.c	Sun Feb 28 21:34:34 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_machdep.c,v 1.21 2012/02/06 02:14:12 matt Exp $ */
+/* $NetBSD: sys_machdep.c,v 1.22 2021/02/28 21:34:34 tnn Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.21 2012/02/06 02:14:12 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.22 2021/02/28 21:34:34 tnn Exp $");
 
 #include 
 #include 
@@ -188,6 +188,7 @@ sys_sysarch(struct lwp *l, const struct 
 		break;
 	}
 
+#if NPCI > 0
 	case ALPHA_PCI_CONF_READWRITE:
 	{
 		struct alpha_pci_conf_readwrite_args args;
@@ -222,6 +223,7 @@ sys_sysarch(struct lwp *l, const struct 
 		}
 		break;
 	}
+#endif
 
 	default:
 		error = EINVAL;



CVS commit: src/external/bsd/tmux/dist

2020-11-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Nov  3 10:52:58 UTC 2020

Modified Files:
src/external/bsd/tmux/dist: tmux.h

Log Message:
tmux.h: annotate file_vprint() as printflike


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/external/bsd/tmux/dist/tmux.h

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

Modified files:

Index: src/external/bsd/tmux/dist/tmux.h
diff -u src/external/bsd/tmux/dist/tmux.h:1.16 src/external/bsd/tmux/dist/tmux.h:1.17
--- src/external/bsd/tmux/dist/tmux.h:1.16	Sun Nov  1 15:16:05 2020
+++ src/external/bsd/tmux/dist/tmux.h	Tue Nov  3 10:52:58 2020
@@ -2185,7 +2185,7 @@ void	 file_fire_done(struct client_file 
 void	 file_fire_read(struct client_file *);
 int	 file_can_print(struct client *);
 void printflike(2, 3) file_print(struct client *, const char *, ...);
-void 	 file_vprint(struct client *, const char *, va_list);
+void printflike(2, 0) file_vprint(struct client *, const char *, va_list);
 void 	 file_print_buffer(struct client *, void *, size_t);
 void printflike(2, 3) file_error(struct client *, const char *, ...);
 void	 file_write(struct client *, const char *, int, const void *, size_t,



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

2020-10-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Oct 19 17:00:02 UTC 2020

Modified Files:
src/sys/arch/evbarm/dev: plcom.c

Log Message:
remove superfluous parentheses in PREAD4/PWRITE4 macros


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/evbarm/dev/plcom.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/dev/plcom.c
diff -u src/sys/arch/evbarm/dev/plcom.c:1.61 src/sys/arch/evbarm/dev/plcom.c:1.62
--- src/sys/arch/evbarm/dev/plcom.c:1.61	Sat Apr 25 21:34:08 2020
+++ src/sys/arch/evbarm/dev/plcom.c	Mon Oct 19 17:00:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: plcom.c,v 1.61 2020/04/25 21:34:08 jmcneill Exp $	*/
+/*	$NetBSD: plcom.c,v 1.62 2020/10/19 17:00:02 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2001 ARM Ltd
@@ -94,7 +94,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.61 2020/04/25 21:34:08 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.62 2020/10/19 17:00:02 tnn Exp $");
 
 #include "opt_plcom.h"
 #include "opt_ddb.h"
@@ -297,12 +297,12 @@ pwritem1(struct plcom_instance *pi, bus_
 
 #define	PREAD1(pi, reg)		pread1(pi, reg)
 #define	PREAD4(pi, reg)		\
-	(bus_space_read_4((pi)->pi_iot, (pi)->pi_ioh, (reg)))
+	bus_space_read_4((pi)->pi_iot, (pi)->pi_ioh, (reg))
 
 #define	PWRITE1(pi, reg, val)	pwrite1(pi, reg, val)
 #define	PWRITEM1(pi, reg, d, c)	pwritem1(pi, reg, d, c)
 #define	PWRITE4(pi, reg, val)	\
-	(bus_space_write_4((pi)->pi_iot, (pi)->pi_ioh, (reg), (val)))
+	bus_space_write_4((pi)->pi_iot, (pi)->pi_ioh, (reg), (val))
 
 int
 pl010comspeed(long speed, long frequency)



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

2020-10-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Oct 19 13:44:25 UTC 2020

Modified Files:
src/sys/arch/arm/rockchip: rk_v1crypto.c

Log Message:
bus_space_write_4 does not have a return value


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rk_v1crypto.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/rockchip/rk_v1crypto.c
diff -u src/sys/arch/arm/rockchip/rk_v1crypto.c:1.2 src/sys/arch/arm/rockchip/rk_v1crypto.c:1.3
--- src/sys/arch/arm/rockchip/rk_v1crypto.c:1.2	Sun May 17 20:29:39 2020
+++ src/sys/arch/arm/rockchip/rk_v1crypto.c	Mon Oct 19 13:44:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rk_v1crypto.c,v 1.2 2020/05/17 20:29:39 riastradh Exp $	*/
+/*	$NetBSD: rk_v1crypto.c,v 1.3 2020/10/19 13:44:25 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: rk_v1crypto.c,v 1.2 2020/05/17 20:29:39 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk_v1crypto.c,v 1.3 2020/10/19 13:44:25 tnn Exp $");
 
 #include 
 
@@ -82,7 +82,7 @@ RKC_READ(struct rk_v1crypto_softc *sc, b
 static void
 RKC_WRITE(struct rk_v1crypto_softc *sc, bus_addr_t reg, uint32_t v)
 {
-	return bus_space_write_4(sc->sc_bst, sc->sc_bsh, reg, v);
+	bus_space_write_4(sc->sc_bst, sc->sc_bsh, reg, v);
 }
 
 static inline void



CVS commit: src/sys/stand/efiboot

2020-10-18 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Oct 18 18:09:32 UTC 2020

Modified Files:
src/sys/stand/efiboot: version

Log Message:
efiboot: bump version


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/stand/efiboot/version

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

Modified files:

Index: src/sys/stand/efiboot/version
diff -u src/sys/stand/efiboot/version:1.21 src/sys/stand/efiboot/version:1.22
--- src/sys/stand/efiboot/version:1.21	Sun Oct 11 14:03:33 2020
+++ src/sys/stand/efiboot/version	Sun Oct 18 18:09:32 2020
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.21 2020/10/11 14:03:33 jmcneill Exp $
+$NetBSD: version,v 1.22 2020/10/18 18:09:32 tnn Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE EFI BOOTLOADER HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
@@ -25,3 +25,4 @@ is taken as the current.
 2.2:	Remove support for storing settings in EFI env vars.
 2.3:	EFI RT and GOP support for devicetree mode.
 2.4:	Add ISO9660 support.
+2.5:	Recognize the EFI system partion as fstype MSDOS.



CVS commit: src/sys/stand/efiboot

2020-10-18 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Oct 18 18:05:48 UTC 2020

Modified Files:
src/sys/stand/efiboot: efiblock.c

Log Message:
efiboot: recognize the EFI system partition as fstype MSDOS


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/stand/efiboot/efiblock.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/stand/efiboot/efiblock.c
diff -u src/sys/stand/efiboot/efiblock.c:1.8 src/sys/stand/efiboot/efiblock.c:1.9
--- src/sys/stand/efiboot/efiblock.c:1.8	Sun Oct 11 14:03:33 2020
+++ src/sys/stand/efiboot/efiblock.c	Sun Oct 18 18:05:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: efiblock.c,v 1.8 2020/10/11 14:03:33 jmcneill Exp $ */
+/* $NetBSD: efiblock.c,v 1.9 2020/10/18 18:05:48 tnn Exp $ */
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -269,6 +269,7 @@ static const struct {
 	{ GPT_ENT_TYPE_NETBSD_CCD,		FS_CCD },
 	{ GPT_ENT_TYPE_NETBSD_CGD,		FS_CGD },
 	{ GPT_ENT_TYPE_MS_BASIC_DATA,		FS_MSDOS },	/* or NTFS? ambiguous */
+	{ GPT_ENT_TYPE_EFI,			FS_MSDOS },
 };
 
 static int



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

2020-10-11 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Oct 11 15:33:18 UTC 2020

Modified Files:
src/sys/arch/arm/rockchip: rk3399_pcie.c

Log Message:
rk3399_pci: support for PCI express switches / bridges / multiple buses

There were two isses that prevented this from working:

1. We must use type 1 configuration cycles when accessing bus 2 and
beyond, but type 0 configuration cycles for bus 0 and 1.

2. The hardware address decoder cannot be used to decode the bus portion
of the ECAM address. Due to the physical SoC address of the remote device
region not having sufficient alignment the wrong bus address would go out
on the wire. Also the mapped region is too small to address busses
beyond bus31.

Fix: Reduce the number of ECAM translated bits to dev+func only.
For each configuration space access, acquire an exclusive lock
and reprogram the translator with the correct bus number and access type.
Config space is accessed sufficiently infrequent for this to not cause
any performance problems.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/rockchip/rk3399_pcie.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/rockchip/rk3399_pcie.c
diff -u src/sys/arch/arm/rockchip/rk3399_pcie.c:1.11 src/sys/arch/arm/rockchip/rk3399_pcie.c:1.12
--- src/sys/arch/arm/rockchip/rk3399_pcie.c:1.11	Thu Oct  8 22:14:00 2020
+++ src/sys/arch/arm/rockchip/rk3399_pcie.c	Sun Oct 11 15:33:18 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399_pcie.c,v 1.11 2020/10/08 22:14:00 tnn Exp $ */
+/* $NetBSD: rk3399_pcie.c,v 1.12 2020/10/11 15:33:18 tnn Exp $ */
 /*
  * Copyright (c) 2018 Mark Kettenis 
  *
@@ -17,7 +17,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: rk3399_pcie.c,v 1.11 2020/10/08 22:14:00 tnn Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3399_pcie.c,v 1.12 2020/10/11 15:33:18 tnn Exp $");
 
 #include 
 #include 
@@ -134,6 +134,7 @@ struct rkpcie_softc {
 	bus_addr_t		sc_apb_addr;
 	bus_size_t		sc_axi_size;
 	bus_size_t		sc_apb_size;
+	kmutex_t		sc_conf_lock;
 };
 
 static int rkpcie_match(device_t, cfdata_t, void *);
@@ -405,6 +406,8 @@ again:
 	sc->sc_phsc.sc_pc.pc_conf_read = rkpcie_conf_read;
 	sc->sc_phsc.sc_pc.pc_conf_write = rkpcie_conf_write;
 	sc->sc_phsc.sc_pc.pc_conf_hook = rkpcie_conf_hook;
+
+	mutex_init(>sc_conf_lock, MUTEX_DEFAULT, IPL_HIGH);
 	pcihost_init2(>sc_phsc);
 }
 
@@ -419,7 +422,7 @@ rkpcie_atr_init(struct rkpcie_softc *sc)
 	int region, i, ranges_len;
 
 	/* Use region 0 to map PCI configuration space */
-	HWRITE4(sc, PCIE_ATR_OB_ADDR0(0), 25 - 1);
+	HWRITE4(sc, PCIE_ATR_OB_ADDR0(0), 20 - 1);
 	HWRITE4(sc, PCIE_ATR_OB_ADDR1(0), 0);
 	HWRITE4(sc, PCIE_ATR_OB_DESC0(0), PCIE_ATR_HDR_CFG_TYPE0 | PCIE_ATR_HDR_RID);
 	HWRITE4(sc, PCIE_ATR_OB_DESC1(0), 0);
@@ -517,8 +520,13 @@ rkpcie_decompose_tag(void *v, pcitag_t t
 
 /* Only one device on root port and the first subordinate port. */
 static bool
-rkpcie_conf_ok(int bus, int dev, int fn, int bus_min)
+rkpcie_conf_ok(int bus, int dev, int fn, int offset, struct rkpcie_softc *sc)
 {
+	int bus_min = sc->sc_phsc.sc_bus_min;
+
+	if ((unsigned int)offset >= (1<<12))
+		return false;
+	/* first two buses use type 0 cfg which doesn't use bus/device numbers */
 	if (dev != 0 && (bus == bus_min || bus == bus_min + 1))
 		return false;
 	return true;
@@ -528,33 +536,45 @@ pcireg_t
 rkpcie_conf_read(void *v, pcitag_t tag, int offset)
 {
 	struct rkpcie_softc *sc = v;
-	struct pcihost_softc *phsc = >sc_phsc;
+	int bus_min = sc->sc_phsc.sc_bus_min;
 	int bus, dev, fn;
 	u_int reg;
+	int32_t val;
 
 	KASSERT(offset >= 0);
 	KASSERT(offset < PCI_EXTCONF_SIZE);
 
 	rkpcie_decompose_tag(sc, tag, , , );
-	if (!rkpcie_conf_ok(bus, dev, fn, phsc->sc_bus_min))
+	if (!rkpcie_conf_ok(bus, dev, fn, offset, sc))
 		return 0x;
-	reg = (bus << 20) | (dev << 15) | (fn << 12) | offset;
+	reg = (dev << 15) | (fn << 12) | offset;
 
-	if (bus == phsc->sc_bus_min)
-		return HREAD4(sc, PCIE_RC_NORMAL_BASE + reg);
+	if (bus == bus_min)
+		val = HREAD4(sc, PCIE_RC_NORMAL_BASE + reg);
 	else {
-		uint32_t val;
+		mutex_spin_enter(>sc_conf_lock);
+		HWRITE4(sc, PCIE_ATR_OB_ADDR0(0),
+		(bus << 20) | (20 - 1));
+		HWRITE4(sc, PCIE_ATR_OB_DESC0(0),
+		PCIE_ATR_HDR_RID | ((bus == bus_min + 1)
+		? PCIE_ATR_HDR_CFG_TYPE0 : PCIE_ATR_HDR_CFG_TYPE1));
+		bus_space_barrier(sc->sc_iot, sc->sc_ioh, 0, sc->sc_apb_size,
+		  BUS_SPACE_BARRIER_READ);
 		if (AXIPEEK4(sc, reg, ) != 0)
-			return 0x;
-		return val;
+			val = 0x;
+		bus_space_barrier(sc->sc_iot, sc->sc_axi_ioh,
+		0, sc->sc_axi_size,
+		BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+		mutex_spin_exit(>sc_conf_lock);
 	}
+	return val;
 }
 
 void
 rkpcie_conf_write(void *v, pcitag_t tag, int offset, pcireg_t data)
 {
 	struct rkpcie_softc *sc = v;
-	struct pcihost_softc *phsc = >sc_phsc;
+	int bus_min = sc->sc_phsc.sc_bus_min;
 	int bus, dev, fn;
 	u_int 

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

2020-10-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Oct  8 22:14:00 UTC 2020

Modified Files:
src/sys/arch/arm/rockchip: rk3399_pcie.c

Log Message:
rk3399_pcie: do reset timing according to PCI Express Base Specification

Don't do link training or configuration space accesses within the time
allowed by the standard for the downstream card to come out of reset
after deasserting PERST#.

This fixes detection issues seen with a dual port wm(4) NIC,
an ASMedia SATA card and also Pericom bridges (but they need more work
to be useful).


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/rockchip/rk3399_pcie.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/rockchip/rk3399_pcie.c
diff -u src/sys/arch/arm/rockchip/rk3399_pcie.c:1.10 src/sys/arch/arm/rockchip/rk3399_pcie.c:1.11
--- src/sys/arch/arm/rockchip/rk3399_pcie.c:1.10	Wed Jun 17 06:51:08 2020
+++ src/sys/arch/arm/rockchip/rk3399_pcie.c	Thu Oct  8 22:14:00 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399_pcie.c,v 1.10 2020/06/17 06:51:08 thorpej Exp $ */
+/* $NetBSD: rk3399_pcie.c,v 1.11 2020/10/08 22:14:00 tnn Exp $ */
 /*
  * Copyright (c) 2018 Mark Kettenis 
  *
@@ -17,7 +17,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: rk3399_pcie.c,v 1.10 2020/06/17 06:51:08 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3399_pcie.c,v 1.11 2020/10/08 22:14:00 tnn Exp $");
 
 #include 
 #include 
@@ -278,7 +278,7 @@ again:
 	reset_assert(phandle, "mgmt-sticky");
 	reset_assert(phandle, "pipe");
 
-	delay(10);
+	delay(1000);	/* TPERST. use 1ms */
 	
 	reset_deassert(phandle, "pm");
 	reset_deassert(phandle, "aclk");
@@ -311,11 +311,12 @@ again:
 	reset_deassert(phandle, "mgmt");
 	reset_deassert(phandle, "pipe");
 
+	fdtbus_gpio_write(ep_gpio, 1);
+	delay(2);	/* 20 ms according to PCI-e BS "Conventional Reset" */
+
 	/* Start link training. */
 	HWRITE4(sc, PCIE_CLIENT_BASIC_STRAP_CONF, PCBSC_LINK_TRAIN_EN);
 
-	fdtbus_gpio_write(ep_gpio, 1);
-
 	for (timo = 500; timo > 0; timo--) {
 		status = HREAD4(sc, PCIE_CLIENT_BASIC_STATUS1);
 		if (PCBS1_LINK_ST(status) == PCBS1_LS_DL_DONE)
@@ -346,6 +347,7 @@ again:
 			goto again;
 		}
 	}
+	delay(8);	/* wait 100 ms before CSR access. already waited 20. */
 
 	fdtbus_gpio_release(ep_gpio);
 



CVS commit: src/games/factor

2020-10-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Oct  5 12:22:49 UTC 2020

Modified Files:
src/games/factor: factor.c

Log Message:
factor: usage(): mark __dead


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/games/factor/factor.c

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

Modified files:

Index: src/games/factor/factor.c
diff -u src/games/factor/factor.c:1.31 src/games/factor/factor.c:1.32
--- src/games/factor/factor.c:1.31	Sun Oct  4 19:32:15 2020
+++ src/games/factor/factor.c	Mon Oct  5 12:22:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: factor.c,v 1.31 2020/10/04 19:32:15 christos Exp $	*/
+/*	$NetBSD: factor.c,v 1.32 2020/10/05 12:22:49 tnn Exp $	*/
 /*
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 __SCCSID("@(#)factor.c	8.4 (Berkeley) 5/4/95");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: factor.c,v 1.31 2020/10/04 19:32:15 christos Exp $");
+__RCSID("$NetBSD: factor.c,v 1.32 2020/10/05 12:22:49 tnn Exp $");
 #endif
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/usr.bin/factor/factor.c 35 2020-01-12 20:25:11Z gad $");
@@ -117,7 +117,7 @@ static void	convert_str2bn(BIGNUM **, ch
 static bool	is_hex_str(char *);
 static void	pr_fact(BIGNUM *, int, int);	/* print factors of a value */
 static void	pr_print(BIGNUM *, int);	/* print a prime */
-static void	usage(void);
+static void	usage(void) __dead;
 
 static BN_CTX	*ctx;			/* just use a global context */
 



CVS commit: src/sys/uvm

2020-08-14 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Aug 15 01:27:22 UTC 2020

Modified Files:
src/sys/uvm: uvm_page.c

Log Message:
add a __diagused to fix non-DIAGNOSTIC kernel


To generate a diff of this commit:
cvs rdiff -u -r1.245 -r1.246 src/sys/uvm/uvm_page.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/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.245 src/sys/uvm/uvm_page.c:1.246
--- src/sys/uvm/uvm_page.c:1.245	Fri Aug 14 09:06:15 2020
+++ src/sys/uvm/uvm_page.c	Sat Aug 15 01:27:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.245 2020/08/14 09:06:15 chs Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.246 2020/08/15 01:27:22 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.245 2020/08/14 09:06:15 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.246 2020/08/15 01:27:22 tnn Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvm.h"
@@ -1790,7 +1790,7 @@ struct vm_page *
 uvm_pagelookup(struct uvm_object *obj, voff_t off)
 {
 	struct vm_page *pg;
-	bool ddb = false;
+	bool ddb __diagused = false;
 #ifdef DDB
 	extern int db_active;
 	ddb = db_active != 0;



CVS commit: src/usr.sbin/npf

2020-05-31 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun May 31 16:32:07 UTC 2020

Modified Files:
src/usr.sbin/npf: npf-params.7

Log Message:
npf-params.7: s/filer/filter/


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/npf/npf-params.7

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/npf/npf-params.7
diff -u src/usr.sbin/npf/npf-params.7:1.5 src/usr.sbin/npf/npf-params.7:1.6
--- src/usr.sbin/npf/npf-params.7:1.5	Sun May 31 15:57:15 2020
+++ src/usr.sbin/npf/npf-params.7	Sun May 31 16:32:07 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: npf-params.7,v 1.5 2020/05/31 15:57:15 rmind Exp $
+.\" $NetBSD: npf-params.7,v 1.6 2020/05/31 16:32:07 tnn Exp $
 .\"
 .\" Copyright (c) 2019 Mindaugas Rasiukevicius 
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 30, 2020
+.Dd May 31, 2020
 .Dt NPF-PARAMS 7
 .Os
 .Sh NAME
@@ -60,7 +60,7 @@ Perform IPv4 reassembly before inspectin
 Fragmentation is considered very harmful, so most networks are expected
 to prevent it; therefore, reassembly is disabled by default.
 However, while the packet should generally be reassembled at the receiver,
-reassembly by the packet filer might be necessary in order to perform state
+reassembly by the packet filter might be necessary in order to perform state
 tracking.
 Default: 0.
 .It Li ip6.reassembly



CVS commit: src/share/man/man4

2020-05-16 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat May 16 20:27:38 UTC 2020

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

Log Message:
wsdisplay.4: correct ioctl name for WSDISPLAYIO_GET_FBINFO


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/share/man/man4/wsdisplay.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/wsdisplay.4
diff -u src/share/man/man4/wsdisplay.4:1.48 src/share/man/man4/wsdisplay.4:1.49
--- src/share/man/man4/wsdisplay.4:1.48	Sat Nov  2 19:22:36 2019
+++ src/share/man/man4/wsdisplay.4	Sat May 16 20:27:38 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: wsdisplay.4,v 1.48 2019/11/02 19:22:36 tnn Exp $
+.\" $NetBSD: wsdisplay.4,v 1.49 2020/05/16 20:27:38 tnn Exp $
 .\"
 .\" Copyright (c) 1999 Matthias Drochner.
 .\" Copyright (c) 2002 Ben Harris.
@@ -26,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd November 2, 2019
+.Dd May 16, 2020
 .Dt WSDISPLAY 4
 .Os
 .Sh NAME
@@ -192,7 +192,7 @@ Their definitions are found in
 Retrieve the type of the display.
 The list of types is in
 .In dev/wscons/wsconsio.h .
-.It Dv WSDISPLAYIO_FBINFO Pq Li "struct wsdisplayio_fbinfo"
+.It Dv WSDISPLAYIO_GET_FBINFO Pq Li "struct wsdisplayio_fbinfo"
 Retrieve extended information about a framebuffer display,
 including the framebuffer's pixel packing layout.
 The returned structure is as follows:



CVS commit: src/sys/arch/aarch64/aarch64

2020-05-14 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri May 15 01:43:47 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: pmap.c

Log Message:
fix non-diag build


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/aarch64/aarch64/pmap.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/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.73 src/sys/arch/aarch64/aarch64/pmap.c:1.74
--- src/sys/arch/aarch64/aarch64/pmap.c:1.73	Thu May 14 07:59:03 2020
+++ src/sys/arch/aarch64/aarch64/pmap.c	Fri May 15 01:43:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.73 2020/05/14 07:59:03 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.74 2020/05/15 01:43:47 tnn Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.73 2020/05/14 07:59:03 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.74 2020/05/15 01:43:47 tnn Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -622,7 +622,9 @@ pmap_free_pdp(struct pmap *pm, struct vm
 	pg->flags |= PG_BUSY;
 	pg->wire_count = 0;
 
+#ifdef DIAGNOSTIC
 	struct pmap_page *pp = VM_PAGE_TO_PP(pg);
+#endif
 	KASSERT(LIST_EMPTY(>pp_pvhead));
 
 	uvm_pagefree(pg);



CVS commit: src/sys/arch/aarch64/aarch64

2020-05-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri May  1 17:58:48 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: cpu_machdep.c sig_machdep.c

Log Message:
aarch64: handle _UC_SETSTACK and _UC_CLRSTACK like on arm32

ok ryo@


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/cpu_machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/sig_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/aarch64/aarch64/cpu_machdep.c
diff -u src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.8 src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.9
--- src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.8	Sat Nov 23 19:40:34 2019
+++ src/sys/arch/aarch64/aarch64/cpu_machdep.c	Fri May  1 17:58:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_machdep.c,v 1.8 2019/11/23 19:40:34 ad Exp $ */
+/* $NetBSD: cpu_machdep.c,v 1.9 2020/05/01 17:58:48 tnn Exp $ */
 
 /*-
  * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.8 2019/11/23 19:40:34 ad Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.9 2020/05/01 17:58:48 tnn Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -198,6 +198,8 @@ cpu_getmcontext(struct lwp *l, mcontext_
 int
 cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags)
 {
+	struct proc * const p = l->l_proc;
+
 	if (flags & _UC_CPU) {
 		struct trapframe * const tf = l->l_md.md_utf;
 		int error = cpu_mcontext_validate(l, mcp);
@@ -216,6 +218,13 @@ cpu_setmcontext(struct lwp *l, const mco
 		pcb->pcb_fpregs = *(const struct fpreg *)>__fregs;
 	}
 
+	mutex_enter(p->p_lock);
+	if (flags & _UC_SETSTACK)
+		l->l_sigstk.ss_flags |= SS_ONSTACK;
+	if (flags & _UC_CLRSTACK)
+		l->l_sigstk.ss_flags &= ~SS_ONSTACK;
+	mutex_exit(p->p_lock);
+
 	return 0;
 }
 

Index: src/sys/arch/aarch64/aarch64/sig_machdep.c
diff -u src/sys/arch/aarch64/aarch64/sig_machdep.c:1.4 src/sys/arch/aarch64/aarch64/sig_machdep.c:1.5
--- src/sys/arch/aarch64/aarch64/sig_machdep.c:1.4	Thu Apr 23 17:21:53 2020
+++ src/sys/arch/aarch64/aarch64/sig_machdep.c	Fri May  1 17:58:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sig_machdep.c,v 1.4 2020/04/23 17:21:53 skrll Exp $ */
+/* $NetBSD: sig_machdep.c,v 1.5 2020/05/01 17:58:48 tnn Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sig_machdep.c,v 1.4 2020/04/23 17:21:53 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sig_machdep.c,v 1.5 2020/05/01 17:58:48 tnn Exp $");
 
 #include 
 #include 
@@ -71,6 +71,8 @@ sendsig_siginfo(const ksiginfo_t *ksi, c
 	uc.uc_flags = _UC_SIGMASK;
 	uc.uc_sigmask = *mask;
 	uc.uc_link = l->l_ctxlink;
+	uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK)
+	? _UC_SETSTACK : _UC_CLRSTACK;
 	sendsig_reset(l, ksi->ksi_signo);
 	mutex_exit(p->p_lock);
 	cpu_getmcontext(l, _mcontext, _flags);



CVS commit: src/sys/arch/aarch64/aarch64

2020-04-23 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Apr 23 16:37:39 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: netbsd32_machdep.c

Log Message:
fix inverted logic in NETBSD32 user signal stack handling (PR evbarm/55200)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/aarch64/netbsd32_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/aarch64/aarch64/netbsd32_machdep.c
diff -u src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.10 src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.11
--- src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.10	Fri Jan 31 09:08:57 2020
+++ src/sys/arch/aarch64/aarch64/netbsd32_machdep.c	Thu Apr 23 16:37:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.10 2020/01/31 09:08:57 maxv Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.11 2020/04/23 16:37:39 tnn Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.10 2020/01/31 09:08:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.11 2020/04/23 16:37:39 tnn Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -217,7 +217,7 @@ netbsd32_sendsig_siginfo(const ksiginfo_
 	int error;
 
 	const bool onstack_p =
-	(ss->ss_flags & (SS_DISABLE | SS_ONSTACK)) &&
+	(ss->ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
 	(sa->sa_flags & SA_ONSTACK);
 
 	vaddr_t sp = onstack_p ?



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

2020-04-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Wed Apr  1 20:37:32 UTC 2020

Modified Files:
src/sys/arch/arm/rockchip: rk_spi.c

Log Message:
Don't fail if we cannot compute the clock divider because the master
clock is too slow for what the slave device requested.
Instead warn and select the highest available slave clock rate.
Should fix boot hang on Pinebook Pro when using spiflash(4).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rk_spi.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/rockchip/rk_spi.c
diff -u src/sys/arch/arm/rockchip/rk_spi.c:1.3 src/sys/arch/arm/rockchip/rk_spi.c:1.4
--- src/sys/arch/arm/rockchip/rk_spi.c:1.3	Tue Aug 13 17:15:55 2019
+++ src/sys/arch/arm/rockchip/rk_spi.c	Wed Apr  1 20:37:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rk_spi.c,v 1.3 2019/08/13 17:15:55 tnn Exp $	*/
+/*	$NetBSD: rk_spi.c,v 1.4 2020/04/01 20:37:32 tnn Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_spi.c,v 1.3 2019/08/13 17:15:55 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_spi.c,v 1.4 2020/04/01 20:37:32 tnn Exp $");
 
 #include 
 #include 
@@ -277,8 +277,12 @@ rk_spi_configure(void *cookie, int slave
 	uint16_t divider;
 
 	divider = (sc->sc_spi_freq / speed) & ~1;
-	if (divider < 2)
-		return EINVAL;
+	if (divider < 2) {
+		aprint_error_dev(sc->sc_dev,
+		"spi_clk %u is too low for speed %u, using speed %u\n",
+		 sc->sc_spi_freq, speed, sc->sc_spi_freq / 2);
+		divider = 2;
+	}
 
 	if (slave >= sc->sc_spi.sct_nslaves)
 		return EINVAL;



CVS commit: src/sys/stand/efiboot

2020-04-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Wed Apr  1 10:45:44 UTC 2020

Modified Files:
src/sys/stand/efiboot: Makefile.efiboot

Log Message:
efiboot: add clang fix from i386/stand/efiboot/bootx64/Makefile here too


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/stand/efiboot/Makefile.efiboot

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

Modified files:

Index: src/sys/stand/efiboot/Makefile.efiboot
diff -u src/sys/stand/efiboot/Makefile.efiboot:1.10 src/sys/stand/efiboot/Makefile.efiboot:1.11
--- src/sys/stand/efiboot/Makefile.efiboot:1.10	Sat Jan 25 11:24:20 2020
+++ src/sys/stand/efiboot/Makefile.efiboot	Wed Apr  1 10:45:44 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.10 2020/01/25 11:24:20 jmcneill Exp $
+# $NetBSD: Makefile.efiboot,v 1.11 2020/04/01 10:45:44 tnn Exp $
 
 S=		${.CURDIR}/../../..
 
@@ -87,6 +87,11 @@ CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
 #CPPFLAGS+= -DRARP_DEBUG
 #CPPFLAGS+= -DRPC_DEBUG
 
+# Follow the suit of Makefile.kern.inc; needed for the lfs64 union
+# accessors -- they don't actually dereference the resulting pointer,
+# just use it for type-checking.
+CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
+
 SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT
 SAMISCCPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT
 SAMISCCPPFLAGS+= -D"cdb2devb(bno)=(bno)"



CVS commit: src/sys

2020-03-24 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Mar 24 22:09:50 UTC 2020

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi
src/sys/dev/fdt: files.fdt

Log Message:
ohci@fdt, ehci@fdt are machine independent; move from sunxi to sys/dev/fdt


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r1.51 -r1.52 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/arch/arm/sunxi/files.sunxi
diff -u src/sys/arch/arm/sunxi/files.sunxi:1.67 src/sys/arch/arm/sunxi/files.sunxi:1.68
--- src/sys/arch/arm/sunxi/files.sunxi:1.67	Mon Dec  9 04:51:03 2019
+++ src/sys/arch/arm/sunxi/files.sunxi	Tue Mar 24 22:09:50 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.67 2019/12/09 04:51:03 riastradh Exp $
+#	$NetBSD: files.sunxi,v 1.68 2020/03/24 22:09:50 tnn Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -159,14 +159,6 @@ device	sun9iusbphy
 attach	sun9iusbphy at fdt with sunxi_a80_usbphy
 file	arch/arm/sunxi/sun9i_a80_usbphy.c	sunxi_a80_usbphy
 
-# EHCI
-attach	ehci at fdt with ehci_fdt
-file	dev/fdt/ehci_fdt.c			ehci_fdt	
-
-# OHCI
-attach	ohci at fdt with ohci_fdt
-file	dev/fdt/ohci_fdt.c			ohci_fdt
-
 # TWI
 device	sunxitwi: i2cbus, i2cexec, mvi2c
 attach	sunxitwi at fdt with sunxi_twi

Index: src/sys/dev/fdt/files.fdt
diff -u src/sys/dev/fdt/files.fdt:1.51 src/sys/dev/fdt/files.fdt:1.52
--- src/sys/dev/fdt/files.fdt:1.51	Sat Feb 22 00:28:35 2020
+++ src/sys/dev/fdt/files.fdt	Tue Mar 24 22:09:50 2020
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.51 2020/02/22 00:28:35 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.52 2020/03/24 22:09:50 tnn Exp $
 
 include	"external/bsd/libfdt/conf/files.libfdt"
 
@@ -116,6 +116,14 @@ file	dev/fdt/simplefb.c			simplefb
 attach	com at fdt with dw_apb_uart
 file	dev/fdt/dw_apb_uart.c			dw_apb_uart
 
+# EHCI
+attach	ehci at fdt with ehci_fdt
+file	dev/fdt/ehci_fdt.c			ehci_fdt
+
+# OHCI
+attach	ohci at fdt with ohci_fdt
+file	dev/fdt/ohci_fdt.c			ohci_fdt
+
 # Designware USB2 OTG
 attach	dwctwo at fdt with dwc2_fdt
 file	dev/fdt/dwc2_fdt.c			dwc2_fdt



CVS commit: src/sys/dev

2020-03-20 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Mar 20 19:03:13 UTC 2020

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

Log Message:
cgd: switch from malloc(9) to kmem(9)

XXX might be worthwhile to use pool_cache(9) in the write path


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/dev/cgd.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/cgd.c
diff -u src/sys/dev/cgd.c:1.123 src/sys/dev/cgd.c:1.124
--- src/sys/dev/cgd.c:1.123	Wed Mar 11 13:48:45 2020
+++ src/sys/dev/cgd.c	Fri Mar 20 19:03:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.123 2020/03/11 13:48:45 mlelstv Exp $ */
+/* $NetBSD: cgd.c,v 1.124 2020/03/20 19:03:13 tnn Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.123 2020/03/11 13:48:45 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.124 2020/03/20 19:03:13 tnn Exp $");
 
 #include 
 #include 
@@ -40,7 +40,6 @@ __KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.12
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -636,11 +635,11 @@ cgd_getdata(struct cgd_softc *sc, unsign
 	if (data)
 		return data;
 
-	return malloc(size, M_DEVBUF, M_NOWAIT);
+	return kmem_intr_alloc(size, KM_NOSLEEP);
 }
 
 static void
-cgd_putdata(struct cgd_softc *sc, void *data)
+cgd_putdata(struct cgd_softc *sc, void *data, unsigned long size)
 {
 
 	if (data == sc->sc_data) {
@@ -648,7 +647,7 @@ cgd_putdata(struct cgd_softc *sc, void *
 		sc->sc_data_used = false;
 		mutex_exit(>sc_lock);
 	} else
-		free(data, M_DEVBUF);
+		kmem_intr_free(data, size);
 }
 
 static int
@@ -804,7 +803,7 @@ cgd_iodone2(struct cgd_softc *sc, struct
 
 	/* If we allocated memory, free it now... */
 	if (nbp->b_data != obp->b_data)
-		cgd_putdata(sc, nbp->b_data);
+		cgd_putdata(sc, nbp->b_data, nbp->b_bcount);
 
 	putiobuf(nbp);
 
@@ -857,7 +856,7 @@ cgd_dumpblocks(device_t dev, void *va, d
 	error = bdev_dump(sc->sc_tdev, blkno, buf, nbytes);
 
 	/* Release the buffer.  */
-	cgd_putdata(sc, buf);
+	cgd_putdata(sc, buf, nbytes);
 
 	/* Return any error from the underlying disk device.  */
 	return error;
@@ -1129,7 +1128,7 @@ cgd_ioctl_set(struct cgd_softc *sc, void
 
 	bufq_alloc(>sc_bufq, "fcfs", 0);
 
-	sc->sc_data = malloc(MAXPHYS, M_DEVBUF, M_WAITOK);
+	sc->sc_data = kmem_alloc(MAXPHYS, KM_SLEEP);
 	sc->sc_data_used = false;
 
 	/* Attach the disk. */
@@ -1168,7 +1167,7 @@ cgd_ioctl_clr(struct cgd_softc *sc, stru
 	(void)vn_close(sc->sc_tvn, FREAD|FWRITE, l->l_cred);
 	sc->sc_cfuncs->cf_destroy(sc->sc_cdata.cf_priv);
 	kmem_free(sc->sc_tpath, sc->sc_tpathlen);
-	free(sc->sc_data, M_DEVBUF);
+	kmem_free(sc->sc_data, MAXPHYS);
 	sc->sc_data_used = false;
 	dk_detach(dksc);
 	disk_detach(>sc_dkdev);
@@ -1486,7 +1485,7 @@ selftest(void)
 
 		sc.sc_cdata.cf_blocksize /= 8;
 
-		buf = malloc(txtlen, M_DEVBUF, M_WAITOK);
+		buf = kmem_alloc(txtlen, KM_SLEEP);
 		memcpy(buf, selftests[i].ptxt, txtlen);
 
 		cgd_cipher(, buf, buf, txtlen, selftests[i].blkno,
@@ -1499,7 +1498,7 @@ selftest(void)
 		if (memcmp(buf, selftests[i].ptxt, txtlen) != 0)
 			panic("decryption is broken");
 
-		free(buf, M_DEVBUF);
+		kmem_free(buf, txtlen);
 		sc.sc_cfuncs->cf_destroy(sc.sc_cdata.cf_priv);
 	}
 



CVS commit: src/lib

2020-03-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Wed Mar 18 00:37:30 UTC 2020

Modified Files:
src/lib: Makefile

Log Message:
libp2k still needs to be under MKRUMP


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/lib/Makefile

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

Modified files:

Index: src/lib/Makefile
diff -u src/lib/Makefile:1.280 src/lib/Makefile:1.281
--- src/lib/Makefile:1.280	Tue Mar 17 22:20:48 2020
+++ src/lib/Makefile	Wed Mar 18 00:37:29 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.280 2020/03/17 22:20:48 christos Exp $
+#	$NetBSD: Makefile,v 1.281 2020/03/18 00:37:29 tnn Exp $
 #	from: @(#)Makefile	5.25.1.1 (Berkeley) 5/7/91
 
 .include 
@@ -283,7 +283,9 @@ SUBDIR+=	.WAIT
 SUBDIR+=	../external/bsd/pam-u2f/lib	# depends on libpam
 .endif
 
+.if (${MKRUMP} != "no")
 SUBDIR+=	libp2k		# depends on libukfs, librumpvfs, libpuffs
+.endif
 
 .if (${MKTPM} != "no")
 SUBDIR+=	../crypto/external/cpl/tpm-tools/lib	# depends on trousers



CVS commit: src/sys/dev/nvmm/x86

2020-03-12 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Mar 12 13:01:59 UTC 2020

Modified Files:
src/sys/dev/nvmm/x86: nvmm_x86_vmx.c

Log Message:
vmx_vmptrst(): only used when DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/nvmm/x86/nvmm_x86_vmx.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/nvmm/x86/nvmm_x86_vmx.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.49 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.50
--- src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.49	Fri Feb 21 00:26:22 2020
+++ src/sys/dev/nvmm/x86/nvmm_x86_vmx.c	Thu Mar 12 13:01:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_vmx.c,v 1.49 2020/02/21 00:26:22 joerg Exp $	*/
+/*	$NetBSD: nvmm_x86_vmx.c,v 1.50 2020/03/12 13:01:59 tnn Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.49 2020/02/21 00:26:22 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.50 2020/03/12 13:01:59 tnn Exp $");
 
 #include 
 #include 
@@ -134,6 +134,7 @@ vmx_vmwrite(uint64_t field, uint64_t val
 	);
 }
 
+#ifdef DIAGNOSTIC
 static inline paddr_t
 vmx_vmptrst(void)
 {
@@ -148,6 +149,7 @@ vmx_vmptrst(void)
 
 	return pa;
 }
+#endif
 
 static inline void
 vmx_vmptrld(paddr_t *pa)



CVS commit: src/sys/kern

2020-03-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Mar  7 23:20:19 UTC 2020

Modified Files:
src/sys/kern: subr_tftproot.c

Log Message:
clean trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/kern/subr_tftproot.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/kern/subr_tftproot.c
diff -u src/sys/kern/subr_tftproot.c:1.23 src/sys/kern/subr_tftproot.c:1.24
--- src/sys/kern/subr_tftproot.c:1.23	Sun Jan 20 21:26:13 2019
+++ src/sys/kern/subr_tftproot.c	Sat Mar  7 23:20:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_tftproot.c,v 1.23 2019/01/20 21:26:13 bad Exp $ */
+/*	$NetBSD: subr_tftproot.c,v 1.24 2020/03/07 23:20:19 tnn Exp $ */
 
 /*-
  * Copyright (c) 2007 Emmanuel Dreyfus, all rights reserved.
@@ -14,14 +14,14 @@
  * 3. All advertising materials mentioning features or use of this software
  *must display the following acknowledgement:
  *	This product includes software developed by Emmanuel Dreyfus
- * 4. The name of the author may not be used to endorse or promote 
- *products derived from this software without specific prior written 
+ * 4. The name of the author may not be used to endorse or promote
+ *products derived from this software without specific prior written
  *permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS'' 
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+ * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS 
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -39,7 +39,7 @@
 #include "opt_md.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_tftproot.c,v 1.23 2019/01/20 21:26:13 bad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_tftproot.c,v 1.24 2020/03/07 23:20:19 tnn Exp $");
 
 #include 
 #include 
@@ -65,8 +65,8 @@ __KERNEL_RCSID(0, "$NetBSD: subr_tftproo
 #include 
 #include 
 
-/* 
- * Copied from  
+/*
+ * Copied from 
  */
 
 #define SEGSIZE 512 /* data segment size */
@@ -134,7 +134,7 @@ tftproot_dhcpboot(device_t bootdv)
 			if (strcmp(rootspec, ifp->if_xname) == 0)
 break;
 		pserialize_read_exit(s);
-	} 
+	}
 
 	if ((ifp == NULL) &&
 	(bootdv != NULL && device_class(bootdv) == DV_IFNET)) {
@@ -167,12 +167,12 @@ tftproot_dhcpboot(device_t bootdv)
 	nd->nd_nomount = 1;
 
 	if ((error = nfs_boot_init(nd, l)) != 0) {
-		DPRINTF(("%s():%d nfs_boot_init returned %d\n", 
+		DPRINTF(("%s():%d nfs_boot_init returned %d\n",
 		__func__, __LINE__, error));
 		goto out;
 	}
 
-	/* 
+	/*
 	 * Strip leading "tftp:"
 	 */
 #define PREFIX "tftp:"
@@ -189,7 +189,7 @@ tftproot_dhcpboot(device_t bootdv)
 	trh.trh_block = 1;
 
 	if ((error = tftproot_getfile(, l)) != 0) {
-		DPRINTF(("%s():%d tftproot_getfile returned %d\n", 
+		DPRINTF(("%s():%d tftproot_getfile returned %d\n",
 		__func__, __LINE__, error));
 		goto out;
 	}
@@ -203,7 +203,7 @@ out:
 	return error;
 }
 
-static int 
+static int
 tftproot_getfile(struct tftproot_handle *trh, struct lwp *l)
 {
 	struct socket *so = NULL;
@@ -218,7 +218,7 @@ tftproot_getfile(struct tftproot_handle 
 	char *cp;
 	
 	if ((error = socreate(AF_INET, , SOCK_DGRAM, 0, l, NULL)) != 0) {
-		DPRINTF(("%s():%d socreate returned %d\n", 
+		DPRINTF(("%s():%d socreate returned %d\n",
 		__func__, __LINE__, error));
 		goto out;
 	}
@@ -227,7 +227,7 @@ tftproot_getfile(struct tftproot_handle 
 	 * Set timeout
 	 */
 	if ((error = nfs_boot_setrecvtimo(so))) {
-		DPRINTF(("%s():%d SO_RCVTIMEO failed %d\n", 
+		DPRINTF(("%s():%d SO_RCVTIMEO failed %d\n",
 		__func__, __LINE__, error));
 		goto out;
 	}
@@ -244,7 +244,7 @@ tftproot_getfile(struct tftproot_handle 
 	namelen = strlen(trh->trh_nd->nd_bootfile) + 1;
 	packetlen = sizeof(tftp->th_opcode) + namelen + sizeof(octetstr);
 	if (packetlen > MSIZE) {
-		DPRINTF(("%s():%d boot filename too long (%ld bytes)\n", 
+		DPRINTF(("%s():%d boot filename too long (%ld bytes)\n",
 		__func__, __LINE__, (long)namelen));
 		error = E2BIG;
 		goto out;
@@ -265,10 +265,10 @@ tftproot_getfile(struct tftproot_handle 
 	cp += namelen;
 	(void)strncpy(cp, octetstr, sizeof(octetstr));
 
-	/* 
+	/*
 	 * Perform the file transfer
 	 */
-	printf("tftproot: download %s:%s ", 
+	printf("tftproot: download %s:%s ",
 	inet_ntoa(sin.sin_addr), trh->trh_nd->nd_bootfile);
 
 	do {
@@ -281,19 +281,19 @@ tftproot_getfile(struct tftproot_handle 
 		if ((trh->trh_block % 

CVS commit: src/share/man/man4

2020-03-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Mar  7 23:17:47 UTC 2020

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

Log Message:
correct documentation for options TFTPROOT

TFTPROOT does *not* require MEMORY_DISK_IS_ROOT. In fact, it doesn't
work at all when MEMORY_DISK_IS_ROOT is set, because then setroot()
tries to perform dhcp on md0 instead of the network card.


To generate a diff of this commit:
cvs rdiff -u -r1.508 -r1.509 src/share/man/man4/options.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/options.4
diff -u src/share/man/man4/options.4:1.508 src/share/man/man4/options.4:1.509
--- src/share/man/man4/options.4:1.508	Sat Feb  8 07:07:06 2020
+++ src/share/man/man4/options.4	Sat Mar  7 23:17:47 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: options.4,v 1.508 2020/02/08 07:07:06 maxv Exp $
+.\"	$NetBSD: options.4,v 1.509 2020/03/07 23:17:47 tnn Exp $
 .\"
 .\" Copyright (c) 1996
 .\" 	Perry E. Metzger.  All rights reserved.
@@ -30,7 +30,7 @@
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd February 8, 2020
+.Dd March 7, 2020
 .Dt OPTIONS 4
 .Os
 .Sh NAME
@@ -1323,10 +1323,9 @@ embedded in the kernel using
 .Xr mdsetimage 8 .
 The RAM disk name is obtained using DHCP's filename parameter.
 This option requires
-.Em MEMORY_DISK_HOOKS ,
-.Em MEMORY_DISK_DYNAMIC ,
+.Em MEMORY_DISK_HOOKS
 and
-.Em MEMORY_DISK_IS_ROOT .
+.Em MEMORY_DISK_DYNAMIC .
 It is incompatible with
 .Em MEMORY_DISK_ROOT_SIZE .
 .It Cd options HZ=integer



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

2020-03-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Mar  5 14:24:46 UTC 2020

Modified Files:
src/sys/arch/arm/dts: meson8b-odroidc1.dts omap3-beagle-xm.dts
omap3-beagle.dts omap3-n900.dts

Log Message:
#include_next confuses clang-cpp; use relative pathname to upstream dts

warning: #include_next in file found relative to primary source file or
 found by absolute path; will search from start of include path
 [-Winclude-next-absolute-path]
error: #include nested too deeply


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/dts/meson8b-odroidc1.dts
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/dts/omap3-beagle-xm.dts \
src/sys/arch/arm/dts/omap3-beagle.dts src/sys/arch/arm/dts/omap3-n900.dts

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/dts/meson8b-odroidc1.dts
diff -u src/sys/arch/arm/dts/meson8b-odroidc1.dts:1.4 src/sys/arch/arm/dts/meson8b-odroidc1.dts:1.5
--- src/sys/arch/arm/dts/meson8b-odroidc1.dts:1.4	Wed Aug 14 09:54:34 2019
+++ src/sys/arch/arm/dts/meson8b-odroidc1.dts	Thu Mar  5 14:24:46 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: meson8b-odroidc1.dts,v 1.4 2019/08/14 09:54:34 jmcneill Exp $ */
+/* $NetBSD: meson8b-odroidc1.dts,v 1.5 2020/03/05 14:24:46 tnn Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include_next "meson8b-odroidc1.dts"
+#include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/meson8b-odroidc1.dts"
 #include "meson8b.dtsi"
 
  {

Index: src/sys/arch/arm/dts/omap3-beagle-xm.dts
diff -u src/sys/arch/arm/dts/omap3-beagle-xm.dts:1.1 src/sys/arch/arm/dts/omap3-beagle-xm.dts:1.2
--- src/sys/arch/arm/dts/omap3-beagle-xm.dts:1.1	Thu Oct 31 01:25:56 2019
+++ src/sys/arch/arm/dts/omap3-beagle-xm.dts	Thu Mar  5 14:24:46 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: omap3-beagle-xm.dts,v 1.1 2019/10/31 01:25:56 sevan Exp $ */
+/* $NetBSD: omap3-beagle-xm.dts,v 1.2 2020/03/05 14:24:46 tnn Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include_next "omap3-beagle-xm.dts"
+#include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/omap3-beagle-xm.dts"
 
 / {
 	chosen {
Index: src/sys/arch/arm/dts/omap3-beagle.dts
diff -u src/sys/arch/arm/dts/omap3-beagle.dts:1.1 src/sys/arch/arm/dts/omap3-beagle.dts:1.2
--- src/sys/arch/arm/dts/omap3-beagle.dts:1.1	Tue Oct 29 22:18:28 2019
+++ src/sys/arch/arm/dts/omap3-beagle.dts	Thu Mar  5 14:24:46 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: omap3-beagle.dts,v 1.1 2019/10/29 22:18:28 jmcneill Exp $ */
+/* $NetBSD: omap3-beagle.dts,v 1.2 2020/03/05 14:24:46 tnn Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include_next "omap3-beagle.dts"
+#include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/omap3-beagle.dts"
 
 / {
 	chosen {
Index: src/sys/arch/arm/dts/omap3-n900.dts
diff -u src/sys/arch/arm/dts/omap3-n900.dts:1.1 src/sys/arch/arm/dts/omap3-n900.dts:1.2
--- src/sys/arch/arm/dts/omap3-n900.dts:1.1	Thu Oct 31 17:09:13 2019
+++ src/sys/arch/arm/dts/omap3-n900.dts	Thu Mar  5 14:24:46 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: omap3-n900.dts,v 1.1 2019/10/31 17:09:13 jmcneill Exp $ */
+/* $NetBSD: omap3-n900.dts,v 1.2 2020/03/05 14:24:46 tnn Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include_next "omap3-n900.dts"
+#include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/omap3-n900.dts"
 
 / {
 	chosen {



CVS commit: src/crypto/external/bsd/openssh/dist

2020-02-29 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Feb 29 14:03:17 UTC 2020

Modified Files:
src/crypto/external/bsd/openssh/dist: xmalloc.h

Log Message:
annotate xvasprintf w/ format string attribute


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/crypto/external/bsd/openssh/dist/xmalloc.h

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

Modified files:

Index: src/crypto/external/bsd/openssh/dist/xmalloc.h
diff -u src/crypto/external/bsd/openssh/dist/xmalloc.h:1.12 src/crypto/external/bsd/openssh/dist/xmalloc.h:1.13
--- src/crypto/external/bsd/openssh/dist/xmalloc.h:1.12	Thu Feb 27 00:24:40 2020
+++ src/crypto/external/bsd/openssh/dist/xmalloc.h	Sat Feb 29 14:03:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xmalloc.h,v 1.12 2020/02/27 00:24:40 christos Exp $	*/
+/*	$NetBSD: xmalloc.h,v 1.13 2020/02/29 14:03:17 tnn Exp $	*/
 /* $OpenBSD: xmalloc.h,v 1.19 2019/11/12 22:32:48 djm Exp $ */
 
 /*
@@ -26,4 +26,5 @@ int	 xasprintf(char **, const char *, ..
 __attribute__((__format__ (printf, 2, 3)))
 __attribute__((__nonnull__ (2)));
 int	 xvasprintf(char **, const char *, va_list)
+__attribute__((__format__ (printf, 2, 0)))
 		__attribute__((__nonnull__ (2)));



CVS commit: xsrc/external/mit/libxshmfence/dist/src

2020-02-23 Thread Tobias Nygren
Module Name:xsrc
Committed By:   tnn
Date:   Sun Feb 23 23:18:01 UTC 2020

Modified Files:
xsrc/external/mit/libxshmfence/dist/src: xshmfence_semaphore.c
xshmfence_semaphore.h

Log Message:
sync from pkgsrc:

> libxshmfence: improve performance of semaphore backend. Bump rev.
>
> It used more locking than necessary. We only need two semaphores.
> One to tell waiters to wake up and one to let the last waiter that
> wakes up notify xshmfence_trigger() it may now return.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
xsrc/external/mit/libxshmfence/dist/src/xshmfence_semaphore.c \
xsrc/external/mit/libxshmfence/dist/src/xshmfence_semaphore.h

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

Modified files:

Index: xsrc/external/mit/libxshmfence/dist/src/xshmfence_semaphore.c
diff -u xsrc/external/mit/libxshmfence/dist/src/xshmfence_semaphore.c:1.1 xsrc/external/mit/libxshmfence/dist/src/xshmfence_semaphore.c:1.2
--- xsrc/external/mit/libxshmfence/dist/src/xshmfence_semaphore.c:1.1	Sun Aug 14 03:43:37 2016
+++ xsrc/external/mit/libxshmfence/dist/src/xshmfence_semaphore.c	Sun Feb 23 23:18:01 2020
@@ -33,12 +33,12 @@
 
 #include "xshmfenceint.h"
 
-static sem_t *mksemtemp(char *, const char *);
+static sem_t *mksemtemp(char *, size_t, const char *);
 
-#define LOCK() do {} while (sem_wait(f->lock) != 0)
-#define UNLOCK() do { sem_post(f->lock); } while (0)
-#define COND_WAIT() do {} while (sem_wait(f->cond) != 0)
-#define COND_SIGNAL() do { sem_post(f->cond); } while (0)
+#define COND_WAIT_W() do {} while (sem_wait(f->cond_w) != 0)
+#define COND_SIGNAL_W() do { sem_post(f->cond_w); } while (0)
+#define COND_WAIT_T() do {} while (sem_wait(f->cond_t) != 0)
+#define COND_SIGNAL_T() do { sem_post(f->cond_t); } while (0)
 
 /**
  * xshmfence_trigger:
@@ -52,30 +52,23 @@ static sem_t *mksemtemp(char *, const ch
 int
 xshmfence_trigger(struct xshmfence *f) {
 	int v, waiting;
-	LOCK();
 	v = __sync_bool_compare_and_swap(>triggered, 0, 1);
 	if (v == 0) {
 		/* already triggered */
-		UNLOCK();
 		return 0;
 	}
-	
-	waiting = __sync_fetch_and_add(>waiting, 0);
 
-	while (waiting > 0) {
-		COND_SIGNAL();
-		waiting--;
-	}
-
-	while (__sync_fetch_and_add(>waiting, 0) > 0) {
-		/*
-		 * Busy wait until they all woke up.
-		 * No new sleepers should arrive since
-		 * the lock is still held.
-		 */
-		/* yield(); */
+	while ((waiting = __sync_fetch_and_add(>waiting, 0)) > 0) {
+		if (__sync_bool_compare_and_swap(>waiting, waiting, 0)) {
+			__sync_fetch_and_add(>wakeups, waiting);
+			while (waiting--) {
+COND_SIGNAL_W();
+			}
+			COND_WAIT_T();
+			return 0;
+		}
 	}
-	UNLOCK();
+
 	return 0;
 }
 
@@ -92,24 +85,18 @@ xshmfence_trigger(struct xshmfence *f) {
 int
 xshmfence_await(struct xshmfence *f) {
 
-	LOCK();
 	if (__sync_fetch_and_add(>triggered, 0) == 1) {
-		UNLOCK();
 		return 0;
 	}
 	do {
 		__sync_fetch_and_add(>waiting, 1);
-		/*
-		 * These next operations are not atomic.
-		 * But we busy-wait in xshmfence_trigger, so that's ok.
-		 */
-		UNLOCK();
-		COND_WAIT();
-		__sync_fetch_and_sub(>waiting, 1);
-		LOCK();
+		COND_WAIT_W();
+	} while (__sync_fetch_and_add(>triggered, 0) == 0);
+
+	if (__sync_sub_and_fetch(>wakeups, 1) == 0) {
+		COND_SIGNAL_T();
 	}
-	while (__sync_fetch_and_add(>triggered, 0) == 0);
-	UNLOCK();
+
 	return 0;
 }
 
@@ -121,11 +108,7 @@ xshmfence_await(struct xshmfence *f) {
  **/
 int
 xshmfence_query(struct xshmfence *f) {
-	int ret;
-	LOCK();
-	ret = __sync_fetch_and_add(>triggered, 0);
-	UNLOCK();
-	return ret;
+	return __sync_fetch_and_add(>triggered, 0);
 }
 
 /**
@@ -137,9 +120,7 @@ xshmfence_query(struct xshmfence *f) {
  **/
 void
 xshmfence_reset(struct xshmfence *f) {
-	LOCK();
 	__sync_bool_compare_and_swap(>triggered, 1, 0);
-	UNLOCK();
 }
 
 /**
@@ -151,27 +132,26 @@ xshmfence_reset(struct xshmfence *f) {
 void
 xshmfence_init(int fd)
 {
-	sem_t *lock;
-	sem_t *cond;
+	sem_t *cond_w, *cond_t;
 	struct xshmfence f;
 
 	__sync_fetch_and_and(, 0);
 	__sync_fetch_and_and(, 0);
 	__sync_fetch_and_and(, 0);
-	
-	lock = mksemtemp(f.lockname, "/xshmfl-%i");
-	if (lock == SEM_FAILED) {
+	__sync_fetch_and_and(, 0);
+
+	cond_w = mksemtemp(f.condname_w, sizeof(f.condname_w), "w");
+	if (cond_w == SEM_FAILED) {
 		err(EXIT_FAILURE, "xshmfence_init: sem_open");
 	}
-
-	cond = mksemtemp(f.condname, "/xshmfc-%i");
-	if (cond == SEM_FAILED) {
+	cond_t = mksemtemp(f.condname_t, sizeof(f.condname_t), "t");
+	if (cond_t == SEM_FAILED) {
 		err(EXIT_FAILURE, "xshmfence_init: sem_open");
 	}
-	
-	sem_close(lock);
-	sem_close(cond);
-	
+
+	sem_close(cond_w);
+	sem_close(cond_t);
+
 	pwrite(fd, , sizeof(f), 0);
 }
 
@@ -187,7 +167,7 @@ xshmfence_open_semaphore(struct xshmfenc
 	/*
 	 * map process local memory to page 2
 	 */
-	if (mmap ((void*)>lock,
+	if (mmap ((void*)>cond_w,
 		  LIBXSHM_PAGESIZE,
 		  PROT_READ|PROT_WRITE,
 		  MAP_FIXED|MAP_ANON,
@@ -195,11 +175,11 @@ 

CVS commit: xsrc/external/mit/MesaLib/dist/src/mapi

2020-02-22 Thread Tobias Nygren
Module Name:xsrc
Committed By:   tnn
Date:   Sat Feb 22 09:42:27 UTC 2020

Modified Files:
xsrc/external/mit/MesaLib/dist/src/mapi: entry_x86-64_tls.h
entry_x86_tls.h

Log Message:
mesa: sync w/ pkgsrc: don't assume the current gl dispatch table points
to noop if NULL, instead call the ENTRY_CURRENT_TABLE_GET function.

Additionally the previous i386 implementation probably never worked
because it looks like it used the wrong asm label when computing GOT ptr.
Likely relevant to PR port-i386/54782.

XXX pullup -9


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h
cvs rdiff -u -r1.5 -r1.6 \
xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h

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

Modified files:

Index: xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h
diff -u xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h:1.4 xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h:1.5
--- xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h:1.4	Tue Apr  9 14:14:59 2019
+++ xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h	Sat Feb 22 09:42:27 2020
@@ -32,24 +32,27 @@
 #endif
 
 __asm__(".text\n"
-".balign 32\n"
+".balign 64\n"
 "x86_64_entry_start:");
 
 #define STUB_ASM_ENTRY(func) \
".globl " func "\n"   \
".type " func ", @function\n" \
-   ".balign 32\n"\
+   ".balign 64\n"\
func ":"
 
 #ifndef __ILP32__
 
-#if defined(__NetBSD__) && defined(MAPI_MODE_GLAPI)
+#if defined(__NetBSD__)
 #define STUB_ASM_CODE(slot)  \
"movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t"  \
"movq %fs:(%rax), %r11\n\t"   \
"testq %r11, %r11\n\t"\
-   "cmoveq table_noop_array@GOTPCREL(%rip), %r11\n\t"\
-   "jmp *(8 * " slot ")(%r11)"
+   "je 1f\n\t"   \
+   "jmp *(8 * " slot ")(%r11)\n\t"   \
+   "1:\n\t"  \
+   "callq " ENTRY_CURRENT_TABLE_GET "@PLT\n\t"   \
+   "jmp *(8 * " slot ")(%rax)"
 #else
 #define STUB_ASM_CODE(slot)  \
"movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t"  \
@@ -86,7 +89,7 @@ x86_64_entry_start[] HIDDEN;
 mapi_func
 entry_get_public(int slot)
 {
-   return (mapi_func) (x86_64_entry_start + slot * 32);
+   return (mapi_func) (x86_64_entry_start + slot * 64);
 }
 
 void

Index: xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h
diff -u xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h:1.5 xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h:1.6
--- xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h:1.5	Tue Apr  9 14:14:59 2019
+++ xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h	Sat Feb 22 09:42:27 2020
@@ -43,6 +43,20 @@ __asm__("x86_current_tls:\n\t"
 	"movl " ENTRY_CURRENT_TABLE "@GOTNTPOFF(%eax), %eax\n\t"
 	"ret");
 
+#if defined(__NetBSD__)
+__asm__("x86_current_table_helper:\n\t"
+	"movl %gs:(%eax), %eax\n\t"   \
+	"testl %eax, %eax\n\t"\
+	"je 1f\n\t"   \
+	"ret\n\t" \
+	"1:\n\t"  \
+	"call 2f\n\t" \
+	"2:\n\t"  \
+	"popl %eax\n\t"   \
+	"addl $_GLOBAL_OFFSET_TABLE_+[.-2b], %eax\n\t" \
+	"jmp *" ENTRY_CURRENT_TABLE_GET "@GOT(%eax)");
+#endif
+
 #ifndef GLX_X86_READONLY_TEXT
 __asm__(".section wtext, \"awx\", @progbits");
 #endif /* GLX_X86_READONLY_TEXT */
@@ -56,20 +70,10 @@ __asm__(".balign 16\n"
".balign 16\n"\
func ":"
 
-#if defined(__NetBSD__) && defined(MAPI_MODE_GLAPI)
-extern const mapi_func table_noop_array[];
+#if defined(__NetBSD__)
 #define STUB_ASM_CODE(slot)  \
"call x86_current_tls\n\t"\
-   "movl %gs:(%eax), %eax\n\t"   \
-   "testl %eax, %eax\n\t"\
-   "je 1f\n\t"   \
-   "jmp *(4 * " slot ")(%eax)\n\t" \
-   "1:\n\t"  \
-   "call 2f\n"   \
-   "2:\n\t"  \
-   "popl %eax\n\t"   \
-   "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" \
-   "movl table_noop_array@GOT(%eax), %eax\n\t" \
+   "call x86_current_table_helper\n\t"\
"jmp *(4 * " slot ")(%eax)"
 #else
 #define STUB_ASM_CODE(slot)  \



CVS commit: src/sys/arch/aarch64/aarch64

2020-02-15 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Feb 15 13:51:33 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: locore.S

Log Message:
avoid nesting /*'s (-Wcomment)


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/aarch64/aarch64/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/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.56 src/sys/arch/aarch64/aarch64/locore.S:1.57
--- src/sys/arch/aarch64/aarch64/locore.S:1.56	Sat Feb 15 08:16:10 2020
+++ src/sys/arch/aarch64/aarch64/locore.S	Sat Feb 15 13:51:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.56 2020/02/15 08:16:10 skrll Exp $	*/
+/*	$NetBSD: locore.S,v 1.57 2020/02/15 13:51:33 tnn Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -38,7 +38,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.56 2020/02/15 08:16:10 skrll Exp $")
+RCSID("$NetBSD: locore.S,v 1.57 2020/02/15 13:51:33 tnn Exp $")
 
 #ifdef AARCH64_DEVICE_MEM_STRONGLY_ORDERED
 #define	MAIR_DEVICE_MEM		MAIR_DEVICE_nGnRnE
@@ -47,9 +47,9 @@ RCSID("$NetBSD: locore.S,v 1.56 2020/02/
 #endif
 #define	MAIR_DEVICE_MEM_SO	MAIR_DEVICE_nGnRnE
 
-/*#define DEBUG_LOCORE			/* debug print */
-/*#define DEBUG_LOCORE_PRINT_LOCK	/* avoid mixing AP's output */
-/*#define DEBUG_MMU			/* dump MMU table */
+/*#define DEBUG_LOCORE			// debug print */
+/*#define DEBUG_LOCORE_PRINT_LOCK	// avoid mixing AP's output */
+/*#define DEBUG_MMU			// dump MMU table */
 
 #define LOCORE_EL2
 



CVS commit: src/sys/external/bsd/drm2/include/linux

2020-02-14 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Feb 14 18:17:23 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/include/linux: fence.h

Log Message:
FENCE_TRACE is __printflike


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/include/linux/fence.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/external/bsd/drm2/include/linux/fence.h
diff -u src/sys/external/bsd/drm2/include/linux/fence.h:1.15 src/sys/external/bsd/drm2/include/linux/fence.h:1.16
--- src/sys/external/bsd/drm2/include/linux/fence.h:1.15	Mon Aug 27 14:20:41 2018
+++ src/sys/external/bsd/drm2/include/linux/fence.h	Fri Feb 14 18:17:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fence.h,v 1.15 2018/08/27 14:20:41 riastradh Exp $	*/
+/*	$NetBSD: fence.h,v 1.16 2020/02/14 18:17:23 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -127,7 +127,7 @@ long	fence_wait(struct fence *, bool);
 long	fence_wait_any_timeout(struct fence **, uint32_t, bool, long);
 long	fence_wait_timeout(struct fence *, bool, long);
 
-static inline void
+static inline void __printflike(2, 3)
 FENCE_TRACE(struct fence *f, const char *fmt, ...)
 {
 	va_list va;



CVS commit: src/sys/external/bsd/drm2/include/linux

2020-02-14 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Feb 14 16:02:41 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/include/linux: capability.h

Log Message:
fix a typo, caught by -Werror,-Wheader-guard


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/linux/capability.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/external/bsd/drm2/include/linux/capability.h
diff -u src/sys/external/bsd/drm2/include/linux/capability.h:1.1 src/sys/external/bsd/drm2/include/linux/capability.h:1.2
--- src/sys/external/bsd/drm2/include/linux/capability.h:1.1	Fri Feb 14 04:36:56 2020
+++ src/sys/external/bsd/drm2/include/linux/capability.h	Fri Feb 14 16:02:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: capability.h,v 1.1 2020/02/14 04:36:56 riastradh Exp $	*/
+/*	$NetBSD: capability.h,v 1.2 2020/02/14 16:02:41 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #ifndef _LINUX_CAPABILITY_H_
-#define _LINUX_CAPABILITy_H_
+#define _LINUX_CAPABILITY_H_
 
 #include 
 



CVS commit: src/tests/lib/libc/sys

2020-02-13 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Feb 13 18:31:55 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_x86_wait.h

Log Message:
adjust r1.19; add clang equivalent of gcc specific attribute


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/lib/libc/sys/t_ptrace_x86_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_x86_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.21 src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.22
--- src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.21	Thu Feb 13 15:27:25 2020
+++ src/tests/lib/libc/sys/t_ptrace_x86_wait.h	Thu Feb 13 18:31:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_x86_wait.h,v 1.21 2020/02/13 15:27:25 mgorny Exp $	*/
+/*	$NetBSD: t_ptrace_x86_wait.h,v 1.22 2020/02/13 18:31:54 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -1971,7 +1971,12 @@ ATF_TC_HEAD(x86_cve_2018_8897, tc)
 
 #define X86_CVE_2018_8897_PAGE 0x5000 /* page addressable by 32-bit registers */
 
-static __attribute__((__optimize__("O0"))) void
+static void
+#ifdef __clang__
+__attribute__((optnone))
+#else
+__attribute__((__optimize__("O0")))
+#endif
 x86_cve_2018_8897_trigger(void)
 {
 	/*



CVS commit: src/tests/dev/audio

2020-02-13 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Feb 13 18:06:26 UTC 2020

Modified Files:
src/tests/dev/audio: audiotest.c

Log Message:
don't use variable 'newval' uninitialized when multiuser mode unchanged


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/audio/audiotest.c

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

Modified files:

Index: src/tests/dev/audio/audiotest.c
diff -u src/tests/dev/audio/audiotest.c:1.2 src/tests/dev/audio/audiotest.c:1.3
--- src/tests/dev/audio/audiotest.c:1.2	Wed Feb 12 07:02:21 2020
+++ src/tests/dev/audio/audiotest.c	Thu Feb 13 18:06:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiotest.c,v 1.2 2020/02/12 07:02:21 martin Exp $	*/
+/*	$NetBSD: audiotest.c,v 1.3 2020/02/13 18:06:26 tnn Exp $	*/
 
 /*
  * Copyright (C) 2019 Tetsuya Isaki. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: audiotest.c,v 1.2 2020/02/12 07:02:21 martin Exp $");
+__RCSID("$NetBSD: audiotest.c,v 1.3 2020/02/13 18:06:26 tnn Exp $");
 
 #include 
 #include 
@@ -2331,6 +2331,8 @@ test_open_multiuser(int multiuser)
 		r = SYSCTLBYNAME(mibname, NULL, NULL, , sizeof(newval));
 		REQUIRED_SYS_EQ(0, r);
 		DPRINTF("  > new multiuser=%d\n", multiuser);
+	} else {
+		newval = oldval;
 	}
 
 	/* Do test */
@@ -6109,6 +6111,8 @@ test_audioctl_open_multiuser(int multius
 		r = SYSCTLBYNAME(mibname, NULL, NULL, , sizeof(newval));
 		REQUIRED_SYS_EQ(0, r);
 		DPRINTF("  > new multiuser=%d\n", multiuser);
+	} else {
+		newval = oldval;
 	}
 
 	/* Do test */



CVS commit: src/sys/dev/acpi

2020-02-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Feb  1 20:11:24 UTC 2020

Modified Files:
src/sys/dev/acpi: sdhc_acpi.c

Log Message:
fix build


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/acpi/sdhc_acpi.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/acpi/sdhc_acpi.c
diff -u src/sys/dev/acpi/sdhc_acpi.c:1.13 src/sys/dev/acpi/sdhc_acpi.c:1.14
--- src/sys/dev/acpi/sdhc_acpi.c:1.13	Sat Feb  1 19:11:59 2020
+++ src/sys/dev/acpi/sdhc_acpi.c	Sat Feb  1 20:11:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc_acpi.c,v 1.13 2020/02/01 19:11:59 christos Exp $	*/
+/*	$NetBSD: sdhc_acpi.c,v 1.14 2020/02/01 20:11:24 tnn Exp $	*/
 
 /*
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.13 2020/02/01 19:11:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.14 2020/02/01 20:11:24 tnn Exp $");
 
 #include 
 #include 
@@ -91,7 +91,7 @@ static const struct sdhc_acpi_slot {
 	{ .hid = "INT344D",		 .type = SLOT_TYPE_SD },
 	{ .hid = "NXP0003",  .uid = "0", .type = SLOT_TYPE_SD,
 	 .flags = SDHC_ESDHC_FLAGS },
-	{ .hid = "NXP0003",  .uid = "1", .type SLOT_TYPE_EMMC,
+	{ .hid = "NXP0003",  .uid = "1", .type = SLOT_TYPE_EMMC,
 	 .flags = SDHC_ESDHC_FLAGS },
 
 	/* Generic IDs last */



CVS commit: src/sbin/fdisk

2019-04-09 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Apr  9 09:03:41 UTC 2019

Modified Files:
src/sbin/fdisk: fdisk.8

Log Message:
mention that -B is used to set the timeout for mbr_bootsel


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sbin/fdisk/fdisk.8

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

Modified files:

Index: src/sbin/fdisk/fdisk.8
diff -u src/sbin/fdisk/fdisk.8:1.87 src/sbin/fdisk/fdisk.8:1.88
--- src/sbin/fdisk/fdisk.8:1.87	Fri Jan 27 10:12:05 2017
+++ src/sbin/fdisk/fdisk.8	Tue Apr  9 09:03:41 2019
@@ -1,6 +1,6 @@
-.\"	$NetBSD: fdisk.8,v 1.87 2017/01/27 10:12:05 abhinav Exp $
+.\"	$NetBSD: fdisk.8,v 1.88 2019/04/09 09:03:41 tnn Exp $
 .\"
-.Dd September 11, 2016
+.Dd April 9, 2019
 .Dt FDISK 8
 .Os
 .Sh NAME
@@ -172,6 +172,7 @@ In interactive mode this question will b
 have been processed.
 .It Fl B
 On an i386 or amd64 system, interactively update the boot selector settings.
+These include the default boot partition and the timeout value for the prompt.
 (The boot selector permits the user to interactively select the boot
 partition, and thus which operating system is run, at system boot time; see
 .Xr mbr 8



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

2019-03-27 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Wed Mar 27 16:38:50 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sunxi_timer.c

Log Message:
ensure LOSC is configured for external clock


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sunxi_timer.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/sunxi/sunxi_timer.c
diff -u src/sys/arch/arm/sunxi/sunxi_timer.c:1.5 src/sys/arch/arm/sunxi/sunxi_timer.c:1.6
--- src/sys/arch/arm/sunxi/sunxi_timer.c:1.5	Wed Mar 27 06:56:19 2019
+++ src/sys/arch/arm/sunxi/sunxi_timer.c	Wed Mar 27 16:38:49 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_timer.c,v 1.5 2019/03/27 06:56:19 tnn Exp $ */
+/* $NetBSD: sunxi_timer.c,v 1.6 2019/03/27 16:38:49 tnn Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_timer.c,v 1.5 2019/03/27 06:56:19 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_timer.c,v 1.6 2019/03/27 16:38:49 tnn Exp $");
 
 #include 
 #include 
@@ -78,6 +78,19 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_timer.
 #define	TMR4_INTV_VALUE_REG	0x54
 #define	TMR4_CURNT_VALUE_REG	0x58
 
+/* Control registers */
+#define	AVS_CNT_CTL_REG		0x80
+#define	AVS_CNT0_REG		0x84
+#define	AVS_CNT1_REG		0x88
+#define	AVS_CNT_DIV_REG		0x8c
+#define	WDOG_CTRL_REG		0x90
+#define	WDOG_MODE_REG		0x94
+#define	LOSC_CTRL_REG		0x100
+#define	 LOSC_CTRL_KEY_FIELD	__BITS(31,16)
+#define	 LOSC_CTRL_KEY_FIELD_V	0x16aa
+#define  LOSC_CTRL_OSC32K_AUTO_SWT_EN	__BIT(14)
+#define	 LOSC_CTRL_OSC32K_SEL	__BIT(0)
+
 static const char * const compatible[] = {
 	"allwinner,sun4i-a10-timer",
 	NULL
@@ -179,6 +192,7 @@ sunxi_timer_attach(device_t parent, devi
 	bus_addr_t addr;
 	bus_size_t size;
 	u_int ticks;
+	u_int reg;
 
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
 		aprint_error(": couldn't get registers\n");
@@ -238,10 +252,16 @@ sunxi_timer_attach(device_t parent, devi
 	 * LOSC is optional to implement in hardware.
 	 * Make sure it ticks before registering it.
 	 */
+	reg = __SHIFTIN(LOSC_CTRL_KEY_FIELD_V, LOSC_CTRL_KEY_FIELD) |
+	LOSC_CTRL_OSC32K_AUTO_SWT_EN |
+	LOSC_CTRL_OSC32K_SEL;
+	TIMER_WRITE(sc, LOSC_CTRL_REG, reg);
 	ticks = sunxi_timer_get_timecount_losc(tc_losc);
 	delay(100);
 	if (ticks != sunxi_timer_get_timecount_losc(tc_losc))
 		tc_init(tc_losc);
+	else
+		TIMER_WRITE(sc, LOSC_CTRL_REG, reg & ~LOSC_CTRL_OSC32K_SEL);
 
 	/* Use this as the OS timer in UP configurations */
 	if (!arm_has_mpext_p) {



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

2019-03-27 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Wed Mar 27 06:56:19 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sunxi_timer.c

Log Message:
fix wrong counter_mask assignment due to typo in previous


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/sunxi/sunxi_timer.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/sunxi/sunxi_timer.c
diff -u src/sys/arch/arm/sunxi/sunxi_timer.c:1.4 src/sys/arch/arm/sunxi/sunxi_timer.c:1.5
--- src/sys/arch/arm/sunxi/sunxi_timer.c:1.4	Tue Mar 26 23:26:03 2019
+++ src/sys/arch/arm/sunxi/sunxi_timer.c	Wed Mar 27 06:56:19 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_timer.c,v 1.4 2019/03/26 23:26:03 tnn Exp $ */
+/* $NetBSD: sunxi_timer.c,v 1.5 2019/03/27 06:56:19 tnn Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_timer.c,v 1.4 2019/03/26 23:26:03 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_timer.c,v 1.5 2019/03/27 06:56:19 tnn Exp $");
 
 #include 
 #include 
@@ -229,7 +229,7 @@ sunxi_timer_attach(device_t parent, devi
 	tc->tc_priv = sc;
 	tc_init(tc);
 	tc_losc->tc_get_timecount = sunxi_timer_get_timecount_losc;
-	tc_losc->tc_counter_mask = ~0u,
+	tc_losc->tc_counter_mask = ~0u;
 	tc_losc->tc_frequency = 32768;
 	tc_losc->tc_name = "LOSC";
 	tc_losc->tc_quality = 150;



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

2019-03-26 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Mar 26 23:26:03 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sunxi_timer.c

Log Message:
Register a timecounter source for the 32.768kHz low-power oscillator,
if it is physically present. It is preferable for timekeeping in
offline scenarios because it generally has much better long-term
frequency stability than the platform XO.

XXX: should it have higher quality rating than the 24MOSC?
I made it lower quality for now to avoid surprises for users.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/sunxi_timer.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/sunxi/sunxi_timer.c
diff -u src/sys/arch/arm/sunxi/sunxi_timer.c:1.3 src/sys/arch/arm/sunxi/sunxi_timer.c:1.4
--- src/sys/arch/arm/sunxi/sunxi_timer.c:1.3	Sat Dec 16 20:04:38 2017
+++ src/sys/arch/arm/sunxi/sunxi_timer.c	Tue Mar 26 23:26:03 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_timer.c,v 1.3 2017/12/16 20:04:38 jmcneill Exp $ */
+/* $NetBSD: sunxi_timer.c,v 1.4 2019/03/26 23:26:03 tnn Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_timer.c,v 1.3 2017/12/16 20:04:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_timer.c,v 1.4 2019/03/26 23:26:03 tnn Exp $");
 
 #include 
 #include 
@@ -71,6 +71,13 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_timer.
 #define	TMR2_INTV_VALUE_REG	0x34
 #define	TMR2_CURNT_VALUE_REG	0x38
 
+/* Timer 4 registers */
+#define	TMR4_CTRL_REG		0x50
+#define	 TMR4_CTRL_RELOAD	__BIT(1)
+#define	 TMR4_CTRL_EN		__BIT(0)
+#define	TMR4_INTV_VALUE_REG	0x54
+#define	TMR4_CURNT_VALUE_REG	0x58
+
 static const char * const compatible[] = {
 	"allwinner,sun4i-a10-timer",
 	NULL
@@ -84,6 +91,7 @@ struct sunxi_timer_softc {
 	struct clk *sc_clk;
 
 	struct timecounter sc_tc;
+	struct timecounter sc_tc_losc;
 };
 
 #define TIMER_READ(sc, reg) \
@@ -144,6 +152,14 @@ sunxi_timer_get_timecount(struct timecou
 	return ~TIMER_READ(sc, TMR2_CURNT_VALUE_REG);
 }
 
+static u_int
+sunxi_timer_get_timecount_losc(struct timecounter *tc)
+{
+	struct sunxi_timer_softc * const sc = tc->tc_priv;
+
+	return ~TIMER_READ(sc, TMR4_CURNT_VALUE_REG);
+}
+
 static int
 sunxi_timer_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -158,9 +174,11 @@ sunxi_timer_attach(device_t parent, devi
 	struct sunxi_timer_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	struct timecounter *tc = >sc_tc;
+	struct timecounter *tc_losc = >sc_tc_losc;
 	const int phandle = faa->faa_phandle;
 	bus_addr_t addr;
 	bus_size_t size;
+	u_int ticks;
 
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
 		aprint_error(": couldn't get registers\n");
@@ -198,15 +216,32 @@ sunxi_timer_attach(device_t parent, devi
 	TIMER_WRITE(sc, TMR2_CTRL_REG,
 	__SHIFTIN(TMR2_CTRL_CLK_SRC_OSC24M, TMR2_CTRL_CLK_SRC) |
 	TMR2_CTRL_RELOAD | TMR2_CTRL_EN);
+	/* Enable Timer 4 (timecounter for LOSC) */
+	TIMER_WRITE(sc, TMR4_INTV_VALUE_REG, ~0u);
+	TIMER_WRITE(sc, TMR4_CTRL_REG, TMR4_CTRL_RELOAD | TMR4_CTRL_EN);
 
 	/* Timecounter setup */
 	tc->tc_get_timecount = sunxi_timer_get_timecount;
 	tc->tc_counter_mask = ~0u,
-	tc->tc_frequency = clk_get_rate(sc->sc_clk);
+	tc->tc_frequency = rate;
 	tc->tc_name = "Timer 2";
 	tc->tc_quality = 200;
 	tc->tc_priv = sc;
 	tc_init(tc);
+	tc_losc->tc_get_timecount = sunxi_timer_get_timecount_losc;
+	tc_losc->tc_counter_mask = ~0u,
+	tc_losc->tc_frequency = 32768;
+	tc_losc->tc_name = "LOSC";
+	tc_losc->tc_quality = 150;
+	tc_losc->tc_priv = sc;
+	/*
+	 * LOSC is optional to implement in hardware.
+	 * Make sure it ticks before registering it.
+	 */
+	ticks = sunxi_timer_get_timecount_losc(tc_losc);
+	delay(100);
+	if (ticks != sunxi_timer_get_timecount_losc(tc_losc))
+		tc_init(tc_losc);
 
 	/* Use this as the OS timer in UP configurations */
 	if (!arm_has_mpext_p) {



CVS commit: src/share/man/man4

2019-03-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Mar 17 06:17:30 UTC 2019

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

Log Message:
update SYNOPSIS; suggest 5x8 font instead of 8x8


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/ssdfb.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/ssdfb.4
diff -u src/share/man/man4/ssdfb.4:1.1 src/share/man/man4/ssdfb.4:1.2
--- src/share/man/man4/ssdfb.4:1.1	Sun Mar 17 00:35:09 2019
+++ src/share/man/man4/ssdfb.4	Sun Mar 17 06:17:30 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ssdfb.4,v 1.1 2019/03/17 00:35:09 tnn Exp $
+.\"	$NetBSD: ssdfb.4,v 1.2 2019/03/17 06:17:30 tnn Exp $
 .\"
 .\" Copyright (c) 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -34,7 +34,7 @@
 .Nm ssdfb
 .Nd OLED/PLED framebuffer device driver
 .Sh SYNOPSIS
-.Cd "options FONT_VT220L8x8"
+.Cd "options FONT_SPLEEN5x8"
 .Cd "ssdfb* at iic? addr ?"
 .Cd "ssdfb* at iic? addr 0x3c"
 .Cd "ssdfb* at iic? addr 0x3d flags 0x102"



CVS commit: src/sys/dev/wsfont

2019-03-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Mar 17 06:09:35 UTC 2019

Modified Files:
src/sys/dev/wsfont: files.wsfont wsfont.c
Added Files:
src/sys/dev/wsfont: spleen12x24.h spleen16x32.h spleen32x64.h
spleen5x8.h spleen8x16.h

Log Message:
import the Spleen wscons fonts from OpenBSD

Spleen is a 2-clause BSD licensed font set designed by Frederic Cambus.
The 5x8 font is designed for low resolution displays, but the font
comes in a variety of sizes suitable for larger display too.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/wsfont/files.wsfont
cvs rdiff -u -r0 -r1.1 src/sys/dev/wsfont/spleen12x24.h \
src/sys/dev/wsfont/spleen16x32.h src/sys/dev/wsfont/spleen32x64.h \
src/sys/dev/wsfont/spleen5x8.h src/sys/dev/wsfont/spleen8x16.h
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/wsfont/wsfont.c

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

diffs are larger than 1MB and have been omitted


CVS commit: src/sys/dev/ic

2019-03-16 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Mar 17 04:03:17 UTC 2019

Modified Files:
src/sys/dev/ic: ssdfb.c ssdfbvar.h

Log Message:
ensure the device's UVM pager object is present before using uvm_pageratop


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/ssdfb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/ssdfbvar.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/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.2 src/sys/dev/ic/ssdfb.c:1.3
--- src/sys/dev/ic/ssdfb.c:1.2	Sun Mar 17 01:33:02 2019
+++ src/sys/dev/ic/ssdfb.c	Sun Mar 17 04:03:17 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.2 2019/03/17 01:33:02 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.3 2019/03/17 04:03:17 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,13 +30,15 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.2 2019/03/17 01:33:02 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.3 2019/03/17 04:03:17 tnn Exp $");
 
 #include "opt_ddb.h"
 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -75,6 +77,7 @@ static int	ssdfb_set_display_on(struct s
 static int	ssdfb_set_mode(struct ssdfb_softc *, u_int);
 
 /* frame buffer damage tracking and synchronization */
+static void	ssdfb_udv_attach(struct ssdfb_softc *sc);
 static bool	ssdfb_is_modified(struct ssdfb_softc *sc);
 static bool	ssdfb_clear_modify(struct ssdfb_softc *sc);
 static void	ssdfb_damage(struct ssdfb_softc *);
@@ -189,7 +192,6 @@ static const struct wsdisplay_accessops 
 
 #define SSDFB_CMD1(c) do { cmd[0] = (c); error = sc->sc_cmd(sc->sc_cookie, cmd, 1, usepoll); } while(0)
 #define SSDFB_CMD2(c, a) do { cmd[0] = (c); cmd[1] = (a); error = sc->sc_cmd(sc->sc_cookie, cmd, 2, usepoll); } while(0)
-#define SSDFB_CMD3(c, a, b) do { cmd[0] = (c); cmd[1] = (a); cmd[2] = (b); error = sc->sc_cmd(sc->sc_cookie, cmd, 3, usepoll); } while(0)
 
 void
 ssdfb_attach(struct ssdfb_softc *sc, int flags)
@@ -349,6 +351,11 @@ ssdfb_detach(struct ssdfb_softc *sc)
 	mutex_exit(>sc_cond_mtx);
 	kthread_join(sc->sc_thread);
 
+	if (sc->sc_uobj != NULL) {
+		mutex_enter(sc->sc_uobj->vmobjlock);
+		sc->sc_uobj->uo_refs--;
+		mutex_exit(sc->sc_uobj->vmobjlock);
+	}
 	config_detach(sc->sc_wsdisplay, DETACH_FORCE);
 
 	cv_destroy(>sc_cond);
@@ -441,7 +448,7 @@ ssdfb_ioctl(void *v, void *vs, u_long cm
 	case WSDISPLAYIO_GETCMAP:
 		wc = (struct wsdisplay_cmap *)data;
 		if (wc->index >= __arraycount(cmap) ||
-		wc->count >= __arraycount(cmap) - wc->index)
+		wc->count >  __arraycount(cmap) - wc->index)
 			return EINVAL;
 		error = copyout([wc->index], wc->red, wc->count);
 		if (error)
@@ -576,7 +583,7 @@ static int
 ssdfb_init(struct ssdfb_softc *sc)
 {
 	int error;
-	uint8_t cmd[3];
+	uint8_t cmd[2];
 	bool usepoll = true;
 
 	/*
@@ -745,6 +752,18 @@ ssdfb_damage(struct ssdfb_softc *sc)
 	}
 }
 
+static void
+ssdfb_udv_attach(struct ssdfb_softc *sc)
+{
+	extern const struct cdevsw wsdisplay_cdevsw;
+	dev_t dev;
+#define WSDISPLAYMINOR(unit, screen)	(((unit) << 8) | (screen))
+	dev = makedev(cdevsw_lookup_major(_cdevsw),
+	WSDISPLAYMINOR(device_unit(sc->sc_wsdisplay), 0));
+	sc->sc_uobj = udv_attach(dev, VM_PROT_READ|VM_PROT_WRITE, 0,
+	sc->sc_ri_bits_len);
+}
+
 static bool
 ssdfb_is_modified(struct ssdfb_softc *sc)
 {
@@ -753,6 +772,9 @@ ssdfb_is_modified(struct ssdfb_softc *sc
 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)
 		return sc->sc_modified;
 
+	if (sc->sc_uobj == NULL)
+		return false;
+
 	va = (vaddr_t)sc->sc_ri.ri_bits;
 	va_end = va + sc->sc_ri_bits_len;
 	while (va < va_end) {
@@ -776,6 +798,9 @@ ssdfb_clear_modify(struct ssdfb_softc *s
 		return ret;
 	}
 
+	if (sc->sc_uobj == NULL)
+		return false;
+
 	va = (vaddr_t)sc->sc_ri.ri_bits;
 	va_end = va + sc->sc_ri_bits_len;
 	ret = false;
@@ -800,6 +825,12 @@ ssdfb_thread(void *arg)
 		ssdfb_set_usepoll(sc, false);
 
 	while(!sc->sc_detaching) {
+		if (sc->sc_mode == WSDISPLAYIO_MODE_DUMBFB &&
+		sc->sc_uobj == NULL) {
+			mutex_exit(>sc_cond_mtx);
+			ssdfb_udv_attach(sc);
+			mutex_enter(>sc_cond_mtx);
+		}
 		if (!ssdfb_is_modified(sc)) {
 			if (cv_timedwait(>sc_cond, >sc_cond_mtx,
 			sc->sc_mode == WSDISPLAYIO_MODE_EMUL

Index: src/sys/dev/ic/ssdfbvar.h
diff -u src/sys/dev/ic/ssdfbvar.h:1.1 src/sys/dev/ic/ssdfbvar.h:1.2
--- src/sys/dev/ic/ssdfbvar.h:1.1	Sun Mar 17 00:57:15 2019
+++ src/sys/dev/ic/ssdfbvar.h	Sun Mar 17 04:03:17 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfbvar.h,v 1.1 2019/03/17 00:57:15 tnn Exp $ */
+/* $NetBSD: ssdfbvar.h,v 1.2 2019/03/17 04:03:17 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -225,6 +225,7 @@ struct ssdfb_softc {
 	boolsc_detaching;
 	intsc_backoff;
 	boolsc_modified;
+	struct uvm_object		*sc_uobj;
 
 	/* reference to bus-specific code */
 	void	*sc_cookie;



CVS commit: src/sys/dev/i2c

2019-03-16 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Mar 17 01:47:57 UTC 2019

Modified Files:
src/sys/dev/i2c: ssdfb_i2c.c

Log Message:
delete unused variable


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/ssdfb_i2c.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/i2c/ssdfb_i2c.c
diff -u src/sys/dev/i2c/ssdfb_i2c.c:1.1 src/sys/dev/i2c/ssdfb_i2c.c:1.2
--- src/sys/dev/i2c/ssdfb_i2c.c:1.1	Sun Mar 17 01:03:47 2019
+++ src/sys/dev/i2c/ssdfb_i2c.c	Sun Mar 17 01:47:57 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_i2c.c,v 1.1 2019/03/17 01:03:47 tnn Exp $ */
+/* $NetBSD: ssdfb_i2c.c,v 1.2 2019/03/17 01:47:57 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.1 2019/03/17 01:03:47 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.2 2019/03/17 01:47:57 tnn Exp $");
 
 #include 
 #include 
@@ -43,7 +43,6 @@ struct ssdfb_i2c_softc {
 	struct		ssdfb_softc sc;
 	i2c_tag_t	sc_i2c_tag;
 	i2c_addr_t	sc_i2c_addr;
-	bool		sc_parent_is_smbus;
 };
 
 static int	ssdfb_i2c_match(device_t, cfdata_t, void *);
@@ -156,7 +155,7 @@ ssdfb_i2c_transfer_rect(void *cookie, ui
 	struct ssdfb_i2c_softc *sc = (struct ssdfb_i2c_softc *)cookie;
 	int flags = usepoll ? I2C_F_POLL : 0;
 	uint8_t cb = SSDFB_I2C_CTRL_BYTE_DATA_MASK;
-	uint8_t data [] = {0, 0, 0};
+	uint8_t data[] = {0, 0, 0};
 	uint8_t cmd[2];
 	int error;
 



CVS commit: src/sys/dev/ic

2019-03-16 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Mar 17 01:33:02 UTC 2019

Modified Files:
src/sys/dev/ic: ssdfb.c

Log Message:
formatting


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/ssdfb.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/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.1 src/sys/dev/ic/ssdfb.c:1.2
--- src/sys/dev/ic/ssdfb.c:1.1	Sun Mar 17 00:57:15 2019
+++ src/sys/dev/ic/ssdfb.c	Sun Mar 17 01:33:02 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.1 2019/03/17 00:57:15 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.2 2019/03/17 01:33:02 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.1 2019/03/17 00:57:15 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.2 2019/03/17 01:33:02 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -789,7 +789,8 @@ ssdfb_clear_modify(struct ssdfb_softc *s
 }
 
 static void
-ssdfb_thread(void *arg) {
+ssdfb_thread(void *arg)
+{
 	struct ssdfb_softc *sc = (struct ssdfb_softc *)arg;
 	int error;
 
@@ -824,12 +825,14 @@ ssdfb_thread(void *arg) {
 }
 
 static void
-ssdfb_set_usepoll(struct ssdfb_softc *sc, bool enable) {
+ssdfb_set_usepoll(struct ssdfb_softc *sc, bool enable)
+{
 	sc->sc_usepoll = enable;
 }
 
 static int
-ssdfb_sync(struct ssdfb_softc *sc, bool usepoll) {
+ssdfb_sync(struct ssdfb_softc *sc, bool usepoll)
+{
 	struct rasops_info *ri = >sc_ri;
 	int block_size = 8;
 	int ri_block_stride = ri->ri_stride * block_size;
@@ -933,7 +936,8 @@ ssdfb_transpose_block_8bpp(uint8_t *src,
 }
 
 static const struct ssdfb_product *
-ssdfb_lookup_product(ssdfb_product_id_t id) {
+ssdfb_lookup_product(ssdfb_product_id_t id)
+{
 	int i;
 
 	for (i = 0; i < __arraycount(ssdfb_products); i++) {
@@ -945,7 +949,8 @@ ssdfb_lookup_product(ssdfb_product_id_t 
 }
 
 static int
-ssdfb_pick_font(int *cookiep, struct wsdisplay_font **fontp) {
+ssdfb_pick_font(int *cookiep, struct wsdisplay_font **fontp)
+{
 	int error;
 	int c;
 	struct wsdisplay_font *f;



CVS commit: src/doc

2019-03-16 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Mar 17 01:14:25 UTC 2019

Modified Files:
src/doc: CHANGES

Log Message:
note addition of ssdfb(4)


To generate a diff of this commit:
cvs rdiff -u -r1.2510 -r1.2511 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.2510 src/doc/CHANGES:1.2511
--- src/doc/CHANGES:1.2510	Tue Mar 12 16:59:16 2019
+++ src/doc/CHANGES	Sun Mar 17 01:14:25 2019
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2510 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2511 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -346,3 +346,4 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	kcov(4): Added driver for kernel coverage tracing [kamil 20190310]
 	mdocml: Import 1.14.5. [christos 20190310]
 	OpenSSL: Imported 1.1.1b. [christos 20190312]
+	ssdfb(4): Added driver for SSD1306 & SH1106 displays [tnn 20190317]



CVS commit: src/sys/conf

2019-03-16 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Mar 17 01:06:42 UTC 2019

Modified Files:
src/sys/conf: files

Log Message:
config glue for ssdfb


To generate a diff of this commit:
cvs rdiff -u -r1.1230 -r1.1231 src/sys/conf/files

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1230 src/sys/conf/files:1.1231
--- src/sys/conf/files:1.1230	Sat Feb 23 03:10:06 2019
+++ src/sys/conf/files	Sun Mar 17 01:06:42 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1230 2019/02/23 03:10:06 kamil Exp $
+#	$NetBSD: files,v 1.1231 2019/03/17 01:06:42 tnn Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20171118
@@ -387,6 +387,10 @@ file	dev/ic/nslm7x.c			lm			needs-flag
 device	spdmem
 file	dev/ic/spdmem.c			spdmem
 
+# SSD1306 or SH1106 OLED/PLED display (attaches via I2C or SPI)
+device	ssdfb:	wsemuldisplaydev
+file	dev/ic/ssdfb.c	ssdfb
+
 # Generic HID support (used by USB, bluetooth and i2c)
 include "dev/hid/files.hid"
 



CVS commit: src/sys/dev/i2c

2019-03-16 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Mar 17 01:03:47 UTC 2019

Modified Files:
src/sys/dev/i2c: files.i2c
Added Files:
src/sys/dev/i2c: ssdfb_i2c.c

Log Message:
add i2c attachment for ssdfb


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r0 -r1.1 src/sys/dev/i2c/ssdfb_i2c.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/i2c/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.98 src/sys/dev/i2c/files.i2c:1.99
--- src/sys/dev/i2c/files.i2c:1.98	Sun Feb  3 13:17:12 2019
+++ src/sys/dev/i2c/files.i2c	Sun Mar 17 01:03:47 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.98 2019/02/03 13:17:12 jmcneill Exp $
+#	$NetBSD: files.i2c,v 1.99 2019/03/17 01:03:47 tnn Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -358,6 +358,10 @@ attach	rkpmic at iic
 attach	rkreg at rkpmic
 file	dev/i2c/rkpmic.c			rkpmic
 
+# SSD1306 or SH1106 OLED/PLED display
+attach	ssdfb at iic with ssdfb_iic
+file	dev/i2c/ssdfb_i2c.c			ssdfb_iic
+
 # Analogix ANX6345 eDP transmitter
 device	anxedp: edid, videomode, drmkms, drmkms_i2c
 attach	anxedp at iic

Added files:

Index: src/sys/dev/i2c/ssdfb_i2c.c
diff -u /dev/null src/sys/dev/i2c/ssdfb_i2c.c:1.1
--- /dev/null	Sun Mar 17 01:03:47 2019
+++ src/sys/dev/i2c/ssdfb_i2c.c	Sun Mar 17 01:03:47 2019
@@ -0,0 +1,368 @@
+/* $NetBSD: ssdfb_i2c.c,v 1.1 2019/03/17 01:03:47 tnn Exp $ */
+
+/*
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Tobias Nygren.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.1 2019/03/17 01:03:47 tnn Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct ssdfb_i2c_softc {
+	struct		ssdfb_softc sc;
+	i2c_tag_t	sc_i2c_tag;
+	i2c_addr_t	sc_i2c_addr;
+	bool		sc_parent_is_smbus;
+};
+
+static int	ssdfb_i2c_match(device_t, cfdata_t, void *);
+static void	ssdfb_i2c_attach(device_t, device_t, void *);
+static int	ssdfb_i2c_detach(device_t, int);
+
+static int	ssdfb_i2c_cmd(void *, uint8_t *, size_t, bool);
+static int	ssdfb_i2c_transfer_rect(void *, uint8_t, uint8_t, uint8_t,
+uint8_t, uint8_t *, size_t, bool);
+static int	ssdfb_i2c_transfer_rect_ssd1306(void *, uint8_t, uint8_t,
+uint8_t, uint8_t, uint8_t *, size_t, bool);
+static int	ssdfb_i2c_transfer_rect_sh1106(void *, uint8_t, uint8_t,
+uint8_t, uint8_t, uint8_t *, size_t, bool);
+static int	ssdfb_smbus_transfer_rect(void *, uint8_t, uint8_t, uint8_t,
+uint8_t, uint8_t *, size_t, bool);
+
+CFATTACH_DECL_NEW(ssdfb_iic, sizeof(struct ssdfb_i2c_softc),
+ssdfb_i2c_match, ssdfb_i2c_attach, ssdfb_i2c_detach, NULL);
+
+static const struct device_compatible_entry compat_data[] = {
+	{ "solomon,ssd1306fb-i2c",	0 },
+	{ "sino,sh1106fb-i2c",		0 },
+	{ NULL,0 }
+};
+
+static int
+ssdfb_i2c_match(device_t parent, cfdata_t match, void *aux)
+{
+	struct i2c_attach_args *ia = aux;
+	int match_result;
+
+	if (iic_use_direct_match(ia, match, compat_data, _result))
+		return match_result;
+
+	switch (ia->ia_addr) {
+	case SSDFB_I2C_DEFAULT_ADDR:
+	case SSDFB_I2C_ALTERNATIVE_ADDR:
+		return I2C_MATCH_ADDRESS_ONLY;
+	}
+
+	return 0;
+}
+
+static void
+ssdfb_i2c_attach(device_t parent, device_t self, void *aux)
+{
+	struct ssdfb_i2c_softc *sc = device_private(self);
+	struct cfdata *cf = device_cfdata(self);
+	struct i2c_attach_args *ia = aux;
+	int flags = cf->cf_flags;
+	int i;
+
+	if ((flags & SSDFB_ATTACH_FLA

CVS commit: src/sys/dev/ic

2019-03-16 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Mar 17 00:57:15 UTC 2019

Added Files:
src/sys/dev/ic: ssdfb.c ssdfbvar.h

Log Message:
add ssdfb

The ssdfb driver provides wsdisplay(4) support for OLED/PLED framebuffer
modules based on one of the following controller chips:

- Solomon Systech Ltd SSD1306
- Sino Wealth Electronic Ltd SH1106

It supports xf86-video-wsfb and can optionally attach as the console.

Some products that should work with this driver include:
- Adafruit 0.96" 128x64 OLED graphic display
- Adafruit 1.3" 128x64 OLED graphic display
- Adafruit 128x32 OLED graphic display
- Adafruit PiOLED 128x32 Monochome OLED for Raspberry Pi
- "GM009605" commonly distributed with Arduino starter kits
- display modules made by Chengdu Heltec Automation technology co. LTD

Note: I used the name ssdfb(4) because that's what OpenBSD calls their
driver but the implementation is entirely unique to NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/ic/ssdfb.c src/sys/dev/ic/ssdfbvar.h

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

Added files:

Index: src/sys/dev/ic/ssdfb.c
diff -u /dev/null src/sys/dev/ic/ssdfb.c:1.1
--- /dev/null	Sun Mar 17 00:57:15 2019
+++ src/sys/dev/ic/ssdfb.c	Sun Mar 17 00:57:15 2019
@@ -0,0 +1,1001 @@
+/* $NetBSD: ssdfb.c,v 1.1 2019/03/17 00:57:15 tnn Exp $ */
+
+/*
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Tobias Nygren.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.1 2019/03/17 00:57:15 tnn Exp $");
+
+#include "opt_ddb.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#if defined(DDB)
+#include 
+#include 
+#endif
+
+/* userland interface */
+static int	ssdfb_ioctl(void *, void *, u_long, void *, int, struct lwp *);
+static paddr_t	ssdfb_mmap(void *, void *, off_t, int);
+
+/* wscons screen management */
+static int	ssdfb_alloc_screen(void *, const struct wsscreen_descr *,
+   void **, int *, int *, long *);
+static void	ssdfb_free_screen(void *, void *);
+static int	ssdfb_show_screen(void *, void *, int,
+  void (*cb) (void *, int, int), void *);
+
+/* rasops hooks */
+static void	ssdfb_putchar(void *, int, int, u_int, long);
+static void	ssdfb_copycols(void *, int, int, int, int);
+static void	ssdfb_erasecols(void *, int, int, int, long);
+static void	ssdfb_copyrows(void *, int, int, int);
+static void	ssdfb_eraserows(void *, int, int, long);
+static void	ssdfb_cursor(void *, int, int, int);
+
+/* hardware interface */
+static int	ssdfb_init(struct ssdfb_softc *);
+static int	ssdfb_set_contrast(struct ssdfb_softc *, uint8_t, bool);
+static int	ssdfb_set_display_on(struct ssdfb_softc *, bool, bool);
+static int	ssdfb_set_mode(struct ssdfb_softc *, u_int);
+
+/* frame buffer damage tracking and synchronization */
+static bool	ssdfb_is_modified(struct ssdfb_softc *sc);
+static bool	ssdfb_clear_modify(struct ssdfb_softc *sc);
+static void	ssdfb_damage(struct ssdfb_softc *);
+static void	ssdfb_thread(void *);
+static void	ssdfb_set_usepoll(struct ssdfb_softc *, bool);
+static int	ssdfb_sync(struct ssdfb_softc *, bool);
+static uint64_t	ssdfb_transpose_block_1bpp(uint8_t *, size_t);
+static uint64_t	ssdfb_transpose_block_8bpp(uint8_t *, size_t);
+
+/* misc helpers */
+static const struct ssdfb_product *
+		ssdfb_lookup_product(ssdfb_product_id_t);
+static int	ssdfb_pick_font(int *, struct wsdisplay_font **);
+static vo

CVS commit: src

2019-03-16 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Mar 17 00:35:10 UTC 2019

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4: Makefile
Added Files:
src/share/man/man4: ssdfb.4

Log Message:
add ssdfb(4) manual page


To generate a diff of this commit:
cvs rdiff -u -r1.1639 -r1.1640 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.678 -r1.679 src/share/man/man4/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/ssdfb.4

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

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1639 src/distrib/sets/lists/man/mi:1.1640
--- src/distrib/sets/lists/man/mi:1.1639	Tue Feb 26 07:31:49 2019
+++ src/distrib/sets/lists/man/mi	Sun Mar 17 00:35:09 2019
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1639 2019/02/26 07:31:49 rin Exp $
+# $NetBSD: mi,v 1.1640 2019/03/17 00:35:09 tnn Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1758,6 +1758,7 @@
 ./usr/share/man/cat4/spp.0			man-obsolete		obsolete
 ./usr/share/man/cat4/sqphy.0			man-sys-catman		.cat
 ./usr/share/man/cat4/ss.0			man-sys-catman		.cat
+./usr/share/man/cat4/ssdfb.0			man-sys-catman		.cat
 ./usr/share/man/cat4/st.0			man-sys-catman		.cat
 ./usr/share/man/cat4/stderr.0			man-sys-catman		.cat
 ./usr/share/man/cat4/stdin.0			man-sys-catman		.cat
@@ -4846,6 +4847,7 @@
 ./usr/share/man/html4/spkr.html			man-sys-htmlman		html
 ./usr/share/man/html4/sqphy.html		man-sys-htmlman		html
 ./usr/share/man/html4/ss.html			man-sys-htmlman		html
+./usr/share/man/html4/ssdfb.html		man-sys-htmlman		html
 ./usr/share/man/html4/st.html			man-sys-htmlman		html
 ./usr/share/man/html4/stderr.html		man-sys-htmlman		html
 ./usr/share/man/html4/stdin.html		man-sys-htmlman		html
@@ -7848,6 +7850,7 @@
 ./usr/share/man/man4/spp.4			man-obsolete		obsolete
 ./usr/share/man/man4/sqphy.4			man-sys-man		.man
 ./usr/share/man/man4/ss.4			man-sys-man		.man
+./usr/share/man/man4/ssdfb.4			man-sys-man		.man
 ./usr/share/man/man4/st.4			man-sys-man		.man
 ./usr/share/man/man4/stderr.4			man-sys-man		.man
 ./usr/share/man/man4/stdin.4			man-sys-man		.man

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.678 src/share/man/man4/Makefile:1.679
--- src/share/man/man4/Makefile:1.678	Sat Feb 23 03:10:06 2019
+++ src/share/man/man4/Makefile	Sun Mar 17 00:35:09 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.678 2019/02/23 03:10:06 kamil Exp $
+#	$NetBSD: Makefile,v 1.679 2019/03/17 00:35:09 tnn Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -58,7 +58,7 @@ MAN=	aac.4 ac97.4 acardide.4 aceride.4 a
 	scsi.4 sctp.4 sd.4 se.4 seeprom.4 sem.4 \
 	ses.4 sf.4 sfb.4 sgsmix.4 shb.4 shmif.4 shpcic.4 si70xxtemp.4 \
 	siisata.4 siop.4 sip.4 siside.4 sk.4 sl.4 slide.4 \
-	sm.4 smsh.4 sn.4 sony.4 spc.4 speaker.4 spif.4 sqphy.4 ss.4 \
+	sm.4 smsh.4 sn.4 sony.4 spc.4 speaker.4 spif.4 sqphy.4 ss.4 ssdfb.4 \
 	st.4 ste.4 stge.4 sti.4 stpcide.4 sv.4 strip.4 \
 	svwsata.4 swsensor.4 swwdog.4 sysmon.4 \
 	tap.4 tc.4 tcds.4 tcp.4 tcu.4 tdvfb.4 tea5767radio.4 termios.4 tfb.4 \

Added files:

Index: src/share/man/man4/ssdfb.4
diff -u /dev/null src/share/man/man4/ssdfb.4:1.1
--- /dev/null	Sun Mar 17 00:35:10 2019
+++ src/share/man/man4/ssdfb.4	Sun Mar 17 00:35:09 2019
@@ -0,0 +1,115 @@
+.\"	$NetBSD: ssdfb.4,v 1.1 2019/03/17 00:35:09 tnn Exp $
+.\"
+.\" Copyright (c) 2019 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Tobias Nygren.
+.\"
+.\" 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONT

CVS commit: src/sys/dev/wscons

2019-03-16 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Mar 17 00:30:55 UTC 2019

Modified Files:
src/sys/dev/wscons: wsconsio.h

Log Message:
allocate wsdisplay type 66 for ssdfb(4)


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/dev/wscons/wsconsio.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/wscons/wsconsio.h
diff -u src/sys/dev/wscons/wsconsio.h:1.121 src/sys/dev/wscons/wsconsio.h:1.122
--- src/sys/dev/wscons/wsconsio.h:1.121	Thu Aug 31 19:55:43 2017
+++ src/sys/dev/wscons/wsconsio.h	Sun Mar 17 00:30:55 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: wsconsio.h,v 1.121 2017/08/31 19:55:43 jmcneill Exp $ */
+/* $NetBSD: wsconsio.h,v 1.122 2019/03/17 00:30:55 tnn Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -341,6 +341,7 @@ struct wsmouse_repeat {
 #define	WSDISPLAY_TYPE_TEGRA	63	/* NVIDIA Tegra ARM SoC */
 #define	WSDISPLAY_TYPE_PLATINUM	64	/* onboard fb in PowerMac 7200 */
 #define	WSDISPLAY_TYPE_PLFB	65	/* ARM PrimeCell PL11x */
+#define	WSDISPLAY_TYPE_SSDFB	66	/* ssdfb(4) */
 
 /* Basic display information.  Not applicable to all display types. */
 struct wsdisplay_fbinfo {



CVS commit: src/external/cddl/osnet/lib/libdtrace

2019-02-11 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Feb 11 17:49:37 UTC 2019

Modified Files:
src/external/cddl/osnet/lib/libdtrace: Makefile

Log Message:
-Wno-format-truncation is only needed when using GCC


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/external/cddl/osnet/lib/libdtrace/Makefile

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

Modified files:

Index: src/external/cddl/osnet/lib/libdtrace/Makefile
diff -u src/external/cddl/osnet/lib/libdtrace/Makefile:1.20 src/external/cddl/osnet/lib/libdtrace/Makefile:1.21
--- src/external/cddl/osnet/lib/libdtrace/Makefile:1.20	Wed Feb  6 04:23:16 2019
+++ src/external/cddl/osnet/lib/libdtrace/Makefile	Mon Feb 11 17:49:37 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.20 2019/02/06 04:23:16 christos Exp $
+#	$NetBSD: Makefile,v 1.21 2019/02/11 17:49:37 tnn Exp $
 
 # $FreeBSD: head/cddl/lib/libdtrace/Makefile 314654 2017-03-04 11:30:04Z ngie $
 
@@ -105,7 +105,7 @@ CPPFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/
 CPPFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/arm
 .PATH:		${.CURDIR}/../../dist/lib/libdtrace/arm
 .endif
-COPTS.dt_link.c	+= -Wno-format-truncation
+COPTS.dt_link.c	+= ${${ACTIVE_CC} == "gcc" :? -Wno-format-truncation :}
 
 LFLAGS+=-l
 



CVS commit: src/sys/dev/pci

2019-02-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Feb  3 12:39:38 UTC 2019

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

Log Message:
machfb: guard against absent mode information from firmware


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 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.95 src/sys/dev/pci/machfb.c:1.96
--- src/sys/dev/pci/machfb.c:1.95	Mon Sep  3 16:29:32 2018
+++ src/sys/dev/pci/machfb.c	Sun Feb  3 12:39:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machfb.c,v 1.95 2018/09/03 16:29:32 riastradh Exp $	*/
+/*	$NetBSD: machfb.c,v 1.96 2019/02/03 12:39:38 tnn Exp $	*/
 
 /*
  * Copyright (c) 2002 Bang Jun-Young
@@ -34,7 +34,7 @@
 
 #include 
 __KERNEL_RCSID(0,
-	"$NetBSD: machfb.c,v 1.95 2018/09/03 16:29:32 riastradh Exp $");
+	"$NetBSD: machfb.c,v 1.96 2019/02/03 12:39:38 tnn Exp $");
 
 #include 
 #include 
@@ -645,7 +645,7 @@ mach64_attach(device_t parent, device_t 
 			}
 		}
 		/* got nothing? try to pick one based on firmware parameters */
-		if (setmode == 0) {
+		if (setmode == 0 && width > 0 && height > 0) {
 			/* no EDID data? */
 			mode = pick_mode_by_ref(width, height, 60);
 			memcpy(_mode, mode, sizeof(struct videomode));



CVS commit: xsrc/external/mit/libdrm/dist

2019-01-19 Thread Tobias Nygren
Module Name:xsrc
Committed By:   tnn
Date:   Sat Jan 19 11:50:05 UTC 2019

Modified Files:
xsrc/external/mit/libdrm/dist/intel: intel_bufmgr_gem.c
xsrc/external/mit/libdrm/dist/radeon: radeon_bo_gem.c

Log Message:
reduce diff to upstream


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
xsrc/external/mit/libdrm/dist/intel/intel_bufmgr_gem.c
cvs rdiff -u -r1.8 -r1.9 xsrc/external/mit/libdrm/dist/radeon/radeon_bo_gem.c

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

Modified files:

Index: xsrc/external/mit/libdrm/dist/intel/intel_bufmgr_gem.c
diff -u xsrc/external/mit/libdrm/dist/intel/intel_bufmgr_gem.c:1.16 xsrc/external/mit/libdrm/dist/intel/intel_bufmgr_gem.c:1.17
--- xsrc/external/mit/libdrm/dist/intel/intel_bufmgr_gem.c:1.16	Thu Jan 10 08:59:43 2019
+++ xsrc/external/mit/libdrm/dist/intel/intel_bufmgr_gem.c	Sat Jan 19 11:50:05 2019
@@ -1539,10 +1539,12 @@ map_gtt(drm_intel_bo *bo)
 		}
 
 		/* and mmap it */
-		ret = drmMap(bufmgr_gem->fd, mmap_arg.offset, bo->size,
-		_gem->gtt_virtual);
-		if (ret) {
+		 bo_gem->gtt_virtual = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE,
+		MAP_SHARED, bufmgr_gem->fd,
+		mmap_arg.offset);
+		if (bo_gem->gtt_virtual == MAP_FAILED) {
 			bo_gem->gtt_virtual = NULL;
+			ret = -errno;
 			DBG("%s:%d: Error mapping buffer %d (%s): %s .\n",
 			__FILE__, __LINE__,
 			bo_gem->gem_handle, bo_gem->name,

Index: xsrc/external/mit/libdrm/dist/radeon/radeon_bo_gem.c
diff -u xsrc/external/mit/libdrm/dist/radeon/radeon_bo_gem.c:1.8 xsrc/external/mit/libdrm/dist/radeon/radeon_bo_gem.c:1.9
--- xsrc/external/mit/libdrm/dist/radeon/radeon_bo_gem.c:1.8	Thu Jan 10 08:59:43 2019
+++ xsrc/external/mit/libdrm/dist/radeon/radeon_bo_gem.c	Sat Jan 19 11:50:05 2019
@@ -175,8 +175,8 @@ static int bo_map(struct radeon_bo_int *
 boi, boi->handle, r);
 return r;
 }
-r = drmMap(boi->bom->fd, args.addr_ptr, args.size, );
-if (r)
+ptr = drm_mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED, boi->bom->fd, args.addr_ptr);
+if (ptr == MAP_FAILED)
 return -errno;
 bo_gem->priv_ptr = ptr;
 wait:



CVS commit: src/sys/kern

2019-01-12 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Jan 13 00:11:29 UTC 2019

Modified Files:
src/sys/kern: kern_crashme.c

Log Message:
clang does not like to deref a null pointer unless it is qualified volatile


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/kern/kern_crashme.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/kern/kern_crashme.c
diff -u src/sys/kern/kern_crashme.c:1.1 src/sys/kern/kern_crashme.c:1.2
--- src/sys/kern/kern_crashme.c:1.1	Wed Jan  9 04:01:20 2019
+++ src/sys/kern/kern_crashme.c	Sun Jan 13 00:11:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_crashme.c,v 1.1 2019/01/09 04:01:20 mrg Exp $	*/
+/*	$NetBSD: kern_crashme.c,v 1.2 2019/01/13 00:11:29 tnn Exp $	*/
 
 /*
  * Copyright (c) 2018, 2019 Matthew R. Green
@@ -231,6 +231,6 @@ static int
 crashme_null_deref(int flags)
 {
 
-	*(char *)0 = 0;
+	*(volatile char *)0 = 0;
 	return -1;
 }



CVS commit: src/sys/external/bsd/drm2/linux

2019-01-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jan  5 22:24:24 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/linux: linux_fence.c

Log Message:
fence_referenced_p(): mark as __diagused


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm2/linux/linux_fence.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/external/bsd/drm2/linux/linux_fence.c
diff -u src/sys/external/bsd/drm2/linux/linux_fence.c:1.13 src/sys/external/bsd/drm2/linux/linux_fence.c:1.14
--- src/sys/external/bsd/drm2/linux/linux_fence.c:1.13	Sat Sep  1 22:28:04 2018
+++ src/sys/external/bsd/drm2/linux/linux_fence.c	Sat Jan  5 22:24:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_fence.c,v 1.13 2018/09/01 22:28:04 riastradh Exp $	*/
+/*	$NetBSD: linux_fence.c,v 1.14 2019/01/05 22:24:24 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_fence.c,v 1.13 2018/09/01 22:28:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_fence.c,v 1.14 2019/01/05 22:24:24 tnn Exp $");
 
 #include 
 #include 
@@ -58,7 +58,7 @@ int	linux_fence_trace = 0;
  *	True if fence has a positive reference count.  True after
  *	fence_init; after the last fence_put, this becomes false.
  */
-static inline bool
+static inline bool __diagused
 fence_referenced_p(struct fence *fence)
 {
 



CVS commit: src/sys/external/bsd/drm2/linux

2019-01-04 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Jan  4 23:03:02 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/linux: linux_dma_buf.c

Log Message:
dma_buf_fd(): fd_putfile() does not belong here

PR kern/53834 ok riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/linux/linux_dma_buf.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/external/bsd/drm2/linux/linux_dma_buf.c
diff -u src/sys/external/bsd/drm2/linux/linux_dma_buf.c:1.4 src/sys/external/bsd/drm2/linux/linux_dma_buf.c:1.5
--- src/sys/external/bsd/drm2/linux/linux_dma_buf.c:1.4	Mon Aug 27 15:25:13 2018
+++ src/sys/external/bsd/drm2/linux/linux_dma_buf.c	Fri Jan  4 23:03:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_dma_buf.c,v 1.4 2018/08/27 15:25:13 riastradh Exp $	*/
+/*	$NetBSD: linux_dma_buf.c,v 1.5 2019/01/04 23:03:02 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_dma_buf.c,v 1.4 2018/08/27 15:25:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_dma_buf.c,v 1.5 2019/01/04 23:03:02 tnn Exp $");
 
 #include 
 #include 
@@ -119,7 +119,6 @@ dma_buf_fd(struct dma_buf *dmabuf, int f
 	fd_set_exclose(curlwp, fd, (flags & O_CLOEXEC) != 0);
 	fd_affix(curproc, file, fd);
 
-	fd_putfile(fd);
 	ret = fd;
 out0:	return ret;
 }



CVS commit: src/sys/external/bsd/drm2/include/linux

2019-01-04 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Jan  4 20:22:32 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/include/linux: interval_tree.h

Log Message:
interval_tree_iter_next: check the node we return, not the prev one.
Also assert that the interval is intersecting the requested boundary.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/include/linux/interval_tree.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/external/bsd/drm2/include/linux/interval_tree.h
diff -u src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.7 src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.8
--- src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.7	Tue Aug 28 03:34:53 2018
+++ src/sys/external/bsd/drm2/include/linux/interval_tree.h	Fri Jan  4 20:22:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: interval_tree.h,v 1.7 2018/08/28 03:34:53 riastradh Exp $	*/
+/*	$NetBSD: interval_tree.h,v 1.8 2019/01/04 20:22:32 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -119,9 +119,9 @@ interval_tree_iter_first(struct rb_root 
 	node = rb_tree_find_node_geq(>rbr_tree, );
 	if (node == NULL)
 		return NULL;
-	KASSERT(node->start <= start);
 	if (last < node->start)
 		return NULL;
+	KASSERT(node->start <= last && node->last >= start);
 
 	return node;
 }
@@ -141,9 +141,9 @@ interval_tree_iter_next(struct rb_root *
 	next = rb_tree_iterate(>rbr_tree, node, RB_DIR_RIGHT);
 	if (next == NULL)
 		return NULL;
-	KASSERT(node->start <= start);
-	if (last < node->start)
+	if (last < next->start)
 		return NULL;
+	KASSERT(next->start <= last && next->last >= start);
 
 	return next;
 }



CVS commit: src/sys/dev/usb

2018-12-14 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Dec 14 13:56:59 UTC 2018

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
add D-Link LTE products


To generate a diff of this commit:
cvs rdiff -u -r1.763 -r1.764 src/sys/dev/usb/usbdevs

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/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.763 src/sys/dev/usb/usbdevs:1.764
--- src/sys/dev/usb/usbdevs:1.763	Thu Dec 13 16:20:20 2018
+++ src/sys/dev/usb/usbdevs	Fri Dec 14 13:56:59 2018
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.763 2018/12/13 16:20:20 fox Exp $
+$NetBSD: usbdevs,v 1.764 2018/12/14 13:56:59 tnn Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1417,6 +1417,12 @@ product DLINK DSB650TX_PNA	0x4003	1/10/1
 product DLINK DSB650TX3		0x400b	10/100 ethernet adapter
 product DLINK DSB650TX2		0x4102	10/100 ethernet adapter
 product DLINK DSB650		0xabc1	10/100 ethernet adapter
+product DLINK DWM157_CD		0xa707	DWM-157 CD-ROM Mode
+product DLINK DWM157		0x7d02  DWM-157 LTE
+product DLINK DWM222_CD		0xab00	DWM-222 CD-ROM Mode
+product DLINK DWM222		0x7e35  DWM-222 LTE
+product DLINK DWR510_CD		0xa805	DWR-510 CD-ROM Mode
+product DLINK DWR510		0x7e12  DWR-510 LTE
 
 /* D-Link(2) products */
 product DLINK2 RTL8192SU_1	0x3300	RTL8192SU



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

2018-09-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Sep  1 20:54:32 UTC 2018

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

Log Message:
fix non-DIAGNOSTIC build


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 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.32 src/sys/arch/arm/cortex/gtmr.c:1.33
--- src/sys/arch/arm/cortex/gtmr.c:1.32	Sat Jun 30 17:30:37 2018
+++ src/sys/arch/arm/cortex/gtmr.c	Sat Sep  1 20:54:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmr.c,v 1.32 2018/06/30 17:30:37 jmcneill Exp $	*/
+/*	$NetBSD: gtmr.c,v 1.33 2018/09/01 20:54:32 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.32 2018/06/30 17:30:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.33 2018/09/01 20:54:32 tnn Exp $");
 
 #include 
 #include 
@@ -87,7 +87,9 @@ reg ## _stable_read(struct gtmr_softc *s
 	return val; \
 }
 
+#ifdef DIAGNOSTIC
 stable_read(gtmr_cntv_cval);
+#endif
 stable_read(gtmr_cntvct);
 
 static int gtmr_match(device_t, cfdata_t, void *);
@@ -172,8 +174,10 @@ gtmr_attach(device_t parent, device_t se
 
 	evcnt_attach_dynamic(_cntv_tval_write_ev, EVCNT_TYPE_MISC, NULL,
 	device_xname(self), "CNTV_TVAL write retry max");
+#ifdef DIAGNOSTIC
 	evcnt_attach_dynamic(_cntv_cval_read_ev, EVCNT_TYPE_MISC, NULL,
 	device_xname(self), "CNTV_CVAL read retry max");
+#endif
 	evcnt_attach_dynamic(_cntvct_read_ev, EVCNT_TYPE_MISC, NULL,
 	device_xname(self), "CNTVCT read retry max");
 



CVS commit: src/sys/external/bsd/drm2/drm

2018-08-30 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug 30 19:03:14 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/drm: drm_agp_hook.c

Log Message:
initialize error variable


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/drm/drm_agp_hook.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/external/bsd/drm2/drm/drm_agp_hook.c
diff -u src/sys/external/bsd/drm2/drm/drm_agp_hook.c:1.1 src/sys/external/bsd/drm2/drm/drm_agp_hook.c:1.2
--- src/sys/external/bsd/drm2/drm/drm_agp_hook.c:1.1	Tue Aug 28 03:41:39 2018
+++ src/sys/external/bsd/drm2/drm/drm_agp_hook.c	Thu Aug 30 19:03:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_agp_hook.c,v 1.1 2018/08/28 03:41:39 riastradh Exp $	*/
+/*	$NetBSD: drm_agp_hook.c,v 1.2 2018/08/30 19:03:14 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_agp_hook.c,v 1.1 2018/08/28 03:41:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_agp_hook.c,v 1.2 2018/08/30 19:03:14 tnn Exp $");
 
 #include 
 #include 
@@ -89,7 +89,7 @@ drm_agp_register(const struct drm_agp_ho
 int
 drm_agp_deregister(const struct drm_agp_hooks *hooks)
 {
-	int error;
+	int error = 0;
 
 	mutex_enter(_hooks.lock);
 	KASSERT(agp_hooks.hooks == hooks);



CVS commit: src/crypto/external/bsd/openssh/dist

2018-08-27 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug 27 17:47:48 UTC 2018

Modified Files:
src/crypto/external/bsd/openssh/dist: auth-pam.c

Log Message:
annotate pthread_exit as __dead (to appease clang)


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/crypto/external/bsd/openssh/dist/auth-pam.c

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

Modified files:

Index: src/crypto/external/bsd/openssh/dist/auth-pam.c
diff -u src/crypto/external/bsd/openssh/dist/auth-pam.c:1.16 src/crypto/external/bsd/openssh/dist/auth-pam.c:1.17
--- src/crypto/external/bsd/openssh/dist/auth-pam.c:1.16	Sun Aug 26 07:46:36 2018
+++ src/crypto/external/bsd/openssh/dist/auth-pam.c	Mon Aug 27 17:47:48 2018
@@ -51,7 +51,7 @@
 /*
  * NetBSD local changes
  */
-__RCSID("$NetBSD: auth-pam.c,v 1.16 2018/08/26 07:46:36 christos Exp $");
+__RCSID("$NetBSD: auth-pam.c,v 1.17 2018/08/27 17:47:48 tnn Exp $");
 #define _LIB_PTHREAD_H
 #undef USE_POSIX_THREADS /* Not yet */
 #define HAVE_SECURITY_PAM_APPL_H
@@ -194,7 +194,7 @@ sshpam_sigchld_handler(int sig)
 }
 
 /* ARGSUSED */
-static void
+__dead static void
 pthread_exit(void *value)
 {
 	_exit(0);



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

2017-08-20 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Aug 20 14:52:36 UTC 2017

Modified Files:
src/sys/arch/evbarm/awin: awin_machdep.c

Log Message:
BPI has no programmable current limiters for the USB host, just a PCB fuse


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/evbarm/awin/awin_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/evbarm/awin/awin_machdep.c
diff -u src/sys/arch/evbarm/awin/awin_machdep.c:1.49 src/sys/arch/evbarm/awin/awin_machdep.c:1.50
--- src/sys/arch/evbarm/awin/awin_machdep.c:1.49	Thu Oct 20 09:53:07 2016
+++ src/sys/arch/evbarm/awin/awin_machdep.c	Sun Aug 20 14:52:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_machdep.c,v 1.49 2016/10/20 09:53:07 skrll Exp $ */
+/*	$NetBSD: awin_machdep.c,v 1.50 2017/08/20 14:52:36 tnn Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_machdep.c,v 1.49 2016/10/20 09:53:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_machdep.c,v 1.50 2017/08/20 14:52:36 tnn Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -722,12 +722,14 @@ awin_device_register(device_t self, void
 		} else {
 			prop_dictionary_set_cstring(dict, "usb0drv", ">PB2");
 		}
+#if AWIN_board != AWIN_bpi
+		prop_dictionary_set_cstring(dict, "usb1drv", ">PH6");
 		prop_dictionary_set_cstring(dict, "usb2drv", ">PH3");
+#endif
 		prop_dictionary_set_cstring(dict, "usb0iddet",
 		(cubietruck_p ? "PH6");
 #endif
 #if AWIN_board == AWIN_cubietruck
 		prop_dictionary_set_cstring(dict, "usb0restrict", ">PH0");



CVS commit: src/sys/dev/i2c

2017-05-14 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun May 14 11:39:17 UTC 2017

Modified Files:
src/sys/dev/i2c: axp20x.c

Log Message:
define control register and associated bits for RTC supercap charger


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/i2c/axp20x.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/i2c/axp20x.c
diff -u src/sys/dev/i2c/axp20x.c:1.4 src/sys/dev/i2c/axp20x.c:1.5
--- src/sys/dev/i2c/axp20x.c:1.4	Thu Oct 15 13:48:57 2015
+++ src/sys/dev/i2c/axp20x.c	Sun May 14 11:39:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: axp20x.c,v 1.4 2015/10/15 13:48:57 bouyer Exp $ */
+/* $NetBSD: axp20x.c,v 1.5 2017/05/14 11:39:17 tnn Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: axp20x.c,v 1.4 2015/10/15 13:48:57 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axp20x.c,v 1.5 2017/05/14 11:39:17 tnn Exp $");
 
 #include 
 #include 
@@ -99,6 +99,33 @@ static int ldo4_mvV[] = {
 #define AXP_LDO3_VOLT_MASK		__BITS(0,6)
 #define AXP_LDO3_VOLT_SHIFT		0
 
+#define AXP_BKUP_CTRL			0x35
+#define AXP_BKUP_CTRL_ENABLE		__BIT(7)
+#define AXP_BKUP_CTRL_VOLT_MASK		__BITS(5,6)
+#define AXP_BKUP_CTRL_VOLT_SHIFT	5
+#define AXP_BKUP_CTRL_VOLT_3V1		0
+#define AXP_BKUP_CTRL_VOLT_3V0		1
+#define AXP_BKUP_CTRL_VOLT_3V6		2
+#define AXP_BKUP_CTRL_VOLT_2V5		3
+static int bkup_volt[] = {
+	3100,
+	3000,
+	3600,
+	2500
+};
+#define AXP_BKUP_CTRL_CURR_MASK		__BITS(0,1)
+#define AXP_BKUP_CTRL_CURR_SHIFT	0
+#define AXP_BKUP_CTRL_CURR_50U		0
+#define AXP_BKUP_CTRL_CURR_100U		1
+#define AXP_BKUP_CTRL_CURR_200U		2
+#define AXP_BKUP_CTRL_CURR_400U		3
+static int bkup_curr[] = {
+	50,
+	100,
+	200,
+	400
+};
+
 #define AXP_ACV_MON_REG		0x56	/* 2 bytes */
 #define AXP_ACI_MON_REG		0x58	/* 2 bytes */
 #define AXP_VBUSV_MON_REG	0x5a	/* 2 bytes */
@@ -347,6 +374,18 @@ axp20x_attach(device_t parent, device_t 
 			(int)(700 + (value & AXP_LDO3_VOLT_MASK) * 25));
 		}
 	}
+
+	if (axp20x_read(sc, AXP_BKUP_CTRL, , 1, I2C_F_POLL) == 0) {
+		if (value & AXP_BKUP_CTRL_ENABLE) {
+			aprint_verbose_dev(sc->sc_dev,
+			"RTC supercap charger enabled: %dmV at %duA\n",
+			bkup_volt[(value & AXP_BKUP_CTRL_VOLT_MASK) >>
+			AXP_BKUP_CTRL_VOLT_SHIFT],
+			bkup_curr[(value & AXP_BKUP_CTRL_CURR_MASK) >>
+			AXP_BKUP_CTRL_CURR_SHIFT]
+			);
+		}
+	}
 }
 
 static void



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

2017-02-10 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Feb 10 23:11:30 UTC 2017

Modified Files:
src/sys/arch/arm/xscale: ixp425-fw.README

Log Message:
remove misleading comment about version 3.0 microcode

The last known microcode to work is 2.4. Version 3.0 changes
the header signature and fails with "block too big for NPE memory".
Provide a backup download URL since intel removed version < 3.0.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/xscale/ixp425-fw.README

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/xscale/ixp425-fw.README
diff -u src/sys/arch/arm/xscale/ixp425-fw.README:1.3 src/sys/arch/arm/xscale/ixp425-fw.README:1.4
--- src/sys/arch/arm/xscale/ixp425-fw.README:1.3	Fri Feb 10 20:30:39 2017
+++ src/sys/arch/arm/xscale/ixp425-fw.README	Fri Feb 10 23:11:30 2017
@@ -1,4 +1,4 @@
-$NetBSD: ixp425-fw.README,v 1.3 2017/02/10 20:30:39 tnn Exp $
+$NetBSD: ixp425-fw.README,v 1.4 2017/02/10 23:11:30 tnn Exp $
 
 IXP425 NPE Microcode
 
@@ -21,17 +21,19 @@ You must grab the NPE microcode from her
 
  https://downloadcenter.intel.com/download/13757/IXP400-Software-NPE-Microcode-v3-0-without-crypto
 
+SHA1 (IPL_ixp400NpeLibrary-3_0.zip) = dda6b27265e6db3dfec68361644197c0f311a07b
+
+or the older version which is archived here:
+ https://downloads.openwrt.org/sources/IPL_ixp400NpeLibrary-2_4.zip
+
+SHA1 (IPL_ixp400NpeLibrary-2_4.zip) = abf1562e750e16e6f9baf9892a59640f863a693e
+
 Select the "Download (without Crypto)" link in the "NPE Microcode"
 section. Note that there is no benefit in selecting the "with Cypto"
 microcode at this time since NetBSD does not support it.
 
-Note: At the time of writing (December 2006), the NPE Microcode is at
-version 2.3. Newer versions may not work with NetBSD's native Ethernet
-driver. If this is the case, let us know via send-pr(1).
-
-Update: As of March 2010, NPE Microcode is at version 3.0 and has been
-confirmed to work. See:
- http://mail-index.netbsd.org/port-arm/2010/03/24/msg000912.html
+Note: At the time of writing (February 2017), the NPE Microcode is at
+version 3.0. However, the last known microcode version to work is 2.4.
 
 After clicking the link, you will be directed to a click-through license
 page. Assuming you agree to the terms of the license (and you are
@@ -42,7 +44,7 @@ Extract the microcode under any decent U
 command provided with the OS, or with the version included in the pkgsrc
 collection under archivers/unzip:
 
-	$ unzip IPL_ixp400NpeLibrary-3_0.zip
+	$ unzip IPL_ixp400NpeLibrary-2_4.zip
 
 Next, you must generate a microcode image suitable for inclusion in the
 NetBSD kernel.



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

2017-02-10 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Feb 10 20:30:39 UTC 2017

Modified Files:
src/sys/arch/arm/xscale: ixp425-fw.README

Log Message:
update firmware download URL


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/xscale/ixp425-fw.README

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/xscale/ixp425-fw.README
diff -u src/sys/arch/arm/xscale/ixp425-fw.README:1.2 src/sys/arch/arm/xscale/ixp425-fw.README:1.3
--- src/sys/arch/arm/xscale/ixp425-fw.README:1.2	Wed Mar 24 13:55:04 2010
+++ src/sys/arch/arm/xscale/ixp425-fw.README	Fri Feb 10 20:30:39 2017
@@ -1,4 +1,4 @@
-$NetBSD: ixp425-fw.README,v 1.2 2010/03/24 13:55:04 scw Exp $
+$NetBSD: ixp425-fw.README,v 1.3 2017/02/10 20:30:39 tnn Exp $
 
 IXP425 NPE Microcode
 
@@ -19,7 +19,7 @@ through license.
 
 You must grab the NPE microcode from here:
 
- http://www.intel.com/design/network/products/npfamily/download_ixp400.htm
+ https://downloadcenter.intel.com/download/13757/IXP400-Software-NPE-Microcode-v3-0-without-crypto
 
 Select the "Download (without Crypto)" link in the "NPE Microcode"
 section. Note that there is no benefit in selecting the "with Cypto"
@@ -42,7 +42,7 @@ Extract the microcode under any decent U
 command provided with the OS, or with the version included in the pkgsrc
 collection under archivers/unzip:
 
-	$ unzip IPL_ixp400NpeLibrary-2_3.zip
+	$ unzip IPL_ixp400NpeLibrary-3_0.zip
 
 Next, you must generate a microcode image suitable for inclusion in the
 NetBSD kernel.



CVS commit: src/lib/libpuffs

2016-08-28 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug 29 01:13:56 UTC 2016

Modified Files:
src/lib/libpuffs: puffs_ops.3

Log Message:
mention puffs_node_pathconf and puffs_node_advlock


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libpuffs/puffs_ops.3

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

Modified files:

Index: src/lib/libpuffs/puffs_ops.3
diff -u src/lib/libpuffs/puffs_ops.3:1.44 src/lib/libpuffs/puffs_ops.3:1.45
--- src/lib/libpuffs/puffs_ops.3:1.44	Thu Nov 12 17:51:05 2015
+++ src/lib/libpuffs/puffs_ops.3	Mon Aug 29 01:13:56 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: puffs_ops.3,v 1.44 2015/11/12 17:51:05 christos Exp $
+.\"	$NetBSD: puffs_ops.3,v 1.45 2016/08/29 01:13:56 tnn Exp $
 .\"
 .\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\"
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd November 9, 2015
+.Dd August 29, 2016
 .Dt PUFFS_OPS 3
 .Os
 .Sh NAME
@@ -118,6 +118,16 @@
 .Fa "const struct puffs_cred *pcr" "struct timespec *va_ttl" "int xflag"
 .Fc
 .Ft int
+.Fo puffs_node_pathconf
+.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int name"
+.Fa "register_t *retval"
+.Fc
+.Ft int
+.Fo puffs_node_advlock
+.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "void *id" "int op"
+.Fa "struct flock *fl" "int flags"
+.Fc
+.Ft int
 .Fo puffs_node_poll
 .Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int *events"
 .Fc
@@ -562,6 +572,30 @@ with cached attribute time to live speci
 will be set in
 .Fa xflag
 for Fire-And-Forget operations.
+.It Fn puffs_node_pathconf "pu" "opc" "name" "retval"
+The value of the
+.Xr pathconf 2
+filesystem limit specified in
+.Ar name
+for the node
+.Ar opc
+should be copied to the space pointed to by
+.Ar retval .
+.It Fn puffs_node_advlock "po" "opc" "id" "op" "fl" "flags"
+Manipulate advisory record locks on the node
+.Ar opc .
+The argument
+.Ar id
+is the id token which is changing the lock,
+.Ar op
+is the
+.Xr fcntl 2
+operation to perform,
+.Ar fl
+is the lock descriptor structure and
+.Ar flags
+are the flags as defined in
+.Xr VOP_ADVLOCK 9 .
 .It Fn puffs_node_poll "pu" "opc" "events"
 Poll for events on node
 .Ar opc .



CVS commit: src/share/examples/puffs

2016-08-26 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug 26 22:12:22 UTC 2016

Modified Files:
src/share/examples/puffs/icfs: Makefile
src/share/examples/puffs/pgfs: Makefile
src/share/examples/puffs/pnullfs: Makefile
src/share/examples/puffs/rot13fs: Makefile

Log Message:
fix build of puffs examples; need _KERNTYPES for register_t


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/examples/puffs/icfs/Makefile
cvs rdiff -u -r1.2 -r1.3 src/share/examples/puffs/pgfs/Makefile
cvs rdiff -u -r1.1 -r1.2 src/share/examples/puffs/pnullfs/Makefile
cvs rdiff -u -r1.1 -r1.2 src/share/examples/puffs/rot13fs/Makefile

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

Modified files:

Index: src/share/examples/puffs/icfs/Makefile
diff -u src/share/examples/puffs/icfs/Makefile:1.1 src/share/examples/puffs/icfs/Makefile:1.2
--- src/share/examples/puffs/icfs/Makefile:1.1	Sun Jun 24 18:32:00 2007
+++ src/share/examples/puffs/icfs/Makefile	Fri Aug 26 22:12:22 2016
@@ -1,8 +1,9 @@
-#	$NetBSD: Makefile,v 1.1 2007/06/24 18:32:00 pooka Exp $
+#	$NetBSD: Makefile,v 1.2 2016/08/26 22:12:22 tnn Exp $
 
-PROG=	icfs
-LDADD+= -lpuffs -lutil
-DBG=-g -O0
+PROG=		icfs
+CPPFLAGS+=	-D_KERNTYPES
+LDADD+= 	-lpuffs -lutil
+DBG=		-g -O0
 
 WARNS=	3
 

Index: src/share/examples/puffs/pgfs/Makefile
diff -u src/share/examples/puffs/pgfs/Makefile:1.2 src/share/examples/puffs/pgfs/Makefile:1.3
--- src/share/examples/puffs/pgfs/Makefile:1.2	Mon Apr 22 13:27:08 2013
+++ src/share/examples/puffs/pgfs/Makefile	Fri Aug 26 22:12:22 2016
@@ -2,8 +2,11 @@
 PROG=	mount_pgfs
 SRCS=	mount.c pgfs_subs.c pgfs_db.c pgfs_puffs.c pgfs_waitq.c pgfs_debug.c
 
-DPADD+=	${LIBPUFFS} ${LIBUTIL}
-LDADD+=	-lpuffs -lutil
+DPADD+=		${LIBPUFFS} ${LIBUTIL}
+CPPFLAGS+=	-D_KERNTYPES
+LDADD+=		-lpuffs -lutil
+
+COPTS.pgfs_debug.c=	-Wno-format-nonliteral
 
 NOMAN=
 

Index: src/share/examples/puffs/pnullfs/Makefile
diff -u src/share/examples/puffs/pnullfs/Makefile:1.1 src/share/examples/puffs/pnullfs/Makefile:1.2
--- src/share/examples/puffs/pnullfs/Makefile:1.1	Thu Jan 11 01:03:03 2007
+++ src/share/examples/puffs/pnullfs/Makefile	Fri Aug 26 22:12:22 2016
@@ -1,8 +1,9 @@
-#	$NetBSD: Makefile,v 1.1 2007/01/11 01:03:03 pooka Exp $
+#	$NetBSD: Makefile,v 1.2 2016/08/26 22:12:22 tnn Exp $
 
-PROG=	pnullfs
-LDADD+= -lpuffs -lutil
-DBG=-g -O0
+PROG=		 pnullfs
+CPPFLAGS+=	-D_KERNTYPES
+LDADD+=		-lpuffs -lutil
+DBG=		-g -O0
 
 WARNS=	2
 

Index: src/share/examples/puffs/rot13fs/Makefile
diff -u src/share/examples/puffs/rot13fs/Makefile:1.1 src/share/examples/puffs/rot13fs/Makefile:1.2
--- src/share/examples/puffs/rot13fs/Makefile:1.1	Mon Jan 15 00:46:29 2007
+++ src/share/examples/puffs/rot13fs/Makefile	Fri Aug 26 22:12:22 2016
@@ -1,8 +1,9 @@
-#	$NetBSD: Makefile,v 1.1 2007/01/15 00:46:29 pooka Exp $
+#	$NetBSD: Makefile,v 1.2 2016/08/26 22:12:22 tnn Exp $
 
-PROG=	rot13fs
-LDADD+= -lpuffs -lutil
-DBG=-g -O0
+PROG=		rot13fs
+CPPFLAGS+=	-D_KERNTYPES
+LDADD+= 	-lpuffs -lutil
+DBG=		-g -O0
 
 WARNS=	3
 



CVS commit: src/sys/arch/mips/mips

2016-03-06 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Mar  6 21:03:01 UTC 2016

Modified Files:
src/sys/arch/mips/mips: trap.c

Log Message:
Don't try to interpret MIPS3-specific status register bit on MIPS1.
Fixes boot of NetBSD/pmax in gxemul 3max emulation mode.


To generate a diff of this commit:
cvs rdiff -u -r1.238 -r1.239 src/sys/arch/mips/mips/trap.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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.238 src/sys/arch/mips/mips/trap.c:1.239
--- src/sys/arch/mips/mips/trap.c:1.238	Thu Jun 11 15:50:17 2015
+++ src/sys/arch/mips/mips/trap.c	Sun Mar  6 21:03:01 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.238 2015/06/11 15:50:17 matt Exp $	*/
+/*	$NetBSD: trap.c,v 1.239 2016/03/06 21:03:01 tnn Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.238 2015/06/11 15:50:17 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.239 2016/03/06 21:03:01 tnn Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -167,7 +167,7 @@ trap(uint32_t status, uint32_t cause, va
 	KSI_INIT_TRAP();
 
 	curcpu()->ci_data.cpu_ntrap++;
-	if (status & MIPS3_SR_NMI) {
+	if (CPUISMIPS3 && (status & MIPS3_SR_NMI)) {
 		type = T_NMI;
 	} else {
 		type = TRAPTYPE(cause);



CVS commit: src/sys/arch/amd64/conf

2015-11-10 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Nov 10 13:01:41 UTC 2015

Modified Files:
src/sys/arch/amd64/conf: ALL XEN3_DOM0 XEN3_DOMU

Log Message:
Add "pseudo-device iscsi" to ALL and as a commented out hint in XEN3_*


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/amd64/conf/XEN3_DOMU

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.32 src/sys/arch/amd64/conf/ALL:1.33
--- src/sys/arch/amd64/conf/ALL:1.32	Sun Oct 25 22:48:23 2015
+++ src/sys/arch/amd64/conf/ALL	Tue Nov 10 13:01:41 2015
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.32 2015/10/25 22:48:23 khorben Exp $
+# $NetBSD: ALL,v 1.33 2015/11/10 13:01:41 tnn 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.32 $"
+#ident 		"ALL-$Revision: 1.33 $"
 
 maxusers	64		# estimated number of users
 
@@ -1587,6 +1587,9 @@ pseudo-device	vcoda			# coda minicache <
 # a pseudo device needed for SMBFS
 pseudo-device	nsmb			# experimental - SMB requester
 
+# iSCSI initiator
+pseudo-device	iscsi
+
 # wscons pseudo-devices
 pseudo-device	wsmux			# mouse & keyboard multiplexor
 pseudo-device	wsfont

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.115 src/sys/arch/amd64/conf/XEN3_DOM0:1.116
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.115	Sat Aug  8 06:36:24 2015
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Tue Nov 10 13:01:41 2015
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.115 2015/08/08 06:36:24 maxv Exp $
+# $NetBSD: XEN3_DOM0,v 1.116 2015/11/10 13:01:41 tnn Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -835,6 +835,9 @@ pseudo-device	vcoda			# coda minicache <
 # a pseudo device needed for SMBFS
 pseudo-device	nsmb			# experimental - SMB requester
 
+# iSCSI initiator
+#pseudo-device	iscsi
+
 # wscons pseudo-devices
 pseudo-device	wsmux			# mouse & keyboard multiplexor
 pseudo-device	wsfont

Index: src/sys/arch/amd64/conf/XEN3_DOMU
diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.63 src/sys/arch/amd64/conf/XEN3_DOMU:1.64
--- src/sys/arch/amd64/conf/XEN3_DOMU:1.63	Wed Aug 12 07:53:57 2015
+++ src/sys/arch/amd64/conf/XEN3_DOMU	Tue Nov 10 13:01:41 2015
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.63 2015/08/12 07:53:57 maxv Exp $
+# $NetBSD: XEN3_DOMU,v 1.64 2015/11/10 13:01:41 tnn Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -245,6 +245,11 @@ pseudo-device	vcoda			# coda minicache <
 # a pseudo device needed for SMBFS
 pseudo-device	nsmb			# experimental - SMB requester
 
+# iSCSI initiator and dependencies
+#scsibus* at scsi?
+#sd*	at scsibus? target ? lun ?
+#pseudo-device	iscsi
+
 # userland interface to drivers, including autoconf and properties retrieval
 pseudo-device	drvctl
 



CVS commit: src/sbin/iscsid

2015-11-10 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Nov 10 12:41:18 UTC 2015

Modified Files:
src/sbin/iscsid: iscsid.8

Log Message:
fix iSCSI RFC number


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sbin/iscsid/iscsid.8

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

Modified files:

Index: src/sbin/iscsid/iscsid.8
diff -u src/sbin/iscsid/iscsid.8:1.11 src/sbin/iscsid/iscsid.8:1.12
--- src/sbin/iscsid/iscsid.8:1.11	Sun Jul  6 14:41:24 2014
+++ src/sbin/iscsid/iscsid.8	Tue Nov 10 12:41:18 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: iscsid.8,v 1.11 2014/07/06 14:41:24 zafer Exp $
+.\" $NetBSD: iscsid.8,v 1.12 2015/11/10 12:41:18 tnn Exp $
 .\"
 .\" Copyright (c) 2011 Alistair Crooks 
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 6, 2014
+.Dd November 10, 2015
 .Dt ISCSID 8
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Sh DESCRIPTION
 The iSCSI initiator runs as a kernel driver, and provides access
 to iSCSI targets running across a network using the iSCSI protocol,
-RFC 3270.
+RFC 3720.
 The
 .Nm
 utility itself interfaces to the kernel iSCSI driver, and also



CVS commit: src/sys/dev/pci

2015-10-20 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 20 13:27:36 UTC 2015

Modified Files:
src/sys/dev/pci: files.pci

Log Message:
add ifnet attributes to vioif(4) so it can be config(8)ed as root device


To generate a diff of this commit:
cvs rdiff -u -r1.377 -r1.378 src/sys/dev/pci/files.pci

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/files.pci
diff -u src/sys/dev/pci/files.pci:1.377 src/sys/dev/pci/files.pci:1.378
--- src/sys/dev/pci/files.pci:1.377	Thu Aug 27 14:04:08 2015
+++ src/sys/dev/pci/files.pci	Tue Oct 20 13:27:36 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.377 2015/08/27 14:04:08 nonaka Exp $
+#	$NetBSD: files.pci,v 1.378 2015/10/20 13:27:36 tnn Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -1136,7 +1136,7 @@ device	viomb
 attach	viomb at virtio
 file	dev/pci/viomb.c		viomb
 
-device	vioif
+device	vioif: ether, ifnet, arp
 attach	vioif at virtio
 file	dev/pci/if_vioif.c	vioif
 



CVS commit: src/sys/dev/pci

2015-10-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Oct 19 09:54:21 UTC 2015

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
add I219 family Ethernet devices


To generate a diff of this commit:
cvs rdiff -u -r1.1235 -r1.1236 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1235 src/sys/dev/pci/pcidevs:1.1236
--- src/sys/dev/pci/pcidevs:1.1235	Fri Aug 28 13:09:48 2015
+++ src/sys/dev/pci/pcidevs	Mon Oct 19 09:54:21 2015
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1235 2015/08/28 13:09:48 nonaka Exp $
+$NetBSD: pcidevs,v 1.1236 2015/10/19 09:54:21 tnn Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -2968,6 +2968,8 @@ product INTEL I218_V		0x1559	I218-V Ethe
 product INTEL I218_LM		0x155a	I218-LM Ethernet Connection
 product INTEL X540_BYPASS	0x155c	X540 10 GbE Bypass
 product INTEL 82599_BYPASS	0x155d	82599 10 GbE Bypass
+product INTEL I219_LM		0x156f	I219-LM Ethernet Connection
+product INTEL I219_V		0x1570	I219-V Ethernet Connection
 product INTEL XL710_VF_HV	0x1571	XL710 Ethernet Virtual Function
 product INTEL XL710_SFP		0x1572	XL710 SFP+ Ethernet
 product INTEL I210_COPPER_WOF	0x157b	I210 Ethernet (COPPER)
@@ -2983,6 +2985,8 @@ product INTEL I218_LM2		0x15a0	I218-LM E
 product INTEL I218_V2		0x15a1	I218-V Ethernet Connection
 product INTEL I218_LM3		0x15a2	I218-LM Ethernet Connection
 product INTEL I218_V3		0x15a3	I218-V Ethernet Connection
+product INTEL I219_LM		0x15b7	I219-LM Ethernet Connection
+product INTEL I219_V2		0x15b8	I219-V Ethernet Connection
 product INTEL CORE5G_HB_1	0x1604	Core 5G Host Bridge
 product INTEL CORE5G_HDA_1	0x160c	Core 5G HD Audio
 product INTEL CORE5G_M_GT1	0x1606	HD Graphics (GT1)



CVS commit: src/sys/dev/pci

2015-10-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Oct 19 09:57:37 UTC 2015

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
fix I219_LM2 entry


To generate a diff of this commit:
cvs rdiff -u -r1.1236 -r1.1237 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1236 src/sys/dev/pci/pcidevs:1.1237
--- src/sys/dev/pci/pcidevs:1.1236	Mon Oct 19 09:54:21 2015
+++ src/sys/dev/pci/pcidevs	Mon Oct 19 09:57:37 2015
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1236 2015/10/19 09:54:21 tnn Exp $
+$NetBSD: pcidevs,v 1.1237 2015/10/19 09:57:37 tnn Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -2985,7 +2985,7 @@ product INTEL I218_LM2		0x15a0	I218-LM E
 product INTEL I218_V2		0x15a1	I218-V Ethernet Connection
 product INTEL I218_LM3		0x15a2	I218-LM Ethernet Connection
 product INTEL I218_V3		0x15a3	I218-V Ethernet Connection
-product INTEL I219_LM		0x15b7	I219-LM Ethernet Connection
+product INTEL I219_LM2		0x15b7	I219-LM Ethernet Connection
 product INTEL I219_V2		0x15b8	I219-V Ethernet Connection
 product INTEL CORE5G_HB_1	0x1604	Core 5G Host Bridge
 product INTEL CORE5G_HDA_1	0x160c	Core 5G HD Audio



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

2015-08-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Aug  8 23:30:16 UTC 2015

Modified Files:
src/sys/arch/arm/allwinner: awin_com.c awin_reg.h

Log Message:
fix attachment of non-console UARTs and ensure the UART clock is running


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/allwinner/awin_com.c
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/arm/allwinner/awin_reg.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/allwinner/awin_com.c
diff -u src/sys/arch/arm/allwinner/awin_com.c:1.9 src/sys/arch/arm/allwinner/awin_com.c:1.10
--- src/sys/arch/arm/allwinner/awin_com.c:1.9	Sun Dec  7 12:44:24 2014
+++ src/sys/arch/arm/allwinner/awin_com.c	Sat Aug  8 23:30:16 2015
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_com.c,v 1.9 2014/12/07 12:44:24 jmcneill Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_com.c,v 1.10 2015/08/08 23:30:16 tnn Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -130,7 +130,28 @@ awin_com_match(device_t parent, cfdata_t
 	awin_gpio_pinset_acquire(pinset);
 
 	bus_space_subregion(iot, aio-aio_core_bsh,
-	loc-loc_offset, loc-loc_size, bsh);
+	loc-loc_offset / 4, loc-loc_size, bsh);
+
+	/*
+	 * Clock gating, soft reset
+	 */
+	if (awin_chip_id() == AWIN_CHIP_ID_A80) {
+		awin_reg_set_clear(aio-aio_core_bst, aio-aio_ccm_bsh,
+		AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_REG,
+		AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART0  loc-loc_port, 0);
+		awin_reg_set_clear(aio-aio_core_bst, aio-aio_ccm_bsh,
+		AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_REG,
+		AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART0  loc-loc_port, 0);
+	} else {
+		awin_reg_set_clear(aio-aio_core_bst, aio-aio_ccm_bsh,
+		   AWIN_APB1_GATING_REG,
+		   AWIN_APB_GATING1_UART0  loc-loc_port, 0);
+		if (awin_chip_id() == AWIN_CHIP_ID_A31) {
+			awin_reg_set_clear(aio-aio_core_bst, aio-aio_ccm_bsh,
+			AWIN_A31_APB2_RESET_REG,
+			AWIN_A31_APB2_RESET_UART0_RST  loc-loc_port, 0);
+		}
+	}
 
 	const int rv = comprobe1(iot, bsh);
 

Index: src/sys/arch/arm/allwinner/awin_reg.h
diff -u src/sys/arch/arm/allwinner/awin_reg.h:1.78 src/sys/arch/arm/allwinner/awin_reg.h:1.79
--- src/sys/arch/arm/allwinner/awin_reg.h:1.78	Wed Jun  3 12:22:41 2015
+++ src/sys/arch/arm/allwinner/awin_reg.h	Sat Aug  8 23:30:16 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_reg.h,v 1.78 2015/06/03 12:22:41 skrll Exp $ */
+/* $NetBSD: awin_reg.h,v 1.79 2015/08/08 23:30:16 tnn Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -2416,6 +2416,13 @@ struct awin_mmc_idma_descriptor {
 #define AWIN_A31_APB1_RESET_DIGITAL_MIC_RST	__BIT(4)
 #define AWIN_A31_APB1_RESET_CODEC_RST		__BIT(0)
 
+#define AWIN_A31_APB2_RESET_UART5_RST		__BIT(21)
+#define AWIN_A31_APB2_RESET_UART4_RST		__BIT(20)
+#define AWIN_A31_APB2_RESET_UART3_RST		__BIT(19)
+#define AWIN_A31_APB2_RESET_UART2_RST		__BIT(18)
+#define AWIN_A31_APB2_RESET_UART1_RST		__BIT(17)
+#define AWIN_A31_APB2_RESET_UART0_RST		__BIT(16)
+
 #define AWIN_A31_APB2_RESET_TWI3_RST		__BIT(3)
 #define AWIN_A31_APB2_RESET_TWI2_RST		__BIT(2)
 #define AWIN_A31_APB2_RESET_TWI1_RST		__BIT(1)
@@ -2786,6 +2793,13 @@ struct awin_a31_dma_desc {
 #define AWIN_A80_CCU_SCLK_BUS_CLK_GATING1_GMAC	__BIT(17)
 #define AWIN_A80_CCU_SCLK_BUS_CLK_GATING1_USB_HOST __BIT(1)
 
+#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART5	__BIT(21)
+#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART4	__BIT(20)
+#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART3	__BIT(19)
+#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART2	__BIT(18)
+#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART1	__BIT(17)
+#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART0	__BIT(16)
+
 #define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_TWI4	__BIT(4)
 #define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_TWI2	__BIT(3)
 #define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_TWI3	__BIT(2)
@@ -2798,6 +2812,13 @@ struct awin_a31_dma_desc {
 #define AWIN_A80_CCU_SCLK_BUS_SOFT_RST1_GMAC	__BIT(17)
 #define AWIN_A80_CCU_SCLK_BUS_SOFT_RST1_USB_DRD	__BIT(1)
 
+#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART5	__BIT(21)
+#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART4	__BIT(20)
+#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART3	__BIT(19)
+#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART2	__BIT(18)
+#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART1	__BIT(17)
+#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART0	__BIT(16)
+
 #define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_TWI4	__BIT(4)
 #define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_TWI3	__BIT(3)
 #define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_TWI2	__BIT(2)



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

2015-08-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Aug  8 23:32:22 UTC 2015

Modified Files:
src/sys/arch/evbarm/conf: BPI

Log Message:
add commented out entries for com ports that are physically routed


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/conf/BPI

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/conf/BPI
diff -u src/sys/arch/evbarm/conf/BPI:1.14 src/sys/arch/evbarm/conf/BPI:1.15
--- src/sys/arch/evbarm/conf/BPI:1.14	Tue Apr 21 04:24:51 2015
+++ src/sys/arch/evbarm/conf/BPI	Sat Aug  8 23:32:22 2015
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BPI,v 1.14 2015/04/21 04:24:51 matt Exp $
+#	$NetBSD: BPI,v 1.15 2015/08/08 23:32:22 tnn Exp $
 #
 #	BPI -- Banana Pi - an Allwinner A20 Eval Board Kernel
 #
@@ -234,6 +234,8 @@ iic*		at awiniic?
 # On-board 16550 UARTs
 com0		at awinio? port 0			# UART0 (console)
 options 	CONADDR=0x01c28000, CONSPEED=115200
+#com1		at awinio? port 3	# CON3: rx = pin 10, tx = pin 8
+#com2		at awinio? port 7	#  J12: rx = pin  4, tx = pin 6
 
 # Consumer IR
 awinir0		at awinio?



CVS commit: src/sys/dev/ic

2015-06-12 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Jun 12 11:54:39 UTC 2015

Modified Files:
src/sys/dev/ic: dwc_gmac.c

Log Message:
Supports ETHERCAP_VLAN_MTU. ok martin@ PR#49967


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.32 src/sys/dev/ic/dwc_gmac.c:1.33
--- src/sys/dev/ic/dwc_gmac.c:1.32	Mon Feb 23 19:05:17 2015
+++ src/sys/dev/ic/dwc_gmac.c	Fri Jun 12 11:54:39 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.32 2015/02/23 19:05:17 martin Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.33 2015/06/12 11:54:39 tnn Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: dwc_gmac.c,v 1.32 2015/02/23 19:05:17 martin Exp $);
+__KERNEL_RCSID(1, $NetBSD: dwc_gmac.c,v 1.33 2015/06/12 11:54:39 tnn Exp $);
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -238,6 +238,11 @@ dwc_gmac_attach(struct dwc_gmac_softc *s
 }
 
 	/*
+	 * We can support 802.1Q VLAN-sized frames.
+	 */
+	sc-sc_ec.ec_capabilities |= ETHERCAP_VLAN_MTU;
+
+	/*
 	 * Ready, attach interface
 	 */
 	if_attach(ifp);



CVS commit: src/sys/dev/pci

2015-04-02 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Apr  2 15:32:19 UTC 2015

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

Log Message:
attach Mobile 5th Gen. Core SMBus


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pci/ichsmb.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/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.40 src/sys/dev/pci/ichsmb.c:1.41
--- src/sys/dev/pci/ichsmb.c:1.40	Fri Mar 20 12:01:32 2015
+++ src/sys/dev/pci/ichsmb.c	Thu Apr  2 15:32:19 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.40 2015/03/20 12:01:32 msaitoh Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.41 2015/04/02 15:32:19 tnn Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.18 2007/05/03 09:36:26 dlg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ichsmb.c,v 1.40 2015/03/20 12:01:32 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: ichsmb.c,v 1.41 2015/04/02 15:32:19 tnn Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -112,6 +112,7 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_8SERIES_SMB:
 		case PCI_PRODUCT_INTEL_9SERIES_SMB:
 		case PCI_PRODUCT_INTEL_CORE4G_M_SMB:
+		case PCI_PRODUCT_INTEL_CORE5G_M_SMB:
 		case PCI_PRODUCT_INTEL_BAYTRAIL_PCU_SMB:
 		case PCI_PRODUCT_INTEL_C600_SMBUS:
 		case PCI_PRODUCT_INTEL_C600_SMB_0:



CVS commit: src/sys/dev/pci

2015-04-02 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Apr  2 15:08:22 UTC 2015

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Mobile 5th Generation Intel Core devices, from intel doc #330837-004


To generate a diff of this commit:
cvs rdiff -u -r1.1219 -r1.1220 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1219 src/sys/dev/pci/pcidevs:1.1220
--- src/sys/dev/pci/pcidevs:1.1219	Fri Mar 20 14:26:42 2015
+++ src/sys/dev/pci/pcidevs	Thu Apr  2 15:08:22 2015
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1219 2015/03/20 14:26:42 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1220 2015/04/02 15:08:22 tnn Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -4059,6 +4059,41 @@ product INTEL CORE4G_M_S_UART_0 0x9c63	C
 product INTEL CORE4G_M_S_UART_1 0x9c64	Core 4G (mobile) Serial I/O UART
 product INTEL CORE4G_M_S_GSPI_0 0x9c65	Core 4G (mobile) Serial I/O GSPI
 product INTEL CORE4G_M_S_GSPI_1 0x9c66	Core 4G (mobile) Serial I/O GSPI
+product INTEL CORE5G_M_AHCI	0x9c83	Core 5G (mobile) SATA Controller (AHCI)
+product INTEL CORE5G_M_RAID_1	0x9c85	Core 5G (mobile) SATA Controller (RAID)
+product INTEL CORE5G_M_RAID_2	0x9c87	Core 5G (mobile) SATA Controller (RAID) Premium
+product INTEL CORE5G_M_RAID_3	0x9c8f	Core 5G (mobile) SATA Controller (RAID) RRT Only
+product INTEL CORE5G_M_PCIE_1	0x9c90	Core 5G (mobile) PCIE
+product INTEL CORE5G_M_PCIE_2	0x9c92	Core 5G (mobile) PCIE
+product INTEL CORE5G_M_PCIE_3	0x9c94	Core 5G (mobile) PCIE
+product INTEL CORE5G_M_PCIE_4	0x9c96	Core 5G (mobile) PCIE
+product INTEL CORE5G_M_PCIE_5	0x9c98	Core 5G (mobile) PCIE
+product INTEL CORE5G_M_PCIE_6	0x9c9a	Core 5G (mobile) PCIE
+product INTEL CORE5G_M_HDA	0x9ca0	Core 5G (mobile) HD Audio
+product INTEL CORE5G_M_SMB	0x9ca2	Core 5G (mobile) SMBus
+product INTEL CORE5G_M_THERM	0x9ca4	Core 5G (mobile) Thermal
+product INTEL CORE5G_M_EHCI	0x9ca6	Core 5G (mobile) USB EHCI
+product INTEL CORE5G_M_XHCI	0x9cb1	Core 5G (mobile) USB xHCI
+product INTEL CORE5G_M_SDIO	0x9cb5	Core 5G (mobile) SDIO
+product INTEL CORE5G_M_SSOUND	0x9cb6	Core 5G (mobile) Smart Sound
+product INTEL CORE5G_M_MEI_1	0x9cba	Core 5G (mobile) ME Interface
+product INTEL CORE5G_M_MEI_2	0x9cbb	Core 5G (mobile) ME Interface
+product INTEL CORE5G_M_IDE_R	0x9cbc	Core 5G (mobile) IDE-R
+product INTEL CORE5G_M_KT	0x9cbd	Core 5G (mobile) KT
+product INTEL CORE5G_M_LPC_1	0x9cc1	Core 5G (mobile) LPC
+product INTEL CORE5G_M_LPC_2	0x9cc2	Core 5G (mobile) LPC
+product INTEL CORE5G_M_LPC_3	0x9cc3	Core 5G (mobile) LPC
+product INTEL CORE5G_M_LPC_4	0x9cc5	Core 5G (mobile) LPC
+product INTEL CORE5G_M_LPC_5	0x9cc6	Core 5G (mobile) LPC
+product INTEL CORE5G_M_LPC_6	0x9cc7	Core 5G (mobile) LPC
+product INTEL CORE5G_M_LPC_7	0x9cc9	Core 5G (mobile) LPC
+product INTEL CORE5G_M_S_DMA	0x9ce0	Core 5G (mobile) Serial I/O DMA
+product INTEL CORE5G_M_S_I2C_0	0x9ce1	Core 5G (mobile) Serial I/O I2C
+product INTEL CORE5G_M_S_I2C_1	0x9ce2	Core 5G (mobile) Serial I/O I2C
+product INTEL CORE5G_M_S_UART_0	0x9ce3	Core 5G (mobile) Serial I/O UART
+product INTEL CORE5G_M_S_UART_1	0x9ce4	Core 5G (mobile) Serial I/O UART
+product INTEL CORE5G_M_S_GSPI_0	0x9ce5	Core 5G (mobile) Serial I/O GSPI
+product INTEL CORE5G_M_S_GSPI_1	0x9ce6	Core 5G (mobile) Serial I/O GSPI
 product INTEL PINEVIEW_HB	0xa000	Pineview Host Bridge
 product INTEL PINEVIEW_IGD	0xa001	Pineview Integrated Graphics Device
 product INTEL PINEVIEW_IGD_1	0xa002	Pineview Integrated Graphics Device



CVS commit: src/usr.sbin/cpuctl/arch

2015-03-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Mar  1 18:02:42 UTC 2015

Modified Files:
src/usr.sbin/cpuctl/arch: i386-asm.S x86_64-asm.S

Log Message:
xgetbv expects XCR0 to be speficied in %ecx, don't leave %ecx undefined


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/cpuctl/arch/i386-asm.S
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/cpuctl/arch/x86_64-asm.S

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/cpuctl/arch/i386-asm.S
diff -u src/usr.sbin/cpuctl/arch/i386-asm.S:1.3 src/usr.sbin/cpuctl/arch/i386-asm.S:1.4
--- src/usr.sbin/cpuctl/arch/i386-asm.S:1.3	Mon Jan  7 23:20:42 2013
+++ src/usr.sbin/cpuctl/arch/i386-asm.S	Sun Mar  1 18:02:42 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386-asm.S,v 1.3 2013/01/07 23:20:42 dsl Exp $	*/
+/*	$NetBSD: i386-asm.S,v 1.4 2015/03/01 18:02:42 tnn Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2006, 2007 The NetBSD Foundation, Inc.
@@ -49,6 +49,7 @@ ENTRY(x86_cpuid2)
 END(x86_cpuid2)
 
 ENTRY(x86_xgetbv)
+	xorl	%ecx, %ecx
 	xgetbv
 	ret
 END(x86_xgetbv)

Index: src/usr.sbin/cpuctl/arch/x86_64-asm.S
diff -u src/usr.sbin/cpuctl/arch/x86_64-asm.S:1.4 src/usr.sbin/cpuctl/arch/x86_64-asm.S:1.5
--- src/usr.sbin/cpuctl/arch/x86_64-asm.S:1.4	Mon Jan  7 23:20:42 2013
+++ src/usr.sbin/cpuctl/arch/x86_64-asm.S	Sun Mar  1 18:02:42 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_64-asm.S,v 1.4 2013/01/07 23:20:42 dsl Exp $	*/
+/*	$NetBSD: x86_64-asm.S,v 1.5 2015/03/01 18:02:42 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -44,6 +44,7 @@ ENTRY(x86_cpuid2)
 	ret
 
 ENTRY(x86_xgetbv)
+	xorl	%ecx, %ecx
 	xgetbv
 	ret
 



CVS commit: src/usr.sbin/usbdevs

2011-08-15 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug 15 14:20:08 UTC 2011

Modified Files:
src/usr.sbin/usbdevs: usbdevs.8

Log Message:
Use proper capitalization. Reported on IRC.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/usbdevs/usbdevs.8

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/usbdevs/usbdevs.8
diff -u src/usr.sbin/usbdevs/usbdevs.8:1.7 src/usr.sbin/usbdevs/usbdevs.8:1.8
--- src/usr.sbin/usbdevs/usbdevs.8:1.7	Wed Apr 30 13:11:03 2008
+++ src/usr.sbin/usbdevs/usbdevs.8	Mon Aug 15 14:20:08 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: usbdevs.8,v 1.7 2008/04/30 13:11:03 martin Exp $
+.\ $NetBSD: usbdevs.8,v 1.8 2011/08/15 14:20:08 tnn Exp $
 .\
 .\ Copyright (c) 1999 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd October 15, 2000
+.Dd August 15, 2011
 .Dt USBDEVS 8
 .Os
 .Sh NAME
@@ -48,11 +48,11 @@
 The options are as follows:
 .Bl -tag -width Fl
 .It Fl a Ar addr
-only print information about the device at the given address.
+Only print information about the device at the given address.
 .It Fl d
 Show the device drivers associated with each device.
 .It Fl f Ar dev
-only print information for the given USB controller.
+Only print information for the given USB controller.
 .It Fl v
 Be verbose.
 .El



CVS commit: src/sys/dev/usb

2010-07-02 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Jul  2 08:35:42 UTC 2010

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add id for Samsung GT-B3730 LTE/4G datacard


To generate a diff of this commit:
cvs rdiff -u -r1.560 -r1.561 src/sys/dev/usb/usbdevs

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/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.560 src/sys/dev/usb/usbdevs:1.561
--- src/sys/dev/usb/usbdevs:1.560	Sun Jun 27 10:32:13 2010
+++ src/sys/dev/usb/usbdevs	Fri Jul  2 08:35:41 2010
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.560 2010/06/27 10:32:13 kardel Exp $
+$NetBSD: usbdevs,v 1.561 2010/07/02 08:35:41 tnn Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -2100,6 +2100,7 @@
 product SAMSUNG MIGHTYDRIVE	0x1623	Mighty Drive
 product SAMSUNG ML6060		0x3008	ML-6060 laser printer
 product SAMSUNG GTB3710		0x6876	GT-B3710 LTE/4G datacard
+product SAMSUNG GTB3730		0x689a	GT-B3730 LTE/4G datacard
 
 /* SanDisk products */
 product SANDISK SDDR05A		0x0001	ImageMate SDDR-05a



  1   2   >