annotate E1000_UpdateToScalarRef @ 109:3523e795bdf9

Done with the ref/scalar mq
author Louis Opter <louis@lse.epita.fr>
date Mon, 01 Apr 2013 00:56:28 -0700
parents 7efe3212db3a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
1 # HG changeset patch
109
3523e795bdf9 Done with the ref/scalar mq
Louis Opter <louis@lse.epita.fr>
parents: 108
diff changeset
2 # User David Pineau <dav.pineau@gmail.com>
3523e795bdf9 Done with the ref/scalar mq
Louis Opter <louis@lse.epita.fr>
parents: 108
diff changeset
3 # Parent c9b5caeeebc6f7778a9cc5bcea67355fbbdc1120
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
4 Update the e1000 sample with the new features
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
5
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
6 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
7 --- a/rathaxes/samples/e1000/e1000.blt
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
8 +++ b/rathaxes/samples/e1000/e1000.blt
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
9 @@ -87,7 +87,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
10 decl data_types()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
11 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
12 unsigned int size;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
13 - ${e1000::RxDescriptor} *base;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
14 + ${e1000::RxDescriptor.ref} base;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
15 dma_addr_t dma_base;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
16 ${Socket::SKBuff} skbuffs[${config.rx_ring_size}];
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
17 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
18 @@ -124,7 +124,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
19 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
20 unsigned int size;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
21 /* XXX: can't use ${e1000::TxDescriptor} here: */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
22 - ${e1000::TxDescriptor} *base; /* rename to descs */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
23 + ${e1000::TxDescriptor.ref} base; /* rename to descs */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
24 dma_addr_t dma_base;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
25 ${Socket::SKBuff} skbuffs[${config.tx_ring_size}];
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
26 unsigned short head;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
27 @@ -133,20 +133,20 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
28
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
29 chunk LKM::prototypes()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
30 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
31 - static void rtx_e1000_tx_ring_clean(${e1000::TxRing} *);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
32 - static unsigned int rtx_e1000_tx_ring_descriptors_remaining(${e1000::TxRing} *);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
33 - static int rtx_e1000_tx_ring_tso_cksum_offload(${e1000::TxRing} *, ${Socket::SKBuff} *);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
34 - static void rtx_e1000_tx_ring_put(${e1000::TxRing} *, ${Socket::SKBuff} *);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
35 + static void rtx_e1000_tx_ring_clean(${e1000::TxRing.ref});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
36 + static unsigned int rtx_e1000_tx_ring_descriptors_remaining(${e1000::TxRing.ref});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
37 + static int rtx_e1000_tx_ring_tso_cksum_offload(${e1000::TxRing.ref}, ${Socket::SKBuff.ref});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
38 + static void rtx_e1000_tx_ring_put(${e1000::TxRing.ref}, ${Socket::SKBuff.ref});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
39 /* FIXME: See issue #54 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
40 - static void rtx_e1000_tx_ring_start_xmit(${e1000::TxRing} *, /*const*/ ${e1000::Context} *);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
41 + static void rtx_e1000_tx_ring_start_xmit(${e1000::TxRing.ref}, /*const*/ ${e1000::Context.ref});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
42 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
43
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
44 chunk LKM::code()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
45 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
46 - static void rtx_e1000_tx_ring_clean(${e1000::TxRing} *self)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
47 + static void rtx_e1000_tx_ring_clean(${e1000::TxRing.ref} self)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
48 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
49 - ${e1000::TxDescriptor} *tx_desc;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
50 - bool done;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
51 + ${e1000::TxDescriptor.ref} tx_desc;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
52 + bool done;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
53
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
54 for (; self->head != self->tail; self->head++)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
55 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
56 @@ -159,7 +159,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
57 pr_info("%s: tx_ring_clean: moving head to %d/%d", ${config.name}, self->head, ${config.tx_ring_size});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
58 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
59
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
60 - static unsigned int rtx_e1000_tx_ring_descriptors_remaining(${e1000::TxRing} *self)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
61 + static unsigned int rtx_e1000_tx_ring_descriptors_remaining(${e1000::TxRing.ref} self)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
62 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
63 if (self->tail == self->head) /* ring is empty */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
64 return 256; /* XXX: ${config.tx_ring_size}; */
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
65 @@ -169,14 +169,13 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
66 return self->head - self->tail;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
67 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
68
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
69 - static int rtx_e1000_tx_ring_tso_cksum_offload(${e1000::TxRing} *self, ${Socket::SKBuff} *skb)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
70 + static int rtx_e1000_tx_ring_tso_cksum_offload(${e1000::TxRing.ref} self, ${Socket::SKBuff.ref} skb)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
71 {
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
72 - ${Socket::AbstractSKBuff} *abs_skb = skb->skbuff;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
73 - ${cast local.abs_skb as Socket::AbstractSKBuff};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
74 + ${Socket::AbstractSKBuff.ref} abs_skb = skb->skbuff;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
75 return skb_is_gso(&${local.abs_skb.data}) || ${local.abs_skb.data}.ip_summed == CHECKSUM_PARTIAL;
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
76 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
77
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
78 - static void rtx_e1000_tx_ring_put(${e1000::TxRing} *self, ${Socket::SKBuff} *skb)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
79 + static void rtx_e1000_tx_ring_put(${e1000::TxRing.ref} self, ${Socket::SKBuff.ref} skb)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
80 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
81 WARN_ON(!skb);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
82
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
83 @@ -188,9 +187,8 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
84 * code shouldn't be aware of it and use something more
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
85 * abstract.
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
86 */
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
87 - ${Socket::AbstractSKBuff} *abs_skb = skb->skbuff;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
88 - ${cast local.abs_skb as Socket::AbstractSKBuff};
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
89 - ${e1000::TxDescriptor} *tx_desc = &self->base[self->tail];
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
90 + ${Socket::AbstractSKBuff.ref} abs_skb = skb->skbuff;
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
91 + ${e1000::TxDescriptor.ref} tx_desc = &self->base[self->tail];
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
92 tx_desc->lower.data = cpu_to_le32(
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
93 E1000_TXD_CMD_EOP |
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
94 E1000_TXD_CMD_IFCS |
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
95 @@ -203,7 +201,7 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
96 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
97
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
98 /* FIXME: See issue #54 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
99 - static void rtx_e1000_tx_ring_start_xmit(${e1000::TxRing} *self, /*const*/ ${e1000::Context} *hw_ctx)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
100 + static void rtx_e1000_tx_ring_start_xmit(${e1000::TxRing.ref} self, /*const*/ ${e1000::Context.ref} hw_ctx)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
101 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
102 pr_info("%s: start_xmit: moving tail to %d/%d", ${config.name}, self->tail, ${config.tx_ring_size});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
103 rtx_e1000_register_write32(hw_ctx, E1000_TDT, self->tail);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
104 @@ -271,7 +269,7 @@
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
105 Builtin::number irq)
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
106 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
107 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
108 - ${e1000::Context} *hw_ctx = &${rtx_ether_ctx}->hw_ctx;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
109 + ${e1000::Context.ref} hw_ctx = &${rtx_ether_ctx}->hw_ctx;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
110 hw_ctx->bars = ${bars};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
111 hw_ctx->ioaddr = ${ioaddr};
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
112 hw_ctx->irq = ${irq};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
113 @@ -281,8 +279,9 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
114 chunk Ethernet::adapter_reset(Ethernet::Device rtx_ether_ctx)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
115 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
116 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
117 - ${e1000::Context} *hw_ctx = &${rtx_ether_ctx}->hw_ctx;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
118 - rtx_e1000_register_write32(hw_ctx, E1000_CTRL, E1000_CMD_RST);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
119 + /* XXX Naming this variable 'hw_ctx' kicks the decl out of the generated code */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
120 + ${e1000::Context.ref} tmp_hw_ctx = &${rtx_ether_ctx}->hw_ctx;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
121 + rtx_e1000_register_write32(tmp_hw_ctx, E1000_CTRL, E1000_CMD_RST);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
122 udelay(10);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
123 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
124 }
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
125 @@ -290,7 +289,7 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
126 chunk Ethernet::adapter_load_mac_address(Ethernet::Device rtx_ether_ctx)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
127 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
128 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
129 - ${e1000::Context} *hw_ctx = &${rtx_ether_ctx}->hw_ctx;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
130 + ${e1000::Context.ref} hw_ctx = &${rtx_ether_ctx}->hw_ctx;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
131 /* Shamelessly borrowed from Minix */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
132 for (int i = 0; i < 3; ++i)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
133 {
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
134 @@ -469,12 +468,12 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
135 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
136 chunk LKM::prototypes()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
137 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
138 - static void rtx_e1000_print_status(${e1000::Context} *);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
139 + static void rtx_e1000_print_status(${e1000::Context.ref});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
140 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
141
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
142 chunk LKM::code()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
143 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
144 - static void rtx_e1000_print_status(${e1000::Context} *hw_ctx)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
145 + static void rtx_e1000_print_status(${e1000::Context.ref} hw_ctx)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
146 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
147 unsigned int status = rtx_e1000_register_read32(hw_ctx, E1000_STATUS);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
148 ${Log::info("card status:")};
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
149 @@ -519,13 +518,13 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
150 chunk LKM::prototypes()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
151 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
152 /* FIXME: See issue #54 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
153 - static unsigned int rtx_e1000_register_read32(/*const*/ ${e1000::Context} *, unsigned int);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
154 + static unsigned int rtx_e1000_register_read32(/*const*/ ${e1000::Context.ref}, unsigned int);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
155 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
156
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
157 chunk LKM::code()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
158 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
159 /* FIXME: See issue #54 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
160 - static unsigned int rtx_e1000_register_read32(/*const*/ ${e1000::Context} *ctx, unsigned int reg_offset)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
161 + static unsigned int rtx_e1000_register_read32(/*const*/ ${e1000::Context.ref} ctx, unsigned int reg_offset)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
162 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
163 return ioread32(ctx->ioaddr + reg_offset);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
164 }
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
165 @@ -542,13 +541,13 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
166 chunk LKM::prototypes()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
167 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
168 /* FIXME: See issue #54 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
169 - static void rtx_e1000_register_write32(/*const*/ ${e1000::Context} *, unsigned int, unsigned int);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
170 + static void rtx_e1000_register_write32(/*const*/ ${e1000::Context.ref}, unsigned int, unsigned int);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
171 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
172
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
173 chunk LKM::code()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
174 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
175 /* FIXME: See issue #54 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
176 - static void rtx_e1000_register_write32(/*const*/ ${e1000::Context} *ctx, unsigned int reg_offset, unsigned int value)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
177 + static void rtx_e1000_register_write32(/*const*/ ${e1000::Context.ref} ctx, unsigned int reg_offset, unsigned int value)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
178 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
179 iowrite32(value, ctx->ioaddr + reg_offset);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
180 }
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
181 @@ -565,13 +564,13 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
182 chunk LKM::prototypes()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
183 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
184 /* FIXME: See issue #54 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
185 - static void rtx_e1000_register_set32(/*const*/ ${e1000::Context} *, unsigned int, unsigned int);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
186 + static void rtx_e1000_register_set32(/*const*/ ${e1000::Context.ref}, unsigned int, unsigned int);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
187 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
188
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
189 chunk LKM::code()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
190 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
191 /* FIXME: See issue #54 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
192 - static void rtx_e1000_register_set32(/*const*/ ${e1000::Context} *ctx, unsigned int reg_offset, unsigned int value)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
193 + static void rtx_e1000_register_set32(/*const*/ ${e1000::Context.ref} ctx, unsigned int reg_offset, unsigned int value)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
194 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
195 iowrite32(rtx_e1000_register_read32(ctx, reg_offset) | value, ctx->ioaddr + reg_offset);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
196 }
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
197 @@ -588,13 +587,13 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
198 chunk LKM::prototypes()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
199 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
200 /* FIXME: See issue #54 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
201 - static void rtx_e1000_register_unset32(/*const*/ ${e1000::Context} *, unsigned int, unsigned int);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
202 + static void rtx_e1000_register_unset32(/*const*/ ${e1000::Context.ref}, unsigned int, unsigned int);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
203 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
204
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
205 chunk LKM::code()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
206 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
207 /* FIXME: See issue #54 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
208 - static void rtx_e1000_register_unset32(/*const*/ ${e1000::Context} *ctx, unsigned int reg_offset, unsigned int value)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
209 + static void rtx_e1000_register_unset32(/*const*/ ${e1000::Context.ref} ctx, unsigned int reg_offset, unsigned int value)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
210 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
211 iowrite32(rtx_e1000_register_read32(ctx, reg_offset) & ~value, ctx->ioaddr + reg_offset);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
212 }
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
213 @@ -707,7 +706,7 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
214 * e1000::Context? (but we would need to make it point back to
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
215 * the struct net_device)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
216 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
217 - ${e1000::Context} *hw_ctx;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
218 + ${e1000::Context.ref} hw_ctx;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
219 hw_ctx = &${rtx_ether_ctx}->hw_ctx;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
220
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
221 /*
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
222 @@ -816,11 +815,10 @@
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
223 * Allocate the skbuffs, map them for DMA, and write their address
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
224 * in the corresponding descriptor.
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
225 */
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
226 - ${Ethernet::AbstractDevice} *rtx_ether_dev = ${rtx_ether_ctx.net_device};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
227 - ${cast local.rtx_ether_dev as Ethernet::AbstractDevice};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
228 + ${Ethernet::AbstractDevice.ref} rtx_ether_dev = ${rtx_ether_ctx.net_device};
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
229 for (i = 0; i != ${config.rx_ring_size}; ++i)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
230 {
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
231 - hw_ctx->rx_ring.skbuffs[i].skbuff = (${Socket::AbstractSKBuff}*) netdev_alloc_skb(
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
232 + hw_ctx->rx_ring.skbuffs[i].skbuff = (${Socket::AbstractSKBuff.ref})netdev_alloc_skb(
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
233 &${rtx_ether_dev.netdev},
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
234 ${config.rx_buffer_len});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
235 if (!hw_ctx->rx_ring.skbuffs[i].skbuff)
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
236 @@ -954,7 +952,7 @@
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
237 {
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
238 chunk ::CALL()
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
239 {
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
240 - ${e1000::Context} *hw_ctx;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
241 + ${e1000::Context.ref} hw_ctx;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
242 hw_ctx = &${rtx_ether_ctx}->hw_ctx;
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
243
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
244 /*
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
245 @@ -1031,14 +1029,14 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
246 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
247
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
248 ${Socket::SKBuff} skb;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
249 - ${e1000::Context} *hw_ctx;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
250 - ${e1000::TxRing} *tx_ring;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
251 - ${Device::AbstractDevice} *devp;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
252 + ${e1000::Context.ref} hw_ctx;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
253 + ${e1000::TxRing.ref} tx_ring;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
254 + ${Device::AbstractDevice.ref} devp;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
255
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
256 ${local.skb.init(kernel_skb)};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
257 hw_ctx = &${rtx_ether_ctx}->hw_ctx;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
258 tx_ring = &hw_ctx->tx_ring;
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
259 - devp = (${Device::AbstractDevice}*) &${rtx_ether_ctx.device};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
260 + devp = (${Device::AbstractDevice.ref})&${rtx_ether_ctx.device};
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
261
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
262 ${Log::info("xmit: skbuff details:")};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
263 /*
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
264 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
265 --- a/rathaxes/samples/e1000/ethernet.blt
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
266 +++ b/rathaxes/samples/e1000/ethernet.blt
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
267 @@ -73,8 +73,8 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
268 * I think it's useless to use the ${PCI::AbstractDevice} "abstraction"
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
269 * here, since we already are in a Linux specific context.
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
270 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
271 - ${PCI::AbstractDevice} *pci_dev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
272 - ${Ethernet::AbstractDevice} *net_dev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
273 + ${PCI::AbstractDevice.ref} pci_dev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
274 + ${Ethernet::AbstractDevice.ref} net_dev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
275
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
276 /*
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
277 * In the long-term, this may disappear for a new concept allowing
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
278 @@ -120,9 +120,8 @@
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
279 {
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
280 static int rtx_ethernet_open(struct net_device *dev)
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
281 {
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
282 - ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev);
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
283 + ${Ethernet::Device.ref} rtx_ether_ctx = netdev_priv(dev);
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
284
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
285 - ${cast local.rtx_ether_ctx as Ethernet::Device};
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
286 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
287
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
288 return 0;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
289 @@ -141,10 +140,8 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
290 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
291 static int rtx_ethernet_xmit(struct sk_buff* kernel_skb, struct net_device *net_dev)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
292 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
293 - ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(net_dev);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
294 - ${Socket::AbstractSKBuff} *rtx_skb = (${Socket::AbstractSKBuff}*) kernel_skb;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
295 - ${cast local.rtx_skb as Socket::AbstractSKBuff};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
296 - ${cast local.rtx_ether_ctx as Ethernet::Device};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
297 + ${Ethernet::Device.ref} rtx_ether_ctx = netdev_priv(net_dev);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
298 + ${Socket::AbstractSKBuff.ref} rtx_skb = (${Socket::AbstractSKBuff.ref}) kernel_skb;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
299
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
300 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx, local.rtx_skb)};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
301 }
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
302 @@ -162,9 +159,8 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
303 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
304 static int rtx_ethernet_close(struct net_device *dev)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
305 {
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
306 - ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev);
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
307 + ${Ethernet::Device.ref} rtx_ether_ctx = netdev_priv(dev);
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
308
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
309 - ${cast local.rtx_ether_ctx as Ethernet::Device};
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
310 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
311
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
312 return 0;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
313 @@ -187,9 +183,8 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
314 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
315 static enum irqreturn rtx_ethernet_interrupt_handler(int irq, void *dev_id)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
316 {
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
317 - ${Ethernet::Device} *rtx_ether_ctx = dev_id;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
318 + ${Ethernet::Device.ref} rtx_ether_ctx = dev_id;
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
319
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
320 - ${cast local.rtx_ether_ctx as Ethernet::Device};
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
321 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
322
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
323 return IRQ_NONE;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
324 @@ -219,11 +214,10 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
325 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
326 chunk PCI::pci_probe_hook(PCI::Device rtx_pci_dev)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
327 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
328 - ${Ethernet::Device} *rtx_ether_ctx;
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
329 - ${Ethernet::AbstractDevice} *net_dev;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
330 - ${cast local.net_dev as Ethernet::AbstractDevice};
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
331 + ${Ethernet::Device.ref} rtx_ether_ctx;
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
332 + ${Ethernet::AbstractDevice.ref} net_dev;
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
333
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
334 - net_dev = (${Ethernet::AbstractDevice}*) alloc_etherdev(sizeof(*rtx_ether_ctx));
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
335 + net_dev = (${Ethernet::AbstractDevice.ref})alloc_etherdev(sizeof(*rtx_ether_ctx));
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
336 if (!net_dev)
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
337 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
338 ${Log::info("cannot allocate the ethernet device context")};
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
339 @@ -252,8 +246,7 @@
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
340 * I don't open a scope here.
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
341 */
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
342 {
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
343 - ${PCI::AbstractDevice} *rtx_pdev = ${rtx_pci_dev.pci_device};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
344 - ${cast local.rtx_pdev as PCI::AbstractDevice};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
345 + ${PCI::AbstractDevice.ref} rtx_pdev = ${rtx_pci_dev.pci_device};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
346 ${local.rtx_ether_ctx.init(local.net_dev, local.rtx_pdev)};
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
347 }
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
348
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
349 @@ -270,7 +263,6 @@
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
350 int irq = ${rtx_pci_dev.irq};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
351 ${cast local.bars as Builtin::number};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
352 ${cast local.irq as Builtin::number};
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
353 - ${cast local.rtx_ether_ctx as Ethernet::Device};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
354 ${pointcut Ethernet::adapter_init_context(local.rtx_ether_ctx,
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
355 local.bars,
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
356 local.ioaddr,
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
357 @@ -296,13 +288,11 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
358 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
359 chunk PCI::pci_remove_hook(PCI::Device rtx_pci_dev)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
360 {
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
361 - ${Ethernet::Device} *rtx_ether_ctx = ${rtx_pci_dev.context};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
362 - ${Ethernet::AbstractDevice} *rtx_ether_dev = (${Ethernet::AbstractDevice}*) ${local.rtx_ether_ctx.net_device};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
363 + ${Ethernet::Device.ref} rtx_ether_ctx = ${rtx_pci_dev.context};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
364 + ${Ethernet::AbstractDevice.ref} rtx_ether_dev = (${Ethernet::AbstractDevice.ref})${local.rtx_ether_ctx.net_device};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
365
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
366 BUG_ON(!rtx_ether_ctx);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
367
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
368 - ${cast local.rtx_ether_ctx as Ethernet::Device};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
369 - ${cast local.rtx_ether_dev as Ethernet::AbstractDevice};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
370 unregister_netdev(&${local.rtx_ether_dev.netdev});
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
371 free_netdev(&${local.rtx_ether_dev.netdev});
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
372 }
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
373 @@ -313,4 +303,3 @@
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
374 }
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
375 }
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
376 }
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
377 -
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
378 diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
379 --- a/rathaxes/samples/e1000/ethernet.rti
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
380 +++ b/rathaxes/samples/e1000/ethernet.rti
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
381 @@ -34,8 +34,8 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
382 * I'd like to use better names here, but I'd like to understand the
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
383 * difference between the two first:
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
384 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
385 - attribute Builtin::symbol.scalar perm_addr;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
386 - attribute Builtin::symbol.scalar dev_addr;
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
387 + attribute Builtin::symbol.ref perm_addr;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
388 + attribute Builtin::symbol.ref dev_addr;
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
389 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
390
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
391 required sequence open(Ethernet::Device)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
392 diff --git a/rathaxes/samples/e1000/pci.blt b/rathaxes/samples/e1000/pci.blt
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
393 --- a/rathaxes/samples/e1000/pci.blt
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
394 +++ b/rathaxes/samples/e1000/pci.blt
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
395 @@ -32,7 +32,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
396 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
397 decl data_types()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
398 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
399 - ${PCI::AbstractDevice} *pdev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
400 + ${PCI::AbstractDevice.ref} pdev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
401 int bars;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
402 /* It could be an array at some point: */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
403 unsigned char /* __iomem */ *ioaddr;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
404 @@ -41,17 +41,16 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
405
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
406 chunk LKM::prototypes()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
407 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
408 - static int rtx_pci_device_enable(${PCI::Device} *);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
409 - static void rtx_pci_device_disable(${PCI::Device} *);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
410 + static int rtx_pci_device_enable(${PCI::Device.ref});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
411 + static void rtx_pci_device_disable(${PCI::Device.ref});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
412 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
413
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
414 chunk LKM::code()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
415 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
416 - static int rtx_pci_device_enable(${PCI::Device} *self)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
417 + static int rtx_pci_device_enable(${PCI::Device.ref} self)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
418 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
419 int error;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
420 - ${PCI::AbstractDevice} *enable_pdev = self->pdev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
421 - ${cast local.enable_pdev as PCI::AbstractDevice};
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
422 + ${PCI::AbstractDevice.ref} enable_pdev = self->pdev;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
423 error = pci_enable_device(&${local.enable_pdev.data});
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
424 if (error)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
425 return error;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
426 @@ -62,10 +61,9 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
427 return 0;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
428 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
429
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
430 - static void rtx_pci_device_disable(${PCI::Device} *self)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
431 + static void rtx_pci_device_disable(${PCI::Device.ref} self)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
432 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
433 - ${PCI::AbstractDevice} *disable_pdev = self->pdev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
434 - ${cast local.disable_pdev as PCI::AbstractDevice};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
435 + ${PCI::AbstractDevice.ref} disable_pdev = self->pdev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
436 if (self->ioaddr)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
437 iounmap(self->ioaddr);
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
438 pci_release_selected_regions(&${local.disable_pdev.data}, self->bars);
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
439 @@ -75,8 +73,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
440
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
441 method init(PCI::AbstractDevice pdev)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
442 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
443 - ${PCI::AbstractDevice} * workaround = (${PCI::AbstractDevice}*)pdev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
444 - ${cast local.workaround as PCI::AbstractDevice};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
445 + ${PCI::AbstractDevice.ref} workaround = (${PCI::AbstractDevice.ref})pdev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
446 ${self}->pdev = ${pdev};
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
447 ${self}->bars = pci_select_bars(&${local.workaround.data}, IORESOURCE_MEM);
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
448 ${self}->ioaddr = NULL;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
449 @@ -95,8 +92,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
450
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
451 method select_ioaddr(Builtin::number bar)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
452 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
453 - ${PCI::AbstractDevice} *select_ioaddr_pdev = ${self}->pdev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
454 - ${cast local.select_ioaddr_pdev as PCI::AbstractDevice};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
455 + ${PCI::AbstractDevice.ref} select_ioaddr_pdev = ${self}->pdev;
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
456 ${self}->ioaddr = pci_ioremap_bar(&${local.select_ioaddr_pdev.data}, ${bar});
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
457 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
458
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
459 @@ -131,9 +127,8 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
460 const struct pci_device_id *pdev_id)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
461 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
462 int error;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
463 - ${PCI::Device} *rtx_pci_dev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
464 - ${PCI::AbstractDevice} *rtx_pdev = (${PCI::AbstractDevice}*)pdev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
465 - ${cast local.rtx_pdev as PCI::AbstractDevice};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
466 + ${PCI::Device.ref} rtx_pci_dev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
467 + ${PCI::AbstractDevice.ref} rtx_pdev = (${PCI::AbstractDevice.ref})pdev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
468
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
469 rtx_pci_dev = kmalloc(sizeof(*rtx_pci_dev), GFP_KERNEL);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
470 if (!rtx_pci_dev)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
471 @@ -173,12 +168,6 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
472 goto fail;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
473 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
474
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
475 - /*
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
476 - * XXX: We have to cast here because the compiler is
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
477 - * confused by the fact that rtx_pci_dev is a
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
478 - * pointer.
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
479 - */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
480 - ${cast local.rtx_pci_dev as PCI::Device};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
481 ${pointcut PCI::pci_probe_hook(local.rtx_pci_dev)};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
482
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
483 return 0;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
484 @@ -208,14 +197,11 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
485 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
486 static void rtx_pci_remove(struct pci_dev *pdev)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
487 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
488 - ${PCI::AbstractDevice} *rtx_pdev = (${PCI::AbstractDevice}*)pdev;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
489 - ${cast local.rtx_pdev as PCI::AbstractDevice};
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
490 - ${PCI::Device} *rtx_pci_dev = ${rtx_pdev.drv_data};
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
491 + ${PCI::AbstractDevice.ref} rtx_pdev = (${PCI::AbstractDevice.ref})pdev;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
492 + ${PCI::Device.ref} rtx_pci_dev = ${rtx_pdev.drv_data};
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
493
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
494 BUG_ON(!rtx_pci_dev);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
495
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
496 - /* XXX: compiler confused by the pointer type. */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
497 - ${cast local.rtx_pci_dev as PCI::Device};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
498 ${pointcut PCI::pci_remove_hook(local.rtx_pci_dev)};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
499
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
500 /* ${local.rtx_pci_dev.disable()}; */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
501 diff --git a/rathaxes/samples/e1000/socket.blt b/rathaxes/samples/e1000/socket.blt
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
502 --- a/rathaxes/samples/e1000/socket.blt
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
503 +++ b/rathaxes/samples/e1000/socket.blt
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
504 @@ -22,20 +22,20 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
505 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
506 decl data_types()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
507 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
508 - ${Socket::AbstractSKBuff} *skbuff;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
509 - dma_addr_t dma_handle;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
510 + ${Socket::AbstractSKBuff.ref} skbuff;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
511 + dma_addr_t dma_handle;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
512 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
513
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
514 chunk LKM::prototypes()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
515 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
516 - static void rtx_socket_skbuff_dump_infos(${Socket::SKBuff} *);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
517 - static int rtx_socket_skbuff_map(${Socket::SKBuff} *, struct device *, enum dma_data_direction);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
518 - static void rtx_socket_skbuff_unmap_and_free(${Socket::SKBuff} *, struct device *, enum dma_data_direction);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
519 + static void rtx_socket_skbuff_dump_infos(${Socket::SKBuff.ref});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
520 + static int rtx_socket_skbuff_map(${Socket::SKBuff.ref}, struct device *, enum dma_data_direction);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
521 + static void rtx_socket_skbuff_unmap_and_free(${Socket::SKBuff.ref}, struct device *, enum dma_data_direction);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
522 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
523
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
524 chunk LKM::code()
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
525 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
526 - static void rtx_socket_skbuff_dump_infos(${Socket::SKBuff} *self)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
527 + static void rtx_socket_skbuff_dump_infos(${Socket::SKBuff.ref} self)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
528 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
529 WARN_ON(!self->skbuff);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
530
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
531 @@ -44,8 +44,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
532 * but Rathaxes doesn't support functions with a variable number of
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
533 * arguments yet.
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
534 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
535 - ${Socket::AbstractSKBuff} *skb = self->skbuff;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
536 - ${cast local.skb as Socket::AbstractSKBuff};
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
537 + ${Socket::AbstractSKBuff.ref} skb = self->skbuff;
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
538 ${Ethernet::ProtocolId} ethernet_proto = { .id = be16_to_cpu(${local.skb.data}.protocol) };
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
539 static const char * const ip_summed_values[] = {
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
540 "none", "unnecessary", "complete", "partial"
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
541 @@ -65,12 +64,11 @@
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
542 );
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
543 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
544
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
545 - static int rtx_socket_skbuff_map(${Socket::SKBuff} *self,
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
546 + static int rtx_socket_skbuff_map(${Socket::SKBuff.ref} self,
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
547 struct device *dev,
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
548 enum dma_data_direction direction)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
549 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
550 - ${Socket::AbstractSKBuff} *skb = self->skbuff;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
551 - ${cast local.skb as Socket::AbstractSKBuff};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
552 + ${Socket::AbstractSKBuff.ref} skb = self->skbuff;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
553
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
554 WARN_ON(!skb);
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
555 WARN_ON(!${local.skb.data}.data);
106
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
556 @@ -90,12 +88,11 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
557 return 0;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
558 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
559
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
560 - static void rtx_socket_skbuff_unmap_and_free(${Socket::SKBuff} *self,
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
561 + static void rtx_socket_skbuff_unmap_and_free(${Socket::SKBuff.ref} self,
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
562 struct device *dev,
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
563 enum dma_data_direction direction)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
564 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
565 - ${Socket::AbstractSKBuff} *skb = self->skbuff;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
566 - ${cast local.skb as Socket::AbstractSKBuff};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
567 + ${Socket::AbstractSKBuff.ref} skb = self->skbuff;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
568
108
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
569 WARN_ON(!${local.skb});
7efe3212db3a Put the patches on e1000 above the patches on the compiler
Louis Opter <louis@lse.epita.fr>
parents: 106
diff changeset
570 WARN_ON(!${local.skb.data}.data);