annotate E1000_UpdateToScalarRef @ 107:f42751b8ca99

Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
author Louis Opter <louis@lse.epita.fr>
date Sun, 24 Mar 2013 21:47:39 -0700
parents 976a4b87803f
children 7efe3212db3a
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
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
2 # Parent 9e6d855c6c477852924e13d354686f18d2036a0e
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
3 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
4
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
5 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
6 --- 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
7 +++ 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
8 @@ -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
9 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
10 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
11 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
12 - ${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
13 + ${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
14 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
15 ${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
16 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
17 @@ -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
18 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
19 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
20 /* 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
21 - ${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
22 + ${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
23 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
24 ${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
25 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
26 @@ -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
27
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
28 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
29 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
30 - 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
31 - 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
32 - 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
33 - 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
34 + 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
35 + 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
36 + 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
37 + 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
38 /* 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
39 - 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
40 + 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
41 }
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 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
44 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
45 - 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
46 + 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
47 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
48 - ${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
49 - 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
50 + ${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
51 + 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
52
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
53 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
54 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
55 @@ -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
56 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
57 }
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 - 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
60 + 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
61 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
62 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
63 return 256; /* XXX: ${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
64 @@ -169,19 +169,17 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
65 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
66 }
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 - 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
69 + 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
70 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
71 /* XXX We can't use ${skb} here because it's a pointer */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
72 - ${Socket::AbstractSKBuff} *k_skb = skb->skbuff;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
73 - ${cast local.k_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
74 + ${Socket::AbstractSKBuff.ref} k_skb = skb->skbuff;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
75 return skb_is_gso(${local.k_skb.k_sk_buff}) || ${local.k_skb.k_sk_buff}->ip_summed == CHECKSUM_PARTIAL;
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 /* XXX We can't use ${skb} here because it's a pointer */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
82 - ${Socket::AbstractSKBuff} *k_skb = skb->skbuff;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
83 - ${cast local.k_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
84 + ${Socket::AbstractSKBuff.ref} k_skb = skb->skbuff;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
85 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
86
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
87 /*
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
88 @@ -192,7 +190,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
89 * 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
90 * abstract.
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
91 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
92 - ${e1000::TxDescriptor} *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
93 + ${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
94 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
95 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
96 E1000_TXD_CMD_IFCS |
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
97 @@ -205,7 +203,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
98 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
99
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
100 /* 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
101 - 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
102 + 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
103 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
104 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
105 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
106 @@ -271,7 +269,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
107 Builtin::symbol ioaddr)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
108 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
109 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
110 - ${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
111 + ${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
112 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
113 hw_ctx->ioaddr = ${ioaddr};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
114 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
115 @@ -280,8 +278,9 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
116 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
117 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
118 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
119 - ${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
120 - 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
121 + /* 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
122 + ${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
123 + 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
124 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
125 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
126 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
127 @@ -289,7 +288,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
128 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
129 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
130 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
131 - ${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
132 + ${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
133 /* 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
134 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
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 @@ -468,12 +467,12 @@
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 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
139 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
140 - 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
141 + 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
142 }
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 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
145 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
146 - 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
147 + 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
148 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
149 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
150 ${Log::info("card status:")};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
151 @@ -518,13 +517,13 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
152 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
153 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
154 /* 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
155 - 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
156 + 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
157 }
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 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
160 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
161 /* 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
162 - 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
163 + 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
164 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
165 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
166 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
167 @@ -541,13 +540,13 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
168 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
169 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
170 /* 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
171 - 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
172 + 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
173 }
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 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
176 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
177 /* 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
178 - 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
179 + 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
180 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
181 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
182 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
183 @@ -564,13 +563,13 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
184 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
185 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
186 /* 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
187 - 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
188 + 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
189 }
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 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
192 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
193 /* 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
194 - 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
195 + 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
196 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
197 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
198 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
199 @@ -587,13 +586,13 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
200 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
201 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
202 /* 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
203 - 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
204 + 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
205 }
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 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
208 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
209 /* 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
210 - 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
211 + 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
212 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
213 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
214 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
215 @@ -644,7 +643,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
216 * 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
217 * 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
218 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
219 - ${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
220 + ${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
221 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
222
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
223 /*
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
224 @@ -755,7 +754,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
225 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
226 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
227 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
228 - hw_ctx->rx_ring.skbuffs[i].skbuff = (${Socket::AbstractSKBuff}*)netdev_alloc_skb(
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
229 + hw_ctx->rx_ring.skbuffs[i].skbuff = (${Socket::AbstractSKBuff.ref})netdev_alloc_skb(
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
230 ${rtx_ether_ctx.net_device.k_net_dev}, /* XXX: .k_net_dev isn't expanded here */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
231 ${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
232 if (!hw_ctx->rx_ring.skbuffs[i].skbuff)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
233 @@ -894,8 +893,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
234 * XXX: Not generated if named "hw_ctx" (which is funny because
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
235 * it's used and works in the template right above this one):
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
236 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
237 - ${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
238 - ${cast local.hw_ctx_ as 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
239 + ${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
240 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
241
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
242 /*
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
243 @@ -911,7 +909,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
244 ${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
245 DMA_FROM_DEVICE);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
246 /* XXX Go through the rtx types (Socket::SKBuff, AbstractSKBuff) */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
247 - dev_kfree_skb(hw_ctx_->rx_ring.skbuffs[i].skbuff);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
248 + dev_kfree_skb((struct sk_buff*)hw_ctx_->rx_ring.skbuffs[i].skbuff);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
249 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
250 dma_free_coherent(${rtx_ether_ctx.device}, hw_ctx_->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
251 hw_ctx_->rx_ring.base, hw_ctx_->rx_ring.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
252 @@ -973,14 +971,14 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
253 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
254
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
255 ${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
256 - ${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
257 - ${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
258 - ${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
259 + ${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
260 + ${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
261 + ${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
262
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
263 ${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
264 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
265 tx_ring = &hw_ctx->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
266 - devp = (${Device::AbstractDevice}*)${rtx_ether_ctx.device};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
267 + devp = (${Device::AbstractDevice.ref})${rtx_ether_ctx.device};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
268
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
269 ${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
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 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
272 --- 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
273 +++ 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
274 @@ -61,7 +61,7 @@
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 method init(Builtin::symbol dev)
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
277 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
278 - ${self} = (${Ethernet::AbstractDevice} *)${dev};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
279 + ${self} = (${Ethernet::AbstractDevice.ref})${dev};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
280 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
281
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
282 map
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
283 @@ -79,8 +79,8 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
284 * 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
285 * 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
286 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
287 - ${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
288 - ${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
289 + ${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
290 + ${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
291
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 * In the long-term, this may disappear for a new concept allowing
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
294 @@ -144,14 +144,12 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
295 * XXX The casts are here because the compiler doesn't resolve
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
296 * "enclosed" type (e.g: local.var.enclosed) correctly.
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
297 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
298 - ${Ethernet::AbstractDevice} *rtx_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
299 - ${cast local.rtx_net_dev as Ethernet::AbstractDevice};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
300 + ${Ethernet::AbstractDevice.ref} rtx_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
301 { /* XXX: I end up with a placeholder if I don't open a scope */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
302 ${local.rtx_net_dev.init(local.dev)};
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
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
305 - ${Ethernet::Device} *rtx_ether_ctx = ${local.rtx_net_dev.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
306 - ${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
307 + ${Ethernet::Device.ref} rtx_ether_ctx = ${local.rtx_net_dev.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
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 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
310 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
311 @@ -189,10 +187,8 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
312 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
313 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
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 - ${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
316 - ${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
317 - ${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
318 - ${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
319 + ${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
320 + ${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
321
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
322 ${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
323 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
324 @@ -210,14 +206,12 @@
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 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
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::AbstractDevice} *rtx_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
329 - ${cast local.rtx_net_dev as Ethernet::AbstractDevice};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
330 + ${Ethernet::AbstractDevice.ref} rtx_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
331 { /* XXX: I end up with a placeholder if I don't open a scope */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
332 ${local.rtx_net_dev.init(local.dev)};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
333 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
334
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
335 - ${Ethernet::Device} *rtx_ether_ctx = ${local.rtx_net_dev.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
336 - ${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
337 + ${Ethernet::Device.ref} rtx_ether_ctx = ${local.rtx_net_dev.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
338
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
339 /* TODO: change this pointcut into a pointcut/adapter/callback: */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
340 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
341 @@ -249,11 +243,9 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
342 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
343 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
344 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
345 - ${Ethernet::AbstractDevice} *rtx_net_dev = 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
346 - ${cast local.rtx_net_dev as Ethernet::AbstractDevice};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
347 + ${Ethernet::AbstractDevice.ref} rtx_net_dev = 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
348
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
349 - ${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
350 - ${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
351 + ${Ethernet::Device.ref} 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
352 rtx_ether_ctx = ${local.rtx_net_dev.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
353
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 ::IMPLEMENTATION(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 @@ -285,12 +277,11 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
356 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
357 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
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 - ${Ethernet::AbstractDevice} *rtx_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
360 - ${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
361 - ${cast local.rtx_net_dev as Ethernet::AbstractDevice};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
362 + ${Ethernet::AbstractDevice.ref} rtx_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
363 + ${Ethernet::Device.ref} 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
364
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
365 /* Cast the result back into our "transparent wrapper" type */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
366 - rtx_net_dev = (${Ethernet::AbstractDevice}*)alloc_etherdev(sizeof(*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 + rtx_net_dev = (${Ethernet::AbstractDevice.ref})alloc_etherdev(sizeof(*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
368 if (!rtx_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
369 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
370 ${Log::info("cannot allocate the ethernet device context")};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
371 @@ -317,8 +308,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
372 * type of rtx_pci_dev.pci_device to the type of
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
373 * rtx_pci_dev instead of the type of rtx_pci_dev.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
374 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
375 - ${PCI::AbstractDevice} *workaround = ${rtx_pci_dev.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
376 - ${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
377 + ${PCI::AbstractDevice.ref} workaround = ${rtx_pci_dev.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
378 { /* XXX: I end up with a placeholder if I don't open a scope */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
379 ${local.rtx_ether_ctx.init(local.rtx_net_dev, local.workaround)};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
380 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
381 @@ -333,8 +323,7 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
382 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
383 int bars = ${rtx_pci_dev.bars};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
384 unsigned char /* __iomem */ *ioaddr = ${rtx_pci_dev.ioaddr};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
385 - ${cast local.bars as Builtin::number};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
386 - ${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
387 + ${cast local.bars as Builtin::number.scalar};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
388 ${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
389 local.bars,
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
390 local.ioaddr)};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
391 @@ -359,12 +348,10 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
392 */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
393 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
394 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
395 - ${Ethernet::Device} *rtx_ether_ctx = ${rtx_pci_dev.rtx_drv_context};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
396 - ${cast local.rtx_ether_ctx as Ethernet::Device}; /* XXX */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
397 + ${Ethernet::Device.ref} rtx_ether_ctx = ${rtx_pci_dev.rtx_drv_context};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
398 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
399
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
400 - ${Ethernet::AbstractDevice} *rtx_net_dev = ${local.rtx_ether_ctx.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
401 - ${cast local.rtx_net_dev as Ethernet::AbstractDevice}; /* XXX */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
402 + ${Ethernet::AbstractDevice.ref} rtx_net_dev = ${local.rtx_ether_ctx.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
403
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
404 unregister_netdev(${local.rtx_net_dev.k_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
405 free_netdev(${local.rtx_net_dev.k_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
406 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
407 --- 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
408 +++ 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
409 @@ -41,9 +41,9 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
410 * 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
411 * 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
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 - 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
414 - attribute Builtin::symbol.scalar dev_addr;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
415 - attribute Builtin::symbol.scalar irq;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
416 + attribute Builtin::symbol.ref 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
417 + attribute Builtin::symbol.ref dev_addr;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
418 + attribute Builtin::symbol.ref irq;
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
419 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
420
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
421 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
422 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
423 --- 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
424 +++ 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
425 @@ -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
426 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
427 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
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 - ${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
430 + ${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
431 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
432 /* 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
433 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
434 @@ -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
435
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
436 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
437 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
438 - 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
439 - 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
440 + 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
441 + 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
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
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
444 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
445 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
446 - 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
447 + 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
448 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
449 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
450 - ${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
451 - ${cast local.enable_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
452 + ${PCI::AbstractDevice.ref} 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
453 error = pci_enable_device(${local.enable_pdev.k_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
454 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
455 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
456 @@ -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
457 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
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
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
460 - 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
461 + 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
462 {
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::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
464 - ${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
465 + ${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
466 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
467 iounmap(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
468 pci_release_selected_regions(${local.disable_pdev.k_pci_dev}, self->bars);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
469 @@ -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
470
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
471 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
472 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
473 - ${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
474 - ${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
475 + ${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
476 ${self}->pdev = ${pdev};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
477 ${self}->bars = pci_select_bars(${local.workaround.k_pci_dev}, IORESOURCE_MEM);
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
478 ${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
479 @@ -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
480
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
481 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
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 - ${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
484 - ${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
485 + ${PCI::AbstractDevice.ref} 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
486 ${self}->ioaddr = pci_ioremap_bar(${local.select_ioaddr_pdev.k_pci_dev}, ${bar});
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
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
489 @@ -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
490 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
491 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
492 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
493 - ${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
494 - ${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
495 - ${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
496 + ${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
497 + ${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
498
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
499 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
500 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
501 @@ -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
502 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
503 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
504
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 - * 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
507 - * 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
508 - * pointer.
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
509 - */
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
510 - ${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
511 ${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
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 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
514 @@ -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
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_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
517 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
518 - ${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
519 - ${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
520 - ${PCI::Device} *rtx_pci_dev = ${rtx_pdev.rtx_pci_ctx};
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
521 + ${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
522 + ${PCI::Device.ref} rtx_pci_dev = ${rtx_pdev.rtx_pci_ctx};
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 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
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 - /* 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
527 - ${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
528 ${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
529
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
530 /* ${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
531 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
532 --- 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
533 +++ 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
534 @@ -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
535 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
536 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
537 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
538 - ${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
539 - 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
540 + ${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
541 + 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
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 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
545 {
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 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
547 - 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
548 - 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
549 + 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
550 + 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
551 + 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
552 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
553
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
554 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
555 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
556 - 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
557 + 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
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 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
560
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
561 @@ -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
562 * 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
563 * 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
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 ${Ethernet::ProtocolId} ethernet_proto = { .id = be16_to_cpu(${local.skb.k_sk_buff}->protocol) };
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
569
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
570 static const char * const ip_summed_values[] = {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
571 @@ -66,12 +65,11 @@
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
572 );
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
573 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
574
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
575 - 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
576 + 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
577 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
578 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
579 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
580 - ${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
581 - ${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
582 + ${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
583
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
584 WARN_ON(!${local.skb.k_sk_buff});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
585 WARN_ON(self->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
586 @@ -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
587 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
588 }
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
589
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
590 - 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
591 + 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
592 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
593 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
594 {
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
595 - ${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
596 - ${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
597 + ${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
598
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
599 WARN_ON(!${local.skb.k_sk_buff});
976a4b87803f Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff changeset
600