if_ex.c (57987) | if_ex.c (57989) |
---|---|
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 57987 2000-03-13 12:23:32Z mdodd $ | 27 * $FreeBSD: head/sys/dev/ex/if_ex.c 57989 2000-03-13 12:27:21Z 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 * --- 214 unchanged lines hidden (view full) --- 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 | 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 * --- 214 unchanged lines hidden (view full) --- 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 if (bootverbose) 259 printf("ex_isa_identify()\n"); 260 |
|
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 | 261 for (ioport = 0x200; ioport < 0x3a0; ioport += 0x10) { 262 263 /* No board found at address */ 264 if (!look_for_card(ioport)) { 265 continue; 266 } 267 |
268 if (bootverbose) 269 printf("ex: Found card at 0x%03x!\n", ioport); 270 |
|
265 /* Board in PnP mode */ | 271 /* Board in PnP mode */ |
266 if (eeprom_read(ioport, 0) & 0x01) { | 272 if (eeprom_read(ioport, EE_W0) & EE_W0_PNP) { 273 /* Reset the card. */ 274 outb(ioport + CMD_REG, Reset_CMD); 275 DELAY(500); 276 if (bootverbose) 277 printf("ex: card at 0x%03x in PnP mode!\n", ioport); |
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); | 278 continue; 279 } 280 281 bzero(enaddr, sizeof(enaddr)); 282 283 /* Reset the card. */ 284 outb(ioport + CMD_REG, Reset_CMD); 285 DELAY(400); 286 287 ex_get_address(ioport, enaddr); |
277 tmp = eeprom_read(ioport, EE_IRQ_No) & IRQ_No_Mask; | 288 tmp = eeprom_read(ioport, EE_W1) & EE_W1_INT_SEL; |
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); | 289 290 /* work out which set of irq <-> internal tables to use */ 291 if (ex_card_type(enaddr) == CARD_TYPE_EX_10_PLUS) { 292 irq = plus_ee2irqmap[tmp]; 293 desc = "Intel Pro/10+"; 294 } else { 295 irq = ee2irqmap[tmp]; 296 desc = "Intel Pro/10"; 297 } 298 299 child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "ex", -1); 300 device_set_desc_copy(child, desc); 301 device_set_driver(child, driver); 302 bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1); 303 bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EX_IOSIZE); |
304 305 if (bootverbose) 306 printf("ex: Adding board at 0x%03x, irq %d\n", ioport, irq); |
|
293 } 294 295 return; 296} 297 298static int 299ex_isa_probe(device_t dev) 300{ --- 16 unchanged lines hidden (view full) --- 317 } 318 319 /* If we had some other problem. */ 320 if (!(error == 0 || error == ENOENT)) { 321 return(error); 322 } 323 324 iobase = bus_get_resource_start(dev, SYS_RES_IOPORT, 0); | 307 } 308 309 return; 310} 311 312static int 313ex_isa_probe(device_t dev) 314{ --- 16 unchanged lines hidden (view full) --- 331 } 332 333 /* If we had some other problem. */ 334 if (!(error == 0 || error == ENOENT)) { 335 return(error); 336 } 337 338 iobase = bus_get_resource_start(dev, SYS_RES_IOPORT, 0); |
325 if (iobase && !look_for_card(iobase)) { | 339 if (!iobase) { 340 printf("ex: no iobase?\n"); 341 return(ENXIO); 342 } 343 344 if (!look_for_card(iobase)) { |
326 printf("ex: no card found at 0x%03x\n", iobase); 327 return(ENXIO); 328 } 329 | 345 printf("ex: no card found at 0x%03x\n", iobase); 346 return(ENXIO); 347 } 348 |
349 if (bootverbose) 350 printf("ex: ex_isa_probe() found card at 0x%03x\n", iobase); 351 |
|
330 /* 331 * Reset the card. 332 */ 333 outb(iobase + CMD_REG, Reset_CMD); | 352 /* 353 * Reset the card. 354 */ 355 outb(iobase + CMD_REG, Reset_CMD); |
334 DELAY(400); | 356 DELAY(800); |
335 336 ex_get_address(iobase, enaddr); 337 338 /* work out which set of irq <-> internal tables to use */ 339 if (ex_card_type(enaddr) == CARD_TYPE_EX_10_PLUS) { 340 irq2ee = plus_irq2eemap; 341 ee2irq = plus_ee2irqmap; 342 } else { 343 irq2ee = irq2eemap; 344 ee2irq = ee2irqmap; 345 } 346 | 357 358 ex_get_address(iobase, enaddr); 359 360 /* work out which set of irq <-> internal tables to use */ 361 if (ex_card_type(enaddr) == CARD_TYPE_EX_10_PLUS) { 362 irq2ee = plus_irq2eemap; 363 ee2irq = plus_ee2irqmap; 364 } else { 365 irq2ee = irq2eemap; 366 ee2irq = ee2irqmap; 367 } 368 |
347 tmp = eeprom_read(iobase, EE_IRQ_No) & IRQ_No_Mask; | 369 tmp = eeprom_read(iobase, EE_W1) & EE_W1_INT_SEL; |
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. */ 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); --- 828 unchanged lines hidden --- | 370 irq = bus_get_resource_start(dev, SYS_RES_IRQ, 0); 371 372 if (irq > 0) { 373 /* This will happen if board is in PnP mode. */ 374 if (ee2irq[tmp] != irq) { 375 printf("ex: WARNING: board's EEPROM is configured" 376 " for IRQ %d, using %d\n", 377 ee2irq[tmp], irq); --- 828 unchanged lines hidden --- |