From b3a497ed788fbc90cc3de0447cc05b01ba4d02e2 Mon Sep 17 00:00:00 2001 From: kettenis Date: Sun, 25 Jan 2015 21:42:13 +0000 Subject: [PATCH] Rework cbus(4) interrupt support a bit. Instead of merging devhandle and devino into a pseudo-sysino, directly use the devino as the ihandle. The devhandle is stored in the cbus softc, and accessed through the bus space tag. This allows us to have more than 256 interrupts on a single cbus, and avoids relying on the lower bits of the devhandle being zero. --- sys/arch/sparc64/dev/cbus.c | 49 +++++++++++++++------------------- sys/arch/sparc64/dev/cbusvar.h | 7 +++-- sys/arch/sparc64/dev/vcctty.c | 33 +++++++++-------------- sys/arch/sparc64/dev/vdsk.c | 22 ++++++--------- sys/arch/sparc64/dev/vdsp.c | 27 +++++++++---------- sys/arch/sparc64/dev/vldcp.c | 42 +++++++++++++++-------------- sys/arch/sparc64/dev/vnet.c | 27 +++++++++---------- 7 files changed, 91 insertions(+), 116 deletions(-) diff --git a/sys/arch/sparc64/dev/cbus.c b/sys/arch/sparc64/dev/cbus.c index a5e8fe28ae8..5ae55eb735b 100644 --- a/sys/arch/sparc64/dev/cbus.c +++ b/sys/arch/sparc64/dev/cbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cbus.c,v 1.13 2014/11/24 12:47:14 kettenis Exp $ */ +/* $OpenBSD: cbus.c,v 1.14 2015/01/25 21:42:13 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis * @@ -28,14 +28,13 @@ #include #include -#define CBUS_HANDLE(x) ((x) & ~0xff) -#define CBUS_INO(x) ((x) & 0xff) - struct cbus_softc { struct device sc_dv; bus_space_tag_t sc_bustag; bus_dma_tag_t sc_dmatag; + uint64_t sc_devhandle; + /* Machine description. */ int sc_idx; }; @@ -77,10 +76,15 @@ cbus_attach(struct device *parent, struct device *self, void *aux) struct cbus_softc *sc = (struct cbus_softc *)self; struct vbus_attach_args *va = aux; int node; + int reg; sc->sc_bustag = cbus_alloc_bus_tag(sc, va->va_bustag); sc->sc_dmatag = va->va_dmatag; + if (OF_getprop(va->va_node, "reg", ®, sizeof(reg)) != sizeof(reg)) + return; + sc->sc_devhandle = reg; + printf("\n"); sc->sc_idx = mdesc_find(va->va_name, va->va_reg[0]); @@ -120,24 +124,10 @@ cbus_print(void *aux, const char *name) } int -cbus_intr_map(int node, int ino, uint64_t *sysino) -{ - int parent; - int reg; - - parent = OF_parent(node); - if (OF_getprop(parent, "reg", ®, sizeof(reg)) != sizeof(reg)) - return (-1); - - *sysino = CBUS_HANDLE(reg) | CBUS_INO(ino); - return (0); -} - -int -cbus_intr_setstate(uint64_t sysino, uint64_t state) +cbus_intr_setstate(bus_space_tag_t t, uint64_t devino, uint64_t state) { - uint64_t devhandle = CBUS_HANDLE(sysino); - uint64_t devino = CBUS_INO(sysino); + struct cbus_softc *sc = t->cookie; + uint64_t devhandle = sc->sc_devhandle; int err; err = hv_vintr_setstate(devhandle, devino, state); @@ -148,10 +138,10 @@ cbus_intr_setstate(uint64_t sysino, uint64_t state) } int -cbus_intr_setenabled(uint64_t sysino, uint64_t enabled) +cbus_intr_setenabled(bus_space_tag_t t, uint64_t devino, uint64_t enabled) { - uint64_t devhandle = CBUS_HANDLE(sysino); - uint64_t devino = CBUS_INO(sysino); + struct cbus_softc *sc = t->cookie; + uint64_t devhandle = sc->sc_devhandle; int err; err = hv_vintr_setenabled(devhandle, devino, enabled); @@ -165,8 +155,9 @@ void * cbus_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int ihandle, int level, int flags, int (*handler)(void *), void *arg, const char *what) { - uint64_t devhandle = CBUS_HANDLE(ihandle); - uint64_t devino = CBUS_INO(ihandle); + struct cbus_softc *sc = t0->cookie; + uint64_t devhandle = sc->sc_devhandle; + uint64_t devino = ihandle; struct intrhand *ih; int err; @@ -216,8 +207,10 @@ cbus_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int ihandle, void cbus_intr_ack(struct intrhand *ih) { - uint64_t devhandle = CBUS_HANDLE(ih->ih_number); - uint64_t devino = CBUS_INO(ih->ih_number); + bus_space_tag_t t = ih->ih_bus; + struct cbus_softc *sc = t->cookie; + uint64_t devhandle = sc->sc_devhandle; + uint64_t devino = ih->ih_number; hv_vintr_setstate(devhandle, devino, INTR_IDLE); } diff --git a/sys/arch/sparc64/dev/cbusvar.h b/sys/arch/sparc64/dev/cbusvar.h index 67f84ac8d09..02d5682b0b3 100644 --- a/sys/arch/sparc64/dev/cbusvar.h +++ b/sys/arch/sparc64/dev/cbusvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cbusvar.h,v 1.4 2009/12/14 16:06:35 kettenis Exp $ */ +/* $OpenBSD: cbusvar.h,v 1.5 2015/01/25 21:42:13 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis * @@ -35,8 +35,7 @@ struct cbus_attach_args { }; int cbus_print(void *, const char *); -int cbus_intr_map(int, int, uint64_t *); -int cbus_intr_setstate(uint64_t, uint64_t); -int cbus_intr_setenabled(uint64_t, uint64_t); +int cbus_intr_setstate(bus_space_tag_t, uint64_t, uint64_t); +int cbus_intr_setenabled(bus_space_tag_t, uint64_t, uint64_t); #endif diff --git a/sys/arch/sparc64/dev/vcctty.c b/sys/arch/sparc64/dev/vcctty.c index 4409c8f8433..b2102f370ed 100644 --- a/sys/arch/sparc64/dev/vcctty.c +++ b/sys/arch/sparc64/dev/vcctty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vcctty.c,v 1.11 2014/05/10 11:49:31 kettenis Exp $ */ +/* $OpenBSD: vcctty.c,v 1.12 2015/01/25 21:42:13 kettenis Exp $ */ /* * Copyright (c) 2009 Mark Kettenis * @@ -58,10 +58,10 @@ struct vcctty_softc { bus_space_tag_t sc_bustag; bus_dma_tag_t sc_dmatag; + uint64_t sc_tx_ino; + uint64_t sc_rx_ino; void *sc_tx_ih; void *sc_rx_ih; - uint64_t sc_tx_sysino; - uint64_t sc_rx_sysino; struct ldc_conn sc_lc; @@ -105,13 +105,10 @@ vcctty_attach(struct device *parent, struct device *self, void *aux) sc->sc_bustag = ca->ca_bustag; sc->sc_dmatag = ca->ca_dmatag; + sc->sc_tx_ino = ca->ca_tx_ino; + sc->sc_rx_ino = ca->ca_rx_ino; - if (cbus_intr_map(ca->ca_node, ca->ca_tx_ino, &sc->sc_tx_sysino) || - cbus_intr_map(ca->ca_node, ca->ca_rx_ino, &sc->sc_rx_sysino)) { - printf(": can't map interrupt\n"); - return; - } - printf(": ivec 0x%llx, 0x%llx", sc->sc_tx_sysino, sc->sc_rx_sysino); + printf(": ivec 0x%llx, 0x%llx", sc->sc_tx_ino, sc->sc_rx_ino); /* * Un-configure queues before registering interrupt handlers, @@ -120,9 +117,9 @@ vcctty_attach(struct device *parent, struct device *self, void *aux) hv_ldc_tx_qconf(ca->ca_id, 0, 0); hv_ldc_rx_qconf(ca->ca_id, 0, 0); - sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_tx_sysino, + sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_tx_ino, IPL_TTY, 0, vcctty_tx_intr, sc, sc->sc_dv.dv_xname); - sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_rx_sysino, + sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_rx_ino, IPL_TTY, 0, vcctty_rx_intr, sc, sc->sc_dv.dv_xname); if (sc->sc_tx_ih == NULL || sc->sc_rx_ih == NULL) { printf(", can't establish interrupt\n"); @@ -155,8 +152,8 @@ vcctty_attach(struct device *parent, struct device *self, void *aux) if (err != H_EOK) printf("%s: hv_ldc_rx_qconf %d\n", __func__, err); - cbus_intr_setenabled(sc->sc_tx_sysino, INTR_ENABLED); - cbus_intr_setenabled(sc->sc_rx_sysino, INTR_ENABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, INTR_ENABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_rx_ino, INTR_ENABLED); printf(" domain \"%s\"\n", ca->ca_name); return; @@ -499,14 +496,10 @@ int vccttyhwiflow(struct tty *tp, int stop) { struct vcctty_softc *sc = vcctty_cd.cd_devs[minor(tp->t_dev)]; + uint64_t state = stop ? INTR_DISABLED : INTR_ENABLED; - if (stop) { - cbus_intr_setenabled(sc->sc_tx_sysino, INTR_DISABLED); - cbus_intr_setenabled(sc->sc_rx_sysino, INTR_DISABLED); - } else { - cbus_intr_setenabled(sc->sc_tx_sysino, INTR_ENABLED); - cbus_intr_setenabled(sc->sc_rx_sysino, INTR_ENABLED); - } + cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, state); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_rx_ino, state); return (1); } diff --git a/sys/arch/sparc64/dev/vdsk.c b/sys/arch/sparc64/dev/vdsk.c index acff2f3d5fa..f07d5635f23 100644 --- a/sys/arch/sparc64/dev/vdsk.c +++ b/sys/arch/sparc64/dev/vdsk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vdsk.c,v 1.45 2014/09/21 14:52:37 kettenis Exp $ */ +/* $OpenBSD: vdsk.c,v 1.46 2015/01/25 21:42:13 kettenis Exp $ */ /* * Copyright (c) 2009, 2011 Mark Kettenis * @@ -233,19 +233,13 @@ vdsk_attach(struct device *parent, struct device *self, void *aux) struct cbus_attach_args *ca = aux; struct scsibus_attach_args saa; struct ldc_conn *lc; - uint64_t sysino[2]; int err, s; int timeout; sc->sc_bustag = ca->ca_bustag; sc->sc_dmatag = ca->ca_dmatag; - if (cbus_intr_map(ca->ca_node, ca->ca_tx_ino, &sysino[0]) || - cbus_intr_map(ca->ca_node, ca->ca_rx_ino, &sysino[1])) { - printf(": can't map interrupt\n"); - return; - } - printf(": ivec 0x%llx, 0x%llx", sysino[0], sysino[1]); + printf(": ivec 0x%llx, 0x%llx", ca->ca_tx_ino, ca->ca_rx_ino); /* * Un-configure queues before registering interrupt handlers, @@ -254,10 +248,10 @@ vdsk_attach(struct device *parent, struct device *self, void *aux) hv_ldc_tx_qconf(ca->ca_id, 0, 0); hv_ldc_rx_qconf(ca->ca_id, 0, 0); - sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, sysino[0], IPL_BIO, - 0, vdsk_tx_intr, sc, sc->sc_dv.dv_xname); - sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, sysino[1], IPL_BIO, - 0, vdsk_rx_intr, sc, sc->sc_dv.dv_xname); + sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, ca->ca_tx_ino, + IPL_BIO, 0, vdsk_tx_intr, sc, sc->sc_dv.dv_xname); + sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, ca->ca_rx_ino, + IPL_BIO, 0, vdsk_rx_intr, sc, sc->sc_dv.dv_xname); if (sc->sc_tx_ih == NULL || sc->sc_rx_ih == NULL) { printf(", can't establish interrupt\n"); return; @@ -323,8 +317,8 @@ vdsk_attach(struct device *parent, struct device *self, void *aux) if (err != H_EOK) printf("hv_ldc_rx_qconf %d\n", err); - cbus_intr_setenabled(sysino[0], INTR_ENABLED); - cbus_intr_setenabled(sysino[1], INTR_ENABLED); + cbus_intr_setenabled(sc->sc_bustag, ca->ca_tx_ino, INTR_ENABLED); + cbus_intr_setenabled(sc->sc_bustag, ca->ca_rx_ino, INTR_ENABLED); ldc_send_vers(lc); diff --git a/sys/arch/sparc64/dev/vdsp.c b/sys/arch/sparc64/dev/vdsp.c index 6e7eae16228..b3e09de8f19 100644 --- a/sys/arch/sparc64/dev/vdsp.c +++ b/sys/arch/sparc64/dev/vdsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vdsp.c,v 1.35 2015/01/23 12:41:23 dlg Exp $ */ +/* $OpenBSD: vdsp.c,v 1.36 2015/01/25 21:42:13 kettenis Exp $ */ /* * Copyright (c) 2009, 2011, 2014 Mark Kettenis * @@ -201,8 +201,8 @@ struct vdsp_softc { bus_space_tag_t sc_bustag; bus_dma_tag_t sc_dmatag; - uint64_t sc_tx_sysino; - uint64_t sc_rx_sysino; + uint64_t sc_tx_ino; + uint64_t sc_rx_ino; void *sc_tx_ih; void *sc_rx_ih; @@ -334,13 +334,10 @@ vdsp_attach(struct device *parent, struct device *self, void *aux) sc->sc_idx = ca->ca_idx; sc->sc_bustag = ca->ca_bustag; sc->sc_dmatag = ca->ca_dmatag; + sc->sc_tx_ino = ca->ca_tx_ino; + sc->sc_rx_ino = ca->ca_rx_ino; - if (cbus_intr_map(ca->ca_node, ca->ca_tx_ino, &sc->sc_tx_sysino) || - cbus_intr_map(ca->ca_node, ca->ca_rx_ino, &sc->sc_rx_sysino)) { - printf(": can't map interrupt\n"); - return; - } - printf(": ivec 0x%llx, 0x%llx", sc->sc_tx_sysino, sc->sc_rx_sysino); + printf(": ivec 0x%llx, 0x%llx", sc->sc_tx_ino, sc->sc_rx_ino); mtx_init(&sc->sc_desc_mtx, IPL_BIO); @@ -351,10 +348,10 @@ vdsp_attach(struct device *parent, struct device *self, void *aux) hv_ldc_tx_qconf(ca->ca_id, 0, 0); hv_ldc_rx_qconf(ca->ca_id, 0, 0); - sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_tx_sysino, + sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_tx_ino, IPL_BIO, BUS_INTR_ESTABLISH_MPSAFE, vdsp_tx_intr, sc, sc->sc_dv.dv_xname); - sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_rx_sysino, + sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_rx_ino, IPL_BIO, BUS_INTR_ESTABLISH_MPSAFE, vdsp_rx_intr, sc, sc->sc_dv.dv_xname); if (sc->sc_tx_ih == NULL || sc->sc_rx_ih == NULL) { @@ -1722,8 +1719,8 @@ vdspopen(dev_t dev, int flag, int mode, struct proc *p) if (err != H_EOK) printf("%s: hv_ldc_rx_qconf %d\n", __func__, err); - cbus_intr_setenabled(sc->sc_tx_sysino, INTR_ENABLED); - cbus_intr_setenabled(sc->sc_rx_sysino, INTR_ENABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, INTR_ENABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_rx_ino, INTR_ENABLED); return (0); } @@ -1740,8 +1737,8 @@ vdspclose(dev_t dev, int flag, int mode, struct proc *p) if (sc == NULL) return (ENXIO); - cbus_intr_setenabled(sc->sc_tx_sysino, INTR_DISABLED); - cbus_intr_setenabled(sc->sc_rx_sysino, INTR_DISABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, INTR_DISABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_rx_ino, INTR_DISABLED); hv_ldc_tx_qconf(sc->sc_lc.lc_id, 0, 0); hv_ldc_rx_qconf(sc->sc_lc.lc_id, 0, 0); diff --git a/sys/arch/sparc64/dev/vldcp.c b/sys/arch/sparc64/dev/vldcp.c index 9de4aac57af..ef63a813dcc 100644 --- a/sys/arch/sparc64/dev/vldcp.c +++ b/sys/arch/sparc64/dev/vldcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vldcp.c,v 1.9 2014/07/12 18:44:43 tedu Exp $ */ +/* $OpenBSD: vldcp.c,v 1.10 2015/01/25 21:42:13 kettenis Exp $ */ /* * Copyright (c) 2009, 2012 Mark Kettenis * @@ -57,10 +57,10 @@ struct vldcp_softc { bus_space_tag_t sc_bustag; bus_dma_tag_t sc_dmatag; + uint64_t sc_tx_ino; + uint64_t sc_rx_ino; void *sc_tx_ih; void *sc_rx_ih; - uint64_t sc_tx_sysino; - uint64_t sc_rx_sysino; struct ldc_conn sc_lc; @@ -133,13 +133,10 @@ vldcp_attach(struct device *parent, struct device *self, void *aux) sc->sc_bustag = ca->ca_bustag; sc->sc_dmatag = ca->ca_dmatag; + sc->sc_tx_ino = ca->ca_tx_ino; + sc->sc_rx_ino = ca->ca_rx_ino; - if (cbus_intr_map(ca->ca_node, ca->ca_tx_ino, &sc->sc_tx_sysino) || - cbus_intr_map(ca->ca_node, ca->ca_rx_ino, &sc->sc_rx_sysino)) { - printf(": can't map interrupt\n"); - return; - } - printf(": ivec 0x%llx, 0x%llx", sc->sc_tx_sysino, sc->sc_rx_sysino); + printf(": ivec 0x%llx, 0x%llx", sc->sc_tx_ino, sc->sc_rx_ino); /* * Un-configure queues before registering interrupt handlers, @@ -148,9 +145,9 @@ vldcp_attach(struct device *parent, struct device *self, void *aux) hv_ldc_tx_qconf(ca->ca_id, 0, 0); hv_ldc_rx_qconf(ca->ca_id, 0, 0); - sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_tx_sysino, + sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_tx_ino, IPL_TTY, 0, vldcp_tx_intr, sc, sc->sc_dv.dv_xname); - sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_rx_sysino, + sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_rx_ino, IPL_TTY, 0, vldcp_rx_intr, sc, sc->sc_dv.dv_xname); if (sc->sc_tx_ih == NULL || sc->sc_rx_ih == NULL) { printf(", can't establish interrupt\n"); @@ -227,7 +224,7 @@ vldcp_tx_intr(void *arg) lc->lc_tx_state = tx_state; } - cbus_intr_setenabled(sc->sc_tx_sysino, INTR_DISABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, INTR_DISABLED); selwakeup(&sc->sc_wsel); wakeup(lc->lc_txq); return (1); @@ -260,7 +257,8 @@ vldcp_rx_intr(void *arg) break; } lc->lc_rx_state = rx_state; - cbus_intr_setenabled(sc->sc_rx_sysino, INTR_DISABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_rx_ino, + INTR_DISABLED); selwakeup(&sc->sc_rsel); wakeup(lc->lc_rxq); return (1); @@ -269,7 +267,7 @@ vldcp_rx_intr(void *arg) if (rx_head == rx_tail) return (0); - cbus_intr_setenabled(sc->sc_rx_sysino, INTR_DISABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_rx_ino, INTR_DISABLED); selwakeup(&sc->sc_rsel); wakeup(lc->lc_rxq); return (1); @@ -333,8 +331,8 @@ vldcpclose(dev_t dev, int flag, int mode, struct proc *p) if (sc == NULL) return (ENXIO); - cbus_intr_setenabled(sc->sc_tx_sysino, INTR_DISABLED); - cbus_intr_setenabled(sc->sc_rx_sysino, INTR_DISABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, INTR_DISABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_rx_ino, INTR_DISABLED); hv_ldc_tx_qconf(sc->sc_lc.lc_id, 0, 0); hv_ldc_rx_qconf(sc->sc_lc.lc_id, 0, 0); @@ -381,7 +379,8 @@ retry: DPRINTF(("rx head %llx, rx tail %llx\n", rx_head, rx_tail)); if (rx_head == rx_tail) { - cbus_intr_setenabled(sc->sc_rx_sysino, INTR_ENABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_rx_ino, + INTR_ENABLED); ret = tsleep(lc->lc_rxq, PWAIT | PCATCH, "hvrd", 0); if (ret) { splx(s); @@ -446,7 +445,8 @@ retry: next_tx_tail &= ((lc->lc_txq->lq_nentries * 64) - 1); if (tx_head == next_tx_tail) { - cbus_intr_setenabled(sc->sc_tx_sysino, INTR_ENABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, + INTR_ENABLED); ret = tsleep(lc->lc_txq, PWAIT | PCATCH, "hvwr", 0); if (ret) { splx(s); @@ -585,11 +585,13 @@ vldcppoll(dev_t dev, int events, struct proc *p) } if (revents == 0) { if (events & (POLLIN | POLLRDNORM)) { - cbus_intr_setenabled(sc->sc_rx_sysino, INTR_ENABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_rx_ino, + INTR_ENABLED); selrecord(p, &sc->sc_rsel); } if (events & (POLLOUT | POLLWRNORM)) { - cbus_intr_setenabled(sc->sc_tx_sysino, INTR_ENABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, + INTR_ENABLED); selrecord(p, &sc->sc_wsel); } } diff --git a/sys/arch/sparc64/dev/vnet.c b/sys/arch/sparc64/dev/vnet.c index d95c401f495..7ae79612187 100644 --- a/sys/arch/sparc64/dev/vnet.c +++ b/sys/arch/sparc64/dev/vnet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnet.c,v 1.36 2014/12/22 02:26:54 tedu Exp $ */ +/* $OpenBSD: vnet.c,v 1.37 2015/01/25 21:42:13 kettenis Exp $ */ /* * Copyright (c) 2009 Mark Kettenis * @@ -133,8 +133,8 @@ struct vnet_softc { bus_space_tag_t sc_bustag; bus_dma_tag_t sc_dmatag; - uint64_t sc_tx_sysino; - uint64_t sc_rx_sysino; + uint64_t sc_tx_ino; + uint64_t sc_rx_ino; void *sc_tx_ih; void *sc_rx_ih; @@ -253,13 +253,10 @@ vnet_attach(struct device *parent, struct device *self, void *aux) sc->sc_bustag = ca->ca_bustag; sc->sc_dmatag = ca->ca_dmatag; + sc->sc_tx_ino = ca->ca_tx_ino; + sc->sc_rx_ino = ca->ca_rx_ino; - if (cbus_intr_map(ca->ca_node, ca->ca_tx_ino, &sc->sc_tx_sysino) || - cbus_intr_map(ca->ca_node, ca->ca_rx_ino, &sc->sc_rx_sysino)) { - printf(": can't map interrupt\n"); - return; - } - printf(": ivec 0x%llx, 0x%llx", sc->sc_tx_sysino, sc->sc_rx_sysino); + printf(": ivec 0x%llx, 0x%llx", sc->sc_tx_ino, sc->sc_rx_ino); /* * Un-configure queues before registering interrupt handlers, @@ -268,9 +265,9 @@ vnet_attach(struct device *parent, struct device *self, void *aux) hv_ldc_tx_qconf(ca->ca_id, 0, 0); hv_ldc_rx_qconf(ca->ca_id, 0, 0); - sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_tx_sysino, + sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_tx_ino, IPL_NET, 0, vnet_tx_intr, sc, sc->sc_dv.dv_xname); - sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_rx_sysino, + sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_rx_ino, IPL_NET, 0, vnet_rx_intr, sc, sc->sc_dv.dv_xname); if (sc->sc_tx_ih == NULL || sc->sc_rx_ih == NULL) { printf(", can't establish interrupt\n"); @@ -1383,8 +1380,8 @@ vnet_init(struct ifnet *ifp) if (err != H_EOK) printf("hv_ldc_rx_qconf %d\n", err); - cbus_intr_setenabled(sc->sc_tx_sysino, INTR_ENABLED); - cbus_intr_setenabled(sc->sc_rx_sysino, INTR_ENABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, INTR_ENABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_rx_ino, INTR_ENABLED); ldc_send_vers(lc); @@ -1401,8 +1398,8 @@ vnet_stop(struct ifnet *ifp) ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); ifp->if_timer = 0; - cbus_intr_setenabled(sc->sc_tx_sysino, INTR_DISABLED); - cbus_intr_setenabled(sc->sc_rx_sysino, INTR_DISABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, INTR_DISABLED); + cbus_intr_setenabled(sc->sc_bustag, sc->sc_rx_ino, INTR_DISABLED); hv_ldc_tx_qconf(lc->lc_id, 0, 0); hv_ldc_rx_qconf(lc->lc_id, 0, 0); -- 2.20.1