Deleted Added
full compact
if_ex.c (55881) if_ex.c (55882)
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 55881 2000-01-13 06:46:02Z mdodd $
27 * $FreeBSD: head/sys/dev/ex/if_ex.c 55882 2000-01-13 06:52:51Z 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 *

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

132 { 9, 3, 5, 10, 11, 0, 0, 0 };
133
134static char plus_irq2eemap[] =
135 { -1, -1, -1, 0, 1, 2, -1, 3, -1, 4, 5, 6, 7, -1, -1, -1 };
136static u_char plus_ee2irqmap[] =
137 { 3, 4, 5, 7, 9, 10, 11, 12 };
138
139/* Bus Front End Functions */
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 *

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

132 { 9, 3, 5, 10, 11, 0, 0, 0 };
133
134static char plus_irq2eemap[] =
135 { -1, -1, -1, 0, 1, 2, -1, 3, -1, 4, 5, 6, 7, -1, -1, -1 };
136static u_char plus_ee2irqmap[] =
137 { 3, 4, 5, 7, 9, 10, 11, 12 };
138
139/* Bus Front End Functions */
140static void ex_isa_identify __P((driver_t *, device_t));
140static int ex_isa_probe __P((device_t));
141static int ex_attach __P((device_t));
142
143/* Network Interface Functions */
144static void ex_init __P((void *));
145static void ex_start __P((struct ifnet *));
146static int ex_ioctl __P((struct ifnet *, u_long, caddr_t));
147static void ex_watchdog __P((struct ifnet *));

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

