Deleted Added
full compact
if_ex.c (59391) if_ex.c (59816)
1/*
2 * Copyright (c) 1996, Javier Mart�n Rueda (jmrueda@diatel.upm.es)
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*
2 * Copyright (c) 1996, Javier Mart�n Rueda (jmrueda@diatel.upm.es)
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/dev/ex/if_ex.c 59391 2000-04-19 14:58:28Z phk $
27 * $FreeBSD: head/sys/dev/ex/if_ex.c 59816 2000-05-01 09:05:19Z mdodd $
28 *
29 * MAINTAINER: Matthew N. Dodd <winter@jurai.net>
30 * <mdodd@FreeBSD.org>
31 */
32
33/*
34 * Intel EtherExpress Pro/10, Pro/10+ Ethernet driver
35 *

--- 28 unchanged lines hidden (view full) ---

64#include <netinet/if_ether.h>
65
66#include <machine/clock.h>
67
68#include <isa/isavar.h>
69#include <isa/pnpvar.h>
70
71#include <dev/ex/if_exreg.h>
28 *
29 * MAINTAINER: Matthew N. Dodd <winter@jurai.net>
30 * <mdodd@FreeBSD.org>
31 */
32
33/*
34 * Intel EtherExpress Pro/10, Pro/10+ Ethernet driver
35 *

--- 28 unchanged lines hidden (view full) ---

64#include <netinet/if_ether.h>
65
66#include <machine/clock.h>
67
68#include <isa/isavar.h>
69#include <isa/pnpvar.h>
70
71#include <dev/ex/if_exreg.h>
72#include <dev/ex/if_exvar.h>
72
73#ifdef EXDEBUG
74# define Start_End 1
75# define Rcvd_Pkts 2
76# define Sent_Pkts 4
77# define Status 8
78static int debug_mask = 0;
79static int exintr_count = 0;
80# define DODEBUG(level, action) if (level & debug_mask) action
81#else
82# define DODEBUG(level, action)
83#endif
84
73
74#ifdef EXDEBUG
75# define Start_End 1
76# define Rcvd_Pkts 2
77# define Sent_Pkts 4
78# define Status 8
79static int debug_mask = 0;
80static int exintr_count = 0;
81# define DODEBUG(level, action) if (level & debug_mask) action
82#else
83# define DODEBUG(level, action)
84#endif
85
85#define CARD_TYPE_EX_10 1
86#define CARD_TYPE_EX_10_PLUS 2
87
88struct ex_softc {
89 struct arpcom arpcom; /* Ethernet common data */
90 struct ifmedia ifmedia;
91
92 device_t dev;
93 struct resource *ioport;
94 struct resource *irq;
95
96 u_int iobase; /* I/O base address. */
97 u_short irq_no; /* IRQ number. */
98
99 char * irq2ee; /* irq <-> internal */
100 u_char * ee2irq; /* representation conversion */
101
102 u_int mem_size; /* Total memory size, in bytes. */
103 u_int rx_mem_size; /* Rx memory size (by default, */
104 /* first 3/4 of total memory). */
105
106 u_int rx_lower_limit; /* Lower and upper limits of */
107 u_int rx_upper_limit; /* receive buffer. */
108
109 u_int rx_head; /* Head of receive ring buffer. */
110 u_int tx_mem_size; /* Tx memory size (by default, */
111 /* last quarter of total memory).*/
112
113 u_int tx_lower_limit; /* Lower and upper limits of */
114 u_int tx_upper_limit; /* transmit buffer. */
115
116 u_int tx_head; /* Head and tail of */
117 u_int tx_tail; /* transmit ring buffer. */
118
119 u_int tx_last; /* Pointer to beginning of last */
120 /* frame in the chain. */
121};
122
123static char irq2eemap[] =
86char irq2eemap[] =
124 { -1, -1, 0, 1, -1, 2, -1, -1, -1, 0, 3, 4, -1, -1, -1, -1 };
87 { -1, -1, 0, 1, -1, 2, -1, -1, -1, 0, 3, 4, -1, -1, -1, -1 };
125static u_char ee2irqmap[] =
88u_char ee2irqmap[] =
126 { 9, 3, 5, 10, 11, 0, 0, 0 };
89 { 9, 3, 5, 10, 11, 0, 0, 0 };
127
128static char plus_irq2eemap[] =
90
91char plus_irq2eemap[] =
129 { -1, -1, -1, 0, 1, 2, -1, 3, -1, 4, 5, 6, 7, -1, -1, -1 };
92 { -1, -1, -1, 0, 1, 2, -1, 3, -1, 4, 5, 6, 7, -1, -1, -1 };
130static u_char plus_ee2irqmap[] =
93u_char plus_ee2irqmap[] =
131 { 3, 4, 5, 7, 9, 10, 11, 12 };
132
94 { 3, 4, 5, 7, 9, 10, 11, 12 };
95
133/* Bus Front End Functions */
134static void ex_isa_identify __P((driver_t *, device_t));
135static int ex_isa_probe __P((device_t));
136static int ex_isa_attach __P((device_t));
137
138/* Network Interface Functions */
139static void ex_init __P((void *));
140static void ex_start __P((struct ifnet *));
141static int ex_ioctl __P((struct ifnet *, u_long, caddr_t));
142static void ex_watchdog __P((struct ifnet *));
143
144/* ifmedia Functions */
145static int ex_ifmedia_upd __P((struct ifnet *));
146static void ex_ifmedia_sts __P((struct ifnet *, struct ifmediareq *));
147
96/* Network Interface Functions */
97static void ex_init __P((void *));
98static void ex_start __P((struct ifnet *));
99static int ex_ioctl __P((struct ifnet *, u_long, caddr_t));
100static void ex_watchdog __P((struct ifnet *));
101
102/* ifmedia Functions */
103static int ex_ifmedia_upd __P((struct ifnet *));
104static void ex_ifmedia_sts __P((struct ifnet *, struct ifmediareq *));
105
106static int ex_get_media __P((u_int32_t iobase));
107
148static void ex_stop __P((struct ex_softc *));
149static void ex_reset __P((struct ex_softc *));
150
108static void ex_stop __P((struct ex_softc *));
109static void ex_reset __P((struct ex_softc *));
110
151static driver_intr_t ex_intr;
152static void ex_tx_intr __P((struct ex_softc *));
153static void ex_rx_intr __P((struct ex_softc *));
154
111static void ex_tx_intr __P((struct ex_softc *));
112static void ex_rx_intr __P((struct ex_softc *));
113
155static u_short eeprom_read __P((int, int));
156
157static device_method_t ex_methods[] = {
158 /* Device interface */
159 DEVMETHOD(device_identify, ex_isa_identify),
160 DEVMETHOD(device_probe, ex_isa_probe),
161 DEVMETHOD(device_attach, ex_isa_attach),
162
163 { 0, 0 }
164};
165
166static driver_t ex_driver = {
167 "ex",
168 ex_methods,
169 sizeof(struct ex_softc),
170};
171
172static devclass_t ex_devclass;
173
174DRIVER_MODULE(ex, isa, ex_driver, ex_devclass, 0, 0);
175
176static struct isa_pnp_id ex_ids[] = {
177 { 0x3110d425, NULL }, /* INT1031 */
178 { 0x3010d425, NULL }, /* INT1030 */
179 { 0, NULL },
180};
181
182static int
183look_for_card (u_int iobase)
114int
115look_for_card (u_int32_t iobase)
184{
185 int count1, count2;
186
187 /*
188 * Check for the i82595 signature, and check that the round robin
189 * counter actually advances.
190 */
191 if (((count1 = inb(iobase + ID_REG)) & Id_Mask) != Id_Sig)
192 return(0);
193 count2 = inb(iobase + ID_REG);
194 count2 = inb(iobase + ID_REG);
195 count2 = inb(iobase + ID_REG);
196
197 return((count2 & Counter_bits) == ((count1 + 0xc0) & Counter_bits));
198}
199
116{
117 int count1, count2;
118
119 /*
120 * Check for the i82595 signature, and check that the round robin
121 * counter actually advances.
122 */
123 if (((count1 = inb(iobase + ID_REG)) & Id_Mask) != Id_Sig)
124 return(0);
125 count2 = inb(iobase + ID_REG);
126 count2 = inb(iobase + ID_REG);
127 count2 = inb(iobase + ID_REG);
128
129 return((count2 & Counter_bits) == ((count1 + 0xc0) & Counter_bits));
130}
131
200static int
201ex_get_media (u_int32_t iobase)
202{
203 int tmp;
204
205 outb(iobase + CMD_REG, Bank2_Sel);
206 tmp = inb(iobase + REG3);
207 outb(iobase + CMD_REG, Bank0_Sel);
208
209 if (tmp & TPE_bit)
210 return(IFM_ETHER|IFM_10_T);
211 if (tmp & BNC_bit)
212 return(IFM_ETHER|IFM_10_2);
213
214 return (IFM_ETHER|IFM_10_5);
215}
216
217static void
132void
218ex_get_address (u_int32_t iobase, u_char *enaddr)
219{
220 u_int16_t eaddr_tmp;
221
222 eaddr_tmp = eeprom_read(iobase, EE_Eth_Addr_Lo);
223 enaddr[5] = eaddr_tmp & 0xff;
224 enaddr[4] = eaddr_tmp >> 8;
225 eaddr_tmp = eeprom_read(iobase, EE_Eth_Addr_Mid);
226 enaddr[3] = eaddr_tmp & 0xff;
227 enaddr[2] = eaddr_tmp >> 8;
228 eaddr_tmp = eeprom_read(iobase, EE_Eth_Addr_Hi);
229 enaddr[1] = eaddr_tmp & 0xff;
230 enaddr[0] = eaddr_tmp >> 8;
231
232 return;
233}
234
133ex_get_address (u_int32_t iobase, u_char *enaddr)
134{
135 u_int16_t eaddr_tmp;
136
137 eaddr_tmp = eeprom_read(iobase, EE_Eth_Addr_Lo);
138 enaddr[5] = eaddr_tmp & 0xff;
139 enaddr[4] = eaddr_tmp >> 8;
140 eaddr_tmp = eeprom_read(iobase, EE_Eth_Addr_Mid);
141 enaddr[3] = eaddr_tmp & 0xff;
142 enaddr[2] = eaddr_tmp >> 8;
143 eaddr_tmp = eeprom_read(iobase, EE_Eth_Addr_Hi);
144 enaddr[1] = eaddr_tmp & 0xff;
145 enaddr[0] = eaddr_tmp >> 8;
146
147 return;
148}
149
235static int
150int
236ex_card_type (u_char *enaddr)
237{
238 if ((enaddr[0] == 0x00) && (enaddr[1] == 0xA0) && (enaddr[2] == 0xC9))
239 return (CARD_TYPE_EX_10_PLUS);
240
241 return (CARD_TYPE_EX_10);
242}
243
244/*
151ex_card_type (u_char *enaddr)
152{
153 if ((enaddr[0] == 0x00) && (enaddr[1] == 0xA0) && (enaddr[2] == 0xC9))
154 return (CARD_TYPE_EX_10_PLUS);
155
156 return (CARD_TYPE_EX_10);
157}
158
159/*
245 * Non-destructive identify.
160 * Caller is responsible for eventually calling
161 * ex_release_resources() on failure.
246 */
162 */
247static void
248ex_isa_identify (driver_t *driver, device_t parent)
163int
164ex_alloc_resources (device_t dev)
249{
165{
250 device_t child;
251 u_int32_t ioport;
252 u_char enaddr[6];
253 u_int irq;
254 int tmp;
255 const char * desc;
166 struct ex_softc * sc = device_get_softc(dev);
167 int error = 0;
256
168
257 if (bootverbose)
258 printf("ex_isa_identify()\n");
169 sc->ioport = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->ioport_rid,
170 0, ~0, 1, RF_ACTIVE);
171 if (!sc->ioport) {
172 device_printf(dev, "No I/O space?!\n");
173 error = ENOMEM;
174 goto bad;
175 }
259
176
260 for (ioport = 0x200; ioport < 0x3a0; ioport += 0x10) {
177 sc->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->irq_rid,
178 0, ~0, 1, RF_ACTIVE);
261
179
262 /* No board found at address */
263 if (!look_for_card(ioport)) {
264 continue;
265 }
266
267 if (bootverbose)
268 printf("ex: Found card at 0x%03x!\n", ioport);
269
270 /* Board in PnP mode */
271 if (eeprom_read(ioport, EE_W0) & EE_W0_PNP) {
272 /* Reset the card. */
273 outb(ioport + CMD_REG, Reset_CMD);
274 DELAY(500);
275 if (bootverbose)
276 printf("ex: card at 0x%03x in PnP mode!\n", ioport);
277 continue;
278 }
279
280 bzero(enaddr, sizeof(enaddr));
281
282 /* Reset the card. */
283 outb(ioport + CMD_REG, Reset_CMD);
284 DELAY(400);
285
286 ex_get_address(ioport, enaddr);
287 tmp = eeprom_read(ioport, EE_W1) & EE_W1_INT_SEL;
288
289 /* work out which set of irq <-> internal tables to use */
290 if (ex_card_type(enaddr) == CARD_TYPE_EX_10_PLUS) {
291 irq = plus_ee2irqmap[tmp];
292 desc = "Intel Pro/10+";
293 } else {
294 irq = ee2irqmap[tmp];
295 desc = "Intel Pro/10";
296 }
297
298 child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "ex", -1);
299 device_set_desc_copy(child, desc);
300 device_set_driver(child, driver);
301 bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
302 bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EX_IOSIZE);
303
304 if (bootverbose)
305 printf("ex: Adding board at 0x%03x, irq %d\n", ioport, irq);
180 if (!sc->irq) {
181 device_printf(dev, "No IRQ?!\n");
182 error = ENOMEM;
183 goto bad;
306 }
307
184 }
185
308 return;
186bad:
187 return (error);
309}
310
188}
189
311static int
312ex_isa_probe(device_t dev)
190void
191ex_release_resources (device_t dev)
313{
192{
314 u_int iobase;
315 u_int irq;
316 char * irq2ee;
317 u_char * ee2irq;
318 u_char enaddr[6];
319 int tmp;
320 int error;
193 struct ex_softc * sc = device_get_softc(dev);
321
194
322 DODEBUG(Start_End, printf("ex_probe: start\n"););
323
324 /* Check isapnp ids */
325 error = ISA_PNP_PROBE(device_get_parent(dev), dev, ex_ids);
326
327 /* If the card had a PnP ID that didn't match any we know about */
328 if (error == ENXIO) {
329 return(error);
195 if (sc->ih) {
196 bus_teardown_intr(dev, sc->irq, sc->ih);
197 sc->ih = NULL;
330 }
331
198 }
199
332 /* If we had some other problem. */
333 if (!(error == 0 || error == ENOENT)) {
334 return(error);
200 if (sc->ioport) {
201 bus_release_resource(dev, SYS_RES_IOPORT,
202 sc->ioport_rid, sc->ioport);
203 sc->ioport = NULL;
335 }
336
204 }
205
337 iobase = bus_get_resource_start(dev, SYS_RES_IOPORT, 0);
338 if (!iobase) {
339 printf("ex: no iobase?\n");
340 return(ENXIO);
206 if (sc->irq) {
207 bus_release_resource(dev, SYS_RES_IRQ,
208 sc->irq_rid, sc->irq);
209 sc->irq = NULL;
341 }
342
210 }
211
343 if (!look_for_card(iobase)) {
344 printf("ex: no card found at 0x%03x\n", iobase);
345 return(ENXIO);
346 }
347
348 if (bootverbose)
349 printf("ex: ex_isa_probe() found card at 0x%03x\n", iobase);
350
351 /*
352 * Reset the card.
353 */
354 outb(iobase + CMD_REG, Reset_CMD);
355 DELAY(800);
356
357 ex_get_address(iobase, enaddr);
358
359 /* work out which set of irq <-> internal tables to use */
360 if (ex_card_type(enaddr) == CARD_TYPE_EX_10_PLUS) {
361 irq2ee = plus_irq2eemap;
362 ee2irq = plus_ee2irqmap;
363 } else {
364 irq2ee = irq2eemap;
365 ee2irq = ee2irqmap;
366 }
367
368 tmp = eeprom_read(iobase, EE_W1) & EE_W1_INT_SEL;
369 irq = bus_get_resource_start(dev, SYS_RES_IRQ, 0);
370
371 if (irq > 0) {
372 /* This will happen if board is in PnP mode. */
373 if (ee2irq[tmp] != irq) {
374 printf("ex: WARNING: board's EEPROM is configured"
375 " for IRQ %d, using %d\n",
376 ee2irq[tmp], irq);
377 }
378 } else {
379 irq = ee2irq[tmp];
380 bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1);
381 }
382
383 if (irq == 0) {
384 printf("ex: invalid IRQ.\n");
385 return(ENXIO);
386 }
387
388 DODEBUG(Start_End, printf("ex_probe: finish\n"););
389
390 return(0);
212 return;
391}
392
213}
214
393static int
394ex_isa_attach(device_t dev)
215int
216ex_attach(device_t dev)
395{
396 struct ex_softc * sc = device_get_softc(dev);
397 struct ifnet * ifp = &sc->arpcom.ac_if;
398 struct ifmedia * ifm;
399 int unit = device_get_unit(dev);
217{
218 struct ex_softc * sc = device_get_softc(dev);
219 struct ifnet * ifp = &sc->arpcom.ac_if;
220 struct ifmedia * ifm;
221 int unit = device_get_unit(dev);
400 int error;
401 int rid;
402 void * ih;
403 u_int16_t temp;
404
222 u_int16_t temp;
223
405 DODEBUG(Start_End, device_printf(dev, "start\n"););
406
407 rid = 0;
408 sc->ioport = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
409 0, ~0, 1, RF_ACTIVE);
410
411 if (!sc->ioport) {
412 device_printf(dev, "No I/O space?!\n");
413 goto bad;
414 }
415
416 rid = 0;
417 sc->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
418 0, ~0, 1, RF_ACTIVE);
419
420 if (!sc->irq) {
421 device_printf(dev, "No IRQ?!\n");
422 goto bad;
423 }
424
425 error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET,
426 ex_intr, (void *)sc, &ih);
427
428 if (error) {
429 device_printf(dev, "bus_setup_intr() failed!\n");
430 goto bad;
431 }
432
433 /*
434 * Fill in several fields of the softc structure:
435 * - I/O base address.
436 * - Hardware Ethernet address.
437 * - IRQ number (if not supplied in config file, read it from EEPROM).
438 * - Connector type.
439 */
440 sc->dev = dev;
441 sc->iobase = rman_get_start(sc->ioport);
442 sc->irq_no = rman_get_start(sc->irq);
443
444 ex_get_address(sc->iobase, sc->arpcom.ac_enaddr);
445
446 /* work out which set of irq <-> internal tables to use */
447 if (ex_card_type(sc->arpcom.ac_enaddr) == CARD_TYPE_EX_10_PLUS) {
448 sc->irq2ee = plus_irq2eemap;
449 sc->ee2irq = plus_ee2irqmap;
450 } else {
451 sc->irq2ee = irq2eemap;
452 sc->ee2irq = ee2irqmap;
453 }

