1 | This patch (against RTEMS-4.6.0) provides fixes for some drivers in libchip/network: |
---|
2 | |
---|
3 | - prevent name clashes by making 'ld_le32()' etc. |
---|
4 | static inlines |
---|
5 | - let dec21140 attach routine return an error rather |
---|
6 | than panic if no chip is detected (thus allowing |
---|
7 | for probing). |
---|
8 | - let elnk bail out if autoneg never completes |
---|
9 | instead of looping forever |
---|
10 | - avoid divide by zero (crashed my PC) |
---|
11 | - enable more fxp chip variants but warn that |
---|
12 | they are UNTESTED |
---|
13 | |
---|
14 | Index: c/src/libchip/network/dec21140.c |
---|
15 | =================================================================== |
---|
16 | RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/libchip/network/dec21140.c,v |
---|
17 | retrieving revision 1.11 |
---|
18 | diff -c -r1.11 dec21140.c |
---|
19 | *** c/src/libchip/network/dec21140.c 27 Feb 2004 04:17:47 -0000 1.11 |
---|
20 | --- c/src/libchip/network/dec21140.c 14 May 2004 22:41:45 -0000 |
---|
21 | *************** |
---|
22 | *** 243,254 **** |
---|
23 | #define rtems_bsp_delay_in_bus_cycles(cycle) Wait_X_ms( cycle/100 ) |
---|
24 | #define CPU_CACHE_ALIGNMENT_FOR_BUFFER PG_SIZE |
---|
25 | |
---|
26 | ! inline void st_le32(volatile unsigned32 *addr, unsigned32 value) |
---|
27 | { |
---|
28 | *(addr)=value ; |
---|
29 | } |
---|
30 | |
---|
31 | ! inline unsigned32 ld_le32(volatile unsigned32 *addr) |
---|
32 | { |
---|
33 | return(*addr); |
---|
34 | } |
---|
35 | --- 243,254 ---- |
---|
36 | #define rtems_bsp_delay_in_bus_cycles(cycle) Wait_X_ms( cycle/100 ) |
---|
37 | #define CPU_CACHE_ALIGNMENT_FOR_BUFFER PG_SIZE |
---|
38 | |
---|
39 | ! static inline void st_le32(volatile unsigned32 *addr, unsigned32 value) |
---|
40 | { |
---|
41 | *(addr)=value ; |
---|
42 | } |
---|
43 | |
---|
44 | ! static inline unsigned32 ld_le32(volatile unsigned32 *addr) |
---|
45 | { |
---|
46 | return(*addr); |
---|
47 | } |
---|
48 | *************** |
---|
49 | *** 1061,1067 **** |
---|
50 | if ( diag == PCIB_ERR_SUCCESS) |
---|
51 | printk( "DEC/Intel 21143 PCI network card found\n" ); |
---|
52 | else |
---|
53 | ! rtems_panic("DEC PCI network card not found !!\n"); |
---|
54 | } |
---|
55 | #endif |
---|
56 | #if defined(__PPC) |
---|
57 | --- 1061,1070 ---- |
---|
58 | if ( diag == PCIB_ERR_SUCCESS) |
---|
59 | printk( "DEC/Intel 21143 PCI network card found\n" ); |
---|
60 | else |
---|
61 | ! { |
---|
62 | ! printk("No DEC/Intel 21140/3 PCI network card found !!\n"); |
---|
63 | ! return 0; |
---|
64 | ! } |
---|
65 | } |
---|
66 | #endif |
---|
67 | #if defined(__PPC) |
---|
68 | Index: c/src/libchip/network/elnk.c |
---|
69 | =================================================================== |
---|
70 | RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/libchip/network/elnk.c,v |
---|
71 | retrieving revision 1.1.1.2 |
---|
72 | diff -c -r1.1.1.2 elnk.c |
---|
73 | *** c/src/libchip/network/elnk.c 27 Feb 2004 02:58:07 -0000 1.1.1.2 |
---|
74 | --- c/src/libchip/network/elnk.c 17 May 2004 23:35:46 -0000 |
---|
75 | *************** |
---|
76 | *** 204,215 **** |
---|
77 | #define rtems_bsp_delay_in_bus_cycles(cycle) Wait_X_ms( cycle/100 ) |
---|
78 | #define CPU_CACHE_ALIGNMENT_FOR_BUFFER PG_SIZE |
---|
79 | |
---|
80 | ! inline void st_le32(volatile unsigned32 *addr, unsigned32 value) |
---|
81 | { |
---|
82 | *(addr)=value ; |
---|
83 | } |
---|
84 | |
---|
85 | ! inline unsigned32 ld_le32(volatile unsigned32 *addr) |
---|
86 | { |
---|
87 | return(*addr); |
---|
88 | } |
---|
89 | --- 204,215 ---- |
---|
90 | #define rtems_bsp_delay_in_bus_cycles(cycle) Wait_X_ms( cycle/100 ) |
---|
91 | #define CPU_CACHE_ALIGNMENT_FOR_BUFFER PG_SIZE |
---|
92 | |
---|
93 | ! static inline void st_le32(volatile unsigned32 *addr, unsigned32 value) |
---|
94 | { |
---|
95 | *(addr)=value ; |
---|
96 | } |
---|
97 | |
---|
98 | ! static inline unsigned32 ld_le32(volatile unsigned32 *addr) |
---|
99 | { |
---|
100 | return(*addr); |
---|
101 | } |
---|
102 | *************** |
---|
103 | *** 2669,2675 **** |
---|
104 | xl_miibus_writereg(sc, 0x18, MII_ANAR, ANAR_10 | ANAR_TX | ANAR_10_FD | ANAR_TX_FD ); /* ANAR_T4 */ |
---|
105 | xl_miibus_writereg(sc, 0x18, MII_BMCR, BMCR_STARTNEG | BMCR_AUTOEN ); |
---|
106 | |
---|
107 | ! while( ((sr = xl_miibus_readreg(sc, 0x18, MII_BMSR)) & BMSR_ACOMP) == 0 ); |
---|
108 | } |
---|
109 | |
---|
110 | |
---|
111 | --- 2669,2677 ---- |
---|
112 | xl_miibus_writereg(sc, 0x18, MII_ANAR, ANAR_10 | ANAR_TX | ANAR_10_FD | ANAR_TX_FD ); /* ANAR_T4 */ |
---|
113 | xl_miibus_writereg(sc, 0x18, MII_BMCR, BMCR_STARTNEG | BMCR_AUTOEN ); |
---|
114 | |
---|
115 | ! |
---|
116 | ! for (i=0; ((sr = xl_miibus_readreg(sc, 0x18, MII_BMSR)) & BMSR_ACOMP) == 0 && i < 20; i++) |
---|
117 | ! DELAY(10000); |
---|
118 | } |
---|
119 | |
---|
120 | |
---|
121 | *************** |
---|
122 | *** 2997,3003 **** |
---|
123 | printf(" interrupts:%-9d txcmp_ints:%-5d avg_chain_len:%-4d\n", |
---|
124 | sc->xl_stats.device_interrupts, |
---|
125 | sc->xl_stats.txcomplete_ints, |
---|
126 | ! (totalLengths / numLengths) ); |
---|
127 | } |
---|
128 | |
---|
129 | printf(" carrier_lost:%-5d sqe_errs:%-5d\n", |
---|
130 | --- 2999,3005 ---- |
---|
131 | printf(" interrupts:%-9d txcmp_ints:%-5d avg_chain_len:%-4d\n", |
---|
132 | sc->xl_stats.device_interrupts, |
---|
133 | sc->xl_stats.txcomplete_ints, |
---|
134 | ! numLengths ? (totalLengths / numLengths) : -1 ); |
---|
135 | } |
---|
136 | |
---|
137 | printf(" carrier_lost:%-5d sqe_errs:%-5d\n", |
---|
138 | *************** |
---|
139 | *** 3119,3126 **** |
---|
140 | { |
---|
141 | int pbus,pdev,pfun, vid, did, tindex; |
---|
142 | }; |
---|
143 | - |
---|
144 | - |
---|
145 | |
---|
146 | /* |
---|
147 | * Attach an ELNK driver to the system |
---|
148 | --- 3121,3126 ---- |
---|
149 | Index: c/src/libchip/network/if_fxp.c |
---|
150 | =================================================================== |
---|
151 | RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/libchip/network/if_fxp.c,v |
---|
152 | retrieving revision 1.2 |
---|
153 | diff -c -r1.2 if_fxp.c |
---|
154 | *** c/src/libchip/network/if_fxp.c 12 Feb 2003 22:10:17 -0000 1.2 |
---|
155 | --- c/src/libchip/network/if_fxp.c 14 May 2004 23:21:02 -0000 |
---|
156 | *************** |
---|
157 | *** 182,189 **** |
---|
158 | --- 182,192 ---- |
---|
159 | struct fxp_ident { |
---|
160 | u_int16_t devid; |
---|
161 | char *name; |
---|
162 | + int warn; |
---|
163 | }; |
---|
164 | |
---|
165 | + #define UNTESTED 1 |
---|
166 | + |
---|
167 | /* |
---|
168 | * Claim various Intel PCI device identifiers for this driver. The |
---|
169 | * sub-vendor and sub-device field are extensively used to identify |
---|
170 | *************** |
---|
171 | *** 191,218 **** |
---|
172 | * them. |
---|
173 | */ |
---|
174 | static struct fxp_ident fxp_ident_table[] = { |
---|
175 | ! #ifdef NOTUSED |
---|
176 | ! /* currently untested */ |
---|
177 | ! { 0x1229, "Intel Pro 10/100B/100+ Ethernet" }, |
---|
178 | ! { 0x2449, "Intel Pro/100 Ethernet" }, |
---|
179 | ! #endif |
---|
180 | ! { 0x1209, "Intel Embedded 10/100 Ethernet" }, |
---|
181 | ! #ifdef NOTUSED |
---|
182 | ! /* currently untested */ |
---|
183 | ! { 0x1029, "Intel Pro/100 Ethernet" }, |
---|
184 | ! #endif |
---|
185 | ! { 0x1030, "Intel Pro/100 Ethernet" }, |
---|
186 | ! #ifdef NOTUSED |
---|
187 | ! /* currently untested */ |
---|
188 | ! { 0x1031, "Intel Pro/100 Ethernet" }, |
---|
189 | ! { 0x1032, "Intel Pro/100 Ethernet" }, |
---|
190 | ! { 0x1033, "Intel Pro/100 Ethernet" }, |
---|
191 | ! { 0x1034, "Intel Pro/100 Ethernet" }, |
---|
192 | ! { 0x1035, "Intel Pro/100 Ethernet" }, |
---|
193 | ! { 0x1036, "Intel Pro/100 Ethernet" }, |
---|
194 | ! { 0x1037, "Intel Pro/100 Ethernet" }, |
---|
195 | ! { 0x1038, "Intel Pro/100 Ethernet" }, |
---|
196 | ! #endif |
---|
197 | { 0, NULL }, |
---|
198 | }; |
---|
199 | |
---|
200 | --- 194,212 ---- |
---|
201 | * them. |
---|
202 | */ |
---|
203 | static struct fxp_ident fxp_ident_table[] = { |
---|
204 | ! { 0x1229, "Intel Pro 10/100B/100+ Ethernet", UNTESTED }, |
---|
205 | ! { 0x2449, "Intel Pro/100 Ethernet", UNTESTED }, |
---|
206 | ! { 0x1209, "Intel Embedded 10/100 Ethernet", 0 }, |
---|
207 | ! { 0x1029, "Intel Pro/100 Ethernet", UNTESTED }, |
---|
208 | ! { 0x1030, "Intel Pro/100 Ethernet", 0 }, |
---|
209 | ! { 0x1031, "Intel Pro/100 Ethernet", UNTESTED }, |
---|
210 | ! { 0x1032, "Intel Pro/100 Ethernet", UNTESTED }, |
---|
211 | ! { 0x1033, "Intel Pro/100 Ethernet", UNTESTED }, |
---|
212 | ! { 0x1034, "Intel Pro/100 Ethernet", UNTESTED }, |
---|
213 | ! { 0x1035, "Intel Pro/100 Ethernet", UNTESTED }, |
---|
214 | ! { 0x1036, "Intel Pro/100 Ethernet", UNTESTED }, |
---|
215 | ! { 0x1037, "Intel Pro/100 Ethernet", UNTESTED }, |
---|
216 | ! { 0x1038, "Intel Pro/100 Ethernet", UNTESTED }, |
---|
217 | { 0, NULL }, |
---|
218 | }; |
---|
219 | |
---|
220 | *************** |
---|
221 | *** 473,480 **** |
---|
222 | DBGLVL_PRINTK(2,"fxp_attach: find_devid returned %d " |
---|
223 | "and pci signature 0x%x\n", |
---|
224 | i,sc->pci_signature); |
---|
225 | ! if (PCIB_ERR_SUCCESS == i) |
---|
226 | break; |
---|
227 | } |
---|
228 | } |
---|
229 | |
---|
230 | --- 467,479 ---- |
---|
231 | DBGLVL_PRINTK(2,"fxp_attach: find_devid returned %d " |
---|
232 | "and pci signature 0x%x\n", |
---|
233 | i,sc->pci_signature); |
---|
234 | ! if (PCIB_ERR_SUCCESS == i) { |
---|
235 | ! if ( UNTESTED == fxp_ident_table[j].warn ) { |
---|
236 | ! device_printf(dev,"WARNING: this chip version has NOT been reported to work under RTEMS yet.\n"); |
---|
237 | ! device_printf(dev," If it works OK, report it as tested in 'c/src/libchip/network/if_fxp.c'\n"); |
---|
238 | ! } |
---|
239 | break; |
---|
240 | + } |
---|
241 | } |
---|
242 | } |
---|
243 | |
---|