aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include/linux/interrupt.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux/interrupt.h')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/interrupt.h49
1 files changed, 44 insertions, 5 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h
index 905a29a77f91..d5f9a0ae7a47 100644
--- a/sys/compat/linuxkpi/common/include/linux/interrupt.h
+++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h
@@ -25,8 +25,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
*/
#ifndef _LINUXKPI_LINUX_INTERRUPT_H_
#define _LINUXKPI_LINUX_INTERRUPT_H_
@@ -42,7 +40,12 @@
typedef irqreturn_t (*irq_handler_t)(int, void *);
-#define IRQF_SHARED RF_SHAREABLE
+#define IRQF_SHARED 0x0004 /* Historically */
+#define IRQF_NOBALANCING 0
+
+#define IRQ_DISABLE_UNLAZY 0
+
+#define IRQ_NOTCONNECTED (1U << 31)
int lkpi_request_irq(struct device *, unsigned int, irq_handler_t,
irq_handler_t, unsigned long, const char *, void *);
@@ -71,6 +74,14 @@ request_threaded_irq(int irq, irq_handler_t handler,
}
static inline int
+devm_request_irq(struct device *dev, int irq,
+ irq_handler_t handler, unsigned long flags, const char *name, void *arg)
+{
+
+ return (lkpi_request_irq(dev, irq, handler, NULL, flags, name, arg));
+}
+
+static inline int
devm_request_threaded_irq(struct device *dev, int irq,
irq_handler_t handler, irq_handler_t thread_handler,
unsigned long flags, const char *name, void *arg)
@@ -92,6 +103,12 @@ disable_irq(unsigned int irq)
lkpi_disable_irq(irq);
}
+static inline void
+disable_irq_nosync(unsigned int irq)
+{
+ lkpi_disable_irq(irq);
+}
+
static inline int
bind_irq_to_cpu(unsigned int irq, int cpu_id)
{
@@ -111,22 +128,36 @@ devm_free_irq(struct device *xdev, unsigned int irq, void *p)
}
static inline int
-irq_set_affinity_hint(int vector, cpumask_t *mask)
+irq_set_affinity_hint(int vector, const cpumask_t *mask)
{
int error;
if (mask != NULL)
- error = intr_setaffinity(vector, CPU_WHICH_IRQ, mask);
+ error = intr_setaffinity(vector, CPU_WHICH_IRQ, __DECONST(cpumask_t *, mask));
else
error = intr_setaffinity(vector, CPU_WHICH_IRQ, cpuset_root);
return (-error);
}
+static inline struct msi_desc *
+irq_get_msi_desc(unsigned int irq)
+{
+
+ return (lkpi_pci_msi_desc_alloc(irq));
+}
+
+static inline void
+irq_set_status_flags(unsigned int irq __unused, unsigned long flags __unused)
+{
+}
+
/*
* LinuxKPI tasklet support
*/
+struct tasklet_struct;
typedef void tasklet_func_t(unsigned long);
+typedef void tasklet_callback_t(struct tasklet_struct *);
struct tasklet_struct {
TAILQ_ENTRY(tasklet_struct) entry;
@@ -135,6 +166,8 @@ struct tasklet_struct {
volatile u_int tasklet_state;
atomic_t count;
unsigned long data;
+ tasklet_callback_t *callback;
+ bool use_callback;
};
#define DECLARE_TASKLET(_name, _func, _data) \
@@ -142,6 +175,11 @@ struct tasklet_struct _name = { .func = (_func), .data = (_data) }
#define tasklet_hi_schedule(t) tasklet_schedule(t)
+/* Some other compat code in the tree has this defined as well. */
+#define from_tasklet(_dev, _t, _field) \
+ container_of(_t, typeof(*(_dev)), _field)
+
+void tasklet_setup(struct tasklet_struct *, tasklet_callback_t *);
extern void tasklet_schedule(struct tasklet_struct *);
extern void tasklet_kill(struct tasklet_struct *);
extern void tasklet_init(struct tasklet_struct *, tasklet_func_t *,
@@ -152,5 +190,6 @@ extern void tasklet_disable_nosync(struct tasklet_struct *);
extern int tasklet_trylock(struct tasklet_struct *);
extern void tasklet_unlock(struct tasklet_struct *);
extern void tasklet_unlock_wait(struct tasklet_struct *ts);
+#define tasklet_unlock_spin_wait(ts) tasklet_unlock_wait(ts)
#endif /* _LINUXKPI_LINUX_INTERRUPT_H_ */