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.
This commit is contained in:
martin 2020-05-26 13:24:52 +00:00
parent 00e3f66015
commit c7910501de
1 changed files with 7 additions and 7 deletions

View File

@ -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_regs *regsp)
}
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 */