diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2005-06-21 20:15:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-21 21:46:30 -0400 |
commit | 0c3b4f1a8e06584d8a1051a74ed79cf8b41f703e (patch) | |
tree | 6eaa6c372ce896649a6dcbdb66f1b58cda0fa931 /arch | |
parent | 061c063efce96b33f9e26d5f83a8eb0643fa493c (diff) |
[PATCH] ppc64 iSeries: irq simple cleanups
This patch is just simple cleanups to the iSeries irq code.
- whitespace and comments
- rearrange some functions to avoid forward declarations
- remove XmPciLpEvent.h as its functions were declared elsewhere
- remove decaration of function that no longer exists
No semantic changes.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ppc64/kernel/XmPciLpEvent.c | 105 | ||||
-rw-r--r-- | arch/ppc64/kernel/iSeries_irq.c | 155 |
2 files changed, 123 insertions, 137 deletions
diff --git a/arch/ppc64/kernel/XmPciLpEvent.c b/arch/ppc64/kernel/XmPciLpEvent.c index 809c9bc6678b..3db530744831 100644 --- a/arch/ppc64/kernel/XmPciLpEvent.c +++ b/arch/ppc64/kernel/XmPciLpEvent.c | |||
@@ -1,9 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * File XmPciLpEvent.h created by Wayne Holm on Mon Jan 15 2001. | 2 | * File XmPciLpEvent.c created by Wayne Holm on Mon Jan 15 2001. |
3 | * | 3 | * |
4 | * This module handles PCI interrupt events sent by the iSeries Hypervisor. | 4 | * This module handles PCI interrupt events sent by the iSeries Hypervisor. |
5 | */ | 5 | */ |
6 | |||
7 | #include <linux/config.h> | 6 | #include <linux/config.h> |
8 | #include <linux/pci.h> | 7 | #include <linux/pci.h> |
9 | #include <linux/init.h> | 8 | #include <linux/init.h> |
@@ -17,22 +16,22 @@ | |||
17 | #include <asm/iSeries/HvTypes.h> | 16 | #include <asm/iSeries/HvTypes.h> |
18 | #include <asm/iSeries/HvLpEvent.h> | 17 | #include <asm/iSeries/HvLpEvent.h> |
19 | #include <asm/iSeries/HvCallPci.h> | 18 | #include <asm/iSeries/HvCallPci.h> |
20 | #include <asm/iSeries/XmPciLpEvent.h> | 19 | #include <asm/iSeries/iSeries_irq.h> |
21 | #include <asm/ppcdebug.h> | 20 | #include <asm/ppcdebug.h> |
22 | 21 | ||
23 | static long Pci_Interrupt_Count; | 22 | static long Pci_Interrupt_Count; |
24 | static long Pci_Event_Count; | 23 | static long Pci_Event_Count; |
25 | 24 | ||
26 | enum XmPciLpEvent_Subtype { | 25 | enum XmPciLpEvent_Subtype { |
27 | XmPciLpEvent_BusCreated = 0, // PHB has been created | 26 | XmPciLpEvent_BusCreated = 0, // PHB has been created |
28 | XmPciLpEvent_BusError = 1, // PHB has failed | 27 | XmPciLpEvent_BusError = 1, // PHB has failed |
29 | XmPciLpEvent_BusFailed = 2, // Msg to Secondary, Primary failed bus | 28 | XmPciLpEvent_BusFailed = 2, // Msg to Secondary, Primary failed bus |
30 | XmPciLpEvent_NodeFailed = 4, // Multi-adapter bridge has failed | 29 | XmPciLpEvent_NodeFailed = 4, // Multi-adapter bridge has failed |
31 | XmPciLpEvent_NodeRecovered = 5, // Multi-adapter bridge has recovered | 30 | XmPciLpEvent_NodeRecovered = 5, // Multi-adapter bridge has recovered |
32 | XmPciLpEvent_BusRecovered = 12, // PHB has been recovered | 31 | XmPciLpEvent_BusRecovered = 12, // PHB has been recovered |
33 | XmPciLpEvent_UnQuiesceBus = 18, // Secondary bus unqiescing | 32 | XmPciLpEvent_UnQuiesceBus = 18, // Secondary bus unqiescing |
34 | XmPciLpEvent_BridgeError = 21, // Bridge Error | 33 | XmPciLpEvent_BridgeError = 21, // Bridge Error |
35 | XmPciLpEvent_SlotInterrupt = 22 // Slot interrupt | 34 | XmPciLpEvent_SlotInterrupt = 22 // Slot interrupt |
36 | }; | 35 | }; |
37 | 36 | ||
38 | struct XmPciLpEvent_BusInterrupt { | 37 | struct XmPciLpEvent_BusInterrupt { |
@@ -71,43 +70,6 @@ struct XmPciLpEvent { | |||
71 | }; | 70 | }; |
72 | 71 | ||
73 | static void intReceived(struct XmPciLpEvent *eventParm, | 72 | static void intReceived(struct XmPciLpEvent *eventParm, |
74 | struct pt_regs *regsParm); | ||
75 | |||
76 | static void XmPciLpEvent_handler(struct HvLpEvent *eventParm, | ||
77 | struct pt_regs *regsParm) | ||
78 | { | ||
79 | #ifdef CONFIG_PCI | ||
80 | #if 0 | ||
81 | PPCDBG(PPCDBG_BUSWALK, "XmPciLpEvent_handler, type 0x%x\n", | ||
82 | eventParm->xType); | ||
83 | #endif | ||
84 | ++Pci_Event_Count; | ||
85 | |||
86 | if (eventParm && (eventParm->xType == HvLpEvent_Type_PciIo)) { | ||
87 | switch (eventParm->xFlags.xFunction) { | ||
88 | case HvLpEvent_Function_Int: | ||
89 | intReceived((struct XmPciLpEvent *)eventParm, regsParm); | ||
90 | break; | ||
91 | case HvLpEvent_Function_Ack: | ||
92 | printk(KERN_ERR | ||
93 | "XmPciLpEvent.c: unexpected ack received\n"); | ||
94 | break; | ||
95 | default: | ||
96 | printk(KERN_ERR | ||
97 | "XmPciLpEvent.c: unexpected event function %d\n", | ||
98 | (int)eventParm->xFlags.xFunction); | ||
99 | break; | ||
100 | } | ||
101 | } else if (eventParm) | ||
102 | printk(KERN_ERR | ||
103 | "XmPciLpEvent.c: Unrecognized PCI event type 0x%x\n", | ||
104 | (int)eventParm->xType); | ||
105 | else | ||
106 | printk(KERN_ERR "XmPciLpEvent.c: NULL event received\n"); | ||
107 | #endif | ||
108 | } | ||
109 | |||
110 | static void intReceived(struct XmPciLpEvent *eventParm, | ||
111 | struct pt_regs *regsParm) | 73 | struct pt_regs *regsParm) |
112 | { | 74 | { |
113 | int irq; | 75 | int irq; |
@@ -164,6 +126,39 @@ static void intReceived(struct XmPciLpEvent *eventParm, | |||
164 | } | 126 | } |
165 | } | 127 | } |
166 | 128 | ||
129 | static void XmPciLpEvent_handler(struct HvLpEvent *eventParm, | ||
130 | struct pt_regs *regsParm) | ||
131 | { | ||
132 | #ifdef CONFIG_PCI | ||
133 | #if 0 | ||
134 | PPCDBG(PPCDBG_BUSWALK, "XmPciLpEvent_handler, type 0x%x\n", | ||
135 | eventParm->xType); | ||
136 | #endif | ||
137 | ++Pci_Event_Count; | ||
138 | |||
139 | if (eventParm && (eventParm->xType == HvLpEvent_Type_PciIo)) { | ||
140 | switch (eventParm->xFlags.xFunction) { | ||
141 | case HvLpEvent_Function_Int: | ||
142 | intReceived((struct XmPciLpEvent *)eventParm, regsParm); | ||
143 | break; | ||
144 | case HvLpEvent_Function_Ack: | ||
145 | printk(KERN_ERR | ||
146 | "XmPciLpEvent.c: unexpected ack received\n"); | ||
147 | break; | ||
148 | default: | ||
149 | printk(KERN_ERR | ||
150 | "XmPciLpEvent.c: unexpected event function %d\n", | ||
151 | (int)eventParm->xFlags.xFunction); | ||
152 | break; | ||
153 | } | ||
154 | } else if (eventParm) | ||
155 | printk(KERN_ERR | ||
156 | "XmPciLpEvent.c: Unrecognized PCI event type 0x%x\n", | ||
157 | (int)eventParm->xType); | ||
158 | else | ||
159 | printk(KERN_ERR "XmPciLpEvent.c: NULL event received\n"); | ||
160 | #endif | ||
161 | } | ||
167 | 162 | ||
168 | /* This should be called sometime prior to buswalk (init_IRQ would be good) */ | 163 | /* This should be called sometime prior to buswalk (init_IRQ would be good) */ |
169 | int XmPciLpEvent_init() | 164 | int XmPciLpEvent_init() |
@@ -179,12 +174,10 @@ int XmPciLpEvent_init() | |||
179 | if (xRc == 0) { | 174 | if (xRc == 0) { |
180 | xRc = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0); | 175 | xRc = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0); |
181 | if (xRc != 0) | 176 | if (xRc != 0) |
182 | printk(KERN_ERR | 177 | printk(KERN_ERR "XmPciLpEvent.c: open event path " |
183 | "XmPciLpEvent.c: open event path failed with rc 0x%x\n", | 178 | "failed with rc 0x%x\n", xRc); |
184 | xRc); | ||
185 | } else | 179 | } else |
186 | printk(KERN_ERR | 180 | printk(KERN_ERR "XmPciLpEvent.c: register handler " |
187 | "XmPciLpEvent.c: register handler failed with rc 0x%x\n", | 181 | "failed with rc 0x%x\n", xRc); |
188 | xRc); | ||
189 | return xRc; | 182 | return xRc; |
190 | } | 183 | } |
diff --git a/arch/ppc64/kernel/iSeries_irq.c b/arch/ppc64/kernel/iSeries_irq.c index f831d259dbb7..41902e358e76 100644 --- a/arch/ppc64/kernel/iSeries_irq.c +++ b/arch/ppc64/kernel/iSeries_irq.c | |||
@@ -1,27 +1,27 @@ | |||
1 | /************************************************************************/ | 1 | /* |
2 | /* This module supports the iSeries PCI bus interrupt handling */ | 2 | * This module supports the iSeries PCI bus interrupt handling |
3 | /* Copyright (C) 20yy <Robert L Holtorf> <IBM Corp> */ | 3 | * Copyright (C) 20yy <Robert L Holtorf> <IBM Corp> |
4 | /* */ | 4 | * |
5 | /* This program is free software; you can redistribute it and/or modify */ | 5 | * This program is free software; you can redistribute it and/or modify |
6 | /* it under the terms of the GNU General Public License as published by */ | 6 | * it under the terms of the GNU General Public License as published by |
7 | /* the Free Software Foundation; either version 2 of the License, or */ | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | /* (at your option) any later version. */ | 8 | * (at your option) any later version. |
9 | /* */ | 9 | * |
10 | /* This program is distributed in the hope that it will be useful, */ | 10 | * This program is distributed in the hope that it will be useful, |
11 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | /* GNU General Public License for more details. */ | 13 | * GNU General Public License for more details. |
14 | /* */ | 14 | * |
15 | /* You should have received a copy of the GNU General Public License */ | 15 | * You should have received a copy of the GNU General Public License |
16 | /* along with this program; if not, write to the: */ | 16 | * along with this program; if not, write to the: |
17 | /* Free Software Foundation, Inc., */ | 17 | * Free Software Foundation, Inc., |
18 | /* 59 Temple Place, Suite 330, */ | 18 | * 59 Temple Place, Suite 330, |
19 | /* Boston, MA 02111-1307 USA */ | 19 | * Boston, MA 02111-1307 USA |
20 | /************************************************************************/ | 20 | * |
21 | /* Change Activity: */ | 21 | * Change Activity: |
22 | /* Created, December 13, 2000 by Wayne Holm */ | 22 | * Created, December 13, 2000 by Wayne Holm |
23 | /* End Change Activity */ | 23 | * End Change Activity |
24 | /************************************************************************/ | 24 | */ |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/threads.h> | 27 | #include <linux/threads.h> |
@@ -38,22 +38,6 @@ | |||
38 | #include <asm/iSeries/HvCallPci.h> | 38 | #include <asm/iSeries/HvCallPci.h> |
39 | #include <asm/iSeries/HvCallXm.h> | 39 | #include <asm/iSeries/HvCallXm.h> |
40 | #include <asm/iSeries/iSeries_irq.h> | 40 | #include <asm/iSeries/iSeries_irq.h> |
41 | #include <asm/iSeries/XmPciLpEvent.h> | ||
42 | |||
43 | static unsigned int iSeries_startup_IRQ(unsigned int irq); | ||
44 | static void iSeries_shutdown_IRQ(unsigned int irq); | ||
45 | static void iSeries_enable_IRQ(unsigned int irq); | ||
46 | static void iSeries_disable_IRQ(unsigned int irq); | ||
47 | static void iSeries_end_IRQ(unsigned int irq); | ||
48 | |||
49 | static hw_irq_controller iSeries_IRQ_handler = { | ||
50 | .typename = "iSeries irq controller", | ||
51 | .startup = iSeries_startup_IRQ, | ||
52 | .shutdown = iSeries_shutdown_IRQ, | ||
53 | .enable = iSeries_enable_IRQ, | ||
54 | .disable = iSeries_disable_IRQ, | ||
55 | .end = iSeries_end_IRQ | ||
56 | }; | ||
57 | 41 | ||
58 | /* This maps virtual irq numbers to real irqs */ | 42 | /* This maps virtual irq numbers to real irqs */ |
59 | unsigned int virt_irq_to_real_map[NR_IRQS]; | 43 | unsigned int virt_irq_to_real_map[NR_IRQS]; |
@@ -69,30 +53,32 @@ void __init iSeries_init_IRQ(void) | |||
69 | XmPciLpEvent_init(); | 53 | XmPciLpEvent_init(); |
70 | } | 54 | } |
71 | 55 | ||
56 | #define REAL_IRQ_TO_BUS(irq) ((((irq) >> 6) & 0xff) + 1) | ||
57 | #define REAL_IRQ_TO_IDSEL(irq) ((((irq) >> 3) & 7) + 1) | ||
58 | #define REAL_IRQ_TO_FUNC(irq) ((irq) & 7) | ||
59 | |||
72 | /* | 60 | /* |
73 | * This is called out of iSeries_scan_slot to allocate an IRQ for an EADS slot | 61 | * This will be called by device drivers (via enable_IRQ) |
74 | * It calculates the irq value for the slot. | 62 | * to enable INTA in the bridge interrupt status register. |
75 | * Note that subBusNumber is always 0 (at the moment at least). | ||
76 | */ | 63 | */ |
77 | int __init iSeries_allocate_IRQ(HvBusNumber busNumber, | 64 | static void iSeries_enable_IRQ(unsigned int irq) |
78 | HvSubBusNumber subBusNumber, HvAgentId deviceId) | ||
79 | { | 65 | { |
80 | unsigned int realirq, virtirq; | 66 | u32 bus, deviceId, function, mask; |
81 | u8 idsel = (deviceId >> 4); | 67 | const u32 subBus = 0; |
82 | u8 function = deviceId & 7; | 68 | unsigned int rirq = virt_irq_to_real_map[irq]; |
83 | 69 | ||
84 | virtirq = next_virtual_irq++; | 70 | /* The IRQ has already been locked by the caller */ |
85 | realirq = ((busNumber - 1) << 6) + ((idsel - 1) << 3) + function; | 71 | bus = REAL_IRQ_TO_BUS(rirq); |
86 | virt_irq_to_real_map[virtirq] = realirq; | 72 | function = REAL_IRQ_TO_FUNC(rirq); |
73 | deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; | ||
87 | 74 | ||
88 | irq_desc[virtirq].handler = &iSeries_IRQ_handler; | 75 | /* Unmask secondary INTA */ |
89 | return virtirq; | 76 | mask = 0x80000000; |
77 | HvCallPci_unmaskInterrupts(bus, subBus, deviceId, mask); | ||
78 | PPCDBG(PPCDBG_BUSWALK, "iSeries_enable_IRQ 0x%02X.%02X.%02X 0x%04X\n", | ||
79 | bus, subBus, deviceId, irq); | ||
90 | } | 80 | } |
91 | 81 | ||
92 | #define REAL_IRQ_TO_BUS(irq) ((((irq) >> 6) & 0xff) + 1) | ||
93 | #define REAL_IRQ_TO_IDSEL(irq) ((((irq) >> 3) & 7) + 1) | ||
94 | #define REAL_IRQ_TO_FUNC(irq) ((irq) & 7) | ||
95 | |||
96 | /* This is called by iSeries_activate_IRQs */ | 82 | /* This is called by iSeries_activate_IRQs */ |
97 | static unsigned int iSeries_startup_IRQ(unsigned int irq) | 83 | static unsigned int iSeries_startup_IRQ(unsigned int irq) |
98 | { | 84 | { |
@@ -131,7 +117,7 @@ void __init iSeries_activate_IRQs() | |||
131 | desc->handler->startup(irq); | 117 | desc->handler->startup(irq); |
132 | spin_unlock_irqrestore(&desc->lock, flags); | 118 | spin_unlock_irqrestore(&desc->lock, flags); |
133 | } | 119 | } |
134 | } | 120 | } |
135 | } | 121 | } |
136 | 122 | ||
137 | /* this is not called anywhere currently */ | 123 | /* this is not called anywhere currently */ |
@@ -173,29 +159,7 @@ static void iSeries_disable_IRQ(unsigned int irq) | |||
173 | mask = 0x80000000; | 159 | mask = 0x80000000; |
174 | HvCallPci_maskInterrupts(bus, subBus, deviceId, mask); | 160 | HvCallPci_maskInterrupts(bus, subBus, deviceId, mask); |
175 | PPCDBG(PPCDBG_BUSWALK, "iSeries_disable_IRQ 0x%02X.%02X.%02X 0x%04X\n", | 161 | PPCDBG(PPCDBG_BUSWALK, "iSeries_disable_IRQ 0x%02X.%02X.%02X 0x%04X\n", |
176 | bus, subBus, deviceId, irq); | 162 | bus, subBus, deviceId, irq); |
177 | } | ||
178 | |||
179 | /* | ||
180 | * This will be called by device drivers (via enable_IRQ) | ||
181 | * to enable INTA in the bridge interrupt status register. | ||
182 | */ | ||
183 | static void iSeries_enable_IRQ(unsigned int irq) | ||
184 | { | ||
185 | u32 bus, deviceId, function, mask; | ||
186 | const u32 subBus = 0; | ||
187 | unsigned int rirq = virt_irq_to_real_map[irq]; | ||
188 | |||
189 | /* The IRQ has already been locked by the caller */ | ||
190 | bus = REAL_IRQ_TO_BUS(rirq); | ||
191 | function = REAL_IRQ_TO_FUNC(rirq); | ||
192 | deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; | ||
193 | |||
194 | /* Unmask secondary INTA */ | ||
195 | mask = 0x80000000; | ||
196 | HvCallPci_unmaskInterrupts(bus, subBus, deviceId, mask); | ||
197 | PPCDBG(PPCDBG_BUSWALK, "iSeries_enable_IRQ 0x%02X.%02X.%02X 0x%04X\n", | ||
198 | bus, subBus, deviceId, irq); | ||
199 | } | 163 | } |
200 | 164 | ||
201 | /* | 165 | /* |
@@ -207,3 +171,32 @@ static void iSeries_enable_IRQ(unsigned int irq) | |||
207 | static void iSeries_end_IRQ(unsigned int irq) | 171 | static void iSeries_end_IRQ(unsigned int irq) |
208 | { | 172 | { |
209 | } | 173 | } |
174 | |||
175 | static hw_irq_controller iSeries_IRQ_handler = { | ||
176 | .typename = "iSeries irq controller", | ||
177 | .startup = iSeries_startup_IRQ, | ||
178 | .shutdown = iSeries_shutdown_IRQ, | ||
179 | .enable = iSeries_enable_IRQ, | ||
180 | .disable = iSeries_disable_IRQ, | ||
181 | .end = iSeries_end_IRQ | ||
182 | }; | ||
183 | |||
184 | /* | ||
185 | * This is called out of iSeries_scan_slot to allocate an IRQ for an EADS slot | ||
186 | * It calculates the irq value for the slot. | ||
187 | * Note that subBusNumber is always 0 (at the moment at least). | ||
188 | */ | ||
189 | int __init iSeries_allocate_IRQ(HvBusNumber busNumber, | ||
190 | HvSubBusNumber subBusNumber, HvAgentId deviceId) | ||
191 | { | ||
192 | unsigned int realirq, virtirq; | ||
193 | u8 idsel = (deviceId >> 4); | ||
194 | u8 function = deviceId & 7; | ||
195 | |||
196 | virtirq = next_virtual_irq++; | ||
197 | realirq = ((busNumber - 1) << 6) + ((idsel - 1) << 3) + function; | ||
198 | virt_irq_to_real_map[virtirq] = realirq; | ||
199 | |||
200 | irq_desc[virtirq].handler = &iSeries_IRQ_handler; | ||
201 | return virtirq; | ||
202 | } | ||