xen_intr.h revision 186557
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: head/sys/xen/xen_intr.h 186557 2008-12-29 06:31:03Z kmacy $
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/* Dynamic binding of event channels and VIRQ sources to Linux IRQ space. */
33extern void unbind_from_irq(int irq);
34
35extern int bind_caller_port_to_irqhandler(unsigned int caller_port,
36	const char *devname, driver_intr_t handler, void *arg,
37	unsigned long irqflags, unsigned int *irqp);
38extern int bind_listening_port_to_irqhandler(unsigned int remote_domain,
39	const char *devname, driver_intr_t handler, void *arg, unsigned long irqflags,
40	unsigned int *irqp);
41extern int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu,
42	const char *devname, driver_filter_t filter, driver_intr_t handler,
43	void *arg, unsigned long irqflags,	unsigned int *irqp);
44extern int bind_ipi_to_irqhandler(unsigned int ipi,
45	unsigned int cpu,
46	const char *devname,
47	driver_filter_t handler,
48	unsigned long irqflags,
49	unsigned int *irqp);
50
51extern int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain,
52	                                             unsigned int remote_port,
53	                                             const char *devname,
54	                                             driver_filter_t filter,
55	                                             driver_intr_t handler,
56	                                             unsigned long irqflags,
57	                                             unsigned int *irqp);
58
59
60
61extern void unbind_from_irqhandler(unsigned int evtchn);
62static __inline__ int irq_cannonicalize(int irq)
63{
64    return (irq == 2) ? 9 : irq;
65}
66
67extern void disable_irq(unsigned int);
68extern void disable_irq_nosync(unsigned int);
69extern void enable_irq(unsigned int);
70
71extern void irq_suspend(void);
72extern void irq_resume(void);
73
74extern void	idle_block(void);
75extern int	ap_cpu_initclocks(int cpu);
76
77#endif /* _XEN_INTR_H_ */
78