Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __ASM_IA64_IOSAPIC_H |
| 2 | #define __ASM_IA64_IOSAPIC_H |
| 3 | |
| 4 | #define IOSAPIC_REG_SELECT 0x0 |
| 5 | #define IOSAPIC_WINDOW 0x10 |
| 6 | #define IOSAPIC_EOI 0x40 |
| 7 | |
| 8 | #define IOSAPIC_VERSION 0x1 |
| 9 | |
| 10 | /* |
| 11 | * Redirection table entry |
| 12 | */ |
| 13 | #define IOSAPIC_RTE_LOW(i) (0x10+i*2) |
| 14 | #define IOSAPIC_RTE_HIGH(i) (0x11+i*2) |
| 15 | |
| 16 | #define IOSAPIC_DEST_SHIFT 16 |
| 17 | |
| 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 |
| 28 | |
| 29 | /* |
| 30 | * Interrupt polarity |
| 31 | */ |
| 32 | #define IOSAPIC_POLARITY_SHIFT 13 |
| 33 | #define IOSAPIC_POL_HIGH 0 |
| 34 | #define IOSAPIC_POL_LOW 1 |
| 35 | |
| 36 | /* |
| 37 | * Trigger mode |
| 38 | */ |
| 39 | #define IOSAPIC_TRIGGER_SHIFT 15 |
| 40 | #define IOSAPIC_EDGE 0 |
| 41 | #define IOSAPIC_LEVEL 1 |
| 42 | |
| 43 | /* |
| 44 | * Mask bit |
| 45 | */ |
| 46 | |
| 47 | #define IOSAPIC_MASK_SHIFT 16 |
| 48 | #define IOSAPIC_MASK (1<<IOSAPIC_MASK_SHIFT) |
| 49 | |
Yasuaki Ishimatsu | cd378f1 | 2007-07-17 21:22:48 +0900 | [diff] [blame] | 50 | #define IOSAPIC_VECTOR_MASK 0xffffff00 |
| 51 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | #ifndef __ASSEMBLY__ |
| 53 | |
| 54 | #ifdef CONFIG_IOSAPIC |
| 55 | |
| 56 | #define NR_IOSAPICS 256 |
| 57 | |
Yasuaki Ishimatsu | c1726d6 | 2007-07-17 21:21:26 +0900 | [diff] [blame] | 58 | static inline unsigned int __iosapic_read(char __iomem *iosapic, unsigned int reg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | { |
| 60 | writel(reg, iosapic + IOSAPIC_REG_SELECT); |
| 61 | return readl(iosapic + IOSAPIC_WINDOW); |
| 62 | } |
| 63 | |
Yasuaki Ishimatsu | c1726d6 | 2007-07-17 21:21:26 +0900 | [diff] [blame] | 64 | static inline void __iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | { |
| 66 | writel(reg, iosapic + IOSAPIC_REG_SELECT); |
| 67 | writel(val, iosapic + IOSAPIC_WINDOW); |
| 68 | } |
| 69 | |
| 70 | static inline void iosapic_eoi(char __iomem *iosapic, u32 vector) |
| 71 | { |
| 72 | writel(vector, iosapic + IOSAPIC_EOI); |
| 73 | } |
| 74 | |
| 75 | extern void __init iosapic_system_init (int pcat_compat); |
Kenji Kaneshige | 0e888ad | 2005-04-28 00:25:58 -0700 | [diff] [blame] | 76 | extern int __devinit iosapic_init (unsigned long address, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | unsigned int gsi_base); |
Kenji Kaneshige | 0e888ad | 2005-04-28 00:25:58 -0700 | [diff] [blame] | 78 | #ifdef CONFIG_HOTPLUG |
| 79 | extern int iosapic_remove (unsigned int gsi_base); |
Kenji Kaneshige | 1c53e43 | 2005-08-10 02:49:00 -0700 | [diff] [blame] | 80 | #else |
| 81 | #define iosapic_remove(gsi_base) (-EINVAL) |
Kenji Kaneshige | 0e888ad | 2005-04-28 00:25:58 -0700 | [diff] [blame] | 82 | #endif /* CONFIG_HOTPLUG */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | extern int gsi_to_vector (unsigned int gsi); |
| 84 | extern int gsi_to_irq (unsigned int gsi); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity, |
| 86 | unsigned long trigger); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | extern void iosapic_unregister_intr (unsigned int irq); |
Tony Luck | 0f7ac29 | 2007-05-07 13:17:00 -0700 | [diff] [blame] | 88 | extern void __devinit iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | unsigned long polarity, |
| 90 | unsigned long trigger); |
| 91 | extern int __init iosapic_register_platform_intr (u32 int_type, |
| 92 | unsigned int gsi, |
| 93 | int pmi_vector, |
| 94 | u16 eid, u16 id, |
| 95 | unsigned long polarity, |
| 96 | unsigned long trigger); |
| 97 | extern unsigned int iosapic_version (char __iomem *addr); |
| 98 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | #ifdef CONFIG_NUMA |
Kenji Kaneshige | 0e888ad | 2005-04-28 00:25:58 -0700 | [diff] [blame] | 100 | extern void __devinit map_iosapic_to_node (unsigned int, int); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | #endif |
| 102 | #else |
| 103 | #define iosapic_system_init(pcat_compat) do { } while (0) |
Kenji Kaneshige | 0e888ad | 2005-04-28 00:25:58 -0700 | [diff] [blame] | 104 | #define iosapic_init(address,gsi_base) (-EINVAL) |
Kenji Kaneshige | 0e888ad | 2005-04-28 00:25:58 -0700 | [diff] [blame] | 105 | #define iosapic_remove(gsi_base) (-ENODEV) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | #define iosapic_register_intr(gsi,polarity,trigger) (gsi) |
| 107 | #define iosapic_unregister_intr(irq) do { } while (0) |
| 108 | #define iosapic_override_isa_irq(isa_irq,gsi,polarity,trigger) do { } while (0) |
| 109 | #define iosapic_register_platform_intr(type,gsi,pmi,eid,id, \ |
| 110 | polarity,trigger) (gsi) |
| 111 | #endif |
| 112 | |
| 113 | # endif /* !__ASSEMBLY__ */ |
| 114 | #endif /* __ASM_IA64_IOSAPIC_H */ |