Changeset View
Changeset View
Standalone View
Standalone View
head/sys/sys/interrupt.h
Show All 27 Lines | |||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _SYS_INTERRUPT_H_ | #ifndef _SYS_INTERRUPT_H_ | ||||
#define _SYS_INTERRUPT_H_ | #define _SYS_INTERRUPT_H_ | ||||
#include <sys/_lock.h> | #include <sys/_lock.h> | ||||
#include <sys/_mutex.h> | #include <sys/_mutex.h> | ||||
#include <sys/ck.h> | |||||
struct intr_event; | struct intr_event; | ||||
struct intr_thread; | struct intr_thread; | ||||
struct trapframe; | struct trapframe; | ||||
/* | /* | ||||
* Describe a hardware interrupt handler. | * Describe a hardware interrupt handler. | ||||
* | * | ||||
* Multiple interrupt handlers for a specific event can be chained | * Multiple interrupt handlers for a specific event can be chained | ||||
* together. | * together. | ||||
*/ | */ | ||||
struct intr_handler { | struct intr_handler { | ||||
driver_filter_t *ih_filter; /* Filter handler function. */ | driver_filter_t *ih_filter; /* Filter handler function. */ | ||||
driver_intr_t *ih_handler; /* Threaded handler function. */ | driver_intr_t *ih_handler; /* Threaded handler function. */ | ||||
void *ih_argument; /* Argument to pass to handlers. */ | void *ih_argument; /* Argument to pass to handlers. */ | ||||
int ih_flags; | int ih_flags; | ||||
char ih_name[MAXCOMLEN + 1]; /* Name of handler. */ | char ih_name[MAXCOMLEN + 1]; /* Name of handler. */ | ||||
struct intr_event *ih_event; /* Event we are connected to. */ | struct intr_event *ih_event; /* Event we are connected to. */ | ||||
int ih_need; /* Needs service. */ | int ih_need; /* Needs service. */ | ||||
TAILQ_ENTRY(intr_handler) ih_next; /* Next handler for this event. */ | CK_SLIST_ENTRY(intr_handler) ih_next; /* Next handler for this event. */ | ||||
u_char ih_pri; /* Priority of this handler. */ | u_char ih_pri; /* Priority of this handler. */ | ||||
struct intr_thread *ih_thread; /* Ithread for filtered handler. */ | struct intr_thread *ih_thread; /* Ithread for filtered handler. */ | ||||
}; | }; | ||||
/* Interrupt handle flags kept in ih_flags */ | /* Interrupt handle flags kept in ih_flags */ | ||||
#define IH_EXCLUSIVE 0x00000002 /* Exclusive interrupt. */ | #define IH_EXCLUSIVE 0x00000002 /* Exclusive interrupt. */ | ||||
#define IH_ENTROPY 0x00000004 /* Device is a good entropy source. */ | #define IH_ENTROPY 0x00000004 /* Device is a good entropy source. */ | ||||
#define IH_DEAD 0x00000008 /* Handler should be removed. */ | #define IH_DEAD 0x00000008 /* Handler should be removed. */ | ||||
Show All 36 Lines | |||||
* event handlers with that event. It can then use | * event handlers with that event. It can then use | ||||
* intr_event_execute_handlers() to execute non-filter handlers. | * intr_event_execute_handlers() to execute non-filter handlers. | ||||
* Currently filter handlers are not supported by this, but that can | * Currently filter handlers are not supported by this, but that can | ||||
* be added by splitting out the filter loop from intr_event_handle() | * be added by splitting out the filter loop from intr_event_handle() | ||||
* if desired. | * if desired. | ||||
*/ | */ | ||||
struct intr_event { | struct intr_event { | ||||
TAILQ_ENTRY(intr_event) ie_list; | TAILQ_ENTRY(intr_event) ie_list; | ||||
TAILQ_HEAD(, intr_handler) ie_handlers; /* Interrupt handlers. */ | CK_SLIST_HEAD(, intr_handler) ie_handlers; /* Interrupt handlers. */ | ||||
char ie_name[MAXCOMLEN + 1]; /* Individual event name. */ | char ie_name[MAXCOMLEN + 1]; /* Individual event name. */ | ||||
char ie_fullname[MAXCOMLEN + 1]; | char ie_fullname[MAXCOMLEN + 1]; | ||||
struct mtx ie_lock; | struct mtx ie_lock; | ||||
void *ie_source; /* Cookie used by MD code. */ | void *ie_source; /* Cookie used by MD code. */ | ||||
struct intr_thread *ie_thread; /* Thread we are connected to. */ | struct intr_thread *ie_thread; /* Thread we are connected to. */ | ||||
void (*ie_pre_ithread)(void *); | void (*ie_pre_ithread)(void *); | ||||
void (*ie_post_ithread)(void *); | void (*ie_post_ithread)(void *); | ||||
void (*ie_post_filter)(void *); | void (*ie_post_filter)(void *); | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
int intr_event_create(struct intr_event **event, void *source, | int intr_event_create(struct intr_event **event, void *source, | ||||
int flags, int irq, void (*pre_ithread)(void *), | int flags, int irq, void (*pre_ithread)(void *), | ||||
void (*post_ithread)(void *), void (*post_filter)(void *), | void (*post_ithread)(void *), void (*post_filter)(void *), | ||||
int (*assign_cpu)(void *, int), const char *fmt, ...) | int (*assign_cpu)(void *, int), const char *fmt, ...) | ||||
__printflike(9, 10); | __printflike(9, 10); | ||||
int intr_event_describe_handler(struct intr_event *ie, void *cookie, | int intr_event_describe_handler(struct intr_event *ie, void *cookie, | ||||
const char *descr); | const char *descr); | ||||
int intr_event_destroy(struct intr_event *ie); | int intr_event_destroy(struct intr_event *ie); | ||||
void intr_event_execute_handlers(struct proc *p, struct intr_event *ie); | |||||
int intr_event_handle(struct intr_event *ie, struct trapframe *frame); | int intr_event_handle(struct intr_event *ie, struct trapframe *frame); | ||||
int intr_event_remove_handler(void *cookie); | int intr_event_remove_handler(void *cookie); | ||||
int intr_getaffinity(int irq, int mode, void *mask); | int intr_getaffinity(int irq, int mode, void *mask); | ||||
void *intr_handler_source(void *cookie); | void *intr_handler_source(void *cookie); | ||||
int intr_setaffinity(int irq, int mode, void *mask); | int intr_setaffinity(int irq, int mode, void *mask); | ||||
void _intr_drain(int irq); /* Linux compat only. */ | void _intr_drain(int irq); /* Linux compat only. */ | ||||
int swi_add(struct intr_event **eventp, const char *name, | int swi_add(struct intr_event **eventp, const char *name, | ||||
driver_intr_t handler, void *arg, int pri, enum intr_type flags, | driver_intr_t handler, void *arg, int pri, enum intr_type flags, | ||||
void **cookiep); | void **cookiep); | ||||
void swi_sched(void *cookie, int flags); | void swi_sched(void *cookie, int flags); | ||||
int swi_remove(void *cookie); | int swi_remove(void *cookie); | ||||
#endif | #endif |