DragonFly On-Line Manual Pages

Search: Section:  


BUS_SETUP_INTR(9)     DragonFly Kernel Developer's Manual    BUS_SETUP_INTR(9)

NAME

BUS_SETUP_INTR, bus_setup_intr, bus_setup_intr_descr, BUS_TEARDOWN_INTR, bus_teardown_intr -- create, attach and teardown an interrupt handler

SYNOPSIS

#include <sys/param.h> #include <sys/bus.h> int BUS_SETUP_INTR(device_t dev, device_t child, struct resource *irq, int flags, driver_intr_t *intr, void *arg, void **cookiep, lwkt_serialize_t serializer, const char *desc); int bus_setup_intr(device_t dev, struct resource *r, int flags, driver_intr_t handler, void *arg, void **cookiep, lwkt_serialize_t serializer); int bus_setup_intr_descr(device_t dev, struct resource *r, int flags, driver_intr_t handler, void *arg, void **cookiep, lwkt_serialize_t serializer, const char *desc); int BUS_TEARDOWN_INTR(device_t dev, device_t child, struct resource *irq, void *cookie); int bus_teardown_intr(device_t dev, struct resource *r, void *cookie);

DESCRIPTION

The BUS_SETUP_INTR() method will create and attach an interrupt handler to an interrupt previously allocated by the resource manager's BUS_ALLOC_RESOURCE(9) method. The defined handler will be called with the value arg as its only argument. The cookiep argument is a pointer to a void * that BUS_SETUP_INTR() will write a cookie for the parent bus' use to if it is successful in establishing an interrupt. Driver writers may assume that this cookie will be non-zero. The nexus driver will write 0 on failure to cookiep. The flags are found in <sys/bus.h> and tell the interrupt handlers about certain device driver characteristics and are typically either 0 or INTR_MPSAFE. If INTR_MPSAFE is specified the kernel is free to call the interrupt handler without holding the MP lock. Other interrupt flags exist for special purposes. If INTR_NOPOLL is specified, the interrupt handler is not executed by the emergency interrupt polling code. If serializer is non-NULL the interrupt handler will be called with the serializer held. The serializer replaces the obsolete SPL calls that are no longer relevant on SMP systems. Driver code can obtain the same serializer to interlock against the driver interrupt. The serializer also has enablement and disablement features which mainline driver code can use to avoid races between interrupt disablement and delayed interrupts executing from the device's interrupt thread. desc can be used to describe the interrupt handler, which is particularly useful for devices that use multiple interrupts. If it is NULL, the device name will be used instead. The interrupt handler will be detached by BUS_TEARDOWN_INTR(). The cookie needs to be passed to BUS_TEARDOWN_INTR() in order to tear down the correct interrupt handler. Once BUS_TEARDOWN_INTR() returns, it is guaranteed that the interrupt function is not active and will no longer be called. The lowercase versions bus_setup_intr(), bus_setup_intr_descr() and bus_teardown_intr() are convenience functions to make it easier for drivers to use the resource-management functions. All they do is hide indirection through the parent's method table, making for slightly less wordy code.

RETURN VALUES

Zero is returned on success, otherwise an appropriate error is returned.

SEE ALSO

device(9), driver(9), serializer(9)

AUTHORS

This manual page was written by Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org> based on the manual pages for BUS_CREATE_INTR() and BUS_CONNECT_INTR() written by Doug Rabson <dfr@FreeBSD.org>. DragonFly 4.3 March 25, 2016 DragonFly 4.3

Search: Section: