Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Introduce sc_poll_ticks and obsolete COM_HW_POLL bit...



details:   https://anonhg.NetBSD.org/src/rev/e70fe2ab186e
branches:  trunk
changeset: 953926:e70fe2ab186e
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Mar 25 05:33:59 2021 +0000

description:
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.

diffstat:

 sys/dev/acpi/com_acpi.c |   8 ++++----
 sys/dev/ic/com.c        |  10 +++++-----
 sys/dev/ic/comvar.h     |   5 +++--
 sys/dev/pci/com_puc.c   |   6 +++---
 4 files changed, 15 insertions(+), 14 deletions(-)

diffs (127 lines):

diff -r 4273e85679af -r e70fe2ab186e sys/dev/acpi/com_acpi.c
--- a/sys/dev/acpi/com_acpi.c   Thu Mar 25 03:44:25 2021 +0000
+++ b/sys/dev/acpi/com_acpi.c   Thu Mar 25 05:33:59 2021 +0000
@@ -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@localhost>
@@ -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 @@
        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_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));
diff -r 4273e85679af -r e70fe2ab186e sys/dev/ic/com.c
--- a/sys/dev/ic/com.c  Thu Mar 25 03:44:25 2021 +0000
+++ b/sys/dev/ic/com.c  Thu Mar 25 05:33:59 2021 +0000
@@ -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 @@
 
        comintr(sc);
 
-       callout_schedule(&sc->sc_poll_callout, 1);
+       callout_schedule(&sc->sc_poll_callout, sc->sc_poll_ticks);
 }
 
 void
@@ -739,8 +739,8 @@
 
        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
diff -r 4273e85679af -r e70fe2ab186e sys/dev/ic/comvar.h
--- a/sys/dev/ic/comvar.h       Thu Mar 25 03:44:25 2021 +0000
+++ b/sys/dev/ic/comvar.h       Thu Mar 25 05:33:59 2021 +0000
@@ -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 @@
 #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 @@
 #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 *);
diff -r 4273e85679af -r e70fe2ab186e sys/dev/pci/com_puc.c
--- a/sys/dev/pci/com_puc.c     Thu Mar 25 03:44:25 2021 +0000
+++ b/sys/dev/pci/com_puc.c     Thu Mar 25 05:33:59 2021 +0000
@@ -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 @@
                        return;
                }
        } else {
-               sc->sc_hwflags |= COM_HW_POLL;
+               sc->sc_poll_ticks = 1;
        }
 
 #if defined(amd64) || defined(i386)



Home | Main Index | Thread Index | Old Index