diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2006-10-04 05:17:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-04 10:55:29 -0400 |
commit | 03571e11c4a6d08230657f80970f0a5cc7820471 (patch) | |
tree | 1ee056fff8d00a49f51116932bedf38ea592d038 /arch/ia64/kernel/msi_ia64.c | |
parent | 3b7d1921f4cdd6d6ddb7899ae7a8d413991c5cf4 (diff) |
[PATCH] msi: move the ia64 code into arch/ia64
This is just a few makefile tweaks and some file renames.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg KH <greg@kroah.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ia64/kernel/msi_ia64.c')
-rw-r--r-- | arch/ia64/kernel/msi_ia64.c | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c new file mode 100644 index 000000000000..822e59a1b822 --- /dev/null +++ b/arch/ia64/kernel/msi_ia64.c | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | * MSI hooks for standard x86 apic | ||
3 | */ | ||
4 | |||
5 | #include <linux/pci.h> | ||
6 | #include <linux/irq.h> | ||
7 | #include <linux/msi.h> | ||
8 | #include <asm/smp.h> | ||
9 | |||
10 | /* | ||
11 | * Shifts for APIC-based data | ||
12 | */ | ||
13 | |||
14 | #define MSI_DATA_VECTOR_SHIFT 0 | ||
15 | #define MSI_DATA_VECTOR(v) (((u8)v) << MSI_DATA_VECTOR_SHIFT) | ||
16 | |||
17 | #define MSI_DATA_DELIVERY_SHIFT 8 | ||
18 | #define MSI_DATA_DELIVERY_FIXED (0 << MSI_DATA_DELIVERY_SHIFT) | ||
19 | #define MSI_DATA_DELIVERY_LOWPRI (1 << MSI_DATA_DELIVERY_SHIFT) | ||
20 | |||
21 | #define MSI_DATA_LEVEL_SHIFT 14 | ||
22 | #define MSI_DATA_LEVEL_DEASSERT (0 << MSI_DATA_LEVEL_SHIFT) | ||
23 | #define MSI_DATA_LEVEL_ASSERT (1 << MSI_DATA_LEVEL_SHIFT) | ||
24 | |||
25 | #define MSI_DATA_TRIGGER_SHIFT 15 | ||
26 | #define MSI_DATA_TRIGGER_EDGE (0 << MSI_DATA_TRIGGER_SHIFT) | ||
27 | #define MSI_DATA_TRIGGER_LEVEL (1 << MSI_DATA_TRIGGER_SHIFT) | ||
28 | |||
29 | /* | ||
30 | * Shift/mask fields for APIC-based bus address | ||
31 | */ | ||
32 | |||
33 | #define MSI_TARGET_CPU_SHIFT 4 | ||
34 | #define MSI_ADDR_HEADER 0xfee00000 | ||
35 | |||
36 | #define MSI_ADDR_DESTID_MASK 0xfff0000f | ||
37 | #define MSI_ADDR_DESTID_CPU(cpu) ((cpu) << MSI_TARGET_CPU_SHIFT) | ||
38 | |||
39 | #define MSI_ADDR_DESTMODE_SHIFT 2 | ||
40 | #define MSI_ADDR_DESTMODE_PHYS (0 << MSI_ADDR_DESTMODE_SHIFT) | ||
41 | #define MSI_ADDR_DESTMODE_LOGIC (1 << MSI_ADDR_DESTMODE_SHIFT) | ||
42 | |||
43 | #define MSI_ADDR_REDIRECTION_SHIFT 3 | ||
44 | #define MSI_ADDR_REDIRECTION_CPU (0 << MSI_ADDR_REDIRECTION_SHIFT) | ||
45 | #define MSI_ADDR_REDIRECTION_LOWPRI (1 << MSI_ADDR_REDIRECTION_SHIFT) | ||
46 | |||
47 | static struct irq_chip ia64_msi_chip; | ||
48 | |||
49 | #ifdef CONFIG_SMP | ||
50 | static void ia64_set_msi_irq_affinity(unsigned int irq, cpumask_t cpu_mask) | ||
51 | { | ||
52 | struct msi_msg msg; | ||
53 | u32 addr; | ||
54 | |||
55 | read_msi_msg(irq, &msg); | ||
56 | |||
57 | addr = msg.address_lo; | ||
58 | addr &= MSI_ADDR_DESTID_MASK; | ||
59 | addr |= MSI_ADDR_DESTID_CPU(cpu_physical_id(first_cpu(cpu_mask))); | ||
60 | msg.address_lo = addr; | ||
61 | |||
62 | write_msi_msg(irq, &msg); | ||
63 | set_native_irq_info(irq, cpu_mask); | ||
64 | } | ||
65 | #endif /* CONFIG_SMP */ | ||
66 | |||
67 | int ia64_setup_msi_irq(unsigned int irq, struct pci_dev *pdev) | ||
68 | { | ||
69 | struct msi_msg msg; | ||
70 | unsigned long dest_phys_id; | ||
71 | unsigned int vector; | ||
72 | |||
73 | dest_phys_id = cpu_physical_id(first_cpu(cpu_online_map)); | ||
74 | vector = irq; | ||
75 | |||
76 | msg.address_hi = 0; | ||
77 | msg.address_lo = | ||
78 | MSI_ADDR_HEADER | | ||
79 | MSI_ADDR_DESTMODE_PHYS | | ||
80 | MSI_ADDR_REDIRECTION_CPU | | ||
81 | MSI_ADDR_DESTID_CPU(dest_phys_id); | ||
82 | |||
83 | msg.data = | ||
84 | MSI_DATA_TRIGGER_EDGE | | ||
85 | MSI_DATA_LEVEL_ASSERT | | ||
86 | MSI_DATA_DELIVERY_FIXED | | ||
87 | MSI_DATA_VECTOR(vector); | ||
88 | |||
89 | write_msi_msg(irq, &msg); | ||
90 | set_irq_chip_and_handler(irq, &ia64_msi_chip, handle_edge_irq); | ||
91 | |||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | void ia64_teardown_msi_irq(unsigned int irq) | ||
96 | { | ||
97 | return; /* no-op */ | ||
98 | } | ||
99 | |||
100 | static void ia64_ack_msi_irq(unsigned int irq) | ||
101 | { | ||
102 | move_native_irq(irq); | ||
103 | ia64_eoi(); | ||
104 | } | ||
105 | |||
106 | static int ia64_msi_retrigger_irq(unsigned int irq) | ||
107 | { | ||
108 | unsigned int vector = irq; | ||
109 | ia64_resend_irq(vector); | ||
110 | |||
111 | return 1; | ||
112 | } | ||
113 | |||
114 | /* | ||
115 | * Generic ops used on most IA64 platforms. | ||
116 | */ | ||
117 | static struct irq_chip ia64_msi_chip = { | ||
118 | .name = "PCI-MSI", | ||
119 | .mask = mask_msi_irq, | ||
120 | .unmask = unmask_msi_irq, | ||
121 | .ack = ia64_ack_msi_irq, | ||
122 | #ifdef CONFIG_SMP | ||
123 | .set_affinity = ia64_set_msi_irq_affinity, | ||
124 | #endif | ||
125 | .retrigger = ia64_msi_retrigger_irq, | ||
126 | }; | ||
127 | |||
128 | |||
129 | int arch_setup_msi_irq(unsigned int irq, struct pci_dev *pdev) | ||
130 | { | ||
131 | if (platform_setup_msi_irq) | ||
132 | return platform_setup_msi_irq(irq, pdev); | ||
133 | |||
134 | return ia64_setup_msi_irq(irq, pdev); | ||
135 | } | ||
136 | |||
137 | void arch_teardown_msi_irq(unsigned int irq) | ||
138 | { | ||
139 | if (platform_teardown_msi_irq) | ||
140 | return platform_teardown_msi_irq(irq); | ||
141 | |||
142 | return ia64_teardown_msi_irq(irq); | ||
143 | } | ||