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

2021-06-10 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Jun 11 05:10:45 UTC 2021

Modified Files:
src/share/man/man4/man4.sparc: tslot.4

Log Message:
Add a bugs section about inserting two cards with different requirements.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/man4.sparc/tslot.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.sparc/tslot.4
diff -u src/share/man/man4/man4.sparc/tslot.4:1.4 src/share/man/man4/man4.sparc/tslot.4:1.5
--- src/share/man/man4/man4.sparc/tslot.4:1.4	Fri Feb 17 22:24:47 2017
+++ src/share/man/man4/man4.sparc/tslot.4	Fri Jun 11 05:10:45 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: tslot.4,v 1.4 2017/02/17 22:24:47 christos Exp $
+.\"	$NetBSD: tslot.4,v 1.5 2021/06/11 05:10:45 jdc Exp $
 .\"
 .\" Copyright (c) 2005 Michael Lorenz
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\" ported from OpenBSD
-.Dd February 17, 2017
+.Dd June 11, 2021
 .Dt TSLOT 4 sparc
 .Os
 .Sh NAME
@@ -50,3 +50,6 @@ handling the attachment and initializati
 .Xr pcmcia 4 ,
 .Xr sbus 4 ,
 .Xr sparc/tctrl 4
+.Sh BUGS
+Inserting two cards with different requirements, like voltage,
+may cause one of them not to function correctly.



CVS commit: src/sys/dev/ic

2021-06-10 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Jun 11 05:00:42 UTC 2021

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

Log Message:
Add a missing htole16() around the length passed to bpf_mtap2().
Allows `tcpdump` to work on BE machines without panicing the kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/ic/an.c

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

Modified files:

Index: src/sys/dev/ic/an.c
diff -u src/sys/dev/ic/an.c:1.73 src/sys/dev/ic/an.c:1.74
--- src/sys/dev/ic/an.c:1.73	Wed Jan 29 14:09:58 2020
+++ src/sys/dev/ic/an.c	Fri Jun 11 05:00:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: an.c,v 1.73 2020/01/29 14:09:58 thorpej Exp $	*/
+/*	$NetBSD: an.c,v 1.74 2021/06/11 05:00:41 jdc Exp $	*/
 /*
  * Copyright (c) 1997, 1998, 1999
  *	Bill Paul .  All rights reserved.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.73 2020/01/29 14:09:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.74 2021/06/11 05:00:41 jdc Exp $");
 
 
 #include 
@@ -1509,7 +1509,7 @@ an_rx_intr(struct an_softc *sc)
 		(le16toh(frmhdr.an_rx_status) & AN_STAT_UNDECRYPTABLE))
 		tap->ar_flags |= IEEE80211_RADIOTAP_F_BADFCS;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, tap->ar_ihdr.it_len, m,
+		bpf_mtap2(sc->sc_drvbpf, tap, htole16(tap->ar_ihdr.it_len), m,
 		BPF_D_IN);
 	}
 	wh = mtod(m, struct ieee80211_frame_min *);



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

2021-06-10 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Jun 11 04:58:30 UTC 2021

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

Log Message:
During slot enable and disable, make sure that the card Access and VCC
controls are enabled and disabled at the same time.
Also remove the software reset during slot enable (we are already in
reset because of the earlier Access and VCC changes).
While here, convert DELAY() to delay() and tsleep(), like nell(4).


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/dev/ts102.c

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

Modified files:

Index: src/sys/arch/sparc/dev/ts102.c
diff -u src/sys/arch/sparc/dev/ts102.c:1.19 src/sys/arch/sparc/dev/ts102.c:1.20
--- src/sys/arch/sparc/dev/ts102.c:1.19	Sat Apr 24 23:36:49 2021
+++ src/sys/arch/sparc/dev/ts102.c	Fri Jun 11 04:58:30 2021
@@ -1,5 +1,5 @@
 /*	$OpenBSD: ts102.c,v 1.14 2005/01/27 17:03:23 millert Exp $	*/
