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

2021-08-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Aug  9 04:07:29 UTC 2021

Added Files:
src/sys/arch/macppc/dev: smuiic.c smuiicvar.h

Log Message:
Fix CVS eff-up.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.10 src/sys/arch/macppc/dev/smuiic.c
cvs rdiff -u -r0 -r1.3 src/sys/arch/macppc/dev/smuiicvar.h

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

Added files:

Index: src/sys/arch/macppc/dev/smuiic.c
diff -u /dev/null src/sys/arch/macppc/dev/smuiic.c:1.10
--- /dev/null	Mon Aug  9 04:07:29 2021
+++ src/sys/arch/macppc/dev/smuiic.c	Mon Aug  9 04:07:29 2021
@@ -0,0 +1,135 @@
+/*	$NetBSD: smuiic.c,v 1.10 2021/08/09 04:07:29 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2013 Phileas Fogg
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+struct smuiic_softc {
+	device_t sc_dev;
+	int sc_node;
+	struct i2c_controller *sc_i2c;
+};
+
+static int smuiic_match(device_t, struct cfdata *, void *);
+static void smuiic_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(smuiic, sizeof(struct smuiic_softc),
+smuiic_match, smuiic_attach, NULL, NULL);
+
+static int
+smuiic_match(device_t parent, struct cfdata *cf, void *aux)
+{
+	struct smu_iicbus_confargs *ca = aux;
+
+	if (strcmp(ca->ca_name, "i2c-bus") == 0)
+		return 5;
+	if (strcmp(ca->ca_name, "i2c") == 0)
+		return 5;
+	
+	return 0;
+}
+
+static void
+smuiic_attach(device_t parent, device_t self, void *aux)
+{
+	struct smu_iicbus_confargs *ca = aux;
+	struct smuiic_softc *sc = device_private(self);
+	struct i2cbus_attach_args iba;
+	prop_dictionary_t dict = device_properties(self);
+	int devs, devc;
+	uint32_t addr;
+	char compat[256];
+	prop_array_t cfg;
+	prop_dictionary_t dev;
+	prop_data_t data;
+	char name[32], descr[32], num[8];
+
+	sc->sc_dev = self;
+	sc->sc_node = ca->ca_node;
+	sc->sc_i2c = ca->ca_tag;
+	printf("\n");
+
+	cfg = prop_array_create();
+	prop_dictionary_set(dict, "i2c-child-devices", cfg);
+	prop_object_release(cfg);
+
+	/* look for i2c devices */
+	devs = OF_child(sc->sc_node);
+	while (devs != 0) {
+		if (OF_getprop(devs, "name", name, 256) <= 0)
+			goto skip;
+		if (OF_getprop(devs, "compatible",
+		compat, 256) <= 0)
+			goto skip;
+		if (OF_getprop(devs, "reg", &addr, 4) <= 0)
+			goto skip;
+		addr = (addr & 0xff) >> 1;
+		dev = prop_dictionary_create();
+		prop_dictionary_set_string(dev, "name", name);
+		data = prop_data_create_copy(compat, strlen(compat)+1);
+		prop_dictionary_set(dev, "compatible", data);
+		prop_object_release(data);
+		prop_dictionary_set_uint32(dev, "addr", addr);
+		prop_dictionary_set_uint64(dev, "cookie", devs);
+		devc = OF_child(devs);
+		while (devc != 0) {
+			int reg;
+			if (OF_getprop(devc, "reg", ®, 4) < 4) goto nope;
+			if (OF_getprop(devc, "location", descr, 32) <= 0)
+goto nope;
+			printf("found '%s' at %02x\n", descr, reg);
+			snprintf(num, 7, "s%02x", reg);
+			prop_dictionary_set_string(dev, num, descr);
+		nope:
+			devc = OF_peer(devc);
+		}
+		prop_array_add(cfg, dev);
+		prop_object_release(dev);
+	skip:
+		devs = OF_peer(devs);
+	}
+
+	memset(&iba, 0, sizeof(iba));
+	iba.iba_tag = sc->sc_i2c;
+
+	config_found(sc->sc_dev, &iba, iicbus_print, CFARGS_NONE);
+}

Index: src/sys/arch/macppc/dev/smuiicvar.h
diff -u /dev/null src/sys/arch/macppc/dev/smuiicvar.h:1.3
--- /dev/null	Mon Aug  9 04:07:29 2021
+++ src/sys/arch/macppc/dev/smuiicvar.h	Mon Aug  9 04:07:29 2021
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 2013 Phileas Fogg
+ * All rights reserved.

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

2021-08-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Aug  7 06:04:26 UTC 2021

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

Log Message:
pass sensor locations to i2c devices if we can find them
tested on 2nd gen Mini


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/macppc/dev/pmu.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/pmu.c
diff -u src/sys/arch/macppc/dev/pmu.c:1.37 src/sys/arch/macppc/dev/pmu.c:1.38
--- src/sys/arch/macppc/dev/pmu.c:1.37	Sat Apr 24 23:36:41 2021
+++ src/sys/arch/macppc/dev/pmu.c	Sat Aug  7 06:04:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmu.c,v 1.37 2021/04/24 23:36:41 thorpej Exp $ */
+/*	$NetBSD: pmu.c,v 1.38 2021/08/07 06:04:26 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.37 2021/04/24 23:36:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.38 2021/08/07 06:04:26 macallan Exp $");
 
 #include 
 #include 
@@ -340,7 +340,7 @@ pmu_attach(device_t parent, device_t sel
 			goto next;
 
 		if (strncmp(name, "pmu-i2c", 8) == 0) {
-			int devs;
+			int devs, sensors;
 			uint32_t addr;
 			char compat[256];
 			prop_array_t cfg;
@@ -372,6 +372,20 @@ pmu_attach(device_t parent, device_t sel
 prop_object_release(data);
 prop_dictionary_set_uint32(dev, "addr", addr);
 prop_dictionary_set_uint64(dev, "cookie", devs);
+sensors = OF_child(devs);
+while (sensors != 0) {
+	int reg;
+	char loc[64];
+	char pname[8];
+	if (OF_getprop(sensors, "reg", ®, 4) != 4)
+		goto nope;
+	if (OF_getprop(sensors, "location", loc, 63) <= 0)
+		goto nope;
+	snprintf(pname, 7, "s%02x", reg);
+	prop_dictionary_set_string(dev, pname, loc);
+nope:
+	sensors = OF_peer(sensors);
+}
 prop_array_add(cfg, dev);
 prop_object_release(dev);
 			skip:
@@ -818,7 +832,7 @@ pmu_poweroff(void)
 	if (pmu_send(sc, PMU_POWER_OFF, 4, cmd, 16, resp) >= 0)
 		while (1);
 }
-
+	
 void
 pmu_restart(void)
 {



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

2021-07-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul 30 22:07:14 UTC 2021

Modified Files:
src/sys/arch/macppc/dev: fancontrol.c fancontrolvar.h fcu.c

Log Message:
make thermal zone parameters configurable by sysctl


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/macppc/dev/fancontrol.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/fancontrolvar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/macppc/dev/fcu.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/fancontrol.c
diff -u src/sys/arch/macppc/dev/fancontrol.c:1.2 src/sys/arch/macppc/dev/fancontrol.c:1.3
--- src/sys/arch/macppc/dev/fancontrol.c:1.2	Wed Jul 28 00:36:00 2021
+++ src/sys/arch/macppc/dev/fancontrol.c	Fri Jul 30 22:07:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: fancontrol.c,v 1.2 2021/07/28 00:36:00 macallan Exp $ */
+/* $NetBSD: fancontrol.c,v 1.3 2021/07/30 22:07:14 macallan Exp $ */
 
 /*-
  * Copyright (c) 2021 Michael Lorenz
@@ -27,13 +27,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fancontrol.c,v 1.2 2021/07/28 00:36:00 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fancontrol.c,v 1.3 2021/07/30 22:07:14 macallan Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -60,6 +61,10 @@ fancontrol_adjust_zone(fancontrol_zone_t
 		return -1;
 	}
 
+	if (z->Tmin < 30) z->Tmin = 30;
+	if (z->Tmin > 60) z->Tmin = 60;
+	if (z->Tmax > 95) z->Tmax = 95;
+	if (z->Tmax < (z->Tmin + 10)) z->Tmax = z->Tmin + 10;
 	temp = (temp - 27315) / 100;
 	diff = temp - z->Tmin;
 	DPRINTF("%s %d %d\n", z->name, temp, z->Tmin);
@@ -76,3 +81,39 @@ fancontrol_adjust_zone(fancontrol_zone_t
 	}
 	return 0;
 }
+
+int
+fancontrol_init_zone(fancontrol_zone_t *z, struct sysctlnode *me)
+{
+	struct sysctlnode *zone_node, *node;
+
+	if (z->nfans <= 0) return 0;
+
+	sysctl_createv(NULL, 0, NULL, (void *) &zone_node,
+	CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
+	CTLTYPE_NODE, z->name, NULL,
+	NULL, 0, NULL, 0,
+	CTL_MACHDEP,
+	me->sysctl_num,
+	CTL_CREATE, CTL_EOL);
+
+	sysctl_createv(NULL, 0, NULL, (void *) &node,
+	CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
+	CTLTYPE_INT, "Tmin", "minimum temperature",
+	NULL, 0, (void *)&z->Tmin, 0,
+	CTL_MACHDEP,
+	me->sysctl_num,
+	zone_node->sysctl_num,
+	CTL_CREATE, CTL_EOL);
+
+	sysctl_createv(NULL, 0, NULL, (void *) &node,
+	CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
+	CTLTYPE_INT, "Tmax", "maximum temperature",
+	NULL, 0, (void *)&z->Tmax, 0,
+	CTL_MACHDEP,
+	me->sysctl_num,
+	zone_node->sysctl_num,
+	CTL_CREATE, CTL_EOL);
+
+	return 0;
+}

Index: src/sys/arch/macppc/dev/fancontrolvar.h
diff -u src/sys/arch/macppc/dev/fancontrolvar.h:1.1 src/sys/arch/macppc/dev/fancontrolvar.h:1.2
--- src/sys/arch/macppc/dev/fancontrolvar.h:1.1	Tue Jul 27 23:38:42 2021
+++ src/sys/arch/macppc/dev/fancontrolvar.h	Fri Jul 30 22:07:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: fancontrolvar.h,v 1.1 2021/07/27 23:38:42 macallan Exp $ */
+/* $NetBSD: fancontrolvar.h,v 1.2 2021/07/30 22:07:14 macallan Exp $ */
 
 /*-
  * Copyright (c) 2021 Michael Lorenz
@@ -48,5 +48,6 @@ typedef struct _fancontrol_zone {
 } fancontrol_zone_t; 
 
 int fancontrol_adjust_zone(fancontrol_zone_t *);
+int fancontrol_init_zone(fancontrol_zone_t *, struct sysctlnode *);
 
 #endif /* FANCONTROLVAR_H */

Index: src/sys/arch/macppc/dev/fcu.c
diff -u src/sys/arch/macppc/dev/fcu.c:1.3 src/sys/arch/macppc/dev/fcu.c:1.4
--- src/sys/arch/macppc/dev/fcu.c:1.3	Wed Jul 28 00:59:10 2021
+++ src/sys/arch/macppc/dev/fcu.c	Fri Jul 30 22:07:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: fcu.c,v 1.3 2021/07/28 00:59:10 macallan Exp $ */
+/* $NetBSD: fcu.c,v 1.4 2021/07/30 22:07:14 macallan Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.3 2021/07/28 00:59:10 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.4 2021/07/30 22:07:14 macallan Exp $");
 
 #include 
 #include 
@@ -35,6 +35,7 @@ __KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.3 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -78,8 +79,8 @@ struct fcu_softc {
 	device_t	sc_dev;
 	i2c_tag_t	sc_i2c;
 	i2c_addr_t	sc_addr;
-
-	struct sysmon_envsys *sc_sme;
+	struct sysctlnode 	*sc_sysctl_me;
+	struct sysmon_envsys	*sc_sme;
 	envsys_data_t		sc_sensors[32];
 	int			sc_nsensors;
 	fancontrol_zone_t	sc_zones[FCU_ZONE_COUNT];
@@ -132,7 +133,7 @@ fcu_attach(device_t parent, device_t sel
 {
 	struct fcu_softc *sc = device_private(self);
 	struct i2c_attach_args *ia = aux;
-	int have_eeprom1 = 1;
+	int have_eeprom1 = 1, i;
 
 	sc->sc_dev = self;
 	sc->sc_i2c = ia->ia_tag;
@@ -141,6 +142,12 @@ fcu_attach(device_t parent, device_t sel
 	aprint_naive("\n");
 	aprint_normal(": Fan Control Unit\n");
 
+	sysctl_createv(NULL, 0, NULL, (void *) &sc->sc_sysctl_me,
+	CTLFLAG_READWRITE,
+	CTLTYPE_NODE, 

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

2021-07-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 28 00:59:10 UTC 2021

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

Log Message:
check temperatures a bit more often
while there, explain why the delay is variable


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/macppc/dev/fcu.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/fcu.c
diff -u src/sys/arch/macppc/dev/fcu.c:1.2 src/sys/arch/macppc/dev/fcu.c:1.3
--- src/sys/arch/macppc/dev/fcu.c:1.2	Tue Jul 27 23:38:42 2021
+++ src/sys/arch/macppc/dev/fcu.c	Wed Jul 28 00:59:10 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: fcu.c,v 1.2 2021/07/27 23:38:42 macallan Exp $ */
+/* $NetBSD: fcu.c,v 1.3 2021/07/28 00:59:10 macallan Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.2 2021/07/27 23:38:42 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.3 2021/07/28 00:59:10 macallan Exp $");
 
 #include 
 #include 
@@ -490,7 +490,13 @@ fcu_adjust(void *cookie)
 		sc->sc_pwm = FALSE;
 		for (i = 0; i < FCU_ZONE_COUNT; i++)
 			fancontrol_adjust_zone(&sc->sc_zones[i]);
-		kpause("fanctrl", true, mstohz(sc->sc_pwm ? 1000 : 5000), NULL);
+		/*
+		 * take a shorter nap if we're in the proccess of adjusting a
+		 * PWM fan, which relies on measuring speed and then changing
+		 * its duty cycle until we're reasonable close to the target
+		 * speed
+		 */
+		kpause("fanctrl", true, mstohz(sc->sc_pwm ? 1000 : 2000), NULL);
 	}
 	kthread_exit(0);
 }



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

2021-07-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 28 00:36:00 UTC 2021

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

Log Message:
adjust comments, break a long line
NFC


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/fancontrol.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/fancontrol.c
diff -u src/sys/arch/macppc/dev/fancontrol.c:1.1 src/sys/arch/macppc/dev/fancontrol.c:1.2
--- src/sys/arch/macppc/dev/fancontrol.c:1.1	Tue Jul 27 23:38:42 2021
+++ src/sys/arch/macppc/dev/fancontrol.c	Wed Jul 28 00:36:00 2021
@@ -1,7 +1,7 @@
-/* $NetBSD: fancontrol.c,v 1.1 2021/07/27 23:38:42 macallan Exp $ */
+/* $NetBSD: fancontrol.c,v 1.2 2021/07/28 00:36:00 macallan Exp $ */
 
 /*-
- * Copyright (c) 2018 Michael Lorenz
+ * Copyright (c) 2021 Michael Lorenz
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fancontrol.c,v 1.1 2021/07/27 23:38:42 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fancontrol.c,v 1.2 2021/07/28 00:36:00 macallan Exp $");
 
 #include 
 #include 
@@ -66,11 +66,12 @@ fancontrol_adjust_zone(fancontrol_zone_t
 	if (diff < 0) diff = 0;
 	diff = (100 * diff) / (z->Tmax - z->Tmin);
 
-	/* now adjust each fan to the new duty cycle */
+	/* now adjust each fan to the new speed */
 	for (i = 0; i < z->nfans; i++) {
 		step = (z->fans[i].max_rpm - z->fans[i].min_rpm) / 100;
 		speed = z->fans[i].min_rpm + diff * step;
-		DPRINTF("diff %d base %d %d sp %d\n", diff, z->fans[i].min_rpm, z->fans[i].max_rpm, speed);
+		DPRINTF("diff %d base %d %d sp %d\n",
+		diff, z->fans[i].min_rpm, z->fans[i].max_rpm, speed);
 		z->set_rpm(z->cookie, z->fans[i].num, speed);
 	}
 	return 0;



CVS commit: src/sys/arch/macppc

2021-07-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jul 27 23:38:42 UTC 2021

Modified Files:
src/sys/arch/macppc/conf: files.macppc
src/sys/arch/macppc/dev: fcu.c
Added Files:
src/sys/arch/macppc/dev: fancontrol.c fancontrolvar.h

Log Message:
first step towards abstracting thermal zone management out of the fcu driver
( and eventually, the smu driver )
todo:
- add sysctl()s to set zone parameters
- handle envsys
- adapt smu


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/macppc/conf/files.macppc
cvs rdiff -u -r0 -r1.1 src/sys/arch/macppc/dev/fancontrol.c \
src/sys/arch/macppc/dev/fancontrolvar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/fcu.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.120 src/sys/arch/macppc/conf/files.macppc:1.121
--- src/sys/arch/macppc/conf/files.macppc:1.120	Tue Jul 27 20:23:41 2021
+++ src/sys/arch/macppc/conf/files.macppc	Tue Jul 27 23:38:42 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.macppc,v 1.120 2021/07/27 20:23:41 macallan Exp $
+#	$NetBSD: files.macppc,v 1.121 2021/07/27 23:38:42 macallan Exp $
 #
 # macppc-specific configuration info
 
@@ -176,7 +176,11 @@ device zstty: tty
 attach zstty at zsc
 file dev/ic/z8530tty.czstty needs-flag
 
-device smu { }
+define fancontrol
+file arch/macppc/dev/fancontrol.c		fancontrol
+defflag	opt_fancontrol.h	FANCONTROL_DEBUG
+
+device smu { } : fancontrol
 attach smu at mainbus
 file arch/macppc/dev/smu.c			smu needs-flag
 defflag	opt_smu.h	SMU_DEBUG
@@ -328,6 +332,6 @@ file	arch/macppc/dev/lmu.clmu
 defflag opt_lmu.h LMU_DEBUG
 
 # Apple Fan Control Unit found in some G5
-device	fcu: sysmon_envsys
+device	fcu: sysmon_envsys, fancontrol
 attach	fcu at iic
 file	arch/macppc/dev/fcu.cfcu	needs-flag

Index: src/sys/arch/macppc/dev/fcu.c
diff -u src/sys/arch/macppc/dev/fcu.c:1.1 src/sys/arch/macppc/dev/fcu.c:1.2
--- src/sys/arch/macppc/dev/fcu.c:1.1	Tue Jul 27 20:23:41 2021
+++ src/sys/arch/macppc/dev/fcu.c	Tue Jul 27 23:38:42 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: fcu.c,v 1.1 2021/07/27 20:23:41 macallan Exp $ */
+/* $NetBSD: fcu.c,v 1.2 2021/07/27 23:38:42 macallan Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.1 2021/07/27 20:23:41 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.2 2021/07/27 23:38:42 macallan Exp $");
 
 #include 
 #include 
@@ -42,6 +42,8 @@ __KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.1 
 
 #include 
 
+#include 
+
 //#define FCU_DEBUG
 #ifdef FCU_DEBUG
 #define DPRINTF printf
@@ -58,14 +60,6 @@ __KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.1 
 #define FCU_PWM_ACTIVE	0x2d
 #define FCU_PWMREAD(x)	0x30 + (x)*2
 
-#define FCU_MAX_FANS 10
-
-typedef struct _fcu_zone {
-	bool (*filter)(const envsys_data_t *);
-	int nfans;
-	int fans[FCU_MAX_FANS];
-	int threshold;
-} fcu_zone_t; 
 
 typedef struct _fcu_fan {
 	int target;
@@ -86,15 +80,15 @@ struct fcu_softc {
 	i2c_addr_t	sc_addr;
 
 	struct sysmon_envsys *sc_sme;
-	envsys_data_t	sc_sensors[32];
-	int		sc_nsensors;
-	fcu_zone_t	sc_zones[FCU_ZONE_COUNT];
-	fcu_fan_t	sc_fans[FCU_MAX_FANS];
-	int		sc_nfans;
-	lwp_t		*sc_thread;
-	bool		sc_dying, sc_pwm;
-	uint8_t		sc_eeprom0[160];
-	uint8_t		sc_eeprom1[160];
+	envsys_data_t		sc_sensors[32];
+	int			sc_nsensors;
+	fancontrol_zone_t	sc_zones[FCU_ZONE_COUNT];
+	fcu_fan_t		sc_fans[FANCONTROL_MAX_FANS];
+	int			sc_nfans;
+	lwp_t			*sc_thread;
+	bool			sc_dying, sc_pwm;
+	uint8_t			sc_eeprom0[160];
+	uint8_t			sc_eeprom1[160];
 };
 
 static int	fcu_match(device_t, cfdata_t, void *);
@@ -106,8 +100,8 @@ static bool is_cpu(const envsys_data_t *
 static bool is_case(const envsys_data_t *);
 static bool is_drive(const envsys_data_t *);
 
-static void fcu_set_fan_rpm(struct fcu_softc *, fcu_fan_t *, int);
-static void fcu_adjust_zone(struct fcu_softc *, int);
+static int fcu_set_rpm(void *, int, int);
+static int fcu_get_rpm(void *, int);
 static void fcu_adjust(void *);
 
 CFATTACH_DECL_NEW(fcu, sizeof(struct fcu_softc),
@@ -160,14 +154,29 @@ fcu_attach(device_t parent, device_t sel
 		have_eeprom1 = 0;
 
 	/* init zones */
+	sc->sc_zones[FCU_ZONE_CPU].name = "CPUs";
 	sc->sc_zones[FCU_ZONE_CPU].filter = is_cpu;
-	sc->sc_zones[FCU_ZONE_CPU].threshold = 50;
+	sc->sc_zones[FCU_ZONE_CPU].cookie = sc;
+	sc->sc_zones[FCU_ZONE_CPU].get_rpm = fcu_get_rpm;
+	sc->sc_zones[FCU_ZONE_CPU].set_rpm = fcu_set_rpm;
+	sc->sc_zones[FCU_ZONE_CPU].Tmin = 50;
+	sc->sc_zones[FCU_ZONE_CPU].Tmax = 85;
 	sc->sc_zones[FCU_ZONE_CPU].nfans = 0;
+	sc->sc_zones[FCU_ZONE_CASE].name = "Slots";
 	sc->sc_zones[FCU_ZONE_CASE].filter = is_case;
