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 IMPLIED W

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_ADVERT_CHAN_TX_PWR

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(>redraw, hlcd_redraw, sc);
 }
 
+void hd44780_detach(struct hd44780_chip *sc)
+{
+	callout_stop(>redraw);
+	callout_destroy(>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(, 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(, 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_intr_lock);
 		err = pad_get_block(sc, , MIN(uio->uio_resid, INT_MAX), first);
 		mutex_exit(>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_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_intr_lock);
 		err = pad_get_block(sc, , MIN(uio->uio_resid, INT_MAX), first);
 		mutex_exit(>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_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"
 
 

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_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
 #
@@ -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
+ *notice, this l

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_mtx);
 	usbd_setup_xfer(cmdq->cq_xfer, cmdq, cmdq->cq_buf,
 	len, 0, USBD_NO_TIMEOUT, udl_cmd_send_async_cb);
+	mutex_exit(>sc_mtx);
 	error = usbd_transfer(cmdq->cq_xfer);
+	mutex_enter(>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_thread_mtx);
 	sc->sc_thread_stop = stop;
-	if (!stop)
+	if (!stop) {
+		sc->sc_clear = true;
 		cv_broadcast(>sc_thread_cv);
+	}
 	mutex_exit(>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_thread_mtx);
+		kpause("udlslp", false, 1, >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_thread_mtx);
 
 	for (;;) {
-		stride = uimin(sc->sc_width, UDL_CMD_WIDTH_MAX - 8);
 		if (sc->sc_dying == true) {
 			mutex_exit(>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, [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, [y * sc->sc_width
-	+ x - linecount], y * sc->sc_width
-	+ x - linecount, linecount);
-	linecount = 0;
-	update = false;
-}
-			}
-			if (linecount) {
-udl_draw_line(sc, [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([offs],
+			[offs], stride * sizeof(uint16_t)) != 0) {
+udl_draw_line(sc, [offs], offs, stride);
+memcpy([offs], [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, [offs], offs, stride);
+		count++;
 
-#endif
 
 		kpause("udlslp", false, (40 * hz)/1000 + 1, >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", )) { 
-		static struct paddr_prefix existingaddr;
-
-		memset(, 0, sizeof(ifr));
-		estrlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-		if (prog_ioctl(s, SIOCGIFADDR, ) == -1)
-			return;
-
-		existingaddr.pfx_addr = ifr.ifr_addr;
-		addr = 
-	} else if (alias)
+	else if (!prop_dictionary_get_bool(env, "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 ||
-	param->gifaddr.cmd == 0)
+	else if (param->gifaddr.cmd == 0)
+		return;
+	else if (!prop_dictionary_get_bool(env, "alias", )) { 
+		static struct paddr_prefix existingaddr;
+
+		memset(, 0, sizeof(ifr));
+		estrlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+		if (prog_ioctl(s, SIOCGIFADDR, ) == -1)
+			return;
+
+		existingaddr.pfx_addr = ifr.ifr_addr;
+		addr = 
+	} else if (alias)
 		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 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.



CVS commit: src/sbin/ifconfig

2022-08-16 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Aug 16 22:31:24 UTC 2022

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

Log Message:
Revert to previous as atf tests were failing.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 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.20 src/sbin/ifconfig/af_inetany.c:1.21
--- src/sbin/ifconfig/af_inetany.c:1.20	Tue Aug 16 10:47:10 2022
+++ src/sbin/ifconfig/af_inetany.c	Tue Aug 16 22:31:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: af_inetany.c,v 1.20 2022/08/16 10:47:10 nat Exp $	*/
+/*	$NetBSD: af_inetany.c,v 1.21 2022/08/16 22:31:24 nat Exp $	*/
 
 /*-
  * Copyright (c) 2008 David Young.  All rights reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: af_inetany.c,v 1.20 2022/08/16 10:47:10 nat Exp $");
+__RCSID("$NetBSD: af_inetany.c,v 1.21 2022/08/16 22:31:24 nat Exp $");
 #endif /* not lint */
 
 #include 
@@ -68,15 +68,12 @@ 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;
 	const struct paddr_prefix *addr, *brd, *dst, *mask;
 	unsigned short flags;
 
-	addr = NULL;
-
 	if ((af = getaf(env)) == -1)
 		af = AF_INET;
 
@@ -92,23 +89,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 (!prop_dictionary_get_bool(env, "alias", ) || alias ||
-	param->gifaddr.cmd == 0) {
-		if (addr == NULL) {
-			static struct paddr_prefix existingaddr;
-
-			memset(, 0, sizeof(ifr));
-			estrlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-			if (prog_ioctl(s, SIOCGIFADDR, ) == -1) {
-if (errno == EADDRNOTAVAIL ||
-errno == EAFNOSUPPORT)
-	return;
-err(EXIT_FAILURE,"SIOCGIFADDR");
-			}
-
-			existingaddr.pfx_addr = ifr.ifr_addr;
-			addr = 
-		}
-	}
+	param->gifaddr.cmd == 0)
+		return;
 	else if (prog_ioctl(s, param->gifaddr.cmd, param->dgreq.buf) == -1)
 		err(EXIT_FAILURE, "%s", param->gifaddr.desc);
 	else if (prog_ioctl(s, param->difaddr.cmd, param->dgreq.buf) == -1)



CVS commit: src/sbin/ifconfig

2022-08-16 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Aug 16 22:31:24 UTC 2022

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

Log Message:
Revert to previous as atf tests were failing.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 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-16 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Aug 16 10:47:11 UTC 2022

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

Log Message:
No need address every time to specify broadcast and netmask.

Previously ifconfig would fail silently.

Addresses PR bin/10911.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 src/sbin/ifconfig/af_inetany.c:1.20
--- src/sbin/ifconfig/af_inetany.c:1.19	Sun Jun  7 06:02:58 2020
+++ src/sbin/ifconfig/af_inetany.c	Tue Aug 16 10:47:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: af_inetany.c,v 1.19 2020/06/07 06:02:58 thorpej Exp $	*/
+/*	$NetBSD: af_inetany.c,v 1.20 2022/08/16 10:47: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.19 2020/06/07 06:02:58 thorpej Exp $");
+__RCSID("$NetBSD: af_inetany.c,v 1.20 2022/08/16 10:47:10 nat Exp $");
 #endif /* not lint */
 
 #include 
@@ -68,12 +68,15 @@ 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;
 	const struct paddr_prefix *addr, *brd, *dst, *mask;
 	unsigned short flags;
 
+	addr = NULL;
+
 	if ((af = getaf(env)) == -1)
 		af = AF_INET;
 
@@ -89,8 +92,23 @@ 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 ||
-	param->gifaddr.cmd == 0)
-		return;
+	param->gifaddr.cmd == 0) {
+		if (addr == NULL) {
+			static struct paddr_prefix existingaddr;
+
+			memset(, 0, sizeof(ifr));
+			estrlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+			if (prog_ioctl(s, SIOCGIFADDR, ) == -1) {
+if (errno == EADDRNOTAVAIL ||
+errno == EAFNOSUPPORT)
+	return;
+err(EXIT_FAILURE,"SIOCGIFADDR");
+			}
+
+			existingaddr.pfx_addr = ifr.ifr_addr;
+			addr = 
+		}
+	}
 	else if (prog_ioctl(s, param->gifaddr.cmd, param->dgreq.buf) == -1)
 		err(EXIT_FAILURE, "%s", param->gifaddr.desc);
 	else if (prog_ioctl(s, param->difaddr.cmd, param->dgreq.buf) == -1)



CVS commit: src/sbin/ifconfig

2022-08-16 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Aug 16 10:47:11 UTC 2022

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

Log Message:
No need address every time to specify broadcast and netmask.

Previously ifconfig would fail silently.

Addresses PR bin/10911.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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/sys/dev/usb

2022-07-06 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Jul  6 06:25:24 UTC 2022

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

Log Message:
Cosmetic changes.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/usb/uplcom.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/uplcom.c
diff -u src/sys/dev/usb/uplcom.c:1.92 src/sys/dev/usb/uplcom.c:1.93
--- src/sys/dev/usb/uplcom.c:1.92	Wed Jul  6 06:00:40 2022
+++ src/sys/dev/usb/uplcom.c	Wed Jul  6 06:25:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uplcom.c,v 1.92 2022/07/06 06:00:40 nat Exp $	*/
+/*	$NetBSD: uplcom.c,v 1.93 2022/07/06 06:25:24 nat Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.92 2022/07/06 06:00:40 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.93 2022/07/06 06:25:24 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -115,13 +115,13 @@ fail:
 #define	UPLCOM_SET_REQUEST		0x01
 #define	UPLCOM_SET_CRTSCTS_0		0x41
 #define	UPLCOM_SET_CRTSCTS_HX		0x61
+#define UPLCOM_HX_STATUS_REG		0x8080
 
 #define	UPLCOM_N_SERIAL_CTS		0x80
 
 #define UPLCOM_HXN_SET_REQUEST		0x80
 #define UPLCOM_HXN_SET_CRTSCTS_REG	0x0A
 #define UPLCOM_HXN_SET_CRTSCTS		0xFA
-#define UPLCOM_HX_STATUS_REG		0x8080
 
 enum  pl2303_type {
 	UPLCOM_TYPE_0,	/* we use this for all non-HX variants */
@@ -316,9 +316,8 @@ uplcom_attach(device_t parent, device_t 
 	/* determine chip type */
 	ddesc = usbd_get_device_descriptor(dev);
 	if (ddesc->bDeviceClass != UDCLASS_COMM &&
-	ddesc->bMaxPacketSize == 0x40) {
+	ddesc->bMaxPacketSize == 0x40)
 		sc->sc_type = UPLCOM_TYPE_HX;
-	}
 
 	if (sc->sc_type == UPLCOM_TYPE_HX) {
 		req.bmRequestType = UT_READ_VENDOR_DEVICE;



CVS commit: src/sys/dev/usb

2022-07-06 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Jul  6 06:25:24 UTC 2022

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

Log Message:
Cosmetic changes.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/usb/uplcom.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-07-06 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Jul  6 06:00:40 UTC 2022

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

Log Message:
Add support for HXN variants from openbsd.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/usb/uplcom.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-07-06 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Jul  6 06:00:40 UTC 2022

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

Log Message:
Add support for HXN variants from openbsd.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/usb/uplcom.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/uplcom.c
diff -u src/sys/dev/usb/uplcom.c:1.91 src/sys/dev/usb/uplcom.c:1.92
--- src/sys/dev/usb/uplcom.c:1.91	Sat Aug  7 16:19:17 2021
+++ src/sys/dev/usb/uplcom.c	Wed Jul  6 06:00:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uplcom.c,v 1.91 2021/08/07 16:19:17 thorpej Exp $	*/
+/*	$NetBSD: uplcom.c,v 1.92 2022/07/06 06:00:40 nat Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.91 2021/08/07 16:19:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.92 2022/07/06 06:00:40 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -112,15 +112,21 @@ fail:
 #define	UPLCOM_IFACE_INDEX	0
 #define	UPLCOM_SECOND_IFACE_INDEX	1
 
-#define	UPLCOM_SET_REQUEST	0x01
-#define	UPLCOM_SET_CRTSCTS_0	0x41
-#define	UPLCOM_SET_CRTSCTS_HX	0x61
-
-#define	UPLCOM_N_SERIAL_CTS	0x80
+#define	UPLCOM_SET_REQUEST		0x01
+#define	UPLCOM_SET_CRTSCTS_0		0x41
+#define	UPLCOM_SET_CRTSCTS_HX		0x61
+
+#define	UPLCOM_N_SERIAL_CTS		0x80
+
+#define UPLCOM_HXN_SET_REQUEST		0x80
+#define UPLCOM_HXN_SET_CRTSCTS_REG	0x0A
+#define UPLCOM_HXN_SET_CRTSCTS		0xFA
+#define UPLCOM_HX_STATUS_REG		0x8080
 
 enum  pl2303_type {
 	UPLCOM_TYPE_0,	/* we use this for all non-HX variants */
 	UPLCOM_TYPE_HX,
+	UPLCOM_TYPE_HXN,
 };
 
 struct	uplcom_softc {
@@ -233,6 +239,13 @@ static const struct usb_devno uplcom_dev
 	{ USB_VENDOR_COREGA, USB_PRODUCT_COREGA_CGUSBRS232R },
 	/* Sharp CE-175TU (USB to Zaurus option port 15 adapter) */
 	{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_CE175TU },
+	/* Various */
+	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303GB },
+	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303GC },
+	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303GE },
+	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303GL },
+	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303GS },
+	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303GT },
 };
 #define uplcom_lookup(v, p) usb_lookup(uplcom_devs, v, p)
 