-/*	$NetBSD: ts102.c,v 1.19 2021/04/24 23:36:49 thorpej Exp $ */
+/*	$NetBSD: ts102.c,v 1.20 2021/06/11 04:58:30 jdc Exp $ */
 /*
  * Copyright (c) 2003, 2004, Miodrag Vallat.
  * Copyright (c) 2005, Michael Lorenz.
@@ -182,6 +182,7 @@ static void tslot_slot_intr(struct tslot
 static void tslot_slot_settype(pcmcia_chipset_handle_t, int);
 static void tslot_update_lcd(struct tslot_softc *, int, int);
 static void tslot_intr_dispatch(void *arg);
+void tslot_delay(struct tslot_softc *sc, unsigned int ms);
 
 CFATTACH_DECL_NEW(tslot, sizeof(struct tslot_softc),
 tslot_match, tslot_attach, NULL, NULL);
@@ -620,22 +621,35 @@ static void
 tslot_slot_disable(pcmcia_chipset_handle_t pch)
 {
 	struct tslot_data *td = (struct tslot_data *)pch;
+	int status;
+
 #ifdef TSLOT_DEBUG
 	printf("%s: disable slot %d\n",
 	device_xname(td->td_parent->sc_dev), td->td_slot);
 #endif
 
-	/*
-	 * Disable card access.
-	 */
-	TSLOT_WRITE(td, TS102_REG_CARD_A_STS,
-	TSLOT_READ(td, TS102_REG_CARD_A_STS) & ~TS102_CARD_STS_ACEN);
+	status = TSLOT_READ(td, TS102_REG_CARD_A_STS);
+
+	status &= ~TS102_CARD_STS_ACEN;
 
 	/*
 	 * Disable interrupts, except for insertion.
 	 */
 	TSLOT_WRITE(td, TS102_REG_CARD_A_INT,
 	TS102_CARD_INT_MASK_CARDDETECT_STATUS);
+
+	/*
+	 * Power down the socket and disable access
+	 */
+	status &= ~TS102_CARD_STS_ACEN;
+	status &= ~(TS102_CARD_STS_VPP1_MASK | TS102_CARD_STS_VPP2_MASK);
+	status |= TS102_CARD_STS_VCCEN;
+	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status);
+	
+	/*
+	 * wait 300ms until power fails (Tpf).
+	 */
+	tslot_delay(td->td_parent, 300);
 }
 
 static void
@@ -652,18 +666,23 @@ tslot_slot_enable(pcmcia_chipset_handle_
 	/* Power down the socket to reset it */
 	status = TSLOT_READ(td, TS102_REG_CARD_A_STS);
 	TSPRINTF("status: %x\n", status);
-	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status | TS102_CARD_STS_VCCEN);
+
+	status &= ~TS102_CARD_STS_ACEN;
+	status &= ~(TS102_CARD_STS_VPP1_MASK | TS102_CARD_STS_VPP2_MASK);
+	status |= TS102_CARD_STS_VCCEN;
+	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status);
 
 	/*
 	 * wait 300ms until power fails (Tpf).  Then, wait 100ms since we
 	 * are changing Vcc (Toff).
 	 */
-	DELAY((300 + 100) * 1000);
+	tslot_delay(td->td_parent, 300 + 100);
 
 	/*
 	 * Power on the card if not already done, and enable card access
 	 */
 	status |= TS102_CARD_STS_ACEN;
+	status |= TS102_CARD_STS_VPP1_VCC;
 	status &= ~TS102_CARD_STS_VCCEN;
 	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status);
 
@@ -671,22 +690,18 @@ tslot_slot_enable(pcmcia_chipset_handle_
 	 * wait 100ms until power raise (Tpr) and 20ms to become
 	 * stable (Tsu(Vcc)).
 	 */
-	DELAY((100 + 20) * 1000);
-
-	status &= ~TS102_CARD_STS_VPP1_MASK;
-	status |= TS102_CARD_STS_VPP1_VCC;
-	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status);
+	tslot_delay(td->td_parent, 100 + 20);
 
 	/*
 	 * hold RESET at least 20us.
 	 */
 	intr = TSLOT_READ(td, TS102_REG_CARD_A_INT);
-	TSLOT_WRITE(td, TS102_REG_CARD_A_INT, TS102_CARD_INT_SOFT_RESET);
-	DELAY(20);
-	TSLOT_WRITE(td, TS102_REG_CARD_A_INT, intr);
+	delay(20);
+	TSLOT_WRITE(td, TS102_REG_CARD_A_INT,
+	intr & ~TS102_CARD_INT_SOFT_RESET);
 
 	/* wait 20ms as per pc card standard (r2.01) section 4.3.6 */
