CVS commit: src/sys/arch/mac68k/obio

2024-10-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Oct 13 12:34:56 UTC 2024

Modified Files:
src/sys/arch/mac68k/obio: ascaudio.c

Log Message:
Match against an EASC chip that reports a different version id.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mac68k/obio/ascaudio.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/mac68k/obio/ascaudio.c
diff -u src/sys/arch/mac68k/obio/ascaudio.c:1.1 src/sys/arch/mac68k/obio/ascaudio.c:1.2
--- src/sys/arch/mac68k/obio/ascaudio.c:1.1	Wed Mar 13 07:55:28 2024
+++ src/sys/arch/mac68k/obio/ascaudio.c	Sun Oct 13 12:34:56 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ascaudio.c,v 1.1 2024/03/13 07:55:28 nat Exp $ */
+/* $NetBSD: ascaudio.c,v 1.2 2024/10/13 12:34:56 nat Exp $ */
 
 /*-
  * Copyright (c) 2017, 2023 Nathanial Sloss 
@@ -29,7 +29,7 @@
 /* Based on pad(4) and asc(4) */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ascaudio.c,v 1.1 2024/03/13 07:55:28 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ascaudio.c,v 1.2 2024/10/13 12:34:56 nat Exp $");
 
 #include 
 #include 
@@ -134,7 +134,8 @@ static const struct audio_hw_if ascaudio
 	.get_locks	 = ascaudio_get_locks,
 };
 
-#define EASC_VER 0xb0
+#define EASC_VER	0xb0
+#define EASC_VER2	0xbb
 
 enum {
 	ASC_OUTPUT_CLASS,
@@ -244,6 +245,9 @@ ascaudioattach(device_t parent, device_t
 			sc->sc_rate /= 2;
 	}
 
+	if (sc->sc_ver == EASC_VER2)
+		sc->sc_ver = EASC_VER;
+
 	if (sc->sc_ver != EASC_VER)
 		printf(": Apple Sound Chip");
 	else



CVS commit: src/sys/arch/mac68k/obio

2024-10-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Oct 13 12:34:56 UTC 2024

Modified Files:
src/sys/arch/mac68k/obio: ascaudio.c

Log Message:
Match against an EASC chip that reports a different version id.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mac68k/obio/ascaudio.c

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



CVS commit: src/sys/dev/scsipi

2024-09-29 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Sep 29 12:36:41 UTC 2024

Modified Files:
src/sys/dev/scsipi: scsiconf.c

Log Message:
Add quirk for the standard PiSCSI cdrom emulation.


To generate a diff of this commit:
cvs rdiff -u -r1.304 -r1.305 src/sys/dev/scsipi/scsiconf.c

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

Modified files:

Index: src/sys/dev/scsipi/scsiconf.c
diff -u src/sys/dev/scsipi/scsiconf.c:1.304 src/sys/dev/scsipi/scsiconf.c:1.305
--- src/sys/dev/scsipi/scsiconf.c:1.304	Sat Jun 22 10:10:07 2024
+++ src/sys/dev/scsipi/scsiconf.c	Sun Sep 29 12:36:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsiconf.c,v 1.304 2024/06/22 10:10:07 palle Exp $	*/
+/*	$NetBSD: scsiconf.c,v 1.305 2024/09/29 12:36:40 nat Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.304 2024/06/22 10:10:07 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.305 2024/09/29 12:36:40 nat Exp $");
 
 #include 
 #include 
@@ -738,6 +738,8 @@ static const struct scsi_quirk_inquiry_p
 	 "MST ", "SnapLink", ""}, PQUIRK_NOLUNS},
 	{{T_DIRECT, T_FIXED,
 	 "NEC ", "D3847   ", "0307"}, PQUIRK_NOLUNS},
+	{{T_CDROM, T_REMOV,
+	 "PiSCSI  ", "SCSI CD-ROM ", ""}, PQUIRK_NOREADDISCINFO},
 	{{T_DIRECT, T_FIXED,
 	 "QUANTUM ", "ELS85S  ", ""}, PQUIRK_AUTOSAVE},
 	{{T_DIRECT, T_FIXED,



CVS commit: src/sys/dev/scsipi

2024-09-29 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Sep 29 12:36:41 UTC 2024

Modified Files:
src/sys/dev/scsipi: scsiconf.c

Log Message:
Add quirk for the standard PiSCSI cdrom emulation.


To generate a diff of this commit:
cvs rdiff -u -r1.304 -r1.305 src/sys/dev/scsipi/scsiconf.c

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



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

2024-09-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Sep 18 01:34:08 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: adb.c

Log Message:
The delay is only required for machines with built-in floppy drives.

I doubt the vibration from an external drive on the Duos would affect adb
before it attaches.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/mac68k/dev/adb.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/mac68k/dev/adb.c
diff -u src/sys/arch/mac68k/dev/adb.c:1.61 src/sys/arch/mac68k/dev/adb.c:1.62
--- src/sys/arch/mac68k/dev/adb.c:1.61	Wed Sep 18 01:29:02 2024
+++ src/sys/arch/mac68k/dev/adb.c	Wed Sep 18 01:34:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb.c,v 1.61 2024/09/18 01:29:02 nat Exp $	*/
+/*	$NetBSD: adb.c,v 1.62 2024/09/18 01:34:08 nat Exp $	*/
 
 /*
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb.c,v 1.61 2024/09/18 01:29:02 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb.c,v 1.62 2024/09/18 01:34:08 nat Exp $");
 
 #include "opt_adb.h"
 
@@ -104,12 +104,6 @@ adbattach(device_t parent, device_t self
 		case MACH_MACPB180:
 		case MACH_MACPB180C:
 		case MACH_MACPB150:
-		case MACH_MACPB210:
-		case MACH_MACPB230:
-		case MACH_MACPB250:
-		case MACH_MACPB270:
-		case MACH_MACPB280:
-		case MACH_MACPB280C:
 			/* Reqired on machines with in-built trackballs. */
 			printf("...  Waiting 5 seconds for adb devices to "
 			 "settle.");



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

2024-09-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Sep 18 01:34:08 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: adb.c

Log Message:
The delay is only required for machines with built-in floppy drives.

I doubt the vibration from an external drive on the Duos would affect adb
before it attaches.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/mac68k/dev/adb.c

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



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

2024-09-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Sep 18 01:29:02 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: adb.c

Log Message:
Use attach delay only on affected machines.

It is only required for machines with built-in trackballs.

Requested by rin@.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/mac68k/dev/adb.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/mac68k/dev/adb.c
diff -u src/sys/arch/mac68k/dev/adb.c:1.60 src/sys/arch/mac68k/dev/adb.c:1.61
--- src/sys/arch/mac68k/dev/adb.c:1.60	Sat Sep 14 20:56:50 2024
+++ src/sys/arch/mac68k/dev/adb.c	Wed Sep 18 01:29:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb.c,v 1.60 2024/09/14 20:56:50 nat Exp $	*/
+/*	$NetBSD: adb.c,v 1.61 2024/09/18 01:29:02 nat Exp $	*/
 
 /*
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb.c,v 1.60 2024/09/14 20:56:50 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb.c,v 1.61 2024/09/18 01:29:02 nat Exp $");
 
 #include "opt_adb.h"
 
@@ -94,8 +94,30 @@ static void
 adbattach(device_t parent, device_t self, void *aux)
 {
 
-	printf("...  Waiting 5 seconds for adb devices to settle.");
-	kpause("adb-slp", false, mstohz(5000), NULL);
+	switch (mac68k_machine.machineid) {
+		case MACH_MACPB140:
+		case MACH_MACPB145:
+		case MACH_MACPB160:
+		case MACH_MACPB165:
+		case MACH_MACPB165C:
+		case MACH_MACPB170:
+		case MACH_MACPB180:
+		case MACH_MACPB180C:
+		case MACH_MACPB150:
+		case MACH_MACPB210:
+		case MACH_MACPB230:
+		case MACH_MACPB250:
+		case MACH_MACPB270:
+		case MACH_MACPB280:
+		case MACH_MACPB280C:
+			/* Reqired on machines with in-built trackballs. */
+			printf("...  Waiting 5 seconds for adb devices to "
+			 "settle.");
+			kpause("adb-slp", false, mstohz(5000), NULL);
+			break;
+		default:
+			break;
+	}
 
 	adb_softintr_cookie = softint_establish(SOFTINT_SERIAL,
 	(void (*)(void *))adb_soft_intr, NULL);



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

2024-09-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Sep 18 01:29:02 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: adb.c

Log Message:
Use attach delay only on affected machines.

It is only required for machines with built-in trackballs.

Requested by rin@.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/mac68k/dev/adb.c

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



CVS commit: src/doc

2024-09-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 14 21:21:43 UTC 2024

Modified Files:
src/doc: CHANGES

Log Message:
Mention recent changes to mac68k.


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.3092 src/doc/CHANGES:1.3093
--- src/doc/CHANGES:1.3092	Sat Sep 14 11:57:34 2024
+++ src/doc/CHANGES	Sat Sep 14 21:21:43 2024
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3092 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3093 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -517,3 +517,6 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 	tzcode: Updated to 2024a. [christos 20240911]
 	acpi(4): Updated ACPICA to 20240827. [christos 20240913] 
 	dkctl(8): Add new getgeometry command.  [mlelstv 20240914]
+	mac68k: Support for LCD brightness control on PB 1xx.  [nat 20240914]
+	mac68k: Support for power off on PB 1xx.  [nat 20240914]
+	mac68k: Support for the power button on PB 160/180.  [nat 20240914]



CVS commit: src/doc

2024-09-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 14 21:21:43 UTC 2024

Modified Files:
src/doc: CHANGES

Log Message:
Mention recent changes to mac68k.


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

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



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

2024-09-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 14 21:11:07 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: sbc.c

Log Message:
Use smaller size when sending PDMA data, and check that the next block can
be sent before sending it.

This fixes PDMA support (which previously has been flakey at best).

These changes provide maximum performance and importantly reliablity.

