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

2019-11-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Nov 23 05:13:11 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
don't invalidate sensors every time we fail to read fan speeds


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/macppc/dev/psoc.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/macppc/dev/psoc.c
diff -u src/sys/arch/macppc/dev/psoc.c:1.2 src/sys/arch/macppc/dev/psoc.c:1.3
--- src/sys/arch/macppc/dev/psoc.c:1.2	Fri Nov 22 05:16:54 2019
+++ src/sys/arch/macppc/dev/psoc.c	Sat Nov 23 05:13:11 2019
@@ -1,7 +1,7 @@
- /* $NetBSD: psoc.c,v 1.2 2019/11/22 05:16:54 macallan Exp $ */
+ /* $NetBSD: psoc.c,v 1.3 2019/11/23 05:13:11 macallan Exp $ */
 
 /*-
- * Copyright (c) 2018 Michael Lorenz
+ * Copyright (c) 2019 Michael Lorenz
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.2 2019/11/22 05:16:54 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.3 2019/11/23 05:13:11 macallan Exp $");
 
 #include 
 #include 
@@ -159,7 +159,7 @@ psoc_sensors_refresh(struct sysmon_envsy
 {
 	struct psoc_softc *sc = sme->sme_cookie;
 	uint8_t cmd = 6;
-	uint8_t buf[0x28], *bptr;
+	uint8_t buf[0x28];
 	int error = 1, data;
 
 	if ( edata->private < 0x20) {
@@ -183,26 +183,24 @@ psoc_sensors_refresh(struct sysmon_envsy
 			psoc_dump(sc);
 #endif
 	} else {
-		cmd = 0x20;
+		cmd = edata->private;
 		iic_acquire_bus(sc->sc_i2c, 0);
 		error = iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP,
-			sc->sc_addr, , 1, buf, 12, 0);
+			sc->sc_addr, , 1, buf, 3, 0);
 		iic_release_bus(sc->sc_i2c, 0);
 		if (error) return;
-		if (edata->private >= 0x20) {
-			bptr = [edata->private - 0x20];
-			switch (bptr[0] & 0xf0) {
-case 0x50:
-	data = bptr[edata->private - 0x20];
-	edata->value_cur = ((bptr[2] & 0x3f) << 6) | (bptr[1] & 0x3f);
-	break;
-case 0x60:
-	edata->value_cur = 0;
-	break;
-default:
-	error = -1;
-			}	
-		}
+		switch (buf[0] & 0xf0) {
+			case 0x50:
+data = buf[edata->private - 0x20];
+edata->value_cur = ((buf[2] & 0x3f) << 6) |
+		(buf[1] & 0x3f);
+break;
+			case 0x60:
+edata->value_cur = 0;
+break;
+			default:
+error = 0;
+		}	
 	}
 	if (error) {
 		edata->state = ENVSYS_SINVALID;



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

2019-11-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Nov 23 05:13:11 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
don't invalidate sensors every time we fail to read fan speeds


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/macppc/dev/psoc.c

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



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

2019-11-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 22 05:16:54 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
report fan speeds
disclaimer:
this is guesswork obtained from watching temperatures, listening to fan noise
and staring at register dumps. Use with caution.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/psoc.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/macppc/dev/psoc.c
diff -u src/sys/arch/macppc/dev/psoc.c:1.1 src/sys/arch/macppc/dev/psoc.c:1.2
--- src/sys/arch/macppc/dev/psoc.c:1.1	Fri Nov  1 17:51:56 2019
+++ src/sys/arch/macppc/dev/psoc.c	Fri Nov 22 05:16:54 2019
@@ -1,4 +1,4 @@
- /* $NetBSD: psoc.c,v 1.1 2019/11/01 17:51:56 macallan Exp $ */
+ /* $NetBSD: psoc.c,v 1.2 2019/11/22 05:16:54 macallan Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz
@@ -30,15 +30,19 @@
  * fan controller found in 1GHz TiBook
  *
  * register values from OF:
- * fan1 - 0x20 ( status ), 0x31 ( data)
+ * fan1 - 0x20 ( status ), 0x31 ( data )
  * fan2 - 0x26 ( status ), 0x45 ( data )
- * fan3 - 0x59
+ * fan status byte 0:
+ * 0x5* - fan is running, 0x6* - fan stopped
+ * byte 1: unknown, 0x80 seems always set, lower bits seem to fluctuate
+ * byte 2: lower 6 bit seem to indicate speed
+ * fan speed may be lower 6 bit of byte 2 and lower 6 of byte 1 
  * temperature sensors start at 6, two bytes each, first appears to be
  * the temperature in degrees Celsius
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.1 2019/11/01 17:51:56 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.2 2019/11/22 05:16:54 macallan Exp $");
 
 #include 
 #include 
@@ -71,6 +75,8 @@ static void	psoc_attach(device_t, device
 
 static void	psoc_sensors_refresh(struct sysmon_envsys *, envsys_data_t *);
 
+static void	psoc_dump(struct psoc_softc *);
+
 CFATTACH_DECL_NEW(psoc, sizeof(struct psoc_softc),
 psoc_match, psoc_attach, NULL, NULL);
 
@@ -98,7 +104,7 @@ psoc_attach(device_t parent, device_t se
 	struct i2c_attach_args *ia = aux;
 	char path[256];
 	envsys_data_t *s;
-	int error, ih, r;
+	int error, ih, r, i;
 
 	sc->sc_dev = self;
 	sc->sc_i2c = ia->ia_tag;
@@ -122,19 +128,8 @@ psoc_attach(device_t parent, device_t se
 	sc->sc_sme->sme_refresh = psoc_sensors_refresh;
 	sc->sc_nsensors = 0;
 
-	int i, j;
-	uint8_t data, cmd;
-	for (i = 0; i < 0x7f; i+= 8) {
-		printf("%02x:", i);
-		for (j = 0; j < 8; j++) {
-			cmd = i + j;
-			data = 0;
-			iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP,
-			sc->sc_addr, , 1, , 1, 0);
-			printf(" %02x", data);
-		}
-		printf("\n");
-	}
+	psoc_dump(sc);
+
 	for (i = 0; i < 4; i++) {
 		r = i * 2 + 6;
 		s = >sc_sensors[sc->sc_nsensors];
@@ -145,8 +140,8 @@ psoc_attach(device_t parent, device_t se
 		sysmon_envsys_sensor_attach(sc->sc_sme, s);
 		sc->sc_nsensors++;
 	}
-#if 0
-	for (r = 0x31; r < 0x50; r += 0x14) {
+
+	for (r = 0x20; r < 0x2b; r += 0x06) {
 		s = >sc_sensors[sc->sc_nsensors];
 		s->state = ENVSYS_SINVALID;
 		s->units = ENVSYS_SFANRPM;
@@ -155,7 +150,7 @@ psoc_attach(device_t parent, device_t se
 		sysmon_envsys_sensor_attach(sc->sc_sme, s);
 		sc->sc_nsensors++;
 	}
-#endif
+
 	sysmon_envsys_register(sc->sc_sme);
 }
 
@@ -164,8 +159,8 @@ psoc_sensors_refresh(struct sysmon_envsy
 {
 	struct psoc_softc *sc = sme->sme_cookie;
 	uint8_t cmd = 6;
-	uint8_t buf[0x28];
-	int error = 1, data, i;
+	uint8_t buf[0x28], *bptr;
+	int error = 1, data;
 
 	if ( edata->private < 0x20) {
 		cmd = 0;
@@ -183,19 +178,30 @@ psoc_sensors_refresh(struct sysmon_envsy
 			/* Celsius -> microkelvin */
 			edata->value_cur = ((int)data * 100) + 27315;
 		}
+#ifdef PSOC_DEBUG
+		if (edata->private == 6)
+			psoc_dump(sc);
+#endif
 	} else {
-		cmd = 0x31;
+		cmd = 0x20;
 		iic_acquire_bus(sc->sc_i2c, 0);
 		error = iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP,
-			sc->sc_addr, , 1, buf, 0x28, 0);
+			sc->sc_addr, , 1, buf, 12, 0);
 		iic_release_bus(sc->sc_i2c, 0);
 		if (error) return;
-		if (edata->private > 0) {
-			data = buf[edata->private - 0x20];
-			edata->value_cur = data;
-			for (i = 0; i < 14; i++)
-printf(" %02x", buf[edata->private - 0x31 + i]);
-			printf("\n");
+		if (edata->private >= 0x20) {
+			bptr = [edata->private - 0x20];
+			switch (bptr[0] & 0xf0) {
+case 0x50:
+	data = bptr[edata->private - 0x20];
+	edata->value_cur = ((bptr[2] & 0x3f) << 6) | (bptr[1] & 0x3f);
+	break;
+case 0x60:
+	edata->value_cur = 0;
+	break;
+default:
+	error = -1;
+			}	
 		}
 	}
 	if (error) {
@@ -204,3 +210,21 @@ psoc_sensors_refresh(struct sysmon_envsy
 		edata->state = ENVSYS_SVALID;
 	}
 }
+
+static void
+ps

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

2019-11-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 22 05:16:54 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
report fan speeds
disclaimer:
this is guesswork obtained from watching temperatures, listening to fan noise
and staring at register dumps. Use with caution.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/psoc.c

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



CVS commit: src/sys/arch/sgimips/gio

2019-11-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Nov 21 22:05:09 UTC 2019

Modified Files:
src/sys/arch/sgimips/gio: gio.c

Log Message:
ga_iot = 0 -> normal_memt
now a Challenge S should work again
from George Harvey


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/sgimips/gio/gio.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/sgimips/gio/gio.c
diff -u src/sys/arch/sgimips/gio/gio.c:1.35 src/sys/arch/sgimips/gio/gio.c:1.36
--- src/sys/arch/sgimips/gio/gio.c:1.35	Wed Jul 20 22:16:37 2016
+++ src/sys/arch/sgimips/gio/gio.c	Thu Nov 21 22:05:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: gio.c,v 1.35 2016/07/20 22:16:37 macallan Exp $	*/
+/*	$NetBSD: gio.c,v 1.36 2019/11/21 22:05:09 macallan Exp $	*/
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gio.c,v 1.35 2016/07/20 22:16:37 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gio.c,v 1.36 2019/11/21 22:05:09 macallan Exp $");
 
 #include "opt_ddb.h"
 
