comparison rathaxes_e1000_move_the_interrupt_init_and_cleanup_into_ethernet.patch @ 108:7efe3212db3a

Put the patches on e1000 above the patches on the compiler
author Louis Opter <louis@lse.epita.fr>
date Sun, 31 Mar 2013 20:00:09 -0700
parents f42751b8ca99
children
comparison
equal deleted inserted replaced
107:f42751b8ca99 108:7efe3212db3a
1 # HG changeset patch 1 # HG changeset patch
2 # Parent a611642de7f291e4749a7f44027f9ebaa0cde75c 2 # Parent 7be52c02870a053b3a12e75423226c252e256c6b
3 Move the interrupt handler init/cleanup out of e1000.blt 3 Move the interrupt handler init/cleanup out of e1000.blt
4 4
5 This is not device dependant and can be done from the Ethernet subsystem 5 This is not device dependant and can be done from the Ethernet subsystem
6 right now, (plus the interrupt handler itself was already in the 6 right now, (plus the interrupt handler itself was already in the
7 Ethernet subsytem). 7 Ethernet subsytem).
8 8
9 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt 9 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt
10 --- a/rathaxes/samples/e1000/e1000.blt 10 --- a/rathaxes/samples/e1000/e1000.blt
11 +++ b/rathaxes/samples/e1000/e1000.blt 11 +++ b/rathaxes/samples/e1000/e1000.blt
12 @@ -249,7 +249,6 @@ 12 @@ -247,7 +247,6 @@
13 { 13 {
14 int bars; 14 int bars;
15 unsigned char /* __iomem */ *ioaddr; 15 unsigned char /* __iomem */ *ioaddr;
16 - int irq; 16 - int irq;
17 17
18 ${e1000::RxRing} rx_ring; 18 ${e1000::RxRing} rx_ring;
19 ${e1000::TxRing} tx_ring; 19 ${e1000::TxRing} tx_ring;
20 @@ -267,14 +266,12 @@ 20 @@ -265,14 +264,12 @@
21 21
22 chunk Ethernet::adapter_init_context(Ethernet::Device rtx_ether_ctx, 22 chunk Ethernet::adapter_init_context(Ethernet::Device rtx_ether_ctx,
23 Builtin::number bars, 23 Builtin::number bars,
24 - Builtin::symbol ioaddr, 24 - Builtin::symbol ioaddr,
25 - Builtin::number irq) 25 - Builtin::number irq)
26 + Builtin::symbol ioaddr) 26 + Builtin::symbol ioaddr)
27 { 27 {
28 { 28 {
29 ${e1000::Context} *hw_ctx = &${rtx_ether_ctx}->hw_ctx; 29 ${e1000::Context.ref} hw_ctx = &${rtx_ether_ctx}->hw_ctx;
30 hw_ctx->bars = ${bars}; 30 hw_ctx->bars = ${bars};
31 hw_ctx->ioaddr = ${ioaddr}; 31 hw_ctx->ioaddr = ${ioaddr};
32 - hw_ctx->irq = ${irq}; 32 - hw_ctx->irq = ${irq};
33 } 33 }
34 } 34 }
35 35
36 @@ -606,68 +603,6 @@ 36 @@ -605,68 +602,6 @@
37 } 37 }
38 } 38 }
39 39
40 - template sequence e1000::setup_interrupt_handler(Ethernet::Device rtx_ether_ctx) 40 - template sequence e1000::setup_interrupt_handler(Ethernet::Device rtx_ether_ctx)
41 - { 41 - {
173 + } 173 + }
174 + 174 +
175 chunk LKM::prototypes() 175 chunk LKM::prototypes()
176 { 176 {
177 static int rtx_ethernet_open(struct net_device *); 177 static int rtx_ethernet_open(struct net_device *);
178 @@ -123,9 +131,28 @@ 178 @@ -122,6 +130,20 @@
179 ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev); 179 {
180 180 ${Ethernet::Device.ref} rtx_ether_ctx = netdev_priv(dev);
181 ${cast local.rtx_ether_ctx as Ethernet::Device}; 181
182 +
183 + int error; 182 + int error;
184 + { 183 + {
185 + ${Log::info("installing the interrupt handler")}; 184 + ${Log::info("installing the interrupt handler")};
186 + } 185 + }
187 + error = request_irq(${local.rtx_ether_ctx.irq}, 186 + error = request_irq(${local.rtx_ether_ctx.irq},
190 + ${config.name}, 189 + ${config.name},
191 + dev); 190 + dev);
192 + if (error) 191 + if (error)
193 + { 192 + {
194 + ${Log::info("Cannot register the interrupt handler")}; 193 + ${Log::info("Cannot register the interrupt handler")};
195 + goto error; 194 + return error;
196 + } 195 + }
197 +
198 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; 196 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
199 197
200 return 0; 198 return 0;
201 + 199 @@ -161,7 +183,15 @@
202 + error: 200 {
203 + return error; 201 ${Ethernet::Device.ref} rtx_ether_ctx = netdev_priv(dev);
204 } 202
205 }
206 }
207 @@ -165,7 +192,16 @@
208 ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev);
209
210 ${cast local.rtx_ether_ctx as Ethernet::Device};
211 - ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; 203 - ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
212 +
213 + /* TODO: change this pointcut into a pointcut/adapter/callback: */ 204 + /* TODO: change this pointcut into a pointcut/adapter/callback: */
214 + { 205 + {
215 + ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; 206 + ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
216 + } 207 + }
217 + 208 +
220 + ${Log::info("interrupt handler free'ed")}; 211 + ${Log::info("interrupt handler free'ed")};
221 + } 212 + }
222 213
223 return 0; 214 return 0;
224 } 215 }
225 @@ -187,9 +223,12 @@ 216 @@ -183,7 +213,9 @@
226 { 217 {
227 static enum irqreturn rtx_ethernet_interrupt_handler(int irq, void *dev_id) 218 static enum irqreturn rtx_ethernet_interrupt_handler(int irq, void *dev_id)
228 { 219 {
229 - ${Ethernet::Device} *rtx_ether_ctx = dev_id; 220 - ${Ethernet::Device.ref} rtx_ether_ctx = dev_id;
230 + ${Ethernet::AbstractDevice} *rtx_net_dev = dev_id; 221 + ${Ethernet::AbstractDevice.ref} rtx_net_dev = dev_id;
231 + ${cast local.rtx_net_dev as Ethernet::AbstractDevice}; 222 + ${Ethernet::Device.ref} rtx_ether_ctx;
232 + ${Ethernet::Device} *rtx_ether_ctx;
233 + ${cast local.rtx_ether_ctx as Ethernet::Device};
234 + rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx}; 223 + rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx};
235 224
236 - ${cast local.rtx_ether_ctx as Ethernet::Device};
237 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; 225 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
238 226
239 return IRQ_NONE; 227 @@ -260,13 +292,10 @@
240 @@ -267,14 +306,11 @@
241 */ 228 */
242 int bars = ${rtx_pci_dev.bars}; 229 int bars = ${rtx_pci_dev.bars};
243 unsigned char /* __iomem */ *ioaddr = ${rtx_pci_dev.ioaddr}; 230 unsigned char /* __iomem */ *ioaddr = ${rtx_pci_dev.ioaddr};
244 - int irq = ${rtx_pci_dev.irq}; 231 - int irq = ${rtx_pci_dev.irq};
245 ${cast local.bars as Builtin::number}; 232 ${cast local.bars as Builtin::number};
246 - ${cast local.irq as Builtin::number}; 233 - ${cast local.irq as Builtin::number};
247 ${cast local.rtx_ether_ctx as Ethernet::Device};
248 ${pointcut Ethernet::adapter_init_context(local.rtx_ether_ctx, 234 ${pointcut Ethernet::adapter_init_context(local.rtx_ether_ctx,
249 local.bars, 235 local.bars,
250 - local.ioaddr, 236 - local.ioaddr,
251 - local.irq)}; 237 - local.irq)};
252 + local.ioaddr)}; 238 + local.ioaddr)};
262 attribute Builtin::symbol.scalar netdev; 248 attribute Builtin::symbol.scalar netdev;
263 + /* 249 + /*
264 + * XXX: should be a Ethernet::Device, but that causes a circular 250 + * XXX: should be a Ethernet::Device, but that causes a circular
265 + * dependency: 251 + * dependency:
266 + */ 252 + */
267 + attribute Builtin::symbol rtx_ether_ctx; 253 + attribute Builtin::symbol.scalar rtx_ether_ctx;
268 } 254 }
269 255
270 provided type Device 256 provided type Device
271 @@ -36,10 +41,12 @@ 257 @@ -34,12 +39,14 @@
258 * I'd like to use better names here, but I'd like to understand the
259 * difference between the two first:
272 */ 260 */
273 attribute Builtin::symbol.scalar perm_addr; 261 - attribute Builtin::symbol.ref perm_addr;
274 attribute Builtin::symbol.scalar dev_addr; 262 - attribute Builtin::symbol.ref dev_addr;
275 + attribute Builtin::symbol.scalar irq; 263 + attribute Builtin::symbol.ref perm_addr;
264 + attribute Builtin::symbol.ref dev_addr;
265 + attribute Builtin::symbol.scalar irq;
276 } 266 }
277 267
278 required sequence open(Ethernet::Device) 268 required sequence open(Ethernet::Device)
279 { 269 {
280 + provided chunk LKM::includes(); 270 + provided chunk LKM::includes();