FreeBSD/Linux Kernel Cross Reference
sys/xen/xen_intr.h
1 /* -*- Mode:C; c-basic-offset:4; tab-width:4 -*- */
2 #ifndef _XEN_INTR_H_
3 #define _XEN_INTR_H_
4
5 /*
6 * The flat IRQ space is divided into two regions:
7 * 1. A one-to-one mapping of real physical IRQs. This space is only used
8 * if we have physical device-access privilege. This region is at the
9 * start of the IRQ space so that existing device drivers do not need
10 * to be modified to translate physical IRQ numbers into our IRQ space.
11 * 3. A dynamic mapping of inter-domain and Xen-sourced virtual IRQs. These
12 * are bound using the provided bind/unbind functions.
13 *
14 *
15 * $FreeBSD$
16 */
17
18 #define PIRQ_BASE 0
19 #define NR_PIRQS 128
20
21 #define DYNIRQ_BASE (PIRQ_BASE + NR_PIRQS)
22 #define NR_DYNIRQS 128
23
24 #define NR_IRQS (NR_PIRQS + NR_DYNIRQS)
25
26 #define pirq_to_irq(_x) ((_x) + PIRQ_BASE)
27 #define irq_to_pirq(_x) ((_x) - PIRQ_BASE)
28
29 #define dynirq_to_irq(_x) ((_x) + DYNIRQ_BASE)
30 #define irq_to_dynirq(_x) ((_x) - DYNIRQ_BASE)
31
32 /*
33 * Dynamic binding of event channels and VIRQ sources to guest IRQ space.
34 */
35
36 /*
37 * Bind a caller port event channel to an interrupt handler. If
38 * successful, the guest IRQ number is returned in *irqp. Return zero
39 * on success or errno otherwise.
40 */
41 extern int bind_caller_port_to_irqhandler(unsigned int caller_port,
42 const char *devname, driver_intr_t handler, void *arg,
43 unsigned long irqflags, unsigned int *irqp);
44
45 /*
46 * Bind a listening port to an interrupt handler. If successful, the
47 * guest IRQ number is returned in *irqp. Return zero on success or
48 * errno otherwise.
49 */
50 extern int bind_listening_port_to_irqhandler(unsigned int remote_domain,
51 const char *devname, driver_intr_t handler, void *arg,
52 unsigned long irqflags, unsigned int *irqp);
53
54 /*
55 * Bind a VIRQ to an interrupt handler. If successful, the guest IRQ
56 * number is returned in *irqp. Return zero on success or errno
57 * otherwise.
58 */
59 extern int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu,
60 const char *devname, driver_filter_t filter, driver_intr_t handler,
61 void *arg, unsigned long irqflags, unsigned int *irqp);
62
63 /*
64 * Bind an IPI to an interrupt handler. If successful, the guest
65 * IRQ number is returned in *irqp. Return zero on success or errno
66 * otherwise.
67 */
68 extern int bind_ipi_to_irqhandler(unsigned int ipi, unsigned int cpu,
69 const char *devname, driver_filter_t filter,
70 unsigned long irqflags, unsigned int *irqp);
71
72 /*
73 * Bind an interdomain event channel to an interrupt handler. If
74 * successful, the guest IRQ number is returned in *irqp. Return zero
75 * on success or errno otherwise.
76 */
77 extern int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain,
78 unsigned int remote_port, const char *devname,
79 driver_intr_t handler, void *arg,
80 unsigned long irqflags, unsigned int *irqp);
81
82 /*
83 * Unbind an interrupt handler using the guest IRQ number returned
84 * when it was bound.
85 */
86 extern void unbind_from_irqhandler(unsigned int irq);
87
88 static __inline__ int irq_cannonicalize(unsigned int irq)
89 {
90 return (irq == 2) ? 9 : irq;
91 }
92
93 extern void disable_irq(unsigned int);
94 extern void disable_irq_nosync(unsigned int);
95 extern void enable_irq(unsigned int);
96
97 extern void irq_suspend(void);
98 extern void irq_resume(void);
99
100 extern void idle_block(void);
101 extern int ap_cpu_initclocks(int cpu);
102
103 #endif /* _XEN_INTR_H_ */
Cache object: 81ee2fb7feb046f481cbd49b28eb7a74
|