@@ -329,7 +329,7 @@ gio_search(device_t parent, cfdata_t cf,
 
 		ga->ga_slot = cf->cf_loc[GIOCF_SLOT];
 		ga->ga_addr = cf->cf_loc[GIOCF_ADDR];
-		ga->ga_iot = 0;
+		ga->ga_iot = normal_memt;
 		ga->ga_ioh = MIPS_PHYS_TO_KSEG1(ga->ga_addr);
 
 		if (config_match(parent, cf, ga) > 0)



CVS commit: src/sys/arch/sgimips/gio

2019-11-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Nov 21 22:05:09 UTC 2019

Modified Files:
src/sys/arch/sgimips/gio: gio.c

Log Message:
ga_iot = 0 -> normal_memt
now a Challenge S should work again
from George Harvey


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/sgimips/gio/gio.c

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



CVS commit: src/sys/arch/powerpc/powerpc

2019-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Nov 16 00:16:56 UTC 2019

Modified Files:
src/sys/arch/powerpc/powerpc: openfirm.c

Log Message:
fix pasto - don't limit OF_finddevice() to 32 characters
now this works again


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/powerpc/powerpc/openfirm.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/powerpc/powerpc/openfirm.c
diff -u src/sys/arch/powerpc/powerpc/openfirm.c:1.28 src/sys/arch/powerpc/powerpc/openfirm.c:1.29
--- src/sys/arch/powerpc/powerpc/openfirm.c:1.28	Fri Nov 15 23:41:47 2019
+++ src/sys/arch/powerpc/powerpc/openfirm.c	Sat Nov 16 00:16:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.c,v 1.28 2019/11/15 23:41:47 macallan Exp $	*/
+/*	$NetBSD: openfirm.c,v 1.29 2019/11/16 00:16:55 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -34,7 +34,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.28 2019/11/15 23:41:47 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.29 2019/11/16 00:16:55 macallan Exp $");
 
 #include 
 #include 
@@ -278,7 +278,7 @@ OF_finddevice(const char *name)
 	};
 
 	ofw_stack();
-	strncpy(OF_buf, name, 32);
+	strncpy(OF_buf, name, NBPG);
 	args.device = OF_buf;
 	if (openfirmware() == -1)
 		return -1;



CVS commit: src/sys/arch/powerpc/oea

2019-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 15 23:43:13 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: ofw_subr.S

Log Message:
bump OF_buf(fer) since we may put extra parameters in there


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/oea/ofw_subr.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/powerpc/oea/ofw_subr.S
diff -u src/sys/arch/powerpc/oea/ofw_subr.S:1.10 src/sys/arch/powerpc/oea/ofw_subr.S:1.11
--- src/sys/arch/powerpc/oea/ofw_subr.S:1.10	Wed Jul 27 22:04:23 2011
+++ src/sys/arch/powerpc/oea/ofw_subr.S	Fri Nov 15 23:43:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_subr.S,v 1.10 2011/07/27 22:04:23 macallan Exp $	*/
+/*	$NetBSD: ofw_subr.S,v 1.11 2019/11/15 23:43:12 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -39,7 +39,7 @@
 	.local	OF_buffer
 
 	.lcomm	firmstk,NBPG,16
-	.lcomm	OF_buffer,NBPG,4
+	.lcomm	OF_buffer,NBPG + 36,4
 	.comm	openfirmware_entry,4,4	/* openfirmware entry point */
 	.lcomm	ofwsrsave,64,4		/* openfirmware SR savearea */
 	.comm	ofwmsr,20,4		/* msr & sprg[0-3] used in OF */



CVS commit: src/sys/arch/powerpc/oea

2019-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 15 23:43:13 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: ofw_subr.S

Log Message:
bump OF_buf(fer) since we may put extra parameters in there


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/oea/ofw_subr.S

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



CVS commit: src/sys/arch/powerpc/powerpc

2019-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 15 23:41:47 UTC 2019

Modified Files:
src/sys/arch/powerpc/powerpc: openfirm.c

Log Message:
stuff name parameters into OF_buf before calling OF
now things like ofctl work on my TiBook with FIRMWORKSBUGS


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/powerpc/powerpc/openfirm.c

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



CVS commit: src/sys/arch/powerpc/powerpc

2019-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 15 23:41:47 UTC 2019

Modified Files:
src/sys/arch/powerpc/powerpc: openfirm.c

Log Message:
stuff name parameters into OF_buf before calling OF
now things like ofctl work on my TiBook with FIRMWORKSBUGS


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/powerpc/powerpc/openfirm.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/powerpc/powerpc/openfirm.c
diff -u src/sys/arch/powerpc/powerpc/openfirm.c:1.27 src/sys/arch/powerpc/powerpc/openfirm.c:1.28
--- src/sys/arch/powerpc/powerpc/openfirm.c:1.27	Tue Jan  8 07:46:11 2019
+++ src/sys/arch/powerpc/powerpc/openfirm.c	Fri Nov 15 23:41:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.c,v 1.27 2019/01/08 07:46:11 mrg Exp $	*/
+/*	$NetBSD: openfirm.c,v 1.28 2019/11/15 23:41:47 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -34,7 +34,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.27 2019/01/08 07:46:11 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.28 2019/11/15 23:41:47 macallan Exp $");
 
 #include 
 #include 
@@ -159,8 +159,9 @@ OF_getproplen(int handle, const char *pr
 	};
 
 	ofw_stack();
+	strncpy(OF_buf, prop, 32);
 	args.phandle = handle;
-	args.prop = prop;
+	args.prop = OF_buf;
 	if (openfirmware() == -1)
 		return -1;
 	return args.proplen;
@@ -187,16 +188,17 @@ OF_getprop(int handle, const char *prop,
 	ofw_stack();
 	if (buflen > PAGE_SIZE)
 		return -1;
+	strncpy(OF_buf, prop, 32);
 	args.phandle = handle;
-	args.prop = prop;
-	args.buf = OF_buf;
+	args.prop = OF_buf;
+	args.buf = _buf[33];
 	args.buflen = buflen;
 	if (openfirmware() == -1)
 		return -1;
 	if (args.size > buflen)
 		args.size = buflen;
 	if (args.size > 0)
-		ofbcopy(OF_buf, buf, args.size);
+		ofbcopy(_buf[33], buf, args.size);
 	return args.size;
 }
 
@@ -250,12 +252,13 @@ OF_nextprop(int handle, const char *prop
 	};
 
 	ofw_stack();
+	strncpy(OF_buf, prop, 32);
 	args.phandle = handle;
-	args.prop = prop;
-	args.buf = OF_buf;
+	args.prop = OF_buf;
+	args.buf = _buf[33];
 	if (openfirmware() == -1)
 		return -1;
-	strncpy(nextprop, OF_buf, 32);
+	strncpy(nextprop, _buf[33], 32);
 	return args.flag;
 }
 
@@ -275,7 +278,8 @@ OF_finddevice(const char *name)
 	};
 
 	ofw_stack();
-	args.device = name;
+	strncpy(OF_buf, name, 32);
+	args.device = OF_buf;
 	if (openfirmware() == -1)
 		return -1;
 	return args.phandle;



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

2019-11-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Nov 12 17:27:59 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: POWERMAC_G5_11_2

Log Message:
add missing usb at ehci
thanks Romain Dolbeau for noticing


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/macppc/conf/POWERMAC_G5_11_2

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/macppc/conf/POWERMAC_G5_11_2
diff -u src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.13 src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.14
--- src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.13	Wed Aug  1 20:04:12 2018
+++ src/sys/arch/macppc/conf/POWERMAC_G5_11_2	Tue Nov 12 17:27:59 2019
@@ -143,6 +143,7 @@ ohci*	at pci? dev ? function ?	# USB Ope
 ehci*	at pci? dev ? function ?	# USB Enhanced Host Controller
 
 usb*	at ohci?	# USB bus support
+usb*	at ehci?	# USB bus support
 uhub*	at usb?		# USB Hubs
 uhub*	at uhub? port ?
 uhidev*	at uhub? port ? configuration ? interface ?	# USB HID device



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

2019-11-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Nov 12 17:27:59 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: POWERMAC_G5_11_2

Log Message:
add missing usb at ehci
thanks Romain Dolbeau for noticing


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/macppc/conf/POWERMAC_G5_11_2

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



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

2019-11-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov  1 17:55:12 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: GENERIC

Log Message:
add psoc driver


To generate a diff of this commit:
cvs rdiff -u -r1.357 -r1.358 src/sys/arch/macppc/conf/GENERIC

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



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

2019-11-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov  1 17:55:12 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: GENERIC

Log Message:
add psoc driver


To generate a diff of this commit:
cvs rdiff -u -r1.357 -r1.358 src/sys/arch/macppc/conf/GENERIC

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

Modified files:

Index: src/sys/arch/macppc/conf/GENERIC
diff -u src/sys/arch/macppc/conf/GENERIC:1.357 src/sys/arch/macppc/conf/GENERIC:1.358
--- src/sys/arch/macppc/conf/GENERIC:1.357	Mon Sep 16 07:11:08 2019
+++ src/sys/arch/macppc/conf/GENERIC	Fri Nov  1 17:55:12 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.357 2019/09/16 07:11:08 macallan Exp $
+# $NetBSD: GENERIC,v 1.358 2019/11/01 17:55:12 macallan Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include		"arch/macppc/conf/std.macppc"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.357 $"
+#ident 		"GENERIC-$Revision: 1.358 $"
 
 maxusers	32
 
@@ -373,6 +373,7 @@ iic*	at ki2c?
 dbcool* 	at iic?		# dbCool thermal monitor & fan control
 deq* 		at iic?		# mixer/equalizer, used by snapper
 admtemp* 	at iic?		# temperature sensor found in Mini, G5
+psoc* 		at iic?		# fan controller found in TiBooks
 videopll*	at iic?		# for valkyriefb
 sgsmix* 	at iic?		# Additional mixer found in beige G3
 # use with awacs.



CVS commit: src/sys/arch/macppc

2019-11-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov  1 17:51:56 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: files.macppc
Added Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
the beginning of a driver for the 'Psoc' fan controller found in my 1GHz
TiBook. So far it does:
- initialize the fan controller via OF
- report temperatures to envsys
there is no documentation, only guesswork from looking at OF methods

With this my TiBook doesn't seem to overheat anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/macppc/conf/files.macppc
cvs rdiff -u -r0 -r1.1 src/sys/arch/macppc/dev/psoc.c

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



CVS commit: src/sys/arch/macppc

2019-11-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov  1 17:51:56 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: files.macppc
Added Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
the beginning of a driver for the 'Psoc' fan controller found in my 1GHz
TiBook. So far it does:
- initialize the fan controller via OF
- report temperatures to envsys
there is no documentation, only guesswork from looking at OF methods

With this my TiBook doesn't seem to overheat anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/macppc/conf/files.macppc
cvs rdiff -u -r0 -r1.1 src/sys/arch/macppc/dev/psoc.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/macppc/conf/files.macppc
diff -u src/sys/arch/macppc/conf/files.macppc:1.111 src/sys/arch/macppc/conf/files.macppc:1.112
--- src/sys/arch/macppc/conf/files.macppc:1.111	Wed May  8 13:40:15 2019
+++ src/sys/arch/macppc/conf/files.macppc	Fri Nov  1 17:51:56 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.macppc,v 1.111 2019/05/08 13:40:15 isaki Exp $
+#	$NetBSD: files.macppc,v 1.112 2019/11/01 17:51:56 macallan Exp $
 #
 # macppc-specific configuration info
 
@@ -312,3 +312,9 @@ defflag opt_valkyriefb.h VALKYRIEFB_DEBU
 device platinumfb: wsemuldisplaydev, rasops8, vcons, videomode
 attach platinumfb at mainbus
 file arch/macppc/dev/platinumfb.c			platinumfb
+
+# 'Psoc' fan controller found in (some?) TiBooks
+device	psoc: sysmon_envsys
+attach	psoc at iic
+file	arch/macppc/dev/psoc.cpsoc
+

Added files:

Index: src/sys/arch/macppc/dev/psoc.c
diff -u /dev/null src/sys/arch/macppc/dev/psoc.c:1.1
--- /dev/null	Fri Nov  1 17:51:56 2019
+++ src/sys/arch/macppc/dev/psoc.c	Fri Nov  1 17:51:56 2019
@@ -0,0 +1,206 @@
+ /* $NetBSD: psoc.c,v 1.1 2019/11/01 17:51:56 macallan Exp $ */
+
+/*-
+ * Copyright (c) 2018 Michael Lorenz
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE 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.
+ */
+
+/*
+ * fan controller found in 1GHz TiBook
+ *
+ * register values from OF:
+ * fan1 - 0x20 ( status ), 0x31 ( data)
+ * fan2 - 0x26 ( status ), 0x45 ( data )
+ * fan3 - 0x59
+ * temperature sensors start at 6, two bytes each, first appears to be
+ * the temperature in degrees Celsius
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.1 2019/11/01 17:51:56 macallan Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+
+struct psoc_softc {
+	device_t	sc_dev;
+	i2c_tag_t	sc_i2c;
+	i2c_addr_t	sc_addr;
+	int		sc_node;
+
+	struct sysmon_envsys *sc_sme;
+	envsys_data_t	sc_sensors[7];
+	int		sc_nsensors;
+	uint8_t		sc_temp[16];
+	time_t		sc_last;
+};
+
+static int	psoc_match(device_t, cfdata_t, void *);
+static void	psoc_attach(device_t, device_t, void *);
+
+static void	psoc_sensors_refresh(struct sysmon_envsys *, envsys_data_t *);
+
+CFATTACH_DECL_NEW(psoc, sizeof(struct psoc_softc),
+psoc_match, psoc_attach, NULL, NULL);
+
+static const struct device_compatible_entry compat_data[] = {
+	{ "Psoc",		0 },
+	{ NULL,			0 }
+};
+
+static int
+psoc_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;
+
+	return 0;
+}
+
+static void
+psoc_attach(device_t parent, device_t self, void *aux)
+{
+	struct psoc_softc *sc = device_private(self);
+	struct i2c_attach_args *ia = aux;
+	char path[256];
+	envsys_data_t *s;
+	int error, ih, r;
+
+	sc->sc_dev = self;
+	sc->sc_i2c = ia->ia_tag;
+	sc->sc_addr = ia->ia_addr;
+	sc->sc_n

CVS commit: src/sys/arch/powerpc/oea

2019-10-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Oct 25 17:17:30 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
register the IPI before spinning up CPUs, and make sure to do it exactly once
with this, and previous commits, G5s with four CPUs work
tested by Romain Dolbeau


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/powerpc/oea/cpu_subr.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/powerpc/oea/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.101 src/sys/arch/powerpc/oea/cpu_subr.c:1.102
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.101	Fri Sep 20 21:27:29 2019
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Oct 25 17:17:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.101 2019/09/20 21:27:29 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.102 2019/10/25 17:17:30 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.101 2019/09/20 21:27:29 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.102 2019/10/25 17:17:30 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -452,6 +452,12 @@ cpu_attach_common(device_t self, int id)
 	ci->ci_dev = self;
 	ci->ci_idlespin = cpu_idlespin;
 
+#ifdef MULTIPROCESSOR
+	/* Register IPI Interrupt */
+	if ((ipiops.ppc_establish_ipi) && (id == 0))
+		ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL);
+#endif
+
 	pvr = mfpvr();
 	vers = (pvr >> 16) & 0x;
 
@@ -1408,10 +1414,6 @@ cpu_spinup(device_t self, struct cpu_inf
 		return -1;
 	}
 
-	/* Register IPI Interrupt */
-	if (ipiops.ppc_establish_ipi)
-		ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL);
-
 	return 0;
 }
 



CVS commit: src/sys/arch/powerpc/oea

2019-10-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Oct 25 17:17:30 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
register the IPI before spinning up CPUs, and make sure to do it exactly once
with this, and previous commits, G5s with four CPUs work
tested by Romain Dolbeau


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/powerpc/oea/cpu_subr.c

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



CVS commit: src/sys/arch/macppc/macppc

2019-10-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Oct 24 23:06:25 UTC 2019

Modified Files:
src/sys/arch/macppc/macppc: mainbus.c

Log Message:
if we have a /cpus node, use it to find and attach all CPUs.
Now we find all CPUs on a 4x G5.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/macppc/macppc/mainbus.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/macppc/macppc/mainbus.c
diff -u src/sys/arch/macppc/macppc/mainbus.c:1.21 src/sys/arch/macppc/macppc/mainbus.c:1.22
--- src/sys/arch/macppc/macppc/mainbus.c:1.21	Sun Jun  5 17:03:16 2011
+++ src/sys/arch/macppc/macppc/mainbus.c	Thu Oct 24 23:06:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.21 2011/06/05 17:03:16 matt Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.22 2019/10/24 23:06:25 macallan Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.21 2011/06/05 17:03:16 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.22 2019/10/24 23:06:25 macallan Exp $");
 
 #include 
 #include 
