Mercurial > archived > louis > epitech > mq > rathaxes
comparison e1000_initialize_reception.patch @ 78:501bf9cf65dc
wip on e1000 add some fixes for the generation and check that it works on tip
author | Louis Opter <louis@lse.epitech.net> |
---|---|
date | Sun, 04 Mar 2012 18:55:20 +0100 |
parents | 892b3bc7e43b |
children | f07f6c6d6cd4 |
comparison
equal
deleted
inserted
replaced
77:892b3bc7e43b | 78:501bf9cf65dc |
---|---|
1 # HG changeset patch | 1 # HG changeset patch |
2 # Parent 40e5b7402e64e301b898fa4da1056a5348522fbb | 2 # Parent 0d14f4eef173e65c3430393966e5f7e3bef7a8b2 |
3 rathaxes: initialize reception on the e1000 sample: | 3 rathaxes: initialize reception on the e1000 sample: |
4 | 4 |
5 - This is documented in details in the sections 14.4 and 3.2 of the | 5 - This is documented in details in the sections 14.4 and 3.2 of the |
6 Intel Gigabit Controller Software Developer manual; | 6 Intel Gigabit Controller Software Developer manual; |
7 - "Address filtering" is set up, address filters just tell the hardware | 7 - "Address filtering" is set up, address filters just tell the hardware |
31 + /* we can't use the Rathaxes type here (#8) */ | 31 + /* we can't use the Rathaxes type here (#8) */ |
32 + struct rtx_e1000_rx_ring rx_ring; | 32 + struct rtx_e1000_rx_ring rx_ring; |
33 } *rtx_e1000_ctx_p; | 33 } *rtx_e1000_ctx_p; |
34 } | 34 } |
35 | 35 |
36 @@ -36,6 +39,78 @@ | 36 @@ -36,6 +39,82 @@ |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 + template type e1000::RxDescriptor() | 40 + template type e1000::RxDescriptor() |
41 + { | 41 + { |
89 + * where the device can write the received | 89 + * where the device can write the received |
90 + * packets; | 90 + * packets; |
91 + */ | 91 + */ |
92 + struct rtx_e1000_rx_ring | 92 + struct rtx_e1000_rx_ring |
93 + { | 93 + { |
94 + unsigned int size; | 94 + unsigned int size; |
95 + rtx_e1000_rx_descriptor_p base; | 95 + /* |
96 + void *dma_base; | 96 + * we can't use the typedef here because will not understand it |
97 + * in __std__ mode | |
98 + */ | |
99 + struct rtx_e1000_rx_descriptor *base; | |
100 + void *dma_base; | |
97 + | 101 + |
98 + struct sk_buff *skbuffs[256 /* ${config.rx_ring_size} */]; | 102 + struct sk_buff *skbuffs[256 /* ${config.rx_ring_size} */]; |
99 + void *dma_skbuffs[256 /* ${config.rx_ring_size} */]; | 103 + void *dma_skbuffs[256 /* ${config.rx_ring_size} */]; |
100 + }; | 104 + }; |
101 + } | 105 + } |
110 + } | 114 + } |
111 + | 115 + |
112 template type e1000::Register() | 116 template type e1000::Register() |
113 { | 117 { |
114 chunk LKM::includes() | 118 chunk LKM::includes() |
115 @@ -64,6 +139,9 @@ | 119 @@ -64,6 +143,9 @@ |
116 E1000_FCT = 0x00030, /* Flow Control Type */ | 120 E1000_FCT = 0x00030, /* Flow Control Type */ |
117 E1000_FCTTV = 0x00170, /* Flow Control Transmit Timer Value */ | 121 E1000_FCTTV = 0x00170, /* Flow Control Transmit Timer Value */ |
118 E1000_CRCERRS = 0x04000, /* CRC Error Count (base address of the statistic register spaces) */ | 122 E1000_CRCERRS = 0x04000, /* CRC Error Count (base address of the statistic register spaces) */ |
119 + E1000_RAL = 0x05400, /* Receive Address Low */ | 123 + E1000_RAL = 0x05400, /* Receive Address Low */ |
120 + E1000_RAH = 0x05404, /* Receive Address High */ | 124 + E1000_RAH = 0x05404, /* Receive Address High */ |
121 + E1000_MTA = 0x05200, /* Multicast Table Array */ | 125 + E1000_MTA = 0x05200, /* Multicast Table Array */ |
122 }; | 126 }; |
123 } | 127 } |
124 | 128 |
125 @@ -132,7 +210,8 @@ | 129 @@ -132,7 +214,8 @@ |
126 E1000_INTR_RXDMT0 = 0x00000010, /* rx desc min. threshold (0) */ | 130 E1000_INTR_RXDMT0 = 0x00000010, /* rx desc min. threshold (0) */ |
127 E1000_INTR_RXO = 0x00000040, /* rx overrun */ | 131 E1000_INTR_RXO = 0x00000040, /* rx overrun */ |
128 E1000_INTR_RXT0 = 0x00000080, /* rx timer intr (ring 0) */ | 132 E1000_INTR_RXT0 = 0x00000080, /* rx timer intr (ring 0) */ |
129 - E1000_INTR_MDAC = 0x00000200 /* MDIO access complete */ | 133 - E1000_INTR_MDAC = 0x00000200 /* MDIO access complete */ |
130 + E1000_INTR_MDAC = 0x00000200, /* MDIO access complete */ | 134 + E1000_INTR_MDAC = 0x00000200, /* MDIO access complete */ |
131 + E1000_RAH_AV = (1 << 31), /* Set the MAC Address as Valid */ | 135 + E1000_RAH_AV = (1 << 31), /* Set the MAC Address as Valid */ |
132 }; | 136 }; |
133 } | 137 } |
134 | 138 |
135 @@ -458,14 +537,23 @@ | 139 @@ -458,14 +541,24 @@ |
136 chunk ::CALL | 140 chunk ::CALL() |
137 { | 141 { |
138 /* | 142 /* |
139 - * This is documented in the Intel Gigabit Ethernet Controller | 143 - * This is documented in the Intel Gigabit Ethernet Controller |
140 - * Software Developper manual. | 144 - * Software Developper manual. |
141 + * This part is documented in the Intel Gigabit Ethernet Controller | 145 + * This part is documented in the Intel Gigabit Ethernet Controller |
149 /* | 153 /* |
150 + * shortcut hw_ctx... maybe we should directly take an | 154 + * shortcut hw_ctx... maybe we should directly take an |
151 + * e1000::Context? (but we would need to make it point back to | 155 + * e1000::Context? (but we would need to make it point back to |
152 + * the struct net_device) | 156 + * the struct net_device) |
153 + */ | 157 + */ |
158 + typedef int ${e1000::Context}; | |
154 + ${e1000::Context} hw_ctx; | 159 + ${e1000::Context} hw_ctx; |
155 + hw_ctx = &${ctx}->hw_ctx; | 160 + hw_ctx = &${ctx}->hw_ctx; |
156 + | 161 + |
157 + /* | 162 + /* |
158 * "General Configuration" (section 14.3): | 163 * "General Configuration" (section 14.3): |
159 * | 164 * |
160 * - CTRL.ASDE/CTRL.SLU: Let the PHY handle the speed detection & | 165 * - CTRL.ASDE/CTRL.SLU: Let the PHY handle the speed detection & |
161 @@ -478,22 +566,111 @@ | 166 @@ -478,22 +571,111 @@ |
162 * - Finally, initialize all the statistic registers from | 167 * - Finally, initialize all the statistic registers from |
163 * E1000_CRCERRS to E1000_TSCTFC. | 168 * E1000_CRCERRS to E1000_TSCTFC. |
164 */ | 169 */ |
165 - rtx_e1000_register_set32(&${ctx}->hw_ctx, E1000_CTRL, | 170 - rtx_e1000_register_set32(&${ctx}->hw_ctx, E1000_CTRL, |
166 + | 171 + |
270 + } | 275 + } |
271 + } | 276 + } |
272 + | 277 + |
273 + template sequence e1000::free_rx_tx(Ethernet::Device ctx) | 278 + template sequence e1000::free_rx_tx(Ethernet::Device ctx) |
274 + { | 279 + { |
275 + chunk ::CALL | 280 + chunk ::CALL() |
276 + { | 281 + { |
277 + | 282 + |
278 } | 283 } |
279 } | 284 } |
280 | 285 |
289 + provided type e1000::RxRing; | 294 + provided type e1000::RxRing; |
290 + | 295 + |
291 /* | 296 /* |
292 * These two types should actually be registers definitions in the frontend: | 297 * These two types should actually be registers definitions in the frontend: |
293 */ | 298 */ |
294 @@ -57,6 +60,11 @@ | 299 @@ -55,6 +58,11 @@ |
295 provided chunk ::CALL; | 300 provided chunk ::CALL(); |
296 } | 301 } |
297 | 302 |
298 + provided sequence e1000::free_rx_tx(Ethernet::Device dev) | 303 + provided sequence e1000::free_rx_tx(Ethernet::Device dev) |
299 + { | 304 + { |
300 + provided chunk ::CALL; | 305 + provided chunk ::CALL(); |
301 + } | 306 + } |
302 + | 307 + |
303 provided sequence e1000::handle_interrupt(Ethernet::Device) | 308 provided sequence e1000::handle_interrupt(Ethernet::Device) |
304 { | 309 { |
305 provided chunk ::CALL; | 310 provided chunk ::CALL(); |
306 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt | 311 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt |
307 --- a/rathaxes/samples/e1000/ethernet.blt | 312 --- a/rathaxes/samples/e1000/ethernet.blt |
308 +++ b/rathaxes/samples/e1000/ethernet.blt | 313 +++ b/rathaxes/samples/e1000/ethernet.blt |
309 @@ -102,7 +102,7 @@ | 314 @@ -105,7 +105,7 @@ |
310 { | 315 { |
311 static int rtx_ethernet_close(struct net_device *dev) | 316 static int rtx_ethernet_close(struct net_device *dev) |
312 { | 317 { |
313 - struct rtx_ethernet_dev* rtx_ether_dev = netdev_priv(dev); | 318 - struct rtx_ethernet_dev* rtx_ether_dev = netdev_priv(dev); |
314 + struct rtx_ethernet_dev* rtx_ether_dev = netdev_priv(dev); | 319 + struct rtx_ethernet_dev* rtx_ether_dev = netdev_priv(dev); |
315 struct rtx_e1000_ctx* ctx = &rtx_ether_dev->hw_ctx; | 320 struct rtx_e1000_ctx* ctx = &rtx_ether_dev->hw_ctx; |
316 | 321 |
317 ${pointcut ::IMPLEMENTATION(local.rtx_ether_dev)}; | 322 ${cast local.rtx_ether_dev as Ethernet::Device}; |
318 diff --git a/rathaxes/samples/e1000/lkm.rtx b/rathaxes/samples/e1000/lkm.rtx | 323 diff --git a/rathaxes/samples/e1000/lkm.rtx b/rathaxes/samples/e1000/lkm.rtx |
319 --- a/rathaxes/samples/e1000/lkm.rtx | 324 --- a/rathaxes/samples/e1000/lkm.rtx |
320 +++ b/rathaxes/samples/e1000/lkm.rtx | 325 +++ b/rathaxes/samples/e1000/lkm.rtx |
321 @@ -24,7 +24,17 @@ | 326 @@ -24,7 +24,17 @@ |
322 Ethernet::close(Ethernet::Device dev) | 327 Ethernet::close(Ethernet::Device dev) |