XenevaOS
Loading...
Searching...
No Matches
interrupt.h
Go to the documentation of this file.
1#ifndef __LINUX_INTERRUPT_H__
2#define __LINUX_INTERRUPT_H__
3
4/*
5 * DCL <linux/interrupt.h> -- request_irq()/free_irq() over Xeneva's GIC.
6 *
7 * The GIC already keeps a per-SPI callback table (KernelAA64/Hal/gic.c:
8 * GICRegisterSPIHandler / GICCallSPIHandler, typed void (*)(int spi)), so the
9 * adapter is small: record (irq -> handler, dev_id) and install one dispatcher
10 * as that SPI's handler. Bodies land in DCL/linux_irq_shim.c.
11 *
12 * IRQ numbers: this is where a faithful adapter earns its keep. On ARM64 the
13 * GIC numbers SGIs 0-15, PPIs 16-31 and SPIs from 32, and Linux's irq number
14 * on these boards is the HW irq, so the SPI id is irq - 32. A negative result
15 * means somebody asked for an SGI/PPI -- a per-CPU line no serial driver owns
16 * -- and is refused rather than quietly registered on the wrong vector.
17 *
18 * One handler per irq. IRQF_SHARED is accepted because 8250_port.c:2314 sets
19 * it unconditionally for iotype PORT_UNKNOWN, but nothing in this tree shares
20 * an irq yet: a fabricated share list would be the kind of quiet wrongness
21 * that surfaces later as a lost interrupt. If a second driver ever asks, that
22 * is the moment to grow it.
23 *
24 * irqreturn_t and IRQ_NONE/IRQ_HANDLED/IRQ_WAKE_THREAD come from
25 * <linux/irqreturn.h> through <linux/kernel.h> now, as do the delay
26 * primitives -- see <linux/delay.h>. IRQ_RETVAL is that header's too, so
27 * this file no longer restates it with a second spelling.
28 */
29
30#include <linux/kernel.h> /* irqreturn_t, IRQ_NONE/IRQ_HANDLED */
31
32/*
33 * mainline's <linux/interrupt.h> includes <linux/irqflags.h>, and the reason
34 * it does is <drm/drm_util.h>:64 -- drm_can_sleep() calls irqs_disabled()
35 * without naming the header it comes from, so the include has to be here for
36 * the vendored drm code to resolve. DCL's irqflags.h is one honest DAIF read.
37 */
38#include <linux/irqflags.h>
39
40typedef irqreturn_t (*irq_handler_t)(int irq, void* dev_id);
41
42/* mainline include/linux/interrupt.h -- values, so flag words survive copy */
43#define IRQF_TRIGGER_NONE 0x00000000
44#define IRQF_TRIGGER_RISING 0x00000001
45#define IRQF_TRIGGER_FALLING 0x00000002
46#define IRQF_TRIGGER_HIGH 0x00000004
47#define IRQF_TRIGGER_LOW 0x00000008
48#define IRQF_TRIGGER_MASK (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW | \
49 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)
50#define IRQF_SHARED 0x00000080
51
52/* IRQ_RETVAL(x) is <linux/irqreturn.h>'s -- `((x) ? IRQ_HANDLED : IRQ_NONE)`.
53 * It used to be restated here as `((x) != IRQ_NONE)`, which is the same value
54 * for every value the enum can take but not the same *text*, and a second
55 * definition of the macro is a -Wmacro-redefined. */
56
57int request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
58 const char* name, void* dev_id);
59void free_irq(unsigned int irq, void* dev_id);
60
61void enable_irq(unsigned int irq);
62void disable_irq(unsigned int irq);
63void synchronize_irq(unsigned int irq);
64
65/*
66 * Bounds every port-irq validity check in serial_core.c:966 and
67 * 8250_port.c:3144, so it must be larger than any irq we could ever hand out.
68 * 1024 covers the full GICv3 SPI range with room to spare.
69 */
71
72#endif /* __LINUX_INTERRUPT_H__ */
uint8_t flags
Definition virtio.h:0
struct drm_crtc struct drm_plane struct drm_plane const struct drm_crtc_funcs const char * name
Definition drm_crtc.h:1242
void disable_irq(unsigned int irq)
irqreturn_t(* irq_handler_t)(int irq, void *dev_id)
Definition interrupt.h:40
void free_irq(unsigned int irq, void *dev_id)
void synchronize_irq(unsigned int irq)
int irq_get_nr_irqs(void)
int request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, const char *name, void *dev_id)
void enable_irq(unsigned int irq)
enum irqreturn irqreturn_t
Definition irqreturn.h:17