-	DELAY(20 * 1000);
+	tslot_delay(td->td_parent, 20);
 
 	/* We need level-triggered interrupts for PC Card hardware */
 	TSLOT_WRITE(td, TS102_REG_CARD_A_STS,
@@ -709,7 +724,7 @@ tslot_slot_enable(pcmcia_chipset_handle_
 		if (status & TS102_CARD_STS_RDY)
 			break;
 		else
-			DELAY(100);
+			delay(100);
 	}
 
 	if (i == 0) {
@@ -1020,3 +1035,24 @@ tslot_update_lcd(struct tslot_softc *sc,
 	}
 #endif
 }
+
+/*
+ * Delay and possibly yield CPU.
+ * XXX - assumes a context
+ */
+void
+tslot_delay(struct tslot_softc *sc, unsigned int ms)
+{
+	unsigned int ticks = mstohz(ms);
+
+	if (cold || ticks == 0) {
+		delay(ms);
+		return;
+	}
+
+#ifdef DIAGNOSTIC
+	if (ticks > 60*hz)
+		panic("tslot: preposterous delay: %u", ticks);
+#endif
+	tsleep(sc, 0, "tslotdel", ticks);

CVS commit: src/sys/dev/hyperv

2021-06-10 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Jun 10 07:48:01 UTC 2021

Modified Files:
src/sys/dev/hyperv: hvs.c

Log Message:
hvs(4): Pass correct pointer of scsibus device to scsi_probe_bus().


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hyperv/hvs.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/hyperv/hvs.c
diff -u src/sys/dev/hyperv/hvs.c:1.5 src/sys/dev/hyperv/hvs.c:1.6
--- src/sys/dev/hyperv/hvs.c:1.5	Sat Apr 24 23:36:54 2021
+++ src/sys/dev/hyperv/hvs.c	Thu Jun 10 07:48:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvs.c,v 1.5 2021/04/24 23:36:54 thorpej Exp $	*/
+/*	$NetBSD: hvs.c,v 1.6 2021/06/10 07:48:00 nonaka Exp $	*/
 /*	$OpenBSD: hvs.c,v 1.17 2017/08/10 17:22:48 mikeb Exp $	*/
 
 /*-
@@ -37,7 +37,7 @@
 /* #define HVS_DEBUG_IO */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvs.c,v 1.5 2021/04/24 23:36:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvs.c,v 1.6 2021/06/10 07:48:00 nonaka Exp $");
 
 #include 
 #include 
@@ -833,7 +833,7 @@ hvs_scsi_probe(void *arg)
 	struct hvs_softc *sc = arg;
 
 	if (sc->sc_scsibus != NULL)
-		scsi_probe_bus((void *)sc->sc_scsibus, -1, -1);
+		scsi_probe_bus(device_private(sc->sc_scsibus), -1, -1);
 }
 
 static void



CVS commit: src/tests/lib/libcurses/director

2021-06-10 Thread Michael Forney
Module Name:src
Committed By:   mcf
Date:   Thu Jun 10 07:21:07 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: director.c

Log Message:
Unset ESCDELAY in libcurses test director to ensure consistent results

Non-default values of ESCDELAY may result in unexpected test failures.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/lib/libcurses/director/director.c

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

Modified files:

Index: src/tests/lib/libcurses/director/director.c
diff -u src/tests/lib/libcurses/director/director.c:1.28 src/tests/lib/libcurses/director/director.c:1.29
--- src/tests/lib/libcurses/director/director.c:1.28	Sat Feb 13 09:18:12 2021
+++ src/tests/lib/libcurses/director/director.c	Thu Jun 10 07:21:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: director.c,v 1.28 2021/02/13 09:18:12 rillig Exp $	*/
+/*	$NetBSD: director.c,v 1.29 2021/06/10 07:21:07 mcf Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -195,6 +195,9 @@ main(int argc, char *argv[])
 	if (setenv("TERM", term, 1) != 0)
 		err(2, "Failed to set TERM variable");
 
+	if (unsetenv("ESCDELAY") != 0)
+		err(2, "Failed to unset ESCDELAY variable");
+
 	if (stat(termpath, ) == -1)
 		err(1, "Cannot stat %s", termpath);
 



CVS commit: src/lib/libcurses

2021-06-10 Thread Michael Forney
Module Name:src
Committed By:   mcf
Date:   Thu Jun 10 07:15:40 UTC 2021

Modified Files:
src/lib/libcurses: setterm.c

Log Message:
Add missing newline to debug trace message

ok blymn@


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/lib/libcurses/setterm.c

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

Modified files:

Index: src/lib/libcurses/setterm.c
diff -u src/lib/libcurses/setterm.c:1.68 src/lib/libcurses/setterm.c:1.69
--- src/lib/libcurses/setterm.c:1.68	Fri Oct 26 22:22:24 2018
+++ src/lib/libcurses/setterm.c	Thu Jun 10 07:15:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: setterm.c,v 1.68 2018/10/26 22:22:24 uwe Exp $	*/
+/*	$NetBSD: setterm.c,v 1.69 2021/06/10 07:15:40 mcf Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)setterm.c	8.8 (Berkeley) 10/25/94";
 #else
-__RCSID("$NetBSD: setterm.c,v 1.68 2018/10/26 22:22:24 uwe Exp $");
+__RCSID("$NetBSD: setterm.c,v 1.69 2021/06/10 07:15:40 mcf Exp $");
 #endif
 #endif /* not lint */
 
@@ -103,7 +103,7 @@ _cursesi_setterm(char *type, SCREEN *scr
 		t_lines(screen->term) = 1;
 	}
 #ifdef DEBUG
-	__CTRACE(__CTRACE_INIT, "setterm: filtered %d", screen->filtered);
+	__CTRACE(__CTRACE_INIT, "setterm: filtered %d\n", screen->filtered);
 #endif
 
 	if ((p = getenv("ESCDELAY")) != NULL)