-	sc->sc_zones[FCU_ZONE_CASE].threshold = 50;
+	sc->sc_zones[FCU_ZONE_CASE].Tmin = 50;
+	sc->sc_zones[FCU_ZONE_CASE].cookie = sc;
+	sc->sc_zones[FCU_ZONE_CASE].get_rpm = fcu_get_rpm;
+	sc->sc_zones[FCU_ZO

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

2021-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  2 10:14:07 UTC 2021

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

Log Message:
port-macppc/56289: kernel spinout on macppc when runing ATF tests with LOCKDEBUG

Move call to snapper_set_rate from trigger_output to commit_settings,
since the intr lock is not held when calling the latter.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 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.59 src/sys/arch/macppc/dev/snapper.c:1.60
--- src/sys/arch/macppc/dev/snapper.c:1.59	Mon Apr 26 14:01:47 2021
+++ src/sys/arch/macppc/dev/snapper.c	Fri Jul  2 10:14:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.59 2021/04/26 14:01:47 thorpej Exp $	*/
+/*	$NetBSD: snapper.c,v 1.60 2021/07/02 10:14:07 jmcneill 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.59 2021/04/26 14:01:47 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.60 2021/07/02 10:14:07 jmcneill Exp $");
 
 #include 
 #include 
@@ -133,6 +133,7 @@ static int snapper_query_format(void *, 
 static int snapper_set_format(void *, int,
 const audio_params_t *, const audio_params_t *,
 audio_filter_reg_t *, audio_filter_reg_t *);
+static int snapper_commit_settings(void *);
 static int snapper_round_blocksize(void *, int, int, const audio_params_t *);
 static int snapper_halt_output(void *);
 static int snapper_halt_input(void *);
@@ -232,6 +233,7 @@ CFATTACH_DECL_NEW(snapper, sizeof(struct
 const struct audio_hw_if snapper_hw_if = {
 	.query_format		= snapper_query_format,
 	.set_format		= snapper_set_format,
+	.commit_settings	= snapper_commit_settings,
 	.round_blocksize	= snapper_round_blocksize,
 	.halt_output		= snapper_halt_output,
 	.halt_input		= snapper_halt_input,
@@ -1013,6 +1015,17 @@ snapper_set_format(void *h, int setmode,
 }
 
 static int
+snapper_commit_settings(void *h)
+{
+	struct snapper_softc *sc;
+
+	DPRINTF("commit_settings\n");
+	sc = h;
+
+	return snapper_set_rate(sc);
+}
+
+static int
 snapper_round_blocksize(void *h, int size, int mode,
 			const audio_params_t *param)
 {
@@ -1408,14 +1421,10 @@ snapper_trigger_output(void *h, void *st
 	struct dbdma_command *cmd;
 	vaddr_t va;
 	int i, len, intmode;
-	int res;
 
 	DPRINTF("trigger_output %p %p 0x%x\n", start, end, bsize);
 	sc = h;
 
-	if ((res = snapper_set_rate(sc)) != 0)
-		return res;
-
 	cmd = sc->sc_odmacmd;
 	sc->sc_ointr = intr;
 	sc->sc_oarg = arg;
@@ -1463,14 +1472,10 @@ snapper_trigger_input(void *h, void *sta
 	struct dbdma_command *cmd;
 	vaddr_t va;
 	int i, len, intmode;
-	int res;
 
 	DPRINTF("trigger_input %p %p 0x%x\n", start, end, bsize);
 	sc = h;
 
-	if ((res = snapper_set_rate(sc)) != 0)
-		return res;
-
 	cmd = sc->sc_idmacmd;
 	sc->sc_iintr = intr;
 	sc->sc_iarg = arg;



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

2021-06-23 Thread Chris Pinnock
Module Name:src
Committed By:   cjep
Date:   Wed Jun 23 20:20:44 UTC 2021

Modified Files:
src/sys/arch/macppc/stand/fixcoff: fixcoff.c

Log Message:
nbmacppc-fixcoff did not cross-build correctly on OpenBSD because
fixcoff.c had its own definition of htobe16. The toolchain
already handles this. Now builds on OpenBSD. Checked on NetBSD, Darwin &
Linux.

Discussed with uwe@


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/macppc/stand/fixcoff/fixcoff.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/stand/fixcoff/fixcoff.c
diff -u src/sys/arch/macppc/stand/fixcoff/fixcoff.c:1.11 src/sys/arch/macppc/stand/fixcoff/fixcoff.c:1.12
--- src/sys/arch/macppc/stand/fixcoff/fixcoff.c:1.11	Sat Mar 14 15:36:09 2009
+++ src/sys/arch/macppc/stand/fixcoff/fixcoff.c	Wed Jun 23 20:20:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fixcoff.c,v 1.11 2009/03/14 15:36:09 dsl Exp $ */
+/*	$NetBSD: fixcoff.c,v 1.12 2021/06/23 20:20:44 cjep Exp $ */
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -43,30 +43,15 @@
 
 #if HAVE_NBTOOL_CONFIG_H
 #include "nbtool_config.h"
-#endif
+#else	/* HAVE_NBTOOL_CONFIG_H */
+#include 
+#endif	/* HAVE_NBTOOL_CONFIG_H */
 
 #include 
 #include 
 #include 
 #include 
 
-#if HAVE_NBTOOL_CONFIG_H
-
-#if WORDS_BIGENDIAN
-#define	htobe16(x)	(x)
-#else
-static unsigned short
-__htobe16(unsigned short x)
-{
-	return (((x & 0xff00) >> 8) | ((x & 0x00ff) << 8));
-}
-#define	htobe16(x) __htobe16(x)
-#endif /* WORDS_BIGENDIAN */
-
-#else	/* HAVE_NBTOOL_CONFIG_H */
-#include 
-#endif	/* HAVE_NBTOOL_CONFIG_H */
-
 struct filehdr {
 #define U802WRMAGIC 0730
 #define U802ROMAGIC 0735



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

2021-06-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 18 23:00:47 UTC 2021

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

Log Message:
do ii2 locking dance in psoc_dump()


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.7 src/sys/arch/macppc/dev/psoc.c:1.8
--- src/sys/arch/macppc/dev/psoc.c:1.7	Fri Jun 18 22:57:18 2021
+++ src/sys/arch/macppc/dev/psoc.c	Fri Jun 18 23:00:47 2021
@@ -1,4 +1,4 @@
- /* $NetBSD: psoc.c,v 1.7 2021/06/18 22:57:18 macallan Exp $ */
+ /* $NetBSD: psoc.c,v 1.8 2021/06/18 23:00:47 macallan Exp $ */
 
 /*-
  * Copyright (c) 2019 Michael Lorenz
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.7 2021/06/18 22:57:18 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.8 2021/06/18 23:00:47 macallan Exp $");
 
 #include 
 #include 
@@ -221,6 +221,8 @@ psoc_dump(struct psoc_softc *sc)
 {
 	int i, j;
 	uint8_t data, cmd;
+
+	iic_acquire_bus(sc->sc_i2c, 0);
 	for (i = 0x20; i < 0x5f; i+= 8) {
 		printf("%02x:", i);
 		for (j = 0; j < 8; j++) {
@@ -232,4 +234,5 @@ psoc_dump(struct psoc_softc *sc)
 		}
 		printf("\n");
 	}
+	iic_release_bus(sc->sc_i2c, 0);
 }



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

2021-06-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 18 22:57:18 UTC 2021

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

Log Message:
use opt_psoc.h, suppress some debug output in !PSOC_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 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.6 src/sys/arch/macppc/dev/psoc.c:1.7
--- src/sys/arch/macppc/dev/psoc.c:1.6	Wed Jan 27 02:17:28 2021
+++ src/sys/arch/macppc/dev/psoc.c	Fri Jun 18 22:57:18 2021
@@ -1,4 +1,4 @@
- /* $NetBSD: psoc.c,v 1.6 2021/01/27 02:17:28 thorpej Exp $ */
+ /* $NetBSD: psoc.c,v 1.7 2021/06/18 22:57:18 macallan Exp $ */
 
 /*-
  * Copyright (c) 2019 Michael Lorenz
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.6 2021/01/27 02:17:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.7 2021/06/18 22:57:18 macallan Exp $");
 
 #include 
 #include 
@@ -57,6 +57,13 @@ __KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.6
 
 #include 
 
+#include "opt_psoc.h"
+#ifdef PSOC_DEBUG
+#define DPRINTF printf
+#else
+#define DPRINTF if (0) printf
+#endif
+
 struct psoc_softc {
 	device_t	sc_dev;
 	i2c_tag_t	sc_i2c;
@@ -117,10 +124,10 @@ psoc_attach(device_t parent, device_t se
 
 	error = OF_package_to_path(sc->sc_node, path, 256);
 	path[error] = 0;
-	printf("path [%s]\n", path);
+	DPRINTF("path [%s]\n", path);
 	ih = OF_open("fan");
 	OF_call_method_1("fan-init", ih, 0);
-	printf("ih %08x\n", ih);
+	DPRINTF("ih %08x\n", ih);
 
 	sc->sc_sme = sysmon_envsys_create();
 	sc->sc_sme->sme_name = device_xname(self);



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

2021-06-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 18 22:52:04 UTC 2021

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

Log Message:
use opt_lmu.h
while there, remove an obsolete comment


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/macppc/dev/lmu.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/lmu.c
diff -u src/sys/arch/macppc/dev/lmu.c:1.8 src/sys/arch/macppc/dev/lmu.c:1.9
--- src/sys/arch/macppc/dev/lmu.c:1.8	Wed Jan 27 02:17:28 2021
+++ src/sys/arch/macppc/dev/lmu.c	Fri Jun 18 22:52:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lmu.c,v 1.8 2021/01/27 02:17:28 thorpej Exp $ */
+/* $NetBSD: lmu.c,v 1.9 2021/06/18 22:52:04 macallan Exp $ */
 
 /*-
  * Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.8 2021/01/27 02:17:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.9 2021/06/18 22:52:04 macallan Exp $");
 
 #include 
 #include 
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.8 
 #include 
 
 #include 
+#include "opt_lmu.h"
 
 #ifdef LMU_DEBUG
 #define DPRINTF printf
@@ -208,7 +209,6 @@ lmu_attach(device_t parent, device_t sel
 
 	sysmon_envsys_register(sc->sc_sme);
 
-	/* TODO: make this adjustable via sysctl */
 	sc->sc_thresh = 300;
 	sc->sc_hyst = 30;
 	sc->sc_level = 16;



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

2021-06-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 18 22:24:51 UTC 2021

Modified Files:
src/sys/arch/macppc/conf: files.macppc

Log Message:
defflag LMU_DEBUG and PSOC_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/macppc/conf/files.macppc

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.118 src/sys/arch/macppc/conf/files.macppc:1.119
--- src/sys/arch/macppc/conf/files.macppc:1.118	Wed May 12 23:22:33 2021
+++ src/sys/arch/macppc/conf/files.macppc	Fri Jun 18 22:24:51 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.macppc,v 1.118 2021/05/12 23:22:33 thorpej Exp $
+#	$NetBSD: files.macppc,v 1.119 2021/06/18 22:24:51 macallan Exp $
 #
 # macppc-specific configuration info
 
@@ -319,8 +319,10 @@ file arch/macppc/dev/platinumfb.c			plat
 device	psoc: sysmon_envsys
 attach	psoc at iic
 file	arch/macppc/dev/psoc.cpsoc
+defflag opt_psoc.h PSOC_DEBUG
 
 # 'lmu-micro' found in late PowerBooks
 device	lmu: sysmon_envsys
 attach	lmu at iic
 file	arch/macppc/dev/lmu.clmu
+defflag opt_lmu.h LMU_DEBUG



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

2021-05-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 24 11:13:44 UTC 2021

Modified Files:
src/sys/arch/macppc/stand/ofwboot: ofdev.c

Log Message:
PR 56205: make the 64bit build work


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/macppc/stand/ofwboot/ofdev.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/stand/ofwboot/ofdev.c
diff -u src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.28 src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.29
--- src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.28	Sun Feb 28 20:27:40 2021
+++ src/sys/arch/macppc/stand/ofwboot/ofdev.c	Mon May 24 11:13:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.28 2021/02/28 20:27:40 thorpej Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.29 2021/05/24 11:13:44 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -103,7 +103,7 @@ devclose(struct open_file *of)
 	uint32_t cells[2];
 	struct of_dev *op = of->f_devdata;
 
-	cells[0] = (uint32_t)op->dmabuf;
+	cells[0] = (uintptr_t)op->dmabuf;
 	cells[1] = MAXPHYS;
 
 	if (op->type == OFDEV_NET)
@@ -439,7 +439,7 @@ devopen(struct open_file *of, const char
 	ofdev.dmabuf = NULL;
 	cells[0] = MAXPHYS;
 	OF_call_method("dma-alloc", handle, 1, 1, (int *)cells);
-	ofdev.dmabuf = (void *)cells[1];
+	ofdev.dmabuf = (void*)(uintptr_t)cells[1];
 	if (!strcmp(buf, "block")) {
 		ofdev.type = OFDEV_DISK;
 		ofdev.bsize = DEV_BSIZE;



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

2021-05-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May  1 15:12:26 UTC 2021

Modified Files:
src/sys/arch/macppc/conf: files.macppc

Log Message:
Remove unnecessary interface attributes from "smu".


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/macppc/conf/files.macppc

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.116 src/sys/arch/macppc/conf/files.macppc:1.117
--- src/sys/arch/macppc/conf/files.macppc:1.116	Sat Apr 24 23:36:41 2021
+++ src/sys/arch/macppc/conf/files.macppc	Sat May  1 15:12:25 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.macppc,v 1.116 2021/04/24 23:36:41 thorpej Exp $
+#	$NetBSD: files.macppc,v 1.117 2021/05/01 15:12:25 thorpej Exp $
 #
 # macppc-specific configuration info
 
@@ -175,8 +175,7 @@ device zstty: tty
 attach zstty at zsc
 file dev/ic/z8530tty.czstty needs-flag
 
-define smu {}
-device smu: smu, obio
+device smu { }
 attach smu at mainbus
 file arch/macppc/dev/smu.c			smu needs-flag
 defflag	opt_smu.h	SMU_DEBUG



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

2021-04-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Apr 26 14:01:47 UTC 2021

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

Log Message:
snapper carries multiple interface attributes, so be explicit about
"onewirebus" when attaching to it.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 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.58 src/sys/arch/macppc/dev/snapper.c:1.59
--- src/sys/arch/macppc/dev/snapper.c:1.58	Sat Apr 24 23:36:41 2021
+++ src/sys/arch/macppc/dev/snapper.c	Mon Apr 26 14:01:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.58 2021/04/24 23:36:41 thorpej Exp $	*/
+/*	$NetBSD: snapper.c,v 1.59 2021/04/26 14:01:47 thorpej 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.58 2021/04/24 23:36:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.59 2021/04/26 14:01:47 thorpej Exp $");
 
 #include 
 #include 
@@ -2301,6 +2301,7 @@ snapper_setup_ow(struct snapper_softc *s
 	memset(&oba, 0, sizeof(oba));
 	oba.oba_bus = &sc->sc_ow_bus;
 	sc->sc_ow_dev = config_found(sc->sc_dev, &oba, onewirebus_print,
+	CFARG_IATTR, "onewirebus",
 	CFARG_EOL);
 
 }



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

2021-04-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr  2 09:27:32 UTC 2021

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

Log Message:
Add gpt wedge support


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/macppc/conf/POWERMAC_G5

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
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.48 src/sys/arch/macppc/conf/POWERMAC_G5:1.49
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.48	Fri Apr  2 06:55:14 2021
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Fri Apr  2 09:27:32 2021
@@ -56,6 +56,14 @@ options 	TRAP_PANICWAIT
 include 	"conf/compat_netbsd70.config"
 #options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
 
+# Wedge support
+options DKWEDGE_AUTODISCOVER# Automatically add dk(4) instances
+options DKWEDGE_METHOD_GPT  # Supports GPT partitions as wedges
+#options	DKWEDGE_METHOD_BSDLABEL # Support disklabel entries as wedges
+#options	DKWEDGE_METHOD_MBR  # Support MBR partitions as wedges
+#options	DKWEDGE_METHOD_APPLE# Support Apple partitions as wedges
+#options 	DKWEDGE_METHOD_RDB	# Support RDB partitions as wedges
+
 # File systems
 file-system 	FFS		# UFS
 file-system 	MFS		# memory file system



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

2021-04-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr  2 06:55:14 UTC 2021

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

Log Message:
Add bpf


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/macppc/conf/POWERMAC_G5

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
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.47 src/sys/arch/macppc/conf/POWERMAC_G5:1.48
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.47	Sun Mar 28 08:43:05 2021
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Fri Apr  2 06:55:14 2021
@@ -229,6 +229,7 @@ pseudo-device	wsmux			# mouse and keyboa
 pseudo-device	clockctl		# user control of clock subsystem
 pseudo-device	drvctl			# user control of drive subsystem
 pseudo-device	ksyms			# /dev/ksyms
+pseudo-device	bpfilter		# packet filter
 #pseudo-device	npf			# NPF packet filter
 
 # Enable the hooks used for initializing the ram-disk.



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

2021-03-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 28 08:43:05 UTC 2021

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

Log Message:
Enable a few more filesystems


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/macppc/conf/POWERMAC_G5

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
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.46 src/sys/arch/macppc/conf/POWERMAC_G5:1.47
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.46	Sun Mar 28 08:39:31 2021
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Sun Mar 28 08:43:05 2021
@@ -63,16 +63,16 @@ file-system 	TMPFS		# memory file system
 file-system 	KERNFS		# /kern
 file-system 	PROCFS		# /proc
 file-system 	NFS		# Network File System client
-#file-system 	CD9660		# ISO 9660 + Rock Ridge file system
-#file-system 	MSDOSFS		# MS-DOS file system
+file-system 	CD9660		# ISO 9660 + Rock Ridge file system
+file-system 	MSDOSFS		# MS-DOS file system
 file-system	PTYFS		# /dev/pts/N support
 #file-system	HFS		# experimental - Apple HFS+ (read-only)
 
 # File system options
-#options 	QUOTA		# legacy UFS quotas
-#options 	QUOTA2		# new, in-filesystem UFS quotas
+options 	QUOTA		# legacy UFS quotas
+options 	QUOTA2		# new, in-filesystem UFS quotas
 #options 	FFS_EI		# FFS Endian Independant support
-#options 	WAPBL		# File system journaling support
+options 	WAPBL		# File system journaling support
 #options 	UFS_DIRHASH	# UFS Large Directory Hashing - Experimental
 #options 	NFSSERVER	# Network File System server
 #options 	FFS_NO_SNAPSHOT	# ffs snapshots



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

2021-03-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 28 08:39:31 UTC 2021

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

Log Message:
Remove makeoptions DEBUG="-g" - we have better ways to achieve the same
(build.sh kernel.gdb= or MKKDEBUG=yes)


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/macppc/conf/POWERMAC_G5

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
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.45 src/sys/arch/macppc/conf/POWERMAC_G5:1.46
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.45	Sun Mar 28 08:34:18 2021
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Sun Mar 28 08:39:31 2021
@@ -52,8 +52,6 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 options 	TRAP_PANICWAIT
 #options 	DDB_COMMANDONENTER="bt"
 
-makeoptions 	DEBUG="-g"	# compile full symbol table
-
 # Compatibility options
 include 	"conf/compat_netbsd70.config"
 #options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.



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

2021-03-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 28 08:34:18 UTC 2021

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

Log Message:
Add siisata


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/macppc/conf/POWERMAC_G5

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
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.44 src/sys/arch/macppc/conf/POWERMAC_G5:1.45
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.44	Tue Mar  2 06:31:25 2021
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Sun Mar 28 08:34:18 2021
@@ -202,7 +202,9 @@ options 	RADEONFB_ALWAYS_ACCEL_PUTCHAR
 #pciide* at pci? dev ? function ? flags 0x	# GENERIC pciide driver
 wdc* 	at pci? dev ? function ?		# Kauai ATA
 svwsata* at pci? dev ? function ?		# ServerWorks SATA controllers
+siisata* at pci? dev ? function ?		# SiI SteelVine controllers
 #options 	ATADEBUG
+
 obio*	at pci? dev ? function ?
 zsc*	at obio?
 zstty*	at zsc? channel ?



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

2021-03-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Mar 11 19:36:11 UTC 2021

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

Log Message:
add basic support for iMac G5 audio:
- match AOAShasta
- deal with headphone gpios labeled as lineout in OF
- set sc_mode to SNAPPER_IS_PCM3052 - OF makes it look like an unlabeled
  TAS3004
TODO:
- actually support pcm3052 instead of treating it like a sw codec


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 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.56 src/sys/arch/macppc/dev/snapper.c:1.57
--- src/sys/arch/macppc/dev/snapper.c:1.56	Fri Mar  5 07:15:53 2021
+++ src/sys/arch/macppc/dev/snapper.c	Thu Mar 11 19:36:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.56 2021/03/05 07:15:53 rin Exp $	*/
+/*	$NetBSD: snapper.c,v 1.57 2021/03/11 19:36:11 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.56 2021/03/05 07:15:53 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.57 2021/03/11 19:36:11 macallan Exp $");
 
 #include 
 #include 
@@ -158,6 +158,7 @@ static int gpio_read(bus_size_t);
 static void gpio_write(bus_size_t, int);
 static void snapper_mute_speaker(struct snapper_softc *, int);
 static void snapper_mute_headphone(struct snapper_softc *, int);
+static void snapper_mute_lineout(struct snapper_softc *, int);
 static int snapper_cint(void *);
 static int tas3004_init(struct snapper_softc *);
 static void snapper_init(struct snapper_softc *, int);
@@ -519,11 +520,14 @@ static const struct audio_format onyx_fo
 #define ONYX_NFORMATS	__arraycount(onyx_formats)
 
 static bus_size_t amp_mute;
-static bus_size_t headphone_mute;
+static bus_size_t headphone_mute = 0;
 static bus_size_t audio_hw_reset;
-static bus_size_t headphone_detect;
+static bus_size_t headphone_detect = 0;
+static bus_size_t lineout_detect = 0;
+static bus_size_t lineout_mute= 0;
 static bus_size_t owaddr = -1;
-static uint8_t headphone_detect_active;
+static uint8_t headphone_detect_active = 0;
+static uint8_t lineout_detect_active = 0;
 
 
 /* I2S registers */
@@ -692,6 +696,9 @@ snapper_match(device_t parent, struct cf
 
 	if (strcmp(compat, "AOAK2") == 0)
 		return 1;
+
+	if (strcmp(compat, "AOAShasta") == 0)
+		return 1;
 		
 	if (strcmp(compat, "AOAbase") == 0)
 		return 1;
@@ -870,8 +877,17 @@ snapper_defer(device_t dev)
 		if (codec[0] == 0) {
 			if (sc->sc_deqaddr == 0x34) {
 sc->sc_mode = SNAPPER_IS_TAS3001;
-			} else
+			} else {
+int root = OF_finddevice("/");
+char model[32];
 sc->sc_mode = SNAPPER_IS_TAS3004;
+if (OF_getprop(root, "model", model, 32) > 0) {
+	printf("model %s\n", model);
+	if (strcmp(model, "PowerMac8,1") == 0) {
+		sc->sc_mode = SNAPPER_IS_PCM3052;
+	}
+}
+			}
 		} else if (strcmp(codec, "tas3004") == 0) {
 			sc->sc_mode = SNAPPER_IS_TAS3004;
 		} else if (strcmp(codec, "pcm3052") == 0) {
@@ -1077,10 +1093,13 @@ snapper_set_port(void *h, mixer_ctrl_t *
 
 		snapper_mute_speaker(sc, 1);
 		snapper_mute_headphone(sc, 1);
+		snapper_mute_lineout(sc, 1);
 		if (mc->un.mask & 1 << 0)
 			snapper_mute_speaker(sc, 0);
 		if (mc->un.mask & 1 << 1)
 			snapper_mute_headphone(sc, 0);
+		if (mc->un.mask & 1 << 2)
+			snapper_mute_lineout(sc, 0);
 
 		sc->sc_output_mask = mc->un.mask;
 		return 0;
@@ -1240,11 +1259,13 @@ snapper_query_devinfo(void *h, mixer_dev
 		strcpy(dip->label.name, AudioNoutput);
 		dip->type = AUDIO_MIXER_SET;
 		dip->prev = dip->next = AUDIO_MIXER_LAST;
-		dip->un.s.num_mem = 2;
+		dip->un.s.num_mem = 3;
 		strcpy(dip->un.s.member[0].label.name, AudioNspeaker);
 		dip->un.s.member[0].mask = 1 << 0;
 		strcpy(dip->un.s.member[1].label.name, AudioNheadphone);
 		dip->un.s.member[1].mask = 1 << 1;
+		strcpy(dip->un.s.member[2].label.name, AudioNline);
+		dip->un.s.member[2].mask = 1 << 2;
 		return 0;
 
 	case SNAPPER_VOL_OUTPUT:
@@ -1937,6 +1958,7 @@ gpio_write(bus_size_t addr, int val)
 }
 
 #define headphone_active 0	/* XXX OF */
+#define lineout_active 0	/* XXX OF */
 #define amp_active 0		/* XXX OF */
 
 static void
@@ -1977,30 +1999,68 @@ snapper_mute_headphone(struct snapper_so
 	}
 }
 
+static void
+snapper_mute_lineout(struct snapper_softc *sc, int mute)
+{
+	u_int x;
+
+	if (lineout_mute != 0) {
+		DPRINTF("lineoutmute %d --> ", gpio_read(lineout_mute));
+
+		if (mute)
+			x = lineout_active;	/* mute */
+		else
+			x = !lineout_active;	/* unmute */
+		if (x != gpio_read(lineout_mute))
+			gpio_write(lineout_mute, x);
+
+		DPRINTF("%d\n", gpio_read(lineout_mute));
+	}
+}
+
 static int
 snapper_cint(void *v)
 {
-	struct snapper_softc *sc;
+	struct snapper_softc *sc = v;
 	u_int sense;
+	int mask =

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

2021-03-10 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 10 19:45:41 UTC 2021

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

Log Message:
switch G5 iMacs to full speed


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/sys/arch/macppc/macppc/machdep.c

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

Modified files:

Index: src/sys/arch/macppc/macppc/machdep.c
diff -u src/sys/arch/macppc/macppc/machdep.c:1.173 src/sys/arch/macppc/macppc/machdep.c:1.174
--- src/sys/arch/macppc/macppc/machdep.c:1.173	Sat Feb 27 02:52:48 2021
+++ src/sys/arch/macppc/macppc/machdep.c	Wed Mar 10 19:45:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.173 2021/02/27 02:52:48 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.174 2021/03/10 19:45:41 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.173 2021/02/27 02:52:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.174 2021/03/10 19:45:41 macallan Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_ddb.h"
@@ -145,6 +145,14 @@ initppc(u_int startkernel, u_int endkern
 		int clock_ih = OF_open("/u3/i2c/i2c-hwclock");
 		if (clock_ih != 0) {
 			OF_call_method_1("slew-high", clock_ih, 0);
+			OF_close(clock_ih);
+		}
+	}
+	if  (strncmp(model_name, "PowerMac8,", 10) == 0) {
+		int smu_ih = OF_open("/smu");
+		if (smu_ih != 0) {
+			OF_call_method_1("smu-powertune-hi", smu_ih, 0);
+			OF_close(smu_ih);
 		}
 	}
 
@@ -360,7 +368,7 @@ copy_disp_props(device_t dev, int node, 
 	}
 	if (!of_to_uint32_prop(dict, node, "address", "address")) {
 		uint32_t fbaddr = 0;
-			OF_interpret("frame-buffer-adr", 0, 1, &fbaddr);
+		OF_interpret("frame-buffer-adr", 0, 1, &fbaddr);
 		if (fbaddr != 0)
 			prop_dictionary_set_uint32(dict, "address", fbaddr);
 	}



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

2021-03-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar  9 01:17:37 UTC 2021

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

Log Message:
add support for the CPU temperature sensor found in iMac G5s


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/macppc/dev/smu.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/smu.c
diff -u src/sys/arch/macppc/dev/smu.c:1.11 src/sys/arch/macppc/dev/smu.c:1.12
--- src/sys/arch/macppc/dev/smu.c:1.11	Fri Mar  5 07:15:53 2021
+++ src/sys/arch/macppc/dev/smu.c	Tue Mar  9 01:17:37 2021
@@ -80,7 +80,7 @@ struct smu_iicbus {
 
 #define SMU_MAX_FANS		8
 #define SMU_MAX_IICBUS		3
-#define SMU_MAX_SME_SENSORS	SMU_MAX_FANS
+#define SMU_MAX_SME_SENSORS	(SMU_MAX_FANS + 8)
 
 struct smu_zone {
 	bool (*filter)(const envsys_data_t *);
@@ -120,6 +120,8 @@ struct smu_softc {
 
 	struct sysmon_envsys *sc_sme;
 	envsys_data_t sc_sme_sensors[SMU_MAX_SME_SENSORS];
+	uint32_t cpu_m;
+	int32_t  cpu_b;
 
 	struct smu_zone sc_zones[SMU_ZONES];
 	lwp_t *sc_thread;
@@ -130,7 +132,7 @@ struct smu_softc {
 #define SMU_CMD_RTC	0x8e
 #define SMU_CMD_I2C	0x9a
 #define SMU_CMD_POWER	0xaa
-#define SMU_ADC		0xd8
+#define SMU_CMD_ADC	0xd8
 #define SMU_MISC	0xee
 #define  SMU_MISC_GET_DATA	0x02
 #define  SMU_MISC_LED_CTRL	0x04
@@ -165,6 +167,8 @@ static int smu_todr_settime_ymdhms(todr_
 static int smu_fan_update_rpm(struct smu_fan *);
 static int smu_fan_get_rpm(struct smu_fan *, int *);
 static int smu_fan_set_rpm(struct smu_fan *, int);
+static int smu_read_adc(struct smu_softc *, int);
+
 static int smu_iicbus_exec(void *, i2c_op_t, i2c_addr_t, const void *,
 size_t, void *, size_t, int);
 static int smu_sysctl_fan_rpm(SYSCTLFN_ARGS);
@@ -199,6 +203,7 @@ smu_attach(device_t parent, device_t sel
 {
 	struct confargs *ca = aux;
 	struct smu_softc *sc = device_private(self);
+	uint16_t data[4];
 
 	sc->sc_dev = self;
 	sc->sc_node = ca->ca_node;
@@ -227,6 +232,13 @@ smu_attach(device_t parent, device_t sel
 	sc->sc_todr.cookie = sc;
 	todr_attach(&sc->sc_todr);
 
+	/* calibration data */
+	memset(data, 0, 8);	
+	smu_get_datablock(SMU_CPUTEMP_CAL, (void *)data, 8);
+	DPRINTF("data %04x %04x %04x %04x\n", data[0], data[1], data[2], data[3]);
+	sc->cpu_m = data[2]; 
+	sc->cpu_b = (int16_t)data[3];
+
 	smu_setup_sme(sc);
 
 	smu_setup_zones(sc);
@@ -476,7 +488,8 @@ smu_setup_sme(struct smu_softc *sc)
 {
 	struct smu_fan *fan;
 	envsys_data_t *sme_sensor;
-	int i;
+	int i, sensors, child, reg;
+	char loc[32], type[32];
 
 	sc->sc_sme = sysmon_envsys_create();
 
@@ -494,7 +507,26 @@ smu_setup_sme(struct smu_softc *sc)
 			return;
 		}
 	}
-
+	sensors = OF_finddevice("/smu/sensors");
+	child = OF_child(sensors);
+	while (child != 0) {
+		sme_sensor = &sc->sc_sme_sensors[i];
+		if (OF_getprop(child, "location", loc, 32) == 0) goto next;
+		if (OF_getprop(child, "device_type", type, 32) == 0) goto next;
+		if (OF_getprop(child, "reg", ®, 4) == 0) goto next;
+		if (strcmp(type, "temp-sensor") == 0) {
+			sme_sensor->units = ENVSYS_STEMP;
+			sme_sensor->state = ENVSYS_SINVALID;
+			strncpy(sme_sensor->desc, loc, sizeof(sme_sensor->desc));
+			sme_sensor->private = reg;
+			sysmon_envsys_sensor_attach(sc->sc_sme, sme_sensor);
+			i++;
+			printf("%s: %s@%x\n", loc, type, reg); 
+		}
+next:
+		child = OF_peer(child);
+	}
+		
 	sc->sc_sme->sme_name = device_xname(sc->sc_dev);
 	sc->sc_sme->sme_cookie = sc;
 	sc->sc_sme->sme_refresh = smu_sme_refresh;
@@ -535,6 +567,19 @@ smu_sme_refresh(struct sysmon_envsys *sm
 			edata->value_cur = fan->current_rpm;
 			edata->state = ENVSYS_SVALID;
 		}
+	} else if (edata->private > 0) {
+		/* this works only for the CPU diode */
+		int64_t r = smu_read_adc(sc, edata->private);
+		if (r != -1) {
+			r = r * sc->cpu_m;
+			r >>= 3;
+			r += (int64_t)sc->cpu_b << 9;
+			r <<= 1;
+			r *= 15625;
+			r /= 1024;
+			edata->value_cur = r + 27315;
+			edata->state = ENVSYS_SVALID;
+		}
 	}
 }
 
@@ -771,6 +816,23 @@ smu_fan_set_rpm(struct smu_fan *fan, int
 }
 
 static int
+smu_read_adc(struct smu_softc *sc, int id)
+{
+	struct smu_cmd cmd;
+	int ret;
+
+	cmd.cmd = SMU_CMD_ADC;
+	cmd.len = 1;
+	cmd.data[0] = id;
+
+	ret = smu_do_cmd(sc, &cmd, 800);
+	if (ret == 0) {
+		return cmd.data[0] << 8 | cmd.data[1];
+	}
+	return -1;
+}
+
+static int
 smu_iicbus_exec(void *cookie, i2c_op_t op, i2c_addr_t addr, const void *send,
 size_t send_len, void *recv, size_t recv_len, int flags)
 {



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

2021-03-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Mar  6 07:29:05 UTC 2021

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

Log Message:
Change pic_name from "openpic" to "u3_ht" so that it can be
distinguishable with generic OpenPIC driver.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/macppc/macppc/pic_u3_ht.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/pic_u3_ht.c
diff -u src/sys/arch/macppc/macppc/pic_u3_ht.c:1.11 src/sys/arch/macppc/macppc/pic_u3_ht.c:1.12
--- src/sys/arch/macppc/macppc/pic_u3_ht.c:1.11	Fri Mar  5 07:15:53 2021
+++ src/sys/arch/macppc/macppc/pic_u3_ht.c	Sat Mar  6 07:29:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic_u3_ht.c,v 1.11 2021/03/05 07:15:53 rin Exp $	*/
+/*	$NetBSD: pic_u3_ht.c,v 1.12 2021/03/06 07:29:05 rin Exp $	*/
 /*-
  * Copyright (c) 2013 Phileas Fogg
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic_u3_ht.c,v 1.11 2021/03/05 07:15:53 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_u3_ht.c,v 1.12 2021/03/06 07:29:05 rin Exp $");
 
 #include "opt_openpic.h"
 #include "opt_interrupt.h"
@@ -229,7 +229,7 @@ setup_u3_ht(uint32_t addr, uint32_t len,
 	pic->pic_ack_irq = u3_ht_ack_irq;
 	pic->pic_establish_irq = u3_ht_establish_irq;
 	pic->pic_finish_setup = u3_ht_finish_setup;
-	strcpy(pic->pic_name, "openpic");
+	strcpy(pic->pic_name, "u3_ht");
 	pic_add(pic);
 
 	u3_ht_set_priority(u3_ht, 0, 15);



CVS commit: src/sys/arch/macppc

2021-03-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Mar  5 07:15:53 UTC 2021

Modified Files:
src/sys/arch/macppc/dev: adb.c awacs.c com_mainbus.c cuda.c esp.c
gpio.c if_bm.c if_gm.c if_mc.c if_wi_obio.c kauai.c mediabay.c
mesh.c pmu.c smu.c snapper.c wdc_obio.c zs.c
src/sys/arch/macppc/macppc: ipi_hammerhead.c pic_ohare.c pic_u3_ht.c

Log Message:
Convert to intr_establish_xname().


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/macppc/dev/adb.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/macppc/dev/awacs.c \
src/sys/arch/macppc/dev/zs.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/macppc/dev/com_mainbus.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/macppc/dev/cuda.c \
src/sys/arch/macppc/dev/if_mc.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/macppc/dev/esp.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/macppc/dev/gpio.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/macppc/dev/if_bm.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/macppc/dev/if_gm.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/macppc/dev/if_wi_obio.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/macppc/dev/kauai.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/macppc/dev/mediabay.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/macppc/dev/mesh.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/macppc/dev/pmu.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/macppc/dev/smu.c
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/macppc/dev/snapper.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/macppc/dev/wdc_obio.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/macppc/macppc/ipi_hammerhead.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/macppc/macppc/pic_ohare.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/macppc/macppc/pic_u3_ht.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/adb.c
diff -u src/sys/arch/macppc/dev/adb.c:1.34 src/sys/arch/macppc/dev/adb.c:1.35
--- src/sys/arch/macppc/dev/adb.c:1.34	Sat Oct 27 17:18:00 2012
+++ src/sys/arch/macppc/dev/adb.c	Fri Mar  5 07:15:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb.c,v 1.34 2012/10/27 17:18:00 chs Exp $	*/
+/*	$NetBSD: adb.c,v 1.35 2021/03/05 07:15:53 rin Exp $	*/
 
 /*-
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb.c,v 1.34 2012/10/27 17:18:00 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb.c,v 1.35 2021/03/05 07:15:53 rin Exp $");
 
 #include 
 #include 
@@ -132,10 +132,12 @@ adbattach(device_t parent, device_t self
 
 	switch (adbHardware) {
 	case ADB_HW_CUDA:
-		intr_establish(irq, IST_LEVEL, IPL_TTY, adb_intr_cuda, sc);
+		intr_establish_xname(irq, IST_LEVEL, IPL_TTY, adb_intr_cuda, sc,
+		device_xname(self));
 		break;
 	case ADB_HW_PMU:
-		intr_establish(irq, IST_LEVEL, IPL_TTY, pm_intr, sc);
+		intr_establish_xname(irq, IST_LEVEL, IPL_TTY, pm_intr, sc,
+		device_xname(self));
 		pm_init();
 		break;
 	}

Index: src/sys/arch/macppc/dev/awacs.c
diff -u src/sys/arch/macppc/dev/awacs.c:1.50 src/sys/arch/macppc/dev/awacs.c:1.51
--- src/sys/arch/macppc/dev/awacs.c:1.50	Sat Feb  6 07:20:36 2021
+++ src/sys/arch/macppc/dev/awacs.c	Fri Mar  5 07:15:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: awacs.c,v 1.50 2021/02/06 07:20:36 isaki Exp $	*/
+/*	$NetBSD: awacs.c,v 1.51 2021/03/05 07:15:53 rin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.50 2021/02/06 07:20:36 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.51 2021/03/05 07:15:53 rin Exp $");
 
 #include 
 #include 
@@ -307,7 +307,7 @@ awacs_attach(device_t parent, device_t s
 	int cirq, oirq, iirq, cirq_type, oirq_type, iirq_type;
 	int len = -1, perch;
 	int root_node;
-	char compat[256];
+	char compat[256], intr_xname[INTRDEVNAMEBUF];
 
 	sc = device_private(self);
 	sc->sc_dev = self;
@@ -361,9 +361,18 @@ awacs_attach(device_t parent, device_t s
 		cirq_type = oirq_type = iirq_type = IST_EDGE;
 	}
 
-	intr_establish(cirq, cirq_type, IPL_BIO, awacs_status_intr, sc);
-	intr_establish(oirq, oirq_type, IPL_AUDIO, awacs_intr, sc);
-	intr_establish(iirq, iirq_type, IPL_AUDIO, awacs_intr, sc);
+	snprintf(intr_xname, sizeof(intr_xname), "%s status",
+	device_xname(self));
+	intr_establish_xname(cirq, cirq_type, IPL_BIO, awacs_status_intr, sc,
+	intr_xname);
+
+	snprintf(intr_xname, sizeof(intr_xname), "%s out", device_xname(self));
+	intr_establish_xname(oirq, oirq_type, IPL_AUDIO, awacs_intr, sc,
+	intr_xname);
+
+	snprintf(intr_xname, sizeof(intr_xname), "%s in", device_xname(self));
+	intr_establish_xname(iirq, iirq_type, IPL_AUDIO, awacs_intr, sc,
+	intr_xname);
 
 	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
Index: src/sys/arch/macppc/dev/zs.c
diff -u src/sys/arch/macppc/dev/zs.c:1.50 src/sys/arch/macppc/dev/zs.c:1.51
--- src/sys/arch/macppc/dev/zs.c:1.50	Thu Jun 30 00:52:57 2011
+++ src/sys/arch/macppc

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

2021-03-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar  2 06:31:25 UTC 2021

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

Log Message:
add gffb
tested on 20" 1.8GHz iMac G5


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/macppc/conf/POWERMAC_G5

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
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.43 src/sys/arch/macppc/conf/POWERMAC_G5:1.44
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.43	Sat Apr  4 15:56:25 2020
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Tue Mar  2 06:31:25 2021
@@ -192,6 +192,7 @@ ums*	at uhidev? reportid ?# USB Mice
 wsmouse* at ums?
 
 genfb*	at pci? dev ? function ?	# Generic Open Firmware Framebuffer
+gffb*	at pci? dev ? function ?	# some iMacs have nvidia graphics chips
 radeonfb*	at pci? dev ? function ?
 options 	RADEONFB_ALWAYS_ACCEL_PUTCHAR
 



CVS commit: src/sys/arch/macppc

2021-02-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Feb 28 20:27:40 UTC 2021

Modified Files:
src/sys/arch/macppc/include: loadfile_machdep.h
src/sys/arch/macppc/stand/ofwboot: Locore.c Makefile boot.c ofdev.c
openfirm.h version
Added Files:
src/sys/arch/macppc/stand/ofwboot: loadfile_machdep.c

Log Message:
- When starting the boot program, cache a bunch of OFW frequently used
  ihandles / phandles, rather than fetching them all the time.
- Change the signature of OF_call_method() to take an array of cells for
  the inputs and outputs, rather than using variadic arguments.  This
  makes it much easier to use OF_call_method() when the format of the
  arguments passed to a given method are determined at run-time
  (due to e.g. #address-cells).
- Properly inform OpenFirmware where the kernel is loaded by using
  "claim" on /chosen/memory and, if running in virtual-mode, using
  "claim" on /chosen/mmu to reserve the VA, and "map" on /chosen/mmu
  to enter the translation.  (The kernel is still always mapped VA==PA.)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/macppc/include/loadfile_machdep.h
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/macppc/stand/ofwboot/Locore.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/macppc/stand/ofwboot/Makefile
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/macppc/stand/ofwboot/boot.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/macppc/stand/ofwboot/loadfile_machdep.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/macppc/stand/ofwboot/ofdev.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/macppc/stand/ofwboot/openfirm.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/macppc/stand/ofwboot/version

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

Modified files:

Index: src/sys/arch/macppc/include/loadfile_machdep.h
diff -u src/sys/arch/macppc/include/loadfile_machdep.h:1.6 src/sys/arch/macppc/include/loadfile_machdep.h:1.7
--- src/sys/arch/macppc/include/loadfile_machdep.h:1.6	Wed Aug  6 21:57:50 2014
+++ src/sys/arch/macppc/include/loadfile_machdep.h	Sun Feb 28 20:27:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: loadfile_machdep.h,v 1.6 2014/08/06 21:57:50 joerg Exp $	*/
+/*	$NetBSD: loadfile_machdep.h,v 1.7 2021/02/28 20:27:40 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -36,9 +36,21 @@
 
 #define LOADADDR(a)		(((u_long)(a)) + offset)
 #define ALIGNENTRY(a)		((u_long)(a))
+
+#ifdef _STANDALONE
+ssize_t	macppc_read(int, void *, size_t);
+void *	macppc_memcpy(void *, const void *, size_t);
+void *	macppc_memset(void *, int, size_t);
+
+#define READ(f, b, c)		macppc_read((f), (void *)LOADADDR(b), (c))
+#define BCOPY(s, d, c)		macppc_memcpy((void *)LOADADDR(d), (void *)(s), (c))
+#define BZERO(d, c)		macppc_memset((void *)LOADADDR(d), 0, (c))
+#else
 #define READ(f, b, c)		read((f), (void *)LOADADDR(b), (c))
 #define BCOPY(s, d, c)		memcpy((void *)LOADADDR(d), (void *)(s), (c))
 #define BZERO(d, c)		memset((void *)LOADADDR(d), 0, (c))
+#endif /* _STANDALONE */
+
 #define	WARN(a)			do { \
 	(void)printf a; \
 	if (errno) \

Index: src/sys/arch/macppc/stand/ofwboot/Locore.c
diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.34 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.35
--- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.34	Wed Apr 15 13:33:13 2020
+++ src/sys/arch/macppc/stand/ofwboot/Locore.c	Sun Feb 28 20:27:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.34 2020/04/15 13:33:13 rin Exp $	*/
+/*	$NetBSD: Locore.c,v 1.35 2021/02/28 20:27:40 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -201,6 +201,34 @@ openfirmware(void *arg)
 }
 #endif
 
+int	ofw_real_mode;
+int	ofw_address_cells;
+int	ofw_size_cells;
+
+int	ofw_root;		/* / */
+int	ofw_options;		/* /options */
+int	ofw_openprom;		/* /openprom */
+int	ofw_chosen;		/* /chosen (package) */
+int	ofw_stdin;		/* /chosen/stdin */
+int	ofw_stdout;		/* /chosen/stdout */
+int	ofw_memory_ihandle;	/* /chosen/memory */
+int	ofw_mmu_ihandle;	/* /chosen/mmu */
+
+bool
+ofw_option_truefalse(const char *prop, int proplen)
+{
+	/* These are all supposed to be strings. */
+	switch (prop[0]) {  
+	case 'y':
+	case 'Y':
+	case 't':
+	case 'T':
+	case '1':
+		return true; 
+	}
+	return false;
+}
+
 static void
 startup(void *vpd, int res, int (*openfirm)(void *), char *arg, int argl)
 {
@@ -623,9 +651,9 @@ OF_chain(void *virt, u_int size, boot_en
 #endif
 
 int
-OF_call_method(const char *method, int ihandle, int nargs, int nreturns, ...)
+OF_call_method(const char *method, int ihandle, int nargs, int nreturns,
+int *cells)
 {
-	va_list ap;
 	static struct {
 		const char *name;
 		int nargs;
@@ -642,47 +670,47 @@ OF_call_method(const char *method, int i
 
 	if (nargs > 6)
 		return -1;
+
 	args.nargs = nargs + 2;
 	args.nreturns = nreturns + 1;
 	args.method = method;
 	args.ihandle = ihandle;
-	va_start(ap, nreturns);
+
 	for (ip = args.args_n_results + (n = nargs); --n >= 0;)
-		*--ip = va_arg

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

2021-02-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 20:51:10 UTC 2021

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

Log Message:
more node name adjustments
also, pass sensor names if we can find them
now we find and currectly use the hard drive temperature sensor on my iMac G5


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/macppc/dev/smuiic.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/smuiic.c
diff -u src/sys/arch/macppc/dev/smuiic.c:1.5 src/sys/arch/macppc/dev/smuiic.c:1.6
--- src/sys/arch/macppc/dev/smuiic.c:1.5	Thu Jul  2 12:47:19 2020
+++ src/sys/arch/macppc/dev/smuiic.c	Thu Feb 25 20:51:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: smuiic.c,v 1.5 2020/07/02 12:47:19 macallan Exp $ */
+/*	$NetBSD: smuiic.c,v 1.6 2021/02/25 20:51:10 macallan Exp $ */
 
 /*-
  * Copyright (c) 2013 Phileas Fogg
@@ -62,6 +62,8 @@ smuiic_match(device_t parent, struct cfd
 
 	if (strcmp(ca->ca_name, "i2c-bus") == 0)
 		return 5;
+	if (strcmp(ca->ca_name, "i2c") == 0)
+		return 5;
 	
 	return 0;
 }
@@ -73,13 +75,13 @@ smuiic_attach(device_t parent, device_t 
 	struct smuiic_softc *sc = device_private(self);
 	struct i2cbus_attach_args iba;
 	prop_dictionary_t dict = device_properties(self);
-	int devs;
+	int devs, devc;
 	uint32_t addr;
 	char compat[256];
 	prop_array_t cfg;
 	prop_dictionary_t dev;
 	prop_data_t data;
-	char name[32];
+	char name[32], descr[32], num[8];
 
 	sc->sc_dev = self;
 	sc->sc_node = ca->ca_node;
@@ -108,6 +110,18 @@ smuiic_attach(device_t parent, device_t 
 		prop_object_release(data);
 		prop_dictionary_set_uint32(dev, "addr", addr);
 		prop_dictionary_set_uint64(dev, "cookie", devs);
+		devc = OF_child(devs);
+		while (devc != 0) {
+			int reg;
+			if (OF_getprop(devc, "reg", ®, 4) < 4) goto nope;
+			if (OF_getprop(devc, "location", descr, 32) <= 0)
+goto nope;
+			printf("found '%s' at %02x\n", descr, reg);
+			snprintf(num, 7, "s%02x", reg);
+			prop_dictionary_set_string(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

2021-02-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 20:49:08 UTC 2021

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

Log Message:
deal with node name inconsistencies between PowerMac10,x and 8,x
Now we find fans and iic devices on iMac G5


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/macppc/dev/smu.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/smu.c
diff -u src/sys/arch/macppc/dev/smu.c:1.9 src/sys/arch/macppc/dev/smu.c:1.10
--- src/sys/arch/macppc/dev/smu.c:1.9	Sat Jul  4 11:55:18 2020
+++ src/sys/arch/macppc/dev/smu.c	Thu Feb 25 20:49:08 2021
@@ -289,51 +289,56 @@ smu_setup_fans(struct smu_softc *sc)
 	struct sysctlnode *sysctl_fans, *sysctl_fan, *sysctl_node;
 	char type[32], sysctl_fan_name[32];
 	int node, i, j;
+	const char *fans[] = { "fans", "rpm-fans", 0 };
+	int n = 0;
+	
+	while (fans[n][0] != 0) {
+		node = of_getnode_byname(sc->sc_node, fans[n]);
+		for (node = OF_child(node);
+		(node != 0) && (sc->sc_num_fans < SMU_MAX_FANS);
+		node = OF_peer(node)) {
+			fan = &sc->sc_fans[sc->sc_num_fans];
+			fan->sc = sc;
+
+			memset(fan->location, 0, sizeof(fan->location));
+			OF_getprop(node, "location", fan->location,
+			sizeof(fan->location));
+
+			if (OF_getprop(node, "reg", &fan->reg,
+			sizeof(fan->reg)) <= 0)
+continue;
+
+			if (OF_getprop(node, "zone", &fan->zone	,
+			sizeof(fan->zone)) <= 0)
+continue;
+
+			memset(type, 0, sizeof(type));
+			OF_getprop(node, "device_type", type, sizeof(type));
+			if (strcmp(type, "fan-rpm-control") == 0)
+fan->rpm_ctl = 1;
+			else
+fan->rpm_ctl = 0;
+
+			if (OF_getprop(node, "min-value", &fan->min_rpm,
+			sizeof(fan->min_rpm)) <= 0)
+fan->min_rpm = 0;
+
+			if (OF_getprop(node, "max-value", &fan->max_rpm,
+			sizeof(fan->max_rpm)) <= 0)
+fan->max_rpm = 0x;
+
+			if (OF_getprop(node, "unmanage-value", &fan->default_rpm,
+			sizeof(fan->default_rpm)) <= 0)
+fan->default_rpm = fan->max_rpm;
+
+			DPRINTF("fan: location %s reg %x zone %d rpm_ctl %d "
+			"min_rpm %d max_rpm %d default_rpm %d\n",
+			fan->location, fan->reg, fan->zone, fan->rpm_ctl,
+			fan->min_rpm, fan->max_rpm, fan->default_rpm);
 
-	node = of_getnode_byname(sc->sc_node, "fans");
-	for (node = OF_child(node);
-	(node != 0) && (sc->sc_num_fans < SMU_MAX_FANS);
-	node = OF_peer(node)) {
-		fan = &sc->sc_fans[sc->sc_num_fans];
-		fan->sc = sc;
-
-		memset(fan->location, 0, sizeof(fan->location));
-		OF_getprop(node, "location", fan->location,
-		sizeof(fan->location));
-
-		if (OF_getprop(node, "reg", &fan->reg,
-		sizeof(fan->reg)) <= 0)
-			continue;
-
-		if (OF_getprop(node, "zone", &fan->zone,
-		sizeof(fan->zone)) <= 0)
-			continue;
-
-		memset(type, 0, sizeof(type));
-		OF_getprop(node, "device_type", type, sizeof(type));
-		if (strcmp(type, "fan-rpm-control") == 0)
-			fan->rpm_ctl = 1;
-		else
-			fan->rpm_ctl = 0;
-
-		if (OF_getprop(node, "min-value", &fan->min_rpm,
-		sizeof(fan->min_rpm)) <= 0)
-			fan->min_rpm = 0;
-
-		if (OF_getprop(node, "max-value", &fan->max_rpm,
-		sizeof(fan->max_rpm)) <= 0)
-			fan->max_rpm = 0x;
-
-		if (OF_getprop(node, "unmanage-value", &fan->default_rpm,
-		sizeof(fan->default_rpm)) <= 0)
-			fan->default_rpm = fan->max_rpm;
-
-		DPRINTF("fan: location %s reg %x zone %d rpm_ctl %d "
-		"min_rpm %d max_rpm %d default_rpm %d\n",
-		fan->location, fan->reg, fan->zone, fan->rpm_ctl,
-		fan->min_rpm, fan->max_rpm, fan->default_rpm);
-
-		sc->sc_num_fans++;
+			sc->sc_num_fans++;
+		}
+		n++;
 	}
 
 	for (i = 0; i < sc->sc_num_fans; i++) {
@@ -433,12 +438,14 @@ smu_setup_iicbus(struct smu_softc *sc)
 	char name[32];
 
 	node = of_getnode_byname(sc->sc_node, "smu-i2c-control");
+	if (node == 0) node = sc->sc_node;
 	for (node = OF_child(node);
 	(node != 0) && (sc->sc_num_iicbus < SMU_MAX_IICBUS);
 	node = OF_peer(node)) {
 		memset(name, 0, sizeof(name));
 		OF_getprop(node, "name", name, sizeof(name));
-		if (strcmp(name, "i2c-bus") != 0)
+		if ((strcmp(name, "i2c-bus") != 0) &&
+		(strcmp(name, "i2c") != 0))
 			continue;
 
 		iicbus = &sc->sc_iicbus[sc->sc_num_iicbus];
@@ -862,7 +869,8 @@ smu_setup_zones(struct smu_softc *sc)
 	z->nfans = 0;
 	for (i = 0; i < SMU_MAX_FANS; i++) {
 		f = &sc->sc_fans[i];
-		if (strstr(f->location, "CPU") != NULL) {
+		if ((strstr(f->location, "CPU") != NULL) || 
+		(strstr(f->location, "System") != NULL)) {
 			z->fans[z->nfans] = i;
 			z->nfans++;
 		}
@@ -878,7 +886,8 @@ smu_setup_zones(struct smu_softc *sc)
 	z->nfans = 0;
 	for (i = 0; i < SMU_MAX_FANS; i++) {
 		f = &sc->sc_fans[i];
-		if (strstr(f->location, "DRIVE") != NULL) {
+		if ((strstr(f->location, "DRIVE") != NULL) ||
+		(strstr(f->location, "Drive") != NULL)) {
 			z->fans[z->nfans] = i;
 			z->nfans++;
 		}
@@ -959,7 

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

2021-02-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb 13 02:17:02 UTC 2021

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

Log Message:
Improve readability of this file by adding register prefixes.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 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.76 src/sys/arch/macppc/macppc/locore.S:1.77
--- src/sys/arch/macppc/macppc/locore.S:1.76	Sat Feb 13 01:11:58 2021
+++ src/sys/arch/macppc/macppc/locore.S	Sat Feb 13 02:17:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.76 2021/02/13 01:11:58 thorpej Exp $	*/
+/*	$NetBSD: locore.S,v 1.77 2021/02/13 02:17:02 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -83,64 +83,64 @@ _C_LABEL(kernel_text):
 __start:
 	bl	_C_LABEL(ofwinit)		/* init OF */
 
-	li	0,0
+	li	%r0,0
 #ifndef FIRMWORKSBUGS
-	mtmsr	0			/* Disable FPU/MMU/exceptions */
+	mtmsr	%r0			/* Disable FPU/MMU/exceptions */
 #endif
 	isync
 
-	mr	13,6
-	mr	14,7
+	mr	%r13,%r6
+	mr	%r14,%r7
 	bl	_C_LABEL(cpu_model_init)	/* init oeacpufeat */
 
 /* compute end of kernel memory */
-	lis	4,_C_LABEL(end)@ha
-	addi	4,4,_C_LABEL(end)@l
+	lis	%r4,_C_LABEL(end)@ha
+	addi	%r4,%r4,_C_LABEL(end)@l
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 	/* skip symbol table */
-	mr	6,13
-	mr	7,14
-	cmpwi	6,0
+	mr	%r6,%r13
+	mr	%r7,%r14
+	cmpwi	%r6,0
 	beq	1f
-	add	9,6,7			/* r9 = args + l */
-	lwz	9,-8(9)			/* esym */
-	cmpwi	9,0
+	add	%r9,%r6,%r7		/* r9 = args + l */
+	lwz	%r9,-8(%r9)		/* esym */
+	cmpwi	%r9,0
 	beq	1f
-	mr	4,9
+	mr	%r4,%r9
 1:
 #endif
 
 #if defined (PMAC_G5) || defined (MAMBO)
 	 /* and clear HID5 DCBZ bits (56/57), need to do this early */
-	mfspr	11,SPR_HID5
-	rldimi	11,0,6,56
+	mfspr	%r11,SPR_HID5
+	rldimi	%r11,%r0,6,56
 	sync
-	mtspr	SPR_HID5,11
+	mtspr	SPR_HID5,%r11
 	isync
 	sync
 
 	/* Setup HID1 features, prefetch + i-cacheability controlled by PTE */
-	mfspr	0,SPR_HID1
-	li	11,0x1200
-	sldi	11,11,44
-	or	0,0,11
-	mtspr	SPR_HID1,0
+	mfspr	%r0,SPR_HID1
+	li	%r11,0x1200
+	sldi	%r11,%r11,44
+	or	%r0,%r0,%r11
+	mtspr	SPR_HID1,%r0
 	isync
 	sync
 
 	/* Restore r0 */
-	li	0,0
+	li	%r0,0
 #endif /* PMAC_G5 */
 
 
 	/*
 	 * Initialize cpu_info[0]
 	 */
-	INIT_CPUINFO(4,1,9,0)
+	INIT_CPUINFO(%r4,%r1,%r9,%r0)
 
-	lis	3,__start@ha
-	addi	3,3,__start@l
-	mr	5,6			/* args string */
+	lis	%r3,__start@ha
+	addi	%r3,%r3,__start@l
+	mr	%r5,%r6			/* args string */
 	bl	_C_LABEL(initppc)
 	bl	_C_LABEL(main)
 	b	_C_LABEL(OF_exit)
@@ -150,17 +150,17 @@ __start:
 	.text
 	.globl _C_LABEL(mfhid4)
 _C_LABEL(mfhid4):
-	mfspr	4, SPR_HID4 
-	std	4, 0(3)
+	mfspr	%r4, SPR_HID4 
+	std	%r4, 0(%r3)
 	blr
 
 /* Set all 64 bits of HID4 */
 	.text
 	.globl _C_LABEL(mthid4)
 _C_LABEL(mthid4):
-	ld 4, 0(3)
+	ld %r4, 0(%r3)
 	sync
-	mtspr SPR_HID4, 4 
+	mtspr SPR_HID4, %r4 
 	isync 
 	isync
 	blr
@@ -168,11 +168,11 @@ _C_LABEL(mthid4):
 	.text
 	.globl _C_LABEL(change_hid4)
 _C_LABEL(change_hid4):
-	mfspr 6, SPR_HID4
-	rldicl 5, 6, 32, 0 
-	ori 5, 5, 0x100
-	rldicl 5, 5, 32, 0 
-	std 5, 0(3)
+	mfspr %r6, SPR_HID4
+	rldicl %r5, %r6, 32, 0 
+	ori %r5, %r5, 0x100
+	rldicl %r5, %r5, 32, 0 
+	std %r5, 0(%r3)
 	blr
 #endif
 



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

2021-02-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb 13 01:11:58 UTC 2021

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

Log Message:
Call cpu_model_init() after clearing the MSR.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 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.75 src/sys/arch/macppc/macppc/locore.S:1.76
--- src/sys/arch/macppc/macppc/locore.S:1.75	Thu Feb 11 19:06:24 2021
+++ src/sys/arch/macppc/macppc/locore.S	Sat Feb 13 01:11:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.75 2021/02/11 19:06:24 macallan Exp $	*/
+/*	$NetBSD: locore.S,v 1.76 2021/02/13 01:11:58 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -82,9 +82,6 @@ _C_LABEL(kernel_text):
 	.globl	__start
 __start:
 	bl	_C_LABEL(ofwinit)		/* init OF */
-	mr	13,6
-	mr	14,7
-	bl	_C_LABEL(cpu_model_init)	/* init oeacpufeat */
 
 	li	0,0
 #ifndef FIRMWORKSBUGS
@@ -92,6 +89,10 @@ __start:
 #endif
 	isync
 
+	mr	13,6
+	mr	14,7
+	bl	_C_LABEL(cpu_model_init)	/* init oeacpufeat */
+
 /* compute end of kernel memory */
 	lis	4,_C_LABEL(end)@ha
 	addi	4,4,_C_LABEL(end)@l



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

2021-02-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Feb 12 23:38:17 UTC 2021

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

Log Message:
No need for a prototype of ofbcopy() here.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/macppc/include/autoconf.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/autoconf.h
diff -u src/sys/arch/macppc/include/autoconf.h:1.20 src/sys/arch/macppc/include/autoconf.h:1.21
--- src/sys/arch/macppc/include/autoconf.h:1.20	Tue Jul  7 02:33:54 2020
+++ src/sys/arch/macppc/include/autoconf.h	Fri Feb 12 23:38:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.h,v 1.20 2020/07/07 02:33:54 rin Exp $	*/
+/*	$NetBSD: autoconf.h,v 1.21 2021/02/12 23:38:17 thorpej Exp $	*/
 
 /*-
  * Copyright (C) 1998	Internet Research Institute, Inc.
@@ -51,7 +51,6 @@ struct confargs {
 };
 
 /* there are in locore.S */
-void ofbcopy(const void *, void *, size_t);
 int badaddr(volatile void *, int);
 
 /* these are in clock.c */



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

2021-02-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 11 19:06:24 UTC 2021

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

Log Message:
remove unused/useless #ifdef block


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 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.74 src/sys/arch/macppc/macppc/locore.S:1.75
--- src/sys/arch/macppc/macppc/locore.S:1.74	Fri Oct 11 21:56:55 2019
+++ src/sys/arch/macppc/macppc/locore.S	Thu Feb 11 19:06:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.74 2019/10/11 21:56:55 macallan Exp $	*/
+/*	$NetBSD: locore.S,v 1.75 2021/02/11 19:06:24 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -90,11 +90,6 @@ __start:
 #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
-	mtmsrd	0
-#endif /* PMAP_OEA64_BRIDGE */
 	isync
 
 /* compute end of kernel memory */



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

2021-02-05 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 07:20:36 UTC 2021

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

Log Message:
Calling halt_{input,output} is done by the MI audio layer if necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/macppc/dev/awacs.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/awacs.c
diff -u src/sys/arch/macppc/dev/awacs.c:1.49 src/sys/arch/macppc/dev/awacs.c:1.50
--- src/sys/arch/macppc/dev/awacs.c:1.49	Tue Jan 26 14:49:41 2021
+++ src/sys/arch/macppc/dev/awacs.c	Sat Feb  6 07:20:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: awacs.c,v 1.49 2021/01/26 14:49:41 thorpej Exp $	*/
+/*	$NetBSD: awacs.c,v 1.50 2021/02/06 07:20:36 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.49 2021/01/26 14:49:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.50 2021/02/06 07:20:36 isaki Exp $");
 
 #include 
 #include 
@@ -110,7 +110,6 @@ static void awacs_attach(device_t, devic
 static int awacs_intr(void *);
 static int awacs_status_intr(void *);
 
-static void awacs_close(void *);
 static int awacs_query_format(void *, audio_format_query_t *);
 static int awacs_set_format(void *, int,
 		 const audio_params_t *, const audio_params_t *,
@@ -154,7 +153,6 @@ CFATTACH_DECL_NEW(awacs, sizeof(struct a
 awacs_match, awacs_attach, NULL, NULL);
 
 const struct audio_hw_if awacs_hw_if = {
-	.close			= awacs_close,
 	.query_format		= awacs_query_format,
 	.set_format		= awacs_set_format,
 	.round_blocksize	= awacs_round_blocksize,
@@ -620,22 +618,6 @@ awacs_intr(void *v)
 	return 1;
 }
 
-/*
- * Close function is called at splaudio().
- */
-static void
-awacs_close(void *h)
-{
-	struct awacs_softc *sc;
-
-	sc = h;
-	awacs_halt_output(sc);
-	awacs_halt_input(sc);
-
-	sc->sc_ointr = 0;
-	sc->sc_iintr = 0;
-}
-
 static int
 awacs_query_format(void *h, audio_format_query_t *afp)
 {
@@ -678,6 +660,7 @@ awacs_halt_output(void *h)
 	sc = h;
 	dbdma_stop(sc->sc_odma);
 	dbdma_reset(sc->sc_odma);
+	sc->sc_ointr = NULL;
 	return 0;
 }
 
@@ -689,6 +672,7 @@ awacs_halt_input(void *h)
 	sc = h;
 	dbdma_stop(sc->sc_idma);
 	dbdma_reset(sc->sc_idma);
+	sc->sc_iintr = NULL;
 	return 0;
 }
 



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

2021-01-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 27 02:17:28 UTC 2021

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

Log Message:
Use DEVICE_COMPAT_EOL.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/macppc/dev/deq.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/macppc/dev/lmu.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/macppc/dev/psoc.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/macppc/dev/smusat.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.19 src/sys/arch/macppc/dev/deq.c:1.20
--- src/sys/arch/macppc/dev/deq.c:1.19	Mon Jan 25 14:20:39 2021
+++ src/sys/arch/macppc/dev/deq.c	Wed Jan 27 02:17:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: deq.c,v 1.19 2021/01/25 14:20:39 thorpej Exp $	*/
+/*	$NetBSD: deq.c,v 1.20 2021/01/27 02:17:27 thorpej Exp $	*/
 
 /*-
  * Copyright (C) 2005 Michael Lorenz
@@ -32,7 +32,7 @@
  */
  
 #include 
-__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.19 2021/01/25 14:20:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.20 2021/01/27 02:17:27 thorpej Exp $");
 
 #include 
 #include 
@@ -58,7 +58,7 @@ static const struct device_compatible_en
 	{ .compat = "pcm3052" },
 	{ .compat = "cs8416" },
 	{ .compat = "codec" },
-	{ }
+	DEVICE_COMPAT_EOL
 };
 
 int

Index: src/sys/arch/macppc/dev/lmu.c
diff -u src/sys/arch/macppc/dev/lmu.c:1.7 src/sys/arch/macppc/dev/lmu.c:1.8
--- src/sys/arch/macppc/dev/lmu.c:1.7	Mon Jan 25 14:20:39 2021
+++ src/sys/arch/macppc/dev/lmu.c	Wed Jan 27 02:17:28 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lmu.c,v 1.7 2021/01/25 14:20:39 thorpej Exp $ */
+/* $NetBSD: lmu.c,v 1.8 2021/01/27 02:17:28 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.7 2021/01/25 14:20:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.8 2021/01/27 02:17:28 thorpej Exp $");
 
 #include 
 #include 
@@ -83,7 +83,7 @@ CFATTACH_DECL_NEW(lmu, sizeof(struct lmu
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "lmu-micro" },
 	{ .compat = "lmu-controller" },
-	{ }
+	DEVICE_COMPAT_EOL
 };
 
 /* time between polling the light sensors */

Index: src/sys/arch/macppc/dev/psoc.c
diff -u src/sys/arch/macppc/dev/psoc.c:1.5 src/sys/arch/macppc/dev/psoc.c:1.6
--- src/sys/arch/macppc/dev/psoc.c:1.5	Mon Jan 25 14:20:39 2021
+++ src/sys/arch/macppc/dev/psoc.c	Wed Jan 27 02:17:28 2021
@@ -1,4 +1,4 @@
- /* $NetBSD: psoc.c,v 1.5 2021/01/25 14:20:39 thorpej Exp $ */
+ /* $NetBSD: psoc.c,v 1.6 2021/01/27 02:17:28 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2019 Michael Lorenz
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.5 2021/01/25 14:20:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.6 2021/01/27 02:17:28 thorpej Exp $");
 
 #include 
 #include 
@@ -82,7 +82,7 @@ CFATTACH_DECL_NEW(psoc, sizeof(struct ps
 
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "Psoc" },
-	{ }
+	DEVICE_COMPAT_EOL
 };
 
 static int

Index: src/sys/arch/macppc/dev/smusat.c
diff -u src/sys/arch/macppc/dev/smusat.c:1.8 src/sys/arch/macppc/dev/smusat.c:1.9
--- src/sys/arch/macppc/dev/smusat.c:1.8	Mon Jan 25 14:20:39 2021
+++ src/sys/arch/macppc/dev/smusat.c	Wed Jan 27 02:17:28 2021
@@ -108,7 +108,7 @@ CFATTACH_DECL_NEW(smusat, sizeof(struct 
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "sat" },
 	{ .compat = "smu-sat" },
-	{ }
+	DEVICE_COMPAT_EOL
 };
 
 static int



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

2021-01-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 17 21:02:33 UTC 2021

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

Log Message:
Use designated initializers and a consistent termination style in
compat_data[].


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/macppc/dev/deq.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/macppc/dev/lmu.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/macppc/dev/psoc.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/macppc/dev/smusat.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.17 src/sys/arch/macppc/dev/deq.c:1.18
--- src/sys/arch/macppc/dev/deq.c:1.17	Fri Sep 20 17:25:11 2019
+++ src/sys/arch/macppc/dev/deq.c	Sun Jan 17 21:02:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: deq.c,v 1.17 2019/09/20 17:25:11 macallan Exp $	*/
+/*	$NetBSD: deq.c,v 1.18 2021/01/17 21:02:33 thorpej Exp $	*/
 
 /*-
  * Copyright (C) 2005 Michael Lorenz
@@ -32,7 +32,7 @@
  */
  
 #include 
-__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.17 2019/09/20 17:25:11 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.18 2021/01/17 21:02:33 thorpej Exp $");
 
 #include 
 #include 
@@ -53,12 +53,13 @@ CFATTACH_DECL_NEW(deq, sizeof(struct deq
 deq_match, deq_attach, NULL, NULL);
 
 static const struct device_compatible_entry compat_data[] = {
-	{ "deq",		0 },
-	{ "tas3004",		0 },
-	{ "pcm3052",		0 },
-	{ "cs8416",		0 },
-	{ "codec",		0 },
-	{ NULL,			0 }
+	{ .compat = "deq" },
+	{ .compat = "tas3004" },
+	{ .compat = "pcm3052" },
+	{ .compat = "cs8416" },
+	{ .compat = "codec" },
+
+	{ 0 }
 };
 
 int

Index: src/sys/arch/macppc/dev/lmu.c
diff -u src/sys/arch/macppc/dev/lmu.c:1.5 src/sys/arch/macppc/dev/lmu.c:1.6
--- src/sys/arch/macppc/dev/lmu.c:1.5	Sat Sep 12 18:12:53 2020
+++ src/sys/arch/macppc/dev/lmu.c	Sun Jan 17 21:02:33 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lmu.c,v 1.5 2020/09/12 18:12:53 macallan Exp $ */
+/* $NetBSD: lmu.c,v 1.6 2021/01/17 21:02:33 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.5 2020/09/12 18:12:53 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.6 2021/01/17 21:02:33 thorpej Exp $");
 
 #include 
 #include 
@@ -81,9 +81,10 @@ CFATTACH_DECL_NEW(lmu, sizeof(struct lmu
 lmu_match, lmu_attach, NULL, NULL);
 
 static const struct device_compatible_entry compat_data[] = {
-	{ "lmu-micro",		0 },
-	{ "lmu-controller",	0 },
-	{ NULL,			0 }
+	{ .compat = "lmu-micro" },
+	{ .compat = "lmu-controller" },
+
+	{ 0 }
 };
 
 /* time between polling the light sensors */

Index: src/sys/arch/macppc/dev/psoc.c
diff -u src/sys/arch/macppc/dev/psoc.c:1.3 src/sys/arch/macppc/dev/psoc.c:1.4
--- src/sys/arch/macppc/dev/psoc.c:1.3	Sat Nov 23 05:13:11 2019
+++ src/sys/arch/macppc/dev/psoc.c	Sun Jan 17 21:02:33 2021
@@ -1,4 +1,4 @@
- /* $NetBSD: psoc.c,v 1.3 2019/11/23 05:13:11 macallan Exp $ */
+ /* $NetBSD: psoc.c,v 1.4 2021/01/17 21:02:33 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2019 Michael Lorenz
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.3 2019/11/23 05:13:11 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.4 2021/01/17 21:02:33 thorpej Exp $");
 
 #include 
 #include 
@@ -81,8 +81,9 @@ CFATTACH_DECL_NEW(psoc, sizeof(struct ps
 psoc_match, psoc_attach, NULL, NULL);
 
 static const struct device_compatible_entry compat_data[] = {
-	{ "Psoc",		0 },
-	{ NULL,			0 }
+	{ .compat = "Psoc" },
+
+	{ 0 }
 };
 
 static int

Index: src/sys/arch/macppc/dev/smusat.c
diff -u src/sys/arch/macppc/dev/smusat.c:1.6 src/sys/arch/macppc/dev/smusat.c:1.7
--- src/sys/arch/macppc/dev/smusat.c:1.6	Tue Jun 26 06:03:57 2018
+++ src/sys/arch/macppc/dev/smusat.c	Sun Jan 17 21:02:33 2021
@@ -106,9 +106,10 @@ CFATTACH_DECL_NEW(smusat, sizeof(struct 
 smusat_match, smusat_attach, NULL, NULL);
 
 static const struct device_compatible_entry compat_data[] = {
-	{ "sat",		0 },
-	{ "smu-sat",		0 },
-	{ NULL,			0 }
+	{ .compat = "sat" },
+	{ .compat = "smu-sat" },
+
+	{ 0 }
 };
 
 static int



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

2020-12-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 21:54:42 UTC 2020

Modified Files:
src/sys/arch/macppc/dev: aed.c apm.c

Log Message:
Use sel{record,remove}_knote().


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/macppc/dev/aed.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/macppc/dev/apm.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/aed.c
diff -u src/sys/arch/macppc/dev/aed.c:1.30 src/sys/arch/macppc/dev/aed.c:1.31
--- src/sys/arch/macppc/dev/aed.c:1.30	Wed Oct 25 08:12:37 2017
+++ src/sys/arch/macppc/dev/aed.c	Sat Dec 19 21:54:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: aed.c,v 1.30 2017/10/25 08:12:37 maya Exp $	*/
+/*	$NetBSD: aed.c,v 1.31 2020/12/19 21:54:42 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.30 2017/10/25 08:12:37 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.31 2020/12/19 21:54:42 thorpej Exp $");
 
 #include 
 #include 
@@ -590,7 +590,7 @@ filt_aedrdetach(struct knote *kn)
 	int s;
 
 	s = spladb();
-	SLIST_REMOVE(&aed_sc->sc_selinfo.sel_klist, kn, knote, kn_selnext);
+	selremove_knote(&aed_sc->sc_selinfo, kn);
 	splx(s);
 }
 
@@ -619,17 +619,14 @@ static const struct filterops aed_seltru
 int
 aedkqfilter(dev_t dev, struct knote *kn)
 {
-	struct klist *klist;
 	int s;
 
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
-		klist = &aed_sc->sc_selinfo.sel_klist;
 		kn->kn_fop = &aedread_filtops;
 		break;
 
 	case EVFILT_WRITE:
-		klist = &aed_sc->sc_selinfo.sel_klist;
 		kn->kn_fop = &aed_seltrue_filtops;
 		break;
 
@@ -640,7 +637,7 @@ aedkqfilter(dev_t dev, struct knote *kn)
 	kn->kn_hook = NULL;
 
 	s = spladb();
-	SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+	selrecord_knote(&aed_sc->sc_selinfo, kn);
 	splx(s);
 
 	return (0);

Index: src/sys/arch/macppc/dev/apm.c
diff -u src/sys/arch/macppc/dev/apm.c:1.28 src/sys/arch/macppc/dev/apm.c:1.29
--- src/sys/arch/macppc/dev/apm.c:1.28	Fri Oct 30 22:20:38 2020
+++ src/sys/arch/macppc/dev/apm.c	Sat Dec 19 21:54:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: apm.c,v 1.28 2020/10/30 22:20:38 christos Exp $	*/
+/*	$NetBSD: apm.c,v 1.29 2020/12/19 21:54:42 thorpej Exp $	*/
 /*	$OpenBSD: apm.c,v 1.5 2002/06/07 07:13:59 miod Exp $	*/
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.28 2020/10/30 22:20:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.29 2020/12/19 21:54:42 thorpej Exp $");
 
 #include "apm.h"
 
@@ -418,7 +418,7 @@ filt_apmrdetach(struct knote *kn)
 	struct apm_softc *sc = (struct apm_softc *)kn->kn_hook;
 
 	APM_LOCK(sc);
-	SLIST_REMOVE(&sc->sc_rsel.sel_klist, kn, knote, kn_selnext);
+	selremove_knote(&sc->sc_rsel, kn);
 	APM_UNLOCK(sc);
 }
 
@@ -442,11 +442,9 @@ int
 apmkqfilter(dev_t dev, struct knote *kn)
 {
 	struct apm_softc *sc = device_lookup_private(&apm_cd,APMUNIT(dev));
-	struct klist *klist;
 
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
-		klist = &sc->sc_rsel.sel_klist;
 		kn->kn_fop = &apmread_filtops;
 		break;
 	default:
@@ -456,7 +454,7 @@ apmkqfilter(dev_t dev, struct knote *kn)
 	kn->kn_hook = sc;
 
 	APM_LOCK(sc);
-	SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+	selrecord_knote(&sc->sc_rsel, kn);
 	APM_UNLOCK(sc);
 
 	return (0);



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

2020-09-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Sep 12 18:12:53 UTC 2020

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

Log Message:
respond to keyboard brightness control PMF events


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/macppc/dev/lmu.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/lmu.c
diff -u src/sys/arch/macppc/dev/lmu.c:1.4 src/sys/arch/macppc/dev/lmu.c:1.5
--- src/sys/arch/macppc/dev/lmu.c:1.4	Thu Apr 23 12:56:40 2020
+++ src/sys/arch/macppc/dev/lmu.c	Sat Sep 12 18:12:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lmu.c,v 1.4 2020/04/23 12:56:40 macallan Exp $ */
+/* $NetBSD: lmu.c,v 1.5 2020/09/12 18:12:53 macallan Exp $ */
 
 /*-
  * Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.4 2020/04/23 12:56:40 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.5 2020/09/12 18:12:53 macallan Exp $");
 
 #include 
 #include 
@@ -123,6 +123,26 @@ lmu_video_off(device_t dev)
 	sc->sc_video_state = false;
 }
 
+static void
+lmu_kbd_brightness_up(device_t dev)
+{
+	struct lmu_softc * const sc = device_private(dev);
+
+	sc->sc_level = __MIN(16, sc->sc_level + 2);
+	sc->sc_target = sc->sc_level;
+	callout_schedule(&sc->sc_adjust, LMU_FADE);
+}
+
+static void
+lmu_kbd_brightness_down(device_t dev)
+{
+	struct lmu_softc * const sc = device_private(dev);
+
+	sc->sc_level = __MAX(0, sc->sc_level - 2);
+	sc->sc_target = sc->sc_level;
+	callout_schedule(&sc->sc_adjust, LMU_FADE);
+}
+
 static int
 lmu_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -162,6 +182,10 @@ lmu_attach(device_t parent, device_t sel
 	lmu_video_on, true);
 	pmf_event_register(sc->sc_dev, PMFE_DISPLAY_OFF,
 	lmu_video_off, true);
+	pmf_event_register(sc->sc_dev, PMFE_KEYBOARD_BRIGHTNESS_UP,
+	lmu_kbd_brightness_up, true);
+	pmf_event_register(sc->sc_dev, PMFE_KEYBOARD_BRIGHTNESS_DOWN,
+	lmu_kbd_brightness_down, true);
 
 	sc->sc_sme = sysmon_envsys_create();
 	sc->sc_sme->sme_name = device_xname(self);



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

2020-08-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Aug 29 23:00:10 UTC 2020

Modified Files:
src/sys/arch/macppc/conf: std.macppc

Log Message:
make us.apple the default USB keyboard layout


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/macppc/conf/std.macppc

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/std.macppc
diff -u src/sys/arch/macppc/conf/std.macppc:1.24 src/sys/arch/macppc/conf/std.macppc:1.25
--- src/sys/arch/macppc/conf/std.macppc:1.24	Sat Jun  9 02:25:52 2018
+++ src/sys/arch/macppc/conf/std.macppc	Sat Aug 29 23:00:10 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: std.macppc,v 1.24 2018/06/09 02:25:52 macallan Exp $
+#	$NetBSD: std.macppc,v 1.25 2020/08/29 23:00:10 macallan Exp $
 #
 # Standard/required options for NetBSD/macppc.
 
@@ -21,6 +21,7 @@ options 	INTSTK=0x2000
 # HID devices - for them to coexist on the same mux we tell the adbkbd driver
 # pose as a USB keyboard
 options 	ADBKBD_EMUL_USB
+options 	UKBD_LAYOUT="(KB_US | KB_APPLE)"  # for ukbd driver
 
 # Atheros HAL options
 include "external/isc/atheros_hal/conf/std.ath_hal"



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

2020-08-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Aug  8 22:41:14 UTC 2020

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

Log Message:
add commented out entries for onewire at snapper, and document what they're for


To generate a diff of this commit:
cvs rdiff -u -r1.369 -r1.370 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.369 src/sys/arch/macppc/conf/GENERIC:1.370
--- src/sys/arch/macppc/conf/GENERIC:1.369	Sat Aug  1 08:20:50 2020
+++ src/sys/arch/macppc/conf/GENERIC	Sat Aug  8 22:41:14 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.369 2020/08/01 08:20:50 maxv Exp $
+# $NetBSD: GENERIC,v 1.370 2020/08/08 22:41:14 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.369 $"
+#ident 		"GENERIC-$Revision: 1.370 $"
 
 maxusers	32
 
@@ -385,6 +385,11 @@ deq* 		at iic?		# mixer/equalizer, used 
 wi* 		at obio?	# AirMac
 snapper* 	at obio?	# Snapper audio device
 
+# this is for talking to the onewire-EEPROM hiding in Apple Pro speakers.
+# or other onewire devices you may want to hook up to it
+#onewire* 	at snapper?
+#oweeprom* 	at onewire?
+
 cardslot* at cbb?
 cardbus* at cardslot?
 pcmcia*	at cardslot?



CVS commit: src/sys/arch/macppc

2020-08-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Aug  8 22:37:19 UTC 2020

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

Log Message:
add support for the onewire bus found in some macs, namely Quicksilver.
This can be used to read the EEPROM content from Apple Pro speakers, or to
hook up other onewire devices.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/macppc/conf/files.macppc
cvs rdiff -u -r1.54 -r1.55 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/conf/files.macppc
diff -u src/sys/arch/macppc/conf/files.macppc:1.114 src/sys/arch/macppc/conf/files.macppc:1.115
--- src/sys/arch/macppc/conf/files.macppc:1.114	Fri Jan 10 06:24:17 2020
+++ src/sys/arch/macppc/conf/files.macppc	Sat Aug  8 22:37:19 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.macppc,v 1.114 2020/01/10 06:24:17 macallan Exp $
+#	$NetBSD: files.macppc,v 1.115 2020/08/08 22:37:19 macallan Exp $
 #
 # macppc-specific configuration info
 
@@ -290,9 +290,10 @@ file arch/macppc/dev/ki2c.c			ki2c
 defflag opt_ki2c.h	KI2C_DEBUG
 
 # snapper audio
-device snapper: audiobus
+device snapper: audiobus, onewirebus, onewire, onewire_bitbang
 attach snapper at obio
 file arch/macppc/dev/snapper.c			snapper
+defflag opt_snapper.h	SNAPPER_DEBUG
 
 include "arch/powerpc/conf/majors.powerpc"
 

Index: src/sys/arch/macppc/dev/snapper.c
diff -u src/sys/arch/macppc/dev/snapper.c:1.54 src/sys/arch/macppc/dev/snapper.c:1.55
--- src/sys/arch/macppc/dev/snapper.c:1.54	Sat Apr 11 01:42:56 2020
+++ src/sys/arch/macppc/dev/snapper.c	Sat Aug  8 22:37:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.54 2020/04/11 01:42:56 macallan Exp $	*/
+/*	$NetBSD: snapper.c,v 1.55 2020/08/08 22:37:19 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.54 2020/04/11 01:42:56 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.55 2020/08/08 22:37:19 macallan Exp $");
 
 #include 
 #include 
@@ -49,13 +49,16 @@ __KERNEL_RCSID(0, "$NetBSD: snapper.c,v 
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 
 #include 
 #include 
-//#define SNAPPER_DEBUG
+
+#include "opt_snapper.h"
+
 #ifdef SNAPPER_DEBUG
 # define DPRINTF printf
 #else
@@ -116,6 +119,10 @@ struct snapper_softc {
 
 	kmutex_t sc_lock;
 	kmutex_t sc_intr_lock;
+
+	struct onewire_bus	sc_ow_bus;
+	device_t		sc_ow_dev;
+	int			sc_ow_data;
 };
 
 static int snapper_match(device_t, struct cfdata *, void *);
@@ -155,6 +162,24 @@ static int snapper_cint(void *);
 static int tas3004_init(struct snapper_softc *);
 static void snapper_init(struct snapper_softc *, int);
 
+static void snapper_setup_ow(struct snapper_softc *);
+static int snapper_ow_reset(void *);
+static int snapper_ow_read_bit(void *);
+static void snapper_ow_write_bit(void *, int);
+
+static void snapper_bb_rx(void *);
+static void snapper_bb_tx(void *);
+static int snapper_bb_get(void *);
+static void snapper_bb_set(void *, int);
+
+static const struct onewire_bbops snapper_bbops = {
+	snapper_bb_rx,
+	snapper_bb_tx,
+	snapper_bb_get,
+	snapper_bb_set
+};
+
+
 static void
 snapper_volume(audio_filter_arg_t *arg)
 {
@@ -497,7 +522,8 @@ static bus_size_t amp_mute;
 static bus_size_t headphone_mute;
 static bus_size_t audio_hw_reset;
 static bus_size_t headphone_detect;
-static uint8_t headphone_detect_active = 0;
+static bus_size_t owaddr = -1;
+static uint8_t headphone_detect_active;
 
 
 /* I2S registers */
@@ -2059,7 +2085,7 @@ snapper_init(struct snapper_softc *sc, i
 
 	gpio = OF_child(gpio);
 	while (gpio) {
-		char name[64], audio_gpio[64];
+		char name[64], audio_gpio[64], sid[64];
 		int intr[2];
 		bus_size_t addr;
 
@@ -2068,6 +2094,7 @@ snapper_init(struct snapper_softc *sc, i
 		addr = 0;
 		OF_getprop(gpio, "name", name, sizeof name);
 		OF_getprop(gpio, "audio-gpio", audio_gpio, sizeof audio_gpio);
+		OF_getprop(gpio, "one-wire-bus", sid, sizeof sid);
 		if (OF_getprop(gpio, "AAPL,address", &addr, sizeof addr) == -1)
 			if (OF_getprop(gpio, "reg", reg, sizeof reg)
 			== sizeof reg)
@@ -2091,7 +2118,7 @@ snapper_init(struct snapper_softc *sc, i
 		/* extint-gpio15 */
 		if (strcmp(audio_gpio, "headphone-detect") == 0 ||
 		strcmp(name, "headphone-detect") == 0) {
-			uint32_t act;
+			uint32_t act = 0;
 			headphone_detect = addr;
 			OF_getprop(gpio, "audio-gpio-active-state", &act, 4);
 			headphone_detect_active = act;
@@ -2099,6 +2126,10 @@ snapper_init(struct snapper_softc *sc, i
 headphone_detect_intr = intr[0];
 			}
 		}
+		/* extint-gpio16 on Quicksilver */
+		if (strcmp(sid, "speaker-id") == 0) {
+			owaddr = addr;
+		}
 		/* gpio11 (keywest-11) */
 		if (strcmp(audio_gpio, "audio-hw-reset") == 0 ||
 		 

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

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 09:58:34 UTC 2020

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

Log Message:
Add NetBSD RCSID. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/macppc/macppc/pic_u3_ht.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/pic_u3_ht.c
diff -u src/sys/arch/macppc/macppc/pic_u3_ht.c:1.8 src/sys/arch/macppc/macppc/pic_u3_ht.c:1.9
--- src/sys/arch/macppc/macppc/pic_u3_ht.c:1.8	Sun Jul 12 23:58:30 2020
+++ src/sys/arch/macppc/macppc/pic_u3_ht.c	Wed Jul 15 09:58:34 2020
@@ -1,3 +1,4 @@
+/*	$NetBSD: pic_u3_ht.c,v 1.9 2020/07/15 09:58:34 rin Exp $	*/
 /*-
  * Copyright (c) 2013 Phileas Fogg
  * All rights reserved.
@@ -25,6 +26,7 @@
  */
 
 #include 
+__KERNEL_RCSID(0, "$NetBSD: pic_u3_ht.c,v 1.9 2020/07/15 09:58:34 rin Exp $");
 
 #include "opt_openpic.h"
 #include "opt_interrupt.h"



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

2020-07-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 14 08:58:03 UTC 2020

Modified Files:
src/sys/arch/macppc/dev: cuda.c pmu.c

Log Message:
Adapt to new proplib API


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/macppc/dev/cuda.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/macppc/dev/pmu.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/cuda.c
diff -u src/sys/arch/macppc/dev/cuda.c:1.25 src/sys/arch/macppc/dev/cuda.c:1.26
--- src/sys/arch/macppc/dev/cuda.c:1.25	Tue Jul 14 08:52:00 2020
+++ src/sys/arch/macppc/dev/cuda.c	Tue Jul 14 08:58:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cuda.c,v 1.25 2020/07/14 08:52:00 martin Exp $ */
+/*	$NetBSD: cuda.c,v 1.26 2020/07/14 08:58:03 martin Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cuda.c,v 1.25 2020/07/14 08:52:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cuda.c,v 1.26 2020/07/14 08:58:03 martin Exp $");
 
 #include 
 #include 
@@ -259,7 +259,7 @@ cuda_attach(device_t parent, device_t se
 	node = OF_finddevice("/valkyrie");
 	if (node != -1) {
 		dev = prop_dictionary_create();
-		prop_dictionary_set_cstring(dev, "name", "videopll");
+		prop_dictionary_set_string(dev, "name", "videopll");
 		prop_dictionary_set_uint32(dev, "addr", 0x50);
 		prop_array_add(cfg, dev);
 		prop_object_release(dev);

Index: src/sys/arch/macppc/dev/pmu.c
diff -u src/sys/arch/macppc/dev/pmu.c:1.33 src/sys/arch/macppc/dev/pmu.c:1.34
--- src/sys/arch/macppc/dev/pmu.c:1.33	Sun Dec 22 23:23:30 2019
+++ src/sys/arch/macppc/dev/pmu.c	Tue Jul 14 08:58:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmu.c,v 1.33 2019/12/22 23:23:30 thorpej Exp $ */
+/*	$NetBSD: pmu.c,v 1.34 2020/07/14 08:58:03 martin Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.33 2019/12/22 23:23:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.34 2020/07/14 08:58:03 martin Exp $");
 
 #include 
 #include 
@@ -365,8 +365,8 @@ pmu_attach(device_t parent, device_t sel
 addr = (addr & 0xff) >> 1;
 DPRINTF("-> %s@%x\n", name, addr);
 dev = prop_dictionary_create();
-prop_dictionary_set_cstring(dev, "name", name);
-data = prop_data_create_data(compat, strlen(compat)+1);
+prop_dictionary_set_string(dev, "name", name);
+data = prop_data_create_copy(compat, strlen(compat)+1);
 prop_dictionary_set(dev, "compatible", data);
 prop_object_release(data);
 prop_dictionary_set_uint32(dev, "addr", addr);



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

2020-07-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 14 08:55:07 UTC 2020

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

Log Message:
Adapt to new proplib API


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

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

Modified files:

Index: src/sys/arch/macppc/macppc/machdep.c
diff -u src/sys/arch/macppc/macppc/machdep.c:1.170 src/sys/arch/macppc/macppc/machdep.c:1.171
--- src/sys/arch/macppc/macppc/machdep.c:1.170	Tue Jul  7 02:33:54 2020
+++ src/sys/arch/macppc/macppc/machdep.c	Tue Jul 14 08:55:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.170 2020/07/07 02:33:54 rin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.171 2020/07/14 08:55:07 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.170 2020/07/07 02:33:54 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.171 2020/07/14 08:55:07 martin Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_ddb.h"
@@ -417,14 +417,14 @@ add_model_specifics(prop_dictionary_t di
 	if (of_compatible(node, clamshell) != -1) {
 		prop_data_t edid;
 
-		edid = prop_data_create_data(edid_clamshell, sizeof(edid_clamshell));
+		edid = prop_data_create_nocopy(edid_clamshell, sizeof(edid_clamshell));
 		prop_dictionary_set(dict, "EDID", edid);
 		prop_object_release(edid);
 	}
 	if (of_compatible(node, pismo) != -1) {
 		prop_data_t edid;
 
-		edid = prop_data_create_data(edid_pismo, sizeof(edid_pismo));
+		edid = prop_data_create_nocopy(edid_pismo, sizeof(edid_pismo));
 		prop_dictionary_set(dict, "EDID", edid);
 		prop_object_release(edid);
 	}



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

2020-07-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 14 08:52:00 UTC 2020

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

Log Message:
Adapt to new proplib API


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/macppc/dev/cuda.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/cuda.c
diff -u src/sys/arch/macppc/dev/cuda.c:1.24 src/sys/arch/macppc/dev/cuda.c:1.25
--- src/sys/arch/macppc/dev/cuda.c:1.24	Sun Dec 22 23:23:30 2019
+++ src/sys/arch/macppc/dev/cuda.c	Tue Jul 14 08:52:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cuda.c,v 1.24 2019/12/22 23:23:30 thorpej Exp $ */
+/*	$NetBSD: cuda.c,v 1.25 2020/07/14 08:52:00 martin Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cuda.c,v 1.24 2019/12/22 23:23:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cuda.c,v 1.25 2020/07/14 08:52:00 martin Exp $");
 
 #include 
 #include 
@@ -268,7 +268,7 @@ cuda_attach(device_t parent, device_t se
 	node = OF_finddevice("/perch");
 	if (node != -1) {
 		dev = prop_dictionary_create();
-		prop_dictionary_set_cstring(dev, "name", "sgsmix");
+		prop_dictionary_set_string(dev, "name", "sgsmix");
 		prop_dictionary_set_uint32(dev, "addr", 0x8a);
 		prop_array_add(cfg, dev);
 		prop_object_release(dev);



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

2020-07-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Jul 12 23:58:30 UTC 2020

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

Log Message:
Fix typo; U3_HT_PIC_DE*P*UG ---> U3_HT_PIC_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/macppc/macppc/pic_u3_ht.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/pic_u3_ht.c
diff -u src/sys/arch/macppc/macppc/pic_u3_ht.c:1.7 src/sys/arch/macppc/macppc/pic_u3_ht.c:1.8
--- src/sys/arch/macppc/macppc/pic_u3_ht.c:1.7	Mon Sep  3 16:29:25 2018
+++ src/sys/arch/macppc/macppc/pic_u3_ht.c	Sun Jul 12 23:58:30 2020
@@ -45,7 +45,7 @@
 #include 
 #include 
 
-#ifdef U3_HT_PIC_DEPUG
+#ifdef U3_HT_PIC_DEBUG
 #define DPRINTF aprint_error
 #else
 #define DPRINTF if (0) printf



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

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 02:39:59 UTC 2020

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

Log Message:
Enable COPY_SYMTAB in case of directly booted from Open Firmware
with ofwboot being skipped.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.20
--- src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.19	Tue Jul  7 02:37:27 2020
+++ src/sys/arch/macppc/conf/POWERMAC_G5_11_2	Tue Jul  7 02:39:59 2020
@@ -42,6 +42,7 @@ options 	DDB_ONPANIC=1	# don't go into d
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 options 	TRAP_PANICWAIT
 
+makeoptions 	COPY_SYMTAB=1	# in case of directly booted from ofw
 makeoptions 	DEBUG="-g"	# compile full symbol table
 
 # Compatibility options



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

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 02:37:27 UTC 2020

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

Log Message:
Sync wscons colors with GENERIC; now it works fine!


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 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.18 src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.19
--- src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.18	Sat Jul  4 12:04:15 2020
+++ src/sys/arch/macppc/conf/POWERMAC_G5_11_2	Tue Jul  7 02:37:27 2020
@@ -83,6 +83,12 @@ options 	MIIVERBOSE	# verbose PHY autoco
 #options 	WSEMUL_SUN			# sun terminal emulation
 options 	WSEMUL_VT100			# VT100 / VT220 emulation
 options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
+
+options 	WS_DEFAULT_FG=WSCOL_BLACK
+options 	WS_DEFAULT_BG=WSCOL_LIGHT_WHITE
+options 	WS_KERNEL_FG=WSCOL_GREEN
+options 	WS_KERNEL_BG=WSCOL_LIGHT_WHITE
+
 #options 	WSDISPLAY_COMPAT_RAWKBD		# can get raw scancodes
 options 	FONT_GALLANT12x22
 



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

2020-07-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jul  4 12:04:15 UTC 2020

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

Log Message:
Add missing TMPFS, PTYFS, WAPBL, INET6, and NFS_BOOT_DHCP.

XXX
Sync options with GENERIC. It should be better to introduce
GENERIC.common in a similar manner to evbarm.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 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.17 src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.18
--- src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.17	Sat Jul  4 12:00:15 2020
+++ src/sys/arch/macppc/conf/POWERMAC_G5_11_2	Sat Jul  4 12:04:15 2020
@@ -51,14 +51,17 @@ include 	"conf/compat_netbsd30.config"
 # File systems
 file-system 	FFS		# UFS
 file-system 	MFS		# memory file system
+file-system	TMPFS		# Efficient memory file-system
 file-system 	KERNFS		# /kern
 file-system 	PROCFS		# /proc
 file-system 	NFS		# Network File System client
+file-system	PTYFS		# /dev/pts/N support
 
 # File system options
 #options 	QUOTA		# legacy UFS quotas
 #options 	QUOTA2		# new, in-filesystem UFS quotas
 #options 	FFS_EI		# FFS Endian Independent support
+options 	WAPBL		# File system journaling support
 #options 	UFS_DIRHASH	# UFS Large Directory Hashing - Experimental
 #options 	NFSSERVER	# Network File System server
 #options 	FFS_NO_SNAPSHOT	# ffs snapshots
@@ -68,6 +71,7 @@ file-system 	NFS		# Network File System 
 # Networking options
 #options 	GATEWAY		# packet forwarding
 options 	INET		# IP + ICMP + TCP + UDP
+options 	INET6		# IPV6
 
 # These options enable verbose messages for several subsystems.
 # Warning, these may compile large string tables into the kernel!
@@ -85,7 +89,8 @@ options 	FONT_GALLANT12x22
 # Kernel root file system and dump configuration.
 config		netbsd	root on ? type ?
 #config		netbsd	root on gem0 type nfs
-#options 	NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM
+options 	NFS_BOOT_DHCP
+#options 	NFS_BOOT_BOOTPARAM
 
 #
 # Device configuration



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

2020-07-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jul  4 12:00:15 UTC 2020

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

Log Message:
Enable snapper(4) and friends. It works just fine.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 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.16 src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.17
--- src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.16	Sat Apr  4 15:56:25 2020
+++ src/sys/arch/macppc/conf/POWERMAC_G5_11_2	Sat Jul  4 12:00:15 2020
@@ -118,7 +118,7 @@ ppb*	at pci? dev ? function ?	# PCI-PCI 
 obio0		at pci? dev ? function ?
 zsc*		at obio?
 zstty*		at zsc? channel ?
-#snapper* 	at obio?
+snapper* 	at obio?
 ki2c*		at obio?	# Keywest I2C
 iic*		at ki2c?
 
@@ -129,10 +129,10 @@ smusat* 	at iic?
 deq* 		at iic?
 
 # Audio support
-#audio*	at audiobus?
+audio*	at audiobus?
 
-#spkr*	at audio?		# PC speaker (synthesized)
-#wsbell* at spkr?
+spkr*	at audio?		# PC speaker (synthesized)
+wsbell* at spkr?
 
 bge*	at pci? dev ? function ?	# gmac ethernet
 brgphy*	at mii? phy ?			# Broadcom BCM5400 PHYs



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

2020-07-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jul  4 11:55:18 UTC 2020

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

Log Message:
- Adjust location of \n in attach message.
- Convert to aprint_*(9).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/macppc/dev/smu.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/smu.c
diff -u src/sys/arch/macppc/dev/smu.c:1.8 src/sys/arch/macppc/dev/smu.c:1.9
--- src/sys/arch/macppc/dev/smu.c:1.8	Sun Dec 22 23:23:30 2019
+++ src/sys/arch/macppc/dev/smu.c	Sat Jul  4 11:55:18 2020
@@ -217,6 +217,8 @@ smu_attach(device_t parent, device_t sel
 		return;
 	}
 
+	aprint_normal("\n");
+
 	smu_setup_fans(sc);
 	smu_setup_iicbus(sc);
 
@@ -227,7 +229,6 @@ smu_attach(device_t parent, device_t sel
 
 	smu_setup_sme(sc);
 
-	printf("\n");
 	smu_setup_zones(sc);
 }
 
@@ -866,7 +867,8 @@ smu_setup_zones(struct smu_softc *sc)
 			z->nfans++;
 		}
 	}
-	printf("using %d fans for CPU zone\n", z->nfans);
+	aprint_normal_dev(sc->sc_dev,
+	"using %d fans for CPU zone\n", z->nfans);
 	z->threshold = C_TO_uK(45);
 	z->duty = 150;
 	z->step = 3;	
@@ -881,7 +883,8 @@ smu_setup_zones(struct smu_softc *sc)
 			z->nfans++;
 		}
 	}
-	printf("using %d fans for drive bay zone\n", z->nfans);
+	aprint_normal_dev(sc->sc_dev,
+	"using %d fans for drive bay zone\n", z->nfans);
 	z->threshold = C_TO_uK(40);
 	z->duty = 150;
 	z->step = 2;
@@ -897,7 +900,8 @@ smu_setup_zones(struct smu_softc *sc)
 			z->nfans++;
 		}
 	}
-	printf("using %d fans for expansion slots zone\n", z->nfans);
+	aprint_normal_dev(sc->sc_dev,
+	"using %d fans for expansion slots zone\n", z->nfans);
 	z->threshold = C_TO_uK(40);
 	z->duty = 150;
 	z->step = 2;



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

2020-07-02 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jul  2 12:47:19 UTC 2020

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

Log Message:
add $NetBSD:


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/macppc/dev/smuiic.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/smuiic.c
diff -u src/sys/arch/macppc/dev/smuiic.c:1.4 src/sys/arch/macppc/dev/smuiic.c:1.5
--- src/sys/arch/macppc/dev/smuiic.c:1.4	Thu Jul  2 12:45:27 2020
+++ src/sys/arch/macppc/dev/smuiic.c	Thu Jul  2 12:47:19 2020
@@ -1,3 +1,5 @@
+/*	$NetBSD: smuiic.c,v 1.5 2020/07/02 12:47:19 macallan Exp $ */
+
 /*-
  * Copyright (c) 2013 Phileas Fogg
  * All rights reserved.



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

2020-07-02 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jul  2 12:45:27 UTC 2020

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

Log Message:
proplib API catchup


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/macppc/dev/smuiic.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/smuiic.c
diff -u src/sys/arch/macppc/dev/smuiic.c:1.3 src/sys/arch/macppc/dev/smuiic.c:1.4
--- src/sys/arch/macppc/dev/smuiic.c:1.3	Fri Apr 20 18:22:50 2018
+++ src/sys/arch/macppc/dev/smuiic.c	Thu Jul  2 12:45:27 2020
@@ -100,8 +100,8 @@ smuiic_attach(device_t parent, device_t 
 			goto skip;
 		addr = (addr & 0xff) >> 1;
 		dev = prop_dictionary_create();
-		prop_dictionary_set_cstring(dev, "name", name);
-		data = prop_data_create_data(compat, strlen(compat)+1);
+		prop_dictionary_set_string(dev, "name", name);
+		data = prop_data_create_copy(compat, strlen(compat)+1);
 		prop_dictionary_set(dev, "compatible", data);
 		prop_object_release(data);
 		prop_dictionary_set_uint32(dev, "addr", addr);



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

2020-06-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 12 06:44:57 UTC 2020

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

Log Message:
more proplib API catchup


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 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.29 src/sys/arch/macppc/dev/ki2c.c:1.30
--- src/sys/arch/macppc/dev/ki2c.c:1.29	Thu Jan  9 18:49:06 2020
+++ src/sys/arch/macppc/dev/ki2c.c	Fri Jun 12 06:44:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ki2c.c,v 1.29 2020/01/09 18:49:06 macallan Exp $	*/
+/*	$NetBSD: ki2c.c,v 1.30 2020/06/12 06:44:57 macallan Exp $	*/
 /*	Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp	*/
 
 /*-
@@ -173,8 +173,8 @@ ki2c_attach(device_t parent, device_t se
 			addr = addr >> 1;
 			DPRINTF("-> %s@%x\n", name, addr);
 			dev = prop_dictionary_create();
-			prop_dictionary_set_cstring(dev, "name", name);
-			data = prop_data_create_data(compat, strlen(compat)+1);
+			prop_dictionary_set_string(dev, "name", name);
+			data = prop_data_create_copy(compat, strlen(compat)+1);
 			prop_dictionary_set(dev, "compatible", data);
 			prop_object_release(data);
 			prop_dictionary_set_uint32(dev, "addr", addr);
@@ -187,7 +187,7 @@ ki2c_attach(device_t parent, device_t se
 	goto nope;
 DPRINTF("found '%s' at %02x\n", descr, reg);
 snprintf(num, 7, "s%02x", reg);
-prop_dictionary_set_cstring(dev, num, descr);
+prop_dictionary_set_string(dev, num, descr);
 			nope:
 devc = OF_peer(devc);
 			}



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

2020-04-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Apr 26 23:03:37 UTC 2020

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

Log Message:
Re-enable crypto and swcrypto - "generic softints" have been available
for quite some time, so no need to disable.

This is a work-around for PR kern/55155.  The root problem, failure to
load modules due to missing kernel symbol table, still exists.


To generate a diff of this commit:
cvs rdiff -u -r1.367 -r1.368 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.367 src/sys/arch/macppc/conf/GENERIC:1.368
--- src/sys/arch/macppc/conf/GENERIC:1.367	Fri Apr 24 12:40:25 2020
+++ src/sys/arch/macppc/conf/GENERIC	Sun Apr 26 23:03:37 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.367 2020/04/24 12:40:25 macallan Exp $
+# $NetBSD: GENERIC,v 1.368 2020/04/26 23:03:37 pgoyette 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.367 $"
+#ident 		"GENERIC-$Revision: 1.368 $"
 
 maxusers	32
 
@@ -512,9 +512,8 @@ midi*	at eap?			# 137[01] MIDI port
 pseudo-device   accf_data		# "dataready" accept filter
 pseudo-device   accf_http		# "httpready" accept filter
 
-#pseudo-device 	crypto			# /dev/crypto device
-	# (disabled, requires generic softints)
-#pseudo-device	swcrypto		# software crypto implementation
+pseudo-device 	crypto			# /dev/crypto device
+pseudo-device	swcrypto		# software crypto implementation
 pseudo-device	vnd			# disk-like interface to files
 #options 	VND_COMPRESSION		# compressed vnd(4)
 pseudo-device	ccd			# concatenated/striped disk devices



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

2020-04-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Apr 24 12:40:25 UTC 2020

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

Log Message:
add sudden motion sensor 'driver'.


To generate a diff of this commit:
cvs rdiff -u -r1.366 -r1.367 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.366 src/sys/arch/macppc/conf/GENERIC:1.367
--- src/sys/arch/macppc/conf/GENERIC:1.366	Sat Mar 28 08:35:36 2020
+++ src/sys/arch/macppc/conf/GENERIC	Fri Apr 24 12:40:25 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.366 2020/03/28 08:35:36 isaki Exp $
+# $NetBSD: GENERIC,v 1.367 2020/04/24 12:40:25 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.366 $"
+#ident 		"GENERIC-$Revision: 1.367 $"
 
 maxusers	32
 
@@ -373,13 +373,14 @@ iic*	at ki2c?
 # I2C devices
 dbcool* 	at iic?		# dbCool thermal monitor & fan control
 lmtemp* 	at iic?		# temperature sensor, found in PowerBook5,6
-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
 lmu* 		at iic?		# ambient / keyboard lights
+asms* 		at iic?		# sudden motion sensor, various later *Books
 videopll*	at iic?		# for valkyriefb
 sgsmix* 	at iic?		# Additional mixer found in beige G3
 # use with awacs.
+deq* 		at iic?		# mixer/equalizer, used by snapper
 
 wi* 		at obio?	# AirMac
 snapper* 	at obio?	# Snapper audio device



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

2020-04-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 23 12:56:40 UTC 2020

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

Log Message:
make this work properly:
- get rid of cargo-culted register assignments, I found the right ones by
  experiment, now both light sensors report sane values
- keyboard brightness seems to max out at 16, act like it
- do what MacOS does and fade keyboard brightness instead of just switching
- add sysctls to configure keyboard brightness and environmental light
  thresholds
- don't poll the chip more often than once a second


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/macppc/dev/lmu.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/lmu.c
diff -u src/sys/arch/macppc/dev/lmu.c:1.3 src/sys/arch/macppc/dev/lmu.c:1.4
--- src/sys/arch/macppc/dev/lmu.c:1.3	Thu Apr 23 09:47:31 2020
+++ src/sys/arch/macppc/dev/lmu.c	Thu Apr 23 12:56:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lmu.c,v 1.3 2020/04/23 09:47:31 macallan Exp $ */
+/* $NetBSD: lmu.c,v 1.4 2020/04/23 12:56:40 macallan Exp $ */
 
 /*-
  * Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.3 2020/04/23 09:47:31 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.4 2020/04/23 12:56:40 macallan Exp $");
 
 #include 
 #include 
@@ -40,11 +40,18 @@ __KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.3 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
 #include 
 
+#ifdef LMU_DEBUG
+#define DPRINTF printf
+#else
+#define DPRINTF if (0) printf
+#endif
+
 struct lmu_softc {
 	device_t	sc_dev;
 	i2c_tag_t	sc_i2c;
@@ -54,7 +61,9 @@ struct lmu_softc {
 	struct sysmon_envsys *sc_sme;
 	envsys_data_t	sc_sensors[2];
 	callout_t	sc_adjust;
-	int		sc_thresh, sc_hyst, sc_level;
+	int		sc_thresh, sc_hyst, sc_level, sc_target, sc_current;
+	int		sc_lux[2];
+	time_t		sc_last;
 	int		sc_lid_state, sc_video_state;
 };
 
@@ -65,6 +74,8 @@ static void	lmu_sensors_refresh(struct s
 static void	lmu_set_brightness(struct lmu_softc *, int);
 static int	lmu_get_brightness(struct lmu_softc *, int);
 static void	lmu_adjust(void *);
+static int 	lmu_sysctl(SYSCTLFN_ARGS);
+static int 	lmu_sysctl_thresh(SYSCTLFN_ARGS);
 
 CFATTACH_DECL_NEW(lmu, sizeof(struct lmu_softc),
 lmu_match, lmu_attach, NULL, NULL);
@@ -75,6 +86,11 @@ static const struct device_compatible_en
 	{ NULL,			0 }
 };
 
+/* time between polling the light sensors */
+#define LMU_POLL	(hz * 2)
+/* time between updates to keyboard brightness */
+#define LMU_FADE	(hz / 16)
+
 static void
 lmu_lid_open(device_t dev)
 {
@@ -125,11 +141,13 @@ lmu_attach(device_t parent, device_t sel
 	struct lmu_softc *sc = device_private(self);
 	struct i2c_attach_args *ia = aux;
 	envsys_data_t *s;
+	const struct sysctlnode *me;
 
 	sc->sc_dev = self;
 	sc->sc_i2c = ia->ia_tag;
 	sc->sc_addr = ia->ia_addr;
 	sc->sc_node = ia->ia_cookie;
+	sc->sc_last = 0;
 
 	aprint_naive("\n");
 	aprint_normal(": ambient light sensor\n");
@@ -161,7 +179,7 @@ lmu_attach(device_t parent, device_t sel
 	s->state = ENVSYS_SINVALID;
 	s->units = ENVSYS_LUX;
 	strcpy(s->desc, "left");
-	s->private = 2;
+	s->private = 1;
 	sysmon_envsys_sensor_attach(sc->sc_sme, s);
 
 	sysmon_envsys_register(sc->sc_sme);
@@ -169,7 +187,30 @@ lmu_attach(device_t parent, device_t sel
 	/* TODO: make this adjustable via sysctl */
 	sc->sc_thresh = 300;
 	sc->sc_hyst = 30;
-	sc->sc_level = 100;
+	sc->sc_level = 16;
+	sc->sc_target = 0;
+	sc->sc_current = 0;
+
+	sysctl_createv(NULL, 0, NULL, &me,
+		CTLFLAG_READWRITE,
+		CTLTYPE_NODE, "lmu",
+		SYSCTL_DESCR("LMU driver"),
+		NULL, 0, NULL, 0,
+		CTL_HW, CTL_CREATE, CTL_EOL);
+
+	sysctl_createv(NULL, 0, NULL, NULL,
+		CTLFLAG_READWRITE,
+		CTLTYPE_INT, "level",
+		SYSCTL_DESCR("keyboard brightness"),
+		lmu_sysctl, 0, (void *)sc, 0,
+		CTL_HW, me->sysctl_num, CTL_CREATE, CTL_EOL);
+
+	sysctl_createv(NULL, 0, NULL, NULL,
+		CTLFLAG_READWRITE,
+		CTLTYPE_INT, "threshold",
+		SYSCTL_DESCR("environmental light threshold"),
+		lmu_sysctl_thresh, 1, (void *)sc, 0,
+		CTL_HW, me->sysctl_num, CTL_CREATE, CTL_EOL);
 
 	callout_init(&sc->sc_adjust, 0);
 	callout_setfunc(&sc->sc_adjust, lmu_adjust, sc);
@@ -193,28 +234,38 @@ lmu_sensors_refresh(struct sysmon_envsys
 static int
 lmu_get_brightness(struct lmu_softc *sc, int reg)
 {
-	int error;
-	uint16_t buf;
-	uint8_t cmd = reg;
+	int error, i;
+	uint16_t buf[2];
+	uint8_t cmd = 0;
+
+	if (reg > 1) return -1;
+	if (time_second == sc->sc_last)
+		return sc->sc_lux[reg];
 
 	iic_acquire_bus(sc->sc_i2c, 0);
 	error = iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP,
-		sc->sc_addr, &cmd, 1, &buf, 2, 0);
+		sc->sc_addr, &cmd, 1, buf, 4, 0);
 	iic_release_bus(sc->sc_i2c, 0);
 	if (error) return -1;
-	return be16toh(buf);
+	sc->sc_last = time_second;
+
+	for (i = 0; i < 2; i++)
+		sc->sc_lux[i] = be16toh(buf[i]);
+
+	DPRINTF("<%d %04x %04x>", reg, buf[0], buf[1

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

2020-04-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 23 09:47:31 UTC 2020

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

Log Message:
drop openfirm.h include


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/macppc/dev/lmu.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/lmu.c
diff -u src/sys/arch/macppc/dev/lmu.c:1.2 src/sys/arch/macppc/dev/lmu.c:1.3
--- src/sys/arch/macppc/dev/lmu.c:1.2	Thu Feb  6 02:17:24 2020
+++ src/sys/arch/macppc/dev/lmu.c	Thu Apr 23 09:47:31 2020
@@ -1,4 +1,4 @@
- /* $NetBSD: lmu.c,v 1.2 2020/02/06 02:17:24 macallan Exp $ */
+/* $NetBSD: lmu.c,v 1.3 2020/04/23 09:47:31 macallan Exp $ */
 
 /*-
  * Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.2 2020/02/06 02:17:24 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.3 2020/04/23 09:47:31 macallan Exp $");
 
 #include 
 #include 
@@ -41,8 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.2 
 #include 
 #include 
 
-#include 
-
 #include 
 
 #include 
@@ -56,7 +54,7 @@ struct lmu_softc {
 	struct sysmon_envsys *sc_sme;
 	envsys_data_t	sc_sensors[2];
 	callout_t	sc_adjust;
-	int sc_thresh, sc_hyst, sc_level;
+	int		sc_thresh, sc_hyst, sc_level;
 	int		sc_lid_state, sc_video_state;
 };
 



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

2020-04-22 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Apr 23 00:12:28 UTC 2020

Modified Files:
src/sys/arch/macppc/stand/ofwboot: boot.c

Log Message:
bootfile is owned by libsa


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/macppc/stand/ofwboot/boot.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/stand/ofwboot/boot.c
diff -u src/sys/arch/macppc/stand/ofwboot/boot.c:1.29 src/sys/arch/macppc/stand/ofwboot/boot.c:1.30
--- src/sys/arch/macppc/stand/ofwboot/boot.c:1.29	Wed Jun  6 22:56:25 2018
+++ src/sys/arch/macppc/stand/ofwboot/boot.c	Thu Apr 23 00:12:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.29 2018/06/06 22:56:25 uwe Exp $	*/
+/*	$NetBSD: boot.c,v 1.30 2020/04/23 00:12:28 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@ extern void __syncicache(void *, size_t)
 #endif
 
 char bootdev[MAXBOOTPATHLEN];
-char bootfile[MAXBOOTPATHLEN];
+extern char bootfile[MAXBOOTPATHLEN];
 int boothowto;
 bool floppyboot;
 int ofw_version = 0;



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

2020-04-10 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr 11 01:42:56 UTC 2020

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

Log Message:
don't try to read a 32bit property into a uint8_t.
Now headphone detection works properly on machines which have the gpio's
polarity reversed, like Quicksilver and TiBook.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 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.53 src/sys/arch/macppc/dev/snapper.c:1.54
--- src/sys/arch/macppc/dev/snapper.c:1.53	Fri Sep 20 21:24:34 2019
+++ src/sys/arch/macppc/dev/snapper.c	Sat Apr 11 01:42:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.53 2019/09/20 21:24:34 macallan Exp $	*/
+/*	$NetBSD: snapper.c,v 1.54 2020/04/11 01:42:56 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.53 2019/09/20 21:24:34 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.54 2020/04/11 01:42:56 macallan Exp $");
 
 #include 
 #include 
@@ -497,7 +497,7 @@ static bus_size_t amp_mute;
 static bus_size_t headphone_mute;
 static bus_size_t audio_hw_reset;
 static bus_size_t headphone_detect;
-static uint8_t headphone_detect_active;
+static uint8_t headphone_detect_active = 0;
 
 
 /* I2S registers */
@@ -2091,9 +2091,10 @@ snapper_init(struct snapper_softc *sc, i
 		/* extint-gpio15 */
 		if (strcmp(audio_gpio, "headphone-detect") == 0 ||
 		strcmp(name, "headphone-detect") == 0) {
+			uint32_t act;
 			headphone_detect = addr;
-			OF_getprop(gpio, "audio-gpio-active-state",
-			&headphone_detect_active, 4);
+			OF_getprop(gpio, "audio-gpio-active-state", &act, 4);
+			headphone_detect_active = act;
 			if (OF_getprop(gpio, "interrupts", intr, 8) == 8) {
 headphone_detect_intr = intr[0];
 			}



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

2020-04-04 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Apr  4 15:56:25 UTC 2020

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

Log Message:
remove some leftover nsmb(4) references from kernel configs


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/macppc/conf/MAMBO
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/macppc/conf/POWERMAC_G5
cvs rdiff -u -r1.15 -r1.16 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/MAMBO
diff -u src/sys/arch/macppc/conf/MAMBO:1.33 src/sys/arch/macppc/conf/MAMBO:1.34
--- src/sys/arch/macppc/conf/MAMBO:1.33	Sat Apr 13 08:23:00 2019
+++ src/sys/arch/macppc/conf/MAMBO	Sat Apr  4 15:56:25 2020
@@ -6,7 +6,7 @@ include 	"arch/macppc/conf/std.macppc.g5
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.33 $"
+#ident 		"GENERIC-$Revision: 1.34 $"
 
 maxusers	32
 
@@ -173,7 +173,6 @@ pseudo-device	wsmux			# mouse and keyboa
 pseudo-device	clockctl		# user control of clock subsystem
 pseudo-device	drvctl			# user control of drive subsystem
 pseudo-device	ksyms			# /dev/ksyms
-pseudo-device	nsmb			# SMB requester
 #pseudo-device	npf			# NPF packet filter
 
 # Enable the hooks used for initializing the ram-disk.

Index: src/sys/arch/macppc/conf/POWERMAC_G5
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.42 src/sys/arch/macppc/conf/POWERMAC_G5:1.43
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.42	Tue Mar 17 21:28:45 2020
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Sat Apr  4 15:56:25 2020
@@ -228,7 +228,6 @@ pseudo-device	wsmux			# mouse and keyboa
 pseudo-device	clockctl		# user control of clock subsystem
 pseudo-device	drvctl			# user control of drive subsystem
 pseudo-device	ksyms			# /dev/ksyms
-#pseudo-device	nsmb			# SMB requester
 #pseudo-device	npf			# NPF packet filter
 
 # Enable the hooks used for initializing the ram-disk.

Index: src/sys/arch/macppc/conf/POWERMAC_G5_11_2
diff -u src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.15 src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.16
--- src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.15	Tue Mar 17 21:28:45 2020
+++ src/sys/arch/macppc/conf/POWERMAC_G5_11_2	Sat Apr  4 15:56:25 2020
@@ -180,7 +180,6 @@ pseudo-device	openfirm		# /dev/openfirm
 pseudo-device	wsmux			# mouse and keyboard multiplexor
 pseudo-device	clockctl		# user control of clock subsystem
 pseudo-device	ksyms			# /dev/ksyms
-pseudo-device	nsmb			# SMB requester
 pseudo-device   bpfilter8   # Berkeley packet filter
 #pseudo-device	npf			# NPF packet filter
 



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

2020-03-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar 17 21:28:45 UTC 2020

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

Log Message:
remove OFWOEA_WSCONS_NO_ROM_FONT


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/macppc/conf/POWERMAC_G5
cvs rdiff -u -r1.14 -r1.15 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
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.41 src/sys/arch/macppc/conf/POWERMAC_G5:1.42
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.41	Sat Apr 13 08:23:00 2019
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Tue Mar 17 21:28:45 2020
@@ -191,7 +191,6 @@ wskbd*	at ukbd? console ?
 ums*	at uhidev? reportid ?# USB Mice
 wsmouse* at ums?
 
-options		OFWOEA_WSCONS_NO_ROM_FONT
 genfb*	at pci? dev ? function ?	# Generic Open Firmware Framebuffer
 radeonfb*	at pci? dev ? function ?
 options 	RADEONFB_ALWAYS_ACCEL_PUTCHAR

Index: src/sys/arch/macppc/conf/POWERMAC_G5_11_2
diff -u src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.14 src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.15
--- src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.14	Tue Nov 12 17:27:59 2019
+++ src/sys/arch/macppc/conf/POWERMAC_G5_11_2	Tue Mar 17 21:28:45 2020
@@ -184,7 +184,6 @@ pseudo-device	nsmb			# SMB requester
 pseudo-device   bpfilter8   # Berkeley packet filter
 #pseudo-device	npf			# NPF packet filter
 
-options		OFWOEA_WSCONS_NO_ROM_FONT
 options		EXSTORAGE_MAX=24
 
 # Enable the hooks used for initializing the ram-disk.



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

2020-02-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  9 09:30:37 UTC 2020

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

Log Message:
Traiing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/macppc/macppc/cpu.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/cpu.c
diff -u src/sys/arch/macppc/macppc/cpu.c:1.70 src/sys/arch/macppc/macppc/cpu.c:1.71
--- src/sys/arch/macppc/macppc/cpu.c:1.70	Thu Jan  9 16:35:03 2020
+++ src/sys/arch/macppc/macppc/cpu.c	Sun Feb  9 09:30:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.70 2020/01/09 16:35:03 ad Exp $	*/
+/*	$NetBSD: cpu.c,v 1.71 2020/02/09 09:30:37 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001 Tsubai Masanari.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.70 2020/01/09 16:35:03 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.71 2020/02/09 09:30:37 skrll Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_multiprocessor.h"
@@ -170,7 +170,7 @@ cpuattach(device_t parent, device_t self
 	core = 0;
 
 	vers = (mfpvr() >> 16) & 0x;
-	
+
 	if (vers == IBM970MP) {
 		core = package & 1;
 		package >>= 1;
@@ -348,7 +348,7 @@ md_setup_interrupts(void)
 	if (openpic_base) {
 		openpic_set_priority(cpu_number(), 0);
 	} else if (have_u3_ht()) {
-		__u3_ht_set_priority(cpu_number(), 0);		
+		__u3_ht_set_priority(cpu_number(), 0);
 	} else
 #endif /* OPENPIC */
 		out32(HH_INTR_SECONDARY, ~0);	/* Reset interrupt. */



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

2020-02-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb  6 02:17:24 UTC 2020

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

Log Message:
listen to PMF events in order to turn off keyboard lights when the lid is
closed or the screen is blanked


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/lmu.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/lmu.c
diff -u src/sys/arch/macppc/dev/lmu.c:1.1 src/sys/arch/macppc/dev/lmu.c:1.2
--- src/sys/arch/macppc/dev/lmu.c:1.1	Fri Jan 10 06:24:17 2020
+++ src/sys/arch/macppc/dev/lmu.c	Thu Feb  6 02:17:24 2020
@@ -1,4 +1,4 @@
- /* $NetBSD: lmu.c,v 1.1 2020/01/10 06:24:17 macallan Exp $ */
+ /* $NetBSD: lmu.c,v 1.2 2020/02/06 02:17:24 macallan Exp $ */
 
 /*-
  * Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.1 2020/01/10 06:24:17 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.2 2020/02/06 02:17:24 macallan Exp $");
 
 #include 
 #include 
@@ -56,7 +56,8 @@ struct lmu_softc {
 	struct sysmon_envsys *sc_sme;
 	envsys_data_t	sc_sensors[2];
 	callout_t	sc_adjust;
-	int sc_thresh, sc_hyst;
+	int sc_thresh, sc_hyst, sc_level;
+	int		sc_lid_state, sc_video_state;
 };
 
 static int	lmu_match(device_t, cfdata_t, void *);
@@ -76,6 +77,38 @@ static const struct device_compatible_en
 	{ NULL,			0 }
 };
 
+static void
+lmu_lid_open(device_t dev)
+{
+	struct lmu_softc * const sc = device_private(dev);
+
+	sc->sc_lid_state = true;
+}
+
+static void
+lmu_lid_close(device_t dev)
+{
+	struct lmu_softc * const sc = device_private(dev);
+
+	sc->sc_lid_state = false;
+}
+
+static void
+lmu_video_on(device_t dev)
+{
+	struct lmu_softc * const sc = device_private(dev);
+
+	sc->sc_video_state = true;
+}
+
+static void
+lmu_video_off(device_t dev)
+{
+	struct lmu_softc * const sc = device_private(dev);
+
+	sc->sc_video_state = false;
+}
+
 static int
 lmu_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -103,6 +136,17 @@ lmu_attach(device_t parent, device_t sel
 	aprint_naive("\n");
 	aprint_normal(": ambient light sensor\n");
 
+	sc->sc_lid_state = true;
+	pmf_event_register(sc->sc_dev, PMFE_CHASSIS_LID_OPEN,
+	lmu_lid_open, true);
+	pmf_event_register(sc->sc_dev, PMFE_CHASSIS_LID_CLOSE,
+	lmu_lid_close, true);
+	sc->sc_video_state = true;
+	pmf_event_register(sc->sc_dev, PMFE_DISPLAY_ON,
+	lmu_video_on, true);
+	pmf_event_register(sc->sc_dev, PMFE_DISPLAY_OFF,
+	lmu_video_off, true);
+
 	sc->sc_sme = sysmon_envsys_create();
 	sc->sc_sme->sme_name = device_xname(self);
 	sc->sc_sme->sme_cookie = sc;
@@ -127,6 +171,7 @@ lmu_attach(device_t parent, device_t sel
 	/* TODO: make this adjustable via sysctl */
 	sc->sc_thresh = 300;
 	sc->sc_hyst = 30;
+	sc->sc_level = 100;
 
 	callout_init(&sc->sc_adjust, 0);
 	callout_setfunc(&sc->sc_adjust, lmu_adjust, sc);
@@ -189,10 +234,11 @@ lmu_adjust(void *cookie)
 	right = lmu_get_brightness(sc, 0);
 	b = left > right ? left : right;
 
-	if (b > (sc->sc_thresh + sc->sc_hyst)) {
+	if ((b > (sc->sc_thresh + sc->sc_hyst)) ||
+	   !(sc->sc_lid_state && sc->sc_video_state)) {
 		lmu_set_brightness(sc, 0);
 	} else if (b < sc->sc_thresh) {
-		lmu_set_brightness(sc, 100);
+		lmu_set_brightness(sc, sc->sc_level);
 	}
 
 	callout_schedule(&sc->sc_adjust, hz * 2);	



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

2020-02-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  4 13:47:34 UTC 2020

Modified Files:
src/sys/arch/macppc/dev: am79c950.c if_bm.c

Log Message:
Convert a few more drivers to the if_stats interface


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/macppc/dev/am79c950.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/macppc/dev/if_bm.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/am79c950.c
diff -u src/sys/arch/macppc/dev/am79c950.c:1.48 src/sys/arch/macppc/dev/am79c950.c:1.49
--- src/sys/arch/macppc/dev/am79c950.c:1.48	Tue Feb  4 07:36:36 2020
+++ src/sys/arch/macppc/dev/am79c950.c	Tue Feb  4 13:47:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: am79c950.c,v 1.48 2020/02/04 07:36:36 skrll Exp $	*/
+/*	$NetBSD: am79c950.c,v 1.49 2020/02/04 13:47:34 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997 David Huang 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.48 2020/02/04 07:36:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.49 2020/02/04 13:47:34 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -439,19 +439,19 @@ mcintr(void *arg)
 #ifdef MCDEBUG
 		printf("%s: jabber error\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_oerrors++;
+		if_statinc(&sc->sc_if, if_oerrors);
 	}
 
 	if (ir & BABL) {
 #ifdef MCDEBUG
 		printf("%s: babble\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_oerrors++;
+		if_statinc(&sc->sc_if, if_oerrors);
 	}
 
 	if (ir & CERR) {
 		printf("%s: collision error\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_collisions++;
+		if_statinc(&sc->sc_if, if_collisions);
 	}
 
 	/*
@@ -486,27 +486,29 @@ mc_tint(struct mc_softc *sc)
 		return;
 	}
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(&sc->sc_if);
 	if (xmtfs & LCOL) {
 		printf("%s: late collision\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_oerrors++;
-		sc->sc_if.if_collisions++;
+		if_statinc_ref(nsr, if_oerrors);
+		if_statinc_ref(nsr, if_collisions);
 	}
 
 	if (xmtfs & MORE)
 		/* Real number is unknown. */
-		sc->sc_if.if_collisions += 2;
+		if_statadd_ref(nsr, if_collisions, 2);
 	else if (xmtfs & ONE)
-		sc->sc_if.if_collisions++;
+		if_statinc_ref(nsr, if_collisions);
 	else if (xmtfs & RTRY) {
-		sc->sc_if.if_collisions += 16;
-		sc->sc_if.if_oerrors++;
+		if_statadd_ref(nsr, if_collisions, 16);
+		if_statinc_ref(nsr, if_oerrors);
 	}
 
 	if (xmtfs & LCAR) {
 		sc->sc_havecarrier = 0;
 		printf("%s: lost carrier\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_oerrors++;
+		if_statinc_ref(nsr, if_oerrors);
 	}
+	IF_STAT_PUTREF(&sc->sc_if);
 
 	sc->sc_if.if_flags &= ~IFF_OACTIVE;
 	sc->sc_if.if_timer = 0;
@@ -530,18 +532,18 @@ mc_rint(struct mc_softc *sc)
 
 	if (rxf.rx_rcvsts & OFLO) {
 		printf("%s: receive FIFO overflow\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_ierrors++;
+		if_statinc(&sc->sc_if, if_ierrors);
 		return;
 	}
 
 	if (rxf.rx_rcvsts & CLSN)
-		sc->sc_if.if_collisions++;
+		if_statinc(&sc->sc_if, if_collisions);
 
 	if (rxf.rx_rcvsts & FRAM) {
 #ifdef MCDEBUG
 		printf("%s: framing error\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_ierrors++;
+		if_statinc(&sc->sc_if, if_ierrors);
 		return;
 	}
 
@@ -550,7 +552,7 @@ mc_rint(struct mc_softc *sc)
 		printf("%s: frame control checksum error\n",
 		device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_ierrors++;
+		if_statinc(&sc->sc_if, if_ierrors);
 		return;
 	}
 

Index: src/sys/arch/macppc/dev/if_bm.c
diff -u src/sys/arch/macppc/dev/if_bm.c:1.62 src/sys/arch/macppc/dev/if_bm.c:1.63
--- src/sys/arch/macppc/dev/if_bm.c:1.62	Tue Feb  4 07:36:36 2020
+++ src/sys/arch/macppc/dev/if_bm.c	Tue Feb  4 13:47:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bm.c,v 1.62 2020/02/04 07:36:36 skrll Exp $	*/
+/*	$NetBSD: if_bm.c,v 1.63 2020/02/04 13:47:34 martin Exp $	*/
 
 /*-
  * Copyright (C) 1998, 1999, 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.62 2020/02/04 07:36:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.63 2020/02/04 13:47:34 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -436,7 +436,7 @@ bmac_intr(void *v)
 	if (stat & IntFrameSent) {
 		sc->sc_if.if_flags &= ~IFF_OACTIVE;
 		sc->sc_if.if_timer = 0;
-		sc->sc_if.if_opackets++;
+		if_statinc(&sc->sc_if, if_opackets);
 		if_schedule_deferred_start(&sc->sc_if);
 	}
 



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

2020-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb  4 07:36:36 UTC 2020

Modified Files:
src/sys/arch/macppc/dev: am79c950.c if_bm.c if_gm.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/macppc/dev/am79c950.c
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/macppc/dev/if_bm.c
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/macppc/dev/if_gm.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/am79c950.c
diff -u src/sys/arch/macppc/dev/am79c950.c:1.47 src/sys/arch/macppc/dev/am79c950.c:1.48
--- src/sys/arch/macppc/dev/am79c950.c:1.47	Fri Dec 27 09:32:10 2019
+++ src/sys/arch/macppc/dev/am79c950.c	Tue Feb  4 07:36:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: am79c950.c,v 1.47 2019/12/27 09:32:10 msaitoh Exp $	*/
+/*	$NetBSD: am79c950.c,v 1.48 2020/02/04 07:36:36 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1997 David Huang 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.47 2019/12/27 09:32:10 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.48 2020/02/04 07:36:36 skrll Exp $");
 
 #include "opt_inet.h"
 
@@ -271,7 +271,7 @@ mcstart(struct ifnet *ifp)
 		ifp->if_flags |= IFF_OACTIVE;
 		maceput(sc, m);
 
-		ifp->if_opackets++;		/* # of pkts */
+		if_statinc(ifp, if_opackets);		/* # of pkts */
 	}
 }
 
@@ -570,13 +570,13 @@ mace_read(struct mc_softc *sc, uint8_t *
 		printf("%s: invalid packet size %d; dropping\n",
 		device_xname(sc->sc_dev), len);
 #endif
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
 	m = mace_get(sc, pkt, len);
 	if (m == NULL) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 

Index: src/sys/arch/macppc/dev/if_bm.c
diff -u src/sys/arch/macppc/dev/if_bm.c:1.61 src/sys/arch/macppc/dev/if_bm.c:1.62
--- src/sys/arch/macppc/dev/if_bm.c:1.61	Sun Nov 10 21:16:29 2019
+++ src/sys/arch/macppc/dev/if_bm.c	Tue Feb  4 07:36:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bm.c,v 1.61 2019/11/10 21:16:29 chs Exp $	*/
+/*	$NetBSD: if_bm.c,v 1.62 2020/02/04 07:36:36 skrll Exp $	*/
 
 /*-
  * Copyright (C) 1998, 1999, 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.61 2019/11/10 21:16:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.62 2020/02/04 07:36:36 skrll Exp $");
 
 #include "opt_inet.h"
 
@@ -490,7 +490,7 @@ bmac_rint(void *v)
 
 		m = bmac_get(sc, data, datalen);
 		if (m == NULL) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto next;
 		}
 
@@ -576,7 +576,7 @@ bmac_start(struct ifnet *ifp)
 
 		/* 5 seconds to watch for failing to transmit */
 		ifp->if_timer = 5;
-		ifp->if_opackets++;		/* # of pkts */
+		if_statinc(ifp, if_opackets);		/* # of pkts */
 
 		bmac_transmit_packet(sc, sc->sc_txbuf, tlen);
 	}
@@ -680,7 +680,7 @@ bmac_watchdog(struct ifnet *ifp)
 	bmac_reset_bits(sc, TXCFG, TxMACEnable);
 
 	printf("%s: device timeout\n", ifp->if_xname);
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	bmac_reset(sc);
 }

Index: src/sys/arch/macppc/dev/if_gm.c
diff -u src/sys/arch/macppc/dev/if_gm.c:1.56 src/sys/arch/macppc/dev/if_gm.c:1.57
--- src/sys/arch/macppc/dev/if_gm.c:1.56	Sun Nov 10 21:16:29 2019
+++ src/sys/arch/macppc/dev/if_gm.c	Tue Feb  4 07:36:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gm.c,v 1.56 2019/11/10 21:16:29 chs Exp $	*/
+/*	$NetBSD: if_gm.c,v 1.57 2020/02/04 07:36:36 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.56 2019/11/10 21:16:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.57 2020/02/04 07:36:36 skrll Exp $");
 
 #include "opt_inet.h"
 
@@ -362,13 +362,13 @@ gmac_rint(struct gmac_softc *sc)
 		len -= 4;	/* CRC */
 
 		if (le32toh(dp->cmd_hi) & 0x4000) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto next;
 		}
 
 		m = gmac_get(sc, sc->sc_rxbuf[i], len);
 		if (m == NULL) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto next;
 		}
 
@@ -458,7 +458,7 @@ gmac_start(struct ifnet *ifp)
 
 		/* 5 seconds to watch for failing to transmit */
 		ifp->if_timer = 5;
-		ifp->if_opackets++;		/* # of pkts */
+		if_statinc(ifp, if_opackets);		/* # of pkts */
 
 		i = sc->sc_txnext;
 		buff = sc->sc_txbuf[i];
@@ -823,7 +823,7 @@ gmac_watchdog(struct ifnet *ifp)
 	struct gmac_softc *sc = ifp->if_softc;
 
 	printf("%s: device timeout\n", ifp->if_xname);
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	gmac_reset(sc);
 	gmac_init(sc);



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

2020-01-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jan 27 20:54:59 UTC 2020

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

Log Message:
add & enable uatp driver, now that it works on ppc-era hardware
leave pbms in but commented out for now


To generate a diff of this commit:
cvs rdiff -u -r1.363 -r1.364 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.363 src/sys/arch/macppc/conf/GENERIC:1.364
--- src/sys/arch/macppc/conf/GENERIC:1.363	Sat Jan 25 18:38:36 2020
+++ src/sys/arch/macppc/conf/GENERIC	Mon Jan 27 20:54:59 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.363 2020/01/25 18:38:36 thorpej Exp $
+# $NetBSD: GENERIC,v 1.364 2020/01/27 20:54:59 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.363 $"
+#ident 		"GENERIC-$Revision: 1.364 $"
 
 maxusers	32
 
@@ -445,7 +445,8 @@ usb*	at slhci?	# USB bus support
 
 include "dev/usb/usbdevices.config"
 
-pbms*	at uhidev? reportid ?# PowerBook 15" mouse
+uatp*	at uhidev? reportid ?	# Apple multi-touchpads found in late *Books
+#pbms*	at uhidev? reportid ?	# older driver for touchpads
 
 # Bluetooth Controller and Device support
 



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

2020-01-23 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Jan 23 17:23:03 UTC 2020

Modified Files:
src/sys/arch/macppc/stand/bootxx: bootxx.c

Log Message:
Avoid warning about dcbf, icbi first argument.

as(1) is not quite happy when RA=0 argument to these instructions is
spelled as %r0 and emits a warning.  Spell that argument as 0 to
placate it.  Same object code is generated.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/macppc/stand/bootxx/bootxx.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/stand/bootxx/bootxx.c
diff -u src/sys/arch/macppc/stand/bootxx/bootxx.c:1.20 src/sys/arch/macppc/stand/bootxx/bootxx.c:1.21
--- src/sys/arch/macppc/stand/bootxx/bootxx.c:1.20	Mon Oct 28 18:13:40 2019
+++ src/sys/arch/macppc/stand/bootxx/bootxx.c	Thu Jan 23 17:23:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootxx.c,v 1.20 2019/10/28 18:13:40 joerg Exp $	*/
+/*	$NetBSD: bootxx.c,v 1.21 2020/01/23 17:23:03 uwe Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -70,8 +70,8 @@ __asm(
 "	li	%r9,0x40	\n"	/* loop 64 times (for 2048 bytes of bootxx) */
 "	mtctr	%r9		\n"
 "\n"
-"1:	dcbf	%r0,%r8		\n"
-"	icbi	%r0,%r8		\n"
+"1:	dcbf	0,%r8		\n"
+"	icbi	0,%r8		\n"
 "	addi	%r8,%r8,0x20	\n"
 "	bdnz	1b		\n"
 "	sync			\n"



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

2020-01-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 22 22:29:29 UTC 2020

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

Log Message:
enable CPU speed / voltage control via GPIOs and/or DFS
should work on most *Book G4
( notable exception - TiBooks. They use a completely different mechanism )


To generate a diff of this commit:
cvs rdiff -u -r1.361 -r1.362 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.361 src/sys/arch/macppc/conf/GENERIC:1.362
--- src/sys/arch/macppc/conf/GENERIC:1.361	Mon Jan 20 18:38:20 2020
+++ src/sys/arch/macppc/conf/GENERIC	Wed Jan 22 22:29:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.361 2020/01/20 18:38:20 thorpej Exp $
+# $NetBSD: GENERIC,v 1.362 2020/01/22 22:29:28 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.361 $"
+#ident 		"GENERIC-$Revision: 1.362 $"
 
 maxusers	32
 
@@ -329,6 +329,9 @@ mc*	at obio?			# MACE ethernet
 esp*	at obio? flags 0x00ff		# 53c9x SCSI
 mesh*	at obio? flags 0x		# MESH SCSI
 nvram*	at obio?			# nvram
+options OBIO_SPEED_CONTROL		# CPU speed / voltage control via GPIOs
+	# and/or DFS, found on most *Book G4
+
 
 # the traditional ADB subsystem
 



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

2020-01-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jan 10 06:26:34 UTC 2020

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

Log Message:
add lmu driver


To generate a diff of this commit:
cvs rdiff -u -r1.359 -r1.360 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.359 src/sys/arch/macppc/conf/GENERIC:1.360
--- src/sys/arch/macppc/conf/GENERIC:1.359	Wed Jan  8 14:21:12 2020
+++ src/sys/arch/macppc/conf/GENERIC	Fri Jan 10 06:26:34 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.359 2020/01/08 14:21:12 macallan Exp $
+# $NetBSD: GENERIC,v 1.360 2020/01/10 06:26:34 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.359 $"
+#ident 		"GENERIC-$Revision: 1.360 $"
 
 maxusers	32
 
@@ -375,6 +375,7 @@ lmtemp* 	at iic?		# temperature sensor, 
 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
+lmu* 		at iic?		# ambient / keyboard lights
 videopll*	at iic?		# for valkyriefb
 sgsmix* 	at iic?		# Additional mixer found in beige G3
 # use with awacs.



CVS commit: src/sys/arch/macppc

2020-01-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jan 10 06:24:17 UTC 2020

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

Log Message:
add driver for the ambient light sensor / keyboard light controller found in
PowerBook5,6 and probably others


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/macppc/conf/files.macppc
cvs rdiff -u -r0 -r1.1 src/sys/arch/macppc/dev/lmu.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.113 src/sys/arch/macppc/conf/files.macppc:1.114
--- src/sys/arch/macppc/conf/files.macppc:1.113	Thu Jan  9 18:49:06 2020
+++ src/sys/arch/macppc/conf/files.macppc	Fri Jan 10 06:24:17 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.macppc,v 1.113 2020/01/09 18:49:06 macallan Exp $
+#	$NetBSD: files.macppc,v 1.114 2020/01/10 06:24:17 macallan Exp $
 #
 # macppc-specific configuration info
 
@@ -319,3 +319,7 @@ device	psoc: sysmon_envsys
 attach	psoc at iic
 file	arch/macppc/dev/psoc.cpsoc
 
+# 'lmu-micro' found in late PowerBooks
+device	lmu: sysmon_envsys
+attach	lmu at iic
+file	arch/macppc/dev/lmu.clmu

Added files:

Index: src/sys/arch/macppc/dev/lmu.c
diff -u /dev/null src/sys/arch/macppc/dev/lmu.c:1.1
--- /dev/null	Fri Jan 10 06:24:17 2020
+++ src/sys/arch/macppc/dev/lmu.c	Fri Jan 10 06:24:17 2020
@@ -0,0 +1,199 @@
+ /* $NetBSD: lmu.c,v 1.1 2020/01/10 06:24:17 macallan Exp $ */
+
+/*-
+ * Copyright (c) 2020 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.
+ */
+
+/*
+ * ambient light controller found in PowerBook5,6
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.1 2020/01/10 06:24:17 macallan Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+
+struct lmu_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[2];
+	callout_t	sc_adjust;
+	int sc_thresh, sc_hyst;
+};
+
+static int	lmu_match(device_t, cfdata_t, void *);
+static void	lmu_attach(device_t, device_t, void *);
+
+static void	lmu_sensors_refresh(struct sysmon_envsys *, envsys_data_t *);
+static void	lmu_set_brightness(struct lmu_softc *, int);
+static int	lmu_get_brightness(struct lmu_softc *, int);
+static void	lmu_adjust(void *);
+
+CFATTACH_DECL_NEW(lmu, sizeof(struct lmu_softc),
+lmu_match, lmu_attach, NULL, NULL);
+
+static const struct device_compatible_entry compat_data[] = {
+	{ "lmu-micro",		0 },
+	{ "lmu-controller",	0 },
+	{ NULL,			0 }
+};
+
+static int
+lmu_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, &match_result))
+		return match_result;
+
+	return 0;
+}
+
+static void
+lmu_attach(device_t parent, device_t self, void *aux)
+{
+	struct lmu_softc *sc = device_private(self);
+	struct i2c_attach_args *ia = aux;
+	envsys_data_t *s;
+
+	sc->sc_dev = self;
+	sc->sc_i2c = ia->ia_tag;
+	sc->sc_addr = ia->ia_addr;
+	sc->sc_node = ia->ia_cookie;
+
+	aprint_naive("\n");
+	aprint_normal(": ambient light sensor\n");
+
+	sc->sc_sme = sysmon_envsys_create();
+	sc->sc_sme->sme_name = device_xname(self);
+	sc->sc_sme->sme_cookie = sc;
+	sc->sc_sme->sme_refresh = lmu_sensors_refresh;
+
+	s = &sc->sc_sensors[0];
+	s->state = ENVSYS_SINVALID;
+	s->units = ENVSYS_LUX;
+	strcpy(s->desc, "right");
+	s->private = 0;
+	sysmon_envsys_sensor_attach(sc->sc_sme, s);
+
+	s = &

CVS commit: src/sys/arch/macppc

2020-01-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jan  9 18:49:06 UTC 2020

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

Log Message:
defflag KI2C_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/macppc/conf/files.macppc
cvs rdiff -u -r1.28 -r1.29 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/conf/files.macppc
diff -u src/sys/arch/macppc/conf/files.macppc:1.112 src/sys/arch/macppc/conf/files.macppc:1.113
--- src/sys/arch/macppc/conf/files.macppc:1.112	Fri Nov  1 17:51:56 2019
+++ src/sys/arch/macppc/conf/files.macppc	Thu Jan  9 18:49:06 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.macppc,v 1.112 2019/11/01 17:51:56 macallan Exp $
+#	$NetBSD: files.macppc,v 1.113 2020/01/09 18:49:06 macallan Exp $
 #
 # macppc-specific configuration info
 
@@ -287,6 +287,7 @@ file arch/macppc/macppc/rbus_machdep.c		
 device ki2c: i2cbus, ki2c
 attach ki2c at obio, uni_n
 file arch/macppc/dev/ki2c.c			ki2c
+defflag opt_ki2c.h	KI2C_DEBUG
 
 # snapper audio
 device snapper: audiobus

Index: src/sys/arch/macppc/dev/ki2c.c
diff -u src/sys/arch/macppc/dev/ki2c.c:1.28 src/sys/arch/macppc/dev/ki2c.c:1.29
--- src/sys/arch/macppc/dev/ki2c.c:1.28	Thu Jan  9 18:47:46 2020
+++ src/sys/arch/macppc/dev/ki2c.c	Thu Jan  9 18:49:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ki2c.c,v 1.28 2020/01/09 18:47:46 macallan Exp $	*/
+/*	$NetBSD: ki2c.c,v 1.29 2020/01/09 18:49:06 macallan Exp $	*/
 /*	Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp	*/
 
 /*-
@@ -35,6 +35,7 @@
 #include 
 #include 
 
+#include "opt_ki2c.h"
 #include 
 
 #ifdef KI2C_DEBUG



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

2020-01-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jan  9 18:47:46 UTC 2020

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

Log Message:
if we have more than one i2c-bus node, look for children on both
now we find the light sensor in my shiny new toy


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 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.27 src/sys/arch/macppc/dev/ki2c.c:1.28
--- src/sys/arch/macppc/dev/ki2c.c:1.27	Sun Dec 22 23:23:30 2019
+++ src/sys/arch/macppc/dev/ki2c.c	Thu Jan  9 18:47:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ki2c.c,v 1.27 2019/12/22 23:23:30 thorpej Exp $	*/
+/*	$NetBSD: ki2c.c,v 1.28 2020/01/09 18:47:46 macallan Exp $	*/
 /*	Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp	*/
 
 /*-
@@ -83,7 +83,7 @@ ki2c_attach(device_t parent, device_t se
 	struct confargs *ca = aux;
 	int node = ca->ca_node;
 	uint32_t addr, channel, reg;
-	int rate, child, /*namelen,*/ i2cbus;
+	int rate, child, /*namelen,*/ i2cbus[2] = {0, 0};
 	struct i2cbus_attach_args iba;
 	prop_dictionary_t dict = device_properties(self);
 	prop_array_t cfg;
@@ -138,59 +138,63 @@ ki2c_attach(device_t parent, device_t se
 	 * XXX
 	 * should probably check for multiple i2c-bus children
 	 */
-	i2cbus = 0;
+
+	int found_busnode = 0;
 	channel = 0;
 	child = OF_child(node);
-	while ((child != 0) && (i2cbus == 0)) {
+	while (child != 0) {
 		OF_getprop(child, "name", name, sizeof(name));
 		if (strcmp(name, "i2c-bus") == 0) {
 			OF_getprop(child, "reg", &channel, sizeof(channel));
-			i2cbus = child;
+			i2cbus[channel] = child;
 			DPRINTF("found channel %x\n", channel);
+			found_busnode = 1;
 		}
 		child = OF_peer(child);
 	}
-	if (i2cbus == 0) 
-		i2cbus = node;
+	if (found_busnode == 0) 
+		i2cbus[0] = node;
 
-	devs = OF_child(i2cbus);
-	while (devs != 0) {
-		if (OF_getprop(devs, "name", name, 32) <= 0)
-			goto skip;
-		if (OF_getprop(devs, "compatible", compat, 256) <= 0) {
-			/* some i2c device nodes don't have 'compatible' */
-			memset(compat, 0, 256);
-			strncpy(compat, name, 256);
-		} 
-		if (OF_getprop(devs, "reg", &addr, 4) <= 0)
-			if (OF_getprop(devs, "i2c-address", &addr, 4) <= 0)
+	for (channel = 0; channel < 2; channel++) {
+		devs = OF_child(i2cbus[channel]);
+		while (devs != 0) {
+			if (OF_getprop(devs, "name", name, 32) <= 0)
 goto skip;
-		addr |= channel << 8;
-		addr = addr >> 1;
-		DPRINTF("-> %s@%x\n", name, addr);
-		dev = prop_dictionary_create();
-		prop_dictionary_set_cstring(dev, "name", name);
-		data = prop_data_create_data(compat, strlen(compat)+1);
-		prop_dictionary_set(dev, "compatible", data);
-		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);
+			if (OF_getprop(devs, "compatible", compat, 256) <= 0) {
+/* some i2c device nodes don't have 'compatible' */
+memset(compat, 0, 256);
+strncpy(compat, name, 256);
+			} 
+			if (OF_getprop(devs, "reg", &addr, 4) <= 0)
+if (OF_getprop(devs, "i2c-address", &addr, 4) <= 0)
+	goto skip;
+			addr |= channel << 8;
+			addr = addr >> 1;
+			DPRINTF("-> %s@%x\n", name, addr);
+			dev = prop_dictionary_create();
+			prop_dictionary_set_cstring(dev, "name", name);
+			data = prop_data_create_data(compat, strlen(compat)+1);
+			prop_dictionary_set(dev, "compatible", data);
+			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:
+			devs = OF_peer(devs);
 		}
-		prop_array_add(cfg, dev);
-		prop_object_release(dev);
-	skip:
-		devs = OF_peer(devs);
 	}
 
 	/* fill in the i2c tag */
@@ -405,6 +409,7 @@ ki2c_i2c_exec(void *cookie, i2c_op_t op,
 
 	/* we handle the subaddress stuff ourselves */
 	ki2c_setmode(sc, channel | I2C_STDMODE);	
+	ki2c_setspeed(sc, I2C_50kHz);
 
 	/* Write-buffer defaults to vcmd */
 	wp = (uint8_t *)(__UNCONST(vcmd));



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

2020-01-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan  8 14:21:12 UTC 2020

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

Log Message:
add lmtemp, found in some late powerbooks


To generate a diff of this commit:
cvs rdiff -u -r1.358 -r1.359 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.358 src/sys/arch/macppc/conf/GENERIC:1.359
--- src/sys/arch/macppc/conf/GENERIC:1.358	Fri Nov  1 17:55:12 2019
+++ src/sys/arch/macppc/conf/GENERIC	Wed Jan  8 14:21:12 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.358 2019/11/01 17:55:12 macallan Exp $
+# $NetBSD: GENERIC,v 1.359 2020/01/08 14:21: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.358 $"
+#ident 		"GENERIC-$Revision: 1.359 $"
 
 maxusers	32
 
@@ -371,6 +371,7 @@ iic*	at ki2c?
 
 # I2C devices
 dbcool* 	at iic?		# dbCool thermal monitor & fan control
+lmtemp* 	at iic?		# temperature sensor, found in PowerBook5,6
 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



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

2020-01-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan  8 13:28:14 UTC 2020

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

Log Message:
add makphy, found in late(ish) PowerBooks


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/arch/macppc/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/macppc/conf/INSTALL
diff -u src/sys/arch/macppc/conf/INSTALL:1.129 src/sys/arch/macppc/conf/INSTALL:1.130
--- src/sys/arch/macppc/conf/INSTALL:1.129	Mon Jan  7 01:44:59 2019
+++ src/sys/arch/macppc/conf/INSTALL	Wed Jan  8 13:28:14 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL,v 1.129 2019/01/07 01:44:59 scole Exp $
+#	$NetBSD: INSTALL,v 1.130 2020/01/08 13:28:14 macallan Exp $
 #
 # config file for INSTALL FLOPPY
 #
@@ -123,6 +123,7 @@ icsphy*	at mii? phy ?			# Integrated Cir
 inphy*	at mii? phy ?			# Intel 82555 PHYs
 iophy*	at mii? phy ?			# Intel 82553 PHYs
 lxtphy*	at mii? phy ?			# Level One LXT-970 PHYs
+makphy* at mii? phy ?			# Marvell Semiconductor 88E1000 PHYs
 nsphy*	at mii? phy ?			# NS83840 PHYs
 nsphyter* at mii? phy ?			# NS83843 PHYs
 qsphy*	at mii? phy ?			# Quality Semiconductor QS6612 PHYs



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

2019-12-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Dec 13 23:01:41 UTC 2019

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

Log Message:
call cpu_topology_set() with adjustments for 970MP CPUs


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/macppc/macppc/cpu.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/cpu.c
diff -u src/sys/arch/macppc/macppc/cpu.c:1.67 src/sys/arch/macppc/macppc/cpu.c:1.68
--- src/sys/arch/macppc/macppc/cpu.c:1.67	Thu May 17 19:08:51 2018
+++ src/sys/arch/macppc/macppc/cpu.c	Fri Dec 13 23:01:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.67 2018/05/17 19:08:51 macallan Exp $	*/
+/*	$NetBSD: cpu.c,v 1.68 2019/12/13 23:01:41 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Tsubai Masanari.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.67 2018/05/17 19:08:51 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.68 2019/12/13 23:01:41 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_multiprocessor.h"
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.67
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -159,12 +160,23 @@ cpuattach(device_t parent, device_t self
 {
 	struct cpu_info *ci;
 	struct confargs *ca = aux;
-	int id = ca->ca_reg[0];
+	int id = ca->ca_reg[0], vers, package, core;
 
 	ci = cpu_attach_common(self, id);
 	if (ci == NULL)
 		return;
 
+	package = id;
+	core = 0;
+
+	vers = (mfpvr() >> 16) & 0x;
+	
+	if (vers == IBM970MP) {
+		core = package & 1;
+		package >>= 1;
+	}
+	cpu_topology_set(ci, package, core, 0);
+
 	if (ci->ci_khz == 0) {
 		cpu_OFgetspeed(self, ci);
 	}



CVS commit: src/sys/arch/macppc

2019-12-11 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Wed Dec 11 21:04:47 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: GENERIC_601 INSTALL_601
src/sys/arch/macppc/dev: platinumfb.c

Log Message:
Synchronize htdocs, manual, comments, and code so that enabling the platinumfb 
is done using "platinum" in openfirmware settings.  Remove "screen" option 
which was somewhat disingenuous.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/macppc/conf/GENERIC_601
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/macppc/conf/INSTALL_601
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/macppc/dev/platinumfb.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/GENERIC_601
diff -u src/sys/arch/macppc/conf/GENERIC_601:1.24 src/sys/arch/macppc/conf/GENERIC_601:1.25
--- src/sys/arch/macppc/conf/GENERIC_601:1.24	Fri Apr 26 22:46:03 2019
+++ src/sys/arch/macppc/conf/GENERIC_601	Wed Dec 11 21:04:47 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC_601,v 1.24 2019/04/26 22:46:03 sevan Exp $
+# $NetBSD: GENERIC_601,v 1.25 2019/12/11 21:04:47 scole Exp $
 #
 # GENERIC machine description file
 # 
@@ -28,7 +28,7 @@ include 	"arch/macppc/conf/std.macppc.60
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident 		"GENERIC-$Revision: 1.24 $"
+ident 		"GENERIC-$Revision: 1.25 $"
 
 maxusers	32
 
@@ -217,8 +217,8 @@ ahc*	at pci? dev ? function ?	# Adaptec 
 # official Macintosh firmware from 3Dfx. The others should work but are
 # untested with OF 1.0.5
 
-# this will take over the console if output-device is set to 'screen' or
-# 'platinum'. It will provide a NetBSD console, but still won't work with OF
+# this will take over the console if output-device is set to 'platinum'.
+# It will provide a NetBSD console, but still won't work with OF
 platinumfb0 	at mainbus?
 
 #gffb*		at pci?	function ?	# NVIDIA GeForce2 MX

Index: src/sys/arch/macppc/conf/INSTALL_601
diff -u src/sys/arch/macppc/conf/INSTALL_601:1.3 src/sys/arch/macppc/conf/INSTALL_601:1.4
--- src/sys/arch/macppc/conf/INSTALL_601:1.3	Sun Dec  8 21:30:00 2019
+++ src/sys/arch/macppc/conf/INSTALL_601	Wed Dec 11 21:04:47 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL_601,v 1.3 2019/12/08 21:30:00 scole Exp $
+#	$NetBSD: INSTALL_601,v 1.4 2019/12/11 21:04:47 scole Exp $
 #
 # config file for INSTALL
 #
@@ -82,8 +82,8 @@ ahc*	at pci? dev ? function ?	# Adaptec 
 # The only cards known to work ( so far ) are PCI Voodoo3s flashed with the
 # official Macintosh firmware from 3Dfx. The others should work but are
 # untested with OF 1.0.5
-# this will take over the console if output-device is set to 'screen' or
-# 'platinum'. It will provide a NetBSD console, but still won't work with OF
+# this will take over the console if output-device is set to 'platinum'.
+# It will provide a NetBSD console, but still won't work with OF
 platinumfb0 	at mainbus?
 
 #gffb*		at pci?	function ?	# NVIDIA GeForce2 MX

Index: src/sys/arch/macppc/dev/platinumfb.c
diff -u src/sys/arch/macppc/dev/platinumfb.c:1.3 src/sys/arch/macppc/dev/platinumfb.c:1.4
--- src/sys/arch/macppc/dev/platinumfb.c:1.3	Fri Sep 16 17:32:36 2016
+++ src/sys/arch/macppc/dev/platinumfb.c	Wed Dec 11 21:04:47 2019
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: platinumfb.c,v 1.3 2016/09/16 17:32:36 scole Exp $");
+__KERNEL_RCSID(0, "$NetBSD: platinumfb.c,v 1.4 2019/12/11 21:04:47 scole Exp $");
 
 #include 
 #include 
@@ -569,8 +569,8 @@ platinumfb_init(device_t self)
 	int i;
 
 	/*
-	 * become console if OF variable "output-device" is "screen" or
-	 * contains "platinum", since normal OF video variables are unavailable
+	 * become console if OF variable "output-device" contains "platinum",
+	 * since normal OF video variables are unavailable
 	 */
 	int options;
 	char output_device[128];
@@ -582,8 +582,7 @@ platinumfb_init(device_t self)
 		aprint_error_dev(sc->sc_dev,
 		"could not get output-device prop, assuming not console\n");
 	} else {
-		if (strstr(output_device,"platinum") ||
-		strcmp(output_device,"screen") == 0 ) {
+		if (strstr(output_device,"platinum")) {
 			is_console = TRUE;
 		}
 	}	



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

2019-12-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sun Dec  8 21:30:00 UTC 2019

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

Log Message:
add platinumfb


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

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/INSTALL_601
diff -u src/sys/arch/macppc/conf/INSTALL_601:1.2 src/sys/arch/macppc/conf/INSTALL_601:1.3
--- src/sys/arch/macppc/conf/INSTALL_601:1.2	Mon Jan  7 01:44:59 2019
+++ src/sys/arch/macppc/conf/INSTALL_601	Sun Dec  8 21:30:00 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL_601,v 1.2 2019/01/07 01:44:59 scole Exp $
+#	$NetBSD: INSTALL_601,v 1.3 2019/12/08 21:30:00 scole Exp $
 #
 # config file for INSTALL
 #
@@ -84,7 +84,7 @@ ahc*	at pci? dev ? function ?	# Adaptec 
 # untested with OF 1.0.5
 # this will take over the console if output-device is set to 'screen' or
 # 'platinum'. It will provide a NetBSD console, but still won't work with OF
-#platinumfb0 	at mainbus?
+platinumfb0 	at mainbus?
 
 #gffb*		at pci?	function ?	# NVIDIA GeForce2 MX
 #machfb*		at pci? function ?	# ATI Mach 64, Rage, Rage Pro



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

2019-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Dec  5 06:28:20 UTC 2019

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

Log Message:
 Revert if_mc.c rev. 1.25. It's not required to check ifm->ifm_cur->ifm_media
instead of ifm->ifm_media.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/macppc/dev/if_mc.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/if_mc.c
diff -u src/sys/arch/macppc/dev/if_mc.c:1.25 src/sys/arch/macppc/dev/if_mc.c:1.26
--- src/sys/arch/macppc/dev/if_mc.c:1.25	Wed Dec  4 07:03:46 2019
+++ src/sys/arch/macppc/dev/if_mc.c	Thu Dec  5 06:28:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mc.c,v 1.25 2019/12/04 07:03:46 msaitoh Exp $	*/
+/*	$NetBSD: if_mc.c,v 1.26 2019/12/05 06:28:20 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1997 David Huang 
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.25 2019/12/04 07:03:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.26 2019/12/05 06:28:20 msaitoh Exp $");
 
 #include 
 #include 
@@ -362,12 +362,12 @@ mc_select_aui(struct mc_softc *sc)
 int
 mc_mediachange(struct mc_softc *sc)
 {
-	struct ifmedia_entry *ife = sc->sc_media.ifm_cur;
+	struct ifmedia *ifm = &sc->sc_media;
 
-	if (IFM_TYPE(ife->ifm_media) != IFM_ETHER)
+	if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
 		return EINVAL;
 
-	switch (IFM_SUBTYPE(ife->ifm_media)) {
+	switch (IFM_SUBTYPE(ifm->ifm_media)) {
 
 	case IFM_10_T:
 		mc_select_utp(sc);



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

2019-12-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Dec  4 07:03:46 UTC 2019

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

Log Message:
Fix macppc/dev/if_mc.c::mc_mediachange(). Not tested.

 ifmedia_change() is used to change the device's media setting from
user-selected media. The user-selected media is not sc->sc_media.ifm_media but
sc->sc_media.ifm_cur->ifm_media. Note that mc_mediachange() is not called from
anywhere because it's disabled with #ifdef NOTYET.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/macppc/dev/if_mc.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/if_mc.c
diff -u src/sys/arch/macppc/dev/if_mc.c:1.24 src/sys/arch/macppc/dev/if_mc.c:1.25
--- src/sys/arch/macppc/dev/if_mc.c:1.24	Thu Apr 25 10:08:45 2019
+++ src/sys/arch/macppc/dev/if_mc.c	Wed Dec  4 07:03:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mc.c,v 1.24 2019/04/25 10:08:45 msaitoh Exp $	*/
+/*	$NetBSD: if_mc.c,v 1.25 2019/12/04 07:03:46 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1997 David Huang 
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.24 2019/04/25 10:08:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.25 2019/12/04 07:03:46 msaitoh Exp $");
 
 #include 
 #include 
@@ -362,12 +362,12 @@ mc_select_aui(struct mc_softc *sc)
 int
 mc_mediachange(struct mc_softc *sc)
 {
-	struct ifmedia *ifm = &sc->sc_media;
+	struct ifmedia_entry *ife = sc->sc_media.ifm_cur;
 
-	if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
+	if (IFM_TYPE(ife->ifm_media) != IFM_ETHER)
 		return EINVAL;
 
-	switch (IFM_SUBTYPE(ifm->ifm_media)) {
+	switch (IFM_SUBTYPE(ife->ifm_media)) {
 
 	case IFM_10_T:
 		mc_select_utp(sc);



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

2019-04-26 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Apr 27 02:00:12 UTC 2019

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

Log Message:
Use usbdevices.config & bluetooth.config to reduce duplication.


To generate a diff of this commit:
cvs rdiff -u -r1.355 -r1.356 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.355 src/sys/arch/macppc/conf/GENERIC:1.356
--- src/sys/arch/macppc/conf/GENERIC:1.355	Sat Apr 27 00:56:19 2019
+++ src/sys/arch/macppc/conf/GENERIC	Sat Apr 27 02:00:12 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.355 2019/04/27 00:56:19 sevan Exp $
+# $NetBSD: GENERIC,v 1.356 2019/04/27 02:00:12 sevan 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.355 $"
+#ident 		"GENERIC-$Revision: 1.356 $"
 
 maxusers	32
 
@@ -437,93 +437,11 @@ slhci*	at pcmcia? function ?	# ScanLogic
 usb*	at ehci?	# USB bus support
 usb*	at ohci?	# USB bus support
 usb*	at slhci?	# USB bus support
-uhub*	at usb?		# USB Hubs
-uhub*	at uhub? port ?
 
-uhidev*	at uhub? port ? configuration ? interface ?	# USB HID device
+include "dev/usb/usbdevices.config"
 
 pbms*	at uhidev? reportid ?# PowerBook 15" mouse
 
-ums*	at uhidev? reportid ?# USB Mice
-
-ukbd*	at uhidev? reportid ?# USB Keyboards
-
-uthum*	at uhidev? reportid ?# TEMPerHUM sensors
-
-ucycom*	at uhidev? reportid ?# USB serial adapter
-
-uhid*	at uhidev? reportid ?# USB Generic HID
-
-ulpt*	at uhub? port ? configuration ? interface ?	# USB Printer
-
-umodem*	at uhub? port ? configuration ?			# USB Modem
-ucom*	at umodem?
-
-ubsa*	at uhub? port ?	# Belkin serial adapter
-ucom*	at ubsa? portno ?
-
-uplcom* at uhub? port ?	# Prolific serial
-ucom* at uplcom? portno ?
-
-uftdi* at uhub? port ?	# FTDI FT8U100AX serial adapter
-ucom* at uftdi? portno ?
-
-uhso*	at uhub? port ? configuration ?			# Option N.V. Wireless WAN modems
-
-umass*	at uhub? port ? configuration ? interface ?	# USB Mass Storage
-
-uaudio*	at uhub? port ? configuration ?			# USB audio
-
-# D-Link DSB-R100 USB FM radio tuner
-udsbr* at uhub? port ?
-radio* at udsbr?
-
-# USB Ethernet adapters
-aue*	at uhub? port ?		# ADMtek AN986 Pegasus based adapters
-axe*	at uhub? port ?		# ASIX AX88172 based adapters
-axen*	at uhub? port ?		# ASIX AX88178a/AX88179 based adapters
-cdce*	at uhub? port ?		# CDC, Ethernet Networking Control Model
-cue*	at uhub? port ?		# CATC USB-EL1201A based adapters
-kue*	at uhub? port ?		# Kawasaki LSI KL5KUSB101B based adapters
-mue*	at uhub? port ?		# Microchip LAN75xx/LAN78xx based adapters
-udav*	at uhub? port ?		# Davicom DM9601 based adapters
-ure*	at uhub? port ?		# Realtek RTL8152/RTL8153 based adapters
-url*	at uhub? port ?		# Realtek RTL8150L based adapters
-
-ukyopon* at uhub? port ?# Kyocera AIR-EDGE PHONE
-ucom*	at ukyopon? portno ?
-
-#uscanner* at uhub? port ?# USB scanners
-uyap* at uhub? port ?	# Y@P firmware loader
-ugen*	at uhub? port ? configuration ? interface ?	# USB Generic driver
-
-# USB 802.11 adapters
-atu*	at uhub? port ?		# Atmel AT76C50XX based adapters
-otus*	at uhub? port ?		# Atheros AR9001U
-ural*	at uhub? port ?		# Ralink Technology RT2500USB 802.11a/b/g
-rum*	at uhub? port ?		# Ralink Technology RT2501/RT2601 802.11a/b/g
-run*	at uhub? port ?		# Ralink Technology RT(2[78]|30)00 802.11a/b/g/n
-upgt*	at uhub? port ?		# Intersil PrismGT
-urtw*	at uhub? port ?		# Realtek RTL8187/RTL8187B 802.11b/g
-urtwn*	at uhub? port ?		# Realtek RTL8188CU/RTL8192CU 802.11b/g/n
-#zyd*	at uhub? port ?		# Zydas ZD1211
-
-# Serial adapters
-uchcom* at uhub? port ? # WinChipHead CH341/CH340 serial adapter
-ucom*   at uchcom? portno ?
-
-uslsa*  at uhub? port ? # Silicon Labs USB-RS232 serial adapter
-ucom*   at uslsa? portno ?
-
-# USB 3G datacards
-umodeswitch* at uhub? port ?
-u3g*at uhub? port ?
-ucom*   at u3g?
-
-# USB generic serial port (e.g., data over cellular)
-ugensa* at uhub? port ?
-ucom*   at ugensa?
-
 # Bluetooth Controller and Device support
 
 # Bluetooth PCMCIA Controllers
@@ -541,23 +459,7 @@ bthub* at btbc?
 bthub* at btuart?
 bthub* at ubt?
 
-# Bluetooth HID support
-bthidev* at bthub?
-
-# Bluetooth Mouse
-btms* at bthidev? reportid ?
-wsmouse* at btms? mux 0
-
-# Bluetooth Keyboard
-btkbd* at bthidev? reportid ?
-wskbd* at btkbd? console ? mux 1
-
-# Bluetooth Apple Magic Mouse
-btmagic* at bthub?
-wsmouse* at btmagic? mux 0
-
-# Bluetooth Audio support
-btsco* at bthub?
+include "dev/bluetooth/bluetoothdevices.config"
 
 # PCI IEEE1394 controllers
 fwohci*	at pci? dev ? function ?	# IEEE1394 Open Host Controller
@@ -647,8 +549,6 @@ pseudo-device 	wsfont
 pseudo-device	swwdog			# software w

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

2019-04-26 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Apr 27 00:56:19 UTC 2019

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

Log Message:
Use filesystems.config to reduce duplication


To generate a diff of this commit:
cvs rdiff -u -r1.354 -r1.355 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.354 src/sys/arch/macppc/conf/GENERIC:1.355
--- src/sys/arch/macppc/conf/GENERIC:1.354	Fri Apr 26 21:40:31 2019
+++ src/sys/arch/macppc/conf/GENERIC	Sat Apr 27 00:56:19 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.354 2019/04/26 21:40:31 sevan Exp $
+# $NetBSD: GENERIC,v 1.355 2019/04/27 00:56:19 sevan 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.354 $"
+#ident 		"GENERIC-$Revision: 1.355 $"
 
 maxusers	32
 
@@ -79,26 +79,7 @@ options DKWEDGE_METHOD_GPT  
 #options 	DKWEDGE_METHOD_RDB	# Support RDB partitions as wedges
 
 # File systems
-file-system 	FFS		# UFS
-file-system 	EXT2FS		# second extended file system (linux)
-file-system 	LFS		# log-structured file system
-file-system 	MFS		# memory file system
-file-system 	NFS		# Network File System client
-file-system 	CD9660		# ISO 9660 + Rock Ridge file system
-file-system 	MSDOSFS		# MS-DOS file system
-file-system 	FDESC		# /dev/fd
-file-system 	KERNFS		# /kern
-file-system 	NULLFS		# loopback file system
-file-system 	OVERLAY		# overlay file system
-file-system	PUFFS		# Userspace file systems (e.g. ntfs-3g & sshfs)
-file-system 	PROCFS		# /proc
-file-system 	UMAPFS		# NULLFS + uid and gid remapping
-file-system 	UNION		# union file system
-file-system	SMBFS		# CIFS; also needs nsmb (below)
-file-system	PTYFS		# /dev/pts/N support
-file-system	TMPFS		# Efficient memory file-system
-#file-system	UDF		# experimental - OSTA UDF CD/DVD file-system
-#file-system	HFS		# experimental - Apple HFS+ (read-only)
+include "conf/filesystems.config"
 
 # File system options
 options 	QUOTA		# legacy UFS quotas
@@ -666,8 +647,6 @@ pseudo-device 	wsfont
 pseudo-device	swwdog			# software watchdog driver - swwdog(4)
 pseudo-device	clockctl		# user control of clock subsystem
 pseudo-device	ksyms			# /dev/ksyms
-pseudo-device	nsmb			# SMB requester
-pseudo-device	putter			# for puffs and pud
 pseudo-device	bcsp			# BlueCore Serial Protocol
 pseudo-device	btuart			# Bluetooth HCI UART (H4)
 



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

2019-04-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 22 08:30:32 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: if_bm.c if_gm.c

Log Message:
 These drivers do ether_ioctl() on SIOC{ADD,DEL}MULTI, SIOC{G,S}IFMEDIA and
default case in the switch statement. Only the default case didn't check the
return value with ENETRESET. Integrate them to one ether_ioctl() with
ENETRESET test. This change might improve SIOCSIFMTU or some other ioctl()s
which return ENETRESET by calling if_init().


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/macppc/dev/if_bm.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/macppc/dev/if_gm.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/if_bm.c
diff -u src/sys/arch/macppc/dev/if_bm.c:1.57 src/sys/arch/macppc/dev/if_bm.c:1.58
--- src/sys/arch/macppc/dev/if_bm.c:1.57	Tue Feb  5 06:17:01 2019
+++ src/sys/arch/macppc/dev/if_bm.c	Mon Apr 22 08:30:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bm.c,v 1.57 2019/02/05 06:17:01 msaitoh Exp $	*/
+/*	$NetBSD: if_bm.c,v 1.58 2019/04/22 08:30:31 msaitoh Exp $	*/
 
 /*-
  * Copyright (C) 1998, 1999, 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.57 2019/02/05 06:17:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.58 2019/04/22 08:30:31 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -749,10 +749,7 @@ bmac_ioctl(struct ifnet *ifp, unsigned l
 #endif
 		break;
 
-	case SIOCADDMULTI:
-	case SIOCDELMULTI:
-	case SIOCGIFMEDIA:
-	case SIOCSIFMEDIA:
+	default:
 		if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
 			/*
 			 * Multicast list has changed; set the hardware filter
@@ -765,9 +762,6 @@ bmac_ioctl(struct ifnet *ifp, unsigned l
 			error = 0;
 		}
 		break;
-	default:
-		error = ether_ioctl(ifp, cmd, data);
-		break;
 	}
 
 	splx(s);

Index: src/sys/arch/macppc/dev/if_gm.c
diff -u src/sys/arch/macppc/dev/if_gm.c:1.52 src/sys/arch/macppc/dev/if_gm.c:1.53
--- src/sys/arch/macppc/dev/if_gm.c:1.52	Tue Feb  5 06:17:01 2019
+++ src/sys/arch/macppc/dev/if_gm.c	Mon Apr 22 08:30:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gm.c,v 1.52 2019/02/05 06:17:01 msaitoh Exp $	*/
+/*	$NetBSD: if_gm.c,v 1.53 2019/04/22 08:30:31 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.52 2019/02/05 06:17:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.53 2019/04/22 08:30:31 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -801,10 +801,7 @@ gmac_ioctl(struct ifnet *ifp, unsigned l
 #endif
 		break;
 
-	case SIOCADDMULTI:
-	case SIOCDELMULTI:
-	case SIOCGIFMEDIA:
-	case SIOCSIFMEDIA:
+	default:
 		if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
 			/*
 			 * Multicast list has changed; set the hardware filter
@@ -817,9 +814,6 @@ gmac_ioctl(struct ifnet *ifp, unsigned l
 			error = 0;
 		}
 		break;
-	default:
-		error = ether_ioctl(ifp, cmd, data);
-		break;
 	}
 
 	splx(s);



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

2019-04-09 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Wed Apr 10 00:49:49 UTC 2019

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

Log Message:
Include CARP support by default


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 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.352 src/sys/arch/macppc/conf/GENERIC:1.353
--- src/sys/arch/macppc/conf/GENERIC:1.352	Tue Apr  9 22:38:25 2019
+++ src/sys/arch/macppc/conf/GENERIC	Wed Apr 10 00:49:49 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.352 2019/04/09 22:38:25 sevan Exp $
+# $NetBSD: GENERIC,v 1.353 2019/04/10 00:49:49 sevan 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.352 $"
+#ident 		"GENERIC-$Revision: 1.353 $"
 
 maxusers	32
 
@@ -643,7 +643,7 @@ pseudo-device	fss			# file system snapsh
 pseudo-device	md			# memory disk device
 pseudo-device	loop			# network loopback
 pseudo-device	bpfilter		# packet filter
-#pseudo-device	carp			# Common Address Redundancy Protocol
+pseudo-device	carp			# Common Address Redundancy Protocol
 pseudo-device	npf			# NPF packet filter
 pseudo-device	ppp			# Point-to-Point Protocol
 pseudo-device	pppoe			# PPP over Ethernet (RFC 2516)



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

2019-04-09 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Tue Apr  9 22:38:25 UTC 2019

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

Log Message:
Add a commented out entry for CARP


To generate a diff of this commit:
cvs rdiff -u -r1.351 -r1.352 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.351 src/sys/arch/macppc/conf/GENERIC:1.352
--- src/sys/arch/macppc/conf/GENERIC:1.351	Wed Feb  6 11:58:31 2019
+++ src/sys/arch/macppc/conf/GENERIC	Tue Apr  9 22:38:25 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.351 2019/02/06 11:58:31 rin Exp $
+# $NetBSD: GENERIC,v 1.352 2019/04/09 22:38:25 sevan 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.351 $"
+#ident 		"GENERIC-$Revision: 1.352 $"
 
 maxusers	32
 
@@ -643,6 +643,7 @@ pseudo-device	fss			# file system snapsh
 pseudo-device	md			# memory disk device
 pseudo-device	loop			# network loopback
 pseudo-device	bpfilter		# packet filter
+#pseudo-device	carp			# Common Address Redundancy Protocol
 pseudo-device	npf			# NPF packet filter
 pseudo-device	ppp			# Point-to-Point Protocol
 pseudo-device	pppoe			# PPP over Ethernet (RFC 2516)



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

2019-01-27 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Mon Jan 28 02:45:13 UTC 2019

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

Log Message:
Add a description


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/macppc/macppc/static_edid.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/static_edid.c
diff -u src/sys/arch/macppc/macppc/static_edid.c:1.2 src/sys/arch/macppc/macppc/static_edid.c:1.3
--- src/sys/arch/macppc/macppc/static_edid.c:1.2	Mon Jan 28 02:25:01 2019
+++ src/sys/arch/macppc/macppc/static_edid.c	Mon Jan 28 02:45:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: static_edid.c,v 1.2 2019/01/28 02:25:01 sevan Exp $ */
+/*	$NetBSD: static_edid.c,v 1.3 2019/01/28 02:45:13 sevan Exp $ */
 
 /*-
  * Copyright (c) 2011 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: static_edid.c,v 1.2 2019/01/28 02:25:01 sevan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: static_edid.c,v 1.3 2019/01/28 02:45:13 sevan Exp $");
 #include 
 
 /* EDID blocks for some known hardware that doesn't provide its own */
@@ -55,6 +55,10 @@ uint8_t edid_pismo[128] = {
 /* 78 */	0x43, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x00, 0x52
 };
 
+/*
+ * iBook G3 Clamshell, obtained from the 2nd revision (firewire).
+ * Should work on the 1st revision.
+ */
 uint8_t edid_clamshell[128] = {
 /* 00 */	0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
 /* 08 */	0x06, 0x10, 0x05, 0x9c, 0x01, 0x01, 0x01, 0x01,



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

2019-01-27 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Mon Jan 28 02:25:02 UTC 2019

Modified Files:
src/sys/arch/macppc/macppc: machdep.c static_edid.c static_edid.h

Log Message:
Fake the EDID info for the clamshell iBook G3 so X11 works out of the box.
Obtained from the 2nd (firewire) revision iBook, but it's applied to 1st gen
also.

[93.906] (II) R128(0): I2C bus "VGA-0" initialized.
[93.907] (II) got 128 bytes worth of EDID from wsdisplay
[93.908] (II) R128(0): EDID for output LVDS
[93.908] (II) R128(0): Manufacturer: APP  Model: 9c05  Serial#: 16843009
[93.908] (II) R128(0): Year: 1999  Week: 9
[93.908] (II) R128(0): EDID Version: 1.1
[93.908] (II) R128(0): Digital Display Input
[93.908] (II) R128(0): Max Image Size [cm]: horiz.: 24  vert.: 18
[93.908] (II) R128(0): Gamma: 2.28
[93.908] (II) R128(0): DPMS capabilities: StandBy Suspend Off
[93.909] (II) R128(0): Supported color encodings: RGB 4:4:4 YCrCb 4:4:4
[93.909] (II) R128(0): redX: 0.594 redY: 0.345   greenX: 0.317 greenY: 0.494
[93.909] (II) R128(0): blueX: 0.155 blueY: 0.146   whiteX: 0.312 whiteY: 
0.328
[93.909] (II) R128(0): Supported established timings:
[93.909] (II) R128(0): 800x600@60Hz
[93.909] (II) R128(0): Manufacturer's mask: 0
[93.910] (II) R128(0): Supported detailed timing:
[93.910] (II) R128(0): clock: 60.0 MHz   Image Size:  275 x 199 mm
[93.910] (II) R128(0): h_active: 800  h_sync: 840  h_sync_end 968 
h_blank_end 1056 h_border: 0
[93.910] (II) R128(0): v_active: 600  v_sync: 601  v_sync_end 605 
v_blanking: 628 v_border: 0
[93.910] (II) R128(0):  LT121SU-121
[93.910] (II) R128(0):  LT121SU-121
[93.910] (II) R128(0): Monitor name: Color LCD
[93.910] (II) R128(0): EDID (in hex):
[93.910] (II) R128(0):  00000610059c01010101
[93.910] (II) R128(0):  09090101a8181280e816e09858517e27
[93.910] (II) R128(0):  2550540101010101010101010101
[93.911] (II) R128(0):  0101010101017017200031581c202880
[93.911] (II) R128(0):  140013c7101800fe004c5431
[93.911] (II) R128(0):  323153552d3132310a2000fe004c
[93.911] (II) R128(0):  5431323153552d3132310a2000fc
[93.911] (II) R128(0):  00436f6c6f72204c43440a2020200037
[93.912] (II) R128(0): I2C device "VGA-0:ddc2" registered at address 0xA0.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/arch/macppc/macppc/machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/macppc/static_edid.c \
src/sys/arch/macppc/macppc/static_edid.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/macppc/machdep.c
diff -u src/sys/arch/macppc/macppc/machdep.c:1.168 src/sys/arch/macppc/macppc/machdep.c:1.169
--- src/sys/arch/macppc/macppc/machdep.c:1.168	Sun Jul 15 05:16:43 2018
+++ src/sys/arch/macppc/macppc/machdep.c	Mon Jan 28 02:25:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.168 2018/07/15 05:16:43 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.169 2019/01/28 02:25:01 sevan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.168 2018/07/15 05:16:43 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.169 2019/01/28 02:25:01 sevan Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_ddb.h"
@@ -389,6 +389,8 @@ add_model_specifics(prop_dictionary_t di
 {
 	const char *bl_rev_models[] = {
 		"PowerBook4,3", "PowerBook6,3", "PowerBook6,5", NULL};
+	const char *clamshell[] = {
+		"PowerBook2,1", "PowerBook2,2", NULL};
 	const char *pismo[] = {
 		"PowerBook3,1", NULL};
 	const char *mini1[] = {
@@ -402,6 +404,13 @@ add_model_specifics(prop_dictionary_t di
 	if (of_compatible(node, bl_rev_models) != -1) {
 		prop_dictionary_set_bool(dict, "backlight_level_reverted", 1);
 	}
+	if (of_compatible(node, clamshell) != -1) {
+		prop_data_t edid;
+
+		edid = prop_data_create_data(edid_clamshell, sizeof(edid_clamshell));
+		prop_dictionary_set(dict, "EDID", edid);
+		prop_object_release(edid);
+	}
 	if (of_compatible(node, pismo) != -1) {
 		prop_data_t edid;
 

Index: src/sys/arch/macppc/macppc/static_edid.c
diff -u src/sys/arch/macppc/macppc/static_edid.c:1.1 src/sys/arch/macppc/macppc/static_edid.c:1.2
--- src/sys/arch/macppc/macppc/static_edid.c:1.1	Wed Jul 13 22:54:33 2011
+++ src/sys/arch/macppc/macppc/static_edid.c	Mon Jan 28 02:25:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: static_edid.c,v 1.1 2011/07/13 22:54:33 macallan Exp $ */
+/*	$NetBSD: static_edid.c,v 1.2 2019/01/28 02:25:01 sevan Exp $ */
 
 /*-
  * Copyright (c) 2011 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: static_edid.c,v 1.1 2011/07/13 22:54:33 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: static_edid.c,v 1.2 2019/01/28 02:25:01 sevan Exp $");
 #include 
 
 /* EDID blocks for some known hardware tha

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

2019-01-26 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 27 04:59:12 UTC 2019

Modified Files:
src/sys/arch/macppc/stand/bootxx: Makefile

Log Message:
fix duplicated chunk from merge


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/macppc/stand/bootxx/Makefile

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/stand/bootxx/Makefile
diff -u src/sys/arch/macppc/stand/bootxx/Makefile:1.20 src/sys/arch/macppc/stand/bootxx/Makefile:1.21
--- src/sys/arch/macppc/stand/bootxx/Makefile:1.20	Sun Jan 27 02:08:38 2019
+++ src/sys/arch/macppc/stand/bootxx/Makefile	Sun Jan 27 04:59:12 2019
@@ -1,8 +1,4 @@
-#	$NetBSD: Makefile,v 1.20 2019/01/27 02:08:38 pgoyette Exp $
-
-NOLIBCSANITIZER=
-NOSANITIZER=
-NOPIE=
+#	$NetBSD: Makefile,v 1.21 2019/01/27 04:59:12 dholland Exp $
 
 NOLIBCSANITIZER=
 NOSANITIZER=



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

2019-01-06 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Jan  7 01:44:59 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: GENERIC_601 GENERIC_MD INSTALL INSTALL_601

Log Message:
increase MEMORY_DISK_ROOT_SIZE slightly to avoid running out of space
when doing some sysinst options.

Add ahc and rtk options for my testing convenience.  The 601 kernels
are still small enough for netbooting.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/macppc/conf/GENERIC_601
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/macppc/conf/GENERIC_MD
cvs rdiff -u -r1.128 -r1.129 src/sys/arch/macppc/conf/INSTALL
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/conf/INSTALL_601

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_601
diff -u src/sys/arch/macppc/conf/GENERIC_601:1.22 src/sys/arch/macppc/conf/GENERIC_601:1.23
--- src/sys/arch/macppc/conf/GENERIC_601:1.22	Mon Nov 12 20:03:42 2018
+++ src/sys/arch/macppc/conf/GENERIC_601	Mon Jan  7 01:44:59 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC_601,v 1.22 2018/11/12 20:03:42 scole Exp $
+# $NetBSD: GENERIC_601,v 1.23 2019/01/07 01:44:59 scole Exp $
 #
 # GENERIC machine description file
 # 
@@ -28,7 +28,7 @@ include 	"arch/macppc/conf/std.macppc.60
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident 		"GENERIC-$Revision: 1.22 $"
+ident 		"GENERIC-$Revision: 1.23 $"
 
 maxusers	32
 
@@ -207,7 +207,7 @@ pchb*	at pci? dev ? function ?	# PCI-Hos
 ppb*	at pci? dev ? function ?	# PCI-PCI bridges
 
 # PCI SCSI controllers
-#ahc*	at pci? dev ? function ?	# Adaptec 294x, aic78x0 SCSI
+ahc*	at pci? dev ? function ?	# Adaptec 294x, aic78x0 SCSI
 
 # Display devices
 #
@@ -371,8 +371,8 @@ pseudo-device   drvctl
 
 #options PAX_MPROTECT=0			# PaX mprotect(2) restrictions
 
-#rlphy*	at mii? phy ?			# Realtek 8139/8201L PHYs
-#rtk*	at pci? dev ? function ?	# Realtek 8129/8139
+rlphy*	at mii? phy ?			# Realtek 8139/8201L PHYs
+rtk*	at pci? dev ? function ?	# Realtek 8129/8139
 
 #rgephy* at mii? phy ?			# Realtek 8169S/8110S internal PHYs
 #ral*	at pci? dev ? function ?	# Ralink Technology RT25x0 802.11a/b/g

Index: src/sys/arch/macppc/conf/GENERIC_MD
diff -u src/sys/arch/macppc/conf/GENERIC_MD:1.16 src/sys/arch/macppc/conf/GENERIC_MD:1.17
--- src/sys/arch/macppc/conf/GENERIC_MD:1.16	Sun Aug 10 17:58:51 2014
+++ src/sys/arch/macppc/conf/GENERIC_MD	Mon Jan  7 01:44:59 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC_MD,v 1.16 2014/08/10 17:58:51 joerg Exp $
+#	$NetBSD: GENERIC_MD,v 1.17 2019/01/07 01:44:59 scole Exp $
 #
 # GENERIC_MD config file
 #
@@ -8,5 +8,5 @@ include "arch/macppc/conf/GENERIC"
 # Enable the hooks used for initializing the ram-disk.
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# Force root on ram-disk
-options 	MEMORY_DISK_ROOT_SIZE=5120	# 2560 KiB
+options 	MEMORY_DISK_ROOT_SIZE=5760	# 2880 KiB
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode

Index: src/sys/arch/macppc/conf/INSTALL
diff -u src/sys/arch/macppc/conf/INSTALL:1.128 src/sys/arch/macppc/conf/INSTALL:1.129
--- src/sys/arch/macppc/conf/INSTALL:1.128	Fri Aug 31 18:11:20 2018
+++ src/sys/arch/macppc/conf/INSTALL	Mon Jan  7 01:44:59 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL,v 1.128 2018/08/31 18:11:20 sevan Exp $
+#	$NetBSD: INSTALL,v 1.129 2019/01/07 01:44:59 scole Exp $
 #
 # config file for INSTALL FLOPPY
 #
@@ -17,7 +17,7 @@ options 	RTC_OFFSET=0	# hardware clock i
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# Force root on ram-disk
 options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
-options 	MEMORY_DISK_ROOT_SIZE=5120	# 2560 KiB
+options 	MEMORY_DISK_ROOT_SIZE=5760	# 2880 KiB
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 
 options 	USERCONF	# userconf(4) support

Index: src/sys/arch/macppc/conf/INSTALL_601
diff -u src/sys/arch/macppc/conf/INSTALL_601:1.1 src/sys/arch/macppc/conf/INSTALL_601:1.2
--- src/sys/arch/macppc/conf/INSTALL_601:1.1	Mon Nov 12 20:07:47 2018
+++ src/sys/arch/macppc/conf/INSTALL_601	Mon Jan  7 01:44:59 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL_601,v 1.1 2018/11/12 20:07:47 scole Exp $
+#	$NetBSD: INSTALL_601,v 1.2 2019/01/07 01:44:59 scole Exp $
 #
 # config file for INSTALL
 #
@@ -19,7 +19,7 @@ options 	RTC_OFFSET=0	# hardware clock i
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# Force root on ram-disk
 options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
-options 	MEMORY_DISK_ROOT_SIZE=5120	# 2560 KiB
+options 	MEMORY_DISK_ROOT_SIZE=5760	# 2880 KiB
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 
 options 	USERCONF	# userconf(4) support
@@ -72,6 +72,9 @@ pci*	at ppb? bus ?
 pchb*	at pci? dev ? function ?	# PCI-Host bridges
 ppb*	at pci? dev ? function ?	# PCI-PCI bridges
 
+# PCI SCSI controllers
+ahc*	at pci? dev ? function ?	# Adaptec 294x, aic78x0 SCSI
+
 # Display devices
 #
 # The 7200's onboard vi

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

2018-12-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 30 01:54:13 UTC 2018

Modified Files:
src/sys/arch/macppc/stand/bootxx: Makefile

Log Message:
no pie/sanitizers for boot code.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/macppc/stand/bootxx/Makefile

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/stand/bootxx/Makefile
diff -u src/sys/arch/macppc/stand/bootxx/Makefile:1.18 src/sys/arch/macppc/stand/bootxx/Makefile:1.19
--- src/sys/arch/macppc/stand/bootxx/Makefile:1.18	Fri Mar  2 18:15:25 2018
+++ src/sys/arch/macppc/stand/bootxx/Makefile	Sat Dec 29 20:54:13 2018
@@ -1,4 +1,8 @@
-#	$NetBSD: Makefile,v 1.18 2018/03/02 23:15:25 sevan Exp $
+#	$NetBSD: Makefile,v 1.19 2018/12/30 01:54:13 christos Exp $
+
+NOLIBCSANITIZER=
+NOSANITIZER=
+NOPIE=
 
 S!=	cd ${.CURDIR}/../../../..; pwd
 



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

2018-11-16 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov 16 14:58:54 UTC 2018

Modified Files:
src/sys/arch/macppc/stand/ofwboot: ofdev.c version

Log Message:
Fix boot failure from installation floppies.  PR port-macppc/53103

Also bump version to denote a visible fix.
Should be pulled up to netbsd-8 and netbsd-7.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/macppc/stand/ofwboot/ofdev.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/macppc/stand/ofwboot/version

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

Modified files:

Index: src/sys/arch/macppc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.26 src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.27
--- src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.26	Sun Feb 19 12:02:55 2012
+++ src/sys/arch/macppc/stand/ofwboot/ofdev.c	Fri Nov 16 14:58:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.26 2012/02/19 12:02:55 tsutsui Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.27 2018/11/16 14:58:54 tsutsui Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -437,10 +437,11 @@ devopen(struct open_file *of, const char
 		ofdev.type = OFDEV_DISK;
 		ofdev.bsize = DEV_BSIZE;
 		/* First try to find a disklabel without partitions */
-		if (strategy(&ofdev, F_READ,
-			 LABELSECTOR, DEV_BSIZE, buf, &nread) != 0
-		|| nread != DEV_BSIZE
-		|| getdisklabel(buf, &label)) {
+		if (!floppyboot &&
+		(strategy(&ofdev, F_READ,
+			  LABELSECTOR, DEV_BSIZE, buf, &nread) != 0
+		 || nread != DEV_BSIZE
+		 || getdisklabel(buf, &label))) {
 			/* Else try APM or MBR partitions */
 			struct drvr_map *map = (struct drvr_map *)buf;
 

Index: src/sys/arch/macppc/stand/ofwboot/version
diff -u src/sys/arch/macppc/stand/ofwboot/version:1.13 src/sys/arch/macppc/stand/ofwboot/version:1.14
--- src/sys/arch/macppc/stand/ofwboot/version:1.13	Sun Oct 17 15:33:04 2010
+++ src/sys/arch/macppc/stand/ofwboot/version	Fri Nov 16 14:58:54 2018
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.13 2010/10/17 15:33:04 phx Exp $
+$NetBSD: version,v 1.14 2018/11/16 14:58:54 tsutsui Exp $
 
 1.1:		Initial revision from NetBSD/powerpc.
 1.2:		Use MI loadfile().
@@ -14,3 +14,4 @@ $NetBSD: version,v 1.13 2010/10/17 15:33
 1.11:		Check floppyboot and disable LOAD_NOTE to avoid backward seek.
 1.12:		Read Apple Partition Map to find the root partition, when
 		no OF path was specified.
+1.13:		Fix boot failure of installation floppies



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

2018-11-12 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Nov 12 20:07:47 UTC 2018

Added Files:
src/sys/arch/macppc/conf: INSTALL_601

Log Message:
install kernel for ppc601 floppies and iso


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/macppc/conf/INSTALL_601

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

Added files:

Index: src/sys/arch/macppc/conf/INSTALL_601
diff -u /dev/null src/sys/arch/macppc/conf/INSTALL_601:1.1
--- /dev/null	Mon Nov 12 20:07:47 2018
+++ src/sys/arch/macppc/conf/INSTALL_601	Mon Nov 12 20:07:47 2018
@@ -0,0 +1,173 @@
+#	$NetBSD: INSTALL_601,v 1.1 2018/11/12 20:07:47 scole Exp $
+#
+# config file for INSTALL
+#
+# this config more or less matches a Power Macintosh 7200 with a USB card,
+# and platinumfb
+
+include 	"arch/macppc/conf/std.macppc.601"
+
+#options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+
+makeoptions	COPTS="-Os" # Reduce size.
+
+maxusers	12
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
+
+# Enable the hooks used for initializing the ram-disk.
+options 	MEMORY_DISK_HOOKS
+options 	MEMORY_DISK_IS_ROOT	# Force root on ram-disk
+options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
+options 	MEMORY_DISK_ROOT_SIZE=5120	# 2560 KiB
+options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
+
+options 	USERCONF	# userconf(4) support
+options 	PIPE_SOCKETPAIR		# smaller, but slower pipe(2)
+#options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
+
+# Compatibility options
+include 	"conf/compat_netbsd13.config"
+
+# File systems
+file-system 	FFS		# UFS
+file-system 	MFS		# memory file system
+file-system 	NFS		# Network File System client
+file-system 	CD9660		# ISO 9660 + Rock Ridge file system
+file-system 	MSDOSFS		# MS-DOS file system
+#file-system	PTYFS		# /dev/pts/N support
+
+# Filesystem options
+options 	NFS_V2_ONLY	# Exclude NFS3 code to save space
+options 	APPLE_UFS	# Apple UFS support in FFS
+#options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
+options 	WAPBL		# File system journaling support
+
+# Networking options
+options 	INET		# IP + ICMP + TCP + UDP
+options 	INET6		# IPV6
+options 	NFS_BOOT_DHCP	# Support DHCP NFS root
+
+options 	WSEMUL_VT100	# VT100 / VT220 emulation
+options 	WSDISPLAY_DEFAULTSCREENS=1
+#options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
+options 	FONT_GALLANT12x22	# big, Sun-like font
+options 	FONT_QVSS8x15		# a smaller font for lower resolutions
+
+# Kernel root file system and dump configuration.
+config		netbsd	root on ? type ?
+
+#
+# Device configuration
+#
+
+mainbus* at root
+
+cpu*	at mainbus?
+bandit*	at mainbus?
+
+pci*	at bandit? bus ?
+pci*	at ppb? bus ?
+
+pchb*	at pci? dev ? function ?	# PCI-Host bridges
+ppb*	at pci? dev ? function ?	# PCI-PCI bridges
+
+# Display devices
+#
+# The 7200's onboard video is unsupported by OF so we need either a
+# graphics card that works as OF console or a serial console.
+# The only cards known to work ( so far ) are PCI Voodoo3s flashed with the
+# official Macintosh firmware from 3Dfx. The others should work but are
+# untested with OF 1.0.5
+# this will take over the console if output-device is set to 'screen' or
+# 'platinum'. It will provide a NetBSD console, but still won't work with OF
+#platinumfb0 	at mainbus?
+
+#gffb*		at pci?	function ?	# NVIDIA GeForce2 MX
+#machfb*		at pci? function ?	# ATI Mach 64, Rage, Rage Pro
+#r128fb*		at pci? function ?	# ATI Rage 128
+voodoofb*	at pci? function ?	# 3Dfx Voodoo3 
+
+# ATI Radeon. Still has problems on some hardware
+#radeonfb*	at pci? function ?
+
+# generic PCI framebuffer, should work with everything supported by OF
+genfb*		at pci? function ?
+
+# make sure the console display is always wsdisplay0
+wsdisplay0	at wsemuldisplaydev? console 1
+wsdisplay*	at wsemuldisplaydev? console 0
+
+obio*	at pci? dev ? function ?
+
+mc*	at obio?			# MACE ethernet
+esp*	at obio? flags 0x00ff		# 53c9x SCSI
+# the 7200 has no mesh but other PMacs with 601 cards may
+mesh*	at obio? flags 0x		# MESH SCSI
+nvram*	at obio?			# nvram
+
+# the new, improved ADB subsystem
+
+cuda*	at obio?			# CUDA, for Old World PowerMacs
+nadb*	at adb_bus?			# ADB bus enumerator, at cuda or pmu
+adbkbd* at nadb?			# ADB keyboard
+adbms*	at nadb?			# ADB mice and touchpads
+
+wskbd*		at wskbddev? console ?
+wsmouse*	at wsmousedev?
+
+iic0	at cuda0		# CUDA's IIC bus
+
+zsc*	at obio?
+zstty*	at zsc? channel ?
+mediabay* at obio?
+wdc*	at mediabay? flags 0
+
+# Cryptographic Devices
+
+# PCI cryptographic devices
+# (disabled, requires opencrypto framework which requires generic softints
+#hifn*	at pci? dev ? function ?	# Hifn 7755/7811/795x
+#ubsec*	at pci? dev ? function ?	# Broadcom 5501/5601/580x/582x
+
+scsibus* at scsi?
+
+sd*	at scsibus? target ? lun ?	# SCSI disks
+cd*	at scsibus? target ? lun ?	# SCSI CD-ROM drives
+
+wdc*	at obio? flags 0x1
+atabus* at ata?
+wd*	at atabus? 

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

2018-11-12 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Nov 12 20:03:42 UTC 2018

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

Log Message:
Add scroll support, wsmouse


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

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_601
diff -u src/sys/arch/macppc/conf/GENERIC_601:1.21 src/sys/arch/macppc/conf/GENERIC_601:1.22
--- src/sys/arch/macppc/conf/GENERIC_601:1.21	Wed Aug  1 20:04:12 2018
+++ src/sys/arch/macppc/conf/GENERIC_601	Mon Nov 12 20:03:42 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC_601,v 1.21 2018/08/01 20:04:12 maxv Exp $
+# $NetBSD: GENERIC_601,v 1.22 2018/11/12 20:03:42 scole Exp $
 #
 # GENERIC machine description file
 # 
@@ -28,7 +28,7 @@ include 	"arch/macppc/conf/std.macppc.60
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident 		"GENERIC-$Revision: 1.21 $"
+ident 		"GENERIC-$Revision: 1.22 $"
 
 maxusers	32
 
@@ -163,6 +163,7 @@ options 	WS_DEFAULT_FG=WSCOL_BLACK
 options 	WS_DEFAULT_BG=WSCOL_LIGHT_WHITE
 options 	WS_KERNEL_FG=WSCOL_GREEN
 options 	WS_KERNEL_BG=WSCOL_LIGHT_WHITE
+options WSDISPLAY_SCROLLSUPPORT
 
 #options 	WSDISPLAY_COMPAT_RAWKBD		# can get raw scancodes
 options 	FONT_GALLANT12x22
@@ -289,6 +290,7 @@ uhub*	at uhub? port ?
 uhidev*	at uhub? port ? configuration ? interface ?	# USB HID device
 
 ums*	at uhidev? reportid ?# USB Mice
+wsmouse* at ums? mux 0
 ukbd*	at uhidev? reportid ?# USB Keyboards
 uhid*	at uhidev? reportid ?# USB Generic HID
 
@@ -327,13 +329,13 @@ pseudo-device	vnd			# disk-like interfac
 pseudo-device	fss			# file system snapshot device
 #pseudo-device	md			# memory disk device
 pseudo-device	loop			# network loopback
-#pseudo-device	bpfilter		# packet filter
+pseudo-device	bpfilter		# packet filter
 #pseudo-device	npf			# NPF packet filter
 #pseudo-device	ppp			# Point-to-Point Protocol
 #pseudo-device	pppoe			# PPP over Ethernet (RFC 2516)
 #pseudo-device	sl			# Serial Line IP
 #pseudo-device	tun			# network tunneling over tty
-pseudo-device	tap			# virtual Ethernet
+#pseudo-device	tap			# virtual Ethernet
 #pseudo-device	gre			# generic L3 over IP tunnel
 #pseudo-device	gif			# IPv[46] over IPv[46] tunnel (RFC1933)
 #pseudo-device	faith			# IPv[46] tcp relay translation i/f
@@ -368,3 +370,9 @@ pseudo-device   drvctl
 #options VERIFIED_EXEC_FP_SHA512
 
 #options PAX_MPROTECT=0			# PaX mprotect(2) restrictions
+
+#rlphy*	at mii? phy ?			# Realtek 8139/8201L PHYs
+#rtk*	at pci? dev ? function ?	# Realtek 8129/8139
+
+#rgephy* at mii? phy ?			# Realtek 8169S/8110S internal PHYs
+#ral*	at pci? dev ? function ?	# Ralink Technology RT25x0 802.11a/b/g



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

2018-11-12 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Nov 12 20:00:46 UTC 2018

Modified Files:
src/sys/arch/macppc/stand/bootxx: bootxx.c
src/sys/arch/macppc/stand/ofwboot: Locore.c

Log Message:
PR 51495/port-macppc

Allow ppc601 to boot off hard disk


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/macppc/stand/bootxx/bootxx.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/macppc/stand/ofwboot/Locore.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/stand/bootxx/bootxx.c
diff -u src/sys/arch/macppc/stand/bootxx/bootxx.c:1.18 src/sys/arch/macppc/stand/bootxx/bootxx.c:1.19
--- src/sys/arch/macppc/stand/bootxx/bootxx.c:1.18	Sat Mar 14 21:04:12 2009
+++ src/sys/arch/macppc/stand/bootxx/bootxx.c	Mon Nov 12 20:00:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootxx.c,v 1.18 2009/03/14 21:04:12 dsl Exp $	*/
+/*	$NetBSD: bootxx.c,v 1.19 2018/11/12 20:00:46 scole Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -33,6 +33,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -68,15 +69,21 @@ __asm(
 "	addi	%r8,8,(_start)@l\n"
 "	li	%r9,0x40	\n"	/* loop 64 times (for 2048 bytes of bootxx) */
 "	mtctr	%r9		\n"
-"1:\n"
-"	dcbf	%r0,%r8		\n"
+"\n"
+"1:	dcbf	%r0,%r8		\n"
 "	icbi	%r0,%r8		\n"
 "	addi	%r8,%r8,0x20	\n"
 "	bdnz	1b		\n"
 "	sync			\n"
 
 "	li	%r0,0		\n"
-"	mtdbatu	3,%r0		\n"
+"\n"	/* test for 601 cpu */
+"	mfspr	%r9,287		\n"	/* mfpvbr %r9 PVR = 287 */
+"	srwi	%r9,%r9,0x10	\n"
+"	cmplwi	%r9,0x02	\n"	/* 601 cpu == 0x0001 */
+"	blt	2f		\n"	/* skip over non-601 BAT setup */
+"\n"
+"	mtdbatu 3,%r0		\n"	/* non-601 BAT */
 "	mtibatu	3,%r0		\n"
 "	isync			\n"
 "	li	%r8,0x1ffe	\n"	/* map the lowest 256MB */
@@ -86,13 +93,61 @@ __asm(
 "	mtibatl	3,%r9		\n"
 "	mtibatu	3,%r8		\n"
 "	isync			\n"
-
+"	b	3f		\n"
+"\n"
+"2:	mfmsr	%r8		\n"	/* 601 BAT */
+"	mtmsr	%r0		\n"
+"	isync			\n"
+"\n"
+"	mtibatu 0,%r0		\n"
+"	mtibatu 1,%r0		\n"
+"	mtibatu 2,%r0		\n"
+"	mtibatu 3,%r0		\n"
+"\n"
+"	li	%r9,0x7f	\n"
+"	mtibatl 0,%r9		\n"
+"	li	%r9,0x1a	\n"
+"	mtibatu 0,%r9		\n"
+"\n"
+"	lis %r9,0x80		\n"
+"	addi %r9,%r9,0x7f	\n"
+"	mtibatl 1,%r9		\n"
+"	lis %r9,0x80		\n"
+"	addi %r9,%r9,0x1a	\n"
+"	mtibatu 1,%r9		\n"
+"\n"
+"	lis %r9,0x100		\n"
+"	addi %r9,%r9,0x7f	\n"
+"	mtibatl 2,%r9		\n"
+"	lis %r9,0x100		\n"
+"	addi %r9,%r9,0x1a	\n"
+"	mtibatu 2,%r9		\n"
+"\n"
+"	lis %r9,0x180		\n"
+"	addi %r9,%r9,0x7f	\n"
+"	mtibatl 3,%r9		\n"
+"	lis %r9,0x180		\n"
+"	addi %r9,%r9,0x1a	\n"
+"	mtibatu 3,%r9		\n"
+"\n"
+"	isync			\n"
+"\n"
+"	mtmsr	%r8		\n"
+"	isync			\n"
+"\n"
 	/*
 	 * setup 32 KB of stack with 32 bytes overpad (see above)
 	 */
-"	lis	%r1,(stack+32768)@ha\n"
+"3:	lis	%r1,(stack+32768)@ha\n"
 "	addi	%r1,%r1,(stack+32768)@l\n"
-"	stw	%r0,0(%r1)	\n"	/* terminate the frame link chain */
+	/*
+	 * terminate the frame link chain,
+	 * clear by bytes to avoid ppc601 alignment exceptions
+	 */
+"	stb	%r0,0(%r1)	\n"
+"	stb	%r0,1(%r1)	\n"
+"	stb	%r0,2(%r1)	\n"
+"	stb	%r0,3(%r1)	\n"
 
 "	b	startup		\n"
 );
@@ -258,10 +313,14 @@ void
 startup(int arg1, int arg2, void *openfirm)
 {
 	int fd, blk, chosen, options, j;
+	uint32_t cpuvers;
 	size_t i;
 	char *addr;
 	char bootpath[128];
 
+	__asm volatile ("mfpvr %0" : "=r"(cpuvers));
+	cpuvers >>= 16;
+
 	openfirmware = openfirm;
 
 	chosen = OF_finddevice("/chosen");
@@ -302,17 +361,19 @@ startup(int arg1, int arg2, void *openfi
 	}
 	putstr(". done!\r\nstarting stage 2...\r\n");
 
-	/*
-	 * enable D/I cache
-	 */
-	__asm(
-		"mtdbatu	3,%0\n\t"
-		"mtdbatl	3,%1\n\t"
-		"mtibatu	3,%0\n\t"
-		"mtibatl	3,%1\n\t"
-		"isync"
-	   ::	"r"(BATU(0, BAT_BL_256M, BAT_Vs)),
-		"r"(BATL(0, 0, BAT_PP_RW)));
+	if (cpuvers != MPC601) {
+		/*
+		 * enable D/I cache
+		 */
+		__asm(
+			"mtdbatu	3,%0\n\t"
+			"mtdbatl	3,%1\n\t"
+			"mtibatu	3,%0\n\t"
+			"mtibatl	3,%1\n\t"
+			"isync"
+		::	"r"(BATU(0, BAT_BL_256M, BAT_Vs)),
+			"r"(BATL(0, 0, BAT_PP_RW)));
+	}
 
 	entry_point(0, 0, openfirm);
 	for (;;);			/* just in case */

Index: src/sys/arch/macppc/stand/ofwboot/Locore.c
diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.32 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.33
--- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.32	Fri Aug 17 16:04:39 2018
+++ src/sys/arch/macppc/stand/ofwboot/Locore.c	Mon Nov 12 20:00:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.32 2018/08/17 16:04:39 macallan Exp $	*/
+/*	$NetBSD: Locore.c,v 1.33 2018/11/12 20:00:46 scole Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -81,11 +81,11 @@ __asm(
 "\n" /* test for 601 */
 "	mfspr	%r0,287		\n" /* mfpvbr %r0 PVR = 287 */
 "	srwi	%r0,%r0,0x10	\n"
-"	cmpi	0,1,%r0,0x02	\n" /* 601 CPU = 0x0001 */
+"	cmplwi	%r0,0x02	\n" /* 601 CPU = 0x0001 */
 "	blt	2f		\n" /* skip over non-601 BAT setup */
-"	cmpi	0,1,%r0,0x39	\n" /* PPC970 */
+"	cmplwi	%r0,0x39	\n" /* PPC970 */
 "	blt	0f		\n"
-"	cmpi	0,1,%r0,0x45	\n" 

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

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 18:11:20 UTC 2018

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

Log Message:
Enable USB 2.0 support so installs go a little faster on systems which support
it.
Include support for USB Ethernet adapters and relevant PHY as a fallback if
onboard Ethernet port is unavailable for some reason.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/macppc/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/macppc/conf/INSTALL
diff -u src/sys/arch/macppc/conf/INSTALL:1.127 src/sys/arch/macppc/conf/INSTALL:1.128
--- src/sys/arch/macppc/conf/INSTALL:1.127	Fri May 11 22:51:33 2018
+++ src/sys/arch/macppc/conf/INSTALL	Fri Aug 31 18:11:20 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL,v 1.127 2018/05/11 22:51:33 macallan Exp $
+#	$NetBSD: INSTALL,v 1.128 2018/08/31 18:11:20 sevan Exp $
 #
 # config file for INSTALL FLOPPY
 #
@@ -95,6 +95,7 @@ siop*	at pci? dev ? function ?	# NCR 53c
 #ofb*	at pci? dev ? function ?	# Generic Open Firmware Framebuffer
 genfb*	at pci? dev ? function ?
 cbb*	at pci? dev ? function ?	# PCI-CardBus bridge
+ehci* 	at pci?	dev ? function ?	# Enhanced Host Controller
 ohci*	at pci? dev ? function ?	# Open Host Controller
 pciide* at pci? dev ? function ? flags 0x	# GENERIC pciide driver
 acardide* at pci? dev ? function ?	# Acard IDE controllers
@@ -130,6 +131,7 @@ rlphy*	at mii? phy ?			# Realtek 8139/82
 sqphy*	at mii? phy ?			# Seeq 80220/80221/80223 PHYs
 tqphy*	at mii? phy ?			# TDK Semiconductor PHYs
 ukphy*	at mii? phy ?			# generic unknown PHYs
+urlphy* at mii? phy ?			# Realtek RTL8150L internal PHYs
 
 cardslot* at cbb?
 cardbus* at cardslot?
@@ -180,6 +182,7 @@ atapibus* at atapi?
 cd*	at atapibus? drive ? flags 0x	# ATAPI CD-ROM drives
 sd*	at atapibus? drive ? flags 0x	# ATAPI disk drives
 
+usb* 	at ehci?
 usb*	at ohci?
 uhub*	at usb?
 uhub*	at uhub? port ?
@@ -187,6 +190,16 @@ uhidev* 	at uhub? port ? configuration ?
 ukbd* 	at uhidev? reportid ?
 umass*	at uhub? port ? configuration ? interface ?	# USB Mass Storage
 
+# USB Ethernet adapters
+aue*	at uhub? port ?		# ADMtek AN986 Pegasus based adapters
+axe*	at uhub? port ?		# ASIX AX88172 based adapters
+axen*	at uhub? port ?		# ASIX AX88178a/AX88179 based adapters
+cdce*	at uhub? port ?		# CDC, Ethernet Networking Control Model
+cue*	at uhub? port ?		# CATC USB-EL1201A based adapters
+kue*	at uhub? port ?		# Kawasaki LSI KL5KUSB101B based adapters
+url*	at uhub? port ?		# Realtek RTL8150L based adapters
+udav*	at uhub? port ?		# Davicom DM9601 based adapters
+
 pseudo-device	md			# memory disk
 #pseudo-device	fss			# file system snapshot device
 pseudo-device	loop			# network loopback



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

2018-08-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Aug 17 16:04:39 UTC 2018

Modified Files:
src/sys/arch/macppc/stand/ofwboot: Locore.c

Log Message:
- add some G5-specific setup
- OF_claim() more heap space on G5
With this, and -DHEAP_VARIABLE my G5s boot from harddisk


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/macppc/stand/ofwboot/Locore.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/stand/ofwboot/Locore.c
diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.31 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.32
--- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.31	Wed Jun  6 23:50:29 2018
+++ src/sys/arch/macppc/stand/ofwboot/Locore.c	Fri Aug 17 16:04:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.31 2018/06/06 23:50:29 uwe Exp $	*/
+/*	$NetBSD: Locore.c,v 1.32 2018/08/17 16:04:39 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -35,6 +35,7 @@
 #include 
 
 #include 
+#include 
 
 #include "openfirm.h"
 
@@ -81,9 +82,13 @@ __asm(
 "	mfspr	%r0,287		\n" /* mfpvbr %r0 PVR = 287 */
 "	srwi	%r0,%r0,0x10	\n"
 "	cmpi	0,1,%r0,0x02	\n" /* 601 CPU = 0x0001 */
-"	blt	1f		\n" /* skip over non-601 BAT setup */
+"	blt	2f		\n" /* skip over non-601 BAT setup */
+"	cmpi	0,1,%r0,0x39	\n" /* PPC970 */
+"	blt	0f		\n"
+"	cmpi	0,1,%r0,0x45	\n" /* PPC970GX */
+"	ble	1f		\n"
 	/* non PPC 601 BATs */
-"	li	%r0,0		\n"
+"0:	li	%r0,0		\n"
 "	mtibatu	0,%r0		\n"
 "	mtibatu	1,%r0		\n"
 "	mtibatu	2,%r0		\n"
@@ -99,10 +104,31 @@ __asm(
 "	li	%r9,0x1ffe	\n"	/* BATU(0, BAT_BL_256M, BAT_Vs) */
 "	mtibatu	0,%r9		\n"
 "	mtdbatu	0,%r9		\n"
-"	b	2f		\n"
-
+"	b	3f		\n"
+	/* 970 initialization stuff */
+"1:\n"
+	/* make sure we're in bridge mode */
+"	clrldi	%r8,%r8,3	\n"
+"	mtmsrd	%r8		\n"
+"	isync			\n"
+	 /* clear HID5 DCBZ bits (56/57), need to do this early */
+"	mfspr	%r9,0x3f6	\n"
+"	rldimi	%r9,0,6,56	\n"
+"	sync			\n"
+"	mtspr	0x3f6,%r9	\n"
+"	isync			\n"
+"	sync			\n"
+	/* Setup HID1 features, prefetch + i-cacheability controlled by PTE */
+"	mfspr	%r9,0x3f1	\n"
+"	li	%r11,0x1200	\n"
+"	sldi	%r11,%r11,44	\n"
+"	or	%r9,%r9,%r11	\n"
+"	mtspr	0x3f1,%r9	\n"
+"	isync			\n"
+"	sync			\n"
+"	b	3f		\n"	
 	/* PPC 601 BATs */
-"1:	li	%r0,0		\n"
+"2:	li	%r0,0		\n"
 "	mtibatu	0,%r0		\n"
 "	mtibatu	1,%r0		\n"
 "	mtibatu	2,%r0		\n"
@@ -134,7 +160,7 @@ __asm(
 "	addi	%r9,%r9,0x1a	\n"
 "	mtibatu	3,%r9		\n"
 "\n"
-"2:	isync			\n"
+"3:	isync			\n"
 "\n"
 "	mtmsr	%r8		\n"
 "	isync			\n"
@@ -649,7 +675,13 @@ setup(void)
 		OF_exit();
 
 #ifdef HEAP_VARIABLE
-	heapspace = OF_claim(0, HEAP_SIZE, NBPG);
+	uint32_t pvr, vers, hsize = HEAP_SIZE;
+
+	__asm volatile ("mfpvr %0" : "=r"(pvr));
+	vers = pvr >> 16;
+	if (vers >= IBM970 && vers <= IBM970GX) hsize = 0x80;
+
+	heapspace = OF_claim(0, hsize, NBPG);
 	if (heapspace == (char *)-1) {
 		panic("Failed to allocate heap");
 	}



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

2018-06-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Jun  9 02:25:52 UTC 2018

Modified Files:
src/sys/arch/macppc/conf: std.macppc

Log Message:
set options ADBKBD_EMUL_USB by default
With this ADB and USB keyboards can coexist on the same mux, as needed by
built-in Bluetooth modules on some *Books
should fix PR53351


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/macppc/conf/std.macppc

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/std.macppc
diff -u src/sys/arch/macppc/conf/std.macppc:1.23 src/sys/arch/macppc/conf/std.macppc:1.24
--- src/sys/arch/macppc/conf/std.macppc:1.23	Thu Dec 11 05:42:18 2008
+++ src/sys/arch/macppc/conf/std.macppc	Sat Jun  9 02:25:52 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: std.macppc,v 1.23 2008/12/11 05:42:18 alc Exp $
+#	$NetBSD: std.macppc,v 1.24 2018/06/09 02:25:52 macallan Exp $
 #
 # Standard/required options for NetBSD/macppc.
 
@@ -17,5 +17,10 @@ options 	EXEC_SCRIPT	# shell script supp
 
 options 	INTSTK=0x2000
 
+# some *Books have both ADB keyboards and Bluetooth modules which pose as USB
+# HID devices - for them to coexist on the same mux we tell the adbkbd driver
+# pose as a USB keyboard
+options 	ADBKBD_EMUL_USB
+
 # Atheros HAL options
 include "external/isc/atheros_hal/conf/std.ath_hal"



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

2018-06-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun  8 23:39:31 UTC 2018

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

Log Message:
fix low CPU speed reporting when using DFS


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/macppc/dev/obio.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/obio.c
diff -u src/sys/arch/macppc/dev/obio.c:1.45 src/sys/arch/macppc/dev/obio.c:1.46
--- src/sys/arch/macppc/dev/obio.c:1.45	Fri May  4 17:17:48 2018
+++ src/sys/arch/macppc/dev/obio.c	Fri Jun  8 23:39:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: obio.c,v 1.45 2018/05/04 17:17:48 macallan Exp $	*/
+/*	$NetBSD: obio.c,v 1.46 2018/06/08 23:39:31 macallan Exp $	*/
 
 /*-
  * Copyright (C) 1998	Internet Research Institute, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.45 2018/05/04 17:17:48 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.46 2018/06/08 23:39:31 macallan Exp $");
 
 #include 
 #include 
@@ -425,7 +425,8 @@ obio_setup_gpios(struct obio_softc *sc, 
 	if (hiclock != 0)
 		sc->sc_spd_hi = (hiclock + 50) / 100;
 	printf("hiclock: %d\n", sc->sc_spd_hi);
-	
+	if (use_dfs) sc->sc_spd_lo = sc->sc_spd_hi / 2;
+
 	sysctl_node = NULL;
 
 	if (sysctl_createv(NULL, 0, NULL, 



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

2018-06-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jun  7 17:02:12 UTC 2018

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

Log Message:
reduce debug spam, use IPI_VECTOR


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/macppc/macppc/pic_u3_ht.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/pic_u3_ht.c
diff -u src/sys/arch/macppc/macppc/pic_u3_ht.c:1.5 src/sys/arch/macppc/macppc/pic_u3_ht.c:1.6
--- src/sys/arch/macppc/macppc/pic_u3_ht.c:1.5	Fri May 11 22:48:38 2018
+++ src/sys/arch/macppc/macppc/pic_u3_ht.c	Thu Jun  7 17:02:12 2018
@@ -218,7 +218,7 @@ setup_u3_ht(uint32_t addr, uint32_t len,
 	x & 0xff, ((x & 0x1f00) >> 8) + 1, ((x & 0x07ff) >> 16) + 1);
 
 	/* up to 128 interrupt sources, plus IPI */
-	pic->pic_numintrs = 129;
+	pic->pic_numintrs = IPI_VECTOR + 1;
 	pic->pic_cookie = (void *) addr;
 	pic->pic_enable_irq = u3_ht_enable_irq;
 	pic->pic_reenable_irq = u3_ht_enable_irq;
@@ -437,7 +437,7 @@ u3_ht_establish_irq(struct pic_ops *pic,
 	if (u3_ht_is_ht_irq(u3_ht, irq))
 		u3_ht_establish_ht_irq(u3_ht, irq, type);
 
-	aprint_error("%s: setting IRQ %d %d to priority %d %x\n", __func__, irq,
+	DPRINTF("%s: setting IRQ %d %d to priority %d %x\n", __func__, irq,
 	type, realpri, x);
 }
 



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

2018-06-06 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Jun  6 23:50:29 UTC 2018

Modified Files:
src/sys/arch/macppc/stand/ofwboot: Locore.c openfirm.h

Log Message:
Provide commented out OF_enter() that comes in handy when debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/macppc/stand/ofwboot/Locore.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/macppc/stand/ofwboot/openfirm.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/stand/ofwboot/Locore.c
diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.30 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.31
--- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.30	Wed Jun  6 22:56:25 2018
+++ src/sys/arch/macppc/stand/ofwboot/Locore.c	Wed Jun  6 23:50:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.30 2018/06/06 22:56:25 uwe Exp $	*/
+/*	$NetBSD: Locore.c,v 1.31 2018/06/06 23:50:29 uwe Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -179,6 +179,24 @@ startup(void *vpd, int res, int (*openfi
 	OF_exit();
 }
 
+#if 0
+void
+OF_enter(void)
+{
+	static struct {
+		const char *name;
+		int nargs;
+		int nreturns;
+	} args = {
+		"enter",
+		0,
+		0
+	};
+
+	openfirmware(&args);
+}
+#endif	/* OF_enter */
+
 __dead void
 OF_exit(void)
 {

Index: src/sys/arch/macppc/stand/ofwboot/openfirm.h
diff -u src/sys/arch/macppc/stand/ofwboot/openfirm.h:1.7 src/sys/arch/macppc/stand/ofwboot/openfirm.h:1.8
--- src/sys/arch/macppc/stand/ofwboot/openfirm.h:1.7	Mon Dec 24 15:46:45 2007
+++ src/sys/arch/macppc/stand/ofwboot/openfirm.h	Wed Jun  6 23:50:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.h,v 1.7 2007/12/24 15:46:45 perry Exp $	*/
+/*	$NetBSD: openfirm.h,v 1.8 2018/06/06 23:50:29 uwe Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -39,6 +39,7 @@
 
 #include "boot.h"
 
+void OF_enter(void);
 __dead void OF_exit(void);
 int OF_finddevice(const char *);
 int OF_instance_to_package(int);



  1   2   3   4   >