Mercurial > archived > louis > epitech > mq > rathaxes
annotate rathaxes_rewrite_create_and_destroy_device_in_the_e1000_sample.patch @ 99:e2c237d6c37b
Update patches against David's new decl system
author | Louis Opter <louis@lse.epita.fr> |
---|---|
date | Thu, 22 Nov 2012 22:47:25 -0800 |
parents | ffdb018893e2 |
children |
rev | line source |
---|---|
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
1 # HG changeset patch |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
2 # Parent 23c454cb9c1efef0cdcb239505343e893bcd6303 |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
3 rathaxes: rehaul the device initialization/destruction in the e1000 sample |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
4 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
5 - Add several chunks on the e1000::Context; these chunks perform |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
6 low-level, device-dependant operations and should be move in the |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
7 front-end at some point. They weave into pointcuts defined by the |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
8 Ethernet subsystem; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
9 - The e1000::{create,destroy}_device sequence templates are entirely |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
10 gone; they are replaced by the aforementioned chunks and more generic |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
11 code in the PCI and Ethernet subsystems; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
12 - The PCI::{probe,remove} chunks/pointcuts have been rehauled and are |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
13 centered on the new PCI::Device type template. |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
14 |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
15 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
16 --- a/rathaxes/samples/e1000/e1000.blt |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
17 +++ b/rathaxes/samples/e1000/e1000.blt |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
18 @@ -1,4 +1,4 @@ |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
19 -with e1000, Ethernet, Socket, PCI, LKM, Log |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
20 +with e1000, Ethernet, Socket, PCI, LKM, Log, Builtin |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
21 { |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
22 template type e1000::RxDescriptor() |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
23 { |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
24 @@ -251,22 +251,8 @@ |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
25 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
26 template type e1000::Context() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
27 { |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
28 - chunk Ethernet::SubContext() |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
29 - { |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
30 - /* |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
31 - * Force the generation of the structure in the "headers" part, we |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
32 - * have to do this since we do not use the structure in this blt |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
33 - * (we hacked a bit and used it in ethernet.blt directly). |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
34 - */ |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
35 - ${e1000::Context} hw_ctx; |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
36 - } |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
37 - |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
38 decl data_types() |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
39 { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
40 - /* |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
41 - * Yes, this typedef looks ugly but read the remark about |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
42 - * Ethernet::Device in ethernet.blt. |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
43 - */ |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
44 struct rtx_e1000_ctx |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
45 { |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
46 int bars; |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
47 @@ -281,8 +267,68 @@ |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
48 }; |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
49 } |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
50 |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
51 - method init() |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
52 + chunk Ethernet::SubContext() |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
53 { |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
54 + /* |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
55 + * Force the generation of the structure in the "headers" part, we |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
56 + * have to do this since we do not use the structure in this blt |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
57 + * (we hacked a bit and used it in ethernet.blt directly). |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
58 + */ |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
59 + ${e1000::Context} hw_ctx; |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
60 + } |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
61 + |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
62 + chunk Ethernet::adapter_init_context(Ethernet::Device rtx_ether_ctx, |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
63 + Builtin::number bars, |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
64 + Builtin::symbol ioaddr, |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
65 + Builtin::number irq) |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
66 + { |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
67 + { |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
68 + struct rtx_e1000_ctx *hw_ctx = &${rtx_ether_ctx}->hw_ctx; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
69 + hw_ctx->bars = ${bars}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
70 + hw_ctx->ioaddr = ${ioaddr}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
71 + hw_ctx->irq = ${irq}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
72 + } |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
73 + } |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
74 + |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
75 + chunk Ethernet::adapter_reset(Ethernet::Device rtx_ether_ctx) |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
76 + { |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
77 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
78 + struct rtx_e1000_ctx *hw_ctx = &${rtx_ether_ctx}->hw_ctx; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
79 + rtx_e1000_register_write32(hw_ctx, E1000_CTRL, E1000_CMD_RST); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
80 + udelay(10); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
81 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
82 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
83 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
84 + chunk Ethernet::adapter_load_mac_address(Ethernet::Device rtx_ether_ctx) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
85 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
86 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
87 + struct rtx_e1000_ctx *hw_ctx = &${rtx_ether_ctx}->hw_ctx; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
88 + /* Shamelessly borrowed from Minix */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
89 + for (int i = 0; i < 3; ++i) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
90 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
91 + rtx_e1000_register_write32(hw_ctx, E1000_EEPROM_READ, (i << 8) | 1); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
92 + int value; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
93 + do |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
94 + value = rtx_e1000_register_read32(hw_ctx, E1000_EEPROM_READ); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
95 + while ((value & (1 << 4)) == 0); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
96 + value >>= 16; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
97 + /* |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
98 + * XXX: The net_dev manipulations here should take place in the |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
99 + * ethernet templates: |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
100 + * TODO: recevoir un Builtin::symbol avec le tableau ici pour |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
101 + * pouvoir les remonter directement. |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
102 + */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
103 + ${rtx_ether_ctx}->net_dev->dev_addr[i * 2] = value & 0xff; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
104 + ${rtx_ether_ctx}->net_dev->dev_addr[i * 2 + 1] = (value >> 8) & 0xff; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
105 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
106 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
107 + /* TODO: deplacer ça dans Ethernet (see above point): */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
108 + memcpy(${rtx_ether_ctx}->net_dev->perm_addr, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
109 + ${rtx_ether_ctx}->net_dev->dev_addr, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
110 + ${rtx_ether_ctx}->net_dev->addr_len); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
111 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
112 + ${Log::info("e1000::create: mac address loaded from the EEPROM")}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
113 + } |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
114 } |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
115 |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
116 map |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
117 @@ -445,91 +491,6 @@ |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
118 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
119 } |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
120 |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
121 - template sequence e1000::create_device() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
122 - { |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
123 - chunk Ethernet::create_device(PCI::AbstractDevice pdev, Ethernet::Device rtx_ether_ctx) |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
124 - { |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
125 - /* |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
126 - * PCI init stuff: |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
127 - * |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
128 - * Some of that code should certainly be moved in the PCI/Ethernet |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
129 - * blts, also at some point maybe we could do that completely |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
130 - * automatically in the PCI/Ethernet blts. |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
131 - */ |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
132 - |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
133 - /* |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
134 - * We could have used an init function here but since we can't init |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
135 - * all the fields at once (see, ioaddr) and cannot call a C |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
136 - * function within a placeholder (${}), it wasn't really worth it. |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
137 - */ |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
138 - ${rtx_ether_ctx}->hw_ctx.bars = pci_select_bars(${pdev}, IORESOURCE_MEM); |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
139 - ${rtx_ether_ctx}->hw_ctx.irq = ${pdev}->irq; |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
140 - |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
141 - if (pci_enable_device_mem(${pdev})) |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
142 - ${Log::info("e1000::create: pci_enable_device_mem failed")}; |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
143 - if (pci_request_selected_regions(${pdev}, ${rtx_ether_ctx}->hw_ctx.bars, ${config.name})) |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
144 - ${Log::info("e1000::create: pci_request_selected_regions failed")}; |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
145 - if (${config.set_master}) |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
146 - pci_set_master(${pdev}); |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
147 - |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
148 - /* 0 here is for BAR_0: */ |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
149 - ${rtx_ether_ctx}->hw_ctx.ioaddr = pci_ioremap_bar(${pdev}, 0); |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
150 - if (!${rtx_ether_ctx}->hw_ctx.ioaddr) |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
151 - ${Log::info("e1000::create: pci_ioremap_bar failed")}; |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
152 - |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
153 - /* |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
154 - * The really device specific algorithm starts here (so it should |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
155 - * certainly be written in the frontend): |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
156 - */ |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
157 - |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
158 - /* Reset the card */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
159 - rtx_e1000_register_write32(&${rtx_ether_ctx}->hw_ctx, E1000_CTRL, E1000_CMD_RST); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
160 - udelay(10); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
161 - |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
162 - /* Now we can load its mac address (thanks minix code) */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
163 - for (int i = 0; i < 3; ++i) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
164 - { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
165 - rtx_e1000_register_write32(&${rtx_ether_ctx}->hw_ctx, E1000_EEPROM_READ, (i << 8) | 1); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
166 - |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
167 - int value; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
168 - do |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
169 - value = rtx_e1000_register_read32(&${rtx_ether_ctx}->hw_ctx, E1000_EEPROM_READ); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
170 - while ((value & (1 << 4)) == 0); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
171 - value >>= 16; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
172 - |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
173 - ${rtx_ether_ctx}->net_dev->dev_addr[i * 2] = value & 0xff; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
174 - ${rtx_ether_ctx}->net_dev->dev_addr[i * 2 + 1] = (value >> 8) & 0xff; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
175 - } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
176 - |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
177 - memcpy(${rtx_ether_ctx}->net_dev->perm_addr, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
178 - ${rtx_ether_ctx}->net_dev->dev_addr, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
179 - ${rtx_ether_ctx}->net_dev->addr_len); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
180 - |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
181 - ${Log::info("e1000::create: mac address loaded from the EEPROM")}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
182 - } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
183 - |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
184 - chunk ::CALL() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
185 - { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
186 - } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
187 - } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
188 - |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
189 - template sequence e1000::destroy_device() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
190 - { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
191 - chunk Ethernet::destroy_device(PCI::AbstractDevice pdev, Ethernet::Device rtx_ether_ctx) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
192 - { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
193 - /* |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
194 - * Here, we should have some checks to avoid to free resources that |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
195 - * haven't been allocated. (e.g: in case of previous errors). |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
196 - */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
197 - iounmap(${rtx_ether_ctx}->hw_ctx.ioaddr); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
198 - pci_release_selected_regions(${pdev}, ${rtx_ether_ctx}->hw_ctx.bars); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
199 - } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
200 - |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
201 - chunk ::CALL() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
202 - { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
203 - } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
204 - } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
205 - |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
206 /* TODO: make that a method of e1000::Context */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
207 template sequence e1000::print_status(Ethernet::Device ctx) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
208 { |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
209 diff --git a/rathaxes/samples/e1000/e1000.rti b/rathaxes/samples/e1000/e1000.rti |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
210 --- a/rathaxes/samples/e1000/e1000.rti |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
211 +++ b/rathaxes/samples/e1000/e1000.rti |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
212 @@ -1,8 +1,5 @@ |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
213 interface e1000 : Socket, Ethernet, PCI, LKM, Builtin |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
214 { |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
215 - /* XXX: This should be in pci.rti, also maybe we need a bool type */ |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
216 - required variable Builtin::symbol set_master; |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
217 - |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
218 required variable Builtin::number rx_ring_size; |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
219 required variable Builtin::number tx_ring_size; |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
220 required variable Builtin::number rx_buffer_len; |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
221 @@ -13,6 +10,14 @@ |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
222 chunk Ethernet::SubContext(); |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
223 decl data_types(); |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
224 method init(); |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
225 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
226 + /* Callbacks/Hooks which should probably be in the front-end: */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
227 + chunk Ethernet::adapter_init_context(Ethernet::Device, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
228 + Builtin::number, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
229 + Builtin::symbol, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
230 + Builtin::number); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
231 + chunk Ethernet::adapter_reset(Ethernet::Device); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
232 + chunk Ethernet::adapter_load_mac_address(Ethernet::Device); |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
233 } |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
234 |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
235 provided type RxDescriptor |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
236 @@ -70,18 +75,6 @@ |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
237 decl data_types(); |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
238 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
239 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
240 - provided sequence create_device() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
241 - { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
242 - provided chunk Ethernet::create_device(PCI::AbstractDevice, Ethernet::Device); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
243 - provided chunk ::CALL(); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
244 - } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
245 - |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
246 - provided sequence destroy_device() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
247 - { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
248 - provided chunk Ethernet::destroy_device(PCI::AbstractDevice, Ethernet::Device); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
249 - provided chunk ::CALL(); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
250 - } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
251 - |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
252 /* |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
253 * This should take an e1000::Context as the first argument but this was |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
254 * not working as wished. |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
255 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
256 --- a/rathaxes/samples/e1000/ethernet.blt |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
257 +++ b/rathaxes/samples/e1000/ethernet.blt |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
258 @@ -113,6 +113,8 @@ |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
259 |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
260 map |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
261 { |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
262 + pci_device: ${self}->pci_dev; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
263 + net_device: ${self}->net_dev; |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
264 } |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
265 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
266 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
267 @@ -210,48 +212,72 @@ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
268 }; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
269 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
270 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
271 - /* For now the type is not handled, so we just omit it (see #17) */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
272 - chunk PCI::pci_probe_hook(PCI::AbstractDevice pdev) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
273 + /* |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
274 + * NOTE: for now, the error handling is leaking from PCI::probe(), but |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
275 + * it's better than doing it at all. |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
276 + * |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
277 + * XXX: the chunk argument isn't correctly expanded by the |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
278 + * compiler I have to use the same name as the actual C |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
279 + * variable: |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
280 + */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
281 + chunk PCI::pci_probe_hook(PCI::Device rtx_pci_dev) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
282 { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
283 - /* |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
284 - * This typedef is needed to workaround a bug in CNorm __std__ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
285 - * dialect. |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
286 - */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
287 ${Ethernet::Device} rtx_ether_ctx; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
288 - struct net_device *net_dev; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
289 - int error; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
290 + ${Ethernet::AbstractDevice} net_dev; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
291 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
292 - /* Initialize the net_device structure */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
293 net_dev = alloc_etherdev(sizeof(*rtx_ether_ctx)); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
294 - if (net_dev == 0) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
295 + if (!net_dev) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
296 { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
297 - ${Log::info("cannot allocate memory")}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
298 - /* |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
299 - * Again, the error should be "raised" in the parent context. |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
300 - * |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
301 - * Here we know that we can return ENOMEM because *we* wrote |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
302 - * the parent context. |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
303 - */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
304 - return -ENOMEM; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
305 + ${Log::info("cannot allocate the ethernet device context")}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
306 + error = -ENOMEM; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
307 + goto fail; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
308 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
309 - SET_NETDEV_DEV(net_dev, &${pdev}->dev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
310 + SET_NETDEV_DEV(net_dev, ${rtx_pci_dev.device}); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
311 strlcpy(net_dev->name, ${config.ifname}, sizeof(net_dev->name)); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
312 - net_dev->irq = ${pdev}->irq; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
313 + net_dev->irq = ${rtx_pci_dev.irq}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
314 net_dev->netdev_ops = &rtx_ether_ops; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
315 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
316 error = register_netdev(net_dev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
317 if (error) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
318 { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
319 ${Log::info("cannot register the driver in the net subsystem")}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
320 - return error; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
321 + goto fail; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
322 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
323 |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
324 /* Initialize our context held by the net_device structure */ |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
325 - ${rtx_ether_ctx.init(local.net_dev, pdev)}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
326 + /* |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
327 + * XXX: the cast is here because the compiler resolve the |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
328 + * type of rtx_pci_dev.pci_device to the type of |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
329 + * rtx_pci_dev instead of the type of rtx_pci_dev.pci_device. |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
330 + * |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
331 + * Also, I'm getting placeholder in the generated code if |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
332 + * I don't open a scope here. |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
333 + */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
334 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
335 + struct pci_dev *pci_device = ${rtx_pci_dev.pci_device}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
336 + ${cast local.pci_device as PCI::AbstractDevice}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
337 + ${local.rtx_ether_ctx.init(local.net_dev, local.pci_device)}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
338 + } |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
339 |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
340 - pci_set_drvdata(${pdev}, net_dev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
341 + /* Register ourselves in the parent context: */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
342 + /* ${rtx_pci_dev.set_context(local.rtx_ether_ctx)}; */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
343 + ${rtx_pci_dev}->context = rtx_ether_ctx; |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
344 |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
345 - ${pointcut Ethernet::create_device(pdev, local.rtx_ether_ctx)}; |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
346 + /* |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
347 + * XXX: the asssignments/casts are here to circumvent |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
348 + * typing issues in the compiler (see previous XXX). |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
349 + */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
350 + int bars = ${rtx_pci_dev.bars}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
351 + unsigned char /* __iomem */ *ioaddr = ${rtx_pci_dev.ioaddr}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
352 + int irq = ${rtx_pci_dev.irq}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
353 + ${cast local.bars as Builtin::number}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
354 + ${cast local.irq as Builtin::number}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
355 + ${pointcut Ethernet::adapter_init_context(local.rtx_ether_ctx, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
356 + local.bars, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
357 + local.ioaddr, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
358 + local.irq)}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
359 + ${pointcut Ethernet::adapter_reset(local.rtx_ether_ctx)}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
360 + ${pointcut Ethernet::adapter_load_mac_address(local.rtx_ether_ctx)}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
361 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
362 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
363 /* This chunk should be removed (see #26) */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
364 @@ -262,16 +288,18 @@ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
365 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
366 template sequence Ethernet::exit() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
367 { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
368 - chunk PCI::pci_remove_hook(PCI::AbstractDevice pdev) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
369 + /* |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
370 + * XXX: We have to use the same name as the C variable for |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
371 + * the chunk argument... |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
372 + */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
373 + chunk PCI::pci_remove_hook(PCI::Device rtx_pci_dev) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
374 { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
375 - /* workaround for cnorm unstrict */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
376 - struct net_device *net_dev = pci_get_drvdata(${pdev}); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
377 - ${Ethernet::Device} rtx_ether_ctx = netdev_priv(net_dev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
378 + ${Ethernet::Device} rtx_ether_ctx = ${rtx_pci_dev.context}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
379 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
380 - ${pointcut Ethernet::destroy_device(pdev, local.rtx_ether_ctx)}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
381 + BUG_ON(!rtx_ether_ctx); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
382 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
383 - unregister_netdev(net_dev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
384 - free_netdev(net_dev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
385 + unregister_netdev(${local.rtx_ether_ctx.net_device}); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
386 + free_netdev(${local.rtx_ether_ctx.net_device}); |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
387 } |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
388 |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
389 /* This chunk should be removed (see #26) */ |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
390 diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
391 --- a/rathaxes/samples/e1000/ethernet.rti |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
392 +++ b/rathaxes/samples/e1000/ethernet.rti |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
393 @@ -1,4 +1,4 @@ |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
394 -interface Ethernet : Socket, PCI, LKM |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
395 +interface Ethernet : Socket, PCI, LKM, Builtin |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
396 { |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
397 required variable Builtin::string ifname; |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
398 |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
399 @@ -23,6 +23,9 @@ |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
400 decl data_types(); |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
401 method init(Ethernet::AbstractDevice, PCI::AbstractDevice); |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
402 pointcut Ethernet::SubContext(); |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
403 + |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
404 + attribute PCI::AbstractDevice pci_device; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
405 + attribute Ethernet::AbstractDevice net_device; |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
406 } |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
407 |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
408 required sequence open(Ethernet::Device) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
409 @@ -52,15 +55,18 @@ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
410 provided sequence init() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
411 { |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
412 provided chunk LKM::data(); |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
413 - provided chunk PCI::pci_probe_hook(PCI::AbstractDevice); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
414 + provided chunk PCI::pci_probe_hook(PCI::Device); |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
415 |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
416 - provided pointcut Ethernet::create_device(PCI::AbstractDevice, Ethernet::Device); |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
417 + provided pointcut Ethernet::adapter_init_context(Ethernet::Device, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
418 + Builtin::number, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
419 + Builtin::symbol, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
420 + Builtin::number); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
421 + provided pointcut Ethernet::adapter_reset(Ethernet::Device); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
422 + provided pointcut Ethernet::adapter_load_mac_address(Ethernet::Device); |
96
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
423 } |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
424 |
3e715b3e0ecd
Start a series to cleanup/refactor the e1000 sample a little bit
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
425 provided sequence exit() |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
426 { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
427 - provided chunk PCI::pci_remove_hook(PCI::AbstractDevice); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
428 - |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
429 - provided pointcut Ethernet::destroy_device(PCI::AbstractDevice, Ethernet::Device); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
430 + provided chunk PCI::pci_remove_hook(PCI::Device); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
431 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
432 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
433 diff --git a/rathaxes/samples/e1000/lkm.rtx b/rathaxes/samples/e1000/lkm.rtx |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
434 --- a/rathaxes/samples/e1000/lkm.rtx |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
435 +++ b/rathaxes/samples/e1000/lkm.rtx |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
436 @@ -74,7 +74,6 @@ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
437 */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
438 PCI::vendor_id = 0x8086; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
439 PCI::product_id = 0x100e; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
440 - PCI::set_master = true; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
441 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
442 Ethernet::ifname = "rtx%d"; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
443 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
444 diff --git a/rathaxes/samples/e1000/pci.blt b/rathaxes/samples/e1000/pci.blt |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
445 --- a/rathaxes/samples/e1000/pci.blt |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
446 +++ b/rathaxes/samples/e1000/pci.blt |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
447 @@ -12,15 +12,105 @@ |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
448 struct pci_dev; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
449 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
450 |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
451 - method init(PCI::AbstractDevice) |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
452 + method init(PCI::AbstractDevice) |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
453 { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
454 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
455 |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
456 + method set_context(Builtin::symbol ctx) |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
457 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
458 + pci_set_drvdata(${self}, ${ctx}); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
459 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
460 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
461 map |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
462 { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
463 + context: pci_get_drvdata(${self}); |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
464 } |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
465 } |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
466 |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
467 + template type PCI::Device() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
468 + { |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
469 + decl data_types() |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
470 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
471 + struct rtx_pci_dev |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
472 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
473 + struct pci_dev *pdev; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
474 + int bars; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
475 + /* It could be an array at some point: */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
476 + unsigned char /* __iomem */ *ioaddr; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
477 + void *context; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
478 + }; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
479 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
480 + |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
481 + method init(PCI::AbstractDevice pdev) |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
482 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
483 + ${self}->pdev = ${pdev}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
484 + ${self}->bars = pci_select_bars(${pdev}, IORESOURCE_MEM); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
485 + ${self}->ioaddr = NULL; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
486 + ${self}->context = NULL; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
487 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
488 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
489 + chunk LKM::prototypes() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
490 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
491 + static int rtx_pci_device_enable(struct rtx_pci_dev *); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
492 + static void rtx_pci_device_disable(struct rtx_pci_dev *); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
493 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
494 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
495 + chunk LKM::code() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
496 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
497 + static int rtx_pci_device_enable(struct rtx_pci_dev *self) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
498 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
499 + int error; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
500 + error = pci_enable_device(self->pdev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
501 + if (error) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
502 + return error; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
503 + error = pci_request_selected_regions(self->pdev, self->bars, ${config.name}); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
504 + if (error) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
505 + return error; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
506 + pci_set_master(self->pdev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
507 + return 0; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
508 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
509 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
510 + static void rtx_pci_device_disable(struct rtx_pci_dev *self) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
511 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
512 + if (self->ioaddr) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
513 + iounmap(self->ioaddr); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
514 + pci_release_selected_regions(self->pdev, self->bars); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
515 + pci_disable_device(self->pdev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
516 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
517 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
518 + |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
519 + method enable() |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
520 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
521 + rtx_pci_device_enable(${self}); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
522 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
523 + |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
524 + method disable() |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
525 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
526 + rtx_pci_device_disable(${self}); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
527 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
528 + |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
529 + method select_ioaddr(Builtin::number bar) |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
530 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
531 + ${self}->ioaddr = pci_ioremap_bar(${self}->pdev, ${bar}); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
532 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
533 + |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
534 + method set_context(Builtin::symbol ctx) |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
535 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
536 + ${self}->context = ctx; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
537 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
538 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
539 + map |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
540 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
541 + context: ${self}->context; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
542 + device: &${self}->pdev->dev; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
543 + pci_device: ${self}->pdev; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
544 + irq: ${self}->pdev->irq; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
545 + bars: ${self}->bars; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
546 + ioaddr: ${self}->ioaddr; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
547 + BAR_0: 0; |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
548 + } |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
549 + } |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
550 + |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
551 template sequence probe() |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
552 { |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
553 chunk LKM::prototypes() |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
554 @@ -34,24 +124,67 @@ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
555 static int /* __devinit */ rtx_pci_probe(struct pci_dev *pdev, |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
556 const struct pci_device_id *pdev_id) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
557 { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
558 - int err; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
559 + ${cast local.pdev as PCI::AbstractDevice}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
560 + int error; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
561 + ${PCI::Device} *rtx_pci_dev; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
562 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
563 - err = pci_enable_device(pdev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
564 - if (err < 0) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
565 + rtx_pci_dev = kmalloc(sizeof(*rtx_pci_dev), GFP_KERNEL); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
566 + if (!rtx_pci_dev) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
567 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
568 + ${Log::info("cannot allocate the pci device context")}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
569 + error = -ENOMEM; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
570 goto fail; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
571 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
572 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
573 - /* Use local. to reference a local C variable: */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
574 - ${cast local.pdev as PCI::AbstractDevice}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
575 - ${pointcut PCI::pci_probe_hook(local.pdev)}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
576 + /* |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
577 + * XXX: I'm getting placeholder in the generated code if I don't |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
578 + * open a scope here: |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
579 + */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
580 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
581 + ${local.rtx_pci_dev.init(local.pdev)}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
582 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
583 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
584 + /* ${local.pdev.set_context(local.rtx_pci_dev)}; */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
585 + pci_set_drvdata(pdev, rtx_pci_dev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
586 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
587 + /* ${local.rtx_pci_dev.enable()}; */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
588 + error = rtx_pci_device_enable(rtx_pci_dev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
589 + if (error) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
590 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
591 + ${Log::info("rtx_pci_device_enable failed")}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
592 + goto fail; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
593 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
594 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
595 + /* ${local.rtx_pci_dev.select_ioaddr(local.rtx_pci_dev.BAR_0)}; */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
596 + rtx_pci_dev->ioaddr = pci_ioremap_bar( |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
597 + rtx_pci_dev->pdev, ${local.rtx_pci_dev.BAR_0} |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
598 + ); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
599 + if (!${local.rtx_pci_dev.ioaddr}) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
600 + { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
601 + ${Log::info("can't map the device address space")}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
602 + error = 1; /* XXX anything more approriate? */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
603 + goto fail; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
604 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
605 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
606 + /* |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
607 + * XXX: We have to cast here because the compiler is |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
608 + * confused by the fact that rtx_pci_dev is a |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
609 + * pointer. |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
610 + */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
611 + ${cast local.rtx_pci_dev as PCI::Device}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
612 + ${pointcut PCI::pci_probe_hook(local.rtx_pci_dev)}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
613 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
614 return 0; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
615 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
616 - fail: |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
617 - return err; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
618 + fail: |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
619 + /* ${local.pdev.set_context(NULL)}; */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
620 + pci_set_drvdata(pdev, NULL); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
621 + kfree(rtx_pci_dev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
622 + return error; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
623 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
624 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
625 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
626 - /* This chunk should be remove (see #26) */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
627 + /* This chunk should be removed (see #26) */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
628 chunk ::CALL() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
629 { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
630 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
631 @@ -69,9 +202,16 @@ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
632 static void rtx_pci_remove(struct pci_dev *pdev) |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
633 { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
634 ${cast local.pdev as PCI::AbstractDevice}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
635 - ${pointcut PCI::pci_remove_hook(local.pdev)}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
636 + ${PCI::Device} *rtx_pci_dev = ${local.pdev.context}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
637 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
638 - pci_disable_device(pdev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
639 + BUG_ON(!rtx_pci_dev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
640 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
641 + /* XXX: compiler confused by the pointer type. */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
642 + ${cast local.rtx_pci_dev as PCI::Device}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
643 + ${pointcut PCI::pci_remove_hook(local.rtx_pci_dev)}; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
644 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
645 + /* ${local.rtx_pci_dev.disable()}; */ |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
646 + rtx_pci_device_disable(rtx_pci_dev); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
647 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
648 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
649 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
650 diff --git a/rathaxes/samples/e1000/pci.rti b/rathaxes/samples/e1000/pci.rti |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
651 --- a/rathaxes/samples/e1000/pci.rti |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
652 +++ b/rathaxes/samples/e1000/pci.rti |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
653 @@ -1,14 +1,41 @@ |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
654 -interface PCI : LKM |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
655 +interface PCI : LKM, Builtin, Device |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
656 { |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
657 + required variable Builtin::string LKM::name; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
658 + required variable Builtin::number PCI::vendor_id; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
659 + required variable Builtin::number PCI::product_id; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
660 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
661 provided type PCI::AbstractDevice |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
662 { |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
663 + decl data_types(); |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
664 + |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
665 chunk LKM::includes(); |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
666 - decl data_types(); |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
667 method init(PCI::AbstractDevice); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
668 + method set_context(Builtin::symbol); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
669 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
670 + attribute Builtin::symbol context; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
671 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
672 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
673 - required variable Builtin::number PCI::vendor_id; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
674 - required variable Builtin::number PCI::product_id; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
675 + provided type PCI::Device |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
676 + { |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
677 + decl data_types(); |
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
678 + |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
679 + chunk LKM::prototypes(); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
680 + chunk LKM::code(); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
681 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
682 + method init(PCI::AbstractDevice); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
683 + method enable(); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
684 + method disable(); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
685 + method select_ioaddr(Builtin::number); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
686 + method set_context(Builtin::symbol); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
687 + |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
688 + attribute Builtin::symbol context; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
689 + attribute Device::AbstractDevice device; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
690 + attribute PCI::AbstractDevice pci_device; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
691 + attribute Builtin::symbol ioaddr; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
692 + attribute Builtin::number BAR_0; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
693 + attribute Builtin::number irq; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
694 + attribute Builtin::number bars; |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
695 + } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
696 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
697 provided sequence register() |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
698 { |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
699 @@ -28,7 +55,7 @@ |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
700 provided chunk LKM::prototypes(); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
701 provided chunk LKM::code(); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
702 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
703 - provided pointcut PCI::pci_probe_hook(PCI::AbstractDevice); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
704 + provided pointcut PCI::pci_probe_hook(PCI::Device); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
705 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
706 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
707 provided sequence remove() |
99
e2c237d6c37b
Update patches against David's new decl system
Louis Opter <louis@lse.epita.fr>
parents:
97
diff
changeset
|
708 @@ -36,6 +63,6 @@ |
97
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
709 provided chunk LKM::prototypes(); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
710 provided chunk LKM::code(); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
711 |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
712 - provided pointcut PCI::pci_remove_hook(PCI::AbstractDevice); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
713 + provided pointcut PCI::pci_remove_hook(PCI::Device); |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
714 } |
ffdb018893e2
Finish the patch on the create/destroy_device rewrite in the e1000 sample and fix Builtin::symbol
Louis Opter <louis@lse.epita.fr>
parents:
96
diff
changeset
|
715 } |