summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64/dev/vcons.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/sparc64/dev/vcons.c')
-rw-r--r--sys/arch/sparc64/dev/vcons.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/sys/arch/sparc64/dev/vcons.c b/sys/arch/sparc64/dev/vcons.c
index 3e138ed2734..df533c062e5 100644
--- a/sys/arch/sparc64/dev/vcons.c
+++ b/sys/arch/sparc64/dev/vcons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vcons.c,v 1.16 2018/02/19 08:59:52 mpi Exp $ */
+/* $OpenBSD: vcons.c,v 1.17 2018/06/27 11:38:59 kettenis Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
*
@@ -36,7 +36,10 @@
struct vcons_softc {
struct device sc_dv;
+ bus_space_tag_t sc_bustag;
+
void *sc_ih;
+ uint64_t sc_sysino;
struct tty *sc_tty;
void *sc_si;
};
@@ -78,7 +81,6 @@ vcons_attach(struct device *parent, struct device *self, void *aux)
{
struct vcons_softc *sc = (struct vcons_softc *)self;
struct vbus_attach_args *va = aux;
- uint64_t sysino;
int vcons_is_input, vcons_is_output;
int node, maj;
@@ -86,11 +88,12 @@ vcons_attach(struct device *parent, struct device *self, void *aux)
if (sc->sc_si == NULL)
panic(": can't establish soft interrupt");
- if (vbus_intr_map(va->va_node, va->va_intr[0], &sysino))
+ if (vbus_intr_map(va->va_node, va->va_intr[0], &sc->sc_sysino))
printf(": can't map interrupt\n");
- printf(": ivec 0x%llx", sysino);
+ printf(": ivec 0x%llx", sc->sc_sysino);
- sc->sc_ih = bus_intr_establish(va->va_bustag, sysino, IPL_TTY,
+ sc->sc_bustag = va->va_bustag;
+ sc->sc_ih = bus_intr_establish(sc->sc_bustag, sc->sc_sysino, IPL_TTY,
BUS_INTR_ESTABLISH_MPSAFE, vcons_intr, sc, sc->sc_dv.dv_xname);
if (sc->sc_ih == NULL) {
printf(", can't establish interrupt\n");
@@ -129,6 +132,7 @@ vcons_intr(void *arg)
if (sc->sc_tty)
softintr_schedule(sc->sc_si);
+
return (1);
}
@@ -172,6 +176,7 @@ vconsopen(dev_t dev, int flag, int mode, struct proc *p)
struct vcons_softc *sc;
struct tty *tp;
int unit = minor(dev);
+ int err;
if (unit >= vcons_cd.cd_ndevs)
return (ENXIO);
@@ -199,7 +204,11 @@ vconsopen(dev_t dev, int flag, int mode, struct proc *p)
return (EBUSY);
tp->t_state |= TS_CARR_ON;
- return ((*linesw[tp->t_line].l_open)(dev, tp, p));
+ err = (*linesw[tp->t_line].l_open)(dev, tp, p);
+ if (err == 0)
+ vbus_intr_setenabled(sc->sc_bustag, sc->sc_sysino, INTR_ENABLED);
+
+ return err;
}
int
@@ -215,6 +224,8 @@ vconsclose(dev_t dev, int flag, int mode, struct proc *p)
if (sc == NULL)
return (ENXIO);
+ vbus_intr_setenabled(sc->sc_bustag, sc->sc_sysino, INTR_DISABLED);
+
tp = sc->sc_tty;
(*linesw[tp->t_line].l_close)(tp, flag, p);
ttyclose(tp);
@@ -346,4 +357,6 @@ vcons_softintr(void *arg)
if (tp->t_state & TS_ISOPEN)
(*linesw[tp->t_line].l_rint)(c, tp);
}
+
+ vbus_intr_setstate(sc->sc_bustag, sc->sc_sysino, INTR_IDLE);
}