1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-17 15:27:36 +00:00

Merge from amd64/i386:

Implement support for interrupt descriptions.
This commit is contained in:
Marius Strobl 2009-12-24 15:43:37 +00:00
parent b1c13fc739
commit 3438bdc53e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=200948
5 changed files with 67 additions and 3 deletions

View File

@ -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);

View File

@ -115,6 +115,7 @@ static bus_alloc_resource_t psycho_alloc_resource;
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, device_t child, struct resource *vec,
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)

View File

@ -113,6 +113,7 @@ static bus_alloc_resource_t schizo_alloc_resource;
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, device_t child, struct resource *vec,
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)

View File

@ -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

View File

@ -90,12 +90,13 @@ static bus_activate_resource_t nexus_activate_resource;
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 child, struct resource *r, int cpu)
}
#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)