]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/i386/include/xen/xen_intr.h
merge fix for boot-time hang on centos' xen
[FreeBSD/FreeBSD.git] / sys / i386 / include / 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 #define PIRQ_BASE   0
16 #define NR_PIRQS  128
17
18 #define DYNIRQ_BASE (PIRQ_BASE + NR_PIRQS)
19 #define NR_DYNIRQS  128
20
21 #define NR_IRQS   (NR_PIRQS + NR_DYNIRQS)
22
23 #define pirq_to_irq(_x)   ((_x) + PIRQ_BASE)
24 #define irq_to_pirq(_x)   ((_x) - PIRQ_BASE)
25
26 #define dynirq_to_irq(_x) ((_x) + DYNIRQ_BASE)
27 #define irq_to_dynirq(_x) ((_x) - DYNIRQ_BASE)
28
29 /* Dynamic binding of event channels and VIRQ sources to Linux IRQ space. */
30 extern void unbind_from_irq(int irq);
31
32 extern int bind_caller_port_to_irqhandler(unsigned int caller_port,
33         const char *devname, driver_intr_t handler, void *arg,
34         unsigned long irqflags, void **cookiep);
35 extern int bind_listening_port_to_irqhandler(unsigned int remote_domain,
36         const char *devname, driver_intr_t handler, void *arg, unsigned long irqflags,
37         void **cookiep);
38 extern int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, const char *devname,
39         driver_intr_t handler, unsigned long irqflags);
40 extern int bind_ipi_to_irqhandler(unsigned int ipi,
41         unsigned int cpu,
42         const char *devname,
43         driver_intr_t handler,
44         unsigned long irqflags);
45
46 extern int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain,
47                                                      unsigned int remote_port,
48                                                      const char *devname,
49                                                      driver_intr_t handler,
50                                                      unsigned long irqflags);
51
52
53
54 extern void unbind_from_irqhandler(unsigned int evtchn, void *dev_id);
55 static __inline__ int irq_cannonicalize(int irq)
56 {
57     return (irq == 2) ? 9 : irq;
58 }
59
60 extern void disable_irq(unsigned int);
61 extern void disable_irq_nosync(unsigned int);
62 extern void enable_irq(unsigned int);
63
64 extern void irq_suspend(void);
65 extern void irq_resume(void);
66
67 extern void     idle_block(void);
68 extern int      ap_cpu_initclocks(int cpu);
69
70 #endif /* _XEN_INTR_H_ */