Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Dec 2009 15:43:38 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200948 - in head/sys/sparc64: include pci sparc64
Message-ID:  <200912241543.nBOFhcMN034391@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Thu Dec 24 15:43:37 2009
New Revision: 200948
URL: http://svn.freebsd.org/changeset/base/200948

Log:
  Merge from amd64/i386:
  Implement support for interrupt descriptions.

Modified:
  head/sys/sparc64/include/intr_machdep.h
  head/sys/sparc64/pci/psycho.c
  head/sys/sparc64/pci/schizo.c
  head/sys/sparc64/sparc64/intr_machdep.c
  head/sys/sparc64/sparc64/nexus.c

Modified: head/sys/sparc64/include/intr_machdep.h
==============================================================================
--- head/sys/sparc64/include/intr_machdep.h	Thu Dec 24 15:40:08 2009	(r200947)
+++ head/sys/sparc64/include/intr_machdep.h	Thu Dec 24 15:43:37 2009	(r200948)
@@ -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: head/sys/sparc64/pci/psycho.c
==============================================================================
--- head/sys/sparc64/pci/psycho.c	Thu Dec 24 15:40:08 2009	(r200947)
+++ head/sys/sparc64/pci/psycho.c	Thu Dec 24 15:43:37 2009	(r200948)
@@ -115,6 +115,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;
@@ -139,6 +140,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 */
@@ -1246,6 +1248,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: head/sys/sparc64/pci/schizo.c
==============================================================================
--- head/sys/sparc64/pci/schizo.c	Thu Dec 24 15:40:08 2009	(r200947)
+++ head/sys/sparc64/pci/schizo.c	Thu Dec 24 15:43:37 2009	(r200948)
@@ -113,6 +113,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;
@@ -137,6 +138,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 */
@@ -1257,6 +1259,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: head/sys/sparc64/sparc64/intr_machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/intr_machdep.c	Thu Dec 24 15:40:08 2009	(r200947)
+++ head/sys/sparc64/sparc64/intr_machdep.c	Thu Dec 24 15:43:37 2009	(r200948)
@@ -413,6 +413,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: head/sys/sparc64/sparc64/nexus.c
==============================================================================
--- head/sys/sparc64/sparc64/nexus.c	Thu Dec 24 15:40:08 2009	(r200947)
+++ head/sys/sparc64/sparc64/nexus.c	Thu Dec 24 15:43:37 2009	(r200948)
@@ -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 */
@@ -329,6 +331,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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912241543.nBOFhcMN034391>