@@ -263,9 +276,11 @@ uplcom_attach(device_t parent, device_t 
 	usb_config_descriptor_t *cdesc;
 	usb_interface_descriptor_t *id;
 	usb_endpoint_descriptor_t *ed;
+	usb_device_request_t req;
 	char *devinfop;
 	const char *devname = device_xname(self);
 	usbd_status err;
+	uint8_t val;
 	int i;
 	struct ucom_attach_args ucaa;
 
@@ -301,12 +316,27 @@ uplcom_attach(device_t parent, device_t 
 	/* determine chip type */
 	ddesc = usbd_get_device_descriptor(dev);
 	if (ddesc->bDeviceClass != UDCLASS_COMM &&
-	ddesc->bMaxPacketSize == 0x40)
+	ddesc->bMaxPacketSize == 0x40) {
 		sc->sc_type = UPLCOM_TYPE_HX;
+	}
+
+	if (sc->sc_type == UPLCOM_TYPE_HX) {
+		req.bmRequestType = UT_READ_VENDOR_DEVICE;
+		req.bRequest = UPLCOM_SET_REQUEST;
+		USETW(req.wValue, UPLCOM_HX_STATUS_REG);
+		USETW(req.wIndex, sc->sc_iface_number);
+		USETW(req.wLength, 1);
+
+		err = usbd_do_request(sc->sc_udev, , );
+		if (err)
+			sc->sc_type = UPLCOM_TYPE_HXN;
+	}
 
 #ifdef UPLCOM_DEBUG
 	/* print the chip type */
-	if (sc->sc_type == UPLCOM_TYPE_HX) {
+	if (sc->sc_type == UPLCOM_TYPE_HXN) {
+		DPRINTF("chiptype HXN", 0, 0, 0, 0);
+	else if (sc->sc_type == UPLCOM_TYPE_HX) {
 		DPRINTF("chiptype HX", 0, 0, 0, 0);
 	} else {
 		DPRINTF("chiptype 0", 0, 0, 0, 0);
@@ -521,6 +551,9 @@ uplcom_reset(struct uplcom_softc *sc)
 	usb_device_request_t req;
 	usbd_status err;
 
+	if (sc->sc_type == UPLCOM_TYPE_HXN)
+		return 0;
+
 	req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
 	req.bRequest = UPLCOM_SET_REQUEST;
 	USETW(req.wValue, 0);
@@ -693,9 +726,17 @@ uplcom_set_crtscts(struct uplcom_softc *
 	UPLCOMHIST_FUNC(); UPLCOMHIST_CALLED();
 
 	req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
-	req.bRequest = UPLCOM_SET_REQUEST;
-	USETW(req.wValue, 0);
-	if (sc->sc_type == UPLCOM_TYPE_HX)
+	if (sc->sc_type == UPLCOM_TYPE_HXN) {
+		req.bRequest = UPLCOM_HXN_SET_REQUEST;
+		USETW(req.wValue, UPLCOM_HXN_SET_CRTSCTS_REG);
+	} else {
+		req.bRequest = UPLCOM_SET_REQUEST;
+		USETW(req.wValue, 0);
+	}
+
+	if (sc->sc_type == UPLCOM_TYPE_HXN)
+		USETW(req.wIndex, UPLCOM_HXN_SET_CRTSCTS);
+	else if (sc->sc_type == UPLCOM_TYPE_HX)
 		USETW(req.wIndex, UPLCOM_SET_CRTSCTS_HX);
 	else
 		USETW(req.wIndex, UPLCOM_SET_CRTSCTS_0);



CVS commit: src/games/testpat

2021-11-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Nov 13 20:59:13 UTC 2021

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

Log Message:
Better display in monochrome.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/games/testpat/testpat.c

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

Modified files:

Index: src/games/testpat/testpat.c
diff -u src/games/testpat/testpat.c:1.5 src/games/testpat/testpat.c:1.6
--- src/games/testpat/testpat.c:1.5	Sun May  2 12:50:46 2021
+++ src/games/testpat/testpat.c	Sat Nov 13 20:59:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: testpat.c,v 1.5 2021/05/02 12:50:46 rillig Exp $ */
+/* $NetBSD: testpat.c,v 1.6 2021/11/13 20:59:13 nat Exp $ */
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: testpat.c,v 1.5 2021/05/02 12:50:46 rillig Exp $");
+__RCSID("$NetBSD: testpat.c,v 1.6 2021/11/13 20:59:13 nat Exp $");
 
 #include 
 #include 
@@ -210,6 +210,8 @@ int main(int argc, char *argv[]) {
 	for (i = roundf(1 * grid_unit); i < roundf(2 * grid_unit); i++) {
 		if (colourOK)
 			attrset(COLOR_PAIR(COLOR_BLACK));
+		else
+			attrset(A_NORMAL);
 
 		for (col = roundf((4 * grid_unit * 2) +
 		circle_pos[y_limit / 2][0]); col <= roundf((9 * grid_unit
@@ -219,6 +221,9 @@ int main(int argc, char *argv[]) {
 
 	i = roundf(1.4 * grid_unit);
 
+	if (!colourOK)
+		attrset(A_NORMAL);
+
 	col = y_limit - (strlen(title) / 2) + circle_pos[y_limit / 2][0];
 		mvprintw(i, col, "%s", title);
 
@@ -226,6 +231,8 @@ int main(int argc, char *argv[]) {
 	for (line = roundf(2 * grid_unit); line < 4 * grid_unit; line++) {
 		if (colourOK)
 			attrset(COLOR_PAIR(COLOR_BLACK));
+		else
+			attrset(A_NORMAL);
 
 		for (col = 0; col <= roundf((3.5 * grid_unit * 2)); col++) {
 xpos = col + circle_pos[y_limit / 2][0];
@@ -251,6 +258,8 @@ int main(int argc, char *argv[]) {
 		for (xpos = 0; xpos <= x_limit; xpos += 2 * gap) {
 			if (colourOK)
 attrset(COLOR_PAIR(COLOR_BLACK));
+			else
+attrset(A_NORMAL);
 
 			for (col = xpos; col < xpos + gap; col++) {
 if (col >= circle_pos[i][0] &&
@@ -260,6 +269,8 @@ int main(int argc, char *argv[]) {
 
 			if (colourOK)
 attrset(COLOR_PAIR(COLOR_WHITE));
+			else
+attrset(A_REVERSE);
 
 			for (col = xpos + gap ; col < xpos + (2 * gap);
 			col++) {
@@ -275,6 +286,10 @@ int main(int argc, char *argv[]) {
 		colour = colour_list[i];
 		if (colourOK)
 			attrset(COLOR_PAIR(colour));
+		else if (i & 1)
+			attrset(A_NORMAL);
+		else
+			attrset(A_REVERSE);
 
 		if (i == 0)
 			spacing_start = 0;
@@ -301,6 +316,8 @@ int main(int argc, char *argv[]) {
 	for (line = y_limit / 2; line < (9.5 * grid_unit); line++) {
 		if (colourOK)
 			attrset(COLOR_PAIR(COLOR_BLACK));
+		else
+			attrset(A_NORMAL);
 
 		for (col = circle_pos[line][0]; col <= circle_pos[line][1];
 		col++)
@@ -336,6 +353,8 @@ int main(int argc, char *argv[]) {
 	line++) {
 		if (colourOK)
 			attrset(COLOR_PAIR(COLOR_BLACK));
+		else
+			attrset(A_NORMAL);
 
 		for (col = roundf((0 * grid_unit * 2)); col <
 		roundf((4 * grid_unit * 2)); col++) {
@@ -355,6 +374,8 @@ int main(int argc, char *argv[]) {
 
 		if (colourOK)
 			attrset(COLOR_PAIR(COLOR_WHITE));
+		else
+			attrset(A_REVERSE);
 
 		for (col = roundf((6.5 * grid_unit * 2)); col <
 		roundf((9 * grid_unit * 2)); col++) {
@@ -378,6 +399,8 @@ int main(int argc, char *argv[]) {
 	line++) {
 		if (colourOK)
 			attrset(COLOR_PAIR(COLOR_BLACK));
+		else
+			attrset(A_NORMAL);
 
 		for (col = roundf(3.5 * grid_unit * 2); col <= roundf(9.5 *
 		grid_unit * 2); col++) {
@@ -389,6 +412,8 @@ int main(int argc, char *argv[]) {
 
 		if (colourOK)
 			attrset(COLOR_PAIR(COLOR_WHITE));
+		else
+			attrset(A_REVERSE);
 
 		for (col = roundf(0 * grid_unit * 2); col <= roundf(3.5 *
 		grid_unit * 2); col++) {
@@ -411,6 +436,9 @@ int main(int argc, char *argv[]) {
 	for (line = 12 * grid_unit; line < y_limit; line++) {
 		if (colourOK)
 			attrset(COLOR_PAIR(COLOR_YELLOW));
+		else
+			attrset(A_REVERSE);
+
 
 		for (col = circle_pos[line][0]; col <= circle_pos[line][1];
 		col++)
@@ -418,6 +446,8 @@ int main(int argc, char *argv[]) {
 
 		if (colourOK)
 			attrset(COLOR_PAIR(COLOR_RED));
+		else
+			attrset(A_NORMAL);
 
 		for (col = roundf((6 * grid_unit * 2)); col <
 		roundf((7 * grid_unit * 2)); col++) {
@@ -430,10 +460,14 @@ int main(int argc, char *argv[]) {
 
 	if (colourOK)
 		attrset(COLOR_PAIR(COLOR_BLACK));
+	else
+		attrset(A_NORMAL);
 
 	for (line = 6 * grid_unit; line <= (7 * grid_unit) + 1; line++) {
 		if (colourOK)
 			attrset(COLOR_PAIR(COLOR_BLACK));
+		else
+			attrset(A_NORMAL);
 
 		col = x_limit / 2;
 		if (line != a_axis) {



CVS commit: src/games/testpat

2021-11-13 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Nov 13 20:59:13 UTC 2021

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

Log Message:
Better display in monochrome.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/games/testpat/testpat.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

2021-09-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Sep 17 13:02:52 UTC 2021

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

Log Message:
Sprinkle a little delay.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/usb/if_urtwn.c

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

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.99 src/sys/dev/usb/if_urtwn.c:1.100
--- src/sys/dev/usb/if_urtwn.c:1.99	Fri Sep 17 13:00:20 2021
+++ src/sys/dev/usb/if_urtwn.c	Fri Sep 17 13:02:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.99 2021/09/17 13:00:20 nat Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.100 2021/09/17 13:02:52 nat Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.99 2021/09/17 13:00:20 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.100 2021/09/17 13:02:52 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3088,6 +3088,7 @@ urtwn_r92c_power_on(struct urtwn_softc *
 
 	/* Unlock ISO/CLK/Power control register. */
 	urtwn_write_1(sc, R92C_RSV_CTRL, 0);
+	DELAY(5);
 	/* Move SPS into PWM mode. */
 	urtwn_write_1(sc, R92C_SPS0_CTRL, 0x2b);
 	DELAY(5);
@@ -3153,6 +3154,9 @@ urtwn_r92c_power_on(struct urtwn_softc *
 	urtwn_write_2(sc, R92C_CR, reg);
 
 	urtwn_write_1(sc, 0xfe10, 0x19);
+
+	urtwn_delay_ms(sc, 1);
+
 	return 0;
 }
 



CVS commit: src/sys/dev/usb

2021-09-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Sep 17 13:02:52 UTC 2021

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

Log Message:
Sprinkle a little delay.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/usb/if_urtwn.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

2021-09-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Sep 17 13:00:20 UTC 2021

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

Log Message:
Initialize firmware mailbox counter when firmware is reset.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/usb/if_urtwn.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

2021-09-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Sep 17 13:00:20 UTC 2021

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

Log Message:
Initialize firmware mailbox counter when firmware is reset.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/usb/if_urtwn.c

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

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.98 src/sys/dev/usb/if_urtwn.c:1.99
--- src/sys/dev/usb/if_urtwn.c:1.98	Fri Sep 17 12:58:31 2021
+++ src/sys/dev/usb/if_urtwn.c	Fri Sep 17 13:00:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.98 2021/09/17 12:58:31 nat Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.99 2021/09/17 13:00:20 nat Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.98 2021/09/17 12:58:31 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.99 2021/09/17 13:00:20 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3362,7 +3362,10 @@ urtwn_fw_reset(struct urtwn_softc *sc)
 	KASSERT(mutex_owned(>sc_write_mtx));
 
 	/* Tell 8051 to reset itself. */
+	mutex_enter(>sc_fwcmd_mtx);
 	urtwn_write_1(sc, R92C_HMETFR + 3, 0x20);
+	sc->fwcur = 0;
+	mutex_exit(>sc_fwcmd_mtx);
 
 	/* Wait until 8051 resets by itself. */
 	for (ntries = 0; ntries < 100; ntries++) {
@@ -3404,6 +3407,11 @@ urtwn_r88e_fw_reset(struct urtwn_softc *
 	}
 	DELAY(50);
 
+	mutex_enter(>sc_fwcmd_mtx);
+	/* Init firmware commands ring. */
+	sc->fwcur = 0;
+	mutex_exit(>sc_fwcmd_mtx);
+
 }
 
 static int



CVS commit: src/sys/dev/usb

2021-09-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Sep 17 12:58:31 UTC 2021

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

Log Message:
Serialize sending of firmware commands to device.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/usb/if_urtwn.c

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

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.97 src/sys/dev/usb/if_urtwn.c:1.98
--- src/sys/dev/usb/if_urtwn.c:1.97	Fri Sep 17 12:55:10 2021
+++ src/sys/dev/usb/if_urtwn.c	Fri Sep 17 12:58:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.97 2021/09/17 12:55:10 nat Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.98 2021/09/17 12:58:31 nat Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.97 2021/09/17 12:55:10 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.98 2021/09/17 12:58:31 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1106,7 +1106,6 @@ urtwn_fw_cmd(struct urtwn_softc *sc, uin
 	mutex_enter(>sc_fwcmd_mtx);
 	fwcur = sc->fwcur;
 	sc->fwcur = (sc->fwcur + 1) % R92C_H2C_NBOX;
-	mutex_exit(>sc_fwcmd_mtx);
 
 	/* Wait for current FW box to be empty. */
 	for (ntries = 0; ntries < 100; ntries++) {
@@ -1117,6 +1116,7 @@ urtwn_fw_cmd(struct urtwn_softc *sc, uin
 	if (ntries == 100) {
 		aprint_error_dev(sc->sc_dev,
 		"could not send firmware command %d\n", id);
+		mutex_exit(>sc_fwcmd_mtx);
 		return ETIMEDOUT;
 	}
 
@@ -1145,6 +1145,7 @@ urtwn_fw_cmd(struct urtwn_softc *sc, uin
 	} else {
 		urtwn_write_region(sc, R92C_HMEBOX(fwcur), cp, len);
 	}
+	mutex_exit(>sc_fwcmd_mtx);
 
 	return 0;
 }



CVS commit: src/sys/dev/usb

2021-09-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Sep 17 12:58:31 UTC 2021

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

Log Message:
Serialize sending of firmware commands to device.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/usb/if_urtwn.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

2021-09-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Sep 17 12:55:10 UTC 2021

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

Log Message:
Use urtwn_delay_ms were possibile.

NFC intended.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/usb/if_urtwn.c

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

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.96 src/sys/dev/usb/if_urtwn.c:1.97
--- src/sys/dev/usb/if_urtwn.c:1.96	Tue Mar  2 22:21:38 2021
+++ src/sys/dev/usb/if_urtwn.c	Fri Sep 17 12:55:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.96 2021/03/02 22:21:38 nat Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.97 2021/09/17 12:55:10 nat Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.96 2021/03/02 22:21:38 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.97 2021/09/17 12:55:10 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1112,7 +1112,7 @@ urtwn_fw_cmd(struct urtwn_softc *sc, uin
 	for (ntries = 0; ntries < 100; ntries++) {
 		if (!(urtwn_read_1(sc, R92C_HMETFR) & (1 << fwcur)))
 			break;
-		DELAY(2000);
+		urtwn_delay_ms(sc, 2);
 	}
 	if (ntries == 100) {
 		aprint_error_dev(sc->sc_dev,
@@ -1195,16 +1195,16 @@ urtwn_rf_read(struct urtwn_softc *sc, in
 
 	urtwn_bb_write(sc, R92C_HSSI_PARAM2(0),
 	reg[0] & ~R92C_HSSI_PARAM2_READ_EDGE);
-	DELAY(1000);
+	urtwn_delay_ms(sc, 1);
 
 	urtwn_bb_write(sc, R92C_HSSI_PARAM2(chain),
 	RW(reg[chain], R92C_HSSI_PARAM2_READ_ADDR, addr) |
 	R92C_HSSI_PARAM2_READ_EDGE);
-	DELAY(1000);
+	urtwn_delay_ms(sc, 1);
 
 	urtwn_bb_write(sc, R92C_HSSI_PARAM2(0),
 	reg[0] | R92C_HSSI_PARAM2_READ_EDGE);
-	DELAY(1000);
+	urtwn_delay_ms(sc, 1);
 
 	if (urtwn_bb_read(sc, R92C_HSSI_PARAM1(chain)) & R92C_HSSI_PARAM1_PI) {
 		val = urtwn_bb_read(sc, R92C_HSPI_READBACK(chain));



CVS commit: src/sys/dev/usb

2021-09-17 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri Sep 17 12:55:10 UTC 2021

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

Log Message:
Use urtwn_delay_ms were possibile.

NFC intended.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/usb/if_urtwn.c

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



CVS commit: src/share/man/man4/man4.evbarm

2021-09-15 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Sep 16 02:53:28 UTC 2021

Modified Files:
src/share/man/man4/man4.evbarm: vchiq.4

Log Message:
Describe how to obtain debugging information from vchiq(4).

Ok nia@


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/man4.evbarm/vchiq.4

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

Modified files:

Index: src/share/man/man4/man4.evbarm/vchiq.4
diff -u src/share/man/man4/man4.evbarm/vchiq.4:1.1 src/share/man/man4/man4.evbarm/vchiq.4:1.2
--- src/share/man/man4/man4.evbarm/vchiq.4:1.1	Fri Feb 26 10:33:46 2021
+++ src/share/man/man4/man4.evbarm/vchiq.4	Thu Sep 16 02:53:28 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: vchiq.4,v 1.1 2021/02/26 10:33:46 nia Exp $
+.\" $NetBSD: vchiq.4,v 1.2 2021/09/16 02:53:28 nat Exp $
 .\"
 .\" Copyright (c) 2021 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -46,7 +46,16 @@ interface exposed to userland.
 Audio output support is provided by the kernel through
 .Xr vcaudio 4 ,
 which uses this messaging interface to the GPU internally.
+.Pp
+Debugging information may be obtained reading the device with
+.Xr cat 1 .
+eg:
+.Dl cat /dev/vchiq
+.Pp
+Information such as slots and usage by particular functions of the VideoCore 4
+device are displayed.
 .Sh SEE ALSO
+.Xr cat 1 ,
 .Xr bcmgpio 4 ,
 .Xr vcaudio 4 ,
 .Pa pkgsrc/misc/raspberrypi-userland ,



CVS commit: src/share/man/man4/man4.evbarm

2021-09-15 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Sep 16 02:53:28 UTC 2021

Modified Files:
src/share/man/man4/man4.evbarm: vchiq.4

Log Message:
Describe how to obtain debugging information from vchiq(4).

Ok nia@


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/man4.evbarm/vchiq.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/arm/broadcom

2021-09-11 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Sep 12 03:58:52 UTC 2021

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

Log Message:
Fix build for uniprocessor.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/arm/broadcom/bcm2835_intr.c

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



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

2021-09-11 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Sep 12 03:58:52 UTC 2021

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

Log Message:
Fix build for uniprocessor.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/arm/broadcom/bcm2835_intr.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_intr.c
diff -u src/sys/arch/arm/broadcom/bcm2835_intr.c:1.40 src/sys/arch/arm/broadcom/bcm2835_intr.c:1.41
--- src/sys/arch/arm/broadcom/bcm2835_intr.c:1.40	Wed Sep  1 22:11:35 2021
+++ src/sys/arch/arm/broadcom/bcm2835_intr.c	Sun Sep 12 03:58:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_intr.c,v 1.40 2021/09/01 22:11:35 jmcneill Exp $	*/
+/*	$NetBSD: bcm2835_intr.c,v 1.41 2021/09/12 03:58:52 nat Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2015, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.40 2021/09/01 22:11:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.41 2021/09/12 03:58:52 nat Exp $");
 
 #define _INTR_PRIVATE
 
@@ -892,11 +892,11 @@ bcm2836mp_ipi_handler(void *priv)
 static void
 bcm2836mp_intr_init(void *priv, struct cpu_info *ci)
 {
+#if defined(MULTIPROCESSOR)
 	const cpuid_t cpuid = ci->ci_core_id;
 
 	KASSERT(cpuid < BCM2836_NCPUS);
 
-#if defined(MULTIPROCESSOR)
 	intr_establish(BCM2836_INT_MAILBOX0_CPUN(cpuid), IPL_HIGH,
 	IST_LEVEL | IST_MPSAFE, bcm2836mp_ipi_handler, ci);
 



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

2019-09-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 21 00:01:33 UTC 2019

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

Log Message:
Fix off by one in sbc encoder.  Test mode transmission and reception
works again.

XXX pullup -8 and -9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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

2019-09-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 21 00:01:33 UTC 2019

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

Log Message:
Fix off by one in sbc encoder.  Test mode transmission and reception
works again.

XXX pullup -8 and -9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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.9 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.10
--- src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.9	Mon Aug  5 13:50:58 2019
+++ src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	Sat Sep 21 00:01:33 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sbc_encode.c,v 1.9 2019/08/05 13:50:58 maya Exp $ */
+/* $NetBSD: sbc_encode.c,v 1.10 2019/09/21 00:01:33 nat Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -902,7 +902,7 @@ stream(int in, int outfd, uint8_t mode, 
 		totalSize += (size_t)mySize[numpkts];
 		numpkts++;
 
-		if (numpkts > 13)
+		if (numpkts > 12)
 			break;
 	}
 



Re: audio usemixer breaks vs(4) Re: CVS commit: src/sys/dev

2017-11-07 Thread Nathanial Sloss
Hello Tetsuya and Christos,


On Tue, 7 Nov 2017 14:45:47 Tetsuya Isaki wrote:
> nat@, (cc: christos@)
> 
> With this change, vs(4) no longer works even if usemixer=0.
> Please revert it, and don't break without public discussion.

vs audio with the mixer enabled has been fixed in a follow up commit.

The change was intended to benifit slow (antiquated) computers that may have 
trouble with the extra code in the audio path with mixing enabled.

> 
> This is the 3rd time you broke vs(4).
> You broke and I repaired.
> You broke and I repaired.
> I spent a lot of time this half year.

The reason as to why vs audio does not work with usemixer=0 is that you 
decided to remove what you considered to be dead code (mulaw, alaw, unsigned 
linear filters).

The time I've spent on audio/ossaudio/bluetooth audio has been at least two 
years non-stop and I will devote more time to it in future - so I think it's 
fair to say we've all spent a lot of time perfecting NetBSD.

> 
> If you can not consider about supported devices (at least
> devices which has active users), please don't touch audio.
> 

Every time I make a change I test it with emulations of various computers, usb 
audio devices, all of the computers I own and bluetooth.

Also an x68k emulation since x68k has been a problem with the changes.

I think to hold the merits of what I done to audio to x68k's abilities to be 
unfair.

I'm actively trying to innovate and to bring NetBSD's audio server into the 21 
century whist still providing a solution for legacy systems we support.

I hope to contine to work on audio in future - if there is an emmense 
objection from others I will stop audio completely and work on something else.

NB: Since I've started to alter audio with regards to mixing and such, I've 
received at least 30 thank you emails from strangers and NetBSD users -  The 
people we write NetBSD for.


> Thanks,

> ---
> Tetsuya Isaki 

Best regards and I hope to collaborate with you on audio in future as it is a 
mutual interest.

Nat

> 
> At Tue, 7 Nov 2017 01:13:19 +,
> 
> > Module Name:src
> > Committed By:   nat
> > Date:   Tue Nov  7 01:13:19 UTC 2017
> > 
> > Modified Files:
> > src/sys/dev: audio.c audiovar.h
> > 
> > Log Message:
> > A sysctl is now available to disable the in kernel mixer.
> > 
> > sysctl -w hw.hdafg0.usemixer=0
> > 
> > There currently is a problem draining the last block with the mixer
> > disabled.  I will fix this in a follow up commit.
> > 
> > AFAIK there will be a problem wiht vs(4) on x68k with the mixer disabled
> > as the filters for mulaw, alaw and unsigned linear have been removed post
> > audio mixing changes.
> > 
> > Documentation for this sysctl variable will be made to audio.4 in a
> > follow up commit.
> > 
> > Ok christos@.
> > 
> > 
> > To generate a diff of this commit:
> > cvs rdiff -u -r1.429 -r1.430 src/sys/dev/audio.c
> > cvs rdiff -u -r1.66 -r1.67 src/sys/dev/audiovar.h


Re: CVS commit: src/sys/dev

2017-11-03 Thread Nathanial Sloss
On Sat, 4 Nov 2017 09:46:03 matthew green wrote:
> > Modified Files:
> > src/sys/dev: audio.c
> > 
> > Log Message:
> > Blocksizes sould be rounded to a power of 2 as OSS applications need
> > this.
> 

Not sure how hard it would be to move it to ossaudio.  I'll try to modify 
ossaudio.c in the kernel and libossaudio and see how it goes.


> sounds like a limitation that belongs in ossaudio not audio.
> is it hard to move there instead?
> 
> 
> mrg.


Re: CVS commit: src/sys/dev

2017-10-26 Thread Nathanial Sloss
There was a typo in the commit message regarding the latency sysctl.

It should read:
hw.hdafg0.latency="value in milliseconds"

Nat


  1   2   >