Mercurial > archived > louis > epitech > mq > rathaxes
comparison rathaxes_e1000_move_the_interrupt_init_and_cleanup_into_ethernet.patch @ 105:fb20f01ea997
Wip, note: the interrupt handler refactoring patch is broken, I have to find the fix from the abstract type notation patch
author | Louis Opter <louis@lse.epita.fr> |
---|---|
date | Fri, 22 Mar 2013 00:25:52 -0700 |
parents | c4c33ac02b93 |
children | 976a4b87803f |
comparison
equal
deleted
inserted
replaced
104:c4c33ac02b93 | 105:fb20f01ea997 |
---|---|
1 # HG changeset patch | 1 # HG changeset patch |
2 # Parent 68c4f142af579e558314cdeebd091fc5abd62014 | 2 # Parent 1e9f01563db8cac05d81f26c5e100d9629b67f1e |
3 Move the interrupt handler init/cleanup out of e1000.blt | |
4 | |
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 | |
7 Ethernet subsytem). | |
3 | 8 |
4 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 |
5 --- a/rathaxes/samples/e1000/e1000.blt | 10 --- a/rathaxes/samples/e1000/e1000.blt |
6 +++ b/rathaxes/samples/e1000/e1000.blt | 11 +++ b/rathaxes/samples/e1000/e1000.blt |
7 @@ -249,7 +249,6 @@ | 12 @@ -249,7 +249,6 @@ |
139 -with Ethernet, PCI, LKM, Log | 144 -with Ethernet, PCI, LKM, Log |
140 +with Ethernet, PCI, LKM, Log, Builtin | 145 +with Ethernet, PCI, LKM, Log, Builtin |
141 { | 146 { |
142 template type Ethernet::ProtocolId() | 147 template type Ethernet::ProtocolId() |
143 { | 148 { |
144 @@ -111,6 +111,11 @@ | 149 @@ -106,11 +106,17 @@ |
150 net_device: ${self}->net_dev; | |
151 perm_addr: ${self}->net_dev->ndev.perm_addr; | |
152 dev_addr: ${self}->net_dev->ndev.dev_addr; | |
153 + irq: ${self}->pci_dev->data.irq; | |
154 } | |
155 } | |
145 | 156 |
146 template sequence Ethernet::open(Ethernet::Device dev) | 157 template sequence Ethernet::open(Ethernet::Device dev) |
147 { | 158 { |
148 + chunk LKM::includes() | 159 + chunk LKM::includes() |
149 + { | 160 + { |
151 + } | 162 + } |
152 + | 163 + |
153 chunk LKM::prototypes() | 164 chunk LKM::prototypes() |
154 { | 165 { |
155 static int rtx_ethernet_open(struct net_device *); | 166 static int rtx_ethernet_open(struct net_device *); |
156 @@ -123,9 +128,28 @@ | 167 @@ -123,9 +129,28 @@ |
157 ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev); | 168 ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev); |
158 | 169 |
159 ${cast local.rtx_ether_ctx as Ethernet::Device}; | 170 ${cast local.rtx_ether_ctx as Ethernet::Device}; |
160 + | 171 + |
161 + int error; | 172 + int error; |
164 + } | 175 + } |
165 + error = request_irq(${local.rtx_ether_ctx.irq}, | 176 + error = request_irq(${local.rtx_ether_ctx.irq}, |
166 + rtx_ethernet_interrupt_handler, | 177 + rtx_ethernet_interrupt_handler, |
167 + IRQF_SHARED, | 178 + IRQF_SHARED, |
168 + ${config.name}, | 179 + ${config.name}, |
169 + ${local.rtx_net_dev.k_net_dev}); | 180 + dev); |
170 + if (error) | 181 + if (error) |
171 + { | 182 + { |
172 + ${Log::info("Cannot register the interrupt handler")}; | 183 + ${Log::info("Cannot register the interrupt handler")}; |
173 + goto error; | 184 + goto error; |
174 + } | 185 + } |
180 + error: | 191 + error: |
181 + return error; | 192 + return error; |
182 } | 193 } |
183 } | 194 } |
184 } | 195 } |
185 @@ -165,7 +189,16 @@ | 196 @@ -165,7 +190,16 @@ |
186 ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev); | 197 ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev); |
187 | 198 |
188 ${cast local.rtx_ether_ctx as Ethernet::Device}; | 199 ${cast local.rtx_ether_ctx as Ethernet::Device}; |
189 - ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; | 200 - ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; |
190 + | 201 + |
191 + /* TODO: change this pointcut into a pointcut/adapter/callback: */ | 202 + /* TODO: change this pointcut into a pointcut/adapter/callback: */ |
192 + { | 203 + { |
193 + ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; | 204 + ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; |
194 + } | 205 + } |
195 + | 206 + |
196 + free_irq(${local.rtx_ether_ctx.irq}, ${local.rtx_net_dev.k_net_dev}); | 207 + free_irq(${local.rtx_ether_ctx.irq}, dev); |
197 + { | 208 + { |
198 + ${Log::info("interrupt handler free'ed")}; | 209 + ${Log::info("interrupt handler free'ed")}; |
199 + } | 210 + } |
200 | 211 |
201 return 0; | 212 return 0; |
202 } | 213 } |
203 @@ -267,14 +300,11 @@ | 214 @@ -267,14 +301,11 @@ |
204 */ | 215 */ |
205 int bars = ${rtx_pci_dev.bars}; | 216 int bars = ${rtx_pci_dev.bars}; |
206 unsigned char /* __iomem */ *ioaddr = ${rtx_pci_dev.ioaddr}; | 217 unsigned char /* __iomem */ *ioaddr = ${rtx_pci_dev.ioaddr}; |
207 - int irq = ${rtx_pci_dev.irq}; | 218 - int irq = ${rtx_pci_dev.irq}; |
208 ${cast local.bars as Builtin::number}; | 219 ${cast local.bars as Builtin::number}; |
217 ${pointcut Ethernet::adapter_load_mac_address(local.rtx_ether_ctx)}; | 228 ${pointcut Ethernet::adapter_load_mac_address(local.rtx_ether_ctx)}; |
218 memcpy(${local.rtx_ether_ctx.perm_addr}, | 229 memcpy(${local.rtx_ether_ctx.perm_addr}, |
219 diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti | 230 diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti |
220 --- a/rathaxes/samples/e1000/ethernet.rti | 231 --- a/rathaxes/samples/e1000/ethernet.rti |
221 +++ b/rathaxes/samples/e1000/ethernet.rti | 232 +++ b/rathaxes/samples/e1000/ethernet.rti |
222 @@ -40,6 +40,7 @@ | 233 @@ -36,10 +36,12 @@ |
234 */ | |
235 attribute Builtin::symbol perm_addr; | |
236 attribute Builtin::symbol dev_addr; | |
237 + attribute Builtin::symbol irq; | |
238 } | |
223 | 239 |
224 required sequence open(Ethernet::Device) | 240 required sequence open(Ethernet::Device) |
225 { | 241 { |
226 + provided chunk LKM::includes(); | 242 + provided chunk LKM::includes(); |
227 provided chunk LKM::prototypes(); | 243 provided chunk LKM::prototypes(); |
228 provided chunk LKM::code(); | 244 provided chunk LKM::code(); |
229 } | 245 } |
230 @@ -69,8 +70,7 @@ | 246 @@ -69,8 +71,7 @@ |
231 | 247 |
232 provided pointcut Ethernet::adapter_init_context(Ethernet::Device, | 248 provided pointcut Ethernet::adapter_init_context(Ethernet::Device, |
233 Builtin::number, | 249 Builtin::number, |
234 - Builtin::symbol, | 250 - Builtin::symbol, |
235 - Builtin::number); | 251 - Builtin::number); |