Module Name:    src
Committed By:   martin
Date:           Tue May 26 13:24:53 UTC 2020

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

Log Message:
Make the readahead-while-sending-output code conditional in
com_common_putc(), only erquest readahead before interrupts are enabled
and when called from comcnputc().
Fixes PR kern/55286.


To generate a diff of this commit:
cvs rdiff -u -r1.358 -r1.359 src/sys/dev/ic/com.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/com.c
diff -u src/sys/dev/ic/com.c:1.358 src/sys/dev/ic/com.c:1.359
--- src/sys/dev/ic/com.c:1.358	Fri May  1 07:27:51 2020
+++ src/sys/dev/ic/com.c	Tue May 26 13:24:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.358 2020/05/01 07:27:51 simonb Exp $ */
+/* $NetBSD: com.c,v 1.359 2020/05/26 13:24:52 martin Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.358 2020/05/01 07:27:51 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.359 2020/05/26 13:24:52 martin Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -159,7 +159,7 @@ int	com_to_tiocm(struct com_softc *);
 void	com_iflush(struct com_softc *);
 
 int	com_common_getc(dev_t, struct com_regs *);
-static void	com_common_putc(dev_t, struct com_regs *, int);
+static void	com_common_putc(dev_t, struct com_regs *, int, int);
 
 int	cominit(struct com_regs *, int, int, int, tcflag_t);
 
@@ -2399,12 +2399,12 @@ com_common_getc(dev_t dev, struct com_re
 }
 
 static void
-com_common_putc(dev_t dev, struct com_regs *regsp, int c)
+com_common_putc(dev_t dev, struct com_regs *regsp, int c, int with_readahead)
 {
 	int s = splserial();
 	int cin, stat, timo;
 
-	if (com_readaheadcount < MAX_READAHEAD
+	if (with_readahead && com_readaheadcount < MAX_READAHEAD
 	     && ISSET(stat = CSR_READ_1(regsp, COM_REG_LSR), LSR_RXRDY)) {
 		int cn_trapped = 0;
 		cin = CSR_READ_1(regsp, COM_REG_RXDATA);
@@ -2572,7 +2572,7 @@ void
 comcnputc(dev_t dev, int c)
 {
 
-	com_common_putc(dev, &comcons_info.regs, c);
+	com_common_putc(dev, &comcons_info.regs, c, cold);
 }
 
 void
@@ -2641,7 +2641,7 @@ void
 com_kgdb_putc(void *arg, int c)
 {
 
-	com_common_putc(NODEV, &comkgdbregs, c);
+	com_common_putc(NODEV, &comkgdbregs, c, 0);
 }
 #endif /* KGDB */
 

Reply via email to