Introduce sc_poll_ticks and obsolete COM_HW_POLL bit in sc_hwflags.
Polling is scheduled at every sc_poll_ticks ticks. This is useful to work around H/W bug, by which interrupts are lost *sometimes*; interrupt-based I/O mostly works and no need for polling every counter ticks.
This commit is contained in:
parent
31283b4a8d
commit
c997c10360
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: com_acpi.c,v 1.41 2021/01/29 15:24:00 thorpej Exp $ */
|
||||
/* $NetBSD: com_acpi.c,v 1.42 2021/03/25 05:33:59 rin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Jared D. McNeill <jmcneill@invisible.ca>
|
||||
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_acpi.c,v 1.41 2021/01/29 15:24:00 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_acpi.c,v 1.42 2021/03/25 05:33:59 rin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
@ -168,7 +168,7 @@ com_acpi_attach(device_t parent, device_t self, void *aux)
|
||||
sc->sc_type = dce->value;
|
||||
|
||||
if (sc->sc_type == COM_TYPE_DW_APB) {
|
||||
SET(sc->sc_hwflags, COM_HW_POLL); /* XXX */
|
||||
sc->sc_poll_ticks = 1; /* XXX */
|
||||
} else {
|
||||
if (com_probe_subr(&sc->sc_regs) == 0) {
|
||||
aprint_error(": com probe failed\n");
|
||||
@ -185,7 +185,7 @@ com_acpi_attach(device_t parent, device_t self, void *aux)
|
||||
|
||||
com_attach_subr(sc);
|
||||
|
||||
if (!ISSET(sc->sc_hwflags, COM_HW_POLL))
|
||||
if (sc->sc_poll_ticks == 0)
|
||||
asc->sc_ih = acpi_intr_establish(self,
|
||||
(uint64_t)(uintptr_t)aa->aa_node->ad_handle,
|
||||
IPL_SERIAL, true, comintr, sc, device_xname(self));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: com.c,v 1.361 2020/09/30 14:56:34 jmcneill Exp $ */
|
||||
/* $NetBSD: com.c,v 1.362 2021/03/25 05:33:59 rin 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.361 2020/09/30 14:56:34 jmcneill Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.362 2021/03/25 05:33:59 rin Exp $");
|
||||
|
||||
#include "opt_com.h"
|
||||
#include "opt_ddb.h"
|
||||
@ -420,7 +420,7 @@ com_intr_poll(void *arg)
|
||||
|
||||
comintr(sc);
|
||||
|
||||
callout_schedule(&sc->sc_poll_callout, 1);
|
||||
callout_schedule(&sc->sc_poll_callout, sc->sc_poll_ticks);
|
||||
}
|
||||
|
||||
void
|
||||
@ -739,8 +739,8 @@ fifodone:
|
||||
|
||||
SET(sc->sc_hwflags, COM_HW_DEV_OK);
|
||||
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_POLL))
|
||||
callout_schedule(&sc->sc_poll_callout, 1);
|
||||
if (sc->sc_poll_ticks != 0)
|
||||
callout_schedule(&sc->sc_poll_callout, sc->sc_poll_ticks);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: comvar.h,v 1.92 2019/01/11 23:10:41 thorpej Exp $ */
|
||||
/* $NetBSD: comvar.h,v 1.93 2021/03/25 05:33:59 rin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
@ -69,7 +69,6 @@ int com_is_console(bus_space_tag_t, bus_addr_t, bus_space_handle_t *);
|
||||
#define COM_HW_TXFIFO_DISABLE 0x100
|
||||
#define COM_HW_NO_TXPRELOAD 0x200
|
||||
#define COM_HW_AFE 0x400
|
||||
#define COM_HW_POLL 0x800
|
||||
|
||||
/* Buffer size for character buffer */
|
||||
#ifndef COM_RING_SIZE
|
||||
@ -191,6 +190,8 @@ struct com_softc {
|
||||
#define COM_TYPE_16750 10
|
||||
#define COM_TYPE_DW_APB 11 /* DesignWare APB UART */
|
||||
|
||||
int sc_poll_ticks;
|
||||
|
||||
/* power management hooks */
|
||||
int (*enable)(struct com_softc *);
|
||||
void (*disable)(struct com_softc *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: com_puc.c,v 1.26 2018/12/08 17:46:14 thorpej Exp $ */
|
||||
/* $NetBSD: com_puc.c,v 1.27 2021/03/25 05:33:59 rin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Christopher G. Demetriou. All rights reserved.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_puc.c,v 1.26 2018/12/08 17:46:14 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_puc.c,v 1.27 2021/03/25 05:33:59 rin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -119,7 +119,7 @@ com_puc_attach(device_t parent, device_t self, void *aux)
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
sc->sc_hwflags |= COM_HW_POLL;
|
||||
sc->sc_poll_ticks = 1;
|
||||
}
|
||||
|
||||
#if defined(amd64) || defined(i386)
|
||||
|
Loading…
Reference in New Issue
Block a user