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

2023-04-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 11 12:58:03 UTC 2023

Modified Files:
src/sys/arch/evbarm/dev: plcom.c

Log Message:
evbarm/plcom(4): Note ttylock in comment, not tty_lock.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/evbarm/dev/plcom.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/evbarm/dev/plcom.c
diff -u src/sys/arch/evbarm/dev/plcom.c:1.68 src/sys/arch/evbarm/dev/plcom.c:1.69
--- src/sys/arch/evbarm/dev/plcom.c:1.68	Tue Apr 11 12:56:07 2023
+++ src/sys/arch/evbarm/dev/plcom.c	Tue Apr 11 12:58:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: plcom.c,v 1.68 2023/04/11 12:56:07 riastradh Exp $	*/
+/*	$NetBSD: plcom.c,v 1.69 2023/04/11 12:58:03 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2001 ARM Ltd
@@ -93,13 +93,13 @@
  * Derived from the NS16550AF com driver.
  *
  * Lock order:
- *	tty_lock (IPL_VM)
+ *	ttylock (IPL_VM)
  *	-> sc->sc_lock (IPL_HIGH)
  *	-> timecounter_lock (IPL_HIGH)
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.68 2023/04/11 12:56:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.69 2023/04/11 12:58:03 riastradh Exp $");
 
 #include "opt_plcom.h"
 #include "opt_kgdb.h"



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

2023-04-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 11 12:58:03 UTC 2023

Modified Files:
src/sys/arch/evbarm/dev: plcom.c

Log Message:
evbarm/plcom(4): Note ttylock in comment, not tty_lock.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/evbarm/dev/plcom.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/evbarm/dev

2023-04-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 11 12:56:08 UTC 2023

Modified Files:
src/sys/arch/evbarm/dev: plcom.c plcomreg.h plcomvar.h

Log Message:
evbarm/plcom(4): Sync some recent changes from com(4).

- Nix quirky `integrate' macro.
- Omit needless spltty in plcomstart.
- Comment on lock order.
- Update confusing comment about hangup delay.
- Add include guards.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/evbarm/dev/plcom.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/dev/plcomreg.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/dev/plcomvar.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/evbarm/dev/plcom.c
diff -u src/sys/arch/evbarm/dev/plcom.c:1.67 src/sys/arch/evbarm/dev/plcom.c:1.68
--- src/sys/arch/evbarm/dev/plcom.c:1.67	Tue Jan 24 06:56:40 2023
+++ src/sys/arch/evbarm/dev/plcom.c	Tue Apr 11 12:56:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: plcom.c,v 1.67 2023/01/24 06:56:40 mlelstv Exp $	*/
+/*	$NetBSD: plcom.c,v 1.68 2023/04/11 12:56:07 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2001 ARM Ltd
@@ -91,10 +91,15 @@
  * COM driver for the Prime Cell PL010 and PL011 UARTs. Both are is similar to
  * the 16C550, but have a completely different programmer's model.
  * Derived from the NS16550AF com driver.
+ *
+ * Lock order:
+ *	tty_lock (IPL_VM)
+ *	-> sc->sc_lock (IPL_HIGH)
+ *	-> timecounter_lock (IPL_HIGH)
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.67 2023/01/24 06:56:40 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.68 2023/04/11 12:56:07 riastradh Exp $");
 
 #include "opt_plcom.h"
 #include "opt_kgdb.h"
@@ -181,12 +186,11 @@ void	plcomcnputc	(dev_t, int);
 void	plcomcnpollc	(dev_t, int);
 void	plcomcnhalt	(dev_t);
 
-#define	integrate	static inline
 void 	plcomsoft	(void *);
-integrate void plcom_rxsoft	(struct plcom_softc *, struct tty *);
-integrate void plcom_txsoft	(struct plcom_softc *, struct tty *);
-integrate void plcom_stsoft	(struct plcom_softc *, struct tty *);
-integrate void plcom_schedrx	(struct plcom_softc *);
+static inline void plcom_rxsoft	(struct plcom_softc *, struct tty *);
+static inline void plcom_txsoft	(struct plcom_softc *, struct tty *);
+static inline void plcom_stsoft	(struct plcom_softc *, struct tty *);
+static inline void plcom_schedrx	(struct plcom_softc *);
 void	plcomdiag		(void *);
 
 bool	plcom_intstatus(struct plcom_instance *, u_int *);
@@ -745,9 +749,9 @@ plcom_shutdown(struct plcom_softc *sc)
 	mutex_spin_exit(_lock);
 
 	/*
-	 * Hang up if necessary.  Wait a bit, so the other side has time to
-	 * notice even if we immediately open the port again.
-	 * Avoid tsleeping above splhigh().
+	 * Hang up if necessary.  Record when we hung up, so if we
+	 * immediately open the port again, we will wait a bit until
+	 * the other side has had time to notice that we hung up.
 	 */
 	if (ISSET(tp->t_cflag, HUPCL)) {
 		plcom_modem(sc, 0);
@@ -1249,7 +1253,7 @@ plcomioctl(dev_t dev, u_long cmd, void *
 	return error;
 }
 
-integrate void
+static inline void
 plcom_schedrx(struct plcom_softc *sc)
 {
 
@@ -1765,19 +1769,17 @@ plcomstart(struct tty *tp)
 	struct plcom_softc *sc =
 		device_lookup_private(_cd, PLCOMUNIT(tp->t_dev));
 	struct plcom_instance *pi = >sc_pi;
-	int s;
 
 	if (PLCOM_ISALIVE(sc) == 0)
 		return;
 
-	s = spltty();
 	if (ISSET(tp->t_state, TS_BUSY | TS_TIMEOUT | TS_TTSTOP))
-		goto out;
+		return;
 	if (sc->sc_tx_stopped)
-		goto out;
+		return;
 
 	if (!ttypull(tp))
-		goto out;
+		return;
 
 	/* Grab the first contiguous region of buffer space. */
 	{
@@ -1825,9 +1827,6 @@ plcomstart(struct tty *tp)
 		sc->sc_tba += n;
 	}
 	mutex_spin_exit(>sc_lock);
-out:
-	splx(s);
-	return;
 }
 
 /*
@@ -1870,7 +1869,7 @@ plcomdiag(void *arg)
 	floods, floods == 1 ? "" : "s");
 }
 
-integrate void
+static inline void
 plcom_rxsoft(struct plcom_softc *sc, struct tty *tp)
 {
 	int (*rint) (int, struct tty *) = tp->t_linesw->l_rint;
@@ -1971,7 +1970,7 @@ plcom_rxsoft(struct plcom_softc *sc, str
 	}
 }
 
-integrate void
+static inline void
 plcom_txsoft(struct plcom_softc *sc, struct tty *tp)
 {
 
@@ -1983,7 +1982,7 @@ plcom_txsoft(struct plcom_softc *sc, str
 	(*tp->t_linesw->l_start)(tp);
 }
 
-integrate void
+static inline void
 plcom_stsoft(struct plcom_softc *sc, struct tty *tp)
 {
 	u_char msr, delta;

Index: src/sys/arch/evbarm/dev/plcomreg.h
diff -u src/sys/arch/evbarm/dev/plcomreg.h:1.7 src/sys/arch/evbarm/dev/plcomreg.h:1.8
--- src/sys/arch/evbarm/dev/plcomreg.h:1.7	Tue Jan 24 06:56:40 2023
+++ src/sys/arch/evbarm/dev/plcomreg.h	Tue Apr 11 12:56:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: plcomreg.h,v 1.7 2023/01/24 06:56:40 mlelstv Exp $	*/
+/*	$NetBSD: plcomreg.h,v 1.8 2023/04/11 12:56:07 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2001 ARM Ltd
@@ -29,6 +29,8 @@
  * SUCH DAMAGE.
 */
 
+#ifndef	_SYS_ARCH_EVBARM_DEV_PLCOMREG_H_
+#define	

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

2023-04-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 11 12:56:08 UTC 2023

Modified Files:
src/sys/arch/evbarm/dev: plcom.c plcomreg.h plcomvar.h

Log Message:
evbarm/plcom(4): Sync some recent changes from com(4).

- Nix quirky `integrate' macro.
- Omit needless spltty in plcomstart.
- Comment on lock order.
- Update confusing comment about hangup delay.
- Add include guards.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/evbarm/dev/plcom.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/dev/plcomreg.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/dev/plcomvar.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/evbarm/dev

2022-09-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep 27 06:11:36 UTC 2022

Modified Files:
src/sys/arch/evbarm/dev: plcom.c

Log Message:
malloc -> kmem


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/evbarm/dev/plcom.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/evbarm/dev/plcom.c
diff -u src/sys/arch/evbarm/dev/plcom.c:1.64 src/sys/arch/evbarm/dev/plcom.c:1.65
--- src/sys/arch/evbarm/dev/plcom.c:1.64	Wed Oct 20 01:09:49 2021
+++ src/sys/arch/evbarm/dev/plcom.c	Tue Sep 27 06:11:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: plcom.c,v 1.64 2021/10/20 01:09:49 jmcneill Exp $	*/
+/*	$NetBSD: plcom.c,v 1.65 2022/09/27 06:11:36 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001 ARM Ltd
@@ -94,7 +94,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.64 2021/10/20 01:09:49 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.65 2022/09/27 06:11:36 skrll Exp $");
 
 #include "opt_plcom.h"
 #include "opt_ddb.h"
@@ -127,7 +127,7 @@ __KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -514,7 +514,7 @@ plcom_attach_subr(struct plcom_softc *sc
 	tp->t_hwiflow = plcomhwiflow;
 
 	sc->sc_tty = tp;
-	sc->sc_rbuf = malloc(plcom_rbuf_size << 1, M_DEVBUF, M_WAITOK);
+	sc->sc_rbuf = kmem_alloc(plcom_rbuf_size << 1, KM_SLEEP);
 	sc->sc_rbput = sc->sc_rbget = sc->sc_rbuf;
 	sc->sc_rbavail = plcom_rbuf_size;
 	sc->sc_ebuf = sc->sc_rbuf + (plcom_rbuf_size << 1);
@@ -624,7 +624,7 @@ plcom_detach(device_t self, int flags)
 	}
 
 	/* Free the receive buffer. */
-	free(sc->sc_rbuf, M_DEVBUF);
+	kmem_free(sc->sc_rbuf, sc->sc_ebuf - sc->sc_rbuf);
 
 	/* Detach and free the tty. */
 	tty_detach(sc->sc_tty);



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

2022-09-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep 27 06:11:36 UTC 2022

Modified Files:
src/sys/arch/evbarm/dev: plcom.c

Log Message:
malloc -> kmem


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/evbarm/dev/plcom.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/evbarm/dev

2021-10-17 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 17 22:34:17 UTC 2021

Modified Files:
src/sys/arch/evbarm/dev: plcom.c plcomvar.h

Log Message:
plcom: speed up close with HUPCL set

Instead of incurring a 1s penalty on close of a plcom device with HUPCL set,
defer the sleep until the next open, and only sleep if necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/evbarm/dev/plcom.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/dev/plcomvar.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/evbarm/dev/plcom.c
diff -u src/sys/arch/evbarm/dev/plcom.c:1.62 src/sys/arch/evbarm/dev/plcom.c:1.63
--- src/sys/arch/evbarm/dev/plcom.c:1.62	Mon Oct 19 17:00:02 2020
+++ src/sys/arch/evbarm/dev/plcom.c	Sun Oct 17 22:34:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: plcom.c,v 1.62 2020/10/19 17:00:02 tnn Exp $	*/
+/*	$NetBSD: plcom.c,v 1.63 2021/10/17 22:34:17 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2001 ARM Ltd
@@ -94,7 +94,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.62 2020/10/19 17:00:02 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.63 2021/10/17 22:34:17 jmcneill Exp $");
 
 #include "opt_plcom.h"
 #include "opt_ddb.h"
@@ -686,10 +686,8 @@ plcom_shutdown(struct plcom_softc *sc)
 	 */
 	if (ISSET(tp->t_cflag, HUPCL)) {
 		plcom_modem(sc, 0);
-		mutex_spin_exit(>sc_lock);
-		/* XXX will only timeout */
-		(void) kpause(ttclos, false, hz, NULL);
-		mutex_spin_enter(>sc_lock);
+		microtime(>sc_hup_pending);
+		sc->sc_hup_pending.tv_sec++;
 	}
 
 	sc->sc_cr = 0;
@@ -773,6 +771,7 @@ plcomopen(dev_t dev, int flag, int mode,
 	 */
 	if (!ISSET(tp->t_state, TS_ISOPEN) && tp->t_wopen == 0) {
 		struct termios t;
+		struct timeval now, diff;
 
 		tp->t_dev = dev;
 
@@ -790,6 +789,18 @@ plcomopen(dev_t dev, int flag, int mode,
 			mutex_spin_enter(>sc_lock);
 		}
 
+		if (timerisset(>sc_hup_pending)) {
+			microtime();
+			while (timercmp(, >sc_hup_pending, <)) {
+timersub(>sc_hup_pending, , );
+const int ms = diff.tv_sec * 100 +
+uimax(diff.tv_usec / 1000, 1);
+kpause(ttclos, false, mstohz(ms), >sc_lock);
+microtime();
+			}
+			timerclear(>sc_hup_pending);
+		}
+
 		/* Turn on interrupts. */
 		/* IER_ERXRDY | IER_ERLS | IER_EMSC;  */
 		/* Fetch the current modem control status, needed later. */

Index: src/sys/arch/evbarm/dev/plcomvar.h
diff -u src/sys/arch/evbarm/dev/plcomvar.h:1.17 src/sys/arch/evbarm/dev/plcomvar.h:1.18
--- src/sys/arch/evbarm/dev/plcomvar.h:1.17	Thu Oct 12 20:05:42 2017
+++ src/sys/arch/evbarm/dev/plcomvar.h	Sun Oct 17 22:34:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: plcomvar.h,v 1.17 2017/10/12 20:05:42 skrll Exp $	*/
+/*	$NetBSD: plcomvar.h,v 1.18 2021/10/17 22:34:17 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -104,6 +104,8 @@ struct plcom_softc {
 	sc_swflags;
 	u_int sc_fifolen;
 
+	struct timeval sc_hup_pending;
+
 	u_int sc_r_hiwat,
 	  sc_r_lowat;
 	u_char *volatile sc_rbget,



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

2021-10-17 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 17 22:34:17 UTC 2021

Modified Files:
src/sys/arch/evbarm/dev: plcom.c plcomvar.h

Log Message:
plcom: speed up close with HUPCL set

Instead of incurring a 1s penalty on close of a plcom device with HUPCL set,
defer the sleep until the next open, and only sleep if necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/evbarm/dev/plcom.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/dev/plcomvar.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/evbarm/dev

2019-07-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul 23 15:56:14 UTC 2019

Modified Files:
src/sys/arch/evbarm/dev: plcom.c

Log Message:
Add cn_halt function, disable interrupts when halting


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/evbarm/dev/plcom.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/evbarm/dev/plcom.c
diff -u src/sys/arch/evbarm/dev/plcom.c:1.58 src/sys/arch/evbarm/dev/plcom.c:1.59
--- src/sys/arch/evbarm/dev/plcom.c:1.58	Tue Jul 23 12:13:47 2019
+++ src/sys/arch/evbarm/dev/plcom.c	Tue Jul 23 15:56:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: plcom.c,v 1.58 2019/07/23 12:13:47 skrll Exp $	*/
+/*	$NetBSD: plcom.c,v 1.59 2019/07/23 15:56:14 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2001 ARM Ltd
@@ -94,7 +94,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.58 2019/07/23 12:13:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.59 2019/07/23 15:56:14 jmcneill Exp $");
 
 #include "opt_plcom.h"
 #include "opt_ddb.h"
@@ -178,6 +178,7 @@ dev_type_poll(plcompoll);
 int	plcomcngetc	(dev_t);
 void	plcomcnputc	(dev_t, int);
 void	plcomcnpollc	(dev_t, int);
+void	plcomcnhalt	(dev_t);
 
 #define	integrate	static inline
 void 	plcomsoft	(void *);
@@ -2407,7 +2408,7 @@ plcominit(struct plcom_instance *pi, int
  */
 struct consdev plcomcons = {
 	NULL, NULL, plcomcngetc, plcomcnputc, plcomcnpollc, NULL,
-	NULL, NULL, NODEV, CN_NORMAL
+	plcomcnhalt, NULL, NODEV, CN_NORMAL
 };
 
 int
@@ -2466,6 +2467,23 @@ plcomcnpollc(dev_t dev, int on)
 	plcom_readaheadcount = 0;
 }
 
+void
+plcomcnhalt(dev_t dev)
+{
+	struct plcom_instance *pi = _info;
+
+	switch (pi->pi_type) {
+	case PLCOM_TYPE_PL010:
+		PWRITE1(pi, PL010COM_CR, PL01X_CR_UARTEN);
+		break;
+	case PLCOM_TYPE_PL011:
+		PWRITE4(pi, PL011COM_CR,
+		PL01X_CR_UARTEN | PL011_CR_RXE | PL011_CR_TXE);
+		PWRITE4(pi, PL011COM_IMSC, 0);
+		break;
+	}
+}
+
 #ifdef KGDB
 int
 plcom_kgdb_attach(struct plcom_instance *pi, int rate, int frequency,



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

2019-07-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul 23 15:56:14 UTC 2019

Modified Files:
src/sys/arch/evbarm/dev: plcom.c

Log Message:
Add cn_halt function, disable interrupts when halting


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/evbarm/dev/plcom.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/evbarm/dev

2019-07-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jul 23 12:13:47 UTC 2019

Modified Files:
src/sys/arch/evbarm/dev: plcom.c

Log Message:
Don't busy wait for a character in plcom_common_getc, but instead
return -1 if there are no characters available.

Fixes WSDISPLAY_MULTICONS for RaspberryPI and GENERIC.

Thanks to jmcneill@ for the hint


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/evbarm/dev/plcom.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/evbarm/dev/plcom.c
diff -u src/sys/arch/evbarm/dev/plcom.c:1.57 src/sys/arch/evbarm/dev/plcom.c:1.58
--- src/sys/arch/evbarm/dev/plcom.c:1.57	Tue Jul 23 12:10:38 2019
+++ src/sys/arch/evbarm/dev/plcom.c	Tue Jul 23 12:13:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: plcom.c,v 1.57 2019/07/23 12:10:38 skrll Exp $	*/
+/*	$NetBSD: plcom.c,v 1.58 2019/07/23 12:13:47 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001 ARM Ltd
@@ -94,7 +94,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.57 2019/07/23 12:10:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.58 2019/07/23 12:13:47 skrll Exp $");
 
 #include "opt_plcom.h"
 #include "opt_ddb.h"
@@ -2275,7 +2275,7 @@ int
 plcom_common_getc(dev_t dev, struct plcom_instance *pi)
 {
 	int s = splserial();
-	u_char stat, c;
+	u_char c;
 
 	/* got a character from reading things earlier */
 	if (plcom_readaheadcount > 0) {
@@ -2290,9 +2290,10 @@ plcom_common_getc(dev_t dev, struct plco
 		return c;
 	}
 
-	/* block until a character becomes available */
-	while (ISSET(stat = PREAD1(pi, PL01XCOM_FR), PL01X_FR_RXFE))
-		;
+	if (ISSET(PREAD1(pi, PL01XCOM_FR), PL01X_FR_RXFE)) {
+		splx(s);
+		return -1;
+	}
 
 	c = PREAD1(pi, PL01XCOM_DR);
 	{



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

2019-07-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jul 23 12:13:47 UTC 2019

Modified Files:
src/sys/arch/evbarm/dev: plcom.c

Log Message:
Don't busy wait for a character in plcom_common_getc, but instead
return -1 if there are no characters available.

Fixes WSDISPLAY_MULTICONS for RaspberryPI and GENERIC.

Thanks to jmcneill@ for the hint


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/evbarm/dev/plcom.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/evbarm/dev

2019-07-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jul 23 12:10:38 UTC 2019

Modified Files:
src/sys/arch/evbarm/dev: plcom.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/evbarm/dev/plcom.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/evbarm/dev

2019-07-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jul 23 12:10:38 UTC 2019

Modified Files:
src/sys/arch/evbarm/dev: plcom.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/evbarm/dev/plcom.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/evbarm/dev/plcom.c
diff -u src/sys/arch/evbarm/dev/plcom.c:1.56 src/sys/arch/evbarm/dev/plcom.c:1.57
--- src/sys/arch/evbarm/dev/plcom.c:1.56	Tue Oct 23 09:15:36 2018
+++ src/sys/arch/evbarm/dev/plcom.c	Tue Jul 23 12:10:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: plcom.c,v 1.56 2018/10/23 09:15:36 jmcneill Exp $	*/
+/*	$NetBSD: plcom.c,v 1.57 2019/07/23 12:10:38 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001 ARM Ltd
@@ -94,7 +94,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.56 2018/10/23 09:15:36 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.57 2019/07/23 12:10:38 skrll Exp $");
 
 #include "opt_plcom.h"
 #include "opt_ddb.h"
@@ -2520,7 +2520,7 @@ plcom_is_console(bus_space_tag_t iot, bu
 #ifdef KGDB
 	else if (!plcom_kgdb_attached &&
 	bus_space_is_equal(iot, plcomkgdb_info.pi_iot) &&
-	iobase == plcomkgdb_info.pi_iobase) 
+	iobase == plcomkgdb_info.pi_iobase)
 		help = plcomkgdb_info.pi_ioh;
 #endif
 	else