From owner-svn-src-stable-7@FreeBSD.ORG Thu Jan 21 17:55:48 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31AD91065672; Thu, 21 Jan 2010 17:55:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C3E58FC08; Thu, 21 Jan 2010 17:55:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0LHtmWO001236; Thu, 21 Jan 2010 17:55:48 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0LHtl0m001217; Thu, 21 Jan 2010 17:55:47 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201001211755.o0LHtl0m001217@svn.freebsd.org> From: John Baldwin Date: Thu, 21 Jan 2010 17:55:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202763 - in stable/7: share/man/man9 sys/amd64/amd64 sys/amd64/include sys/i386/i386 sys/i386/include sys/kern sys/sparc64/include sys/sparc64/pci sys/sparc64/sparc64 sys/sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2010 17:55:48 -0000 Author: jhb Date: Thu Jan 21 17:55:47 2010 New Revision: 202763 URL: http://svn.freebsd.org/changeset/base/202763 Log: MFC 198134,198149,198170,198171,198391,200948: Add a facility for associating optional descriptions with active interrupt handlers. This is primarily intended as a way to allow devices that use multiple interrupts (e.g. MSI) to meaningfully distinguish the various interrupt handlers. - Add a new BUS_DESCRIBE_INTR() method to the bus interface to associate a description with an active interrupt handler setup by BUS_SETUP_INTR. It has a default method (bus_generic_describe_intr()) which simply passes the request up to the parent device. - Add a bus_describe_intr() wrapper around BUS_DESCRIBE_INTR() that supports printf(9) style formatting using var args. - Reserve MAXCOMLEN bytes in the intr_handler structure to hold the name of an interrupt handler and copy the name passed to intr_event_add_handler() into that buffer instead of just saving the pointer to the name. - Add a new intr_event_describe_handler() which appends a description string to an interrupt handler's name. - Implement support for interrupt descriptions on amd64, i386, and sparc64 by having the nexus(4) driver supply a custom bus_describe_intr method that invokes a new intr_describe() MD routine which in turn looks up the associated interrupt event and invokes intr_event_describe_handler(). Added: stable/7/share/man/man9/BUS_DESCRIBE_INTR.9 - copied, changed from r198134, head/share/man/man9/BUS_DESCRIBE_INTR.9 Modified: stable/7/share/man/man9/Makefile stable/7/sys/amd64/amd64/intr_machdep.c stable/7/sys/amd64/amd64/nexus.c stable/7/sys/amd64/include/intr_machdep.h stable/7/sys/i386/i386/intr_machdep.c stable/7/sys/i386/i386/nexus.c stable/7/sys/i386/include/intr_machdep.h stable/7/sys/kern/bus_if.m stable/7/sys/kern/kern_intr.c stable/7/sys/kern/subr_bus.c stable/7/sys/sparc64/include/intr_machdep.h stable/7/sys/sparc64/pci/psycho.c stable/7/sys/sparc64/pci/schizo.c stable/7/sys/sparc64/sparc64/intr_machdep.c stable/7/sys/sparc64/sparc64/nexus.c stable/7/sys/sys/bus.h stable/7/sys/sys/interrupt.h Directory Properties: stable/7/share/man/man9/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Copied and modified: stable/7/share/man/man9/BUS_DESCRIBE_INTR.9 (from r198134, head/share/man/man9/BUS_DESCRIBE_INTR.9) ============================================================================== --- head/share/man/man9/BUS_DESCRIBE_INTR.9 Thu Oct 15 14:54:35 2009 (r198134, copy source) +++ stable/7/share/man/man9/BUS_DESCRIBE_INTR.9 Thu Jan 21 17:55:47 2010 (r202763) @@ -88,10 +88,10 @@ the interrupt handler name. Zero is returned on success, otherwise an appropriate error is returned. .Sh SEE ALSO .Xr BUS_SETUP_INTR 9 , -.Xr device 9 , -.Xr printf 9 , .Xr systat 1 , -.Xr vmstat 8 +.Xr vmstat 8 , +.Xr device 9 , +.Xr printf 9 .Sh HISTORY The .Fn BUS_DESCRIBE_INTR Modified: stable/7/share/man/man9/Makefile ============================================================================== --- stable/7/share/man/man9/Makefile Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/share/man/man9/Makefile Thu Jan 21 17:55:47 2010 (r202763) @@ -24,6 +24,7 @@ MAN= accept_filter.9 \ BUS_BIND_INTR.9 \ bus_child_present.9 \ BUS_CONFIG_INTR.9 \ + BUS_DESCRIBE_INTR.9 \ bus_dma.9 \ bus_generic_attach.9 \ bus_generic_detach.9 \ @@ -379,6 +380,7 @@ MLINKS+=buf.9 bp.9 MLINKS+=bus_activate_resource.9 bus_deactivate_resource.9 MLINKS+=bus_alloc_resource.9 bus_alloc_resource_any.9 MLINKS+=BUS_BIND_INTR.9 bus_bind_intr.9 +MLINKS+=BUS_DESCRIBE_INTR.9 bus_describe_intr.9 MLINKS+=bus_dma.9 busdma.9 \ bus_dma.9 bus_dmamap_create.9 \ bus_dma.9 bus_dmamap_destroy.9 \ Modified: stable/7/sys/amd64/amd64/intr_machdep.c ============================================================================== --- stable/7/sys/amd64/amd64/intr_machdep.c Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/amd64/amd64/intr_machdep.c Thu Jan 21 17:55:47 2010 (r202763) @@ -405,6 +405,23 @@ atpic_reset(void) } #endif +/* Add a description to an active interrupt handler. */ +int +intr_describe(u_int vector, void *ih, const char *descr) +{ + struct intsrc *isrc; + int error; + + isrc = intr_lookup_source(vector); + if (isrc == NULL) + return (EINVAL); + error = intr_event_describe_handler(isrc->is_event, ih, descr); + if (error) + return (error); + intrcnt_updatename(isrc); + return (0); +} + #ifdef DDB /* * Dump data about interrupt handlers Modified: stable/7/sys/amd64/amd64/nexus.c ============================================================================== --- stable/7/sys/amd64/amd64/nexus.c Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/amd64/amd64/nexus.c Thu Jan 21 17:55:47 2010 (r202763) @@ -94,6 +94,9 @@ static int nexus_bind_intr(device_t, dev #endif static int nexus_config_intr(device_t, int, enum intr_trigger, enum intr_polarity); +static int nexus_describe_intr(device_t dev, device_t child, + struct resource *irq, void *cookie, + const char *descr); static int nexus_activate_resource(device_t, device_t, int, int, struct resource *); static int nexus_deactivate_resource(device_t, device_t, int, int, @@ -137,6 +140,7 @@ static device_method_t nexus_methods[] = DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif DEVMETHOD(bus_config_intr, nexus_config_intr), + DEVMETHOD(bus_describe_intr, nexus_describe_intr), DEVMETHOD(bus_get_resource_list, nexus_get_reslist), DEVMETHOD(bus_set_resource, nexus_set_resource), DEVMETHOD(bus_get_resource, nexus_get_resource), @@ -472,6 +476,14 @@ nexus_config_intr(device_t dev, int irq, return (intr_config_intr(irq, trig, pol)); } +static int +nexus_describe_intr(device_t dev, device_t child, struct resource *irq, + void *cookie, const char *descr) +{ + + return (intr_describe(rman_get_start(irq), cookie, descr)); +} + static struct resource_list * nexus_get_reslist(device_t dev, device_t child) { Modified: stable/7/sys/amd64/include/intr_machdep.h ============================================================================== --- stable/7/sys/amd64/include/intr_machdep.h Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/amd64/include/intr_machdep.h Thu Jan 21 17:55:47 2010 (r202763) @@ -151,6 +151,7 @@ int intr_bind(u_int vector, u_char cpu); #endif int intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol); +int intr_describe(u_int vector, void *ih, const char *descr); void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); struct intsrc *intr_lookup_source(int vector); int intr_register_pic(struct pic *pic); Modified: stable/7/sys/i386/i386/intr_machdep.c ============================================================================== --- stable/7/sys/i386/i386/intr_machdep.c Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/i386/i386/intr_machdep.c Thu Jan 21 17:55:47 2010 (r202763) @@ -374,6 +374,23 @@ intr_init(void *dummy __unused) } SYSINIT(intr_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_init, NULL); +/* Add a description to an active interrupt handler. */ +int +intr_describe(u_int vector, void *ih, const char *descr) +{ + struct intsrc *isrc; + int error; + + isrc = intr_lookup_source(vector); + if (isrc == NULL) + return (EINVAL); + error = intr_event_describe_handler(isrc->is_event, ih, descr); + if (error) + return (error); + intrcnt_updatename(isrc); + return (0); +} + #ifdef DDB /* * Dump data about interrupt handlers Modified: stable/7/sys/i386/i386/nexus.c ============================================================================== --- stable/7/sys/i386/i386/nexus.c Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/i386/i386/nexus.c Thu Jan 21 17:55:47 2010 (r202763) @@ -98,6 +98,9 @@ static int nexus_bind_intr(device_t, dev #endif static int nexus_config_intr(device_t, int, enum intr_trigger, enum intr_polarity); +static int nexus_describe_intr(device_t dev, device_t child, + struct resource *irq, void *cookie, + const char *descr); static int nexus_activate_resource(device_t, device_t, int, int, struct resource *); static int nexus_deactivate_resource(device_t, device_t, int, int, @@ -143,6 +146,7 @@ static device_method_t nexus_methods[] = DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif DEVMETHOD(bus_config_intr, nexus_config_intr), + DEVMETHOD(bus_describe_intr, nexus_describe_intr), DEVMETHOD(bus_get_resource_list, nexus_get_reslist), DEVMETHOD(bus_set_resource, nexus_set_resource), DEVMETHOD(bus_get_resource, nexus_get_resource), @@ -519,6 +523,14 @@ nexus_config_intr(device_t dev, int irq, return (intr_config_intr(irq, trig, pol)); } +static int +nexus_describe_intr(device_t dev, device_t child, struct resource *irq, + void *cookie, const char *descr) +{ + + return (intr_describe(rman_get_start(irq), cookie, descr)); +} + static struct resource_list * nexus_get_reslist(device_t dev, device_t child) { Modified: stable/7/sys/i386/include/intr_machdep.h ============================================================================== --- stable/7/sys/i386/include/intr_machdep.h Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/i386/include/intr_machdep.h Thu Jan 21 17:55:47 2010 (r202763) @@ -138,6 +138,7 @@ int intr_bind(u_int vector, u_char cpu); #endif int intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol); +int intr_describe(u_int vector, void *ih, const char *descr); void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); struct intsrc *intr_lookup_source(int vector); int intr_register_pic(struct pic *pic); Modified: stable/7/sys/kern/bus_if.m ============================================================================== --- stable/7/sys/kern/bus_if.m Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/kern/bus_if.m Thu Jan 21 17:55:47 2010 (r202763) @@ -509,7 +509,6 @@ METHOD int bind_intr { int _cpu; } DEFAULT bus_generic_bind_intr; - /** * @brief Allow (bus) drivers to specify the trigger mode and polarity * of the specified interrupt. @@ -527,6 +526,25 @@ METHOD int config_intr { } DEFAULT bus_generic_config_intr; /** + * @brief Allow drivers to associate a description with an active + * interrupt handler. + * + * @param _dev the parent device of @p _child + * @param _child the device which allocated the resource + * @param _irq the resource representing the interrupt + * @param _cookie the cookie value returned when the interrupt + * was originally registered + * @param _descr the description to associate with the interrupt + */ +METHOD int describe_intr { + device_t _dev; + device_t _child; + struct resource *_irq; + void *_cookie; + const char *_descr; +} DEFAULT bus_generic_describe_intr; + +/** * @brief Notify a (bus) driver about a child that the hints mechanism * believes it has discovered. * Modified: stable/7/sys/kern/kern_intr.c ============================================================================== --- stable/7/sys/kern/kern_intr.c Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/kern/kern_intr.c Thu Jan 21 17:55:47 2010 (r202763) @@ -506,7 +506,7 @@ intr_event_add_handler(struct intr_event ih->ih_filter = filter; ih->ih_handler = handler; ih->ih_argument = arg; - ih->ih_name = name; + strlcpy(ih->ih_name, name, sizeof(ih->ih_name)); ih->ih_event = ie; ih->ih_pri = pri; if (flags & INTR_EXCL) @@ -579,7 +579,7 @@ intr_event_add_handler(struct intr_event ih->ih_filter = filter; ih->ih_handler = handler; ih->ih_argument = arg; - ih->ih_name = name; + strlcpy(ih->ih_name, name, sizeof(ih->ih_name)); ih->ih_event = ie; ih->ih_pri = pri; if (flags & INTR_EXCL) @@ -647,6 +647,61 @@ intr_event_add_handler(struct intr_event #endif /* + * Append a description preceded by a ':' to the name of the specified + * interrupt handler. + */ +int +intr_event_describe_handler(struct intr_event *ie, void *cookie, + const char *descr) +{ + struct intr_handler *ih; + size_t space; + char *start; + + mtx_lock(&ie->ie_lock); +#ifdef INVARIANTS + TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) { + if (ih == cookie) + break; + } + if (ih == NULL) { + mtx_unlock(&ie->ie_lock); + panic("handler %p not found in interrupt event %p", cookie, ie); + } +#endif + ih = cookie; + + /* + * Look for an existing description by checking for an + * existing ":". This assumes device names do not include + * colons. If one is found, prepare to insert the new + * description at that point. If one is not found, find the + * end of the name to use as the insertion point. + */ + start = index(ih->ih_name, ':'); + if (start == NULL) + start = index(ih->ih_name, 0); + + /* + * See if there is enough remaining room in the string for the + * description + ":". The "- 1" leaves room for the trailing + * '\0'. The "+ 1" accounts for the colon. + */ + space = sizeof(ih->ih_name) - (start - ih->ih_name) - 1; + if (strlen(descr) + 1 > space) { + mtx_unlock(&ie->ie_lock); + return (ENOSPC); + } + + /* Append a colon followed by the description. */ + *start = ':'; + strcpy(start + 1, descr); + intr_event_update(ie); + mtx_unlock(&ie->ie_lock); + return (0); +} + +/* * Return the ie_source field from the intr_event an intr_handler is * associated with. */ Modified: stable/7/sys/kern/subr_bus.c ============================================================================== --- stable/7/sys/kern/subr_bus.c Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/kern/subr_bus.c Thu Jan 21 17:55:47 2010 (r202763) @@ -3264,6 +3264,24 @@ bus_generic_config_intr(device_t dev, in } /** + * @brief Helper function for implementing BUS_DESCRIBE_INTR(). + * + * This simple implementation of BUS_DESCRIBE_INTR() simply calls the + * BUS_DESCRIBE_INTR() method of the parent of @p dev. + */ +int +bus_generic_describe_intr(device_t dev, device_t child, struct resource *irq, + void *cookie, const char *descr) +{ + + /* Propagate up the bus hierarchy until someone handles it. */ + if (dev->parent) + return (BUS_DESCRIBE_INTR(dev->parent, child, irq, cookie, + descr)); + return (EINVAL); +} + +/** * @brief Helper function for implementing BUS_GET_DMA_TAG(). * * This simple implementation of BUS_GET_DMA_TAG() simply calls the @@ -3569,6 +3587,28 @@ bus_bind_intr(device_t dev, struct resou } /** + * @brief Wrapper function for BUS_DESCRIBE_INTR(). + * + * This function first formats the requested description into a + * temporary buffer and then calls the BUS_DESCRIBE_INTR() method of + * the parent of @p dev. + */ +int +bus_describe_intr(device_t dev, struct resource *irq, void *cookie, + const char *fmt, ...) +{ + char descr[MAXCOMLEN]; + va_list ap; + + if (dev->parent == NULL) + return (EINVAL); + va_start(ap, fmt); + vsnprintf(descr, sizeof(descr), fmt, ap); + va_end(ap); + return (BUS_DESCRIBE_INTR(dev->parent, dev, irq, cookie, descr)); +} + +/** * @brief Wrapper function for BUS_SET_RESOURCE(). * * This function simply calls the BUS_SET_RESOURCE() method of the Modified: stable/7/sys/sparc64/include/intr_machdep.h ============================================================================== --- stable/7/sys/sparc64/include/intr_machdep.h Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/sparc64/include/intr_machdep.h Thu Jan 21 17:55:47 2010 (r202763) @@ -93,6 +93,7 @@ extern struct intr_vector intr_vectors[] void intr_add_cpu(u_int cpu); #endif int intr_bind(int vec, u_char cpu); +int intr_describe(int vec, void *ih, const char *descr); void intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf, void *iva); void intr_init1(void); Modified: stable/7/sys/sparc64/pci/psycho.c ============================================================================== --- stable/7/sys/sparc64/pci/psycho.c Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/sparc64/pci/psycho.c Thu Jan 21 17:55:47 2010 (r202763) @@ -116,6 +116,7 @@ static bus_alloc_resource_t psycho_alloc static bus_activate_resource_t psycho_activate_resource; static bus_deactivate_resource_t psycho_deactivate_resource; static bus_release_resource_t psycho_release_resource; +static bus_describe_intr_t psycho_describe_intr; static bus_get_dma_tag_t psycho_get_dma_tag; static pcib_maxslots_t psycho_maxslots; static pcib_read_config_t psycho_read_config; @@ -140,6 +141,7 @@ static device_method_t psycho_methods[] DEVMETHOD(bus_activate_resource, psycho_activate_resource), DEVMETHOD(bus_deactivate_resource, psycho_deactivate_resource), DEVMETHOD(bus_release_resource, psycho_release_resource), + DEVMETHOD(bus_describe_intr, psycho_describe_intr), DEVMETHOD(bus_get_dma_tag, psycho_get_dma_tag), /* pcib interface */ @@ -1262,6 +1264,18 @@ psycho_teardown_intr(device_t dev, devic return (bus_generic_teardown_intr(dev, child, vec, cookie)); } +static int +psycho_describe_intr(device_t dev, device_t child, struct resource *vec, + void *cookie, const char *descr) +{ + struct psycho_softc *sc; + + sc = device_get_softc(dev); + if (sc->sc_mode == PSYCHO_MODE_SABRE) + cookie = ((struct psycho_dma_sync *)cookie)->pds_cookie; + return (bus_generic_describe_intr(dev, child, vec, cookie, descr)); +} + static struct resource * psycho_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) Modified: stable/7/sys/sparc64/pci/schizo.c ============================================================================== --- stable/7/sys/sparc64/pci/schizo.c Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/sparc64/pci/schizo.c Thu Jan 21 17:55:47 2010 (r202763) @@ -114,6 +114,7 @@ static bus_alloc_resource_t schizo_alloc static bus_activate_resource_t schizo_activate_resource; static bus_deactivate_resource_t schizo_deactivate_resource; static bus_release_resource_t schizo_release_resource; +static bus_describe_intr_t schizo_describe_intr; static bus_get_dma_tag_t schizo_get_dma_tag; static pcib_maxslots_t schizo_maxslots; static pcib_read_config_t schizo_read_config; @@ -138,6 +139,7 @@ static device_method_t schizo_methods[] DEVMETHOD(bus_activate_resource, schizo_activate_resource), DEVMETHOD(bus_deactivate_resource, schizo_deactivate_resource), DEVMETHOD(bus_release_resource, schizo_release_resource), + DEVMETHOD(bus_describe_intr, schizo_describe_intr), DEVMETHOD(bus_get_dma_tag, schizo_get_dma_tag), /* pcib interface */ @@ -1283,6 +1285,18 @@ schizo_teardown_intr(device_t dev, devic return (bus_generic_teardown_intr(dev, child, vec, cookie)); } +static int +schizo_describe_intr(device_t dev, device_t child, struct resource *vec, + void *cookie, const char *descr) +{ + struct schizo_softc *sc; + + sc = device_get_softc(dev); + if ((sc->sc_flags & SCHIZO_FLAGS_CDMA) != 0) + cookie = ((struct schizo_dma_sync *)cookie)->sds_cookie; + return (bus_generic_describe_intr(dev, child, vec, cookie, descr)); +} + static struct resource * schizo_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) Modified: stable/7/sys/sparc64/sparc64/intr_machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/intr_machdep.c Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/sparc64/sparc64/intr_machdep.c Thu Jan 21 17:55:47 2010 (r202763) @@ -414,6 +414,31 @@ inthand_remove(int vec, void *cookie) return (error); } +/* Add a description to an active interrupt handler. */ +int +intr_describe(int vec, void *ih, const char *descr) +{ + struct intr_vector *iv; + int error; + + if (vec < 0 || vec >= IV_MAX) + return (EINVAL); + sx_xlock(&intr_table_lock); + iv = &intr_vectors[vec]; + if (iv == NULL) { + sx_xunlock(&intr_table_lock); + return (EINVAL); + } + error = intr_event_describe_handler(iv->iv_event, ih, descr); + if (error) { + sx_xunlock(&intr_table_lock); + return (error); + } + intrcnt_updatename(vec, iv->iv_event->ie_fullname, 0); + sx_xunlock(&intr_table_lock); + return (error); +} + #ifdef SMP /* * Support for balancing interrupt sources across CPUs. For now we just Modified: stable/7/sys/sparc64/sparc64/nexus.c ============================================================================== --- stable/7/sys/sparc64/sparc64/nexus.c Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/sparc64/sparc64/nexus.c Thu Jan 21 17:55:47 2010 (r202763) @@ -90,12 +90,13 @@ static bus_activate_resource_t nexus_act static bus_deactivate_resource_t nexus_deactivate_resource; static bus_release_resource_t nexus_release_resource; static bus_get_resource_list_t nexus_get_resource_list; +#ifdef SMP +static bus_bind_intr_t nexus_bind_intr; +#endif +static bus_describe_intr_t nexus_describe_intr; static bus_get_dma_tag_t nexus_get_dma_tag; static ofw_bus_get_devinfo_t nexus_get_devinfo; -#ifdef SMP -static int nexus_bind_intr(device_t, device_t, struct resource *, int); -#endif static int nexus_inlist(const char *, const char *const *); static struct nexus_devinfo * nexus_setup_dinfo(device_t, phandle_t); static void nexus_destroy_dinfo(struct nexus_devinfo *); @@ -128,6 +129,7 @@ static device_method_t nexus_methods[] = #ifdef SMP DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif + DEVMETHOD(bus_describe_intr, nexus_describe_intr), DEVMETHOD(bus_get_dma_tag, nexus_get_dma_tag), /* ofw_bus interface */ @@ -328,6 +330,14 @@ nexus_bind_intr(device_t dev, device_t c } #endif +static int +nexus_describe_intr(device_t dev, device_t child, struct resource *r, + void *cookie, const char *descr) +{ + + return (intr_describe(rman_get_start(r), cookie, descr)); +} + static struct resource * nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) Modified: stable/7/sys/sys/bus.h ============================================================================== --- stable/7/sys/sys/bus.h Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/sys/bus.h Thu Jan 21 17:55:47 2010 (r202763) @@ -291,6 +291,9 @@ int bus_generic_bind_intr(device_t dev, int bus_generic_child_present(device_t dev, device_t child); int bus_generic_config_intr(device_t, int, enum intr_trigger, enum intr_polarity); +int bus_generic_describe_intr(device_t dev, device_t child, + struct resource *irq, void *cookie, + const char *descr); int bus_generic_deactivate_resource(device_t dev, device_t child, int type, int rid, struct resource *r); int bus_generic_detach(device_t dev); @@ -361,6 +364,8 @@ int bus_setup_intr(device_t dev, struct void *arg, void **cookiep); int bus_teardown_intr(device_t dev, struct resource *r, void *cookie); int bus_bind_intr(device_t dev, struct resource *r, int cpu); +int bus_describe_intr(device_t dev, struct resource *irq, void *cookie, + const char *fmt, ...); int bus_set_resource(device_t dev, int type, int rid, u_long start, u_long count); int bus_get_resource(device_t dev, int type, int rid, Modified: stable/7/sys/sys/interrupt.h ============================================================================== --- stable/7/sys/sys/interrupt.h Thu Jan 21 17:54:29 2010 (r202762) +++ stable/7/sys/sys/interrupt.h Thu Jan 21 17:55:47 2010 (r202763) @@ -47,7 +47,7 @@ struct intr_handler { driver_intr_t *ih_handler; /* Handler function. */ void *ih_argument; /* Argument to pass to handler. */ int ih_flags; - const char *ih_name; /* Name of handler. */ + char ih_name[MAXCOMLEN]; /* Name of handler. */ struct intr_event *ih_event; /* Event we are connected to. */ int ih_need; /* Needs service. */ TAILQ_ENTRY(intr_handler) ih_next; /* Next handler for this event. */ @@ -156,6 +156,8 @@ int intr_event_create(struct intr_event void (*post_ithread)(void *), void (*post_filter)(void *), int (*assign_cpu)(void *, u_char), const char *fmt, ...) __printflike(9, 10); +int intr_event_describe_handler(struct intr_event *ie, void *cookie, + const char *descr); int intr_event_destroy(struct intr_event *ie); int intr_event_handle(struct intr_event *ie, struct trapframe *frame); int intr_event_remove_handler(void *cookie);