--- 32 unchanged lines hidden (view full) ---

486 ex_ifmedia_upd(ifp);
487
488 /*
489 * Attach the interface.
490 */
491 if_attach(ifp);
492 ether_ifattach(ifp);
493
224 /* work out which set of irq <-> internal tables to use */
225 if (ex_card_type(sc->arpcom.ac_enaddr) == CARD_TYPE_EX_10_PLUS) {
226 sc->irq2ee = plus_irq2eemap;
227 sc->ee2irq = plus_ee2irqmap;
228 } else {
229 sc->irq2ee = irq2eemap;
230 sc->ee2irq = ee2irqmap;
231 }

--- 32 unchanged lines hidden (view full) ---

264 ex_ifmedia_upd(ifp);
265
266 /*
267 * Attach the interface.
268 */
269 if_attach(ifp);
270 ether_ifattach(ifp);
271
494 temp = eeprom_read(sc->iobase, EE_W0);
495 device_printf(sc->dev, "%s config, %s bus, ",
496 (temp & EE_W0_PNP) ? "PnP" : "Manual",
497 (temp & EE_W0_BUS16) ? "16-bit" : "8-bit");
498
499 temp = eeprom_read(sc->iobase, EE_W6);
500 printf("board id 0x%03x, stepping 0x%01x\n",
501 (temp & EE_W6_BOARD_MASK) >> EE_W6_BOARD_SHIFT,
502 temp & EE_W6_STEP_MASK);
503
504 device_printf(sc->dev, "Ethernet address %6D\n",
505 sc->arpcom.ac_enaddr, ":");
506 /*
507 * If BPF is in the kernel, call the attach for it
508 */
509 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
272 device_printf(sc->dev, "Ethernet address %6D\n",
273 sc->arpcom.ac_enaddr, ":");
274 /*
275 * If BPF is in the kernel, call the attach for it
276 */
277 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
510 DODEBUG(Start_End, printf("ex_isa_attach%d: finish\n", unit););
511
512 return(0);
278
279 return(0);
513bad:
514
515 if (sc->ioport)
516 bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->ioport);
517 if (sc->irq)
518 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
519
520 return (-1);
521}
522
280}
281
523
524static void
525ex_init(void *xsc)
526{
527 struct ex_softc * sc = (struct ex_softc *) xsc;
528 struct ifnet * ifp = &sc->arpcom.ac_if;
529 int s;
530 int i;
531 register int iobase = sc->iobase;
532 unsigned short temp_reg;
533
534 DODEBUG(Start_End, printf("ex_init%d: start\n", ifp->if_unit););
535
536 if (ifp->if_addrhead.tqh_first == NULL) {
537 return;
538 }
539 s = splimp();
282static void
283ex_init(void *xsc)
284{
285 struct ex_softc * sc = (struct ex_softc *) xsc;
286 struct ifnet * ifp = &sc->arpcom.ac_if;
287 int s;
288 int i;
289 register int iobase = sc->iobase;
290 unsigned short temp_reg;
291
292 DODEBUG(Start_End, printf("ex_init%d: start\n", ifp->if_unit););
293
294 if (ifp->if_addrhead.tqh_first == NULL) {
295 return;
296 }
297 s = splimp();
540 sc->arpcom.ac_if.if_timer = 0;
298 ifp->if_timer = 0;
541
542 /*
543 * Load the ethernet address into the card.
544 */
545 outb(iobase + CMD_REG, Bank2_Sel);
546 temp_reg = inb(iobase + EEPROM_REG);
547 if (temp_reg & Trnoff_Enable) {
548 outb(iobase + EEPROM_REG, temp_reg & ~Trnoff_Enable);

--- 268 unchanged lines hidden (view full) ---

817 outb(iobase + CMD_REG, Reset_CMD);
818 DELAY(200);
819
820 DODEBUG(Start_End, printf("ex_stop%d: finish\n", unit););
821
822 return;
823}
824
299
300 /*
301 * Load the ethernet address into the card.
302 */
303 outb(iobase + CMD_REG, Bank2_Sel);
304 temp_reg = inb(iobase + EEPROM_REG);
305 if (temp_reg & Trnoff_Enable) {
306 outb(iobase + EEPROM_REG, temp_reg & ~Trnoff_Enable);

--- 268 unchanged lines hidden (view full) ---

575 outb(iobase + CMD_REG, Reset_CMD);
576 DELAY(200);
577
578 DODEBUG(Start_End, printf("ex_stop%d: finish\n", unit););
579
580 return;
581}
582
825
826static void
583void
827ex_intr(void *arg)
828{
829 struct ex_softc * sc = (struct ex_softc *)arg;
830 struct ifnet * ifp = &sc->arpcom.ac_if;
831 int iobase = sc->iobase;
832 int int_status, send_pkts;
833
834 DODEBUG(Start_End, printf("ex_intr%d: start\n", unit););

--- 304 unchanged lines hidden (view full) ---

1139 ex_start(ifp);
1140
1141 DODEBUG(Start_End, printf("ex_watchdog%d: finish\n", ifp->if_unit););
1142
1143 return;
1144}
1145
1146static int
584ex_intr(void *arg)
585{
586 struct ex_softc * sc = (struct ex_softc *)arg;
587 struct ifnet * ifp = &sc->arpcom.ac_if;
588 int iobase = sc->iobase;
589 int int_status, send_pkts;
590
591 DODEBUG(Start_End, printf("ex_intr%d: start\n", unit););

--- 304 unchanged lines hidden (view full) ---

896 ex_start(ifp);
897
898 DODEBUG(Start_End, printf("ex_watchdog%d: finish\n", ifp->if_unit););
899
900 return;
901}
902
903static int
904ex_get_media (u_int32_t iobase)
905{
906 int tmp;
907
908 outb(iobase + CMD_REG, Bank2_Sel);
909 tmp = inb(iobase + REG3);
910 outb(iobase + CMD_REG, Bank0_Sel);
911
912 if (tmp & TPE_bit)
913 return(IFM_ETHER|IFM_10_T);
914 if (tmp & BNC_bit)
915 return(IFM_ETHER|IFM_10_2);
916
917 return (IFM_ETHER|IFM_10_5);
918}
919
920static int
1147ex_ifmedia_upd (ifp)
1148 struct ifnet * ifp;
1149{
1150 struct ex_softc * sc = ifp->if_softc;
1151
1152 return (0);
1153}
1154

--- 4 unchanged lines hidden (view full) ---

1159{
1160 struct ex_softc * sc = ifp->if_softc;
1161
1162 ifmr->ifm_active = ex_get_media(sc->iobase);
1163
1164 return;
1165}
1166
921ex_ifmedia_upd (ifp)
922 struct ifnet * ifp;
923{
924 struct ex_softc * sc = ifp->if_softc;
925
926 return (0);
927}
928

--- 4 unchanged lines hidden (view full) ---

933{
934 struct ex_softc * sc = ifp->if_softc;
935
936 ifmr->ifm_active = ex_get_media(sc->iobase);
937
938 return;
939}
940
1167static u_short
1168eeprom_read(int iobase, int location)
941u_short
942eeprom_read(u_int32_t iobase, int location)
1169{
1170 int i;
1171 u_short data = 0;
1172 int ee_addr;
1173 int read_cmd = location | EE_READ_CMD;
1174 short ctrl_val = EECS;
1175
1176 ee_addr = iobase + EEPROM_REG;

--- 28 unchanged lines hidden ---
943{
944 int i;
945 u_short data = 0;
946 int ee_addr;
947 int read_cmd = location | EE_READ_CMD;
948 short ctrl_val = EECS;
949
950 ee_addr = iobase + EEPROM_REG;

--- 28 unchanged lines hidden ---