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/ppc64/kernel/iSeries_irq.c | |
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/ppc64/kernel/iSeries_irq.c')
-rw-r--r-- | arch/ppc64/kernel/iSeries_irq.c | 155 |
1 files changed, 74 insertions, 81 deletions
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 | } | ||