Date: Sat, 20 May 2006 18:51:17 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 97522 for review Message-ID: <200605201851.k4KIpHuR084519@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=97522 Change 97522 by kmacy@kmacy_storage:sun4v_rwbuf on 2006/05/20 18:50:36 put debug output under -DDEBUG add interrupt wrapper for doing interrupt reset Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/nexus.c#9 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/nexus.c#9 (text+ko) ==== @@ -81,6 +81,15 @@ struct rman sc_mem_rman; }; +typedef struct nexus_id { + devhandle_t dh; + uint32_t ino; + devhandle_t nid_ihdl; + driver_intr_t *nid_handler; + void *nid_arg; + +} nexus_id_t; + static device_probe_t nexus_probe; static device_attach_t nexus_attach; static bus_print_child_t nexus_print_child; @@ -246,6 +255,12 @@ ndi->ndi_obdinfo.obd_node = -1; ndi->ndi_obdinfo.obd_name = strdup(name, M_OFWPROP); resource_list_init(&ndi->ndi_rl); + ndi->ndi_intr_rman.rm_type = RMAN_ARRAY; + ndi->ndi_intr_rman.rm_descr = "Interrupts"; + if (rman_init(&ndi->ndi_intr_rman) != 0 || + rman_manage_region(&ndi->ndi_intr_rman, 0, IV_MAX - 1) != 0) + panic("%s: failed to set up rmans.", __func__); + device_set_ivars(cdev, ndi); return (cdev); @@ -295,6 +310,51 @@ #ifdef SUN4V +void nexus_intr_reset(void *arg); + +void +nexus_intr_reset(void *arg) +{ + nexus_id_t *nidp; + + nidp = (nexus_id_t *)arg; + + hvio_intr_setstate(nidp->nid_ihdl, HV_INTR_IDLE_STATE); + +} + + +static void +nexus_intr_wrapper(void *arg) +{ + nexus_id_t *nidp; + driver_intr_t *handler; + void *harg; + int state, valid; + + nidp = (nexus_id_t *)arg; +#if 1 + if (nidp->dh == 0x7c0) + printf("(%#lx, %#x)", nidp->dh, nidp->ino); +#endif + handler = nidp->nid_handler; + harg = nidp->nid_arg; + + (*handler)(harg); + + hvio_intr_setstate(nidp->nid_ihdl, HV_INTR_IDLE_STATE); + +#ifdef DEBUG + if (nidp->dh == 0x7c0) { + hvio_intr_getstate(nidp->nid_ihdl, &state); + hvio_intr_getvalid(nidp->nid_ihdl, &valid); + printf("i: %#lx, s: %d, v: %d\n", nidp->nid_ihdl, state, valid); + } +#endif +} + + + static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, @@ -304,18 +364,20 @@ uint64_t ihdl; uint64_t ino; int error, cpuid; + nexus_id_t *nidp; ndi = device_get_ivars(child); if (res == NULL) panic("%s: NULL interrupt resource!", __func__); - +#ifdef DEBUG printf("dev=%s child=%s\n", ofw_bus_get_name(dev), ofw_bus_get_name(child)); - +#endif ino = rman_get_start(res); - +#ifdef DEBUG printf("child=%s reg=0x%lx ino=0x%lx\n", ofw_bus_get_name(child), ndi->ndi_devhandle, ino); +#endif if (hvio_intr_devino_to_sysino(ndi->ndi_devhandle, (uint32_t)ino, &ihdl) != H_EOK) { @@ -347,10 +409,20 @@ if ((error = rman_activate_resource(res))) goto fail; + if ((nidp = malloc(sizeof(nexus_id_t), M_DEVBUF, M_NOWAIT)) == NULL) { + printf("failed to allocate nexus_id\n"); + error = ENOMEM; + goto fail; + } + nidp->nid_ihdl = ihdl; + nidp->nid_handler = intr; + nidp->nid_arg = arg; + nidp->dh = ndi->ndi_devhandle; + nidp->ino = ino; + error = inthand_add(device_get_nameunit(child), ihdl, - intr, arg, flags, cookiep); + nexus_intr_wrapper, nidp, flags, cookiep); - printf("inthandler added\n"); fail: return (error); @@ -449,6 +521,10 @@ flags &= ~RF_ACTIVE; rv = rman_reserve_resource(rm, start, end, count, flags, child); + if (type == SYS_RES_IRQ && rv == NULL) { + printf("%s: start: %ld, end: %ld, flags: %#x\n", __func__, + start, end, flags); + } if (rv == NULL) return (NULL); if (type == SYS_RES_MEMORY) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605201851.k4KIpHuR084519>