1 /*- 2 * Copyright (c) 2010 Isilon Systems, Inc. 3 * Copyright (c) 2010 iX Systems, Inc. 4 * Copyright (c) 2010 Panasas, Inc. 5 * Copyright (c) 2013-2015 Mellanox Technologies, Ltd. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice unmodified, this list of conditions, and the following 13 * disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 * $FreeBSD: releng/12.2/sys/compat/linuxkpi/common/include/linux/interrupt.h 352472 2019-09-18 07:21:08Z hselasky $ 30 */ 31 #ifndef _LINUX_INTERRUPT_H_ 32 #define _LINUX_INTERRUPT_H_ 33 34 #include "linux/kernel.h" 35 #include "los_base.h" 36 #include "linux/workqueue.h" 37 38 #ifdef __cplusplus 39 #if __cplusplus 40 extern "C" { 41 #endif /* __cplusplus */ 42 #endif /* __cplusplus */ 43 44 #define IRQ_RETVAL(x) ((x) != IRQ_NONE) 45 46 /** 47 * These correspond to the IORESOURCE_IRQ_* defines in 48 * linux/ioport.h to select the interrupt line behaviour. 49 */ 50 #define IRQF_TRIGGER_LOW 0x00000008 51 #define IRQF_TRIGGER_HIGH 0x00000004 52 #define IRQF_TRIGGER_FALLING 0x00000002 53 #define IRQF_TRIGGER_RISING 0x00000001 54 #define IRQF_TRIGGER_NONE 0x00000000 55 #define IRQF_TRIGGER_MASK (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW | \ 56 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING) 57 #define IRQF_PROBE_SHARED 0x00000100 58 59 #define IRQ_DEFAULT_PRIORITY 0x0 60 61 typedef enum irqreturn { 62 IRQ_NONE = (0U << 0), /* interrupt was not from this device. */ 63 IRQ_HANDLED = (1U << 0), /* interrupt was handled by this device. */ 64 IRQ_WAKE_THREAD = (1U << 1) /* handler requests to wake the handler thread. */ 65 } irqreturn_t; 66 67 typedef irqreturn_t (*irq_handler_t)(int, void *); 68 typedef void (*irq_bottom_half_handler_t)(struct work_struct *); 69 70 typedef struct irq_args { 71 int iIrq; 72 void *pDevId; 73 const char *pName; 74 } irq_args; 75 76 #define request_irq(irq, handler, flags, name, dev) \ 77 linux_request_irq(irq, handler, flags, name, dev) 78 79 #define free_irq(irq, dev_id) \ 80 linux_free_irq(irq, dev_id) 81 82 #define enable_irq(irq) \ 83 linux_enable_irq(irq) 84 85 #define disable_irq(irq) \ 86 linux_disable_irq(irq) 87 88 extern int linux_request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, 89 const char *name, void *dev); 90 extern void linux_free_irq(unsigned int irq, void *dev_id); 91 extern void linux_enable_irq(unsigned int irq); 92 extern void linux_disable_irq(unsigned int irq); 93 94 #ifdef WORKQUEUE_SUPPORT_PRIORITY 95 extern bool irq_bottom_half(struct workqueue_struct *workQueue, irq_bottom_half_handler_t handler, void *data, 96 unsigned int pri); 97 #else 98 extern bool irq_bottom_half(struct workqueue_struct *workQueue, irq_bottom_half_handler_t handler, void *data); 99 #endif 100 101 #ifdef __cplusplus 102 #if __cplusplus 103 } 104 #endif /* __cplusplus */ 105 #endif /* __cplusplus */ 106 107 #endif /* _LINUX_INTERRUPT_H_ */ 108