Add event counter for zs interrupts and attach and use it; also, get the
zs major number out of the cdevsw table rather than hardcoding it in zs.c.
This commit is contained in:
parent
3e9bbb1219
commit
7a25d8c7ba
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: zs.c,v 1.8 2002/03/13 13:12:26 simonb Exp $ */
|
||||
/* $NetBSD: zs.c,v 1.9 2002/04/17 13:49:55 rafal Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -78,7 +78,7 @@
|
|||
* or you can not see messages done with printf during boot-up...
|
||||
*/
|
||||
int zs_def_cflag = (CREAD | CS8 | HUPCL);
|
||||
int zs_major = 35;
|
||||
int zs_major = 0;
|
||||
|
||||
#define PCLK 3672000 /* PCLK pin input clock rate */
|
||||
|
||||
|
@ -173,6 +173,7 @@ struct cfattach zsc_hpc_ca = {
|
|||
sizeof(struct zsc_softc), zs_hpc_match, zs_hpc_attach
|
||||
};
|
||||
|
||||
cdev_decl(zs);
|
||||
extern struct cfdriver zsc_cd;
|
||||
|
||||
static int zshard __P((void *));
|
||||
|
@ -332,6 +333,9 @@ zs_hpc_attach(parent, self, aux)
|
|||
zsc->sc_si = softintr_establish(IPL_SOFTSERIAL, zssoft, zsc);
|
||||
cpu_intr_establish(haa->ha_irq, IPL_TTY, zshard, NULL);
|
||||
|
||||
evcnt_attach_dynamic(&zsc->zsc_intrcnt, EVCNT_TYPE_INTR, NULL,
|
||||
self->dv_xname, "intr");
|
||||
|
||||
/*
|
||||
* Set the master interrupt enable and interrupt vector.
|
||||
* (common to both channels, do it on A)
|
||||
|
@ -370,14 +374,19 @@ zshard(arg)
|
|||
void *arg;
|
||||
{
|
||||
register struct zsc_softc *zsc;
|
||||
register int unit, rval, softreq;
|
||||
register int rr3, unit, rval, softreq;
|
||||
|
||||
rval = 0;
|
||||
for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) {
|
||||
zsc = zsc_cd.cd_devs[unit];
|
||||
if (zsc == NULL)
|
||||
continue;
|
||||
rval |= zsc_intr_hard(zsc);
|
||||
|
||||
while ((rr3 = zsc_intr_hard(zsc))) {
|
||||
rval |= rr3;
|
||||
zsc->zsc_intrcnt.ev_count++;
|
||||
}
|
||||
|
||||
softreq = zsc->zsc_cs[0]->cs_softreq;
|
||||
softreq |= zsc->zsc_cs[1]->cs_softreq;
|
||||
if (softreq && (zssoftpending == 0)) {
|
||||
|
@ -709,6 +718,13 @@ zscninit(cn)
|
|||
|
||||
cons_port = consdev[7] - '0';
|
||||
|
||||
/*
|
||||
* Initialize the zstty console device major (needed by cnopen)
|
||||
*/
|
||||
for (zs_major = 0; zs_major < nchrdev; zs_major++)
|
||||
if (cdevsw[zs_major].d_open == zsopen)
|
||||
break;
|
||||
|
||||
cn->cn_dev = makedev(zs_major, cons_port);
|
||||
cn->cn_pri = CN_REMOTE;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: z8530var.h,v 1.3 2002/03/13 13:12:28 simonb Exp $ */
|
||||
/* $NetBSD: z8530var.h,v 1.4 2002/04/17 13:49:54 rafal Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
|
@ -61,6 +61,7 @@ struct zsc_softc {
|
|||
/* Machine-dependent part follows... */
|
||||
bus_space_tag_t zsc_bustag; /* Bus type */
|
||||
bus_space_handle_t zsc_base; /* Device base address */
|
||||
struct evcnt zsc_intrcnt; /* count interrupts */
|
||||
void *sc_si; /* Softinterrupt handle */
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue