aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-11-16 01:47:43 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-08 22:50:05 -0500
commit60798c6a27b4e9827bdf641259409ada674c2868 (patch)
tree40a19224c29b5643df0cfdd7ea9e20804f5f6368
parent2c5bd01f8f5d7c655d9d1aa60b696d980947e3be (diff)
powerpc: cleanup iseries irq.c
Remove two useless counters. DeStropify. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
-rw-r--r--arch/powerpc/platforms/iseries/irq.c260
1 files changed, 118 insertions, 142 deletions
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c
index a58daa153686..cc6a266e7662 100644
--- a/arch/powerpc/platforms/iseries/irq.c
+++ b/arch/powerpc/platforms/iseries/irq.c
@@ -42,69 +42,50 @@
42#include "irq.h" 42#include "irq.h"
43#include "call_pci.h" 43#include "call_pci.h"
44 44
45static long Pci_Interrupt_Count; 45enum pci_event_type {
46static long Pci_Event_Count; 46 pe_bus_created = 0, /* PHB has been created */
47 47 pe_bus_error = 1, /* PHB has failed */
48enum XmPciLpEvent_Subtype { 48 pe_bus_failed = 2, /* Msg to Secondary, Primary failed bus */
49 XmPciLpEvent_BusCreated = 0, // PHB has been created 49 pe_node_failed = 4, /* Multi-adapter bridge has failed */
50 XmPciLpEvent_BusError = 1, // PHB has failed 50 pe_node_recovered = 5, /* Multi-adapter bridge has recovered */
51 XmPciLpEvent_BusFailed = 2, // Msg to Secondary, Primary failed bus 51 pe_bus_recovered = 12, /* PHB has been recovered */
52 XmPciLpEvent_NodeFailed = 4, // Multi-adapter bridge has failed 52 pe_unquiese_bus = 18, /* Secondary bus unqiescing */
53 XmPciLpEvent_NodeRecovered = 5, // Multi-adapter bridge has recovered 53 pe_bridge_error = 21, /* Bridge Error */
54 XmPciLpEvent_BusRecovered = 12, // PHB has been recovered 54 pe_slot_interrupt = 22 /* Slot interrupt */
55 XmPciLpEvent_UnQuiesceBus = 18, // Secondary bus unqiescing
56 XmPciLpEvent_BridgeError = 21, // Bridge Error
57 XmPciLpEvent_SlotInterrupt = 22 // Slot interrupt
58}; 55};
59 56
60struct XmPciLpEvent_BusInterrupt { 57struct pci_event {
61 HvBusNumber busNumber; 58 struct HvLpEvent event;
62 HvSubBusNumber subBusNumber;
63};
64
65struct XmPciLpEvent_NodeInterrupt {
66 HvBusNumber busNumber;
67 HvSubBusNumber subBusNumber;
68 HvAgentId deviceId;
69};
70
71struct XmPciLpEvent {
72 struct HvLpEvent hvLpEvent;
73
74 union { 59 union {
75 u64 alignData; // Align on an 8-byte boundary 60 u64 __align; /* Align on an 8-byte boundary */
76
77 struct { 61 struct {
78 u32 fisr; 62 u32 fisr;
79 HvBusNumber busNumber; 63 HvBusNumber bus_number;
80 HvSubBusNumber subBusNumber; 64 HvSubBusNumber sub_bus_number;
81 HvAgentId deviceId; 65 HvAgentId dev_id;
82 } slotInterrupt; 66 } slot;
83 67 struct {
84 struct XmPciLpEvent_BusInterrupt busFailed; 68 HvBusNumber bus_number;
85 struct XmPciLpEvent_BusInterrupt busRecovered; 69 HvSubBusNumber sub_bus_number;
86 struct XmPciLpEvent_BusInterrupt busCreated; 70 } bus;
87 71 struct {
88 struct XmPciLpEvent_NodeInterrupt nodeFailed; 72 HvBusNumber bus_number;
89 struct XmPciLpEvent_NodeInterrupt nodeRecovered; 73 HvSubBusNumber sub_bus_number;
90 74 HvAgentId dev_id;
91 } eventData; 75 } node;
92 76 } data;
93}; 77};
94 78
95static void intReceived(struct XmPciLpEvent *eventParm, 79static void int_received(struct pci_event *event, struct pt_regs *regs)
96 struct pt_regs *regsParm)
97{ 80{
98 int irq; 81 int irq;
99#ifdef CONFIG_IRQSTACKS 82#ifdef CONFIG_IRQSTACKS
100 struct thread_info *curtp, *irqtp; 83 struct thread_info *curtp, *irqtp;
101#endif 84#endif
102 85
103 ++Pci_Interrupt_Count; 86 switch (event->event.xSubtype) {
104 87 case pe_slot_interrupt:
105 switch (eventParm->hvLpEvent.xSubtype) { 88 irq = event->event.xCorrelationToken;
106 case XmPciLpEvent_SlotInterrupt:
107 irq = eventParm->hvLpEvent.xCorrelationToken;
108 /* Dispatch the interrupt handlers for this irq */ 89 /* Dispatch the interrupt handlers for this irq */
109#ifdef CONFIG_IRQSTACKS 90#ifdef CONFIG_IRQSTACKS
110 /* Switch to the irq stack to handle this */ 91 /* Switch to the irq stack to handle this */
@@ -113,83 +94,78 @@ static void intReceived(struct XmPciLpEvent *eventParm,
113 if (curtp != irqtp) { 94 if (curtp != irqtp) {
114 irqtp->task = curtp->task; 95 irqtp->task = curtp->task;
115 irqtp->flags = 0; 96 irqtp->flags = 0;
116 call___do_IRQ(irq, regsParm, irqtp); 97 call___do_IRQ(irq, regs, irqtp);
117 irqtp->task = NULL; 98 irqtp->task = NULL;
118 if (irqtp->flags) 99 if (irqtp->flags)
119 set_bits(irqtp->flags, &curtp->flags); 100 set_bits(irqtp->flags, &curtp->flags);
120 } else 101 } else
121#endif 102#endif
122 __do_IRQ(irq, regsParm); 103 __do_IRQ(irq, regs);
123 HvCallPci_eoi(eventParm->eventData.slotInterrupt.busNumber, 104 HvCallPci_eoi(event->data.slot.bus_number,
124 eventParm->eventData.slotInterrupt.subBusNumber, 105 event->data.slot.sub_bus_number,
125 eventParm->eventData.slotInterrupt.deviceId); 106 event->data.slot.dev_id);
126 break; 107 break;
127 /* Ignore error recovery events for now */ 108 /* Ignore error recovery events for now */
128 case XmPciLpEvent_BusCreated: 109 case pe_bus_created:
129 printk(KERN_INFO "intReceived: system bus %d created\n", 110 printk(KERN_INFO "int_received: system bus %d created\n",
130 eventParm->eventData.busCreated.busNumber); 111 event->data.bus.bus_number);
131 break; 112 break;
132 case XmPciLpEvent_BusError: 113 case pe_bus_error:
133 case XmPciLpEvent_BusFailed: 114 case pe_bus_failed:
134 printk(KERN_INFO "intReceived: system bus %d failed\n", 115 printk(KERN_INFO "int_received: system bus %d failed\n",
135 eventParm->eventData.busFailed.busNumber); 116 event->data.bus.bus_number);
136 break; 117 break;
137 case XmPciLpEvent_BusRecovered: 118 case pe_bus_recovered:
138 case XmPciLpEvent_UnQuiesceBus: 119 case pe_unquiese_bus:
139 printk(KERN_INFO "intReceived: system bus %d recovered\n", 120 printk(KERN_INFO "int_received: system bus %d recovered\n",
140 eventParm->eventData.busRecovered.busNumber); 121 event->data.bus.bus_number);
141 break; 122 break;
142 case XmPciLpEvent_NodeFailed: 123 case pe_node_failed:
143 case XmPciLpEvent_BridgeError: 124 case pe_bridge_error:
144 printk(KERN_INFO 125 printk(KERN_INFO
145 "intReceived: multi-adapter bridge %d/%d/%d failed\n", 126 "int_received: multi-adapter bridge %d/%d/%d failed\n",
146 eventParm->eventData.nodeFailed.busNumber, 127 event->data.node.bus_number,
147 eventParm->eventData.nodeFailed.subBusNumber, 128 event->data.node.sub_bus_number,
148 eventParm->eventData.nodeFailed.deviceId); 129 event->data.node.dev_id);
149 break; 130 break;
150 case XmPciLpEvent_NodeRecovered: 131 case pe_node_recovered:
151 printk(KERN_INFO 132 printk(KERN_INFO
152 "intReceived: multi-adapter bridge %d/%d/%d recovered\n", 133 "int_received: multi-adapter bridge %d/%d/%d recovered\n",
153 eventParm->eventData.nodeRecovered.busNumber, 134 event->data.node.bus_number,
154 eventParm->eventData.nodeRecovered.subBusNumber, 135 event->data.node.sub_bus_number,
155 eventParm->eventData.nodeRecovered.deviceId); 136 event->data.node.dev_id);
156 break; 137 break;
157 default: 138 default:
158 printk(KERN_ERR 139 printk(KERN_ERR
159 "intReceived: unrecognized event subtype 0x%x\n", 140 "int_received: unrecognized event subtype 0x%x\n",
160 eventParm->hvLpEvent.xSubtype); 141 event->event.xSubtype);
161 break; 142 break;
162 } 143 }
163} 144}
164 145
165static void XmPciLpEvent_handler(struct HvLpEvent *eventParm, 146static void pci_event_handler(struct HvLpEvent *event, struct pt_regs *regs)
166 struct pt_regs *regsParm)
167{ 147{
168#ifdef CONFIG_PCI 148 if (event && (event->xType == HvLpEvent_Type_PciIo)) {
169 ++Pci_Event_Count; 149 switch (event->xFlags.xFunction) {
170
171 if (eventParm && (eventParm->xType == HvLpEvent_Type_PciIo)) {
172 switch (eventParm->xFlags.xFunction) {
173 case HvLpEvent_Function_Int: 150 case HvLpEvent_Function_Int:
174 intReceived((struct XmPciLpEvent *)eventParm, regsParm); 151 int_received((struct pci_event *)event, regs);
175 break; 152 break;
176 case HvLpEvent_Function_Ack: 153 case HvLpEvent_Function_Ack:
177 printk(KERN_ERR 154 printk(KERN_ERR
178 "XmPciLpEvent_handler: unexpected ack received\n"); 155 "pci_event_handler: unexpected ack received\n");
179 break; 156 break;
180 default: 157 default:
181 printk(KERN_ERR 158 printk(KERN_ERR
182 "XmPciLpEvent_handler: unexpected event function %d\n", 159 "pci_event_handler: unexpected event function %d\n",
183 (int)eventParm->xFlags.xFunction); 160 (int)event->xFlags.xFunction);
184 break; 161 break;
185 } 162 }
186 } else if (eventParm) 163 } else if (event)
187 printk(KERN_ERR 164 printk(KERN_ERR
188 "XmPciLpEvent_handler: Unrecognized PCI event type 0x%x\n", 165 "pci_event_handler: Unrecognized PCI event type 0x%x\n",
189 (int)eventParm->xType); 166 (int)event->xType);
190 else 167 else
191 printk(KERN_ERR "XmPciLpEvent_handler: NULL event received\n"); 168 printk(KERN_ERR "pci_event_handler: NULL event received\n");
192#endif
193} 169}
194 170
195/* 171/*
@@ -199,18 +175,18 @@ static void XmPciLpEvent_handler(struct HvLpEvent *eventParm,
199void __init iSeries_init_IRQ(void) 175void __init iSeries_init_IRQ(void)
200{ 176{
201 /* Register PCI event handler and open an event path */ 177 /* Register PCI event handler and open an event path */
202 int xRc; 178 int ret;
203 179
204 xRc = HvLpEvent_registerHandler(HvLpEvent_Type_PciIo, 180 ret = HvLpEvent_registerHandler(HvLpEvent_Type_PciIo,
205 &XmPciLpEvent_handler); 181 &pci_event_handler);
206 if (xRc == 0) { 182 if (ret == 0) {
207 xRc = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0); 183 ret = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0);
208 if (xRc != 0) 184 if (ret != 0)
209 printk(KERN_ERR "iSeries_init_IRQ: open event path " 185 printk(KERN_ERR "iseries_init_IRQ: open event path "
210 "failed with rc 0x%x\n", xRc); 186 "failed with rc 0x%x\n", ret);
211 } else 187 } else
212 printk(KERN_ERR "iSeries_init_IRQ: register handler " 188 printk(KERN_ERR "iseries_init_IRQ: register handler "
213 "failed with rc 0x%x\n", xRc); 189 "failed with rc 0x%x\n", ret);
214} 190}
215 191
216#define REAL_IRQ_TO_BUS(irq) ((((irq) >> 6) & 0xff) + 1) 192#define REAL_IRQ_TO_BUS(irq) ((((irq) >> 6) & 0xff) + 1)
@@ -221,40 +197,40 @@ void __init iSeries_init_IRQ(void)
221 * This will be called by device drivers (via enable_IRQ) 197 * This will be called by device drivers (via enable_IRQ)
222 * to enable INTA in the bridge interrupt status register. 198 * to enable INTA in the bridge interrupt status register.
223 */ 199 */
224static void iSeries_enable_IRQ(unsigned int irq) 200static void iseries_enable_IRQ(unsigned int irq)
225{ 201{
226 u32 bus, deviceId, function, mask; 202 u32 bus, dev_id, function, mask;
227 const u32 subBus = 0; 203 const u32 sub_bus = 0;
228 unsigned int rirq = virt_irq_to_real_map[irq]; 204 unsigned int rirq = virt_irq_to_real_map[irq];
229 205
230 /* The IRQ has already been locked by the caller */ 206 /* The IRQ has already been locked by the caller */
231 bus = REAL_IRQ_TO_BUS(rirq); 207 bus = REAL_IRQ_TO_BUS(rirq);
232 function = REAL_IRQ_TO_FUNC(rirq); 208 function = REAL_IRQ_TO_FUNC(rirq);
233 deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; 209 dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
234 210
235 /* Unmask secondary INTA */ 211 /* Unmask secondary INTA */
236 mask = 0x80000000; 212 mask = 0x80000000;
237 HvCallPci_unmaskInterrupts(bus, subBus, deviceId, mask); 213 HvCallPci_unmaskInterrupts(bus, sub_bus, dev_id, mask);
238} 214}
239 215
240/* This is called by iSeries_activate_IRQs */ 216/* This is called by iseries_activate_IRQs */
241static unsigned int iSeries_startup_IRQ(unsigned int irq) 217static unsigned int iseries_startup_IRQ(unsigned int irq)
242{ 218{
243 u32 bus, deviceId, function, mask; 219 u32 bus, dev_id, function, mask;
244 const u32 subBus = 0; 220 const u32 sub_bus = 0;
245 unsigned int rirq = virt_irq_to_real_map[irq]; 221 unsigned int rirq = virt_irq_to_real_map[irq];
246 222
247 bus = REAL_IRQ_TO_BUS(rirq); 223 bus = REAL_IRQ_TO_BUS(rirq);
248 function = REAL_IRQ_TO_FUNC(rirq); 224 function = REAL_IRQ_TO_FUNC(rirq);
249 deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; 225 dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
250 226
251 /* Link the IRQ number to the bridge */ 227 /* Link the IRQ number to the bridge */
252 HvCallXm_connectBusUnit(bus, subBus, deviceId, irq); 228 HvCallXm_connectBusUnit(bus, sub_bus, dev_id, irq);
253 229
254 /* Unmask bridge interrupts in the FISR */ 230 /* Unmask bridge interrupts in the FISR */
255 mask = 0x01010000 << function; 231 mask = 0x01010000 << function;
256 HvCallPci_unmaskFisr(bus, subBus, deviceId, mask); 232 HvCallPci_unmaskFisr(bus, sub_bus, dev_id, mask);
257 iSeries_enable_IRQ(irq); 233 iseries_enable_IRQ(irq);
258 return 0; 234 return 0;
259} 235}
260 236
@@ -279,76 +255,76 @@ void __init iSeries_activate_IRQs()
279} 255}
280 256
281/* this is not called anywhere currently */ 257/* this is not called anywhere currently */
282static void iSeries_shutdown_IRQ(unsigned int irq) 258static void iseries_shutdown_IRQ(unsigned int irq)
283{ 259{
284 u32 bus, deviceId, function, mask; 260 u32 bus, dev_id, function, mask;
285 const u32 subBus = 0; 261 const u32 sub_bus = 0;
286 unsigned int rirq = virt_irq_to_real_map[irq]; 262 unsigned int rirq = virt_irq_to_real_map[irq];
287 263
288 /* irq should be locked by the caller */ 264 /* irq should be locked by the caller */
289 bus = REAL_IRQ_TO_BUS(rirq); 265 bus = REAL_IRQ_TO_BUS(rirq);
290 function = REAL_IRQ_TO_FUNC(rirq); 266 function = REAL_IRQ_TO_FUNC(rirq);
291 deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; 267 dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
292 268
293 /* Invalidate the IRQ number in the bridge */ 269 /* Invalidate the IRQ number in the bridge */
294 HvCallXm_connectBusUnit(bus, subBus, deviceId, 0); 270 HvCallXm_connectBusUnit(bus, sub_bus, dev_id, 0);
295 271
296 /* Mask bridge interrupts in the FISR */ 272 /* Mask bridge interrupts in the FISR */
297 mask = 0x01010000 << function; 273 mask = 0x01010000 << function;
298 HvCallPci_maskFisr(bus, subBus, deviceId, mask); 274 HvCallPci_maskFisr(bus, sub_bus, dev_id, mask);
299} 275}
300 276
301/* 277/*
302 * This will be called by device drivers (via disable_IRQ) 278 * This will be called by device drivers (via disable_IRQ)
303 * to disable INTA in the bridge interrupt status register. 279 * to disable INTA in the bridge interrupt status register.
304 */ 280 */
305static void iSeries_disable_IRQ(unsigned int irq) 281static void iseries_disable_IRQ(unsigned int irq)
306{ 282{
307 u32 bus, deviceId, function, mask; 283 u32 bus, dev_id, function, mask;
308 const u32 subBus = 0; 284 const u32 sub_bus = 0;
309 unsigned int rirq = virt_irq_to_real_map[irq]; 285 unsigned int rirq = virt_irq_to_real_map[irq];
310 286
311 /* The IRQ has already been locked by the caller */ 287 /* The IRQ has already been locked by the caller */
312 bus = REAL_IRQ_TO_BUS(rirq); 288 bus = REAL_IRQ_TO_BUS(rirq);
313 function = REAL_IRQ_TO_FUNC(rirq); 289 function = REAL_IRQ_TO_FUNC(rirq);
314 deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; 290 dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
315 291
316 /* Mask secondary INTA */ 292 /* Mask secondary INTA */
317 mask = 0x80000000; 293 mask = 0x80000000;
318 HvCallPci_maskInterrupts(bus, subBus, deviceId, mask); 294 HvCallPci_maskInterrupts(bus, sub_bus, dev_id, mask);
319} 295}
320 296
321/* 297/*
322 * This does nothing because there is not enough information 298 * This does nothing because there is not enough information
323 * provided to do the EOI HvCall. This is done by XmPciLpEvent.c 299 * provided to do the EOI HvCall. This is done by XmPciLpEvent.c
324 */ 300 */
325static void iSeries_end_IRQ(unsigned int irq) 301static void iseries_end_IRQ(unsigned int irq)
326{ 302{
327} 303}
328 304
329static hw_irq_controller iSeries_IRQ_handler = { 305static hw_irq_controller iSeries_IRQ_handler = {
330 .typename = "iSeries irq controller", 306 .typename = "iSeries irq controller",
331 .startup = iSeries_startup_IRQ, 307 .startup = iseries_startup_IRQ,
332 .shutdown = iSeries_shutdown_IRQ, 308 .shutdown = iseries_shutdown_IRQ,
333 .enable = iSeries_enable_IRQ, 309 .enable = iseries_enable_IRQ,
334 .disable = iSeries_disable_IRQ, 310 .disable = iseries_disable_IRQ,
335 .end = iSeries_end_IRQ 311 .end = iseries_end_IRQ
336}; 312};
337 313
338/* 314/*
339 * This is called out of iSeries_scan_slot to allocate an IRQ for an EADS slot 315 * This is called out of iSeries_scan_slot to allocate an IRQ for an EADS slot
340 * It calculates the irq value for the slot. 316 * It calculates the irq value for the slot.
341 * Note that subBusNumber is always 0 (at the moment at least). 317 * Note that sub_bus_number is always 0 (at the moment at least).
342 */ 318 */
343int __init iSeries_allocate_IRQ(HvBusNumber busNumber, 319int __init iSeries_allocate_IRQ(HvBusNumber bus_number,
344 HvSubBusNumber subBusNumber, HvAgentId deviceId) 320 HvSubBusNumber sub_bus_number, HvAgentId dev_id)
345{ 321{
346 int virtirq; 322 int virtirq;
347 unsigned int realirq; 323 unsigned int realirq;
348 u8 idsel = (deviceId >> 4); 324 u8 idsel = (dev_id >> 4);
349 u8 function = deviceId & 7; 325 u8 function = dev_id & 7;
350 326
351 realirq = ((busNumber - 1) << 6) + ((idsel - 1) << 3) + function; 327 realirq = ((bus_number - 1) << 6) + ((idsel - 1) << 3) + function;
352 virtirq = virt_irq_create_mapping(realirq); 328 virtirq = virt_irq_create_mapping(realirq);
353 329
354 irq_desc[virtirq].handler = &iSeries_IRQ_handler; 330 irq_desc[virtirq].handler = &iSeries_IRQ_handler;