Mercurial > archived > louis > epitech > mq > rathaxes
annotate rathaxes_trying_to_fix_the_abstract_type_nightmare_in_e1000.patch @ 102:8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
author | Louis Opter <louis@lse.epita.fr> |
---|---|
date | Thu, 28 Feb 2013 23:30:59 -0800 |
parents | |
children | d9af98faac8a |
rev | line source |
---|---|
102
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
1 # HG changeset patch |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
2 # Parent 21cb4b0b59ebfc3350ded6f9cea2b44203437ab2 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
3 diff --git a/rathaxes/samples/e1000/device.blt b/rathaxes/samples/e1000/device.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
4 --- a/rathaxes/samples/e1000/device.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
5 +++ b/rathaxes/samples/e1000/device.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
6 @@ -18,7 +18,7 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
7 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
8 map |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
9 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
10 - data: ${self}->data; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
11 + k_device: ((struct device *)${self}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
12 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
13 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
14 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
15 diff --git a/rathaxes/samples/e1000/device.rti b/rathaxes/samples/e1000/device.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
16 --- a/rathaxes/samples/e1000/device.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
17 +++ b/rathaxes/samples/e1000/device.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
18 @@ -5,6 +5,6 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
19 decl data_types(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
20 chunk LKM::includes(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
21 method init(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
22 - attribute Builtin::symbol data; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
23 + attribute Builtin::symbol k_device; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
24 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
25 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
26 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
27 --- a/rathaxes/samples/e1000/e1000.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
28 +++ b/rathaxes/samples/e1000/e1000.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
29 @@ -249,7 +249,6 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
30 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
31 int bars; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
32 unsigned char /* __iomem */ *ioaddr; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
33 - int irq; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
34 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
35 ${e1000::RxRing} rx_ring; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
36 ${e1000::TxRing} tx_ring; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
37 @@ -267,14 +266,12 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
38 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
39 chunk Ethernet::adapter_init_context(Ethernet::Device rtx_ether_ctx, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
40 Builtin::number bars, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
41 - Builtin::symbol ioaddr, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
42 - Builtin::number irq) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
43 + Builtin::symbol ioaddr) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
44 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
45 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
46 ${e1000::Context} *hw_ctx = &${rtx_ether_ctx}->hw_ctx; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
47 hw_ctx->bars = ${bars}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
48 hw_ctx->ioaddr = ${ioaddr}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
49 - hw_ctx->irq = ${irq}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
50 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
51 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
52 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
53 @@ -606,68 +603,6 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
54 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
55 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
56 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
57 - template sequence e1000::setup_interrupt_handler(Ethernet::Device rtx_ether_ctx) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
58 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
59 - chunk LKM::includes() |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
60 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
61 - #include <linux/interrupt.h> |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
62 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
63 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
64 - chunk LKM::prototypes() |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
65 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
66 - static int e1000_setup_interrupt_handler(${Ethernet::Device} *); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
67 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
68 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
69 - chunk LKM::code() |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
70 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
71 - static int e1000_setup_interrupt_handler(${Ethernet::Device} *rtx_ether_ctx) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
72 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
73 - int error; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
74 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
75 - error = request_irq(rtx_ether_ctx->hw_ctx.irq, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
76 - rtx_ethernet_interrupt_handler, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
77 - IRQF_SHARED, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
78 - ${config.name}, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
79 - rtx_ether_ctx); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
80 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
81 - if (error) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
82 - ${Log::info("cannot register the interrupt handler")}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
83 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
84 - return error; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
85 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
86 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
87 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
88 - chunk ::CALL() |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
89 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
90 - int error = e1000_setup_interrupt_handler(${rtx_ether_ctx}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
91 - if (error) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
92 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
93 - return error; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
94 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
95 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
96 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
97 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
98 - template sequence free_interrupt_handler(Ethernet::Device rtx_ether_ctx) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
99 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
100 - chunk prototypes() |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
101 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
102 - static void e1000_free_interrupt_handler(${Ethernet::Device} *rtx_ether_ctx); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
103 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
104 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
105 - chunk code() |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
106 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
107 - static void e1000_free_interrupt_handler(${Ethernet::Device} *rtx_ether_ctx) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
108 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
109 - free_irq(rtx_ether_ctx->hw_ctx.irq, rtx_ether_ctx); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
110 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
111 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
112 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
113 - chunk ::CALL() |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
114 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
115 - e1000_free_interrupt_handler(${rtx_ether_ctx}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
116 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
117 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
118 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
119 template sequence activate_device_interruption(Ethernet::Device rtx_ether_ctx) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
120 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
121 chunk ::CALL() |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
122 @@ -816,12 +751,10 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
123 * Allocate the skbuffs, map them for DMA, and write their address |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
124 * in the corresponding descriptor. |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
125 */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
126 - ${Ethernet::AbstractDevice} *rtx_ether_dev = ${rtx_ether_ctx.net_device}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
127 - ${cast local.rtx_ether_dev as Ethernet::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
128 for (i = 0; i != ${config.rx_ring_size}; ++i) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
129 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
130 - hw_ctx->rx_ring.skbuffs[i].skbuff = (${Socket::AbstractSKBuff}*) netdev_alloc_skb( |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
131 - &${rtx_ether_dev.netdev}, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
132 + hw_ctx->rx_ring.skbuffs[i].skbuff = (${Socket::AbstractSKBuff}*)netdev_alloc_skb( |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
133 + ${rtx_ether_ctx.net_device}, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
134 ${config.rx_buffer_len}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
135 if (!hw_ctx->rx_ring.skbuffs[i].skbuff) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
136 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
137 @@ -830,7 +763,7 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
138 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
139 hw_ctx->rx_ring.skbuffs[i].dma_handle = dma_map_single( |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
140 &${rtx_ether_ctx.device}, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
141 - &hw_ctx->rx_ring.skbuffs[i].skbuff->data, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
142 + (struct sk_buff *)hw_ctx->rx_ring.skbuffs[i].skbuff, /* XXX leaking cast */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
143 ${config.rx_buffer_len}, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
144 DMA_FROM_DEVICE); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
145 int dma_error = dma_mapping_error(&${rtx_ether_ctx.device}, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
146 @@ -933,7 +866,8 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
147 ${config.rx_buffer_len}, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
148 DMA_FROM_DEVICE); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
149 err_skbuffs_map: |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
150 - dev_kfree_skb(&hw_ctx->rx_ring.skbuffs[i].skbuff->data); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
151 + /* XXX leaking cast: */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
152 + dev_kfree_skb((struct sk_buff *)hw_ctx->rx_ring.skbuffs[i].skbuff); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
153 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
154 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
155 dma_free_coherent(&${rtx_ether_ctx.device}, hw_ctx->rx_ring.size, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
156 @@ -1042,9 +976,9 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
157 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
158 ${Log::info("xmit: skbuff details:")}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
159 /* |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
160 - * skb is not expand on the bound C variable (should be rtx_skbuff), |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
161 - * which is funny because it works for the sequence template call |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
162 - * right after. |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
163 + * skb does not expand on the bound C variable (should be |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
164 + * rtx_skbuff), which is funny because it works for the |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
165 + * sequence template call right after. |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
166 */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
167 /* |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
168 * XXX: doesn't work (I tried to pass self explicitely too): |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
169 @@ -1077,8 +1011,8 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
170 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
171 /* 2. Map the data */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
172 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
173 - /* XXX: ${local.skb.map_to(local.devp)}; */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
174 - if (rtx_socket_skbuff_map(&skb, &${devp.data}, DMA_TO_DEVICE)) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
175 + /* XXX: ${local.skb.map_to(devp.k_device)}; */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
176 + if (rtx_socket_skbuff_map(&skb, ${devp.k_device}, DMA_TO_DEVICE)) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
177 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
178 ${Log::info("xmit: can't DMA map a SKbuff")}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
179 goto err_skb_map_to; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
180 @@ -1097,7 +1031,7 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
181 err_offload: |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
182 err_skb_map_to: |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
183 /* XXX: ${local.skb.unmap_to_and_free(local.dev)}; */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
184 - rtx_socket_skbuff_unmap_and_free(&skb, &${devp.data}, DMA_TO_DEVICE); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
185 + rtx_socket_skbuff_unmap_and_free(&skb, &${devp.k_device}, DMA_TO_DEVICE); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
186 return NETDEV_TX_OK; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
187 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
188 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
189 diff --git a/rathaxes/samples/e1000/e1000.rti b/rathaxes/samples/e1000/e1000.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
190 --- a/rathaxes/samples/e1000/e1000.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
191 +++ b/rathaxes/samples/e1000/e1000.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
192 @@ -13,8 +13,7 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
193 /* Callbacks/Hooks which should probably be in the front-end: */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
194 chunk Ethernet::adapter_init_context(Ethernet::Device, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
195 Builtin::number, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
196 - Builtin::symbol, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
197 - Builtin::number); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
198 + Builtin::symbol); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
199 chunk Ethernet::adapter_reset(Ethernet::Device); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
200 chunk Ethernet::adapter_load_mac_address(Ethernet::Device); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
201 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
202 @@ -85,21 +84,6 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
203 provided chunk ::CALL(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
204 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
205 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
206 - provided sequence setup_interrupt_handler(Ethernet::Device) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
207 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
208 - provided chunk LKM::includes(); // works without this one |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
209 - provided chunk LKM::prototypes(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
210 - provided chunk LKM::code(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
211 - provided chunk ::CALL(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
212 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
213 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
214 - provided sequence free_interrupt_handler(Ethernet::Device) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
215 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
216 - provided chunk LKM::prototypes(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
217 - provided chunk LKM::code(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
218 - provided chunk ::CALL(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
219 - } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
220 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
221 provided sequence activate_device_interruption(Ethernet::Device) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
222 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
223 provided chunk ::CALL(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
224 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
225 --- a/rathaxes/samples/e1000/ethernet.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
226 +++ b/rathaxes/samples/e1000/ethernet.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
227 @@ -1,4 +1,4 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
228 -with Ethernet, PCI, LKM, Log |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
229 +with Ethernet, PCI, LKM, Log, Builtin |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
230 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
231 template type Ethernet::ProtocolId() |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
232 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
233 @@ -51,7 +51,7 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
234 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
235 decl data_types() |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
236 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
237 - struct net_device ndev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
238 + struct net_device data; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
239 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
240 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
241 chunk LKM::includes() |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
242 @@ -59,9 +59,15 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
243 #include <linux/netdevice.h> |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
244 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
245 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
246 + method init(Builtin::symbol dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
247 + { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
248 + ${self} = (${Ethernet::AbstractDevice} *)${dev}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
249 + } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
250 + |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
251 map |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
252 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
253 - netdev: ${self}->ndev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
254 + k_net_dev: ((struct net_device *)${self}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
255 + rtx_ether_ctx: netdev_priv((struct net_device *)${self}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
256 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
257 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
258 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
259 @@ -88,29 +94,43 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
260 #include <linux/etherdevice.h> |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
261 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
262 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
263 - method init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
264 + /* XXX: if the first arg is not called rtx_net_dev, it breaks. */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
265 + method init(Ethernet::AbstractDevice rtx_net_dev, PCI::AbstractDevice pci_dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
266 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
267 - ${self} = netdev_priv(&${net_dev.netdev}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
268 + ${self} = ${rtx_net_dev.rtx_ether_ctx}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
269 /* |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
270 * We can use -> because we know that ${self} will be always a |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
271 * pointer, but the ambiguity sucks. |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
272 */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
273 ${self}->pci_dev = ${pci_dev}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
274 - ${self}->net_dev = ${net_dev}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
275 + ${self}->net_dev = ${rtx_net_dev}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
276 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
277 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
278 map |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
279 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
280 - device: ${self}->pci_dev->data.dev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
281 + /* |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
282 + * XXX: I'd like to be able to do things like: |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
283 + * device: ${self.pci_dev.k_pci_dev}->dev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
284 + * |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
285 + * Btw, should this be ${PCI::AbstractDevice} instead of directly |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
286 + * struct pci_dev? |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
287 + */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
288 + device: ((struct pci_dev *)(${self})->pci_dev)->dev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
289 pci_device: ${self}->pci_dev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
290 net_device: ${self}->net_dev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
291 - perm_addr: ${self}->net_dev->ndev.perm_addr; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
292 - dev_addr: ${self}->net_dev->ndev.dev_addr; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
293 + perm_addr: ((struct net_device *)(${self})->net_dev)->perm_addr; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
294 + dev_addr: ((struct net_device *)(${self})->net_dev)->dev_addr; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
295 + irq: ((struct pci_dev *)(${self})->pci_dev)->irq; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
296 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
297 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
298 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
299 template sequence Ethernet::open(Ethernet::Device dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
300 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
301 + chunk LKM::includes() |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
302 + { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
303 + #include <linux/interrupt.h> |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
304 + } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
305 + |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
306 chunk LKM::prototypes() |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
307 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
308 static int rtx_ethernet_open(struct net_device *); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
309 @@ -120,12 +140,40 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
310 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
311 static int rtx_ethernet_open(struct net_device *dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
312 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
313 - ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
314 + /* |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
315 + * XXX The casts are here because the compiler doesn't resolve |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
316 + * "enclosed" type (e.g: local.var.enclosed) correctly. |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
317 + */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
318 + ${Ethernet::AbstractDevice} *rtx_net_dev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
319 + ${cast local.rtx_net_dev as Ethernet::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
320 + { /* XXX: I end up with a placeholder if I don't open a scope */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
321 + ${local.rtx_net_dev.init(local.dev)}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
322 + } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
323 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
324 + ${Ethernet::Device} *rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
325 ${cast local.rtx_ether_ctx as Ethernet::Device}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
326 + |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
327 + int error; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
328 + { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
329 + ${Log::info("installing the interrupt handler")}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
330 + } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
331 + error = request_irq(${local.rtx_ether_ctx.irq}, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
332 + rtx_ethernet_interrupt_handler, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
333 + IRQF_SHARED, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
334 + ${config.name}, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
335 + ${local.rtx_net_dev.k_net_dev}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
336 + if (error) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
337 + { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
338 + ${Log::info("Cannot register the interrupt handler")}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
339 + goto error; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
340 + } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
341 + |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
342 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
343 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
344 return 0; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
345 + |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
346 + error: |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
347 + return error; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
348 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
349 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
350 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
351 @@ -162,11 +210,23 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
352 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
353 static int rtx_ethernet_close(struct net_device *dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
354 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
355 - ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
356 + ${Ethernet::AbstractDevice} *rtx_net_dev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
357 + ${cast local.rtx_net_dev as Ethernet::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
358 + { /* XXX: I end up with a placeholder if I don't open a scope */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
359 + ${local.rtx_net_dev.init(local.dev)}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
360 + } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
361 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
362 + ${Ethernet::Device} *rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
363 ${cast local.rtx_ether_ctx as Ethernet::Device}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
364 + |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
365 + /* TODO: change this pointcut into a pointcut/adapter/callback: */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
366 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
367 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
368 + free_irq(${local.rtx_ether_ctx.irq}, ${local.rtx_net_dev.k_net_dev}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
369 + { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
370 + ${Log::info("interrupt handler free'ed")}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
371 + } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
372 + |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
373 return 0; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
374 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
375 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
376 @@ -187,9 +247,13 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
377 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
378 static enum irqreturn rtx_ethernet_interrupt_handler(int irq, void *dev_id) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
379 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
380 - ${Ethernet::Device} *rtx_ether_ctx = dev_id; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
381 + ${Ethernet::AbstractDevice} *rtx_net_dev = dev_id; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
382 + ${cast local.rtx_net_dev as Ethernet::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
383 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
384 + ${Ethernet::Device} *rtx_ether_ctx; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
385 ${cast local.rtx_ether_ctx as Ethernet::Device}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
386 + rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
387 + |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
388 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
389 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
390 return IRQ_NONE; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
391 @@ -219,23 +283,26 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
392 */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
393 chunk PCI::pci_probe_hook(PCI::Device rtx_pci_dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
394 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
395 + ${Ethernet::AbstractDevice} *rtx_net_dev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
396 ${Ethernet::Device} *rtx_ether_ctx; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
397 - ${Ethernet::AbstractDevice} *net_dev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
398 - ${cast local.net_dev as Ethernet::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
399 + ${cast local.rtx_net_dev as Ethernet::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
400 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
401 - net_dev = (${Ethernet::AbstractDevice}*) alloc_etherdev(sizeof(*rtx_ether_ctx)); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
402 - if (!net_dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
403 + /* Cast the result back into our "transparent wrapper" type */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
404 + rtx_net_dev = (${Ethernet::AbstractDevice}*)alloc_etherdev(sizeof(*rtx_ether_ctx)); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
405 + if (!rtx_net_dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
406 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
407 ${Log::info("cannot allocate the ethernet device context")}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
408 error = -ENOMEM; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
409 goto fail; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
410 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
411 - SET_NETDEV_DEV(&${local.net_dev.netdev}, ${rtx_pci_dev.device}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
412 - strlcpy(${local.net_dev.netdev}.name, ${config.ifname}, sizeof(${local.net_dev.netdev}.name)); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
413 - ${local.net_dev.netdev}.irq = ${rtx_pci_dev.irq}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
414 - ${local.net_dev.netdev}.netdev_ops = &rtx_ether_ops; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
415 + SET_NETDEV_DEV(${local.rtx_net_dev.k_net_dev}, ${rtx_pci_dev.device}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
416 + strlcpy(${local.rtx_net_dev.k_net_dev}->name, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
417 + ${config.ifname}, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
418 + sizeof(${local.rtx_net_dev.k_net_dev}->name)); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
419 + ${local.rtx_net_dev.k_net_dev}->irq = ${rtx_pci_dev.irq}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
420 + ${local.rtx_net_dev.k_net_dev}->netdev_ops = &rtx_ether_ops; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
421 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
422 - error = register_netdev(&${local.net_dev.netdev}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
423 + error = register_netdev(${local.rtx_net_dev.k_net_dev}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
424 if (error) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
425 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
426 ${Log::info("cannot register the driver in the net subsystem")}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
427 @@ -247,14 +314,11 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
428 * XXX: the cast is here because the compiler resolve the |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
429 * type of rtx_pci_dev.pci_device to the type of |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
430 * rtx_pci_dev instead of the type of rtx_pci_dev.pci_device. |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
431 - * |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
432 - * Also, I'm getting placeholder in the generated code if |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
433 - * I don't open a scope here. |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
434 */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
435 - { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
436 - ${PCI::AbstractDevice} *rtx_pdev = ${rtx_pci_dev.pci_device}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
437 - ${cast local.rtx_pdev as PCI::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
438 - ${local.rtx_ether_ctx.init(local.net_dev, local.rtx_pdev)}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
439 + ${PCI::AbstractDevice} *workaround = ${rtx_pci_dev.pci_device}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
440 + ${cast local.workaround as PCI::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
441 + { /* XXX: I end up with a placeholder if I don't open a scope */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
442 + ${local.rtx_ether_ctx.init(local.rtx_net_dev, local.workaround)}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
443 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
444 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
445 /* Register ourselves in the parent context: */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
446 @@ -267,19 +331,16 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
447 */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
448 int bars = ${rtx_pci_dev.bars}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
449 unsigned char /* __iomem */ *ioaddr = ${rtx_pci_dev.ioaddr}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
450 - int irq = ${rtx_pci_dev.irq}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
451 ${cast local.bars as Builtin::number}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
452 - ${cast local.irq as Builtin::number}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
453 ${cast local.rtx_ether_ctx as Ethernet::Device}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
454 ${pointcut Ethernet::adapter_init_context(local.rtx_ether_ctx, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
455 local.bars, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
456 - local.ioaddr, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
457 - local.irq)}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
458 + local.ioaddr)}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
459 ${pointcut Ethernet::adapter_reset(local.rtx_ether_ctx)}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
460 ${pointcut Ethernet::adapter_load_mac_address(local.rtx_ether_ctx)}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
461 memcpy(${local.rtx_ether_ctx.perm_addr}, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
462 ${local.rtx_ether_ctx.dev_addr}, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
463 - ${local.net_dev.netdev}.addr_len); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
464 + ${local.rtx_net_dev.k_net_dev}->addr_len); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
465 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
466 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
467 /* This chunk should be removed (see #26) */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
468 @@ -296,15 +357,15 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
469 */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
470 chunk PCI::pci_remove_hook(PCI::Device rtx_pci_dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
471 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
472 - ${Ethernet::Device} *rtx_ether_ctx = ${rtx_pci_dev.context}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
473 - ${Ethernet::AbstractDevice} *rtx_ether_dev = (${Ethernet::AbstractDevice}*) ${local.rtx_ether_ctx.net_device}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
474 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
475 + ${Ethernet::Device} *rtx_ether_ctx = ${rtx_pci_dev.rtx_drv_context}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
476 + ${cast local.rtx_ether_ctx as Ethernet::Device}; /* XXX */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
477 BUG_ON(!rtx_ether_ctx); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
478 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
479 - ${cast local.rtx_ether_ctx as Ethernet::Device}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
480 - ${cast local.rtx_ether_dev as Ethernet::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
481 - unregister_netdev(&${local.rtx_ether_dev.netdev}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
482 - free_netdev(&${local.rtx_ether_dev.netdev}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
483 + ${Ethernet::AbstractDevice} *rtx_net_dev = ${local.rtx_ether_ctx.net_device}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
484 + ${cast local.rtx_net_dev as Ethernet::AbstractDevice}; /* XXX */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
485 + |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
486 + unregister_netdev(${local.rtx_net_dev.k_net_dev}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
487 + free_netdev(${local.rtx_net_dev.k_net_dev}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
488 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
489 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
490 /* This chunk should be removed (see #26) */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
491 diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
492 --- a/rathaxes/samples/e1000/ethernet.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
493 +++ b/rathaxes/samples/e1000/ethernet.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
494 @@ -16,8 +16,15 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
495 provided type AbstractDevice |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
496 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
497 chunk LKM::includes(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
498 + method init(Builtin::symbol); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
499 decl data_types(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
500 - attribute Builtin::symbol netdev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
501 + |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
502 + attribute Builtin::symbol k_net_dev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
503 + /* |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
504 + * XXX: should be a Ethernet::Device, but that causes a circular |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
505 + * dependency. |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
506 + */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
507 + attribute Builtin::symbol rtx_ether_ctx; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
508 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
509 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
510 provided type Device |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
511 @@ -34,12 +41,14 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
512 * I'd like to use better names here, but I'd like to understand the |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
513 * difference between the two first: |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
514 */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
515 - attribute Builtin::symbol perm_addr; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
516 - attribute Builtin::symbol dev_addr; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
517 + attribute Builtin::symbol perm_addr; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
518 + attribute Builtin::symbol dev_addr; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
519 + attribute Builtin::symbol irq; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
520 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
521 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
522 required sequence open(Ethernet::Device) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
523 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
524 + provided chunk LKM::includes(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
525 provided chunk LKM::prototypes(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
526 provided chunk LKM::code(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
527 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
528 @@ -69,8 +78,7 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
529 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
530 provided pointcut Ethernet::adapter_init_context(Ethernet::Device, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
531 Builtin::number, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
532 - Builtin::symbol, |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
533 - Builtin::number); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
534 + Builtin::symbol); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
535 provided pointcut Ethernet::adapter_reset(Ethernet::Device); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
536 provided pointcut Ethernet::adapter_load_mac_address(Ethernet::Device); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
537 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
538 diff --git a/rathaxes/samples/e1000/lkm.rtx b/rathaxes/samples/e1000/lkm.rtx |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
539 --- a/rathaxes/samples/e1000/lkm.rtx |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
540 +++ b/rathaxes/samples/e1000/lkm.rtx |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
541 @@ -4,13 +4,6 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
542 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
543 Log::info("opening the device"); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
544 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
545 - /* |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
546 - * Maybe e1000::create_device should be called from here, to be |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
547 - * more coherent. |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
548 - */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
549 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
550 - e1000::setup_interrupt_handler(dev); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
551 - Log::info("interrupt handler installed"); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
552 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
553 e1000::set_up_device(dev); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
554 Log::info("device activated"); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
555 @@ -32,9 +25,6 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
556 */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
557 e1000::free_rx_tx(dev); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
558 Log::info("free'ed up rx/tx resources"); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
559 - |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
560 - e1000::free_interrupt_handler(dev); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
561 - Log::info("interrupt handler free'ed"); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
562 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
563 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
564 Ethernet::interrupt_handler(Ethernet::Device dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
565 diff --git a/rathaxes/samples/e1000/pci.blt b/rathaxes/samples/e1000/pci.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
566 --- a/rathaxes/samples/e1000/pci.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
567 +++ b/rathaxes/samples/e1000/pci.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
568 @@ -16,15 +16,15 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
569 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
570 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
571 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
572 - method set_context(Builtin::symbol ctx) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
573 + method set_rtx_context(Builtin::symbol ctx) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
574 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
575 - pci_set_drvdata(&${self}->data, ${ctx}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
576 + pci_set_drvdata(${self.k_pci_dev}, ${ctx}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
577 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
578 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
579 map |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
580 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
581 - data: ${self}->data; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
582 - drv_data: pci_get_drvdata(&${self}->data); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
583 + k_pci_dev: ((struct pci_dev *)${self}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
584 + rtx_pci_ctx: pci_get_drvdata((struct pci_dev *)${self}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
585 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
586 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
587 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
588 @@ -52,13 +52,13 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
589 int error; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
590 ${PCI::AbstractDevice} *enable_pdev = self->pdev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
591 ${cast local.enable_pdev as PCI::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
592 - error = pci_enable_device(&${local.enable_pdev.data}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
593 + error = pci_enable_device(${local.enable_pdev.k_pci_dev}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
594 if (error) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
595 return error; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
596 - error = pci_request_selected_regions(&${local.enable_pdev.data}, self->bars, ${config.name}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
597 + error = pci_request_selected_regions(${local.enable_pdev.k_pci_dev}, self->bars, ${config.name}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
598 if (error) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
599 return error; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
600 - pci_set_master(&${local.enable_pdev.data}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
601 + pci_set_master(${local.enable_pdev.k_pci_dev}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
602 return 0; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
603 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
604 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
605 @@ -68,8 +68,8 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
606 ${cast local.disable_pdev as PCI::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
607 if (self->ioaddr) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
608 iounmap(self->ioaddr); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
609 - pci_release_selected_regions(&${local.disable_pdev.data}, self->bars); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
610 - pci_disable_device(&${local.disable_pdev.data}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
611 + pci_release_selected_regions(${local.disable_pdev.k_pci_dev}, self->bars); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
612 + pci_disable_device(${local.disable_pdev.k_pci_dev}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
613 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
614 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
615 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
616 @@ -78,7 +78,7 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
617 ${PCI::AbstractDevice} * workaround = (${PCI::AbstractDevice}*)pdev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
618 ${cast local.workaround as PCI::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
619 ${self}->pdev = ${pdev}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
620 - ${self}->bars = pci_select_bars(&${local.workaround.data}, IORESOURCE_MEM); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
621 + ${self}->bars = pci_select_bars(${local.workaround.k_pci_dev}, IORESOURCE_MEM); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
622 ${self}->ioaddr = NULL; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
623 ${self}->context = NULL; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
624 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
625 @@ -97,18 +97,18 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
626 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
627 ${PCI::AbstractDevice} *select_ioaddr_pdev = ${self}->pdev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
628 ${cast local.select_ioaddr_pdev as PCI::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
629 - ${self}->ioaddr = pci_ioremap_bar(&${local.select_ioaddr_pdev.data}, ${bar}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
630 + ${self}->ioaddr = pci_ioremap_bar(${local.select_ioaddr_pdev.k_pci_dev}, ${bar}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
631 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
632 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
633 - method set_context(Builtin::symbol ctx) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
634 + method set_rtx_drv_context(Builtin::symbol ctx) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
635 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
636 ${self}->context = ctx; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
637 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
638 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
639 map |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
640 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
641 - context: ${self}->context; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
642 - device: &${self}->pdev->data.dev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
643 + rtx_drv_context: ${self}->context; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
644 + device: &((struct pci_dev *)(${self})->pdev->dev); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
645 pci_device: ${self}->pdev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
646 irq: ${self}->pdev->data.irq; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
647 bars: ${self}->bars; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
648 @@ -151,7 +151,7 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
649 ${local.rtx_pci_dev.init(local.rtx_pdev)}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
650 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
651 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
652 - /* ${local.pdev.set_context(local.rtx_pci_dev)}; */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
653 + /* ${local.pdev.set_rtx_context(local.rtx_pci_dev)}; */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
654 pci_set_drvdata(pdev, rtx_pci_dev); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
655 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
656 /* ${local.rtx_pci_dev.enable()}; */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
657 @@ -184,7 +184,7 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
658 return 0; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
659 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
660 fail: |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
661 - /* ${local.pdev.set_context(NULL)}; */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
662 + /* ${local.pdev.set_rtx_drv_context(NULL)}; */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
663 pci_set_drvdata(pdev, NULL); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
664 kfree(rtx_pci_dev); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
665 return error; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
666 @@ -210,7 +210,7 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
667 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
668 ${PCI::AbstractDevice} *rtx_pdev = (${PCI::AbstractDevice}*)pdev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
669 ${cast local.rtx_pdev as PCI::AbstractDevice}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
670 - ${PCI::Device} *rtx_pci_dev = ${rtx_pdev.drv_data}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
671 + ${PCI::Device} *rtx_pci_dev = ${rtx_pdev.rtx_pci_ctx}; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
672 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
673 BUG_ON(!rtx_pci_dev); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
674 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
675 diff --git a/rathaxes/samples/e1000/pci.rti b/rathaxes/samples/e1000/pci.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
676 --- a/rathaxes/samples/e1000/pci.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
677 +++ b/rathaxes/samples/e1000/pci.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
678 @@ -10,10 +10,15 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
679 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
680 chunk LKM::includes(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
681 method init(PCI::AbstractDevice); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
682 - method set_context(Builtin::symbol); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
683 + /* |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
684 + * XXX: the argument should be a PCI::Device but that causes a circular |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
685 + * dependency: |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
686 + */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
687 + method set_rtx_context(Builtin::symbol); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
688 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
689 - attribute Builtin::symbol data; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
690 - attribute Builtin::symbol drv_data; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
691 + attribute Builtin::symbol k_pci_dev; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
692 + /* XXX: should be PCI::Device (see above point) */ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
693 + attribute Builtin::symbol rtx_pci_ctx; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
694 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
695 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
696 provided type PCI::Device |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
697 @@ -27,9 +32,9 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
698 method enable(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
699 method disable(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
700 method select_ioaddr(Builtin::number); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
701 - method set_context(Builtin::symbol); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
702 + method set_rtx_drv_context(Builtin::symbol); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
703 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
704 - attribute Builtin::symbol context; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
705 + attribute Builtin::symbol rtx_drv_context; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
706 attribute Device::AbstractDevice device; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
707 attribute PCI::AbstractDevice pci_device; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
708 attribute Builtin::symbol ioaddr; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
709 diff --git a/rathaxes/samples/e1000/socket.blt b/rathaxes/samples/e1000/socket.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
710 --- a/rathaxes/samples/e1000/socket.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
711 +++ b/rathaxes/samples/e1000/socket.blt |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
712 @@ -14,7 +14,7 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
713 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
714 map |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
715 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
716 - data: ${self}->data; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
717 + k_sk_buff: ((struct sk_buff *)${self}); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
718 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
719 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
720 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
721 @@ -131,22 +131,22 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
722 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
723 method map_to(Device::AbstractDevice dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
724 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
725 - rtx_socket_skbuff_map(${self}, &${dev.data}, DMA_TO_DEVICE); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
726 + rtx_socket_skbuff_map(${self}, ${dev.k_device}, DMA_TO_DEVICE); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
727 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
728 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
729 method map_from(Device::AbstractDevice dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
730 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
731 - rtx_socket_skbuff_map(${self}, &${dev.data}, DMA_FROM_DEVICE); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
732 + rtx_socket_skbuff_map(${self}, ${dev.k_device}, DMA_FROM_DEVICE); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
733 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
734 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
735 method unmap_to_and_free(Device::AbstractDevice dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
736 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
737 - rtx_socket_skbuff_unmap_and_free(${self}, &${dev.data}, DMA_TO_DEVICE); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
738 + rtx_socket_skbuff_unmap_and_free(${self}, ${dev.k_device}, DMA_TO_DEVICE); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
739 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
740 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
741 method unmap_from_and_free(Device::AbstractDevice dev) |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
742 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
743 - rtx_socket_skbuff_unmap_and_free(${self}, &${dev.data}, DMA_FROM_DEVICE); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
744 + rtx_socket_skbuff_unmap_and_free(${self}, ${dev.k_device}, DMA_FROM_DEVICE); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
745 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
746 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
747 map |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
748 diff --git a/rathaxes/samples/e1000/socket.rti b/rathaxes/samples/e1000/socket.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
749 --- a/rathaxes/samples/e1000/socket.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
750 +++ b/rathaxes/samples/e1000/socket.rti |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
751 @@ -5,7 +5,7 @@ |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
752 { |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
753 chunk LKM::includes(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
754 decl data_types(); |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
755 - attribute Builtin::symbol data; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
756 + attribute Builtin::symbol k_sk_buff; |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
757 } |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
758 |
8e8aa342078b
Close the series on the slides and backup some wip on the abstract type nightmare in e1000
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
759 provided type SKBuff |