Add support for polling com devices when no interrupt is available.
This commit is contained in:
parent
462b2f438f
commit
b1584913f6
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: atppc_puc.c,v 1.14 2014/03/29 19:28:24 christos Exp $ */
|
||||
/* $NetBSD: atppc_puc.c,v 1.15 2018/11/30 16:26:59 jmcneill Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
@ -32,7 +32,7 @@
|
||||
#include "opt_atppc.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: atppc_puc.c,v 1.14 2014/03/29 19:28:24 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: atppc_puc.c,v 1.15 2018/11/30 16:26:59 jmcneill Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -101,6 +101,11 @@ atppc_puc_attach(device_t parent, device_t self, void *aux)
|
||||
|
||||
sc->sc_dev_ok = ATPPC_NOATTACH;
|
||||
|
||||
if (aa->poll) {
|
||||
aprint_error(": polling not supported\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf(": AT Parallel Port\n");
|
||||
|
||||
/* Attach */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: com_puc.c,v 1.24 2017/04/27 10:01:54 msaitoh Exp $ */
|
||||
/* $NetBSD: com_puc.c,v 1.25 2018/11/30 16:26:59 jmcneill 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.24 2017/04/27 10:01:54 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_puc.c,v 1.25 2018/11/30 16:26:59 jmcneill Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -91,7 +91,7 @@ com_puc_attach(device_t parent, device_t self, void *aux)
|
||||
struct com_puc_softc *psc = device_private(self);
|
||||
struct com_softc *sc = &psc->sc_com;
|
||||
struct puc_attach_args *aa = aux;
|
||||
const char *intrstr;
|
||||
const char *intrstr = NULL;
|
||||
char intrbuf[PCI_INTRSTR_LEN];
|
||||
unsigned int iface;
|
||||
|
||||
@ -106,16 +106,20 @@ com_puc_attach(device_t parent, device_t self, void *aux)
|
||||
COM_INIT_REGS(sc->sc_regs, aa->t, aa->h, aa->a);
|
||||
sc->sc_frequency = aa->flags & PUC_COM_CLOCKMASK;
|
||||
|
||||
intrstr = pci_intr_string(aa->pc, aa->intrhandle, intrbuf,
|
||||
sizeof(intrbuf));
|
||||
psc->sc_ih = pci_intr_establish_xname(aa->pc, aa->intrhandle,
|
||||
IPL_SERIAL, comintr, sc, device_xname(self));
|
||||
if (psc->sc_ih == NULL) {
|
||||
aprint_error("couldn't establish interrupt");
|
||||
if (intrstr != NULL)
|
||||
aprint_error(" at %s", intrstr);
|
||||
aprint_error("\n");
|
||||
return;
|
||||
if (!aa->poll) {
|
||||
intrstr = pci_intr_string(aa->pc, aa->intrhandle, intrbuf,
|
||||
sizeof(intrbuf));
|
||||
psc->sc_ih = pci_intr_establish_xname(aa->pc, aa->intrhandle,
|
||||
IPL_SERIAL, comintr, sc, device_xname(self));
|
||||
if (psc->sc_ih == NULL) {
|
||||
aprint_error("couldn't establish interrupt");
|
||||
if (intrstr != NULL)
|
||||
aprint_error(" at %s", intrstr);
|
||||
aprint_error("\n");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
sc->sc_hwflags |= COM_HW_POLL;
|
||||
}
|
||||
|
||||
#if defined(amd64) || defined(i386)
|
||||
@ -129,7 +133,10 @@ com_puc_attach(device_t parent, device_t self, void *aux)
|
||||
if (aa->h < 0x10000)
|
||||
aprint_normal("ioaddr 0x%04lx, ", aa->h);
|
||||
#endif
|
||||
aprint_normal("interrupting at %s\n", intrstr);
|
||||
if (!aa->poll)
|
||||
aprint_normal("interrupting at %s\n", intrstr);
|
||||
else
|
||||
aprint_normal("polling\n");
|
||||
|
||||
/* Enable Cyberserial 8X clock. */
|
||||
if (aa->flags & (PUC_COM_SIIG10x|PUC_COM_SIIG20x)) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lpt_puc.c,v 1.18 2017/04/27 10:01:54 msaitoh Exp $ */
|
||||
/* $NetBSD: lpt_puc.c,v 1.19 2018/11/30 16:26:59 jmcneill Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Christopher G. Demetriou. All rights reserved.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lpt_puc.c,v 1.18 2017/04/27 10:01:54 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lpt_puc.c,v 1.19 2018/11/30 16:26:59 jmcneill Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -76,6 +76,11 @@ lpt_puc_attach(device_t parent, device_t self, void *aux)
|
||||
sc->sc_iot = aa->t;
|
||||
sc->sc_ioh = aa->h;
|
||||
|
||||
if (aa->poll) {
|
||||
aprint_error(": polling not supported\n");
|
||||
return;
|
||||
}
|
||||
|
||||
aprint_naive(": Parallel port");
|
||||
aprint_normal(": ");
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: puc.c,v 1.39 2016/07/07 06:55:41 msaitoh Exp $ */
|
||||
/* $NetBSD: puc.c,v 1.40 2018/11/30 16:26:59 jmcneill Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 1998, 1999
|
||||
@ -53,7 +53,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: puc.c,v 1.39 2016/07/07 06:55:41 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: puc.c,v 1.40 2018/11/30 16:26:59 jmcneill Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -148,6 +148,7 @@ puc_attach(device_t parent, device_t self, void *aux)
|
||||
pcireg_t subsys;
|
||||
int i, barindex;
|
||||
int locs[PUCCF_NLOCS];
|
||||
bool poll = false;
|
||||
|
||||
subsys = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
|
||||
sc->sc_desc = puc_find_description(PCI_VENDOR(pa->pa_id),
|
||||
@ -215,8 +216,7 @@ puc_attach(device_t parent, device_t self, void *aux)
|
||||
|
||||
/* Map interrupt. */
|
||||
if (pci_intr_map(pa, &intrhandle)) {
|
||||
aprint_error_dev(self, "couldn't map interrupt\n");
|
||||
return;
|
||||
poll = true;
|
||||
}
|
||||
/*
|
||||
* XXX the sub-devices establish the interrupts, for the
|
||||
@ -288,6 +288,7 @@ puc_attach(device_t parent, device_t self, void *aux)
|
||||
paa.pc = pa->pa_pc;
|
||||
paa.tag = pa->pa_tag;
|
||||
paa.intrhandle = intrhandle;
|
||||
paa.poll = poll;
|
||||
paa.a = sc->sc_bar_mappings[barindex].a +
|
||||
sc->sc_desc->ports[i].offset;
|
||||
paa.t = sc->sc_bar_mappings[barindex].t;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pucvar.h,v 1.11 2014/03/18 18:20:42 riastradh Exp $ */
|
||||
/* $NetBSD: pucvar.h,v 1.12 2018/11/30 16:26:59 jmcneill Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 1999 Christopher G. Demetriou. All rights reserved.
|
||||
@ -95,6 +95,7 @@ struct puc_attach_args {
|
||||
|
||||
pci_chipset_tag_t pc;
|
||||
pci_intr_handle_t intrhandle;
|
||||
bool poll;
|
||||
pcitag_t tag;
|
||||
|
||||
bus_addr_t a;
|
||||
|
Loading…
Reference in New Issue
Block a user