152static driver_intr_t exintr;
153static void ex_tx_intr __P((struct ex_softc *));
154static void ex_rx_intr __P((struct ex_softc *));
155
156static u_short eeprom_read __P((int, int));
157
158static device_method_t ex_methods[] = {
159 /* Device interface */
141static int ex_isa_probe __P((device_t));
142static int ex_attach __P((device_t));
143
144/* Network Interface Functions */
145static void ex_init __P((void *));
146static void ex_start __P((struct ifnet *));
147static int ex_ioctl __P((struct ifnet *, u_long, caddr_t));
148static void ex_watchdog __P((struct ifnet *));

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

153static driver_intr_t exintr;
154static void ex_tx_intr __P((struct ex_softc *));
155static void ex_rx_intr __P((struct ex_softc *));
156
157static u_short eeprom_read __P((int, int));
158
159static device_method_t ex_methods[] = {
160 /* Device interface */
161 DEVMETHOD(device_identify, ex_isa_identify),
160 DEVMETHOD(device_probe, ex_isa_probe),
161 DEVMETHOD(device_attach, ex_attach),
162
163 { 0, 0 }
164};
165
166static driver_t ex_driver = {
167 "ex",

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

235ex_card_type (u_char *enaddr)
236{
237 if ((enaddr[0] == 0x00) && (enaddr[1] == 0xA0) && (enaddr[2] == 0xC9))
238 return (CARD_TYPE_EX_10_PLUS);
239
240 return (CARD_TYPE_EX_10);
241}
242
162 DEVMETHOD(device_probe, ex_isa_probe),
163 DEVMETHOD(device_attach, ex_attach),
164
165 { 0, 0 }
166};
167
168static driver_t ex_driver = {
169 "ex",

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

237ex_card_type (u_char *enaddr)
238{
239 if ((enaddr[0] == 0x00) && (enaddr[1] == 0xA0) && (enaddr[2] == 0xC9))
240 return (CARD_TYPE_EX_10_PLUS);
241
242 return (CARD_TYPE_EX_10);
243}
244
245/*
246 * Non-destructive identify.
247 */
248static void
249ex_isa_identify (driver_t *driver, device_t parent)
250{
251 device_t child;
252 u_int32_t ioport;
253 u_char enaddr[6];
254 u_int irq;
255 int tmp;
256 const char * desc;
257
258 for (ioport = 0x200; ioport < 0x3a0; ioport += 0x10) {
259
260 /* No board found at address */
261 if (!look_for_card(ioport)) {
262 continue;
263 }
264
265 /* Board in PnP mode */
266 if (eeprom_read(ioport, 0) & 0x01) {
267 continue;
268 }
269
270 bzero(enaddr, sizeof(enaddr));
271
272 /* Reset the card. */
273 outb(ioport + CMD_REG, Reset_CMD);
274 DELAY(400);
275
276 ex_get_address(ioport, enaddr);
277 tmp = eeprom_read(ioport, EE_IRQ_No) & IRQ_No_Mask;
278
279 /* work out which set of irq <-> internal tables to use */
280 if (ex_card_type(enaddr) == CARD_TYPE_EX_10_PLUS) {
281 irq = plus_ee2irqmap[tmp];
282 desc = "Intel Pro/10+";
283 } else {
284 irq = ee2irqmap[tmp];
285 desc = "Intel Pro/10";
286 }
287
288 child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "ex", -1);
289 device_set_desc_copy(child, desc);
290 device_set_driver(child, driver);
291 bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
292 bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EX_IOSIZE);
293 }
294
295 return;
296}
297
243static int
244ex_isa_probe(device_t dev)
245{
246 u_int iobase;
247 u_int irq;
248 char * irq2ee;
249 u_char * ee2irq;
250 u_char enaddr[6];

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

261 return(error);
262 }
263
264 /* If we had some other problem. */
265 if (!(error == 0 || error == ENOENT)) {
266 return(error);
267 }
268
298static int
299ex_isa_probe(device_t dev)
300{
301 u_int iobase;
302 u_int irq;
303 char * irq2ee;
304 u_char * ee2irq;
305 u_char enaddr[6];

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

316 return(error);
317 }
318
319 /* If we had some other problem. */
320 if (!(error == 0 || error == ENOENT)) {
321 return(error);
322 }
323
269 /*
270 * If an I/O address was supplied in the configuration file
271 * or by PnP ,probe only that. Otherwise, cycle through the
272 * predefined set of possible addresses.
273 * This should really be a bus enumerator ala DEVICE_IDENTFY()
274 */
275 iobase = bus_get_resource_start(dev, SYS_RES_IOPORT, 0);
324 iobase = bus_get_resource_start(dev, SYS_RES_IOPORT, 0);
276 if (iobase != 0) {
277 if (! look_for_card(iobase)) {
278 printf("ex: no card found at 0x%03x\n", iobase);
279 return(ENXIO);
280 }
281 } else {
282 for (iobase = 0x200; iobase < 0x3a0; iobase += 0x10) {
283 if (look_for_card(iobase))
284 break;
285 }
286 if (iobase >= 0x3a0) {
287 return(ENXIO);
288 } else {
289 bus_set_resource(dev, SYS_RES_IOPORT, 0,
290 iobase, EX_IOSIZE);
291 }
325 if (iobase && !look_for_card(iobase)) {
326 printf("ex: no card found at 0x%03x\n", iobase);
327 return(ENXIO);
292 }
293
294 /*
295 * Reset the card.
296 */
297 outb(iobase + CMD_REG, Reset_CMD);
298 DELAY(400);
299

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

307 irq2ee = irq2eemap;
308 ee2irq = ee2irqmap;
309 }
310
311 tmp = eeprom_read(iobase, EE_IRQ_No) & IRQ_No_Mask;
312 irq = bus_get_resource_start(dev, SYS_RES_IRQ, 0);
313
314 if (irq > 0) {
328 }
329
330 /*
331 * Reset the card.
332 */
333 outb(iobase + CMD_REG, Reset_CMD);
334 DELAY(400);
335

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

343 irq2ee = irq2eemap;
344 ee2irq = ee2irqmap;
345 }
346
347 tmp = eeprom_read(iobase, EE_IRQ_No) & IRQ_No_Mask;
348 irq = bus_get_resource_start(dev, SYS_RES_IRQ, 0);
349
350 if (irq > 0) {
351 /* This will happen if board is in PnP mode. */
315 if (ee2irq[tmp] != irq) {
316 printf("ex: WARNING: board's EEPROM is configured"
317 " for IRQ %d, using %d\n",
318 ee2irq[tmp], irq);
319 }
320 } else {
321 irq = ee2irq[tmp];
322 bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1);

--- 785 unchanged lines hidden ---
352 if (ee2irq[tmp] != irq) {
353 printf("ex: WARNING: board's EEPROM is configured"
354 " for IRQ %d, using %d\n",
355 ee2irq[tmp], irq);
356 }
357 } else {
358 irq = ee2irq[tmp];
359 bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1);

--- 785 unchanged lines hidden ---