annotate rathaxes_e1000_move_the_interrupt_init_and_cleanup_into_ethernet.patch @ 104:c4c33ac02b93

First try at splitting the type nightmare and the refactoring
author Louis Opter <louis@lse.epita.fr>
date Fri, 22 Mar 2013 00:06:00 -0700
parents
children fb20f01ea997
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
1 # HG changeset patch
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
2 # Parent 68c4f142af579e558314cdeebd091fc5abd62014
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
3
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
4 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
5 --- a/rathaxes/samples/e1000/e1000.blt
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
6 +++ b/rathaxes/samples/e1000/e1000.blt
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
7 @@ -249,7 +249,6 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
8 {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
9 int bars;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
10 unsigned char /* __iomem */ *ioaddr;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
11 - int irq;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
12
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
13 ${e1000::RxRing} rx_ring;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
14 ${e1000::TxRing} tx_ring;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
15 @@ -267,14 +266,12 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
16
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
17 chunk Ethernet::adapter_init_context(Ethernet::Device rtx_ether_ctx,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
18 Builtin::number bars,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
19 - Builtin::symbol ioaddr,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
20 - Builtin::number irq)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
21 + Builtin::symbol ioaddr)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
22 {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
23 {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
24 ${e1000::Context} *hw_ctx = &${rtx_ether_ctx}->hw_ctx;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
25 hw_ctx->bars = ${bars};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
26 hw_ctx->ioaddr = ${ioaddr};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
27 - hw_ctx->irq = ${irq};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
28 }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
29 }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
30
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
31 @@ -606,68 +603,6 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
32 }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
33 }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
34
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
35 - template sequence e1000::setup_interrupt_handler(Ethernet::Device rtx_ether_ctx)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
36 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
37 - chunk LKM::includes()
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
38 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
39 - #include <linux/interrupt.h>
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
40 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
41 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
42 - chunk LKM::prototypes()
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
43 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
44 - static int e1000_setup_interrupt_handler(${Ethernet::Device} *);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
45 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
46 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
47 - chunk LKM::code()
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
48 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
49 - static int e1000_setup_interrupt_handler(${Ethernet::Device} *rtx_ether_ctx)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
50 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
51 - int error;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
52 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
53 - error = request_irq(rtx_ether_ctx->hw_ctx.irq,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
54 - rtx_ethernet_interrupt_handler,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
55 - IRQF_SHARED,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
56 - ${config.name},
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
57 - rtx_ether_ctx);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
58 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
59 - if (error)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
60 - ${Log::info("cannot register the interrupt handler")};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
61 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
62 - return error;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
63 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
64 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
65 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
66 - chunk ::CALL()
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
67 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
68 - int error = e1000_setup_interrupt_handler(${rtx_ether_ctx});
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
69 - if (error)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
70 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
71 - return error;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
72 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
73 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
74 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
75 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
76 - template sequence free_interrupt_handler(Ethernet::Device rtx_ether_ctx)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
77 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
78 - chunk prototypes()
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
79 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
80 - static void e1000_free_interrupt_handler(${Ethernet::Device} *rtx_ether_ctx);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
81 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
82 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
83 - chunk code()
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
84 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
85 - static void e1000_free_interrupt_handler(${Ethernet::Device} *rtx_ether_ctx)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
86 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
87 - free_irq(rtx_ether_ctx->hw_ctx.irq, rtx_ether_ctx);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
88 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
89 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
90 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
91 - chunk ::CALL()
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
92 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
93 - e1000_free_interrupt_handler(${rtx_ether_ctx});
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
94 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
95 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
96 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
97 template sequence activate_device_interruption(Ethernet::Device rtx_ether_ctx)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
98 {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
99 chunk ::CALL()
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
100 diff --git a/rathaxes/samples/e1000/e1000.rti b/rathaxes/samples/e1000/e1000.rti
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
101 --- a/rathaxes/samples/e1000/e1000.rti
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
102 +++ b/rathaxes/samples/e1000/e1000.rti
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
103 @@ -13,8 +13,7 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
104 /* Callbacks/Hooks which should probably be in the front-end: */
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
105 chunk Ethernet::adapter_init_context(Ethernet::Device,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
106 Builtin::number,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
107 - Builtin::symbol,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
108 - Builtin::number);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
109 + Builtin::symbol);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
110 chunk Ethernet::adapter_reset(Ethernet::Device);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
111 chunk Ethernet::adapter_load_mac_address(Ethernet::Device);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
112 }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
113 @@ -85,21 +84,6 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
114 provided chunk ::CALL();
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
115 }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
116
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
117 - provided sequence setup_interrupt_handler(Ethernet::Device)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
118 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
119 - provided chunk LKM::includes(); // works without this one
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
120 - provided chunk LKM::prototypes();
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
121 - provided chunk LKM::code();
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
122 - provided chunk ::CALL();
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
123 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
124 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
125 - provided sequence free_interrupt_handler(Ethernet::Device)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
126 - {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
127 - provided chunk LKM::prototypes();
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
128 - provided chunk LKM::code();
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
129 - provided chunk ::CALL();
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
130 - }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
131 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
132 provided sequence activate_device_interruption(Ethernet::Device)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
133 {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
134 provided chunk ::CALL();
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
135 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
136 --- a/rathaxes/samples/e1000/ethernet.blt
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
137 +++ b/rathaxes/samples/e1000/ethernet.blt
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
138 @@ -1,4 +1,4 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
139 -with Ethernet, PCI, LKM, Log
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
140 +with Ethernet, PCI, LKM, Log, Builtin
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
141 {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
142 template type Ethernet::ProtocolId()
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
143 {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
144 @@ -111,6 +111,11 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
145
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
146 template sequence Ethernet::open(Ethernet::Device dev)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
147 {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
148 + chunk LKM::includes()
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
149 + {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
150 + #include <linux/interrupt.h>
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
151 + }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
152 +
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
153 chunk LKM::prototypes()
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
154 {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
155 static int rtx_ethernet_open(struct net_device *);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
156 @@ -123,9 +128,28 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
157 ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
158
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
159 ${cast local.rtx_ether_ctx as Ethernet::Device};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
160 +
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
161 + int error;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
162 + {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
163 + ${Log::info("installing the interrupt handler")};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
164 + }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
165 + error = request_irq(${local.rtx_ether_ctx.irq},
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
166 + rtx_ethernet_interrupt_handler,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
167 + IRQF_SHARED,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
168 + ${config.name},
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
169 + ${local.rtx_net_dev.k_net_dev});
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
170 + if (error)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
171 + {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
172 + ${Log::info("Cannot register the interrupt handler")};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
173 + goto error;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
174 + }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
175 +
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
176 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
177
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
178 return 0;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
179 +
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
180 + error:
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
181 + return error;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
182 }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
183 }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
184 }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
185 @@ -165,7 +189,16 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
186 ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
187
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
188 ${cast local.rtx_ether_ctx as Ethernet::Device};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
189 - ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
190 +
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
191 + /* TODO: change this pointcut into a pointcut/adapter/callback: */
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
192 + {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
193 + ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
194 + }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
195 +
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
196 + free_irq(${local.rtx_ether_ctx.irq}, ${local.rtx_net_dev.k_net_dev});
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
197 + {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
198 + ${Log::info("interrupt handler free'ed")};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
199 + }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
200
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
201 return 0;
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
202 }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
203 @@ -267,14 +300,11 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
204 */
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
205 int bars = ${rtx_pci_dev.bars};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
206 unsigned char /* __iomem */ *ioaddr = ${rtx_pci_dev.ioaddr};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
207 - int irq = ${rtx_pci_dev.irq};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
208 ${cast local.bars as Builtin::number};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
209 - ${cast local.irq as Builtin::number};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
210 ${cast local.rtx_ether_ctx as Ethernet::Device};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
211 ${pointcut Ethernet::adapter_init_context(local.rtx_ether_ctx,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
212 local.bars,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
213 - local.ioaddr,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
214 - local.irq)};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
215 + local.ioaddr)};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
216 ${pointcut Ethernet::adapter_reset(local.rtx_ether_ctx)};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
217 ${pointcut Ethernet::adapter_load_mac_address(local.rtx_ether_ctx)};
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
218 memcpy(${local.rtx_ether_ctx.perm_addr},
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
219 diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
220 --- a/rathaxes/samples/e1000/ethernet.rti
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
221 +++ b/rathaxes/samples/e1000/ethernet.rti
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
222 @@ -40,6 +40,7 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
223
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
224 required sequence open(Ethernet::Device)
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
225 {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
226 + provided chunk LKM::includes();
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
227 provided chunk LKM::prototypes();
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
228 provided chunk LKM::code();
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
229 }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
230 @@ -69,8 +70,7 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
231
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
232 provided pointcut Ethernet::adapter_init_context(Ethernet::Device,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
233 Builtin::number,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
234 - Builtin::symbol,
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
235 - Builtin::number);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
236 + Builtin::symbol);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
237 provided pointcut Ethernet::adapter_reset(Ethernet::Device);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
238 provided pointcut Ethernet::adapter_load_mac_address(Ethernet::Device);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
239 }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
240 diff --git a/rathaxes/samples/e1000/lkm.rtx b/rathaxes/samples/e1000/lkm.rtx
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
241 --- a/rathaxes/samples/e1000/lkm.rtx
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
242 +++ b/rathaxes/samples/e1000/lkm.rtx
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
243 @@ -4,13 +4,6 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
244 {
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
245 Log::info("opening the device");
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
246
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
247 - /*
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
248 - * Maybe e1000::create_device should be called from here, to be
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
249 - * more coherent.
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
250 - */
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
251 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
252 - e1000::setup_interrupt_handler(dev);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
253 - Log::info("interrupt handler installed");
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
254
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
255 e1000::set_up_device(dev);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
256 Log::info("device activated");
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
257 @@ -32,9 +25,6 @@
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
258 */
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
259 e1000::free_rx_tx(dev);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
260 Log::info("free'ed up rx/tx resources");
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
261 -
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
262 - e1000::free_interrupt_handler(dev);
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
263 - Log::info("interrupt handler free'ed");
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
264 }
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
265
c4c33ac02b93 First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff changeset
266 Ethernet::interrupt_handler(Ethernet::Device dev)