ia64/xen-unstable

view xen/include/asm-ia64/linux-xen/asm/iosapic.h @ 9747:de2dc4e7966a

[IA64] Add support to physdev_ops

Add support to physdev ops, and thus give IOSAPIC RTEs
managed by Xen now. Dom0 now issues hypercall to r/w
RTE entry. Another change is the irq vector allocation
which is also owned by xen now.

After this change, the IOSAPIC is almost owned by xen
with only exception as IOSAPIC EOI which is still issued
by dom0 directly. But that's OK since currently dom0
owns all external physical devices. Later full event
channel mechanism will provide necessary support for
driver domain, and at that time, dom0 instead issues
physdev_op (PHYSDEVOP_IRQ_UNMASK_NOTIFY) naturally as
replace of IOSAPIC EOI.

Signed-off-by Kevin Tian <kevin.tian@intel.com>
author awilliam@xenbuild.aw
date Fri Apr 21 09:03:19 2006 -0600 (2006-04-21)
parents eab6fd4949f0
children 811c02dbe595
line source
1 #ifndef __ASM_IA64_IOSAPIC_H
2 #define __ASM_IA64_IOSAPIC_H
4 #define IOSAPIC_REG_SELECT 0x0
5 #define IOSAPIC_WINDOW 0x10
6 #define IOSAPIC_EOI 0x40
8 #define IOSAPIC_VERSION 0x1
10 /*
11 * Redirection table entry
12 */
13 #define IOSAPIC_RTE_LOW(i) (0x10+i*2)
14 #define IOSAPIC_RTE_HIGH(i) (0x11+i*2)
16 #define IOSAPIC_DEST_SHIFT 16
18 /*
19 * Delivery mode
20 */
21 #define IOSAPIC_DELIVERY_SHIFT 8
22 #define IOSAPIC_FIXED 0x0
23 #define IOSAPIC_LOWEST_PRIORITY 0x1
24 #define IOSAPIC_PMI 0x2
25 #define IOSAPIC_NMI 0x4
26 #define IOSAPIC_INIT 0x5
27 #define IOSAPIC_EXTINT 0x7
29 /*
30 * Interrupt polarity
31 */
32 #define IOSAPIC_POLARITY_SHIFT 13
33 #define IOSAPIC_POL_HIGH 0
34 #define IOSAPIC_POL_LOW 1
36 /*
37 * Trigger mode
38 */
39 #define IOSAPIC_TRIGGER_SHIFT 15
40 #define IOSAPIC_EDGE 0
41 #define IOSAPIC_LEVEL 1
43 /*
44 * Mask bit
45 */
47 #define IOSAPIC_MASK_SHIFT 16
48 #define IOSAPIC_MASK (1<<IOSAPIC_MASK_SHIFT)
50 #ifndef __ASSEMBLY__
52 #ifdef CONFIG_IOSAPIC
54 #define NR_IOSAPICS 256
56 static inline unsigned int iosapic_read(char __iomem *iosapic, unsigned int reg)
57 {
58 writel(reg, iosapic + IOSAPIC_REG_SELECT);
59 return readl(iosapic + IOSAPIC_WINDOW);
60 }
62 static inline void iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
63 {
64 writel(reg, iosapic + IOSAPIC_REG_SELECT);
65 writel(val, iosapic + IOSAPIC_WINDOW);
66 }
68 static inline void iosapic_eoi(char __iomem *iosapic, u32 vector)
69 {
70 writel(vector, iosapic + IOSAPIC_EOI);
71 }
73 extern void __init iosapic_system_init (int pcat_compat);
74 extern int __devinit iosapic_init (unsigned long address,
75 unsigned int gsi_base);
76 #ifdef CONFIG_HOTPLUG
77 extern int iosapic_remove (unsigned int gsi_base);
78 #else
79 #define iosapic_remove(gsi_base) (-EINVAL)
80 #endif /* CONFIG_HOTPLUG */
81 extern int gsi_to_vector (unsigned int gsi);
82 extern int gsi_to_irq (unsigned int gsi);
83 extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity,
84 unsigned long trigger);
85 extern void iosapic_unregister_intr (unsigned int irq);
86 extern void __init iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi,
87 unsigned long polarity,
88 unsigned long trigger);
89 extern int __init iosapic_register_platform_intr (u32 int_type,
90 unsigned int gsi,
91 int pmi_vector,
92 u16 eid, u16 id,
93 unsigned long polarity,
94 unsigned long trigger);
95 extern unsigned int iosapic_version (char __iomem *addr);
97 #ifdef CONFIG_NUMA
98 extern void __devinit map_iosapic_to_node (unsigned int, int);
99 #endif
100 #else
101 #define iosapic_system_init(pcat_compat) do { } while (0)
102 #define iosapic_init(address,gsi_base) (-EINVAL)
103 #define iosapic_remove(gsi_base) (-ENODEV)
104 #define iosapic_register_intr(gsi,polarity,trigger) (gsi)
105 #define iosapic_unregister_intr(irq) do { } while (0)
106 #define iosapic_override_isa_irq(isa_irq,gsi,polarity,trigger) do { } while (0)
107 #define iosapic_register_platform_intr(type,gsi,pmi,eid,id, \
108 polarity,trigger) (gsi)
109 #endif
111 #ifdef XEN
112 /* Move to common code later */
113 /**
114 * list_move - delete from one list and add as another's head
115 * @list: the entry to move
116 * @head: the head that will precede our entry
117 */
118 static inline void list_move(struct list_head *list, struct list_head *head)
119 {
120 __list_del(list->prev, list->next);
121 list_add(list, head);
122 }
124 #define move_irq(x)
126 #define WARN_ON(condition) do { \
127 if (unlikely((condition)!=0)) { \
128 printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
129 dump_stack(); \
130 } \
131 } while (0)
133 #ifdef nop
134 #undef nop
135 #endif
137 struct rte_entry {
138 union {
139 struct {
140 u32 vector : 8,
141 delivery_mode : 3,
142 dest_mode : 1, /* always 0 for iosapic */
143 delivery_status : 1,
144 polarity : 1,
145 __reserved0 : 1,
146 trigger : 1,
147 mask : 1,
148 __reserved1 : 15;
149 } lo;
150 struct {
151 u32 __reserved2 : 16,
152 eid : 8,
153 id : 8;
154 } hi;
155 u32 val;
156 };
157 };
159 #define IOSAPIC_RTEINDEX(reg) (((reg) - 0x10) >> 1)
160 extern unsigned long ia64_vector_mask[];
161 #endif /* XEN */
163 # endif /* !__ASSEMBLY__ */
164 #endif /* __ASM_IA64_IOSAPIC_H */