@@ -67,17 +67,29 @@ mainbus_attach(device_t parent, device_t
 {
 	struct ofbus_attach_args oba;
 	struct confargs ca;
-	int node, i;
+	int node, cpus, i;
 	u_int32_t reg[4];
 	char name[32];
 
 	printf("\n");
 
-	for (i = 0; i < 2; i++) {
-		ca.ca_name = "cpu";
-		ca.ca_reg = reg;
-		reg[0] = i;
-		config_found(self, , NULL);
+	cpus = OF_finddevice("/cpus");
+	if (cpus != 0) {
+		node = OF_child(cpus);
+		while (node != 0) {
+			ca.ca_name = "cpu";
+			ca.ca_reg = reg;
+			ca.ca_nreg = OF_getprop(node, "reg", reg, sizeof(reg));
+			config_found(self, , NULL);
+			node = OF_peer(node);
+		}			
+	} else {
+		for (i = 0; i < 2; i++) {
+			ca.ca_name = "cpu";
+			ca.ca_reg = reg;
+			reg[0] = i;
+			config_found(self, , NULL);
+		}
 	}
 
 	pic_finish_setup();



CVS commit: src/sys/arch/macppc/macppc

2019-10-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Oct 24 23:06:25 UTC 2019

Modified Files:
src/sys/arch/macppc/macppc: mainbus.c

Log Message:
if we have a /cpus node, use it to find and attach all CPUs.
Now we find all CPUs on a 4x G5.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/macppc/macppc/mainbus.c

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



CVS commit: src/sys/arch/macppc/include

2019-10-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Oct 24 23:04:46 UTC 2019

Modified Files:
src/sys/arch/macppc/include: cpu.h

Log Message:
bump CPU_MAXNUM to 4, hardware exists and is being asked about on port-macppc@


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/macppc/include/cpu.h

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



CVS commit: src/sys/arch/macppc/include

2019-10-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Oct 24 23:04:46 UTC 2019

Modified Files:
src/sys/arch/macppc/include: cpu.h

Log Message:
bump CPU_MAXNUM to 4, hardware exists and is being asked about on port-macppc@


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/macppc/include/cpu.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/macppc/include/cpu.h
diff -u src/sys/arch/macppc/include/cpu.h:1.20 src/sys/arch/macppc/include/cpu.h:1.21
--- src/sys/arch/macppc/include/cpu.h:1.20	Fri Mar 16 22:08:53 2018
+++ src/sys/arch/macppc/include/cpu.h	Thu Oct 24 23:04:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.20 2018/03/16 22:08:53 macallan Exp $	*/
+/*	$NetBSD: cpu.h,v 1.21 2019/10/24 23:04:46 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995-1997 Wolfgang Solfrank.
@@ -34,7 +34,7 @@
 #define	_MACPPC_CPU_H_
 
 #if defined(_KERNEL) && !defined(_MODULE)
-#define	CPU_MAXNUM	2
+#define	CPU_MAXNUM	4
 extern char bootpath[];
 int get_cpuid(int, uint8_t *);
 #endif /* _KERNEL */



CVS commit: src/sys/arch/powerpc/include

2019-10-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Oct 24 23:03:35 UTC 2019

Modified Files:
src/sys/arch/powerpc/include: intr.h

Log Message:
bump NIRQ to 256 since we're going to use vectors above 128


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/include/intr.h

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



CVS commit: src/sys/arch/powerpc/include

2019-10-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Oct 24 23:03:35 UTC 2019

Modified Files:
src/sys/arch/powerpc/include: intr.h

Log Message:
bump NIRQ to 256 since we're going to use vectors above 128


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/include/intr.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/powerpc/include/intr.h
diff -u src/sys/arch/powerpc/include/intr.h:1.13 src/sys/arch/powerpc/include/intr.h:1.14
--- src/sys/arch/powerpc/include/intr.h:1.13	Thu Apr 19 21:50:07 2018
+++ src/sys/arch/powerpc/include/intr.h	Thu Oct 24 23:03:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.13 2018/04/19 21:50:07 christos Exp $ */
+/*	$NetBSD: intr.h,v 1.14 2019/10/24 23:03:35 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -28,7 +28,7 @@
 
 #ifndef _LOCORE
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.h,v 1.13 2018/04/19 21:50:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.h,v 1.14 2019/10/24 23:03:35 macallan Exp $");
 #endif
 
 #ifndef _POWERPC_INTR_MACHDEP_H_
@@ -105,7 +105,7 @@ extern imask_t imask[];
 
 #define NVIRQ		(sizeof(imask_t)*8)	/* 32 virtual IRQs */
 #ifndef NIRQ
-#define NIRQ		128	/* up to 128 HW IRQs */
+#define NIRQ		256	/* up to 256 HW IRQs */
 #endif
 
 #define HWIRQ_MAX   (NVIRQ - 1)



CVS commit: src/sys/arch/macppc/macppc

2019-10-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Oct 11 21:56:55 UTC 2019

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

Log Message:
don't zero the MSR when building with options FIRMWORKSBUGS
with this a FIRMWORKSBUGS kernel boots on my TiBook
first step to address PR2231


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/macppc/macppc/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/macppc/macppc/locore.S
diff -u src/sys/arch/macppc/macppc/locore.S:1.73 src/sys/arch/macppc/macppc/locore.S:1.74
--- src/sys/arch/macppc/macppc/locore.S:1.73	Sun Jul 15 05:16:43 2018
+++ src/sys/arch/macppc/macppc/locore.S	Fri Oct 11 21:56:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.73 2018/07/15 05:16:43 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.74 2019/10/11 21:56:55 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -87,7 +87,9 @@ __start:
 	bl	_C_LABEL(cpu_model_init)	/* init oeacpufeat */
 
 	li	0,0
+#ifndef FIRMWORKSBUGS
 	mtmsr	0			/* Disable FPU/MMU/exceptions */
+#endif
 #if defined(PMAP_OEA64_BRIDGE)
 	mfmsr	0			/* Clear SF and ISF bits */
 	clrldi	0,0,3



CVS commit: src/sys/arch/macppc/macppc

2019-10-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Oct 11 21:56:55 UTC 2019

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

Log Message:
don't zero the MSR when building with options FIRMWORKSBUGS
with this a FIRMWORKSBUGS kernel boots on my TiBook
first step to address PR2231


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/macppc/macppc/locore.S

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



CVS commit: src/sys/dev/i2c

2019-09-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep 29 05:35:29 UTC 2019

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

Log Message:
appease -Werror=stack-protector by avoiding variable sized arrays
Now this builds and works on sparc64


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/i2c/ds1307.c

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



CVS commit: src/sys/dev/i2c

2019-09-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep 29 05:35:29 UTC 2019

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

Log Message:
appease -Werror=stack-protector by avoiding variable sized arrays
Now this builds and works on sparc64


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/i2c/ds1307.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/ds1307.c
diff -u src/sys/dev/i2c/ds1307.c:1.32 src/sys/dev/i2c/ds1307.c:1.33
--- src/sys/dev/i2c/ds1307.c:1.32	Sun Sep 29 05:28:21 2019
+++ src/sys/dev/i2c/ds1307.c	Sun Sep 29 05:35:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ds1307.c,v 1.32 2019/09/29 05:28:21 macallan Exp $	*/
+/*	$NetBSD: ds1307.c,v 1.33 2019/09/29 05:35:29 macallan Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.32 2019/09/29 05:28:21 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.33 2019/09/29 05:35:29 macallan Exp $");
 
 #include 
 #include 
@@ -775,8 +775,9 @@ static int
 dsrtc_clock_write_timeval(struct dsrtc_softc *sc, time_t t)
 {
 	const struct dsrtc_model * const dm = >sc_model;
-	size_t buflen = dm->dm_rtc_size + 2; 
-	uint8_t buf[buflen];
+	size_t buflen = dm->dm_rtc_size + 2;
+	/* XXX: the biggest dm_rtc_size we have now is 7, so we should be ok */ 
+	uint8_t buf[16];
 	int error;
 
 	KASSERT((dm->dm_flags & DSRTC_FLAG_CLOCK_HOLD) == 0);



CVS commit: src/sys/dev/i2c

2019-09-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep 29 05:28:21 UTC 2019

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

Log Message:
add another matchstring for the ds1307 found in Sun Fire V210 ( and probably
V240 )


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/i2c/ds1307.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/ds1307.c
diff -u src/sys/dev/i2c/ds1307.c:1.31 src/sys/dev/i2c/ds1307.c:1.32
--- src/sys/dev/i2c/ds1307.c:1.31	Thu Dec 20 21:36:53 2018
+++ src/sys/dev/i2c/ds1307.c	Sun Sep 29 05:28:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ds1307.c,v 1.31 2018/12/20 21:36:53 macallan Exp $	*/
+/*	$NetBSD: ds1307.c,v 1.32 2019/09/29 05:28:21 macallan Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.31 2018/12/20 21:36:53 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.32 2019/09/29 05:28:21 macallan Exp $");
 
 #include 
 #include 
@@ -159,6 +159,7 @@ static const struct dsrtc_model mcp7940_
 static const struct device_compatible_entry compat_data[] = {
 	{ "dallas,ds1307",		(uintptr_t)_model },
 	{ "maxim,ds1307",		(uintptr_t)_model },
+	{ "i2c-ds1307",			(uintptr_t)_model },
 
 	{ "dallas,ds1339",		(uintptr_t)_model },
 	{ "maxim,ds1339",		(uintptr_t)_model },



CVS commit: src/sys/dev/i2c

2019-09-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep 29 05:28:21 UTC 2019

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

Log Message:
add another matchstring for the ds1307 found in Sun Fire V210 ( and probably
V240 )


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/i2c/ds1307.c

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



CVS commit: src/sys/arch/powerpc/oea

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 21:27:29 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
don't enable NAP mode on 7450 CPUs - my Quicksilver has two of those and we
hang hard shortly after boot with NAP enabled, even on UP kernels


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/oea/cpu_subr.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/powerpc/oea/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.100 src/sys/arch/powerpc/oea/cpu_subr.c:1.101
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.100	Fri Aug  2 05:08:07 2019
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Sep 20 21:27:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.100 2019/08/02 05:08:07 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.101 2019/09/20 21:27:29 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.100 2019/08/02 05:08:07 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.101 2019/09/20 21:27:29 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -584,8 +584,11 @@ cpu_setup(device_t self, struct cpu_info
 			hid0 &= ~HID0_BTIC;
 		/* Select NAP mode. */
 		hid0 &= ~HID0_SLEEP;
-		hid0 |= HID0_NAP | HID0_DPM;
-		powersave = 1;
+		/* XXX my quicksilver hangs if nap is enabled */
+		if (vers != MPC7450) {
+			hid0 |= HID0_NAP | HID0_DPM;
+			powersave = 1;
+		}
 		break;
 #endif
 



CVS commit: src/sys/arch/powerpc/oea

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 21:27:29 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
don't enable NAP mode on 7450 CPUs - my Quicksilver has two of those and we
hang hard shortly after boot with NAP enabled, even on UP kernels


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/oea/cpu_subr.c

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



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

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 21:24:34 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
various minor fixes and updates:
- add (very) basic ONYX support. Treat as 16bit codec with software volume
  control. Makes basic audio work on PCIe G5
- correctly detect TAS3001 without 'compatible' property, now this works on
  Quicksilver
- mute line input on TAS3001 - it's unconnected on Quicksilver and causes noise
- make more of an effort to match codecs to i2sbus instances, needed on G5 and
  some other models with software 'modems'


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/macppc/dev/snapper.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/macppc/dev/snapper.c
diff -u src/sys/arch/macppc/dev/snapper.c:1.52 src/sys/arch/macppc/dev/snapper.c:1.53
--- src/sys/arch/macppc/dev/snapper.c:1.52	Sat Jun  8 08:02:37 2019
+++ src/sys/arch/macppc/dev/snapper.c	Fri Sep 20 21:24:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.52 2019/06/08 08:02:37 isaki Exp $	*/
+/*	$NetBSD: snapper.c,v 1.53 2019/09/20 21:24:34 macallan Exp $	*/
 /*	Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp	*/
 /*	Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp		*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.52 2019/06/08 08:02:37 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.53 2019/09/20 21:24:34 macallan Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: snapper.c,v 
 
 #include 
 #include 
-
+//#define SNAPPER_DEBUG
 #ifdef SNAPPER_DEBUG
 # define DPRINTF printf
 #else
@@ -66,9 +66,12 @@ __KERNEL_RCSID(0, "$NetBSD: snapper.c,v 
 
 struct snapper_softc {
 	device_t sc_dev;
-	int sc_mode;		  // 0 for TAS3004
+	int sc_mode;
+#define SNAPPER_IS_TAS3004	0 // codec is TAS3004
 #define SNAPPER_IS_TAS3001	1 // codec is TAS3001
-#define SNAPPER_SWVOL		2 // software codec
+#define SNAPPER_IS_PCM3052	2 // codec is PCM3052
+#define SNAPPER_IS_CS8416	3 // codec is CS8416
+#define SNAPPER_SWVOL		4 // software codec
 	
 	int sc_node;
 
@@ -475,6 +478,21 @@ static const struct audio_format tumbler
 };
 #define TUMBLER_NFORMATS	__arraycount(tumbler_formats)
 
+/* OF hands us the codec in 16bit mode, run with it for now */
+static const struct audio_format onyx_formats[] = {
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_SLINEAR_BE,
+		.validbits	= 16,
+		.precision	= 16,
+		.channels	= 2,
+		.channel_mask	= AUFMT_STEREO,
+		.frequency_type	= 3,
+		.frequency	= { 44100, 48000, 96000 },
+	},
+};
+#define ONYX_NFORMATS	__arraycount(onyx_formats)
+
 static bus_size_t amp_mute;
 static bus_size_t headphone_mute;
 static bus_size_t audio_hw_reset;
@@ -492,6 +510,16 @@ static uint8_t headphone_detect_active;
 /* I2S_INT register definitions */
 #define I2S_INT_CLKSTOPPEND 0x0100  /* clock-stop interrupt pending */
 
+/* I2S_WORDSIZE register definitions */
+#define INPUT_STEREO(2 << 24)
+#define INPUT_MONO  (1 << 24)
+#define INPUT_16BIT (0 << 16)
+#define INPUT_24BIT (3 << 16)
+#define OUTPUT_STEREO   (2 << 8)
+#define OUTPUT_MONO (1 << 8)
+#define OUTPUT_16BIT(0 << 0)
+#define OUTPUT_24BIT(3 << 0)
+
 /* FCR(0x3c) bits */
 #define KEYLARGO_FCR1   0x3c
 #define  I2S0CLKEN  0x1000
@@ -639,6 +667,9 @@ snapper_match(device_t parent, struct cf
 	if (strcmp(compat, "AOAK2") == 0)
 		return 1;
 		
+	if (strcmp(compat, "AOAbase") == 0)
+		return 1;
+
 	if (OF_getprop(soundchip, "platform-tas-codec-ref",
 	, sizeof soundcodec) == sizeof soundcodec)
 		return 1;
@@ -664,6 +695,8 @@ snapper_attach(device_t parent, device_t
 	memset(compat, 0, sizeof compat);
 	OF_getprop(OF_child(soundbus), "compatible", compat, sizeof compat);
 
+	sc->sc_mode = SNAPPER_IS_TAS3004;
+
 	if (strcmp(compat, "tumbler") == 0)
 		sc->sc_mode = SNAPPER_IS_TAS3001;
 	sc->sc_swvol_l = 255;
@@ -718,8 +751,8 @@ snapper_attach(device_t parent, device_t
 	oirq = intr[2];
 	iirq = intr[4];
 	/* cirq_type = intr[1] ? IST_LEVEL : IST_EDGE; */
-	oirq_type = intr[3] ? IST_LEVEL : IST_EDGE;
-	iirq_type = intr[5] ? IST_LEVEL : IST_EDGE;
+	oirq_type = (intr[3] & 1) ? IST_LEVEL : IST_EDGE;
+	iirq_type = (intr[5] & 1) ? IST_LEVEL : IST_EDGE;
 
 	/* intr_establish(cirq, cirq_type, IPL_AUDIO, snapper_intr, sc); */
 	intr_establish(oirq, oirq_type, IPL_AUDIO, snapper_intr, sc);
@@ -743,25 +776,79 @@ snapper_defer(device_t dev)
 	device_t dv;
 	deviter_t di;
 	struct deq_softc *deq;
+	char prop[64], next[64], codec[64], *cref;
+	int codec_node, soundbus, sound, ok, deqnode = 0;
 	
 	sc = device_private(dev);
+
+	/* look for platform-*-codec-ref node */
+
+	/*
+	 * XXX
+	 * there can be more than one i2sbus, the one we want just so happens
+	 * to be the first we see
+	 */
+	soundbus = 

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

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 21:24:34 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
various minor fixes and updates:
- add (very) basic ONYX support. Treat as 16bit codec with software volume
  control. Makes basic audio work on PCIe G5
- correctly detect TAS3001 without 'compatible' property, now this works on
  Quicksilver
- mute line input on TAS3001 - it's unconnected on Quicksilver and causes noise
- make more of an effort to match codecs to i2sbus instances, needed on G5 and
  some other models with software 'modems'


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/macppc/dev/snapper.c

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



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

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 17:25:11 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: deq.c

Log Message:
identify TAS3001 from i2c address if there is no 'compatible' property


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/macppc/dev/deq.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/macppc/dev/deq.c
diff -u src/sys/arch/macppc/dev/deq.c:1.16 src/sys/arch/macppc/dev/deq.c:1.17
--- src/sys/arch/macppc/dev/deq.c:1.16	Tue Jun 26 06:03:57 2018
+++ src/sys/arch/macppc/dev/deq.c	Fri Sep 20 17:25:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: deq.c,v 1.16 2018/06/26 06:03:57 thorpej Exp $	*/
+/*	$NetBSD: deq.c,v 1.17 2019/09/20 17:25:11 macallan Exp $	*/
 
 /*-
  * Copyright (C) 2005 Michael Lorenz
@@ -32,7 +32,7 @@
  */
  
 #include 
-__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.16 2018/06/26 06:03:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.17 2019/09/20 17:25:11 macallan Exp $");
 
 #include 
 #include 
@@ -88,11 +88,14 @@ deq_attach(device_t parent, device_t sel
 	sc->sc_address = ia->ia_addr;
 	sc->sc_i2c = ia->ia_tag;
 	if (OF_getprop(sc->sc_node, "compatible", name, 256) <= 0) {
-		/* deq has no 'compatible' on my iBook G4 */
+		/* deq has no 'compatible' on my iBook G4 or Quicksilver */
 		switch (sc->sc_address) {
 			case 0x35:
 strcpy(name, "tas3004");
 break;
+			case 0x34:
+strcpy(name, "tas3001");
+break;
 			default:
 strcpy(name, "unknown");
 		}



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

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 17:25:11 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: deq.c

Log Message:
identify TAS3001 from i2c address if there is no 'compatible' property


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/macppc/dev/deq.c

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



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

2019-09-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Sep 16 07:11:09 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: GENERIC POWERMAC

Log Message:
add ktm at adb driver


To generate a diff of this commit:
cvs rdiff -u -r1.356 -r1.357 src/sys/arch/macppc/conf/GENERIC
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/macppc/conf/POWERMAC

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/macppc/conf/GENERIC
diff -u src/sys/arch/macppc/conf/GENERIC:1.356 src/sys/arch/macppc/conf/GENERIC:1.357
--- src/sys/arch/macppc/conf/GENERIC:1.356	Sat Apr 27 02:00:12 2019
+++ src/sys/arch/macppc/conf/GENERIC	Mon Sep 16 07:11:08 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.356 2019/04/27 02:00:12 sevan Exp $
+# $NetBSD: GENERIC,v 1.357 2019/09/16 07:11:08 macallan Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include		"arch/macppc/conf/std.macppc"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.356 $"
+#ident 		"GENERIC-$Revision: 1.357 $"
 
 maxusers	32
 
@@ -349,6 +349,7 @@ pmu*	at obio?		# PMU, *Books and newer P
 nadb*	at adb_bus?		# ADB bus enumerator, at cuda or pmu
 adbkbd* at nadb?		# ADB keyboard
 adbms*	at nadb?		# ADB mice and touchpads
+ktm* 	at nadb?		# Kensington Turbo Mouse
 adbbt*	at nadb?		# button device found on *Books
 
 wskbd*		at wskbddev? console ?

Index: src/sys/arch/macppc/conf/POWERMAC
diff -u src/sys/arch/macppc/conf/POWERMAC:1.70 src/sys/arch/macppc/conf/POWERMAC:1.71
--- src/sys/arch/macppc/conf/POWERMAC:1.70	Wed Aug  1 20:04:12 2018
+++ src/sys/arch/macppc/conf/POWERMAC	Mon Sep 16 07:11:08 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: POWERMAC,v 1.70 2018/08/01 20:04:12 maxv Exp $
+#	$NetBSD: POWERMAC,v 1.71 2019/09/16 07:11:08 macallan Exp $
 #
 # POWERMAC config file
 #
@@ -106,6 +106,7 @@ adbkbd* at nadb?			# ADB keyboard
 #options 	ADB_DEBUG
 #options 	ADBKBD_DEBUG
 adbms*	at nadb?
+ktm* 	at nadb?			# Kensington Turbo Mouse
 
 wskbd*	at wskbddev? console ?
 wsmouse* at wsmousedev?



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

2019-09-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Sep 16 07:11:09 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: GENERIC POWERMAC

Log Message:
add ktm at adb driver


To generate a diff of this commit:
cvs rdiff -u -r1.356 -r1.357 src/sys/arch/macppc/conf/GENERIC
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/macppc/conf/POWERMAC

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



CVS commit: src/sys/dev/adb

2019-09-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep 15 16:16:36 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ktm.c

Log Message:
fix non-debug build


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/adb/adb_ktm.c

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



CVS commit: src/sys/dev/adb

2019-09-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep 15 16:16:36 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ktm.c

Log Message:
fix non-debug build


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/adb/adb_ktm.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/adb/adb_ktm.c
diff -u src/sys/dev/adb/adb_ktm.c:1.1 src/sys/dev/adb/adb_ktm.c:1.2
--- src/sys/dev/adb/adb_ktm.c:1.1	Sun Sep  8 05:55:15 2019
+++ src/sys/dev/adb/adb_ktm.c	Sun Sep 15 16:16:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ktm.c,v 1.1 2019/09/08 05:55:15 macallan Exp $	*/
+/*	$NetBSD: adb_ktm.c,v 1.2 2019/09/15 16:16:36 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2019 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ktm.c,v 1.1 2019/09/08 05:55:15 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ktm.c,v 1.2 2019/09/15 16:16:36 macallan Exp $");
 
 #include 
 #include 
@@ -175,7 +175,6 @@ ktm_init(struct ktm_softc *sc)
 {
 	const struct sysctlnode *me = NULL, *node = NULL;
 	int ret;
-	uint8_t addr;
 
 	/* Found Kensington Turbo Mouse */
 
@@ -212,7 +211,6 @@ ktm_init(struct ktm_softc *sc)
 	/* this seems to be the most reasonable default */
 	uint8_t data[8] = { 0xa5, 0x0e, 0, 0, 1, 0xff, 0xff, 0 };
 
-	addr = sc->sc_adbdev->current_addr;
 	memcpy(sc->sc_config, data, sizeof(data));
 
 	sc->sc_left = 1;
@@ -221,6 +219,7 @@ ktm_init(struct ktm_softc *sc)
 	ktm_buttons(sc);
 
 #ifdef KTM_DEBUG
+	int addr = sc->sc_adbdev->current_addr;
 	{
 		int i;
 		ktm_send_sync(sc, ADBTALK(addr, 2), 0, NULL);



CVS commit: src/sys/dev/adb

2019-09-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep  8 05:55:15 UTC 2019

Modified Files:
src/sys/dev/adb: files.adb
Added Files:
src/sys/dev/adb: adb_ktm.c

Log Message:
add driver for Kensington Turbo Mouse ( actually a trackball )
the adbms driver contains basic support, this driver lets you program the
buttons, I'll add other features once I figure out how they work


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/adb/adb_ktm.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/adb/files.adb

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



CVS commit: src/sys/dev/adb

2019-09-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep  8 05:55:15 UTC 2019

Modified Files:
src/sys/dev/adb: files.adb
Added Files:
src/sys/dev/adb: adb_ktm.c

Log Message:
add driver for Kensington Turbo Mouse ( actually a trackball )
the adbms driver contains basic support, this driver lets you program the
buttons, I'll add other features once I figure out how they work


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/adb/adb_ktm.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/adb/files.adb

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/adb/files.adb
diff -u src/sys/dev/adb/files.adb:1.8 src/sys/dev/adb/files.adb:1.9
--- src/sys/dev/adb/files.adb:1.8	Thu Jun  6 20:59:58 2019
+++ src/sys/dev/adb/files.adb	Sun Sep  8 05:55:15 2019
@@ -1,5 +1,5 @@
 # 
-#	$NetBSD: files.adb,v 1.8 2019/06/06 20:59:58 macallan Exp $
+#	$NetBSD: files.adb,v 1.9 2019/09/08 05:55:15 macallan Exp $
 #
 # Apple Desktop Bus protocol and drivers
 
@@ -8,6 +8,7 @@ defflag	adbdebug.h	ADBKBD_DEBUG
 defflag	adbdebug.h	ADBMS_DEBUG
 defflag	adbdebug.h	ADBBT_DEBUG
 defflag adbdebug.h	ADBKBD_POWER_DDB
+defflag	adbdebug.h	KTM_DEBUG
 
 define adb_bus {}
 
@@ -28,3 +29,7 @@ file dev/adb/adb_bt.c		adbbt
 device adbms : wsmousedev
 attach adbms at nadb
 file dev/adb/adb_ms.c		adbms needs-flag
+
+device ktm : wsmousedev
+attach ktm at nadb
+file dev/adb/adb_ktm.c		ktm needs-flag

Added files:

Index: src/sys/dev/adb/adb_ktm.c
diff -u /dev/null src/sys/dev/adb/adb_ktm.c:1.1
--- /dev/null	Sun Sep  8 05:55:15 2019
+++ src/sys/dev/adb/adb_ktm.c	Sun Sep  8 05:55:15 2019
@@ -0,0 +1,486 @@
+/*	$NetBSD: adb_ktm.c,v 1.1 2019/09/08 05:55:15 macallan Exp $	*/
+
+/*-
+ * Copyright (c) 2019 Michael Lorenz
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE 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: adb_ktm.c,v 1.1 2019/09/08 05:55:15 macallan Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "adbdebug.h"
+
+#ifdef KTM_DEBUG
+#define DPRINTF printf
+#else
+#define DPRINTF while (0) printf
+#endif
+
+/*
+ * State info, per mouse instance.
+ */
+struct ktm_softc {
+	device_t	sc_dev;
+	struct adb_device *sc_adbdev;
+	struct adb_bus_accessops *sc_ops;
+
+	uint8_t		sc_us;		/* cmd to watch for */
+	device_t	sc_wsmousedev;
+	/* buffers */
+	uint8_t		sc_config[8];
+	int		sc_left;
+	int		sc_right;
+	int		sc_poll;
+	int		sc_msg_len;
+	int		sc_event;
+	uint8_t		sc_buffer[16];
+};
+
+/*
+ * Function declarations.
+ */
+static int	ktm_match(device_t, cfdata_t, void *);
+static void	ktm_attach(device_t, device_t, void *);
+static void	ktm_init(struct ktm_softc *);
+static void	ktm_write_config(struct ktm_softc *);
+static void	ktm_buttons(struct ktm_softc *);
+static void	ktm_process_event(struct ktm_softc *, int, uint8_t *);
+static int	ktm_send_sync(struct ktm_softc *, uint8_t, int, uint8_t *);
+
+/* Driver definition. */
+CFATTACH_DECL_NEW(ktm, sizeof(struct ktm_softc),
+ktm_match, ktm_attach, NULL, NULL);
+
+static int ktm_enable(void *);
+static int ktm_ioctl(void *, u_long, void *, int, struct lwp *);
+static void ktm_disable(void *);
+
+static void ktm_handler(void *, int, uint8_t *);
+static int  ktm_wait(struct ktm_softc *, int);
+static int  sysctl_ktm_left(SYSCTLFN_ARGS);
+static int  sysctl_ktm_right(SYSCTLFN_ARGS);
+
+const struct wsmouse_accessops ktm_accessops = {
+	ktm_enable,
+	ktm_ioctl,
+	ktm_disable,
+};
+
+static int
+ktm_match(device_t parent, cfdata_t cf, void *aux)
+{
+	struct adb_attach_args *aaa = 

CVS commit: src/sys/dev/adb

2019-09-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Sep  5 21:29:22 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ms.c

Log Message:
now that I figured out how the checksum for the Kensington Turbo Mouse's
init command works:
- document it
- calculate the checksum instead of hardcoding it, so the init command can be
  easily changed
- drop the first init string - it's entirely overwritten by the 2nd
- remove some debug goop


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/adb/adb_ms.c

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



CVS commit: src/sys/dev/adb

2019-09-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Sep  5 21:29:22 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ms.c

Log Message:
now that I figured out how the checksum for the Kensington Turbo Mouse's
init command works:
- document it
- calculate the checksum instead of hardcoding it, so the init command can be
  easily changed
- drop the first init string - it's entirely overwritten by the 2nd
- remove some debug goop


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/adb/adb_ms.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/adb/adb_ms.c
diff -u src/sys/dev/adb/adb_ms.c:1.18 src/sys/dev/adb/adb_ms.c:1.19
--- src/sys/dev/adb/adb_ms.c:1.18	Sat Aug 31 02:14:51 2019
+++ src/sys/dev/adb/adb_ms.c	Thu Sep  5 21:29:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ms.c,v 1.18 2019/08/31 02:14:51 macallan Exp $	*/
+/*	$NetBSD: adb_ms.c,v 1.19 2019/09/05 21:29:22 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.18 2019/08/31 02:14:51 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.19 2019/09/05 21:29:22 macallan Exp $");
 
 #include 
 #include 
@@ -320,6 +320,16 @@ adbms_init_uspeed(struct adbms_softc *sc
 	sc->sc_res = 200;
 }
 
+static int
+adbms_turbo_csum(uint8_t *d)
+{
+	int i = 0, sum = 0;
+
+	for (i = 0; i < 7; i++)
+		sum ^= d[i];
+	return (sum ^ 0xff);
+}
+
 static void
 adbms_init_turbo(struct adbms_softc *sc)
 {
@@ -343,22 +353,13 @@ adbms_init_turbo(struct adbms_softc *sc)
  - 0x21 - button 1 - 2, button 2 - 1
  - 0x31 - button 1 - 3, button 2 - 1
  * byte 4 programs a delay for button presses, apparently in 1/100 seconds
- * byte 7 is some sort of checksum, writes will only stick if it's valid
-  no idea how exactly it works yet, can't be too complicated considering
-  the device's age
+ * byte 7 is a simple XOR checksum, writes will only stick if it's valid
+  as in, b[7] = (b[0] ^ b[1] ^ ... ^ b[6]) ^ 0xff
  */
  
-/*
- * XXX
- * I doubt the first command is actually necessary. Leave in for now since it 
- * doesn't do any harm either
- */
-	static u_char data1[] =
-		{ 0xe7, 0x8c, 0, 0, 0, 0xff, 0xff, 0x94 };
-
 	/* this seems to be the most reasonable default */
-	static u_char data2[] =
-		{ 0xa5, 0x0e, 0, 0, 1, 0xff, 0xff, 0x55 };
+	static u_char data[] =
+		{ 0xa5, 0x0e, 0, 0, 1, 0xff, 0xff, 0/*0x55*/ };
 
 	addr = sc->sc_adbdev->current_addr;
 
@@ -374,23 +375,9 @@ adbms_init_turbo(struct adbms_softc *sc)
 #endif
 
 	adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
-	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data1);
-	adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
-	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data2);
+	data[7] = adbms_turbo_csum(data);
+	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data);
 
-#ifdef ADBMS_BRUTEFORCE
-	sc->sc_buffer[1] = 0;
-	int y = 0;
-	while ((sc->sc_buffer[1] != data2[1]) && (y < 0x100)) {
-		data2[7] = y;
-		y++;
-		adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
-		adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data2);
-		adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
-		adbms_send_sync(sc, ADBTALK(addr, 2), 0, NULL);
-	}
-	printf("y %02x\n", data2[7]);	
-#endif
 
 #ifdef ADBMS_DEBUG
 	int i, reg;



CVS commit: src/sys/dev/adb

2019-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Aug 31 02:14:51 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ms.c

Log Message:
fix Kensington Turbo Mouse support properly
- program the buttons sanely ( as left & right mouse buttons, no toggles and
  no ridiculous debounce delay either ) - apparently the init values were
  cargo culted from cthulhu knows where
- don't fudge buttons anymore, now that they behave sanely
- add comments on what I could figure out the init command actually does
- leave in code to find checksum values for init commands, at least until I
  can figure out what exactly the checksum is
Todo: deal with models that have more than 2 buttons, figure out what the rest
  of the init command does


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/adb/adb_ms.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/adb/adb_ms.c
diff -u src/sys/dev/adb/adb_ms.c:1.17 src/sys/dev/adb/adb_ms.c:1.18
--- src/sys/dev/adb/adb_ms.c:1.17	Fri Aug 30 19:24:03 2019
+++ src/sys/dev/adb/adb_ms.c	Sat Aug 31 02:14:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ms.c,v 1.17 2019/08/30 19:24:03 macallan Exp $	*/
+/*	$NetBSD: adb_ms.c,v 1.18 2019/08/31 02:14:51 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.17 2019/08/30 19:24:03 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.18 2019/08/31 02:14:51 macallan Exp $");
 
 #include 
 #include 
@@ -326,18 +326,72 @@ adbms_init_turbo(struct adbms_softc *sc)
 	uint8_t addr;
 
 	/* Found Kensington Turbo Mouse */
+
+/*
+ * byte 1 assigns what which button does
+ - 0x08 - button 1 - 1, button 2 - nothing
+ - 0x09 - both buttons - 1
+ - 0x0a - butoon 1 - 1, button 2 - toggle 1
+ - 0x0b - button 1 - 1, button 2 - nothing
+ - 0x0c - button 1 - 1, button 2 - 2
+ - 0x0e - button 1 - 1, button 2 - 3
+ - 0x0f - button 1 - 1, button 2 - toggle 3
+ - 0x10 - button 1 toggle 1, button 2 nothing
+ - 0x11 - button 1 - toggle 1, button 2 - 1
+ - 0x12 - both toggle 1
+ - 0x14 - button 1 toggle 1, button 2 - 2
+ - 0x21 - button 1 - 2, button 2 - 1
+ - 0x31 - button 1 - 3, button 2 - 1
+ * byte 4 programs a delay for button presses, apparently in 1/100 seconds
+ * byte 7 is some sort of checksum, writes will only stick if it's valid
+  no idea how exactly it works yet, can't be too complicated considering
+  the device's age
+ */
+ 
+/*
+ * XXX
+ * I doubt the first command is actually necessary. Leave in for now since it 
+ * doesn't do any harm either
+ */
 	static u_char data1[] =
 		{ 0xe7, 0x8c, 0, 0, 0, 0xff, 0xff, 0x94 };
+
+	/* this seems to be the most reasonable default */
 	static u_char data2[] =
-		{ 0xa5, 0x14, 0, 0, 0x69, 0xff, 0xff, 0x27 };
+		{ 0xa5, 0x0e, 0, 0, 1, 0xff, 0xff, 0x55 };
 
 	addr = sc->sc_adbdev->current_addr;
 
+#ifdef ADBMS_DEBUG
+	{
+		int i;
+		adbms_send_sync(sc, ADBTALK(addr, 2), 0, NULL);
+		printf("reg *");
+		for (i = 0; i < sc->sc_msg_len; i++)
+			printf(" %02x", sc->sc_buffer[i]);
+		printf("\n");
+	}
+#endif
+
 	adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
 	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data1);
 	adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
 	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data2);
 
+#ifdef ADBMS_BRUTEFORCE
+	sc->sc_buffer[1] = 0;
+	int y = 0;
+	while ((sc->sc_buffer[1] != data2[1]) && (y < 0x100)) {
+		data2[7] = y;
+		y++;
+		adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
+		adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data2);
+		adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
+		adbms_send_sync(sc, ADBTALK(addr, 2), 0, NULL);
+	}
+	printf("y %02x\n", data2[7]);	
+#endif
+
 #ifdef ADBMS_DEBUG
 	int i, reg;
 	for (reg = 1; reg < 4; reg++) {
@@ -607,9 +661,6 @@ adbms_process_event(struct adbms_softc *
 #ifdef ADBMS_DEBUG
 		printf("%d %d %08x %d\n", dx, dy, smask, shift);
 #endif
-		if (sc->sc_adbdev->handler_id == ADBMS_TURBO) {
-			buttons = (buttons != 0) ? 1 : 0;
-		}
 	}
 
 	if (sc->sc_class == MSCLASS_TRACKPAD) {



CVS commit: src/sys/dev/adb

2019-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Aug 31 02:14:51 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ms.c

Log Message:
fix Kensington Turbo Mouse support properly
- program the buttons sanely ( as left & right mouse buttons, no toggles and
  no ridiculous debounce delay either ) - apparently the init values were
  cargo culted from cthulhu knows where
- don't fudge buttons anymore, now that they behave sanely
- add comments on what I could figure out the init command actually does
- leave in code to find checksum values for init commands, at least until I
  can figure out what exactly the checksum is
Todo: deal with models that have more than 2 buttons, figure out what the rest
  of the init command does


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/adb/adb_ms.c

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



CVS commit: src/sys/dev/adb

2019-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Aug 30 19:24:03 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ms.c

Log Message:
make Kensington Turbo Mouse ( actually a trackball ) work:
- this thing speaks EMP, act like it
- adjust the *way* excessive timeout for trying to enable EMP mode on mice -
  for some reason this trackball shows up as two devices - the trackball and a
  non-functional non-EMP mouse
- map both buttons to button 0 - one is an on/off switch for button 0, the
  other shows up as regular button 1


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/adb/adb_ms.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/adb/adb_ms.c
diff -u src/sys/dev/adb/adb_ms.c:1.16 src/sys/dev/adb/adb_ms.c:1.17
--- src/sys/dev/adb/adb_ms.c:1.16	Wed Oct 29 00:48:12 2014
+++ src/sys/dev/adb/adb_ms.c	Fri Aug 30 19:24:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ms.c,v 1.16 2014/10/29 00:48:12 macallan Exp $	*/
+/*	$NetBSD: adb_ms.c,v 1.17 2019/08/30 19:24:03 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.16 2014/10/29 00:48:12 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.17 2019/08/30 19:24:03 macallan Exp $");
 
 #include 
 #include 
@@ -337,6 +337,17 @@ adbms_init_turbo(struct adbms_softc *sc)
 	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data1);
 	adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
 	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data2);
+
+#ifdef ADBMS_DEBUG
+	int i, reg;
+	for (reg = 1; reg < 4; reg++) {
+		adbms_send_sync(sc, ADBTALK(addr, reg), 0, NULL);
+		printf("reg %d", reg);
+		for (i = 0; i < sc->sc_msg_len; i++)
+			printf(" %02x", sc->sc_buffer[i]);
+		printf("\n");
+	}
+#endif
 }
 
 static void
@@ -564,7 +575,8 @@ adbms_process_event(struct adbms_softc *
 			break;
 	}
 
-	if (sc->sc_adbdev->handler_id != ADBMS_EXTENDED) {
+	if ((sc->sc_adbdev->handler_id != ADBMS_EXTENDED) &&
+	(sc->sc_adbdev->handler_id != ADBMS_TURBO)) {
 		dx = ((int)(buffer[1] & 0x3f)) - ((buffer[1] & 0x40) ? 64 : 0);
 		dy = ((int)(buffer[0] & 0x3f)) - ((buffer[0] & 0x40) ? 64 : 0);
 	} else {
@@ -595,6 +607,9 @@ adbms_process_event(struct adbms_softc *
 #ifdef ADBMS_DEBUG
 		printf("%d %d %08x %d\n", dx, dy, smask, shift);
 #endif
+		if (sc->sc_adbdev->handler_id == ADBMS_TURBO) {
+			buttons = (buttons != 0) ? 1 : 0;
+		}
 	}
 
 	if (sc->sc_class == MSCLASS_TRACKPAD) {
@@ -806,7 +821,7 @@ adbms_send_sync(struct adbms_softc *sc, 
 		DPRINTF(" %02x", msg[i]);
 	DPRINTF("\n");
 	sc->sc_ops->send(sc->sc_ops->cookie, sc->sc_poll, cmd, len, msg);
-	adbms_wait(sc, 1000);
+	adbms_wait(sc, 3);
 	return (sc->sc_msg_len != -1);
 }
 



CVS commit: src/sys/dev/adb

2019-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Aug 30 19:24:03 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ms.c

Log Message:
make Kensington Turbo Mouse ( actually a trackball ) work:
- this thing speaks EMP, act like it
- adjust the *way* excessive timeout for trying to enable EMP mode on mice -
  for some reason this trackball shows up as two devices - the trackball and a
  non-functional non-EMP mouse
- map both buttons to button 0 - one is an on/off switch for button 0, the
  other shows up as regular button 1


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/adb/adb_ms.c

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



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

2019-08-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Aug 15 22:35:39 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: ki2c.c

Log Message:
pass sensor location info to drivers if we can find it


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/macppc/dev/ki2c.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/macppc/dev/ki2c.c
diff -u src/sys/arch/macppc/dev/ki2c.c:1.25 src/sys/arch/macppc/dev/ki2c.c:1.26
--- src/sys/arch/macppc/dev/ki2c.c:1.25	Thu Mar  8 21:53:20 2018
+++ src/sys/arch/macppc/dev/ki2c.c	Thu Aug 15 22:35:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ki2c.c,v 1.25 2018/03/08 21:53:20 macallan Exp $	*/
+/*	$NetBSD: ki2c.c,v 1.26 2019/08/15 22:35:39 macallan Exp $	*/
 /*	Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp	*/
 
 /*-
@@ -84,13 +84,13 @@ ki2c_attach(device_t parent, device_t se
 	struct ki2c_softc *sc = device_private(self);
 	struct confargs *ca = aux;
 	int node = ca->ca_node;
-	uint32_t addr, channel;
+	uint32_t addr, channel, reg;
 	int rate, child, /*namelen,*/ i2cbus;
 	struct i2cbus_attach_args iba;
 	prop_dictionary_t dict = device_properties(self);
 	prop_array_t cfg;
-	int devs;
-	char compat[256];
+	int devs, devc;
+	char compat[256], num[8], descr[32];
 	prop_dictionary_t dev;
 	prop_data_t data;
 	char name[32];
@@ -178,6 +178,18 @@ ki2c_attach(device_t parent, device_t se
 		prop_object_release(data);
 		prop_dictionary_set_uint32(dev, "addr", addr);
 		prop_dictionary_set_uint64(dev, "cookie", devs);
+		/* look for location info for sensors */
+		devc = OF_child(devs);
+		while (devc != 0) {
+			if (OF_getprop(devc, "reg", , 4) < 4) goto nope;
+			if (OF_getprop(devc, "location", descr, 32) <= 0)
+goto nope;
+			DPRINTF("found '%s' at %02x\n", descr, reg);
+			snprintf(num, 7, "s%02x", reg);
+			prop_dictionary_set_cstring(dev, num, descr);
+		nope:
+			devc = OF_peer(devc);
+		}
 		prop_array_add(cfg, dev);
 		prop_object_release(dev);
 	skip:



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

2019-08-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Aug 15 22:35:39 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: ki2c.c

Log Message:
pass sensor location info to drivers if we can find it


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/macppc/dev/ki2c.c

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



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

2019-08-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Aug 11 06:04:16 UTC 2019

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
remove orphaned comment


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/sparc/dev/cgfourteen.c

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



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

2019-08-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Aug 11 06:04:16 UTC 2019

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
remove orphaned comment


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.87 src/sys/arch/sparc/dev/cgfourteen.c:1.88
--- src/sys/arch/sparc/dev/cgfourteen.c:1.87	Thu Jan 17 23:05:15 2019
+++ src/sys/arch/sparc/dev/cgfourteen.c	Sun Aug 11 06:04:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.87 2019/01/17 23:05:15 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.88 2019/08/11 06:04:16 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -59,13 +59,6 @@
  * XXX should defer colormap updates to vertical retrace interrupts
  */
 
-/*
- * The following is for debugging only; it opens up a security hole
- * enabled by allowing any user to map the control registers for the
- * cg14 into their space.
- */
-#undef CG14_MAP_REGS
-
 #include "opt_wsemul.h"
 #include "sx.h"
 



CVS commit: src/sys/dev/usb

2019-08-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug  7 22:26:29 UTC 2019

Modified Files:
src/sys/dev/usb: if_urndis.c

Log Message:
match USB_PRODUCT_SAMSUNG_ANDROID too
now this works with my Galaxy S8 active


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/usb/if_urndis.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/usb/if_urndis.c
diff -u src/sys/dev/usb/if_urndis.c:1.22 src/sys/dev/usb/if_urndis.c:1.23
--- src/sys/dev/usb/if_urndis.c:1.22	Thu Aug  1 00:10:22 2019
+++ src/sys/dev/usb/if_urndis.c	Wed Aug  7 22:26:28 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urndis.c,v 1.22 2019/08/01 00:10:22 mrg Exp $ */
+/*	$NetBSD: if_urndis.c,v 1.23 2019/08/07 22:26:28 macallan Exp $ */
 /*	$OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */
 
 /*
@@ -21,7 +21,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.22 2019/08/01 00:10:22 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.23 2019/08/07 22:26:28 macallan Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -177,6 +177,7 @@ CFATTACH_DECL_NEW(urndis, sizeof(struct 
 static const struct usb_devno urndis_devs[] = {
 	{ USB_VENDOR_HTC,	USB_PRODUCT_HTC_ANDROID },
 	{ USB_VENDOR_SAMSUNG,	USB_PRODUCT_SAMSUNG_ANDROID2 },
+	{ USB_VENDOR_SAMSUNG,	USB_PRODUCT_SAMSUNG_ANDROID },
 };
 
 static usbd_status



CVS commit: src/sys/dev/usb

2019-08-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug  7 22:26:29 UTC 2019

Modified Files:
src/sys/dev/usb: if_urndis.c

Log Message:
match USB_PRODUCT_SAMSUNG_ANDROID too
now this works with my Galaxy S8 active


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/usb/if_urndis.c

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



CVS commit: src/sys/arch/powerpc/oea

2019-08-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Aug  2 05:08:07 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
first step to address PR54331:
poll h->hatch_running for a bit instead of blindly relying on a fixed timeout
for secondary CPUs to wake up and get ready

needs more testing, possibly pullup


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/powerpc/oea/cpu_subr.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/powerpc/oea/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.99 src/sys/arch/powerpc/oea/cpu_subr.c:1.100
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.99	Wed Feb  6 07:32:50 2019
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Aug  2 05:08:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.99 2019/02/06 07:32:50 mrg Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.100 2019/08/02 05:08:07 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.99 2019/02/06 07:32:50 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.100 2019/08/02 05:08:07 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -1381,6 +1381,17 @@ cpu_spinup(device_t self, struct cpu_inf
 	__asm volatile ("dcbst 0,%0"::"r"(>hatch_running):"memory");
 	__asm volatile ("sync; isync");
 #endif
+	int hatch_bail = 0;
+	while ((h->hatch_running < 1) && (hatch_bail < 10)) {
+		delay(1);
+		hatch_bail++;
+#ifdef CACHE_PROTO_MEI
+		__asm volatile ("dcbi 0,%0"::"r"(>hatch_running):"memory");
+		__asm volatile ("sync; isync");
+		__asm volatile ("dcbst 0,%0"::"r"(>hatch_running):"memory");
+		__asm volatile ("sync; isync");
+#endif
+	}
 	if (h->hatch_running < 1) {
 #ifdef CACHE_PROTO_MEI
 		__asm volatile ("dcbi 0,%0"::"r"(_spinstart_ack):"memory");



CVS commit: src/sys/arch/powerpc/oea

2019-08-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Aug  2 05:08:07 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
first step to address PR54331:
poll h->hatch_running for a bit instead of blindly relying on a fixed timeout
for secondary CPUs to wake up and get ready

needs more testing, possibly pullup


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/powerpc/oea/cpu_subr.c

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



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2019-07-24 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Jul 24 16:07:59 UTC 2019

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h cg14_accel.c
cg14_render.c

Log Message:
avoid stalling the CPU by letting the SX instruction FIFO drain every couple
of memory instructions.
No more missed IPIs when building stuff in an xterm so far...


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
cvs rdiff -u -r1.14 -r1.15 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.12 -r1.13 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.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/xf86-video-suncg14/dist/src/cg14.h
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.13 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.14
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.13	Thu Dec  7 19:23:22 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h	Wed Jul 24 16:07:59 2019
@@ -31,6 +31,7 @@
 #include "gcstruct.h"
 #include "xf86sbusBus.h"
 #include "exa.h"
+#include 
 
 /* Various offsets in virtual (ie. mmap()) spaces Linux and Solaris support. */
 #define CG14_REGS_VOFF		0x	/* registers */
@@ -100,7 +101,8 @@ typedef struct {
 	uint32_t	fillcolour;
 	int		op;
 	Bool		source_is_solid, no_source_pixmap;
-	int		xdir, ydir;	
+	int		xdir, ydir;
+	int		queuecount;
 	ExaDriverPtr 	pExa;
 } Cg14Rec, *Cg14Ptr;
 
@@ -123,7 +125,14 @@ read_sx_reg(Cg14Ptr p, int reg)
 static inline void
 write_sx_io(Cg14Ptr p, int reg, uint32_t val)
 {
+	if (p->queuecount > 6) {
+		/* let the queue drain to avoid stalling the CPU */
+		do { } while 
+		((read_sx_reg(p, SX_CONTROL_STATUS) & SX_MT) == 0);
+		p->queuecount = 0;
+	}
 	*(volatile uint32_t *)(p->sxio + (reg & ~7)) = val;
+	p->queuecount++;
 }
 
 Bool CG14SetupCursor(ScreenPtr);

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.14 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.15
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.14	Fri Mar  1 02:22:27 2019
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Wed Jul 24 16:07:59 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.14 2019/03/01 02:22:27 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.15 2019/07/24 16:07:59 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -41,7 +41,6 @@
 #include "compiler.h"
 
 #include "cg14.h"
-#include 
 
 /*#define SX_DEBUG*/
 
@@ -1121,6 +1120,7 @@ CG14InitAccel(ScreenPtr pScreen)
 	pExa->UploadToScreen = CG14UploadToScreen;
 	pExa->DownloadFromScreen = CG14DownloadFromScreen;
 
+	p->queuecount = 0;
 	/* do some hardware init */
 	write_sx_reg(p, SX_PLANEMASK, 0x);
 	p->last_mask = 0x;

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.12 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.13
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.12	Fri Dec  8 22:49:37 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Wed Jul 24 16:07:59 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.12 2017/12/08 22:49:37 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.13 2019/07/24 16:07:59 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -41,7 +41,6 @@
 #include "compiler.h"
 
 #include "cg14.h"
-#include 
 
 /*#define SX_SINGLE*/
 /*#define SX_RENDER_DEBUG*/



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2019-07-24 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Jul 24 16:07:59 UTC 2019

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h cg14_accel.c
cg14_render.c

Log Message:
avoid stalling the CPU by letting the SX instruction FIFO drain every couple
of memory instructions.
No more missed IPIs when building stuff in an xterm so far...


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
cvs rdiff -u -r1.14 -r1.15 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.12 -r1.13 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c

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



CVS commit: xsrc/external/mit/xf86-video-suncg6/dist/src

2019-07-18 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Jul 18 18:02:10 UTC 2019

Modified Files:
xsrc/external/mit/xf86-video-suncg6/dist/src: cg6_driver.c

Log Message:
remove unused xaaSymbols[]


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c

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



CVS commit: xsrc/external/mit/xf86-video-suncg6/dist/src

2019-07-18 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Jul 18 18:02:10 UTC 2019

Modified Files:
xsrc/external/mit/xf86-video-suncg6/dist/src: cg6_driver.c

Log Message:
remove unused xaaSymbols[]


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.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/xf86-video-suncg6/dist/src/cg6_driver.c
diff -u xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c:1.13 xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c:1.14
--- xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c:1.13	Fri Sep 23 19:54:40 2016
+++ xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c	Thu Jul 18 18:02:10 2019
@@ -102,14 +102,6 @@ static const OptionInfoRec CG6Options[] 
 { -1,			NULL,		OPTV_NONE,	{0}, FALSE }
 };
 
-static const char *xaaSymbols[] =
-{
-"XAACreateInfoRec",
-"XAADestroyInfoRec",
-"XAAInit",
-NULL
-};
-
 static MODULESETUPPROTO(cg6Setup);
 
 static XF86ModuleVersionInfo suncg6VersRec =



CVS commit: xsrc/external/mit/xf86-video-suncg6/dist/src

2019-07-18 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Jul 18 18:00:58 UTC 2019

Modified Files:
xsrc/external/mit/xf86-video-suncg6/dist/src: cg6_exa.c

Log Message:
adjust comment to reality
NFC


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_exa.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/xf86-video-suncg6/dist/src/cg6_exa.c
diff -u xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_exa.c:1.4 xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_exa.c:1.5
--- xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_exa.c:1.4	Fri Sep 23 19:56:30 2016
+++ xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_exa.c	Thu Jul 18 18:00:58 2019
@@ -20,7 +20,7 @@
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_accel.c $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_exa.c $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -213,8 +213,7 @@ Cg6Solid(
 }
 
 /*
- * Memcpy-based UTS.
- * TODO: use host blit
+ * UTS using host blits
  */
 static Bool
 Cg6UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,



CVS commit: xsrc/external/mit/xf86-video-suncg6/dist/src

2019-07-18 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Jul 18 18:00:58 UTC 2019

Modified Files:
xsrc/external/mit/xf86-video-suncg6/dist/src: cg6_exa.c

Log Message:
adjust comment to reality
NFC


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_exa.c

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



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

2019-07-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jul 11 18:22:14 UTC 2019

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

Log Message:
add compat string for H5

ok jmcneill@


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/sunxi/sunxi_sramc.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_sramc.c
diff -u src/sys/arch/arm/sunxi/sunxi_sramc.c:1.4 src/sys/arch/arm/sunxi/sunxi_sramc.c:1.5
--- src/sys/arch/arm/sunxi/sunxi_sramc.c:1.4	Wed Feb  6 22:50:35 2019
+++ src/sys/arch/arm/sunxi/sunxi_sramc.c	Thu Jul 11 18:22:14 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_sramc.c,v 1.4 2019/02/06 22:50:35 jmcneill Exp $ */
+/* $NetBSD: sunxi_sramc.c,v 1.5 2019/07/11 18:22:14 macallan Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_sramc.c,v 1.4 2019/02/06 22:50:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_sramc.c,v 1.5 2019/07/11 18:22:14 macallan Exp $");
 
 #include 
 #include 
@@ -47,6 +47,7 @@ static const char * compatible[] = {
 	"allwinner,sun4i-a10-system-control",
 	"allwinner,sun8i-h3-system-control",
 	"allwinner,sun50i-a64-system-control",
+	"allwinner,sun50i-h5-system-control",
 	"allwinner,sun50i-h6-system-control",
 	NULL
 };



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

2019-07-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jul 11 18:22:14 UTC 2019

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

Log Message:
add compat string for H5

ok jmcneill@


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/sunxi/sunxi_sramc.c

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



CVS commit: src/sys/dev/i2c

2019-06-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Jun 15 02:00:21 UTC 2019

Modified Files:
src/sys/dev/i2c: adadc.c fcu.c

Log Message:
explicitly initialize sensor->state


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/i2c/adadc.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/i2c/fcu.c

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



CVS commit: src/sys/dev/adb

2019-06-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jun  6 20:59:58 UTC 2019

Modified Files:
src/sys/dev/adb: adb_kbd.c files.adb

Log Message:
- call Debugger() from adbkbd_keys() instead of the task queue
- add options ADBKBD_POWER_DDB to enable DDB-on-Power by default


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/adb/files.adb

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



CVS commit: src/sys/dev/adb

2019-06-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jun  6 20:59:58 UTC 2019

Modified Files:
src/sys/dev/adb: adb_kbd.c files.adb

Log Message:
- call Debugger() from adbkbd_keys() instead of the task queue
- add options ADBKBD_POWER_DDB to enable DDB-on-Power by default


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/adb/files.adb

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/adb/adb_kbd.c
diff -u src/sys/dev/adb/adb_kbd.c:1.27 src/sys/dev/adb/adb_kbd.c:1.28
--- src/sys/dev/adb/adb_kbd.c:1.27	Sat Oct 28 04:53:55 2017
+++ src/sys/dev/adb/adb_kbd.c	Thu Jun  6 20:59:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.27 2017/10/28 04:53:55 riastradh Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.28 2019/06/06 20:59:58 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.27 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.28 2019/06/06 20:59:58 macallan Exp $");
 
 #include 
 #include 
@@ -232,7 +232,11 @@ adbkbd_attach(device_t parent, device_t 
 	sc->sc_power = 0x;
 	sc->sc_timestamp = 0;
 	sc->sc_emul_usb = FALSE;
+#ifdef ADBKBD_POWER_DDB
+	sc->sc_power_dbg = TRUE;
+#else
 	sc->sc_power_dbg = FALSE;
+#endif
 
 	aprint_normal(" addr %d: ", sc->sc_adbdev->current_addr);
 
@@ -463,8 +467,12 @@ adbkbd_keys(struct adbkbd_softc *sc, uin
 		 (sc->sc_power_button_delay == 0)) {
 
 			/* power button, report to sysmon */
-			sc->sc_pe = k1;
-			sysmon_task_queue_sched(0, adbkbd_powerbutton, sc);
+			if (sc->sc_power_dbg) {
+Debugger();
+			} else {
+sc->sc_pe = k1;
+sysmon_task_queue_sched(0, adbkbd_powerbutton, sc);
+			}
 		}
 	} else {
 
@@ -479,17 +487,10 @@ adbkbd_powerbutton(void *cookie)
 {
 	struct adbkbd_softc *sc = cookie;
 
-	if (sc->sc_power_dbg) {
-#ifdef DDB
-		Debugger();
-#else
-		printf("kernel is not compiled with DDB support\n");
-#endif
-	} else {
-		sysmon_pswitch_event(>sc_sm_pbutton, 
-		ADBK_PRESS(sc->sc_pe) ? PSWITCH_EVENT_PRESSED :
-		PSWITCH_EVENT_RELEASED);
-	}
+	sysmon_pswitch_event(>sc_sm_pbutton, 
+	ADBK_PRESS(sc->sc_pe) ? PSWITCH_EVENT_PRESSED :
+	PSWITCH_EVENT_RELEASED);
+
 }
 
 static inline void

Index: src/sys/dev/adb/files.adb
diff -u src/sys/dev/adb/files.adb:1.7 src/sys/dev/adb/files.adb:1.8
--- src/sys/dev/adb/files.adb:1.7	Thu Aug 30 01:27:44 2012
+++ src/sys/dev/adb/files.adb	Thu Jun  6 20:59:58 2019
@@ -1,5 +1,5 @@
 # 
-#	$NetBSD: files.adb,v 1.7 2012/08/30 01:27:44 macallan Exp $
+#	$NetBSD: files.adb,v 1.8 2019/06/06 20:59:58 macallan Exp $
 #
 # Apple Desktop Bus protocol and drivers
 
@@ -7,7 +7,7 @@ defflag	adbdebug.h	ADB_DEBUG
 defflag	adbdebug.h	ADBKBD_DEBUG
 defflag	adbdebug.h	ADBMS_DEBUG
 defflag	adbdebug.h	ADBBT_DEBUG
-defflag adbdebug.h	ADBKBD_POWER_PANIC
+defflag adbdebug.h	ADBKBD_POWER_DDB
 
 define adb_bus {}
 



CVS commit: src/sys/arch/sgimips/gio

2019-05-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu May 16 23:42:23 UTC 2019

Modified Files:
src/sys/arch/sgimips/gio: newportreg.h

Log Message:
Even more registers!


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sgimips/gio/newportreg.h

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



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

2019-05-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu May 16 23:39:37 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
switch the default input to line in, to avoid feedback noise on laptops
should probably just mute the input, I need to read the datasheet again...


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/macppc/dev/snapper.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/macppc/dev/snapper.c
diff -u src/sys/arch/macppc/dev/snapper.c:1.50 src/sys/arch/macppc/dev/snapper.c:1.51
--- src/sys/arch/macppc/dev/snapper.c:1.50	Wed May  8 13:40:15 2019
+++ src/sys/arch/macppc/dev/snapper.c	Thu May 16 23:39:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.50 2019/05/08 13:40:15 isaki Exp $	*/
+/*	$NetBSD: snapper.c,v 1.51 2019/05/16 23:39:37 macallan Exp $	*/
 /*	Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp	*/
 /*	Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp		*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.50 2019/05/08 13:40:15 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.51 2019/05/16 23:39:37 macallan Exp $");
 
 #include 
 #include 
@@ -680,7 +680,7 @@ snapper_attach(device_t parent, device_t
 	sc->sc_baseaddr = ca->ca_baseaddr;
 
 	OF_getprop(soundbus, "reg", reg, sizeof reg);
-	/* deal with messed up properties on PowerMac7,3 abd friends */
+	/* deal with messed up properties on PowerMac7,3 and friends */
 	if (reg[0] == 0) {
 		reg[0] += ca->ca_reg[0];
 		reg[2] += ca->ca_reg[2];
@@ -1702,7 +1702,7 @@ const struct tas3004_reg tas3004_initdat
 	{ 0x10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },	/* BIQUAD */
 	{ 0, 0, 0 },		/* LLB_GAIN */
 	{ 0, 0, 0 },		/* RLB_GAIN */
-	{ DEQ_ACR_ADM | DEQ_ACR_LRB | DEQ_ACR_INP_B },		/* ACR - right channel of input B is the microphone */
+	{ 0 },			/* ACR - line in */
 	{ 2 }			/* MCR2 - AllPass mode since we don't use the equalizer anyway */
 };
 
@@ -2031,10 +2031,10 @@ snapper_init(struct snapper_softc *sc, i
 	snapper_set_bass(sc, 128);
 	snapper_set_treble(sc, 128);
 
-	/* Record source defaults to microphone.  This reflects the
+	/* Record source defaults to line in.  This reflects the
 	 * default value for the ACR (see tas3004_initdata).
 	 */
-	sc->sc_record_source = 1 << 0;
+	sc->sc_record_source = 1 << 1;
 	
 	/* We mute the analog input for now */
 	sc->mixer[0] = 128;



CVS commit: src/sys/arch/sgimips/gio

2019-05-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu May 16 23:42:23 UTC 2019

Modified Files:
src/sys/arch/sgimips/gio: newportreg.h

Log Message:
Even more registers!


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sgimips/gio/newportreg.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/sgimips/gio/newportreg.h
diff -u src/sys/arch/sgimips/gio/newportreg.h:1.8 src/sys/arch/sgimips/gio/newportreg.h:1.9
--- src/sys/arch/sgimips/gio/newportreg.h:1.8	Fri May 10 22:54:51 2019
+++ src/sys/arch/sgimips/gio/newportreg.h	Thu May 16 23:42:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: newportreg.h,v 1.8 2019/05/10 22:54:51 macallan Exp $	*/
+/*	$NetBSD: newportreg.h,v 1.9 2019/05/16 23:42:23 macallan Exp $	*/
 
 /*
  * Copyright (c) 2003 Ilpo Ruotsalainen
@@ -145,6 +145,14 @@
 #define REX3_REG_COLORBACK		0x0018
 #define REX3_REG_COLORVRAM		0x001c
 
+#define REX3_REG_ALPHAREF		0x0020
+#define REX3_REG_STALL0			0x0024	/* stall until engine is idle */
+
+#define REX3_REG_SMASK0X		0x0028	/* min/max 16.16 */  
+#define REX3_REG_SMASK0Y		0x002c	/* min/max 16.16 */  
+
+#define REX3_REG_SETUP			0x0030  
+
 #define REX3_REG_XSTART			0x0100
 
 #define REX3_REG_XYMOVE			0x0114
@@ -162,6 +170,9 @@
 
 #define REX3_REG_COLORI			0x0224
 
+#define REX3_REG_HOSTRW0		0x0230
+#define REX3_REG_HOSTRW1		0x0234
+
 #define REX3_REG_DCBMODE		0x0238
 #define  REX3_DCBMODE_DW_MASK		0x0003
 #define   REX3_DCBMODE_DW_4		0x
@@ -190,6 +201,16 @@
 /* Not really a register, but in the same space */
 #define REX3_REG_GO			0x0800
 
+/* clipping regions, enable/disable in REG_CLIPMODE */
+#define REX3_REG_SMASK1X		0x1300	/* min/max 16.16 */  
+#define REX3_REG_SMASK1Y		0x1304	/* min/max 16.16 */  
+#define REX3_REG_SMASK2X		0x1308	/* min/max 16.16 */  
+#define REX3_REG_SMASK2Y		0x130c	/* min/max 16.16 */  
+#define REX3_REG_SMASK3X		0x1310	/* min/max 16.16 */  
+#define REX3_REG_SMASK3Y		0x1314	/* min/max 16.16 */  
+#define REX3_REG_SMASK4X		0x1318	/* min/max 16.16 */  
+#define REX3_REG_SMASK4Y		0x131c	/* min/max 16.16 */  
+
 #define REX3_REG_TOPSCAN		0x1320
 #define REX3_REG_XYWIN			0x1324
 #define REX3_REG_CLIPMODE		0x1328
@@ -203,6 +224,8 @@
 #define  REX3_CLIPMODE_CIDMATCH2	0x0800
 #define  REX3_CLIPMODE_CIDMATCH3	0x1000
 
+#define REX3_REG_STALL1			0x132c
+#define REX3_REG_CONFIG			0x1330
 
 #define REX3_REG_STATUS			0x1338
 #define  REX3_STATUS_GFXBUSY		0x0008



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

2019-05-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu May 16 23:39:37 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
switch the default input to line in, to avoid feedback noise on laptops
should probably just mute the input, I need to read the datasheet again...


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/macppc/dev/snapper.c

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



CVS commit: src/sys/arch/sgimips/gio

2019-05-10 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri May 10 23:21:42 UTC 2019

Modified Files:
src/sys/arch/sgimips/gio: newport.c

Log Message:
general overhaul, in no particular order:
- use MIPS_PHYS_TO_KSEG1()
- get rid of duplicated rasops_allocattr() and _mapchar() methods
- use rasops_init()
- support fonts that aren't 8x16
- use fastclear mode for rectangle fills
- don't mess with XMAP9's config register
- initialize all 32 XMAP9 mode registers, just in case
- make newport_fill_rectangle() use x, y, wi, he like everyone else
- use R3G3B2 palette in preparation for alpha font support


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sgimips/gio/newport.c

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



CVS commit: src/sys/arch/sgimips/gio

2019-05-10 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri May 10 23:21:42 UTC 2019

Modified Files:
src/sys/arch/sgimips/gio: newport.c

Log Message:
general overhaul, in no particular order:
- use MIPS_PHYS_TO_KSEG1()
- get rid of duplicated rasops_allocattr() and _mapchar() methods
- use rasops_init()
- support fonts that aren't 8x16
- use fastclear mode for rectangle fills
- don't mess with XMAP9's config register
- initialize all 32 XMAP9 mode registers, just in case
- make newport_fill_rectangle() use x, y, wi, he like everyone else
- use R3G3B2 palette in preparation for alpha font support


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sgimips/gio/newport.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/sgimips/gio/newport.c
diff -u src/sys/arch/sgimips/gio/newport.c:1.19 src/sys/arch/sgimips/gio/newport.c:1.20
--- src/sys/arch/sgimips/gio/newport.c:1.19	Tue Aug 25 02:09:18 2015
+++ src/sys/arch/sgimips/gio/newport.c	Fri May 10 23:21:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: newport.c,v 1.19 2015/08/25 02:09:18 macallan Exp $	*/
+/*	$NetBSD: newport.c,v 1.20 2019/05/10 23:21:42 macallan Exp $	*/
 
 /*
  * Copyright (c) 2003 Ilpo Ruotsalainen
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: newport.c,v 1.19 2015/08/25 02:09:18 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: newport.c,v 1.20 2019/05/10 23:21:42 macallan Exp $");
 
 #include 
 #include 
@@ -73,7 +73,6 @@ struct newport_devconfig {
 
 	int			dc_font;
 	struct wsscreen_descr	*dc_screen;
-	struct wsdisplay_font	*dc_fontdata;
 	int			dc_mode;
 	struct vcons_data	dc_vd;
 };
@@ -87,13 +86,11 @@ CFATTACH_DECL_NEW(newport, sizeof(struct
 /* textops */
 static void newport_cursor(void *, int, int, int);
 static void newport_cursor_dummy(void *, int, int, int);
-static int  newport_mapchar(void *, int, unsigned int *);
 static void newport_putchar(void *, int, int, u_int, long);
 static void newport_copycols(void *, int, int, int, int);
 static void newport_erasecols(void *, int, int, int, long);
 static void newport_copyrows(void *, int, int, int);
 static void newport_eraserows(void *, int, int, long);
-static int  newport_allocattr(void *, int, int, int, long *);
 
 static void newport_init_screen(void *, struct vcons_screen *, int, long *);
 
@@ -107,22 +104,10 @@ static struct wsdisplay_accessops newpor
 	.mmap		= newport_mmap,
 };
 
-static struct wsdisplay_emulops newport_textops = {
-	.cursor		= newport_cursor_dummy,
-	.mapchar	= newport_mapchar,
-	.putchar	= newport_putchar,
-	.copycols	= newport_copycols,
-	.erasecols	= newport_erasecols,
-	.copyrows	= newport_copyrows,
-	.eraserows	= newport_eraserows,
-	.allocattr	= newport_allocattr
-};
-
 static struct wsscreen_descr newport_screen = {
 	.name		= "default",
 	.ncols		= 160,
 	.nrows		= 64,
-	.textops	= _textops,
 	.fontwidth	= 8,
 	.fontheight	= 16,
 	.capabilities	= WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_REVERSE
@@ -141,11 +126,7 @@ static struct vcons_screen newport_conso
 static struct newport_devconfig newport_console_dc;
 static int newport_is_console = 0;
 
-#define NEWPORT_ATTR_ENCODE(fg,bg)	(((fg) << 8) | (bg))
-#define NEWPORT_ATTR_BG(a)		((a) & 0xff)
-#define NEWPORT_ATTR_FG(a)		(((a) >> 8) & 0xff)
-
-extern const u_char rasops_cmap[768];
+uint8_t our_cmap[768];
 
 / Low-level hardware register groveling functions /
 static void
@@ -273,9 +254,19 @@ xmap9_write(struct newport_devconfig *dc
 	rex3_write(dc, REX3_REG_DCBDATA0, val << 24);
 }
 
+static inline void
+xmap9_wait(struct newport_devconfig *dc)
+{
+	do {} while (xmap9_read(dc, XMAP9_DCBCRS_FIFOAVAIL) == 0);
+}
+
 static void
 xmap9_write_mode(struct newport_devconfig *dc, uint8_t index, uint32_t mode)
 {
+	volatile uint32_t junk;	
+	/* wait for FIFO if needed */
+	xmap9_wait(dc);
+
 	rex3_write(dc, REX3_REG_DCBMODE,
 	REX3_DCBMODE_DW_4 |
 	(NEWPORT_DCBADDR_XMAP_BOTH << REX3_DCBMODE_DCBADDR_SHIFT) |
@@ -284,30 +275,40 @@ xmap9_write_mode(struct newport_devconfi
 	(2 << REX3_DCBMODE_CSHOLD_SHIFT) |
 	(1 << REX3_DCBMODE_CSSETUP_SHIFT));
 
+	xmap9_wait(dc);
+
 	rex3_write(dc, REX3_REG_DCBDATA0, (index << 24) | mode);
+	junk = rex3_read(dc, REX3_REG_DCBDATA0);
+	__USE(junk);
 }
 
 / Helper functions /
 static void
-newport_fill_rectangle(struct newport_devconfig *dc, int x1, int y1, int x2,
-int y2, uint8_t color)
+newport_fill_rectangle(struct newport_devconfig *dc, int x1, int y1, int wi,
+int he, uint32_t color)
 {
+	int x2 = x1 + wi - 1;
+	int y2 = y1 + he - 1;
+
 	rex3_wait_gfifo(dc);
 	
 	rex3_write(dc, REX3_REG_DRAWMODE0, REX3_DRAWMODE0_OPCODE_DRAW |
 	REX3_DRAWMODE0_ADRMODE_BLOCK | REX3_DRAWMODE0_DOSETUP |
 	REX3_DRAWMODE0_STOPONX | REX3_DRAWMODE0_STOPONY);
+	rex3_write(dc, REX3_REG_CLIPMODE, 0x1e00);
 	rex3_write(dc, REX3_REG_DRAWMODE1,
-	REX3_DRAWMODE1_PLANES_CI |
+	REX3_DRAWMODE1_PLANES_RGB 

CVS commit: src/sys/arch/sgimips/gio

2019-05-10 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri May 10 22:54:51 UTC 2019

Modified Files:
src/sys/arch/sgimips/gio: newportreg.h

Log Message:
move the CIDMATCH bits where they belong, now FASTCLEAR mode can actually work


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sgimips/gio/newportreg.h

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



CVS commit: src/sys/arch/sgimips/gio

2019-05-10 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri May 10 22:54:51 UTC 2019

Modified Files:
src/sys/arch/sgimips/gio: newportreg.h

Log Message:
move the CIDMATCH bits where they belong, now FASTCLEAR mode can actually work


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sgimips/gio/newportreg.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/sgimips/gio/newportreg.h
diff -u src/sys/arch/sgimips/gio/newportreg.h:1.7 src/sys/arch/sgimips/gio/newportreg.h:1.8
--- src/sys/arch/sgimips/gio/newportreg.h:1.7	Sat May  4 00:45:18 2019
+++ src/sys/arch/sgimips/gio/newportreg.h	Fri May 10 22:54:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: newportreg.h,v 1.7 2019/05/04 00:45:18 macallan Exp $	*/
+/*	$NetBSD: newportreg.h,v 1.8 2019/05/10 22:54:51 macallan Exp $	*/
 
 /*
  * Copyright (c) 2003 Ilpo Ruotsalainen
@@ -198,10 +198,10 @@
 #define  REX3_CLIPMODE_SMASK2		0x0004
 #define  REX3_CLIPMODE_SMASK3		0x0008
 #define  REX3_CLIPMODE_SMASK4		0x0010
-#define  REX3_CLIPMODE_CIDMATCH0	0x0100
-#define  REX3_CLIPMODE_CIDMATCH1	0x0200
-#define  REX3_CLIPMODE_CIDMATCH2	0x0400
-#define  REX3_CLIPMODE_CIDMATCH3	0x0800
+#define  REX3_CLIPMODE_CIDMATCH0	0x0200
+#define  REX3_CLIPMODE_CIDMATCH1	0x0400
+#define  REX3_CLIPMODE_CIDMATCH2	0x0800
+#define  REX3_CLIPMODE_CIDMATCH3	0x1000
 
 
 #define REX3_REG_STATUS			0x1338



CVS commit: src/sys/dev/pci

2010-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar  9 22:45:50 UTC 2010

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

Log Message:
Use a shadow framebuffer instead of doing every operation twice ( once for
each framebuffer ) - this gives quite a dramatic speedup and hides the funky
effects previously seen.
Almost there, now we need to actually draw a cursor.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/wcfb.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/wcfb.c
diff -u src/sys/dev/pci/wcfb.c:1.2 src/sys/dev/pci/wcfb.c:1.3
--- src/sys/dev/pci/wcfb.c:1.2	Thu Feb 25 20:56:20 2010
+++ src/sys/dev/pci/wcfb.c	Tue Mar  9 22:45:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wcfb.c,v 1.2 2010/02/25 20:56:20 macallan Exp $ */
+/*	$NetBSD: wcfb.c,v 1.3 2010/03/09 22:45:50 macallan Exp $ */
 
 /*-
  * Copyright (c) 2010 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wcfb.c,v 1.2 2010/02/25 20:56:20 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: wcfb.c,v 1.3 2010/03/09 22:45:50 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -39,6 +39,7 @@
 #include sys/kernel.h
 #include sys/systm.h
 #include sys/kauth.h
+#include sys/kmem.h
 
 #include dev/pci/pcidevs.h
 #include dev/pci/pcireg.h
@@ -83,7 +84,7 @@
 
 	int sc_width, sc_height, sc_stride;
 	int sc_locked;
-	uint8_t *sc_fbaddr;
+	uint8_t *sc_fbaddr, *sc_fb0, *sc_fb1, *sc_shadow;
 	struct vcons_screen sc_console_screen;
 	struct wsscreen_descr sc_defaultscreen_descr;
 	const struct wsscreen_descr *sc_screens[1];
@@ -204,10 +205,21 @@
 
 	sc-sc_fb0off = bus_space_read_4(sc-sc_regt, sc-sc_regh, 0x8080) -
 	sc-sc_fb;
+	sc-sc_fb0 = sc-sc_fbaddr + sc-sc_fb0off;
+	sc-sc_fb1 = sc-sc_fb0 + 0x20;
+
 	sc-sc_stride = 1  
 	((bus_space_read_4(sc-sc_regt, sc-sc_regh, 0x8074)  0x00ff)  16);
 	printf(%s: %d x %d, %d\n, device_xname(sc-sc_dev), 
 	sc-sc_width, sc-sc_height, sc-sc_stride);
+
+	sc-sc_shadow = kmem_alloc(sc-sc_stride * sc-sc_height, KM_SLEEP);
+	if (sc-sc_shadow == NULL) {
+		printf(%s: failed to allocate shadow buffer\n,
+		device_xname(self));
+		return;
+	}
+
 	for (i = 0x40; i  0x100; i += 16) {
 		printf(%04x:, i);
 		for (j = 0; j  16; j += 4) {
@@ -375,7 +387,7 @@
 	ri-ri_stride = sc-sc_stride;
 	ri-ri_flg = RI_CENTER /*| RI_FULLCLEAR*/;
 
-	ri-ri_bits = (char *)sc-sc_fbaddr + sc-sc_fb0off;
+	ri-ri_bits = sc-sc_shadow;
 
 	if (existing) {
 		ri-ri_flg |= RI_CLEAR;
@@ -408,11 +420,22 @@
 	struct rasops_info *ri = cookie;
 	struct vcons_screen *scr = ri-ri_hw;
 	struct wcfb_softc *sc = scr-scr_cookie;
+	int offset = (ri-ri_yorigin + row * ri-ri_font-fontheight) *
+	sc-sc_stride + ri-ri_xorigin + col * ri-ri_font-fontwidth;
+	uint8_t *from, *to0, *to1;
+	int i;
 
 	sc-putchar(ri, row, col, c, attr);
-	ri-ri_bits += 0x20;
-	sc-putchar(ri, row, col, c, attr);
-	ri-ri_bits -= 0x20;
+	from = sc-sc_shadow + offset;
+	to0 = sc-sc_fb0 + offset;
+	to1 = sc-sc_fb1 + offset;
+	for (i = 0; i  ri-ri_font-fontheight; i++) {
+		memcpy(to0, from, ri-ri_font-fontwidth);
+		memcpy(to1, from, ri-ri_font-fontwidth);
+		to0 += sc-sc_stride;
+		to1 += sc-sc_stride;
+		from += sc-sc_stride;
+	}
 }	
 
 static void
@@ -441,37 +464,72 @@
 	struct rasops_info *ri = cookie;
 	struct vcons_screen *scr = ri-ri_hw;
 	struct wcfb_softc *sc = scr-scr_cookie;
+	int offset = (ri-ri_yorigin + row * ri-ri_font-fontheight) *
+	sc-sc_stride + ri-ri_xorigin + dstcol * ri-ri_font-fontwidth;
+	uint8_t *from, *to0, *to1;
+	int i;
 
 	sc-copycols(ri, row, srccol, dstcol, ncols);
-	ri-ri_bits += 0x20;
-	sc-copycols(ri, row, srccol, dstcol, ncols);
-	ri-ri_bits -= 0x20;
+	from = sc-sc_shadow + offset;
+	to0 = sc-sc_fb0 + offset;
+	to1 = sc-sc_fb1 + offset;
+	for (i = 0; i  ri-ri_font-fontheight; i++) {
+		memcpy(to0, from, ri-ri_font-fontwidth * ncols);
+		memcpy(to1, from, ri-ri_font-fontwidth * ncols);
+		to0 += sc-sc_stride;
+		to1 += sc-sc_stride;
+		from += sc-sc_stride;
+	}
 }
 
 static void
-wcfb_erasecols(void *cookie, int row, int startcol, int ncol, long fillattr)
+wcfb_erasecols(void *cookie, int row, int startcol, int ncols, long fillattr)
 {
 	struct rasops_info *ri = cookie;
 	struct vcons_screen *scr = ri-ri_hw;
 	struct wcfb_softc *sc = scr-scr_cookie;
-
-	sc-erasecols(ri, row, startcol, ncol, fillattr);
-	ri-ri_bits += 0x20;
-	sc-erasecols(ri, row, startcol, ncol, fillattr);
-	ri-ri_bits -= 0x20;
+	int offset = (ri-ri_yorigin + row * ri-ri_font-fontheight) *
+	sc-sc_stride + ri-ri_xorigin + startcol * ri-ri_font-fontwidth;
+	uint8_t *to0, *to1;
+	int i;
+
+	sc-erasecols(ri, row, startcol, ncols, fillattr);
+
+	to0 = sc-sc_fb0 + offset;
+	to1 = sc-sc_fb1 + offset;
+	for (i = 0; i  ri-ri_font-fontheight; i++) {
+		memset(to0, ri-ri_devcmap[(fillattr  16)  0xff],
+		ri-ri_font-fontwidth * ncols);
+		memset(to1, ri-ri_devcmap

CVS commit: src/sys/dev/pci

2010-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar  9 23:17:12 UTC 2010

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

Log Message:
now we also draw a cursor


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/wcfb.c

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



CVS commit: src/sys/dev/pci

2010-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar  9 23:17:12 UTC 2010

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

Log Message:
now we also draw a cursor


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/wcfb.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/wcfb.c
diff -u src/sys/dev/pci/wcfb.c:1.3 src/sys/dev/pci/wcfb.c:1.4
--- src/sys/dev/pci/wcfb.c:1.3	Tue Mar  9 22:45:50 2010
+++ src/sys/dev/pci/wcfb.c	Tue Mar  9 23:17:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wcfb.c,v 1.3 2010/03/09 22:45:50 macallan Exp $ */
+/*	$NetBSD: wcfb.c,v 1.4 2010/03/09 23:17:12 macallan Exp $ */
 
 /*-
  * Copyright (c) 2010 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wcfb.c,v 1.3 2010/03/09 22:45:50 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: wcfb.c,v 1.4 2010/03/09 23:17:12 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -451,11 +451,44 @@
 static void
 wcfb_cursor(void *cookie, int on, int row, int col)
 {
-#if 0
 	struct rasops_info *ri = cookie;
 	struct vcons_screen *scr = ri-ri_hw;
 	struct wcfb_softc *sc = scr-scr_cookie;
+	int coffset;
+	
+	if (sc-sc_mode == WSDISPLAYIO_MODE_EMUL) {
+
+		if (ri-ri_flg  RI_CURSOR) {
+			/* remove cursor */
+			coffset = ri-ri_ccol + (ri-ri_crow * ri-ri_cols);
+#ifdef WSDISPLAY_SCROLLSUPPORT
+			coffset += scr-scr_offset_to_zero;
+#endif
+			wcfb_putchar(cookie, ri-ri_crow, 
+			ri-ri_ccol, scr-scr_chars[coffset], 
+			scr-scr_attrs[coffset]);
+			ri-ri_flg = ~RI_CURSOR;
+		}
+		ri-ri_crow = row;
+		ri-ri_ccol = col;
+		if (on) {
+			long attr, revattr;
+			coffset = col + (row * ri-ri_cols);
+#ifdef WSDISPLAY_SCROLLSUPPORT
+			coffset += scr-scr_offset_to_zero;
 #endif
+			attr = scr-scr_attrs[coffset];
+			revattr = attr ^ 0x;
+
+			wcfb_putchar(cookie, ri-ri_crow, ri-ri_ccol,
+			scr-scr_chars[coffset], revattr);
+			ri-ri_flg |= RI_CURSOR;
+		}
+	} else {
+		ri-ri_crow = row;
+		ri-ri_ccol = col;
+		ri-ri_flg = ~RI_CURSOR;
+	}
 }
 
 static void



CVS commit: xsrc/external/mit/xf86-video-ati/dist/src

2010-03-02 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Mar  3 03:06:50 UTC 2010

Modified Files:
xsrc/external/mit/xf86-video-ati/dist/src: legacy_crtc.c

Log Message:
treat the onboard radeon found in Mac Minis like the ones found in iBooks
From Hiroaki Urata via PR 42931


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 \
xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c

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



CVS commit: xsrc/external/mit/xf86-video-ati/dist/src

2010-03-02 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Mar  3 03:06:50 UTC 2010

Modified Files:
xsrc/external/mit/xf86-video-ati/dist/src: legacy_crtc.c

Log Message:
treat the onboard radeon found in Mac Minis like the ones found in iBooks
From Hiroaki Urata via PR 42931


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 \
xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.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/xf86-video-ati/dist/src/legacy_crtc.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c:1.1.1.3 xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c:1.2
--- xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c:1.1.1.3	Mon Nov  9 00:51:53 2009
+++ xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c	Wed Mar  3 03:06:50 2010
@@ -305,7 +305,8 @@
 
 #if defined(__powerpc__)
 /* apparently restoring the pll causes a hang??? */
-if (info-MacModel == RADEON_MAC_IBOOK)
+if ((info-MacModel == RADEON_MAC_IBOOK) ||
+(info-MacModel == RADEON_MAC_MINI_INTERNAL))
 	return;
 #endif
 
@@ -1242,7 +1243,8 @@
 
 #if defined(__powerpc__)
 /* apparently programming this otherwise causes a hang??? */
-if (info-MacModel == RADEON_MAC_IBOOK)
+if ((info-MacModel == RADEON_MAC_IBOOK) ||
+(info-MacModel == RADEON_MAC_MINI_INTERNAL))
 	save-ppll_div_3 = 0x000600ad;
 else
 #endif



CVS commit: src/sys/arch/sparc64/sparc64

2010-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Mar  1 01:14:58 UTC 2010

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

Log Message:
Don't call frame-buffer-adr since it doesn't work as expected by the code
that got cargo culted over from macppc. While there shut up some leftover
debug printf.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/arch/sparc64/sparc64/autoconf.c

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

Modified files:

Index: src/sys/arch/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.170 src/sys/arch/sparc64/sparc64/autoconf.c:1.171
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.170	Sun Feb 28 13:59:05 2010
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Mon Mar  1 01:14:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.170 2010/02/28 13:59:05 martin Exp $ */
+/*	$NetBSD: autoconf.c,v 1.171 2010/03/01 01:14:58 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.170 2010/02/28 13:59:05 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.171 2010/03/01 01:14:58 macallan Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -1128,8 +1128,6 @@
 		prop_dictionary_set_uint32(dict, depth, 8);
 	}
 	OF_getprop(console_node, address, fbaddr, sizeof(fbaddr));
-	if (fbaddr == 0)
-		OF_interpret(frame-buffer-adr, 0, 1, fbaddr);
 	if (fbaddr != 0) {
 	
 		pmap_extract(pmap_kernel(), fbaddr, fbpa);
@@ -1164,7 +1162,6 @@
 		return;
 	if (OF_getprop(options, output-device, output_device, 256) == 0)
 		return;
-	printf(output-device: %s\n, output_device);
 	/* find the mode string if there is one */
 	pos = strstr(output_device, :r);
 	if (pos == NULL)



CVS commit: src/sys/dev/sbus

2010-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Mar  1 05:26:53 UTC 2010

Modified Files:
src/sys/dev/sbus: p9100.c

Log Message:
fix ancient typo, noticed by mouse@


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/sbus/p9100.c

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



CVS commit: src/sys/dev/sbus

2010-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Mar  1 05:26:53 UTC 2010

Modified Files:
src/sys/dev/sbus: p9100.c

Log Message:
fix ancient typo, noticed by mouse@


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/sbus/p9100.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/sbus/p9100.c
diff -u src/sys/dev/sbus/p9100.c:1.52 src/sys/dev/sbus/p9100.c:1.53
--- src/sys/dev/sbus/p9100.c:1.52	Wed Feb 24 22:38:08 2010
+++ src/sys/dev/sbus/p9100.c	Mon Mar  1 05:26:53 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: p9100.c,v 1.52 2010/02/24 22:38:08 dyoung Exp $ */
+/*	$NetBSD: p9100.c,v 1.53 2010/03/01 05:26:53 macallan Exp $ */
 
 /*-
  * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.52 2010/02/24 22:38:08 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.53 2010/03/01 05:26:53 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -256,7 +256,7 @@
 };
 #endif
 
-#define PNOZZ_LATCH(sc, off) if(sc-sc_last_offset == (off  0xff80)) { \
+#define PNOZZ_LATCH(sc, off) if(sc-sc_last_offset != (off  0xff80)) { \
 		sc-sc_junk = bus_space_read_4(sc-sc_bustag, sc-sc_fb_memh, \
 		off); \
 		sc-sc_last_offset = off  0xff80; }



CVS commit: src/sys/dev/sbus

2010-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Mar  1 05:42:08 UTC 2010

Modified Files:
src/sys/dev/sbus: files.sbus p9100.c

Log Message:
make latching optional.
The SPARCbook docs claim it's necessary but my 3GX happily works without.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/sbus/files.sbus
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/sbus/p9100.c

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



CVS commit: src/sys/dev/sbus

2010-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Mar  1 05:42:08 UTC 2010

Modified Files:
src/sys/dev/sbus: files.sbus p9100.c

Log Message:
make latching optional.
The SPARCbook docs claim it's necessary but my 3GX happily works without.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/sbus/files.sbus
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/sbus/p9100.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/sbus/files.sbus
diff -u src/sys/dev/sbus/files.sbus:1.34 src/sys/dev/sbus/files.sbus:1.35
--- src/sys/dev/sbus/files.sbus:1.34	Wed Jan 27 21:01:33 2010
+++ src/sys/dev/sbus/files.sbus	Mon Mar  1 05:42:08 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sbus,v 1.34 2010/01/27 21:01:33 macallan Exp $
+#	$NetBSD: files.sbus,v 1.35 2010/03/01 05:42:08 macallan Exp $
 #
 # Config file and device description for machine-independent SBUS code.
 # Included by ports that need it.
@@ -126,6 +126,7 @@
 # Tadpole 3GX/3GS (P9100 -- P Nine One Zero Zero - pnozz)
 defflag	opt_pnozz.h	PNOZZ_DEBUG
 defflag opt_pnozz.h	PNOZZ_EMUL_CG3
+defflag opt_pnozz.h	PNOZZ_USE_LATCH
 device	pnozz: fb, rasops8, bt_dac, wsemuldisplaydev, vcons
 attach	pnozz at sbus
 file	dev/sbus/p9100.c		pnozz needs-flag

Index: src/sys/dev/sbus/p9100.c
diff -u src/sys/dev/sbus/p9100.c:1.53 src/sys/dev/sbus/p9100.c:1.54
--- src/sys/dev/sbus/p9100.c:1.53	Mon Mar  1 05:26:53 2010
+++ src/sys/dev/sbus/p9100.c	Mon Mar  1 05:42:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: p9100.c,v 1.53 2010/03/01 05:26:53 macallan Exp $ */
+/*	$NetBSD: p9100.c,v 1.54 2010/03/01 05:42:08 macallan Exp $ */
 
 /*-
  * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.53 2010/03/01 05:26:53 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.54 2010/03/01 05:42:08 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -110,8 +110,9 @@
 
 	bus_addr_t	sc_fb_paddr;	/* phys address description */
 	bus_size_t	sc_fb_psize;	/*   for device mmap() */
+#ifdef PNOZZ_USE_LATCH
 	bus_space_handle_t sc_fb_memh;	/*   bus space handle */
-
+#endif
 	volatile uint32_t sc_junk;
 	uint32_t 	sc_mono_width;	/* for setup_mono */
 
@@ -256,10 +257,14 @@
 };
 #endif
 
+#ifdef PNOZZ_USE_LATCH
 #define PNOZZ_LATCH(sc, off) if(sc-sc_last_offset != (off  0xff80)) { \
 		sc-sc_junk = bus_space_read_4(sc-sc_bustag, sc-sc_fb_memh, \
 		off); \
 		sc-sc_last_offset = off  0xff80; }
+#else
+#define PNOZZ_LATCH(a, b)
+#endif
 
 /*
  * Match a p9100.
@@ -338,7 +343,9 @@
 	 * P9100 - all register accesses need to be 'latched in' whenever we
 	 * go to another 0x80 aligned 'page' by reading the framebuffer at the
 	 * same offset
+	 * XXX apparently the latter isn't true - my SP3GX works fine without
 	 */
+#ifdef PNOZZ_USE_LATCH
 	if (fb-fb_pixels == NULL) {
 		if (sbus_bus_map(sc-sc_bustag,
 		sa-sa_reg[2].oa_space,
@@ -354,6 +361,7 @@
 	} else {
 		sc-sc_fb_memh = (bus_space_handle_t) fb-fb_pixels;
 	}
+#endif
 	sc-sc_width = prom_getpropint(node, width, 800);
 	sc-sc_height = prom_getpropint(node, height, 600);
 	sc-sc_depth = prom_getpropint(node, depth, 8)  3;
@@ -1217,9 +1225,10 @@
 	ri-ri_stride = sc-sc_stride;
 	ri-ri_flg = RI_CENTER | RI_FULLCLEAR;
 
+#ifdef PNOZZ_USE_LATCH
 	ri-ri_bits = bus_space_vaddr(sc-sc_bustag, sc-sc_fb_memh);
-
 	DPRINTF(addr: %08lx\n,(ulong)ri-ri_bits);
+#endif
 
 	rasops_init(ri, sc-sc_height/8, sc-sc_width/8);
 	ri-ri_caps = WSSCREEN_WSCOLORS;



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

2010-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Mar  1 06:14:17 UTC 2010

Modified Files:
src/sys/arch/sparc/conf: GENERIC INSTALL

Log Message:
enable PNOZZ_USE_LATCH in case we run into some hardware which needs it


To generate a diff of this commit:
cvs rdiff -u -r1.219 -r1.220 src/sys/arch/sparc/conf/GENERIC
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/sparc/conf/INSTALL

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



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

2010-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Mar  1 06:14:17 UTC 2010

Modified Files:
src/sys/arch/sparc/conf: GENERIC INSTALL

Log Message:
enable PNOZZ_USE_LATCH in case we run into some hardware which needs it


To generate a diff of this commit:
cvs rdiff -u -r1.219 -r1.220 src/sys/arch/sparc/conf/GENERIC
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/sparc/conf/INSTALL

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/sparc/conf/GENERIC
diff -u src/sys/arch/sparc/conf/GENERIC:1.219 src/sys/arch/sparc/conf/GENERIC:1.220
--- src/sys/arch/sparc/conf/GENERIC:1.219	Fri Jan 15 20:57:12 2010
+++ src/sys/arch/sparc/conf/GENERIC	Mon Mar  1 06:14:17 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.219 2010/01/15 20:57:12 bouyer Exp $
+# $NetBSD: GENERIC,v 1.220 2010/03/01 06:14:17 macallan Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.219 $
+#ident 		GENERIC-$Revision: 1.220 $
 
 maxusers	32
 
@@ -693,6 +693,10 @@
 
 # P9100-based display on Tadpole SPARCbook 3.
 pnozz0		at sbus? slot ? offset ?
+# the SPARCbook 3 hardware docs say that accesses to P9100 registers need to be
+# 'latched in' but at least my 3GX works happily without
+# Enable it by default since we don't know which hardware really needs it.
+options PNOZZ_USE_LATCH
 
 # Sun ZX/Leo 24-bit framebuffer
 zx*		at sbus? slot ? offset ?

Index: src/sys/arch/sparc/conf/INSTALL
diff -u src/sys/arch/sparc/conf/INSTALL:1.72 src/sys/arch/sparc/conf/INSTALL:1.73
--- src/sys/arch/sparc/conf/INSTALL:1.72	Sat Dec  5 20:11:17 2009
+++ src/sys/arch/sparc/conf/INSTALL	Mon Mar  1 06:14:17 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL,v 1.72 2009/12/05 20:11:17 pooka Exp $
+#	$NetBSD: INSTALL,v 1.73 2010/03/01 06:14:17 macallan Exp $
 #
 # from: NetBSD: GENERIC,v 1.84 1999/06/06 13:00:03 mrg Exp
 #
@@ -561,6 +561,10 @@
 
 # P9100-based display on Tadpole SPARCbook 3.
 pnozz0		at sbus? slot ? offset ?
+# the SPARCbook 3 hardware docs say that accesses to P9100 registers need to be
+# 'latched in' but at least my 3GX works happily without
+# Enable it by default since we don't know which hardware really needs it.
+options PNOZZ_USE_LATCH
 
 # Sun ZX/Leo 24-bit framebuffer
 zx*		at sbus? slot ? offset ?



CVS commit: src/sys/dev/pci

2010-02-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 20:56:20 UTC 2010

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

Log Message:
some cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/wcfb.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/wcfb.c
diff -u src/sys/dev/pci/wcfb.c:1.1 src/sys/dev/pci/wcfb.c:1.2
--- src/sys/dev/pci/wcfb.c:1.1	Thu Feb 25 03:33:09 2010
+++ src/sys/dev/pci/wcfb.c	Thu Feb 25 20:56:20 2010
@@ -1,7 +1,7 @@
-/*	$NetBSD: wcfb.c,v 1.1 2010/02/25 03:33:09 macallan Exp $ */
+/*	$NetBSD: wcfb.c,v 1.2 2010/02/25 20:56:20 macallan Exp $ */
 
 /*-
- * Copyright (c) 2007 Michael Lorenz
+ * Copyright (c) 2010 Michael Lorenz
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wcfb.c,v 1.1 2010/02/25 03:33:09 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: wcfb.c,v 1.2 2010/02/25 20:56:20 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -154,7 +154,6 @@
 	bool			is_console;
 	char 			devinfo[256];
 	void *wtf;
-	uint32_t *tcfb;
 
 	sc-sc_dev = self;
 	sc-putchar = NULL;
@@ -164,7 +163,7 @@
 
 	dict = device_properties(self);
 	prop_dictionary_get_bool(dict, is_console, is_console);
-if(!is_console) return;
+	if(!is_console) return;
 
 	sc-sc_memt = pa-pa_memt;
 	sc-sc_iot = pa-pa_iot;	
@@ -347,6 +346,11 @@
 	 * somewhere in a MD header and compile this code only if all are
 	 * present
 	 */
+	/*
+	 * PCI_IOAREA_PADDR is useless, that's what the IO tag is for
+	 * the address isn't guaranteed to be the same on each host bridge
+	 * either, never mind the fact that it would be a bus address
+	 */
 #ifdef PCI_MAGIC_IO_RANGE
 	/* allow to map our IO space */
 	if ((offset = PCI_MAGIC_IO_RANGE) 



CVS commit: src/sys/dev/pci

2010-02-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 20:56:20 UTC 2010

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

Log Message:
some cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/wcfb.c

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



CVS commit: src/sys/dev/pci

2010-02-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 21:09:00 UTC 2010

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

Log Message:
add a comment on PCI_MAGIC_IO_RANGE


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/genfb_pci.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/genfb_pci.c
diff -u src/sys/dev/pci/genfb_pci.c:1.23 src/sys/dev/pci/genfb_pci.c:1.24
--- src/sys/dev/pci/genfb_pci.c:1.23	Mon Aug 24 11:32:49 2009
+++ src/sys/dev/pci/genfb_pci.c	Thu Feb 25 21:09:00 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb_pci.c,v 1.23 2009/08/24 11:32:49 jmcneill Exp $ */
+/*	$NetBSD: genfb_pci.c,v 1.24 2010/02/25 21:09:00 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: genfb_pci.c,v 1.23 2009/08/24 11:32:49 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: genfb_pci.c,v 1.24 2010/02/25 21:09:00 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -97,6 +97,7 @@
 	struct pci_genfb_softc *sc = device_private(self);
 	struct pci_attach_args *pa = aux;
 	struct genfb_ops ops;
+	pcireg_t rom;
 	int idx, bar, type;
 	char devinfo[256];
 
@@ -136,7 +137,7 @@
 	/* mmap()able bus ranges */
 	idx = 0;
 	bar = 0x10;
-	while (bar  0x30) {
+	while (bar  0x34) {
 
 		type = pci_mapreg_type(sc-sc_pc, sc-sc_pcitag, bar);
 		if ((type == PCI_MAPREG_TYPE_MEM) || 
@@ -148,10 +149,15 @@
 			sc-sc_ranges[idx].flags);
 			idx++;
 		}
-		sc-sc_bars[(bar - 0x10)  2] =
+		sc-sc_bars[(bar - 0x10)  2] = rom =
 		pci_conf_read(sc-sc_pc, sc-sc_pcitag, bar);
+		if ((bar == PCI_MAPREG_ROM)  (rom != 0)) {
+			pci_conf_write(sc-sc_pc, sc-sc_pcitag, bar, rom |
+			PCI_MAPREG_ROM_ENABLE);
+		}
 		bar += 4;
 	}
+
 	sc-sc_ranges_used = idx;			
 
 	ops.genfb_ioctl = pci_genfb_ioctl;
@@ -258,6 +264,25 @@
 	 * somewhere in a MD header and compile this code only if all are
 	 * present
 	 */
+	/*
+	 * no.
+	 * PCI_IOAREA_PADDR would be completely, utterly wrong and completely
+	 * useless for the following reasons:
+	 * - it's a bus address, not a physical address
+	 * - there's no guarantee it's the same for each host bridge
+	 * - it's already taken care of by the IO tag
+	 * PCI_IOAREA_OFFSET is the same as PCI_MAGIC_IO_RANGE
+	 * PCI_IOAREA_SIZE is also useless:
+	 * - many cards don't decode more than 16 bit IO anyway
+	 * - even machines with more than 64kB IO space try to keep everything
+	 *   within 64kB for the reason above
+	 * - IO ranges tend to be small so in most cases you can't cram enough
+	 *   cards into a single machine to exhaust 64kB IO space
+	 * - machines which need this tend to prefer memory space anyway
+	 * - the only use for this right now is to allow the Xserver to map
+	 *   VGA registers on macppc and a few other powerpc ports, shark uses
+	 *   a similar mechanism, and what they need is always within 64kB
+	 */
 #ifdef PCI_MAGIC_IO_RANGE
 	/* allow to map our IO space */
 	if ((offset = PCI_MAGIC_IO_RANGE) 



CVS commit: src/sys/dev/pci

2010-02-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 21:09:00 UTC 2010

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

Log Message:
add a comment on PCI_MAGIC_IO_RANGE


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/genfb_pci.c

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



CVS commit: src/doc

2010-02-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 21:13:07 UTC 2010

Modified Files:
src/doc: CHANGES

Log Message:
mention wcfb


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

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



CVS commit: src/doc

2010-02-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 21:13:07 UTC 2010

Modified Files:
src/doc: CHANGES

Log Message:
mention wcfb


To generate a diff of this commit:
cvs rdiff -u -r1.1361 -r1.1362 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.1361 src/doc/CHANGES:1.1362
--- src/doc/CHANGES:1.1361	Sun Feb 21 05:21:25 2010
+++ src/doc/CHANGES	Thu Feb 25 21:13:07 2010
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1361 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1362 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -554,3 +554,4 @@
 		hardware monitor with limit support.	[cnst 20100209]
 	wbsio(4): New driver for Winbond Super I/O attachment of
 		lm(4) on any port.	[cnst 20100221]
+	wcfb: A driver for 3Dlabs Wildcat graphics cards [macallan 20100224]



CVS commit: src/sys/dev/pci

2010-02-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 03:20:02 UTC 2010

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1020 -r1.1021 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1019 -r1.1020 src/sys/dev/pci/pcidevs_data.h

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



CVS commit: src/sys/dev/pci

2010-02-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 03:33:09 UTC 2010

Modified Files:
src/sys/dev/pci: files.pci
Added Files:
src/sys/dev/pci: wcfb.c

Log Message:
a very preliminary driver for Wildcat 5110 / Sun XVR-500 graphics boards
Since we don't have any documentationthis driver is unaccelerated and thanks
to the insane state we get the hardware in it's also slow and scrolling
looks weird.
Some hardware info came from OpenBSD's ifb driver.


To generate a diff of this commit:
cvs rdiff -u -r1.325 -r1.326 src/sys/dev/pci/files.pci
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/wcfb.c

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



CVS commit: src/sys/dev/sbus

2010-02-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 18 02:21:39 UTC 2010

Modified Files:
src/sys/dev/sbus: dbri.c

Log Message:
Abort setup when we find no audio codec to avoid crashing later on with
ISDN-only cards.
Should fix PR41055


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/sbus/dbri.c

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



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist

2010-02-10 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Feb 11 00:16:41 UTC 2010

Update of /cvsroot/xsrc/external/mit/xf86-video-suncg14/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv4491

Log Message:
suncg14 driver, from Xorg

Status:

Vendor Tag: XORG
Release Tags:   SUNCG14-1-1-0

N xsrc/external/mit/xf86-video-suncg14/dist/depcomp
N xsrc/external/mit/xf86-video-suncg14/dist/config.guess
N xsrc/external/mit/xf86-video-suncg14/dist/COPYING
N xsrc/external/mit/xf86-video-suncg14/dist/ltmain.sh
N xsrc/external/mit/xf86-video-suncg14/dist/Makefile.in
N xsrc/external/mit/xf86-video-suncg14/dist/missing
N xsrc/external/mit/xf86-video-suncg14/dist/Makefile.am
N xsrc/external/mit/xf86-video-suncg14/dist/install-sh
N xsrc/external/mit/xf86-video-suncg14/dist/config.h.in
N xsrc/external/mit/xf86-video-suncg14/dist/configure.ac
N xsrc/external/mit/xf86-video-suncg14/dist/ChangeLog
N xsrc/external/mit/xf86-video-suncg14/dist/configure
N xsrc/external/mit/xf86-video-suncg14/dist/aclocal.m4
N xsrc/external/mit/xf86-video-suncg14/dist/config.sub
N xsrc/external/mit/xf86-video-suncg14/dist/man/Makefile.in
N xsrc/external/mit/xf86-video-suncg14/dist/man/Makefile.am
N xsrc/external/mit/xf86-video-suncg14/dist/man/suncg14.man
N xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c
N xsrc/external/mit/xf86-video-suncg14/dist/src/Makefile.in
N xsrc/external/mit/xf86-video-suncg14/dist/src/Makefile.am
N xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h

No conflicts created by this import



CVS commit: src/external/mit/xorg/server/drivers

2010-02-10 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 11 04:07:17 UTC 2010

Modified Files:
src/external/mit/xorg/server/drivers: Makefile

Log Message:
build the suncg14 driver on sparc


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/external/mit/xorg/server/drivers/Makefile

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



CVS commit: src/sys/dev/pci

2010-02-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb  3 19:32:41 UTC 2010

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

Log Message:
do not attach to Powrbook G3 onboard Firewire controllers until someone with
access to the hardware can figure out why it deadlocks during device
discovery


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/fwohci_pci.c

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



  1   2   >