The lack of support for the PDMA intr should now be revisited on the PowerBook
5xx series (Unfortunately I don't have the hw to test with).

These changes have been tested on emulated (PiSCSI/BlueSCSI) and real hw.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/mac68k/dev/sbc.c

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



CVS commit: src/sys/arch/mac68k

2024-09-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 14 21:04:25 UTC 2024

Modified Files:
src/sys/arch/mac68k/conf: files.mac68k
src/sys/arch/mac68k/dev: pm_direct.c

Log Message:
Add support for the power button on the PowerBook 160/180.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/mac68k/conf/files.mac68k
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mac68k/dev/pm_direct.c

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



CVS commit: src/sys/arch/mac68k

2024-09-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 14 21:04:25 UTC 2024

Modified Files:
src/sys/arch/mac68k/conf: files.mac68k
src/sys/arch/mac68k/dev: pm_direct.c

Log Message:
Add support for the power button on the PowerBook 160/180.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/mac68k/conf/files.mac68k
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mac68k/dev/pm_direct.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/mac68k/conf/files.mac68k
diff -u src/sys/arch/mac68k/conf/files.mac68k:1.133 src/sys/arch/mac68k/conf/files.mac68k:1.134
--- src/sys/arch/mac68k/conf/files.mac68k:1.133	Wed Mar 13 07:55:28 2024
+++ src/sys/arch/mac68k/conf/files.mac68k	Sat Sep 14 21:04:24 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.mac68k,v 1.133 2024/03/13 07:55:28 nat Exp $
+#	$NetBSD: files.mac68k,v 1.134 2024/09/14 21:04:24 nat Exp $
 
 # mac68k-specific configuration info
 
@@ -24,7 +24,7 @@ device	obio { [addr = -1] }
 attach	obio at mainbus
 file	arch/mac68k/obio/obio.c		obio
 
-device	adb { }
+device	adb { }: sysmon_power
 attach	adb at obio
 file	arch/mac68k/dev/adb.c		adb
 file	arch/mac68k/dev/adbsysasm.s

Index: src/sys/arch/mac68k/dev/pm_direct.c
diff -u src/sys/arch/mac68k/dev/pm_direct.c:1.34 src/sys/arch/mac68k/dev/pm_direct.c:1.35
--- src/sys/arch/mac68k/dev/pm_direct.c:1.34	Sat Sep 14 21:02:46 2024
+++ src/sys/arch/mac68k/dev/pm_direct.c	Sat Sep 14 21:04:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm_direct.c,v 1.34 2024/09/14 21:02:46 nat Exp $	*/
+/*	$NetBSD: pm_direct.c,v 1.35 2024/09/14 21:04:24 nat Exp $	*/
 
 /*
  * Copyright (c) 2024 Nathanial Sloss 
@@ -35,7 +35,7 @@
 /* From: pm_direct.c 1.3 03/18/98 Takashi Hamada */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.34 2024/09/14 21:02:46 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.35 2024/09/14 21:04:24 nat Exp $");
 
 #include "opt_adb.h"
 
@@ -50,6 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: pm_direct.c,
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -88,6 +90,7 @@ u_short	pm_existent_ADB_devices = 0x0;	/
 u_int	pm_LCD_brightness = 0x0;
 u_int	pm_LCD_contrast = 0x0;
 u_int	pm_counter = 0;			/* clock count */
+struct sysmon_pswitch pbutton;
 
 /* these values shows that number of data returned after 'send' cmd is sent */
 char pm_send_cmd_type[] = {
@@ -260,6 +263,12 @@ pm_setup_adb(void)
 		case MACH_MACPB180:
 		case MACH_MACPB180C:
 			pmHardware = PM_HW_PB1XX;
+
+			memset(&pbutton, 0, sizeof(struct sysmon_pswitch));
+			pbutton.smpsw_name = "PB";
+			pbutton.smpsw_type = PSWITCH_TYPE_POWER;
+			if (sysmon_pswitch_register(&pbutton) != 0)
+printf("Unable to register soft power\n");
 			break;
 		case MACH_MACPB150:
 		case MACH_MACPB210:
@@ -272,6 +281,13 @@ pm_setup_adb(void)
 		case MACH_MACPB190:
 		case MACH_MACPB190CS:
 			pmHardware = PM_HW_PB5XX;
+#if notyet
+			memset(&pbutton, 0, sizeof(struct sysmon_pswitch));
+			pbutton.smpsw_name = "PB";
+			pbutton.smpsw_type = PSWITCH_TYPE_POWER;
+			if (sysmon_pswitch_register(&pbutton) != 0)
+printf("Unable to register soft power\n");
+#endif
 			break;
 		default:
 			break;
@@ -579,6 +595,9 @@ pm_intr_pm1(void *arg)
 			/* ADB device event */
 			pm_adb_get_ADB_data(&pmdata);
 		}
+	} else if ((pmdata.num_data == 0x1) && (pmdata.data[0] == 0)) {
+		/* PowerBook 160/180 Power button. */
+		sysmon_pswitch_event(&pbutton, PSWITCH_EVENT_PRESSED);
 	} else {
 #ifdef ADB_DEBUG
 		if (adb_debug)



CVS commit: src/sys/arch/mac68k

2024-09-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 14 21:02:46 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: pm_direct.c pm_direct.h
src/sys/arch/mac68k/mac68k: machdep.c

Log Message:
Add support for poweroff on PowerBook 1xx.

This excludes the PowerBook 150 and 190, which are more similar to the 500
series.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/mac68k/dev/pm_direct.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mac68k/dev/pm_direct.h
cvs rdiff -u -r1.369 -r1.370 src/sys/arch/mac68k/mac68k/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/mac68k/dev/pm_direct.c
diff -u src/sys/arch/mac68k/dev/pm_direct.c:1.33 src/sys/arch/mac68k/dev/pm_direct.c:1.34
--- src/sys/arch/mac68k/dev/pm_direct.c:1.33	Sat Sep 14 20:59:45 2024
+++ src/sys/arch/mac68k/dev/pm_direct.c	Sat Sep 14 21:02:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm_direct.c,v 1.33 2024/09/14 20:59:45 nat Exp $	*/
+/*	$NetBSD: pm_direct.c,v 1.34 2024/09/14 21:02:46 nat Exp $	*/
 
 /*
  * Copyright (c) 2024 Nathanial Sloss 
@@ -35,7 +35,7 @@
 /* From: pm_direct.c 1.3 03/18/98 Takashi Hamada */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.33 2024/09/14 20:59:45 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.34 2024/09/14 21:02:46 nat Exp $");
 
 #include "opt_adb.h"
 
@@ -1151,6 +1151,26 @@ pm_adb_poll_next_device_pm1(PMData *pmda
 	tmp_pmdata.data[2] = 0x00;
 	pmgrop(&tmp_pmdata);
 }
+
+void 
+pm_poweroff(void)
+{
+	PMData pmdata;
+	int attempt = 3;
+
+	while (pmHardware == PM_HW_PB1XX && attempt > 0) {
+		pmdata.command = 0x7e;
+		pmdata.num_data = 0;
+		pmdata.data[0] = pmdata.data[1] = 0;
+		pmdata.s_buf = &pmdata.data[2];
+		pmdata.r_buf = &pmdata.data[2];
+		(void)pm_pmgrop_pm1(&pmdata);
+		attempt--;
+	}	
+
+	return;
+}
+
 u_int
 pm_set_brightness(u_int brightness)
 {

Index: src/sys/arch/mac68k/dev/pm_direct.h
diff -u src/sys/arch/mac68k/dev/pm_direct.h:1.2 src/sys/arch/mac68k/dev/pm_direct.h:1.3
--- src/sys/arch/mac68k/dev/pm_direct.h:1.2	Sat Sep 14 20:59:45 2024
+++ src/sys/arch/mac68k/dev/pm_direct.h	Sat Sep 14 21:02:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm_direct.h,v 1.2 2024/09/14 20:59:45 nat Exp $	*/
+/*	$NetBSD: pm_direct.h,v 1.3 2024/09/14 21:02:46 nat Exp $	*/
 
 /*
  * Copyright (c) 2024 Nathanial Sloss 
@@ -48,4 +48,5 @@ typedef	struct	{
 }	PMData;
 
 int		pmgrop(PMData *);
+void		pm_poweroff(void);
 u_int		pm_set_brightness(u_int);

Index: src/sys/arch/mac68k/mac68k/machdep.c
diff -u src/sys/arch/mac68k/mac68k/machdep.c:1.369 src/sys/arch/mac68k/mac68k/machdep.c:1.370
--- src/sys/arch/mac68k/mac68k/machdep.c:1.369	Fri Jun  7 02:51:45 2024
+++ src/sys/arch/mac68k/mac68k/machdep.c	Sat Sep 14 21:02:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.369 2024/06/07 02:51:45 nat Exp $	*/
+/*	$NetBSD: machdep.c,v 1.370 2024/09/14 21:02:46 nat Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.369 2024/06/07 02:51:45 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.370 2024/09/14 21:02:46 nat Exp $");
 
 #include "opt_adb.h"
 #include "opt_compat_netbsd.h"
@@ -156,6 +156,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #if NMACFB > 0
 #include 
 #endif
+#include 
 #include 
 
 #include "ksyms.h"
@@ -493,6 +494,11 @@ cpu_reboot(int howto, char *bootstr)
 		adb_poweroff();
 #endif
 		/*
+		 * Try to shutdown via the power manager (PowerBooks mainly).
+		 */
+		pm_poweroff();
+
+		/*
 		 * RB_POWERDOWN implies RB_HALT... fall into it...
 		 */
 	}



CVS commit: src/sys/arch/mac68k

2024-09-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 14 21:02:46 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: pm_direct.c pm_direct.h
src/sys/arch/mac68k/mac68k: machdep.c

Log Message:
Add support for poweroff on PowerBook 1xx.

This excludes the PowerBook 150 and 190, which are more similar to the 500
series.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/mac68k/dev/pm_direct.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mac68k/dev/pm_direct.h
cvs rdiff -u -r1.369 -r1.370 src/sys/arch/mac68k/mac68k/machdep.c

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



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

2024-09-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 14 20:59:46 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: aed.c pm_direct.c pm_direct.h

Log Message:
Add support for brightness control on Powerbook 1xx.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mac68k/dev/pm_direct.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mac68k/dev/pm_direct.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/mac68k/dev/aed.c
diff -u src/sys/arch/mac68k/dev/aed.c:1.39 src/sys/arch/mac68k/dev/aed.c:1.40
--- src/sys/arch/mac68k/dev/aed.c:1.39	Wed Jun  5 11:01:47 2024
+++ src/sys/arch/mac68k/dev/aed.c	Sat Sep 14 20:59:45 2024
@@ -1,6 +1,9 @@
-/*	$NetBSD: aed.c,v 1.39 2024/06/05 11:01:47 nat Exp $	*/
+/*	$NetBSD: aed.c,v 1.40 2024/09/14 20:59:45 nat Exp $	*/
 
 /*
+ * Copyright (c) 2024 Nathanial Sloss 
+ * All rights reserved.
+ *
  * Copyright (C) 1994	Bradley A. Grantham
  * All rights reserved.
  *
@@ -26,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.39 2024/06/05 11:01:47 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.40 2024/09/14 20:59:45 nat Exp $");
 
 #include "opt_adb.h"
 
@@ -48,6 +51,11 @@ __KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.39
 #include 
 #include 
 #include 
+#include 
+
+#define BRIGHTNESS_MAX	31
+#define BRIGHTNESS_MIN	0
+#define BRIGHTNESS_STEP	4
 
 /*
  * Function declarations.
@@ -60,11 +68,15 @@ static void	aed_dokeyupdown(adb_event_t 
 static void	aed_handoff(adb_event_t *);
 static void	aed_enqevent(adb_event_t *);
 
+static void	aed_brightness_down(device_t);
+static void	aed_brightness_up(device_t);
+
 /*
  * Local variables.
  */
 static struct aed_softc *aed_sc;
 static int aed_options = 0 | AED_MSEMUL;
+static int brightness = BRIGHTNESS_MAX;
 
 /* Driver definition */
 CFATTACH_DECL_NEW(aed, sizeof(struct aed_softc),
@@ -139,6 +151,11 @@ aedattach(device_t parent, device_t self
 
 	aed_sc = sc;
 
+	pmf_event_register(self, PMFE_DISPLAY_BRIGHTNESS_UP,
+	aed_brightness_up, TRUE);
+	pmf_event_register(self, PMFE_DISPLAY_BRIGHTNESS_DOWN,
+	aed_brightness_down, TRUE);
+
 	printf("ADB Event device\n");
 
 	return;
@@ -268,6 +285,12 @@ aed_emulate_mouse(adb_event_t *event)
 			microtime(&new_event.timestamp);
 			aed_handoff(&new_event);
 			break;
+		case ADBK_KEYUP(ADBK_UP):
+			pmf_event_inject(NULL, PMFE_DISPLAY_BRIGHTNESS_UP);
+			break;
+		case ADBK_KEYUP(ADBK_DOWN):
+			pmf_event_inject(NULL, PMFE_DISPLAY_BRIGHTNESS_DOWN);
+			break;
 		case ADBK_KEYUP(ADBK_SHIFT):
 		case ADBK_KEYDOWN(ADBK_SHIFT):
 		case ADBK_KEYUP(ADBK_CONTROL):
@@ -628,3 +651,33 @@ aedkqfilter(dev_t dev, struct knote *kn)
 
 	return (0);
 }
+
+static void
+aed_brightness_down(device_t dev)
+{
+	int level, step;
+
+	level = brightness;
+	if (level <= 4) 	 /* logarithmic brightness curve. */
+		step = 1;
+	else
+		step = BRIGHTNESS_STEP;
+
+	level = uimax(BRIGHTNESS_MIN, level - step);
+	brightness = pm_set_brightness(level);
+}
+
+static void
+aed_brightness_up(device_t dev)
+{
+	int level, step;
+
+	level = brightness;
+	if (level <= 4) 	 /* logarithmic brightness curve. */
+		step = 1;
+	else
+		step = BRIGHTNESS_STEP;
+
+	level = uimin(BRIGHTNESS_MAX, level + step);
+	brightness = pm_set_brightness(level);
+}

Index: src/sys/arch/mac68k/dev/pm_direct.c
diff -u src/sys/arch/mac68k/dev/pm_direct.c:1.32 src/sys/arch/mac68k/dev/pm_direct.c:1.33
--- src/sys/arch/mac68k/dev/pm_direct.c:1.32	Sun Jun  2 13:28:45 2024
+++ src/sys/arch/mac68k/dev/pm_direct.c	Sat Sep 14 20:59:45 2024
@@ -1,6 +1,9 @@
-/*	$NetBSD: pm_direct.c,v 1.32 2024/06/02 13:28:45 andvar Exp $	*/
+/*	$NetBSD: pm_direct.c,v 1.33 2024/09/14 20:59:45 nat Exp $	*/
 
 /*
+ * Copyright (c) 2024 Nathanial Sloss 
+ * All rights reserved.
+ *
  * Copyright (C) 1997 Takashi Hamada
  * All rights reserved.
  *
@@ -32,7 +35,7 @@
 /* From: pm_direct.c 1.3 03/18/98 Takashi Hamada */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.32 2024/06/02 13:28:45 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.33 2024/09/14 20:59:45 nat Exp $");
 
 #include "opt_adb.h"
 
@@ -845,18 +848,8 @@ pm_intr_pm2(void *arg)
 			rval = pm_pmgrop_pm2(&pmdata);
 			pm_printerr("#33", rval, pmdata.num_data, pmdata.data);
 */
-			/* this is an experimental code */
-			pmdata.command = 0x41;
-			pmdata.num_data = 1;
-			pmdata.s_buf = pmdata.data;
-			pmdata.r_buf = pmdata.data;
-			pm_LCD_brightness = 0x7f - pm_LCD_brightness / 2;
-			if (pm_LCD_brightness < 0x25)
-pm_LCD_brightness = 0x25;
-			if (pm_LCD_brightness > 0x5a)
-pm_LCD_brightness = 0x7f;
-			pmdata.data[0] = pm_LCD_brightness;
-			rval = pm_pmgrop_pm2(&pmdata);
+			pm_LCD_brightness =
+			pm_set_brightness(pm_LCD_brightness);
 			break;
 		case 0x10:			/*

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

2024-09-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 14 20:59:46 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: aed.c pm_direct.c pm_direct.h

Log Message:
Add support for brightness control on Powerbook 1xx.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mac68k/dev/pm_direct.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mac68k/dev/pm_direct.h

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



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

2024-09-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 14 20:56:51 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: adb.c

Log Message:
Allow a few seconds for adb devices to settle.

The spin up of the floppy drive motor would cause a crash on my PowerBook
when adb was attached.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/mac68k/dev/adb.c

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



CVS commit: src/sys/dev/scsipi

2024-09-07 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Sep  8 04:42:49 UTC 2024

Modified Files:
src/sys/dev/scsipi: if_dse.c

Log Message:
Only input needs to be polled.

Tested with PDMA on mac68k (on emulated hw).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/scsipi/if_dse.c

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

Modified files:

Index: src/sys/dev/scsipi/if_dse.c
diff -u src/sys/dev/scsipi/if_dse.c:1.7 src/sys/dev/scsipi/if_dse.c:1.8
--- src/sys/dev/scsipi/if_dse.c:1.7	Sun Sep  8 04:40:34 2024
+++ src/sys/dev/scsipi/if_dse.c	Sun Sep  8 04:42:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_dse.c,v 1.7 2024/09/08 04:40:34 nat Exp $ */
+/*	$NetBSD: if_dse.c,v 1.8 2024/09/08 04:42:49 nat Exp $ */
 
 /*
  * Driver for DaynaPORT SCSI/Link SCSI-Ethernet
@@ -578,8 +578,7 @@ dse_send_worker(struct work *wk, void *c
 		error = dse_scsipi_cmd(sc->sc_periph,
 		(void *)&cmd_send, sizeof(cmd_send),
 		sc->sc_tbuf, len, DSE_RETRIES,
-		DSE_TIMEOUT, NULL, XS_CTL_NOSLEEP | XS_CTL_POLL |
-		XS_CTL_DATA_OUT);
+		DSE_TIMEOUT, NULL, XS_CTL_NOSLEEP | XS_CTL_DATA_OUT);
 		if (error) {
 			aprint_error_dev(sc->sc_dev,
 			"not queued, error %d\n", error);
@@ -1080,7 +1079,7 @@ dse_set_multi(struct dse_softc *sc)
 
 	error = dse_scsipi_cmd(sc->sc_periph,
 	(struct scsipi_generic*)&cmd_set_multi, sizeof(cmd_set_multi),
-	mybuf, len, DSE_RETRIES, DSE_TIMEOUT, NULL, XS_CTL_POLL | XS_CTL_DATA_OUT);
+	mybuf, len, DSE_RETRIES, DSE_TIMEOUT, NULL, XS_CTL_DATA_OUT);
 
 	free(mybuf, M_DEVBUF);
 



CVS commit: src/sys/dev/scsipi

2024-09-07 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Sep  8 04:42:49 UTC 2024

Modified Files:
src/sys/dev/scsipi: if_dse.c

Log Message:
Only input needs to be polled.

Tested with PDMA on mac68k (on emulated hw).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/scsipi/if_dse.c

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



CVS commit: src/sys/dev/scsipi

2024-09-07 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Sep  8 04:40:34 UTC 2024

Modified Files:
src/sys/dev/scsipi: if_dse.c

Log Message:
Use aprint_normal_dev for ethernet address.

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/scsipi/if_dse.c

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

Modified files:

Index: src/sys/dev/scsipi/if_dse.c
diff -u src/sys/dev/scsipi/if_dse.c:1.6 src/sys/dev/scsipi/if_dse.c:1.7
--- src/sys/dev/scsipi/if_dse.c:1.6	Sat Jul  6 10:37:33 2024
+++ src/sys/dev/scsipi/if_dse.c	Sun Sep  8 04:40:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_dse.c,v 1.6 2024/07/06 10:37:33 andvar Exp $ */
+/*	$NetBSD: if_dse.c,v 1.7 2024/09/08 04:40:34 nat Exp $ */
 
 /*
  * Driver for DaynaPORT SCSI/Link SCSI-Ethernet
@@ -983,7 +983,7 @@ dse_get_addr(struct dse_softc *sc, uint8
 	if (error == 0) {
 		memcpy(myaddr, &(tmpbuf[0]), ETHER_ADDR_LEN);
 
-		aprint_error_dev(sc->sc_dev, "ethernet address %s\n",
+		aprint_normal_dev(sc->sc_dev, "ethernet address %s\n",
 			   ether_sprintf(myaddr));
 	}
 



CVS commit: src/sys/dev/scsipi

2024-09-07 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Sep  8 04:40:34 UTC 2024

Modified Files:
src/sys/dev/scsipi: if_dse.c

Log Message:
Use aprint_normal_dev for ethernet address.

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/scsipi/if_dse.c

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



CVS commit: src

2024-08-01 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Aug  1 13:41:15 UTC 2024

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

Log Message:
Add manual page for ascaudio(4).


To generate a diff of this commit:
cvs rdiff -u -r1.1777 -r1.1778 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/man4.mac68k/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/man4.mac68k/ascaudio.4

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

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1777 src/distrib/sets/lists/man/mi:1.1778
--- src/distrib/sets/lists/man/mi:1.1777	Fri Jul 12 21:02:22 2024
+++ src/distrib/sets/lists/man/mi	Thu Aug  1 13:41:15 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1777 2024/07/12 21:02:22 christos Exp $
+# $NetBSD: mi,v 1.1778 2024/08/01 13:41:15 nat Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.manman-sys-root
@@ -1528,6 +1528,7 @@
 ./usr/share/man/cat4/m25p.0			man-sys-catman		.cat
 ./usr/share/man/cat4/mac68k/adb.0		man-obsolete		obsolete
 ./usr/share/man/cat4/mac68k/ae.0		man-sys-catman		.cat
+./usr/share/man/cat4/mac68k/ascaudio.0		man-sys-catman		.cat
 ./usr/share/man/cat4/mac68k/autoconf.0		man-sys-catman		.cat
 ./usr/share/man/cat4/mac68k/cpi.0		man-sys-catman		.cat
 ./usr/share/man/cat4/mac68k/intro.0		man-sys-catman		.cat
@@ -5081,6 +5082,7 @@
 ./usr/share/man/man4/m25p.4			man-sys-man		.man
 ./usr/share/man/man4/mac68k/adb.4		man-obsolete		obsolete
 ./usr/share/man/man4/mac68k/ae.4		man-sys-man		.man
+./usr/share/man/man4/mac68k/ascaudio.4		man-sys-man		.man
 ./usr/share/man/man4/mac68k/autoconf.4		man-sys-man		.man
 ./usr/share/man/man4/mac68k/cpi.4		man-sys-man		.man
 ./usr/share/man/man4/mac68k/intro.4		man-sys-man		.man

Index: src/share/man/man4/man4.mac68k/Makefile
diff -u src/share/man/man4/man4.mac68k/Makefile:1.13 src/share/man/man4/man4.mac68k/Makefile:1.14
--- src/share/man/man4/man4.mac68k/Makefile:1.13	Thu May 22 19:51:48 2008
+++ src/share/man/man4/man4.mac68k/Makefile	Thu Aug  1 13:41:14 2024
@@ -1,8 +1,8 @@
 #	from: @(#)Makefile	5.1 (Berkeley) 6/29/90
-#	$NetBSD: Makefile,v 1.13 2008/05/22 19:51:48 hauke Exp $
+#	$NetBSD: Makefile,v 1.14 2024/08/01 13:41:14 nat Exp $
 
-MAN=	ae.4 autoconf.4 cpi.4 intro.4 iwm.4 mainbus.4 mem.4 netdock.4 \
-	obio.4 zsc.4
+MAN=	ae.4 ascaudio.4 autoconf.4 cpi.4 intro.4 iwm.4 mainbus.4 mem.4 \
+	netdock.4 obio.4 zsc.4
 MLINKS=	mem.4 kmem.4
 MANSUBDIR=/mac68k
 

Added files:

Index: src/share/man/man4/man4.mac68k/ascaudio.4
diff -u /dev/null src/share/man/man4/man4.mac68k/ascaudio.4:1.1
--- /dev/null	Thu Aug  1 13:41:15 2024
+++ src/share/man/man4/man4.mac68k/ascaudio.4	Thu Aug  1 13:41:14 2024
@@ -0,0 +1,69 @@
+.\"	$NetBSD: ascaudio.4,v 1.1 2024/08/01 13:41:14 nat Exp $
+.\" Copyright (c) 2024  Nathanial Sloss 
+.\" 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.
+.\"
+.Dd July 29, 2024
+.Dt ASCAUDIO 4 mac68k
+.Os
+.Sh NAME
+.Nm ascaudio
+.Nd MAC68K Apple Sound Chip (ASC) built-in audio.
+.Sh SYNOPSIS
+.Cd ascaudio*	at obio? flags 0x00
+.Cd audio*	at audiobus?
+.Cd spkr*	at audio?
+.Cd wsbell*	at spkr?
+.Sh DESCRIPTION
+.Nm
+provides an audio device for the (Enchanced) Apple Sound Chip.
+It is implemented as an
+.Xr audio 4
+device.
+.Sh CONFIGURATION
+The
+.Nm
+driver supports the fol

CVS commit: src

2024-08-01 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Aug  1 13:41:15 UTC 2024

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

Log Message:
Add manual page for ascaudio(4).


To generate a diff of this commit:
cvs rdiff -u -r1.1777 -r1.1778 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/man4.mac68k/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/man4.mac68k/ascaudio.4

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



CVS commit: src/sys/arch/mac68k/mac68k

2024-06-06 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Jun  7 02:51:45 UTC 2024

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

Log Message:
Relax the video size sanity check.

If stride and height are defined, compute the required size.

Fixes external video on my Powerbook 160.

A similar approach is done for macfb - should the mv_len == 0 an appropriate
value is calculated.


To generate a diff of this commit:
cvs rdiff -u -r1.368 -r1.369 src/sys/arch/mac68k/mac68k/machdep.c

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



CVS commit: src/sys/arch/mac68k/mac68k

2024-06-06 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Jun  7 02:51:45 UTC 2024

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

Log Message:
Relax the video size sanity check.

If stride and height are defined, compute the required size.

Fixes external video on my Powerbook 160.

A similar approach is done for macfb - should the mv_len == 0 an appropriate
value is calculated.


To generate a diff of this commit:
cvs rdiff -u -r1.368 -r1.369 src/sys/arch/mac68k/mac68k/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/mac68k/mac68k/machdep.c
diff -u src/sys/arch/mac68k/mac68k/machdep.c:1.368 src/sys/arch/mac68k/mac68k/machdep.c:1.369
--- src/sys/arch/mac68k/mac68k/machdep.c:1.368	Sun Jun  2 13:28:44 2024
+++ src/sys/arch/mac68k/mac68k/machdep.c	Fri Jun  7 02:51:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.368 2024/06/02 13:28:44 andvar Exp $	*/
+/*	$NetBSD: machdep.c,v 1.369 2024/06/07 02:51:45 nat Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.368 2024/06/02 13:28:44 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.369 2024/06/07 02:51:45 nat Exp $");
 
 #include "opt_adb.h"
 #include "opt_compat_netbsd.h"
@@ -2619,7 +2619,7 @@ get_mapping(void)
 	}
 	/* mv_len sanity check */
 	int reqsize = mac68k_video.mv_height * mac68k_video.mv_stride;
-	if (mac68k_video.mv_len != 0 && mac68k_video.mv_len < reqsize)
+	if (mac68k_video.mv_len < reqsize)
 		mac68k_video.mv_len = reqsize;
 
 	return load_addr;	/* Return physical address of logical 0 */



CVS commit: src/sys/arch

2024-06-05 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Jun  5 11:01:47 UTC 2024

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

Log Message:
Pass event up to adb device.

While here do the same for macppc.

Addresses PR/58303


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/macppc/dev/aed.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/mac68k/dev/aed.c
diff -u src/sys/arch/mac68k/dev/aed.c:1.38 src/sys/arch/mac68k/dev/aed.c:1.39
--- src/sys/arch/mac68k/dev/aed.c:1.38	Sun Sep 26 16:36:18 2021
+++ src/sys/arch/mac68k/dev/aed.c	Wed Jun  5 11:01:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: aed.c,v 1.38 2021/09/26 16:36:18 thorpej Exp $	*/
+/*	$NetBSD: aed.c,v 1.39 2024/06/05 11:01:47 nat Exp $	*/
 
 /*
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.38 2021/09/26 16:36:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.39 2024/06/05 11:01:47 nat Exp $");
 
 #include "opt_adb.h"
 
@@ -164,6 +164,7 @@ aed_input(adb_event_t *event)
 			aed_dokeyupdown(&new_event);
 		break;
 	case ADBADDR_MS:
+		event->u.m.buttons |= aed_sc->sc_buttons;
 		new_event.u.m.buttons |= aed_sc->sc_buttons;
 		aed_handoff(&new_event);
 		break;

Index: src/sys/arch/macppc/dev/aed.c
diff -u src/sys/arch/macppc/dev/aed.c:1.34 src/sys/arch/macppc/dev/aed.c:1.35
--- src/sys/arch/macppc/dev/aed.c:1.34	Sun Sep 26 16:36:19 2021
+++ src/sys/arch/macppc/dev/aed.c	Wed Jun  5 11:01:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: aed.c,v 1.34 2021/09/26 16:36:19 thorpej Exp $	*/
+/*	$NetBSD: aed.c,v 1.35 2024/06/05 11:01:47 nat Exp $	*/
 
 /*
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.34 2021/09/26 16:36:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.35 2024/06/05 11:01:47 nat Exp $");
 
 #include 
 #include 
@@ -167,6 +167,7 @@ aed_input(adb_event_t *event)
 			aed_dokeyupdown(&new_event);
 		break;
 	case ADBADDR_MS:
+		event->u.m.buttons |= aed_sc->sc_buttons;
 		new_event.u.m.buttons |= aed_sc->sc_buttons;
 		aed_handoff(&new_event);
 		break;



CVS commit: src/sys/arch

2024-06-05 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Jun  5 11:01:47 UTC 2024

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

Log Message:
Pass event up to adb device.

While here do the same for macppc.

Addresses PR/58303


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/macppc/dev/aed.c

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



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

2024-04-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Apr 26 00:59:08 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: pm_direct.c

Log Message:
Return early if PM data is not available.

This avoids random crashes on my Powerbook when using the mouse or keyboard.

The same was needed for the Powerbook 5xx/Duos (compile tested only).

XXX pullup-10, pullup-9, pullup-8.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/mac68k/dev/pm_direct.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/mac68k/dev/pm_direct.c
diff -u src/sys/arch/mac68k/dev/pm_direct.c:1.30 src/sys/arch/mac68k/dev/pm_direct.c:1.31
--- src/sys/arch/mac68k/dev/pm_direct.c:1.30	Sat Aug 21 11:55:24 2021
+++ src/sys/arch/mac68k/dev/pm_direct.c	Fri Apr 26 00:59:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm_direct.c,v 1.30 2021/08/21 11:55:24 andvar Exp $	*/
+/*	$NetBSD: pm_direct.c,v 1.31 2024/04/26 00:59:08 nat Exp $	*/
 
 /*
  * Copyright (C) 1997 Takashi Hamada
@@ -32,7 +32,7 @@
 /* From: pm_direct.c 1.3 03/18/98 Takashi Hamada */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.30 2021/08/21 11:55:24 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.31 2024/04/26 00:59:08 nat Exp $");
 
 #include "opt_adb.h"
 
@@ -562,6 +562,7 @@ pm_intr_pm1(void *arg)
 			printf("pm: PM is not ready. error code=%08x\n", rval);
 #endif
 		splx(s);
+		return;
 	}
 
 	if ((pmdata.data[2] & 0x10) == 0x10) {
@@ -821,6 +822,7 @@ pm_intr_pm2(void *arg)
 			printf("pm: PM is not ready. error code: %08x\n", rval);
 #endif
 		splx(s);
+		return;
 	}
 
 	switch ((u_int)(pmdata.data[2] & 0xff)) {



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

2024-04-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Apr 26 00:59:08 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: pm_direct.c

Log Message:
Return early if PM data is not available.

This avoids random crashes on my Powerbook when using the mouse or keyboard.

The same was needed for the Powerbook 5xx/Duos (compile tested only).

XXX pullup-10, pullup-9, pullup-8.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/mac68k/dev/pm_direct.c

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



CVS commit: src/doc

2024-03-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Mar 13 08:13:56 UTC 2024

Modified Files:
src/doc: CHANGES

Log Message:
Mention ascaudio(4).


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

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



CVS commit: src/doc

2024-03-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Mar 13 08:13:56 UTC 2024

Modified Files:
src/doc: CHANGES

Log Message:
Mention ascaudio(4).


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.3043 src/doc/CHANGES:1.3044
--- src/doc/CHANGES:1.3043	Sun Mar  3 17:43:32 2024
+++ src/doc/CHANGES	Wed Mar 13 08:13:56 2024
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3043 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3044 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -285,3 +285,4 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 	bind: Import 9.18.24 [christos 20240221]
 	sqlite3(1): Import 3.45.1. [christos 20240301]
 	elftoolchain: Import svn r4037. [christos 20240303]
+	mac68k: Add ascaudio(4) ASC audio driver. [nat 20240313]



CVS commit: src/sys/arch/mac68k

2024-03-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Mar 13 07:55:29 UTC 2024

Modified Files:
src/sys/arch/mac68k/conf: files.mac68k majors.mac68k
Added Files:
src/sys/arch/mac68k/conf: AUDIO AUDIOSBC
src/sys/arch/mac68k/obio: ascaudio.c ascaudiovar.h ascreg.h

Log Message:
Apple Sound Chip audio support for 68k Macintoshoes.

This provies a sound device and support for wsbell(4).

Manual page to be added in a followup commit.

As posted to port-mac68k.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/mac68k/conf/AUDIO \
src/sys/arch/mac68k/conf/AUDIOSBC
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/mac68k/conf/files.mac68k
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/mac68k/conf/majors.mac68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/mac68k/obio/ascaudio.c \
src/sys/arch/mac68k/obio/ascaudiovar.h src/sys/arch/mac68k/obio/ascreg.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/mac68k/conf/files.mac68k
diff -u src/sys/arch/mac68k/conf/files.mac68k:1.132 src/sys/arch/mac68k/conf/files.mac68k:1.133
--- src/sys/arch/mac68k/conf/files.mac68k:1.132	Tue Jan  9 04:16:25 2024
+++ src/sys/arch/mac68k/conf/files.mac68k	Wed Mar 13 07:55:28 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.mac68k,v 1.132 2024/01/09 04:16:25 thorpej Exp $
+#	$NetBSD: files.mac68k,v 1.133 2024/03/13 07:55:28 nat Exp $
 
 # mac68k-specific configuration info
 
@@ -43,10 +43,16 @@ device	ams: wsmousedev
 attach	ams at adb
 file	arch/mac68k/dev/ams.c		ams needs-flag
 
+# ASC (beeper)
 device	asc
 attach	asc at obio
 file	arch/mac68k/obio/asc.c		asc needs-flag
 
+#ASC audio
+device	ascaudio: audiobus, auconv, mulaw, aurateconv, auvolconv
+attach	ascaudio at obio
+file	arch/mac68k/obio/ascaudio.c	ascaudio needs-flag
+
 device	nubus { }
 attach	nubus at mainbus
 file	arch/mac68k/nubus/nubus.c	nubus

Index: src/sys/arch/mac68k/conf/majors.mac68k
diff -u src/sys/arch/mac68k/conf/majors.mac68k:1.27 src/sys/arch/mac68k/conf/majors.mac68k:1.28
--- src/sys/arch/mac68k/conf/majors.mac68k:1.27	Sat Apr  4 16:06:14 2020
+++ src/sys/arch/mac68k/conf/majors.mac68k	Wed Mar 13 07:55:28 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.mac68k,v 1.27 2020/04/04 16:06:14 jdolecek Exp $
+#	$NetBSD: majors.mac68k,v 1.28 2024/03/13 07:55:28 nat Exp $
 #
 # Device majors for mac68k
 #
@@ -52,6 +52,7 @@ device-major	ksyms		char 52			ksyms
 device-major	wsfont		char 53			wsfont
 device-major	cpi		char 54			cpi
 device-major	sysmon		char 55			sysmon
+device-major	audio		char 56			audio
 
 #device-major	obsolete	char 98			obsolete (nsmb)
 

Added files:

Index: src/sys/arch/mac68k/conf/AUDIO
diff -u /dev/null src/sys/arch/mac68k/conf/AUDIO:1.1
--- /dev/null	Wed Mar 13 07:55:29 2024
+++ src/sys/arch/mac68k/conf/AUDIO	Wed Mar 13 07:55:28 2024
@@ -0,0 +1,17 @@
+# $NetBSD: AUDIO,v 1.1 2024/03/13 07:55:28 nat Exp $
+#
+# WSFB with audio enabled.
+
+include 	"arch/mac68k/conf/WSFB"
+
+no asc0 at obio?
+
+# DEFQUALTY	0x0	22257 Monaural playback.
+# LOWQUALITY	0x1	Half playback rate.
+# HIGHQUALITY	0x2	Best Quality supported by ASC.
+
+ascaudio*	at obio? flags 0x0		# ASC/EASC audio
+audio*		at audiobus?
+spkr*		at audio?			# PC speaker (synthesized)
+wsbell*		at spkr? 			# Console beep
+
Index: src/sys/arch/mac68k/conf/AUDIOSBC
diff -u /dev/null src/sys/arch/mac68k/conf/AUDIOSBC:1.1
--- /dev/null	Wed Mar 13 07:55:29 2024
+++ src/sys/arch/mac68k/conf/AUDIOSBC	Wed Mar 13 07:55:28 2024
@@ -0,0 +1,17 @@
+# $NetBSD: AUDIOSBC,v 1.1 2024/03/13 07:55:28 nat Exp $
+#
+# WSFB with audio enabled.
+
+include 	"arch/mac68k/conf/WSFBSBC"
+
+no asc0 at obio?
+
+# DEFQUALTY	0x0	22257 Monaural playback.
+# LOWQUALITY	0x1	Half playback rate.
+# HIGHQUALITY	0x2	Best Quality supported by ASC.
+
+ascaudio*	at obio? flags 0x0		# ASC/EASC audio
+audio*		at audiobus?
+spkr*		at audio?			# PC speaker (synthesized)
+wsbell*		at spkr? 			# Console beep
+

Index: src/sys/arch/mac68k/obio/ascaudio.c
diff -u /dev/null src/sys/arch/mac68k/obio/ascaudio.c:1.1
--- /dev/null	Wed Mar 13 07:55:29 2024
+++ src/sys/arch/mac68k/obio/ascaudio.c	Wed Mar 13 07:55:28 2024
@@ -0,0 +1,970 @@
+/* $NetBSD: ascaudio.c,v 1.1 2024/03/13 07:55:28 nat Exp $ */
+
+/*-
+ * Copyright (c) 2017, 2023 Nathanial Sloss 
+ * 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 IMPL

CVS commit: src/sys/arch/mac68k

2024-03-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Mar 13 07:55:29 UTC 2024

Modified Files:
src/sys/arch/mac68k/conf: files.mac68k majors.mac68k
Added Files:
src/sys/arch/mac68k/conf: AUDIO AUDIOSBC
src/sys/arch/mac68k/obio: ascaudio.c ascaudiovar.h ascreg.h

Log Message:
Apple Sound Chip audio support for 68k Macintoshoes.

This provies a sound device and support for wsbell(4).

Manual page to be added in a followup commit.

As posted to port-mac68k.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/mac68k/conf/AUDIO \
src/sys/arch/mac68k/conf/AUDIOSBC
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/mac68k/conf/files.mac68k
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/mac68k/conf/majors.mac68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/mac68k/obio/ascaudio.c \
src/sys/arch/mac68k/obio/ascaudiovar.h src/sys/arch/mac68k/obio/ascreg.h

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



CVS commit: src/sys/netbt

2024-03-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Mar 13 07:22:16 UTC 2024

Added Files:
src/sys/netbt: hci_le.h

Log Message:
Bluetooth low energy - A beginning at least.

This was the start of support for low energy bluetooth support that I have
not as yet completed.

I'm committing this as it gives the hci defines for an impementation in NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/netbt/hci_le.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/netbt/hci_le.h
diff -u /dev/null src/sys/netbt/hci_le.h:1.1
--- /dev/null	Wed Mar 13 07:22:16 2024
+++ src/sys/netbt/hci_le.h	Wed Mar 13 07:22:16 2024
@@ -0,0 +1,368 @@
+/* $NetBSD: hci_le.h,v 1.1 2024/03/13 07:22:16 nat Exp $ */
+
+/*-
+ * Copyright (c) 2020 Nathanial Sloss 
+ * 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.
+ */
+
+#define HCI_ADVERT_DATA_SIZE		31  /* advertising data size */
+#define HCI_SCAN_DATA_SIZE		31  /* scan resp. data size */
+ 
+/* LE Event masks */
+#define HCI_LE_EVMSK_ALL			0x001f
+#define HCI_LE_EVMSK_NONE			0x
+#define HCI_LE_EVMSK_CON_COMPL			0x0001
+#define HCI_LE_EVMSK_ADV_REPORT			0x0002
+#define HCI_LE_EVMSK_CON_UPDATE_COMPL		0x0004
+#define HCI_LE_EVMSK_READ_REMOTE_FEATURES_COMPL	0x0008
+#define HCI_LE_EVMSK_LONG_TERM_KEY_REQ		0x0010
+/* 0x0020 - 0x8000 - reserved for future use */
+
+/**
+ **
+ ** OGF 0x08	Bluetooth Low Energy (LE) Link commands
+ **
+ **/
+
+#define HCI_OGF_LE0x08
+
+#define HCI_OCF_LE_SET_EVENT_MASK			0x0001
+#define HCI_CMD_LE_SET_EVENT_MASK			0x2001
+typedef struct {
+	uint8_t		event_mask[HCI_EVENT_MASK_SIZE]; /* event_mask */
+} __packed hci_le_set_event_mask_cp;
+
+typedef hci_status_rp	hci_le_set_event_mask_rp;
+
+#define HCI_OCF_LE_READ_BUFFER_SIZE			0x0002
+#define HCI_CMD_LE_READ_BUFFER_SIZE			0x2002
+/* No command parameter(s) */
+
+typedef struct {
+	uint8_t		status; 	/* status 0x00 = success */
+	uint16_t	le_data_pktlen; /* buffer len*/
+	uint8_t		le_num_pkts; 	/* no. acl data packets */
+} __packed hci_le_read_buffer_size_rp;
+
+#define HCI_OCF_LE_READ_LOCAL_FEATURES			0x0003
+#define HCI_CMD_LE_READ_LOCAL_FEATURES			0x2003
+/* No command parameter(s) */
+
+typedef struct {
+	uint8_t		status; 	/* status 0x00 = success */
+	uint8_t		features[HCI_FEATURES_SIZE];	/* le features */
+} __packed hci_le_read_local_features_rp;
+
+#define HCI_OCF_LE_SET_RND_ADDR0x0005
+#define HCI_CMD_LE_SET_RND_ADDR0x2005
+typedef struct {
+	bdaddr_t	bdaddr; 	/* random local address */
+} __packed hci_le_set_rnd_addr_cp;
+
+typedef hci_status_rp	hci_le_set_rnd_addr_rp;
+/* XXX NS Finish defines. */
+#define HCI_OCF_LE_SET_ADVERT_PARAM			0x0006
+#define HCI_CMD_LE_SET_ADVERT_PARAM			0x2006
+typedef struct {
+	uint16_t	min_interval; 	/* min interval * 0.625ms */
+	uint16_t	max_interval; 	/* max_interval * 0.625ms */
+	uint8_t		advert_type;
+	uint8_t		own_address_type;
+	uint8_t		direct_address_type;
+	bdaddr_t	direct_address; /* remote address */
+	uint8_t		advert_channel_map;
+	uint8_t		advert_filter_policy;
+} __packed hci_le_set_advert_param_cp;
+
+typedef hci_status_rp	hci_le_set_advert_param_rp;
+
+#define HCF_OCF_LE_READ_ADVERT_CHAN_TX_PWR		0x0007
+#define HCF_CMD_LE_READ_ADV

CVS commit: src/sys/netbt

2024-03-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Mar 13 07:22:16 UTC 2024

Added Files:
src/sys/netbt: hci_le.h

Log Message:
Bluetooth low energy - A beginning at least.

This was the start of support for low energy bluetooth support that I have
not as yet completed.

I'm committing this as it gives the hci defines for an impementation in NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/netbt/hci_le.h

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



CVS commit: src/sys/arch

2024-02-27 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Feb 27 16:07:02 UTC 2024

Modified Files:
src/sys/arch/evbcf/include: cpu.h
src/sys/arch/m68k/include: cpu.h
src/sys/arch/mac68k/include: cpu.h

Log Message:
Use proper clockframe size for those platforms that require it.

XXX This is a tempory measure, better to fix clock interrupts to take the
common clockframe size.

OK thorpej@.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbcf/include/cpu.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/m68k/include/cpu.h
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/mac68k/include/cpu.h

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

Modified files:

Index: src/sys/arch/evbcf/include/cpu.h
diff -u src/sys/arch/evbcf/include/cpu.h:1.9 src/sys/arch/evbcf/include/cpu.h:1.10
--- src/sys/arch/evbcf/include/cpu.h:1.9	Sat Jan 20 00:15:31 2024
+++ src/sys/arch/evbcf/include/cpu.h	Tue Feb 27 16:07:02 2024
@@ -1,3 +1,7 @@
-/*	$NetBSD: cpu.h,v 1.9 2024/01/20 00:15:31 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.10 2024/02/27 16:07:02 nat Exp $	*/
+
+#ifndef CLOCK_FORMAT0
+#define CLOCK_FORMAT0
+#endif
 
 #include 

Index: src/sys/arch/m68k/include/cpu.h
diff -u src/sys/arch/m68k/include/cpu.h:1.23 src/sys/arch/m68k/include/cpu.h:1.24
--- src/sys/arch/m68k/include/cpu.h:1.23	Sat Jan 20 02:23:15 2024
+++ src/sys/arch/m68k/include/cpu.h	Tue Feb 27 16:07:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.23 2024/01/20 02:23:15 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.24 2024/02/27 16:07:02 nat Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -149,8 +149,10 @@ void	cpu_proc_fork(struct proc *, struct
  * what the interrupt stub puts on the stack before calling C code.
  */
 struct clockframe {
+#ifndef CLOCK_FORMAT0
 	/* regs saved on the stack by the interrupt stub */
 	u_int	cf_regs[4];	/* d0,d1,a0,a1 */
+#endif
 	/* hardware frame */
 	u_short	cf_sr;		/* sr at time of interrupt */
 	u_long	cf_pc;		/* pc at time of interrupt */

Index: src/sys/arch/mac68k/include/cpu.h
diff -u src/sys/arch/mac68k/include/cpu.h:1.105 src/sys/arch/mac68k/include/cpu.h:1.106
--- src/sys/arch/mac68k/include/cpu.h:1.105	Sat Jan 20 00:15:32 2024
+++ src/sys/arch/mac68k/include/cpu.h	Tue Feb 27 16:07:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.105 2024/01/20 00:15:32 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.106 2024/02/27 16:07:02 nat Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -60,6 +60,10 @@
 #ifndef _CPU_MACHINE_
 #define _CPU_MACHINE_
 
+#ifndef CLOCK_FORMAT0
+#define CLOCK_FORMAT0
+#endif
+
 #if defined(_KERNEL_OPT)
 #include "opt_lockdebug.h"
 #endif



CVS commit: src/sys/arch

2024-02-27 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Feb 27 16:07:02 UTC 2024

Modified Files:
src/sys/arch/evbcf/include: cpu.h
src/sys/arch/m68k/include: cpu.h
src/sys/arch/mac68k/include: cpu.h

Log Message:
Use proper clockframe size for those platforms that require it.

XXX This is a tempory measure, better to fix clock interrupts to take the
common clockframe size.

OK thorpej@.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbcf/include/cpu.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/m68k/include/cpu.h
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/mac68k/include/cpu.h

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



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

2024-01-21 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Mon Jan 22 06:28:49 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: sbcvar.h

Log Message:
Missing '\'

Many thnanks rillig@

XXX-pullup10.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mac68k/dev/sbcvar.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/mac68k/dev/sbcvar.h
diff -u src/sys/arch/mac68k/dev/sbcvar.h:1.13 src/sys/arch/mac68k/dev/sbcvar.h:1.14
--- src/sys/arch/mac68k/dev/sbcvar.h:1.13	Sat Feb 18 13:28:05 2023
+++ src/sys/arch/mac68k/dev/sbcvar.h	Mon Jan 22 06:28:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbcvar.h,v 1.13 2023/02/18 13:28:05 nat Exp $	*/
+/*	$NetBSD: sbcvar.h,v 1.14 2024/01/22 06:28:49 nat Exp $	*/
 
 /*
  * Copyright (C) 1996 Scott Reynolds.  All rights reserved.
@@ -82,7 +82,7 @@ struct sbc_softc {
 #define	SBC_RESELECT		0x04	/* Allow disconnect/reselect */
 #define	SBC_PDMA_NO_WRITE	0x08	/* No PDMA for writes */
 #define	SBC_OPTIONS_MASK (SBC_PDMA_NO_WRITE|SBC_RESELECT|SBC_INTR|SBC_PDMA)
-#define	SBC_OPTIONS_BITS	"\10\4NOWRITE3RESELECT\2INTR\1PDMA"
+#define	SBC_OPTIONS_BITS	"\10\4NOWRITE\3RESELECT\2INTR\1PDMA"
 
 extern int	sbc_debug;
 extern int	sbc_link_flags;



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

2024-01-21 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Mon Jan 22 06:28:49 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev: sbcvar.h

Log Message:
Missing '\'

Many thnanks rillig@

XXX-pullup10.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mac68k/dev/sbcvar.h

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



CVS commit: src/sys/dev/hid

2023-10-16 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Oct 17 02:46:57 UTC 2023

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

Log Message:
Improve hid matching.

It now matches all kinds (application/physical/logical) in the hid
collection.

Patch from PR applied.

Addresses PR/46868.

Ok skrll@


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hid/hid.c

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

Modified files:

Index: src/sys/dev/hid/hid.c
diff -u src/sys/dev/hid/hid.c:1.5 src/sys/dev/hid/hid.c:1.6
--- src/sys/dev/hid/hid.c:1.5	Sun Mar 13 11:35:47 2022
+++ src/sys/dev/hid/hid.c	Tue Oct 17 02:46:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: hid.c,v 1.5 2022/03/13 11:35:47 riastradh Exp $	*/
+/*	$NetBSD: hid.c,v 1.6 2023/10/17 02:46:57 nat Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/hid.c,v 1.11 1999/11/17 22:33:39 n_hibma Exp $ */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.5 2022/03/13 11:35:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.6 2023/10/17 02:46:57 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -519,13 +519,15 @@ hid_is_collection(const void *desc, int 
 			hi.kind, hi.report_ID, hi.usage, coll_usage));
 
 		if (hi.kind == hid_collection &&
-		hi.collection == HCOLL_APPLICATION)
+		(hi.collection == HCOLL_APPLICATION ||
+		hi.collection == HCOLL_PHYSICAL ||
+		hi.collection == HCOLL_LOGICAL))
 			coll_usage = hi.usage;
 
 		if (hi.kind == hid_endcollection)
 			coll_usage = ~0;
 
-		if (hi.kind == hid_input &&
+		if (hi.kind == hid_collection &&
 		coll_usage == usage &&
 		hi.report_ID == id) {
 			DPRINTFN(2,("hid_is_collection: found\n"));



CVS commit: src/sys/dev/hid

2023-10-16 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Oct 17 02:46:57 UTC 2023

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

Log Message:
Improve hid matching.

It now matches all kinds (application/physical/logical) in the hid
collection.

Patch from PR applied.

Addresses PR/46868.

Ok skrll@


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hid/hid.c

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



CVS commit: src/sys/dev/ic

2023-08-08 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Aug  8 17:31:13 UTC 2023

Modified Files:
src/sys/dev/ic: hd44780_subr.c hd44780var.h

Log Message:
Avoid adding another member to the softc and use sc_flags instead.

NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/ic/hd44780_subr.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/hd44780var.h

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

Modified files:

Index: src/sys/dev/ic/hd44780_subr.c
diff -u src/sys/dev/ic/hd44780_subr.c:1.23 src/sys/dev/ic/hd44780_subr.c:1.24
--- src/sys/dev/ic/hd44780_subr.c:1.23	Tue Aug  8 16:32:39 2023
+++ src/sys/dev/ic/hd44780_subr.c	Tue Aug  8 17:31:13 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: hd44780_subr.c,v 1.23 2023/08/08 16:32:39 nat Exp $ */
+/* $NetBSD: hd44780_subr.c,v 1.24 2023/08/08 17:31:13 nat Exp $ */
 
 /*
  * Copyright (c) 2002 Dennis I. Chernoivanov
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hd44780_subr.c,v 1.23 2023/08/08 16:32:39 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hd44780_subr.c,v 1.24 2023/08/08 17:31:13 nat Exp $");
 
 #include 
 #include 
@@ -458,7 +458,8 @@ hd44780_chipinit(struct hd44780_chip *sc
 	hd44780_ir_write(sc, en, cmd_ddramset(0x5));
 	hd44780_ir_write(sc, en, cmd_shift(0, 1));
 	hd44780_busy_wait(sc, en);
-	if (!sc->sc_writeonly && (dat = hd44780_ir_read(sc, en) & 0x7f) != 0x6) {
+	if (!(sc->sc_flags & HD_WRITEONLY) &&
+	(dat = hd44780_ir_read(sc, en) & 0x7f) != 0x6) {
 		sc->sc_dev_ok = 0;
 		sc->sc_flags &= ~HD_UP;
 		return EIO;

Index: src/sys/dev/ic/hd44780var.h
diff -u src/sys/dev/ic/hd44780var.h:1.10 src/sys/dev/ic/hd44780var.h:1.11
--- src/sys/dev/ic/hd44780var.h:1.10	Tue Aug  8 16:32:39 2023
+++ src/sys/dev/ic/hd44780var.h	Tue Aug  8 17:31:13 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: hd44780var.h,v 1.10 2023/08/08 16:32:39 nat Exp $ */
+/* $NetBSD: hd44780var.h,v 1.11 2023/08/08 17:31:13 nat Exp $ */
 
 /*
  * Copyright (c) 2002 Dennis I. Chernoivanov
@@ -97,6 +97,7 @@ struct hd44780_chip {
 #define HD_UP			0x10	/* if set, lcd has been initialized */
 #define HD_TIMEDOUT		0x20	/* lcd has recently stopped talking */
 #define HD_MULTICHIP		0x40	/* two HD44780 controllers (4-line) */
+#define HD_WRITEONLY		0x80	/* write only if set */
 	uint8_t sc_flags;
 
 	uint8_t sc_cols;		/* visible columns */
@@ -118,7 +119,6 @@ struct hd44780_chip {
 	void (* sc_writereg)(struct hd44780_chip *, uint32_t, uint32_t,
 	  uint8_t);
 	uint8_t (* sc_readreg)(struct hd44780_chip *, uint32_t, uint32_t);
-	bool sc_writeonly;		/* Output only device */
 };
 
 #define hd44780_ir_write(sc, en, dat) \



CVS commit: src/sys/dev/ic

2023-08-08 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Aug  8 17:31:13 UTC 2023

Modified Files:
src/sys/dev/ic: hd44780_subr.c hd44780var.h

Log Message:
Avoid adding another member to the softc and use sc_flags instead.

NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/ic/hd44780_subr.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/hd44780var.h

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



CVS commit: src/sys/dev/ic

2023-08-08 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Aug  8 16:32:39 UTC 2023

Modified Files:
src/sys/dev/ic: hd44780_subr.c hd44780var.h

Log Message:
Add a flag for output only devices and attachments.

It is necessary to skip the test for the device as output only attached
devices lack the ability for the device to be probed - such as the 1602 lcd
module.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ic/hd44780_subr.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/hd44780var.h

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

Modified files:

Index: src/sys/dev/ic/hd44780_subr.c
diff -u src/sys/dev/ic/hd44780_subr.c:1.22 src/sys/dev/ic/hd44780_subr.c:1.23
--- src/sys/dev/ic/hd44780_subr.c:1.22	Tue Aug  8 16:29:00 2023
+++ src/sys/dev/ic/hd44780_subr.c	Tue Aug  8 16:32:39 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: hd44780_subr.c,v 1.22 2023/08/08 16:29:00 nat Exp $ */
+/* $NetBSD: hd44780_subr.c,v 1.23 2023/08/08 16:32:39 nat Exp $ */
 
 /*
  * Copyright (c) 2002 Dennis I. Chernoivanov
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hd44780_subr.c,v 1.22 2023/08/08 16:29:00 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hd44780_subr.c,v 1.23 2023/08/08 16:32:39 nat Exp $");
 
 #include 
 #include 
@@ -458,7 +458,7 @@ hd44780_chipinit(struct hd44780_chip *sc
 	hd44780_ir_write(sc, en, cmd_ddramset(0x5));
 	hd44780_ir_write(sc, en, cmd_shift(0, 1));
 	hd44780_busy_wait(sc, en);
-	if ((dat = hd44780_ir_read(sc, en) & 0x7f) != 0x6) {
+	if (!sc->sc_writeonly && (dat = hd44780_ir_read(sc, en) & 0x7f) != 0x6) {
 		sc->sc_dev_ok = 0;
 		sc->sc_flags &= ~HD_UP;
 		return EIO;

Index: src/sys/dev/ic/hd44780var.h
diff -u src/sys/dev/ic/hd44780var.h:1.9 src/sys/dev/ic/hd44780var.h:1.10
--- src/sys/dev/ic/hd44780var.h:1.9	Tue Aug  8 16:29:00 2023
+++ src/sys/dev/ic/hd44780var.h	Tue Aug  8 16:32:39 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: hd44780var.h,v 1.9 2023/08/08 16:29:00 nat Exp $ */
+/* $NetBSD: hd44780var.h,v 1.10 2023/08/08 16:32:39 nat Exp $ */
 
 /*
  * Copyright (c) 2002 Dennis I. Chernoivanov
@@ -118,6 +118,7 @@ struct hd44780_chip {
 	void (* sc_writereg)(struct hd44780_chip *, uint32_t, uint32_t,
 	  uint8_t);
 	uint8_t (* sc_readreg)(struct hd44780_chip *, uint32_t, uint32_t);
+	bool sc_writeonly;		/* Output only device */
 };
 
 #define hd44780_ir_write(sc, en, dat) \



CVS commit: src/sys/dev/ic

2023-08-08 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Aug  8 16:32:39 UTC 2023

Modified Files:
src/sys/dev/ic: hd44780_subr.c hd44780var.h

Log Message:
Add a flag for output only devices and attachments.

It is necessary to skip the test for the device as output only attached
devices lack the ability for the device to be probed - such as the 1602 lcd
module.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ic/hd44780_subr.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/hd44780var.h

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



CVS commit: src/sys/dev/ic

2023-08-08 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Aug  8 16:29:00 UTC 2023

Modified Files:
src/sys/dev/ic: hd44780_subr.c hd44780var.h

Log Message:
Add a detach function.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/hd44780_subr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/hd44780var.h

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

Modified files:

Index: src/sys/dev/ic/hd44780_subr.c
diff -u src/sys/dev/ic/hd44780_subr.c:1.21 src/sys/dev/ic/hd44780_subr.c:1.22
--- src/sys/dev/ic/hd44780_subr.c:1.21	Sat Nov 13 13:52:01 2010
+++ src/sys/dev/ic/hd44780_subr.c	Tue Aug  8 16:29:00 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: hd44780_subr.c,v 1.21 2010/11/13 13:52:01 uebayasi Exp $ */
+/* $NetBSD: hd44780_subr.c,v 1.22 2023/08/08 16:29:00 nat Exp $ */
 
 /*
  * Copyright (c) 2002 Dennis I. Chernoivanov
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hd44780_subr.c,v 1.21 2010/11/13 13:52:01 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hd44780_subr.c,v 1.22 2023/08/08 16:29:00 nat Exp $");
 
 #include 
 #include 
@@ -393,6 +393,15 @@ hd44780_attach_subr(struct hd44780_chip 
 	callout_setfunc(&sc->redraw, hlcd_redraw, sc);
 }
 
+void hd44780_detach(struct hd44780_chip *sc)
+{
+	callout_stop(&sc->redraw);
+	callout_destroy(&sc->redraw);
+
+	if (sc->sc_screen.image)
+		free(sc->sc_screen.image, M_DEVBUF);
+}
+
 int hd44780_init(struct hd44780_chip *sc)
 {
 	int ret;

Index: src/sys/dev/ic/hd44780var.h
diff -u src/sys/dev/ic/hd44780var.h:1.8 src/sys/dev/ic/hd44780var.h:1.9
--- src/sys/dev/ic/hd44780var.h:1.8	Sun Sep  6 06:01:00 2015
+++ src/sys/dev/ic/hd44780var.h	Tue Aug  8 16:29:00 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: hd44780var.h,v 1.8 2015/09/06 06:01:00 dholland Exp $ */
+/* $NetBSD: hd44780var.h,v 1.9 2023/08/08 16:29:00 nat Exp $ */
 
 /*
  * Copyright (c) 2002 Dennis I. Chernoivanov
@@ -136,6 +136,7 @@ struct hd44780_chip {
 	(sc)->sc_readreg((sc), (en), 1)
 
 void hd44780_attach_subr(struct hd44780_chip *);
+void hd44780_detach(struct hd44780_chip *);
 void hd44780_busy_wait(struct hd44780_chip *, uint32_t);
 int  hd44780_init(struct hd44780_chip *);
 int  hd44780_chipinit(struct hd44780_chip *, uint32_t);



CVS commit: src/sys/dev/ic

2023-08-08 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Aug  8 16:29:00 UTC 2023

Modified Files:
src/sys/dev/ic: hd44780_subr.c hd44780var.h

Log Message:
Add a detach function.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/hd44780_subr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/hd44780var.h

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



CVS commit: src/doc

2023-07-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Jul 21 02:42:54 UTC 2023

Modified Files:
src/doc: CHANGES

Log Message:
Add missing dot.


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2982 src/doc/CHANGES:1.2983
--- src/doc/CHANGES:1.2982	Fri Jul 21 02:16:20 2023
+++ src/doc/CHANGES	Fri Jul 21 02:42:54 2023
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2982 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2983 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -162,4 +162,4 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 	openpam(3): update to 20230627 (ximenia) [christos 20230630]
 	gcc(1): Import GCC 10.5.  [mrg 20230710]
 	dhcpcd: Import version 10.0.2. [roy 20230719]
-	bta2dpd(8): Add throttle when playing from file [nat 20230720]
+	bta2dpd(8): Add throttle when playing from file. [nat 20230720]



CVS commit: src/doc

2023-07-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Jul 21 02:42:54 UTC 2023

Modified Files:
src/doc: CHANGES

Log Message:
Add missing dot.


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

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



CVS commit: src/doc

2023-07-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Jul 21 02:16:20 UTC 2023

Modified Files:
src/doc: CHANGES

Log Message:
Mention changes to bta2dpd(8).


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

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



CVS commit: src/doc

2023-07-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Jul 21 02:16:20 UTC 2023

Modified Files:
src/doc: CHANGES

Log Message:
Mention changes to bta2dpd(8).


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2981 src/doc/CHANGES:1.2982
--- src/doc/CHANGES:1.2981	Wed Jul 19 13:59:01 2023
+++ src/doc/CHANGES	Fri Jul 21 02:16:20 2023
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2981 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2982 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -162,3 +162,4 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 	openpam(3): update to 20230627 (ximenia) [christos 20230630]
 	gcc(1): Import GCC 10.5.  [mrg 20230710]
 	dhcpcd: Import version 10.0.2. [roy 20230719]
+	bta2dpd(8): Add throttle when playing from file [nat 20230720]



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

2023-07-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Jul 21 02:11:18 UTC 2023

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

Log Message:
Reorder for readability.

No functional change intended.

XXX pullup-10.


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

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

Modified files:

Index: src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.12 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.13
--- src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.12	Thu Jul 20 12:33:27 2023
+++ src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	Fri Jul 21 02:11:18 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: sbc_encode.c,v 1.12 2023/07/20 12:33:27 nat Exp $ */
+/* $NetBSD: sbc_encode.c,v 1.13 2023/07/21 02:11:18 nat Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -952,8 +952,6 @@ stream(int in, int outfd, uint8_t mode, 
 	memcpy(whole + offset, frameData, (size_t)next_pkt);
 	free(frameData);
 
-	tries = 1;
-
 	/* Wait if necessary to avoid rapid playback. */
 	gettimeofday(&myTime, NULL);
 	timeNow = myTime.tv_sec * 100 + myTime.tv_usec;
@@ -967,6 +965,7 @@ stream(int in, int outfd, uint8_t mode, 
 	}
 	prevTime = timeNow;
 
+	tries = 1;
 send_again:
 	len = write(outfd, whole, totalSize);
 



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

2023-07-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Jul 21 02:11:18 UTC 2023

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

Log Message:
Reorder for readability.

No functional change intended.

XXX pullup-10.


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

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



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

2023-07-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Jul 20 13:31:31 UTC 2023

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

Log Message:
Fix formatting.

XXX pullup-10.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8

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



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

2023-07-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Jul 20 13:31:31 UTC 2023

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

Log Message:
Fix formatting.

XXX pullup-10.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8

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

Modified files:

Index: src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8
diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.9 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.10
--- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.9	Thu Jul 20 13:28:47 2023
+++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8	Thu Jul 20 13:31:31 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bta2dpd.8,v 1.9 2023/07/20 13:28:47 nat Exp $
+.\"	$NetBSD: bta2dpd.8,v 1.10 2023/07/20 13:31:31 nat Exp $
 .\"
 .\" Copyright (c) 2015 - 2016  Nathanial Sloss 
 .\" All rights reserved.
@@ -116,7 +116,7 @@ Local device address.
 May be given as BDADDR or device name.
 .It Fl I
 Initiate a Discover command.
- Useful when used as an audio sink as some devices need this to pair.
+Useful when used as an audio sink as some devices need this to pair.
 .It Fl K
 Allows registering as an audio sink receiving an incoming connection.
 .It Fl M Ar mtu



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

2023-07-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Jul 20 13:28:48 UTC 2023

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

Log Message:
Add BUGS section to manual page.

This notes the problems with playback from file on certain devices.

XXX pullup-10


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

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



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

2023-07-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Jul 20 13:28:48 UTC 2023

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

Log Message:
Add BUGS section to manual page.

This notes the problems with playback from file on certain devices.

XXX pullup-10


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

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

Modified files:

Index: src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8
diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.8 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.9
--- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.8	Thu Jun 22 01:35:12 2023
+++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8	Thu Jul 20 13:28:47 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bta2dpd.8,v 1.8 2023/06/22 01:35:12 nat Exp $
+.\"	$NetBSD: bta2dpd.8,v 1.9 2023/07/20 13:28:47 nat Exp $
 .\"
 .\" Copyright (c) 2015 - 2016  Nathanial Sloss 
 .\" All rights reserved.
@@ -29,7 +29,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 20, 2023
+.Dd July 20, 2023
 .Dt BTA2DPD 8
 .Os
 .Sh NAME
@@ -289,3 +289,8 @@ and send to speakers.
 .Xr btconfig 8
 .Sh AUTHORS
 .An Nathanial Sloss
+.Sh BUGS
+For some devices playback from file results in rapid playback or playback with
+stutter.
+For best results use with
+.Xr pad 4 .



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

2023-07-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Jul 20 12:33:28 UTC 2023

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

Log Message:
Add thottling when playing from file.

This avoids rapid playback when playing from file with affected devices.

Playback using pad(4) is still preferred ad gives a better result.
Playback from pad(4) is unaffected by this change.

XXX pullup-10.


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

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

Modified files:

Index: src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.11 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.12
--- src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.11	Sun May 28 07:59:17 2023
+++ src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	Thu Jul 20 12:33:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: sbc_encode.c,v 1.11 2023/05/28 07:59:17 mlelstv Exp $ */
+/* $NetBSD: sbc_encode.c,v 1.12 2023/07/20 12:33:27 nat Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -32,6 +32,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -841,6 +842,7 @@ stream(int in, int outfd, uint8_t mode, 
 blocks, uint8_t alloc_method, uint8_t bitpool, size_t mtu, int volume)
 {
 	struct rtpHeader myHeader;
+	struct timeval myTime;
 	uint8_t *whole, *frameData;
 	int16_t music[2048];
 	ssize_t len, mySize[16], offset, next_pkt;
@@ -849,6 +851,7 @@ stream(int in, int outfd, uint8_t mode, 
 	size_t frequency;
 	static size_t ts = 0;
 	static uint16_t seqnumber = 0;
+	static time_t prevTime, readTime, sleepTime, timeNow;
 	int numpkts, tries;
 
 	global_mode = mode;
@@ -912,9 +915,11 @@ stream(int in, int outfd, uint8_t mode, 
 	next_pkt = 0;
 	len = 0;
 	pkt_len = 80;
+	readTime = 0;
 	while (totalSize + ((size_t)pkt_len * 2) <= mtu) {
 
 		len = readloop(in, music, readsize);
+		readTime += (time_t)readsize;
 		if (len < (int)readsize)
 			break;
 
@@ -934,6 +939,8 @@ stream(int in, int outfd, uint8_t mode, 
 		return -1;
 	}
 
+	readTime = readTime * 100 / 2 / global_chan / (time_t)frequency;
+
 	myHeader.numFrames = (uint8_t)numpkts;
 	whole = malloc(totalSize);
 	if (whole == NULL)
@@ -946,6 +953,20 @@ stream(int in, int outfd, uint8_t mode, 
 	free(frameData);
 
 	tries = 1;
+
+	/* Wait if necessary to avoid rapid playback. */
+	gettimeofday(&myTime, NULL);
+	timeNow = myTime.tv_sec * 100 + myTime.tv_usec;
+	if (prevTime == 0)
+		prevTime = timeNow;
+	else
+		sleepTime += readTime - (timeNow - prevTime);
+	if (sleepTime >= 1000) {
+		usleep(500);
+		sleepTime -= 1000;
+	}
+	prevTime = timeNow;
+
 send_again:
 	len = write(outfd, whole, totalSize);
 



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

2023-07-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Jul 20 12:33:28 UTC 2023

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

Log Message:
Add thottling when playing from file.

This avoids rapid playback when playing from file with affected devices.

Playback using pad(4) is still preferred ad gives a better result.
Playback from pad(4) is unaffected by this change.

XXX pullup-10.


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

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



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

2023-06-21 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Jun 22 01:35:12 UTC 2023

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

Log Message:
Bump date for previous commit.

XXX pullup-10.


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

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



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

2023-06-21 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Jun 22 01:35:12 UTC 2023

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

Log Message:
Bump date for previous commit.

XXX pullup-10.


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

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

Modified files:

Index: src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8
diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.7 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.8
--- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.7	Tue Jun 20 03:24:08 2023
+++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8	Thu Jun 22 01:35:12 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bta2dpd.8,v 1.7 2023/06/20 03:24:08 nat Exp $
+.\"	$NetBSD: bta2dpd.8,v 1.8 2023/06/22 01:35:12 nat Exp $
 .\"
 .\" Copyright (c) 2015 - 2016  Nathanial Sloss 
 .\" All rights reserved.
@@ -29,7 +29,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 27, 2019
+.Dd June 20, 2023
 .Dt BTA2DPD 8
 .Os
 .Sh NAME



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

2023-06-19 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Jun 20 03:24:08 UTC 2023

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

Log Message:
Manual page fixups.

Fix EXAMPLES section.

Use correct flags when used with pad(4).
Use correct encoding format (sinear_le).

XXX pullup-10.


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

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

Modified files:

Index: src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8
diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.6 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.7
--- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.6	Thu Dec  2 21:59:22 2021
+++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8	Tue Jun 20 03:24:08 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bta2dpd.8,v 1.6 2021/12/02 21:59:22 andvar Exp $
+.\"	$NetBSD: bta2dpd.8,v 1.7 2023/06/20 03:24:08 nat Exp $
 .\"
 .\" Copyright (c) 2015 - 2016  Nathanial Sloss 
 .\" All rights reserved.
@@ -267,7 +267,7 @@ Encode and send audio
 to address
 .Sq spkr .
 .Pp
-.Dl bta2dpd -a spkr /dev/pad
+.Dl bta2dpd -n -a spkr /dev/pad
 Encode and send audio from
 .Xr pad 4
 to address
@@ -278,7 +278,7 @@ Decode stream from any connected address
 and write it to
 .Pa out.pcm .
 .Pp
-.Dl bta2dpd -K -a phone | audioplay -f -e linear -P 16 -s 44100 -c 2 --
+.Dl bta2dpd -K -a phone | audioplay -f -e slinear_le -P 16 -s 44100 -c 2 --
 Decode stream from address
 .Sq phone
 and send to speakers.



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

2023-06-19 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Jun 20 03:24:08 UTC 2023

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

Log Message:
Manual page fixups.

Fix EXAMPLES section.

Use correct flags when used with pad(4).
Use correct encoding format (sinear_le).

XXX pullup-10.


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

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



CVS commit: src/sys/dev/pad

2023-05-27 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat May 27 14:51:47 UTC 2023

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

Log Message:
Revert to previous.

This change broke the intention of recent changes to pad(4).

The solution to address PR/57436 must be done in bta2dpd(8).


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/pad/pad.c

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

Modified files:

Index: src/sys/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.84 src/sys/dev/pad/pad.c:1.85
--- src/sys/dev/pad/pad.c:1.84	Fri May 26 12:10:13 2023
+++ src/sys/dev/pad/pad.c	Sat May 27 14:51:47 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.84 2023/05/26 12:10:13 nat Exp $ */
+/* $NetBSD: pad.c,v 1.85 2023/05/27 14:51:47 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.84 2023/05/26 12:10:13 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.85 2023/05/27 14:51:47 nat Exp $");
 
 #include 
 #include 
@@ -515,13 +515,13 @@ pad_read(struct pad_softc *sc, off_t *of
 	int err, first;
 
 	err = 0;
-	first = 0;
+	first = 1;
 	DPRINTF("%s: resid=%zu\n", __func__, uio->uio_resid);
 	while (uio->uio_resid > 0) {
 		mutex_enter(&sc->sc_intr_lock);
 		err = pad_get_block(sc, &pb, MIN(uio->uio_resid, INT_MAX), first);
 		mutex_exit(&sc->sc_intr_lock);
-		first = 1;
+		first = 0;
 		if (err == EAGAIN) {
 			err = 0;
 			break;



CVS commit: src/sys/dev/pad

2023-05-27 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat May 27 14:51:47 UTC 2023

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

Log Message:
Revert to previous.

This change broke the intention of recent changes to pad(4).

The solution to address PR/57436 must be done in bta2dpd(8).


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/pad/pad.c

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



CVS commit: src/sys/dev/pad

2023-05-26 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri May 26 12:10:13 UTC 2023

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

Log Message:
Fix previous.

The previous commit was misleading due to the flag names used.

The rationale for this change is that it is ok to return EAGAIN on first
read as playback has not started.  Then it shoud wait on every subsequent read.

This is what makes the high precsision throttling of pad(4), for which these
degree of fine-grained sleeps are not possible in userland.  This is a
requirement of users of pad(4) such as bta2dpd(8).


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/pad/pad.c

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

Modified files:

Index: src/sys/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.83 src/sys/dev/pad/pad.c:1.84
--- src/sys/dev/pad/pad.c:1.83	Fri May 26 10:39:56 2023
+++ src/sys/dev/pad/pad.c	Fri May 26 12:10:13 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.83 2023/05/26 10:39:56 nat Exp $ */
+/* $NetBSD: pad.c,v 1.84 2023/05/26 12:10:13 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.83 2023/05/26 10:39:56 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.84 2023/05/26 12:10:13 nat Exp $");
 
 #include 
 #include 
@@ -324,7 +324,7 @@ pad_get_block(struct pad_softc *sc, pad_
 	KASSERT(maxblksize > 0);
 	KASSERT(mutex_owned(&sc->sc_intr_lock));
 
-	if (sc->sc_buflen == 0 && dowait)
+	if (sc->sc_buflen == 0 && !dowait)
 		return EAGAIN;
 
 	while (sc->sc_buflen == 0) {
@@ -515,13 +515,13 @@ pad_read(struct pad_softc *sc, off_t *of
 	int err, first;
 
 	err = 0;
-	first = 1;
+	first = 0;
 	DPRINTF("%s: resid=%zu\n", __func__, uio->uio_resid);
 	while (uio->uio_resid > 0) {
 		mutex_enter(&sc->sc_intr_lock);
 		err = pad_get_block(sc, &pb, MIN(uio->uio_resid, INT_MAX), first);
 		mutex_exit(&sc->sc_intr_lock);
-		first = 0;
+		first = 1;
 		if (err == EAGAIN) {
 			err = 0;
 			break;



CVS commit: src/sys/dev/pad

2023-05-26 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri May 26 12:10:13 UTC 2023

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

Log Message:
Fix previous.

The previous commit was misleading due to the flag names used.

The rationale for this change is that it is ok to return EAGAIN on first
read as playback has not started.  Then it shoud wait on every subsequent read.

This is what makes the high precsision throttling of pad(4), for which these
degree of fine-grained sleeps are not possible in userland.  This is a
requirement of users of pad(4) such as bta2dpd(8).


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/pad/pad.c

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



CVS commit: src/sys/dev/pad

2023-05-26 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri May 26 10:39:56 UTC 2023

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

Log Message:
Fix logic for timing.

Addresses PR/57436.

XXX pullup-10.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/pad/pad.c

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



CVS commit: src/sys/dev/pad

2023-05-26 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri May 26 10:39:56 UTC 2023

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

Log Message:
Fix logic for timing.

Addresses PR/57436.

XXX pullup-10.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/pad/pad.c

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

Modified files:

Index: src/sys/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.82 src/sys/dev/pad/pad.c:1.83
--- src/sys/dev/pad/pad.c:1.82	Mon May  1 16:35:47 2023
+++ src/sys/dev/pad/pad.c	Fri May 26 10:39:56 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.82 2023/05/01 16:35:47 mlelstv Exp $ */
+/* $NetBSD: pad.c,v 1.83 2023/05/26 10:39:56 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.82 2023/05/01 16:35:47 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.83 2023/05/26 10:39:56 nat Exp $");
 
 #include 
 #include 
@@ -324,7 +324,7 @@ pad_get_block(struct pad_softc *sc, pad_
 	KASSERT(maxblksize > 0);
 	KASSERT(mutex_owned(&sc->sc_intr_lock));
 
-	if (sc->sc_buflen == 0 && !dowait)
+	if (sc->sc_buflen == 0 && dowait)
 		return EAGAIN;
 
 	while (sc->sc_buflen == 0) {



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

2023-05-22 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Mon May 22 22:36:53 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/i915drm: intelfb.c

Log Message:
Use the offset in mmap calculations.

It fixes wsfb(4) when used with intelfb(4).

Ok riastradh@

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/external/bsd/drm2/i915drm/intelfb.c

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

Modified files:

Index: src/sys/external/bsd/drm2/i915drm/intelfb.c
diff -u src/sys/external/bsd/drm2/i915drm/intelfb.c:1.24 src/sys/external/bsd/drm2/i915drm/intelfb.c:1.25
--- src/sys/external/bsd/drm2/i915drm/intelfb.c:1.24	Mon Jul 18 23:34:02 2022
+++ src/sys/external/bsd/drm2/i915drm/intelfb.c	Mon May 22 22:36:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: intelfb.c,v 1.24 2022/07/18 23:34:02 riastradh Exp $	*/
+/*	$NetBSD: intelfb.c,v 1.25 2023/05/22 22:36:53 nat Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.24 2022/07/18 23:34:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.25 2023/05/22 22:36:53 nat Exp $");
 
 #include 
 #include 
@@ -181,8 +181,8 @@ intelfb_drmfb_mmapfb(struct drmfb_softc 
 	KASSERT(0 <= offset);
 	KASSERT(offset < vma->node.size);
 
-	return bus_space_mmap(dev->bst, ggtt->gmadr.start, vma->node.start,
-	prot, BUS_SPACE_MAP_PREFETCHABLE);
+	return bus_space_mmap(dev->bst, ggtt->gmadr.start,
+	vma->node.start + offset, prot, BUS_SPACE_MAP_PREFETCHABLE);
 }
 
 static void



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

2023-05-22 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Mon May 22 22:36:53 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/i915drm: intelfb.c

Log Message:
Use the offset in mmap calculations.

It fixes wsfb(4) when used with intelfb(4).

Ok riastradh@

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/external/bsd/drm2/i915drm/intelfb.c

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



CVS commit: src/sys/arch/mac68k

2023-02-18 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Feb 18 13:28:05 UTC 2023

Modified Files:
src/sys/arch/mac68k/conf: GENERICSBC INSTALLSBC
src/sys/arch/mac68k/dev: sbc.c sbcvar.h

Log Message:
Introduce a flag to disable PDMA when writing.

The use of pdma when writing would always cause a panic on my Powerbook 160,
possibly others as well.

As posted to tech-kern.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/mac68k/conf/GENERICSBC
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mac68k/conf/INSTALLSBC
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/mac68k/dev/sbc.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mac68k/dev/sbcvar.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/mac68k/conf/GENERICSBC
diff -u src/sys/arch/mac68k/conf/GENERICSBC:1.56 src/sys/arch/mac68k/conf/GENERICSBC:1.57
--- src/sys/arch/mac68k/conf/GENERICSBC:1.56	Thu Mar 27 20:00:24 2008
+++ src/sys/arch/mac68k/conf/GENERICSBC	Sat Feb 18 13:28:05 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERICSBC,v 1.56 2008/03/27 20:00:24 hauke Exp $
+# $NetBSD: GENERICSBC,v 1.57 2023/02/18 13:28:05 nat Exp $
 #
 # GENERICSBC machine description file
 
@@ -12,7 +12,8 @@ include		"arch/mac68k/conf/GENERIC"
 
 no ncrscsi0# SCSI NCR 5380
 
-# SBC_PDMA  0x01Use PDMA for polled transfers
-# SBC_INTR  0x02Allow SCSI IRQ/DRQ interrupts
-# SBC_RESELECT  0x04Allow disconnect/reselect
+# SBC_PDMA		0x01Use PDMA for polled transfers
+# SBC_INTR		0x02Allow SCSI IRQ/DRQ interrupts
+# SBC_RESELECT		0x04Allow disconnect/reselect
+# SBC_PDMA_NO_WRITE	0x08Disallow PDMA for writing
 sbc0	at obio? addr 0 flags 0x1	# MI SCSI NCR 5380

Index: src/sys/arch/mac68k/conf/INSTALLSBC
diff -u src/sys/arch/mac68k/conf/INSTALLSBC:1.32 src/sys/arch/mac68k/conf/INSTALLSBC:1.33
--- src/sys/arch/mac68k/conf/INSTALLSBC:1.32	Thu Mar 27 20:00:24 2008
+++ src/sys/arch/mac68k/conf/INSTALLSBC	Sat Feb 18 13:28:05 2023
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALLSBC,v 1.32 2008/03/27 20:00:24 hauke Exp $
+# $NetBSD: INSTALLSBC,v 1.33 2023/02/18 13:28:05 nat Exp $
 #
 # INSTALLSBC machine description file
 
@@ -12,7 +12,8 @@ include		"arch/mac68k/conf/INSTALL"
 
 no ncrscsi0# SCSI NCR 5380
 
-# SBC_PDMA  0x01Use PDMA for polled transfers
-# SBC_INTR  0x02Allow SCSI IRQ/DRQ interrupts
-# SBC_RESELECT  0x04Allow disconnect/reselect
+# SBC_PDMA		0x01Use PDMA for polled transfers
+# SBC_INTR		0x02Allow SCSI IRQ/DRQ interrupts
+# SBC_RESELECT		0x04Allow disconnect/reselect
+# SBC_PDMA_NO_WRITE	0x08Disallow PDMA for writing
 sbc0	at obio? addr 0 flags 0x1	# MI SCSI NCR 5380

Index: src/sys/arch/mac68k/dev/sbc.c
diff -u src/sys/arch/mac68k/dev/sbc.c:1.58 src/sys/arch/mac68k/dev/sbc.c:1.59
--- src/sys/arch/mac68k/dev/sbc.c:1.58	Sat Feb 18 13:17:45 2023
+++ src/sys/arch/mac68k/dev/sbc.c	Sat Feb 18 13:28:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbc.c,v 1.58 2023/02/18 13:17:45 nat Exp $	*/
+/*	$NetBSD: sbc.c,v 1.59 2023/02/18 13:28:05 nat Exp $	*/
 
 /*
  * Copyright (C) 1996 Scott Reynolds.  All rights reserved.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sbc.c,v 1.58 2023/02/18 13:17:45 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbc.c,v 1.59 2023/02/18 13:28:05 nat Exp $");
 
 #include "opt_ddb.h"
 
@@ -318,6 +318,7 @@ sbc_pdma_out(struct ncr5380_softc *ncr_s
 
 	if (datalen < ncr_sc->sc_min_dma_len ||
 	(sc->sc_options & SBC_PDMA) == 0 ||
+	(sc->sc_options & SBC_PDMA_NO_WRITE) ||
 	(ncr_sc->sc_current != NULL &&
 	(ncr_sc->sc_current->sr_xs->xs_control & XS_CTL_POLL)))
 		return ncr5380_pio_out(ncr_sc, phase, datalen, data);

Index: src/sys/arch/mac68k/dev/sbcvar.h
diff -u src/sys/arch/mac68k/dev/sbcvar.h:1.12 src/sys/arch/mac68k/dev/sbcvar.h:1.13
--- src/sys/arch/mac68k/dev/sbcvar.h:1.12	Sun Dec 11 12:18:02 2005
+++ src/sys/arch/mac68k/dev/sbcvar.h	Sat Feb 18 13:28:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbcvar.h,v 1.12 2005/12/11 12:18:02 christos Exp $	*/
+/*	$NetBSD: sbcvar.h,v 1.13 2023/02/18 13:28:05 nat Exp $	*/
 
 /*
  * Copyright (C) 1996 Scott Reynolds.  All rights reserved.
@@ -77,11 +77,12 @@ struct sbc_softc {
  * The options code is based on the sparc 'si' driver's version of
  * the same.
  */ 
-#define	SBC_PDMA	0x01	/* Use PDMA for polled transfers */
-#define	SBC_INTR	0x02	/* Allow SCSI IRQ/DRQ interrupts */
-#define	SBC_RESELECT	0x04	/* Allow disconnect/reselect */
-#define	SBC_OPTIONS_MASK	(SBC_RESELECT|SBC_INTR|SBC_PDMA)
-#define	SBC_OPTIONS_BITS	"\10\3RESELECT\2INTR\1PDMA"
+#define	SBC_PDMA		0x01	/* Use PDMA for polled transfers */
+#define	SBC_INTR		0x02	/* Allow SCSI IRQ/DRQ interrupts */
+#define	SBC_RESELECT		0x04	/* Allow disconnect/reselect */
+#define	SBC_PDMA_NO_WRITE	0x08	/* No PDMA for writes */
+#define	SBC_OPTIONS_MASK (SBC_PDMA_NO_WRITE|SBC_RESELECT|SBC_INTR|SBC_PDMA)
+#define	SBC_OPTIONS_BITS	"\10\4NOWRITE3RESELECT\2INTR\1PDMA"
 
 extern

CVS commit: src/sys/arch/mac68k

2023-02-18 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Feb 18 13:28:05 UTC 2023

Modified Files:
src/sys/arch/mac68k/conf: GENERICSBC INSTALLSBC
src/sys/arch/mac68k/dev: sbc.c sbcvar.h

Log Message:
Introduce a flag to disable PDMA when writing.

The use of pdma when writing would always cause a panic on my Powerbook 160,
possibly others as well.

As posted to tech-kern.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/mac68k/conf/GENERICSBC
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mac68k/conf/INSTALLSBC
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/mac68k/dev/sbc.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mac68k/dev/sbcvar.h

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



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

2023-02-18 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Feb 18 13:17:45 UTC 2023

Modified Files:
src/sys/arch/mac68k/dev: sbc.c

Log Message:
Honor the XS_CTL_POLL flag and fallback to polled io instead of PDMA.

As posted to tech-kern.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/mac68k/dev/sbc.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/mac68k/dev/sbc.c
diff -u src/sys/arch/mac68k/dev/sbc.c:1.57 src/sys/arch/mac68k/dev/sbc.c:1.58
--- src/sys/arch/mac68k/dev/sbc.c:1.57	Mon Sep  3 16:29:25 2018
+++ src/sys/arch/mac68k/dev/sbc.c	Sat Feb 18 13:17:45 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbc.c,v 1.57 2018/09/03 16:29:25 riastradh Exp $	*/
+/*	$NetBSD: sbc.c,v 1.58 2023/02/18 13:17:45 nat Exp $	*/
 
 /*
  * Copyright (C) 1996 Scott Reynolds.  All rights reserved.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sbc.c,v 1.57 2018/09/03 16:29:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbc.c,v 1.58 2023/02/18 13:17:45 nat Exp $");
 
 #include "opt_ddb.h"
 
@@ -249,7 +249,9 @@ sbc_pdma_in(struct ncr5380_softc *ncr_sc
 	int resid, s;
 
 	if (datalen < ncr_sc->sc_min_dma_len ||
-	(sc->sc_options & SBC_PDMA) == 0)
+	(sc->sc_options & SBC_PDMA) == 0 ||
+	(ncr_sc->sc_current != NULL &&
+	(ncr_sc->sc_current->sr_xs->xs_control & XS_CTL_POLL)))
 		return ncr5380_pio_in(ncr_sc, phase, datalen, data);
 
 	s = splbio();
@@ -315,7 +317,9 @@ sbc_pdma_out(struct ncr5380_softc *ncr_s
 #endif
 
 	if (datalen < ncr_sc->sc_min_dma_len ||
-	(sc->sc_options & SBC_PDMA) == 0)
+	(sc->sc_options & SBC_PDMA) == 0 ||
+	(ncr_sc->sc_current != NULL &&
+	(ncr_sc->sc_current->sr_xs->xs_control & XS_CTL_POLL)))
 		return ncr5380_pio_out(ncr_sc, phase, datalen, data);
 
 	s = splbio();



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

2023-02-18 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Feb 18 13:17:45 UTC 2023

Modified Files:
src/sys/arch/mac68k/dev: sbc.c

Log Message:
Honor the XS_CTL_POLL flag and fallback to polled io instead of PDMA.

As posted to tech-kern.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/mac68k/dev/sbc.c

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



CVS commit: src/sys/arch/mac68k/mac68k

2022-12-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Mon Dec 26 01:05:36 UTC 2022

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

Log Message:
Sanity check and set the framebuffer length if necessary.

Addresses PR 57126.


To generate a diff of this commit:
cvs rdiff -u -r1.363 -r1.364 src/sys/arch/mac68k/mac68k/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/mac68k/mac68k/machdep.c
diff -u src/sys/arch/mac68k/mac68k/machdep.c:1.363 src/sys/arch/mac68k/mac68k/machdep.c:1.364
--- src/sys/arch/mac68k/mac68k/machdep.c:1.363	Sat Oct  9 20:00:41 2021
+++ src/sys/arch/mac68k/mac68k/machdep.c	Mon Dec 26 01:05:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.363 2021/10/09 20:00:41 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.364 2022/12/26 01:05:35 nat Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.363 2021/10/09 20:00:41 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.364 2022/12/26 01:05:35 nat Exp $");
 
 #include "opt_adb.h"
 #include "opt_compat_netbsd.h"
@@ -2616,6 +2616,10 @@ get_mapping(void)
 			mac68k_video.mv_len, mac68k_video.mv_len);
 		}
 	}
+	/* mv_len sanity check */
+	int reqsize = mac68k_video.mv_height * mac68k_video.mv_stride;
+	if (mac68k_video.mv_len != 0 && mac68k_video.mv_len < reqsize)
+		mac68k_video.mv_len = reqsize;
 
 	return load_addr;	/* Return physical address of logical 0 */
 }



CVS commit: src/sys/arch/mac68k/mac68k

2022-12-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Mon Dec 26 01:05:36 UTC 2022

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

Log Message:
Sanity check and set the framebuffer length if necessary.

Addresses PR 57126.


To generate a diff of this commit:
cvs rdiff -u -r1.363 -r1.364 src/sys/arch/mac68k/mac68k/machdep.c

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



Re: CVS commit: src

2022-12-22 Thread Nathanial Sloss
On Fri, 23 Dec 2022 01:59:17 Izumi Tsutsui wrote:
> > Module Name:src
> > Committed By:   nat
> > Date:   Thu Dec 22 11:05:55 UTC 2022
> > 
> > Modified Files:
> > src/distrib/sets/lists/man: mi
> > src/share/man/man4: Makefile
> > src/sys/arch/alpha/conf: GENERIC
> > src/sys/arch/amd64/conf: ALL
> > src/sys/arch/atari/conf: ATARITT FALCON GENERIC.in HADES HADES.in
> > src/sys/arch/i386/conf: ALL
> > src/sys/arch/mac68k/conf: GENERIC
> > src/sys/arch/next68k/conf: GENERIC SLAB
> > src/sys/dev/scsipi: files.scsipi
> > 
> > Added Files:
> > src/share/man/man4: dse.4
> > src/sys/dev/scsipi: if_dse.c
> > 
> > Log Message:
> > Driver for DaynaPORT SCSI/Link (dse.4).
> > 
> > Written by Hiroshi Noguchi, of which an updated version was posted to
> > port-mac68k in 2001.
> > 
> > Attachments were added to kernel configs for platforms that already had
> > the Cabletron (se.4) driver added, although other platorms may benefit.
> > 
> > Reviewed on tech-net by Izumi Tsutsui.
> 
> Well it would be better to put some ack for a comment,
> to call it "reviewd".
> 
> >> static int
> >> dse_read(struct dse_softc *sc, uint8_t *data, int datalen)
> >> {
> >> 
> >>if_statinc(ifp, if_ierrors);
> >> 
> >> printf("LEN %d\n",len);
> >> 
> >> printf("M null\n");
> >> 
> >>if_statinc(ifp, if_ierrors);
> >>goto next_packet;
> >>
> >>}
> 
> Looks stray debug printfs.
> 
> >> static int
> >> dse_ioctl(struct ifnet *ifp, u_long cmd, void *data)
> >> {
> >> 
> >>case AF_INET:
> >>//  sc->protos |= (PROTO_IP | PROTO_ARP | PROTO_REVARP);
> >>
> >>case AF_APPLETALK:
> >>//  sc->protos |= (PROTO_AT | PROTO_AARP);
> 
> Looks no protos member in the dse_softc so not necessary?
> 
> >> #ifdef SEDEBUG
> 
> Is this SEDEBUG intentional or leftover?
> 
> ---
> Izumi Tsutsui

HI,

Thanks again for looking at this.

I've just fixed it in a commit made just now.

Best regards,

Nat


CVS commit: src/sys/dev/scsipi

2022-12-22 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Dec 22 23:06:11 UTC 2022

Modified Files:
src/sys/dev/scsipi: if_dse.c

Log Message:
Fix condition for ending the pacet read loop.

len is unsigned 16 bit so testing for less than zero is not valid.


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

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



CVS commit: src/sys/dev/scsipi

2022-12-22 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Dec 22 23:06:11 UTC 2022

Modified Files:
src/sys/dev/scsipi: if_dse.c

Log Message:
Fix condition for ending the pacet read loop.

len is unsigned 16 bit so testing for less than zero is not valid.


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

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

Modified files:

Index: src/sys/dev/scsipi/if_dse.c
diff -u src/sys/dev/scsipi/if_dse.c:1.2 src/sys/dev/scsipi/if_dse.c:1.3
--- src/sys/dev/scsipi/if_dse.c:1.2	Thu Dec 22 22:39:20 2022
+++ src/sys/dev/scsipi/if_dse.c	Thu Dec 22 23:06:11 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_dse.c,v 1.2 2022/12/22 22:39:20 nat Exp $ */
+/*	$NetBSD: if_dse.c,v 1.3 2022/12/22 23:06:11 nat Exp $ */
 
 /*
  * Driver for DaynaPORT SCSI/Link SCSI-Ethernet
@@ -850,7 +850,7 @@ dse_read(struct dse_softc *sc, uint8_t *
 			len = peek_packet(data);
 		}
 #endif
-		if (len <=0)
+		if (len == 0)
 			break;
 
 #ifdef DSE_DEBUG



CVS commit: src/sys/dev/scsipi

2022-12-22 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Dec 22 22:39:20 UTC 2022

Modified Files:
src/sys/dev/scsipi: if_dse.c

Log Message:
Remove unused commented out code.
Remove unintentional stray debug printfs.
Fix DSE_DEBUG build.


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

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



CVS commit: src/sys/dev/scsipi

2022-12-22 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Dec 22 22:39:20 UTC 2022

Modified Files:
src/sys/dev/scsipi: if_dse.c

Log Message:
Remove unused commented out code.
Remove unintentional stray debug printfs.
Fix DSE_DEBUG build.


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

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

Modified files:

Index: src/sys/dev/scsipi/if_dse.c
diff -u src/sys/dev/scsipi/if_dse.c:1.1 src/sys/dev/scsipi/if_dse.c:1.2
--- src/sys/dev/scsipi/if_dse.c:1.1	Thu Dec 22 11:05:55 2022
+++ src/sys/dev/scsipi/if_dse.c	Thu Dec 22 22:39:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_dse.c,v 1.1 2022/12/22 11:05:55 nat Exp $ */
+/*	$NetBSD: if_dse.c,v 1.2 2022/12/22 22:39:20 nat Exp $ */
 
 /*
  * Driver for DaynaPORT SCSI/Link SCSI-Ethernet
@@ -561,11 +561,11 @@ dse_send_worker(struct work *wk, void *c
 			m = m0 = m_free(m);
 		}
 		if (len < DSE_MINSIZE) {
-#ifdef SEDEBUG
+#ifdef DSE_DEBUG
 			if (sc->sc_debug)
-aprnt_error_dev(sc->sc_dev,
+aprint_error_dev(sc->sc_dev,
 "packet size %d (%zu) < %d\n", len,
-cp - (u_char *)sc->sc_tbuf, SEMINSIZE);
+cp - (u_char *)sc->sc_tbuf, DSE_MINSIZE);
 #endif
 			memset(cp, 0, DSE_MINSIZE - len);
 			len = DSE_MINSIZE;
@@ -854,8 +854,8 @@ dse_read(struct dse_softc *sc, uint8_t *
 			break;
 
 #ifdef DSE_DEBUG
-		aprint_error_dev("dse_read: datalen = %d, packetlen = %d, "
-		"proto = 0x%04x\n", datalen, len,
+		aprint_error_dev(sc->sc_dev, "dse_read: datalen = %d, packetlen"
+		" = %d, proto = 0x%04x\n", datalen, len,
 		ntohs(((struct ether_header *)data)->ether_type));
 #endif
 		if ((len < (DSE_MINSIZE + ETHER_CRC_LEN)) ||
@@ -865,7 +865,6 @@ dse_read(struct dse_softc *sc, uint8_t *
 			"%d; dropping\n", len);
 #endif
 			if_statinc(ifp, if_ierrors);
-printf("LEN %d\n",len);
 			break;
 		}
 
@@ -874,10 +873,9 @@ printf("LEN %d\n",len);
 		if (m == NULL) {
 #ifdef DSE_DEBUG
 			if (sc->sc_debug)
-aprint_error_dev("dse_read: dse_get returned "
-"null\n");
+aprint_error_dev(sc->sc_dev, "dse_read: "
+"dse_get returned null\n");
 #endif
-printf("M null\n");
 			if_statinc(ifp, if_ierrors);
 			goto next_packet;
 		}
@@ -1146,7 +1144,6 @@ dse_ioctl(struct ifnet *ifp, u_long cmd,
 		switch (ifa->ifa_addr->sa_family) {
 #ifdef INET
 		case AF_INET:
-	//		sc->protos |= (PROTO_IP | PROTO_ARP | PROTO_REVARP);
 			if ((error = dse_init(sc)) != 0)
 break;
 			arp_ifinit(ifp, ifa);
@@ -1154,7 +1151,6 @@ dse_ioctl(struct ifnet *ifp, u_long cmd,
 #endif
 #ifdef NETATALK
 		case AF_APPLETALK:
-	//		sc->protos |= (PROTO_AT | PROTO_AARP);
 			if ((error = dse_init(sc)) != 0)
 break;
 			break;
@@ -1233,7 +1229,7 @@ dse_ioctl(struct ifnet *ifp, u_long cmd,
 			mutex_exit(&sc->sc_iflock);
 			break;
 		}
-#ifdef SEDEBUG
+#ifdef DSE_DEBUG
 		if (ifp->if_flags & IFF_DEBUG)
 			sc->sc_debug = 1;
 		else



CVS commit: src/doc

2022-12-22 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Dec 22 11:10:52 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Mention dse.4


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

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



CVS commit: src/doc

2022-12-22 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Dec 22 11:10:52 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Mention dse.4


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2942 src/doc/CHANGES:1.2943
--- src/doc/CHANGES:1.2942	Sun Dec 18 15:56:27 2022
+++ src/doc/CHANGES	Thu Dec 22 11:10:52 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2942 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2943 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -26,3 +26,4 @@
 Changes from NetBSD 10.0 to NetBSD 11.0:
 	amdsmn(4): added trivial power management support
 	amdccp(4): added trivial power management support
+	dse(4): Added Dayna SCSI/Link ethernet driver. [nat 20221222]



CVS commit: src

2022-12-22 Thread Nathanial Sloss
t machine
 #
@@ -158,6 +158,7 @@ scsibus* at scsi?
 #st*	at scsibus? target ? lun ?	# SCSI tape drives
 #cd*	at scsibus? target ? lun ?	# SCSI CD-ROM drives
 #ch*	at scsibus? target ? lun ?	# SCSI autochangers
+#dse*	at scsibus? target ? lun ?	# SCSI ethernet (Dayna)
 #se*	at scsibus? target ? lun ?	# SCSI ethernet
 #ss*	at scsibus? target ? lun ?	# SCSI scanners
 #uk*	at scsibus? target ? lun ?	# SCSI unknown

Index: src/sys/dev/scsipi/files.scsipi
diff -u src/sys/dev/scsipi/files.scsipi:1.43 src/sys/dev/scsipi/files.scsipi:1.44
--- src/sys/dev/scsipi/files.scsipi:1.43	Thu Apr 14 16:50:26 2022
+++ src/sys/dev/scsipi/files.scsipi	Thu Dec 22 11:05:55 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.scsipi,v 1.43 2022/04/14 16:50:26 pgoyette Exp $
+#	$NetBSD: files.scsipi,v 1.44 2022/12/22 11:05:55 nat Exp $
 #
 # Config file and device description for machine-independent SCSI code.
 # Included by ports that need it.  Ports that use it must provide
@@ -40,6 +40,10 @@ device	ch
 attach	ch at scsibus
 file	dev/scsipi/ch.c			ch			needs-flag
 
+device	dse: ifnet, ether, arp
+attach	dse at scsibus
+file	dev/scsipi/if_dse.c		dse			needs-flag
+
 device	se: ifnet, ether, arp
 attach	se at scsibus
 file	dev/scsipi/if_se.c		se			needs-flag

Added files:

Index: src/share/man/man4/dse.4
diff -u /dev/null src/share/man/man4/dse.4:1.1
--- /dev/null	Thu Dec 22 11:05:56 2022
+++ src/share/man/man4/dse.4	Thu Dec 22 11:05:54 2022
@@ -0,0 +1,82 @@
+.\"	$NetBSD: dse.4,v 1.1 2022/12/22 11:05:54 nat Exp $
+.\" Copyright (c) 2022  Nathanial Sloss 
+.\" 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.
+.\"
+.Dd December 16, 2022
+.Dt DSE 4
+.Os
+.Sh NAME
+.Nm dse
+.Nd DaynaPORT SCSI/Link SCSI bus Ethernet interface driver
+.Sh SYNOPSIS
+.Cd "dse* at scsibus? target ? lun ?"
+.Sh DESCRIPTION
+The
+.Nm
+driver supports the
+.Tn DaynaPORT
+SCSI/Link
+.Tn SCSI
+bus
+.Tn Ethernet
+interface.
+These devices can also be currently emulated on a Raspberry Pi with an RaSCSI
+board running PiSCSI software.
+.Pp
+There are additionally
+.Fn open ,
+.Fn close ,
+and
+.Fn ioctl
+entry points so that the device also appears as a
+.Tn SCSI
+device.
+Currently these functions are place holders.
+.Sh SEE ALSO
+.Xr scsi 4 ,
+.Xr ifconfig 8
+.Sh AUTHORS
+.An -nosplit
+.An Hiroshi Noguchi Aq Mt n...@ff.iij4u.or.jp
+.Pp
+.An -nosplit
+.An Matt Sandstrom Aq Mt matt...@beauty.se
+who modified this driver for
+.Nx 1.5.3
+.Sh BUGS
+This device  doesn't conform to the
+.Tn SCSI
+specification.
+Also that this manual page was written by
+.An -nosplit
+.An Nathanial Sloss Aq Mt nathanialsl...@yahoo.com.au
+.Sh REFERNCES
+.Tn RaSCSI
+http://retropc.net/gimons/rascsi/
+.Pp
+.Tn PiSCSI (formally RaSCSI Reloaded)
+https://github.com/PiSCSI
+.Pp
+.Tn Raspberry Pi
+http://raspberrypi.org

Index: src/sys/dev/scsipi/if_dse.c
diff -u /dev/null src/sys/dev/scsipi/if_dse.c:1.1
--- /dev/null	Thu Dec 22 11:05:56 2022
+++ src/sys/dev/scsipi/if_dse.c	Thu Dec 22 11:05:55 2022
@@ -0,0 +1,1405 @@
+/*	$NetBSD: if_dse.c,v 1.1 2022/12/22 11:05:55 nat Exp $ */
+
+/*
+ * Driver for DaynaPORT SCSI/Link SCSI-Ethernet
+ *
+ * Written by Hiroshi Noguchi 
+ *
+ * Modified by Matt Sandstrom  for NetBSD 1.5.3
+ *
+ * This driver is written based on "if_se.c".
+ */
+
+/*
+ * Copyright (c) 1997 Ian W. Dall 
+ * 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

CVS commit: src

2022-12-22 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Dec 22 11:05:55 UTC 2022

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4: Makefile
src/sys/arch/alpha/conf: GENERIC
src/sys/arch/amd64/conf: ALL
src/sys/arch/atari/conf: ATARITT FALCON GENERIC.in HADES HADES.in
src/sys/arch/i386/conf: ALL
src/sys/arch/mac68k/conf: GENERIC
src/sys/arch/next68k/conf: GENERIC SLAB
src/sys/dev/scsipi: files.scsipi
Added Files:
src/share/man/man4: dse.4
src/sys/dev/scsipi: if_dse.c

Log Message:
Driver for DaynaPORT SCSI/Link (dse.4).

Written by Hiroshi Noguchi, of which an updated version was posted to
port-mac68k in 2001.

Attachments were added to kernel configs for platforms that already had
the Cabletron (se.4) driver added, although other platorms may benefit.

Reviewed on tech-net by Izumi Tsutsui.


To generate a diff of this commit:
cvs rdiff -u -r1.1757 -r1.1758 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.730 -r1.731 src/share/man/man4/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/dse.4
cvs rdiff -u -r1.416 -r1.417 src/sys/arch/alpha/conf/GENERIC
cvs rdiff -u -r1.174 -r1.175 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/atari/conf/ATARITT
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/atari/conf/FALCON
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/atari/conf/GENERIC.in
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/atari/conf/HADES
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/atari/conf/HADES.in
cvs rdiff -u -r1.503 -r1.504 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.235 -r1.236 src/sys/arch/mac68k/conf/GENERIC
cvs rdiff -u -r1.153 -r1.154 src/sys/arch/next68k/conf/GENERIC
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/next68k/conf/SLAB
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/scsipi/files.scsipi
cvs rdiff -u -r0 -r1.1 src/sys/dev/scsipi/if_dse.c

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



CVS commit: src/sys/dev/usb

2022-09-05 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Sep  6 02:31:08 UTC 2022

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

Log Message:
Don't hold a spin lock entering usbd_transfer.

This avoids a crash found with LOCKDEBUG.


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

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

Modified files:

Index: src/sys/dev/usb/udl.c
diff -u src/sys/dev/usb/udl.c:1.32 src/sys/dev/usb/udl.c:1.33
--- src/sys/dev/usb/udl.c:1.32	Tue Sep  6 02:28:35 2022
+++ src/sys/dev/usb/udl.c	Tue Sep  6 02:31:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: udl.c,v 1.32 2022/09/06 02:28:35 nat Exp $	*/
+/*	$NetBSD: udl.c,v 1.33 2022/09/06 02:31:08 nat Exp $	*/
 
 /*-
  * Copyright (c) 2009 FUKAUMI Naoki.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.32 2022/09/06 02:28:35 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.33 2022/09/06 02:31:08 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1541,7 +1541,9 @@ udl_cmd_send_async(struct udl_softc *sc)
 	mutex_enter(&sc->sc_mtx);
 	usbd_setup_xfer(cmdq->cq_xfer, cmdq, cmdq->cq_buf,
 	len, 0, USBD_NO_TIMEOUT, udl_cmd_send_async_cb);
+	mutex_exit(&sc->sc_mtx);
 	error = usbd_transfer(cmdq->cq_xfer);
+	mutex_enter(&sc->sc_mtx);
 	if (error != USBD_NORMAL_COMPLETION && error != USBD_IN_PROGRESS) {
 		aprint_error_dev(sc->sc_dev, "%s: %s!\n", __func__,
 		usbd_errstr(error));



CVS commit: src/sys/dev/usb

2022-09-05 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Sep  6 02:31:08 UTC 2022

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

Log Message:
Don't hold a spin lock entering usbd_transfer.

This avoids a crash found with LOCKDEBUG.


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

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



CVS commit: src/sys/dev/usb

2022-09-05 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Sep  6 02:28:35 UTC 2022

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

Log Message:
Do a full screen update upon vt switch.


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

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

Modified files:

Index: src/sys/dev/usb/udl.c
diff -u src/sys/dev/usb/udl.c:1.31 src/sys/dev/usb/udl.c:1.32
--- src/sys/dev/usb/udl.c:1.31	Tue Sep  6 02:26:11 2022
+++ src/sys/dev/usb/udl.c	Tue Sep  6 02:28:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: udl.c,v 1.31 2022/09/06 02:26:11 nat Exp $	*/
+/*	$NetBSD: udl.c,v 1.32 2022/09/06 02:28:35 nat Exp $	*/
 
 /*-
  * Copyright (c) 2009 FUKAUMI Naoki.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.31 2022/09/06 02:26:11 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.32 2022/09/06 02:28:35 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1869,7 +1869,9 @@ udl_startstop(struct udl_softc *sc, bool
 {
 	mutex_enter(&sc->sc_thread_mtx);
 	sc->sc_thread_stop = stop;
-	if (!stop)
+	if (!stop) {
+		sc->sc_clear = true;
 		cv_broadcast(&sc->sc_thread_cv);
+	}
 	mutex_exit(&sc->sc_thread_mtx);
 }



CVS commit: src/sys/dev/usb

2022-09-05 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Sep  6 02:28:35 UTC 2022

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

Log Message:
Do a full screen update upon vt switch.


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

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



CVS commit: src/sys/dev/usb

2022-09-05 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Sep  6 02:26:11 UTC 2022

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

Log Message:
Ensure the device is fully initialized before starting the update thread.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/usb/udl.c

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

Modified files:

Index: src/sys/dev/usb/udl.c
diff -u src/sys/dev/usb/udl.c:1.30 src/sys/dev/usb/udl.c:1.31
--- src/sys/dev/usb/udl.c:1.30	Tue Sep  6 02:23:50 2022
+++ src/sys/dev/usb/udl.c	Tue Sep  6 02:26:11 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: udl.c,v 1.30 2022/09/06 02:23:50 nat Exp $	*/
+/*	$NetBSD: udl.c,v 1.31 2022/09/06 02:26:11 nat Exp $	*/
 
 /*-
  * Copyright (c) 2009 FUKAUMI Naoki.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.30 2022/09/06 02:23:50 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.31 2022/09/06 02:26:11 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1833,7 +1833,8 @@ udl_update_thread(void *v)
 			kthread_exit(0);
 		}
 
-		if (sc->sc_thread_stop == true || sc->sc_fbmem == NULL)
+		if (sc->sc_thread_stop == true || sc->sc_fbmem == NULL ||
+		sc->sc_fbmem_prev == NULL || sc->sc_width <= 0)
 			goto thread_wait;
 
 		if (sc->sc_clear == true)



CVS commit: src/sys/dev/usb

2022-09-05 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Sep  6 02:26:11 UTC 2022

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

Log Message:
Ensure the device is fully initialized before starting the update thread.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/usb/udl.c

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



CVS commit: src/sys/dev/usb

2022-09-05 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Sep  6 02:23:50 UTC 2022

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

Log Message:
Don't throttle the frame rate.

Throttling of the frame rate is no longer necessary as most screen updates are
now partial updates.


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

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

Modified files:

Index: src/sys/dev/usb/udl.c
diff -u src/sys/dev/usb/udl.c:1.29 src/sys/dev/usb/udl.c:1.30
--- src/sys/dev/usb/udl.c:1.29	Tue Sep  6 02:20:17 2022
+++ src/sys/dev/usb/udl.c	Tue Sep  6 02:23:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: udl.c,v 1.29 2022/09/06 02:20:17 nat Exp $	*/
+/*	$NetBSD: udl.c,v 1.30 2022/09/06 02:23:50 nat Exp $	*/
 
 /*-
  * Copyright (c) 2009 FUKAUMI Naoki.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.29 2022/09/06 02:20:17 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.30 2022/09/06 02:23:50 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1855,8 +1855,7 @@ udl_update_thread(void *v)
 		}
 		count++;
 
-
-		kpause("udlslp", false, (40 * hz)/1000 + 1, &sc->sc_thread_mtx);
+		kpause("udlslp", false, 1, &sc->sc_thread_mtx);
 		continue;
 
 thread_wait:



CVS commit: src/sys/dev/usb

2022-09-05 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Sep  6 02:23:50 UTC 2022

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

Log Message:
Don't throttle the frame rate.

Throttling of the frame rate is no longer necessary as most screen updates are
now partial updates.


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

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



CVS commit: src/sys/dev/usb

2022-09-05 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Sep  6 02:20:17 UTC 2022

Modified Files:
src/sys/dev/usb: udl.c udl.h

Log Message:
Finally fix the blitting function.

This means better performance for mostly static displays.
Full screen updates are still done five times a second.

Introduce a new variable sc_clear to force a full update.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/usb/udl.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/udl.h

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



CVS commit: src/sys/dev/usb

2022-09-05 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Sep  6 02:20:17 UTC 2022

Modified Files:
src/sys/dev/usb: udl.c udl.h

Log Message:
Finally fix the blitting function.

This means better performance for mostly static displays.
Full screen updates are still done five times a second.

Introduce a new variable sc_clear to force a full update.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/usb/udl.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/udl.h

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

Modified files:

Index: src/sys/dev/usb/udl.c
diff -u src/sys/dev/usb/udl.c:1.28 src/sys/dev/usb/udl.c:1.29
--- src/sys/dev/usb/udl.c:1.28	Tue May 17 05:05:20 2022
+++ src/sys/dev/usb/udl.c	Tue Sep  6 02:20:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: udl.c,v 1.28 2022/05/17 05:05:20 andvar Exp $	*/
+/*	$NetBSD: udl.c,v 1.29 2022/09/06 02:20:17 nat Exp $	*/
 
 /*-
  * Copyright (c) 2009 FUKAUMI Naoki.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.28 2022/05/17 05:05:20 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.29 2022/09/06 02:20:17 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1822,21 +1822,12 @@ static void
 udl_update_thread(void *v)
 {
 	struct udl_softc *sc = v;
-	int stride;
-#ifdef notyet
-	bool update = false;
-	int linecount, x, y;
 	uint16_t *fb, *fbcopy;
-	uint8_t *curfb;
-#else
-	uint16_t *fb;
-	int offs;
-#endif
+	int offs, stride, count = 0;
 
 	mutex_enter(&sc->sc_thread_mtx);
 
 	for (;;) {
-		stride = uimin(sc->sc_width, UDL_CMD_WIDTH_MAX - 8);
 		if (sc->sc_dying == true) {
 			mutex_exit(&sc->sc_thread_mtx);
 			kthread_exit(0);
@@ -1845,49 +1836,25 @@ udl_update_thread(void *v)
 		if (sc->sc_thread_stop == true || sc->sc_fbmem == NULL)
 			goto thread_wait;
 
-#ifdef notyet
-		curfb = kmem_zalloc(UDL_FBMEM_SIZE(sc), KM_SLEEP);
-		memcpy(curfb, sc->sc_fbmem, sc->sc_height * sc->sc_width * 2);
-		fb = (uint16_t *)curfb;
+		if (sc->sc_clear == true)
+			count = 0;
+		sc->sc_clear = false;
+
+		stride = uimin(sc->sc_width, UDL_CMD_WIDTH_MAX - 8);
+		stride /= 8;
+		fb = (uint16_t *)sc->sc_fbmem;
 		fbcopy = (uint16_t *)sc->sc_fbmem_prev;
-		for (y = 0; y < sc->sc_height; y++) {
-			linecount = 0;
-			update = false;
-			for (x = 0; x < sc->sc_width; x++) {
-if (linecount >= stride) {
-	udl_draw_line(sc, &fb[y * sc->sc_width
-	+ x - linecount], y * sc->sc_width
-	+ x - linecount, linecount);
-	linecount = 0;
-	update = false;
-}
-if (fb[y * sc->sc_width + x] ^ fbcopy[y *
-sc->sc_width + x]) {
-	update = true;
-	linecount ++;
-} else if (update == true) {
-	udl_draw_line(sc, &fb[y * sc->sc_width
-	+ x - linecount], y * sc->sc_width
-	+ x - linecount, linecount);
-	linecount = 0;
-	update = false;
-}
-			}
-			if (linecount) {
-udl_draw_line(sc, &fb[y * sc->sc_width + x -
-linecount], y * sc->sc_width  + x -
-linecount, linecount);
+		for (offs = 0; offs < (sc->sc_height * sc->sc_width) - stride;
+		offs += stride) {
+			if (count % (hz / 5) == 0 || memcmp(&fb[offs],
+			&fbcopy[offs], stride * sizeof(uint16_t)) != 0) {
+udl_draw_line(sc, &fb[offs], offs, stride);
+memcpy(&fbcopy[offs], &fb[offs], stride *
+   sizeof(uint16_t));
 			}
 		}
-		memcpy(sc->sc_fbmem_prev, curfb, sc->sc_height * sc->sc_width
-		* 2);
-		kmem_free(curfb, UDL_FBMEM_SIZE(sc));
-#else
-		fb = (uint16_t *)sc->sc_fbmem;
-		for (offs = 0; offs < sc->sc_height * sc->sc_width; offs += stride)
-			udl_draw_line(sc, &fb[offs], offs, stride);
+		count++;
 
-#endif
 
 		kpause("udlslp", false, (40 * hz)/1000 + 1, &sc->sc_thread_mtx);
 		continue;

Index: src/sys/dev/usb/udl.h
diff -u src/sys/dev/usb/udl.h:1.5 src/sys/dev/usb/udl.h:1.6
--- src/sys/dev/usb/udl.h:1.5	Sat Sep 14 15:24:23 2019
+++ src/sys/dev/usb/udl.h	Tue Sep  6 02:20:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: udl.h,v 1.5 2019/09/14 15:24:23 maxv Exp $	*/
+/*	$NetBSD: udl.h,v 1.6 2022/09/06 02:20:17 nat Exp $	*/
 
 /*-
  * Copyright (c) 2009 FUKAUMI Naoki.
@@ -111,6 +111,7 @@ struct udl_softc {
 	device_t		 sc_wsdisplay;
 	u_int			 sc_mode;
 	u_int			 sc_blank;
+	bool			 sc_clear;
 	uint8_t			 sc_nscreens;
 
 	uint8_t			*sc_fbmem;	/* framebuffer for X11 */



CVS commit: src/sbin/ifconfig

2022-08-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Aug 17 23:36:48 UTC 2022

Modified Files:
src/sbin/ifconfig: af_inetany.c

Log Message:
Revert to previous as the atf tests are still failing.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sbin/ifconfig/af_inetany.c

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

Modified files:

Index: src/sbin/ifconfig/af_inetany.c
diff -u src/sbin/ifconfig/af_inetany.c:1.22 src/sbin/ifconfig/af_inetany.c:1.23
--- src/sbin/ifconfig/af_inetany.c:1.22	Wed Aug 17 12:35:10 2022
+++ src/sbin/ifconfig/af_inetany.c	Wed Aug 17 23:36:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: af_inetany.c,v 1.22 2022/08/17 12:35:10 nat Exp $	*/
+/*	$NetBSD: af_inetany.c,v 1.23 2022/08/17 23:36:48 nat Exp $	*/
 
 /*-
  * Copyright (c) 2008 David Young.  All rights reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: af_inetany.c,v 1.22 2022/08/17 12:35:10 nat Exp $");
+__RCSID("$NetBSD: af_inetany.c,v 1.23 2022/08/17 23:36:48 nat Exp $");
 #endif /* not lint */
 
 #include 
@@ -68,7 +68,6 @@ commit_address(prop_dictionary_t env, pr
 const struct afparam *param)
 {
 	const char *ifname;
-	struct ifreq ifr;
 	int af, rc, s;
 	bool alias, delete, replace;
 	prop_data_t d;
@@ -89,19 +88,8 @@ commit_address(prop_dictionary_t env, pr
 
 	if ((d = (prop_data_t)prop_dictionary_get(env, "address")) != NULL)
 		addr = prop_data_value(d);
-	else if (param->gifaddr.cmd == 0)
-		return;
-	else if (!prop_dictionary_get_bool(env, "alias", &alias)) { 
-		static struct paddr_prefix existingaddr;
-
-		memset(&ifr, 0, sizeof(ifr));
-		estrlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-		if (prog_ioctl(s, SIOCGIFADDR, &ifr) == -1)
-			return;
-
-		existingaddr.pfx_addr = ifr.ifr_addr;
-		addr = &existingaddr;
-	} else if (alias)
+	else if (!prop_dictionary_get_bool(env, "alias", &alias) || alias ||
+	param->gifaddr.cmd == 0)
 		return;
 	else if (prog_ioctl(s, param->gifaddr.cmd, param->dgreq.buf) == -1)
 		err(EXIT_FAILURE, "%s", param->gifaddr.desc);



CVS commit: src/sbin/ifconfig

2022-08-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Aug 17 23:36:48 UTC 2022

Modified Files:
src/sbin/ifconfig: af_inetany.c

Log Message:
Revert to previous as the atf tests are still failing.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sbin/ifconfig/af_inetany.c

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



CVS commit: src/sbin/ifconfig

2022-08-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Aug 17 12:35:11 UTC 2022

Modified Files:
src/sbin/ifconfig: af_inetany.c

Log Message:
Use existing address when setting parameters.

No need to specify address every time when setting broadcast address or
netmask.

Hopefully successfully re addresses PR bin/10911.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sbin/ifconfig/af_inetany.c

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

Modified files:

Index: src/sbin/ifconfig/af_inetany.c
diff -u src/sbin/ifconfig/af_inetany.c:1.21 src/sbin/ifconfig/af_inetany.c:1.22
--- src/sbin/ifconfig/af_inetany.c:1.21	Tue Aug 16 22:31:24 2022
+++ src/sbin/ifconfig/af_inetany.c	Wed Aug 17 12:35:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: af_inetany.c,v 1.21 2022/08/16 22:31:24 nat Exp $	*/
+/*	$NetBSD: af_inetany.c,v 1.22 2022/08/17 12:35:10 nat Exp $	*/
 
 /*-
  * Copyright (c) 2008 David Young.  All rights reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: af_inetany.c,v 1.21 2022/08/16 22:31:24 nat Exp $");
+__RCSID("$NetBSD: af_inetany.c,v 1.22 2022/08/17 12:35:10 nat Exp $");
 #endif /* not lint */
 
 #include 
@@ -68,6 +68,7 @@ commit_address(prop_dictionary_t env, pr
 const struct afparam *param)
 {
 	const char *ifname;
+	struct ifreq ifr;
 	int af, rc, s;
 	bool alias, delete, replace;
 	prop_data_t d;
@@ -88,8 +89,19 @@ commit_address(prop_dictionary_t env, pr
 
 	if ((d = (prop_data_t)prop_dictionary_get(env, "address")) != NULL)
 		addr = prop_data_value(d);
-	else if (!prop_dictionary_get_bool(env, "alias", &alias) || alias ||
-	param->gifaddr.cmd == 0)
+	else if (param->gifaddr.cmd == 0)
+		return;
+	else if (!prop_dictionary_get_bool(env, "alias", &alias)) { 
+		static struct paddr_prefix existingaddr;
+
+		memset(&ifr, 0, sizeof(ifr));
+		estrlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+		if (prog_ioctl(s, SIOCGIFADDR, &ifr) == -1)
+			return;
+
+		existingaddr.pfx_addr = ifr.ifr_addr;
+		addr = &existingaddr;
+	} else if (alias)
 		return;
 	else if (prog_ioctl(s, param->gifaddr.cmd, param->dgreq.buf) == -1)
 		err(EXIT_FAILURE, "%s", param->gifaddr.desc);



  1   2   >