isa.c (3224) | isa.c (3258) |
---|---|
1/*- 2 * Copyright (c) 1991 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 | 1/*- 2 * Copyright (c) 1991 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 |
37 * $Id: isa.c,v 1.25 1994/09/20 05:07:11 bde Exp $ | 37 * $Id: isa.c,v 1.26 1994/09/30 05:35:55 swallace Exp $ |
38 */ 39 40/* 41 * code to manage AT bus 42 * 43 * 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com): 44 * Fixed uninitialized variable problem and added code to deal 45 * with DMA page boundaries in isa_dmarangecheck(). Fixed word --- 266 unchanged lines hidden (view full) --- 312 for (dvp = isa_devtab_null; dvp->id_driver; dvp++) 313 register_imask(dvp, SWI_CLOCK_MASK); 314 spl0(); 315} 316 317/* 318 * Configure an ISA device. 319 */ | 38 */ 39 40/* 41 * code to manage AT bus 42 * 43 * 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com): 44 * Fixed uninitialized variable problem and added code to deal 45 * with DMA page boundaries in isa_dmarangecheck(). Fixed word --- 266 unchanged lines hidden (view full) --- 312 for (dvp = isa_devtab_null; dvp->id_driver; dvp++) 313 register_imask(dvp, SWI_CLOCK_MASK); 314 spl0(); 315} 316 317/* 318 * Configure an ISA device. 319 */ |
320 321 322static void config_isadev_c(); 323 |
|
320static void 321config_isadev(isdp, mp) | 324static void 325config_isadev(isdp, mp) |
326 struct isa_device *isdp; 327 u_int *mp; 328{ 329 config_isadev_c(isdp, mp, 0); 330} 331 332void 333reconfig_isadev(isdp, mp) |
|
322 struct isa_device *isdp; 323 u_int *mp; 324{ | 334 struct isa_device *isdp; 335 u_int *mp; 336{ |
337 config_isadev_c(isdp, mp, 1); 338} 339 340static void 341config_isadev_c(isdp, mp, reconfig) 342 struct isa_device *isdp; 343 u_int *mp; 344 int reconfig; 345{ |
|
325 u_int checkbits; 326 int id_alive; | 346 u_int checkbits; 347 int id_alive; |
348 int last_alive; |
|
327 struct isa_driver *dp = isdp->id_driver; 328 329 checkbits = 0; 330#ifndef ALLOW_CONFLICT_IRQ 331 checkbits |= CC_IRQ; 332#endif 333#ifndef ALLOW_CONFLICT_DRQ 334 checkbits |= CC_DRQ; 335#endif 336#ifndef ALLOW_CONFLICT_IOADDR 337 checkbits |= CC_IOADDR; 338#endif 339#ifndef ALLOW_CONFLICT_MEMADDR 340 checkbits |= CC_MEMADDR; 341#endif | 349 struct isa_driver *dp = isdp->id_driver; 350 351 checkbits = 0; 352#ifndef ALLOW_CONFLICT_IRQ 353 checkbits |= CC_IRQ; 354#endif 355#ifndef ALLOW_CONFLICT_DRQ 356 checkbits |= CC_DRQ; 357#endif 358#ifndef ALLOW_CONFLICT_IOADDR 359 checkbits |= CC_IOADDR; 360#endif 361#ifndef ALLOW_CONFLICT_MEMADDR 362 checkbits |= CC_MEMADDR; 363#endif |
342 if (haveseen_isadev(isdp, checkbits)) | 364 if (!reconfig && haveseen_isadev(isdp, checkbits)) |
343 return; | 365 return; |
344 if (isdp->id_maddr) { | 366 if (!reconfig && isdp->id_maddr) { |
345 isdp->id_maddr -= 0xa0000; /* XXX should be a define */ 346 isdp->id_maddr += atdevbase; 347 } | 367 isdp->id_maddr -= 0xa0000; /* XXX should be a define */ 368 isdp->id_maddr += atdevbase; 369 } |
370 if (reconfig) { 371 last_alive = isdp->id_alive; 372 } 373 else { 374 last_alive = 0; 375 } |
|
348 id_alive = (*dp->probe)(isdp); 349 if (id_alive) { 350 /* 351 * Only print the I/O address range if id_alive != -1 352 * Right now this is a temporary fix just for the new 353 * NPX code so that if it finds a 486 that can use trap 354 * 16 it will not report I/O addresses. 355 * Rod Grimes 04/26/94 356 */ | 376 id_alive = (*dp->probe)(isdp); 377 if (id_alive) { 378 /* 379 * Only print the I/O address range if id_alive != -1 380 * Right now this is a temporary fix just for the new 381 * NPX code so that if it finds a 486 that can use trap 382 * 16 it will not report I/O addresses. 383 * Rod Grimes 04/26/94 384 */ |
357 printf("%s%d", dp->name, isdp->id_unit); 358 if (id_alive != -1) { 359 printf(" at 0x%x", isdp->id_iobase); 360 if ((isdp->id_iobase + id_alive - 1) != 361 isdp->id_iobase) { 362 printf("-0x%x", 363 isdp->id_iobase + id_alive - 1); | 385 if (!isdp->id_reconfig) { 386 printf("%s%d", dp->name, isdp->id_unit); 387 if (id_alive != -1) { 388 printf(" at 0x%x", isdp->id_iobase); 389 if ((isdp->id_iobase + id_alive - 1) != 390 isdp->id_iobase) { 391 printf("-0x%x", 392 isdp->id_iobase + id_alive - 1); 393 } |
364 } | 394 } |
365 } 366 if (isdp->id_irq) 367 printf(" irq %d", ffs(isdp->id_irq) - 1); 368 if (isdp->id_drq != -1) 369 printf(" drq %d", isdp->id_drq); 370 if (isdp->id_maddr) 371 printf(" maddr 0x%lx", kvtop(isdp->id_maddr)); 372 if (isdp->id_msize) 373 printf(" msize %d", isdp->id_msize); 374 if (isdp->id_flags) 375 printf(" flags 0x%x", isdp->id_flags); 376 if (isdp->id_iobase) { 377 if (isdp->id_iobase < 0x100) { 378 printf(" on motherboard\n"); 379 } else { 380 if (isdp->id_iobase >= 0x1000) { 381 printf (" on eisa\n"); | 395 if (isdp->id_irq) 396 printf(" irq %d", ffs(isdp->id_irq) - 1); 397 if (isdp->id_drq != -1) 398 printf(" drq %d", isdp->id_drq); 399 if (isdp->id_maddr) 400 printf(" maddr 0x%lx", kvtop(isdp->id_maddr)); 401 if (isdp->id_msize) 402 printf(" msize %d", isdp->id_msize); 403 if (isdp->id_flags) 404 printf(" flags 0x%x", isdp->id_flags); 405 if (isdp->id_iobase) { 406 if (isdp->id_iobase < 0x100) { 407 printf(" on motherboard\n"); |
382 } else { | 408 } else { |
383 printf (" on isa\n"); | 409 if (isdp->id_iobase >= 0x1000) { 410 printf (" on eisa\n"); 411 } else { 412 printf (" on isa\n"); 413 } |
384 } 385 } | 414 } 415 } |
386 } 387 /* 388 * Check for conflicts again. The driver may have changed 389 * *dvp. We should weaken the early check since the 390 * driver may have been able to change *dvp to avoid 391 * conflicts if given a chance. We already skip the early 392 * check for IRQs and force a check for IRQs in the next 393 * group of checks. 394 */ | 416 /* 417 * Check for conflicts again. The driver may have 418 * changed *dvp. We should weaken the early check 419 * since the driver may have been able to change 420 * *dvp to avoid conflicts if given a chance. We 421 * already skip the early check for IRQs and force 422 * a check for IRQs in the next group of checks. 423 */ |
395#ifndef ALLOW_CONFLICT_IRQ | 424#ifndef ALLOW_CONFLICT_IRQ |
396 checkbits |= CC_IRQ; | 425 checkbits |= CC_IRQ; |
397#endif | 426#endif |
398 if (haveseen_isadev(isdp, checkbits)) 399 return; 400 isdp->id_alive = id_alive; | 427 if (haveseen_isadev(isdp, checkbits)) 428 return; 429 isdp->id_alive = id_alive; 430 } |
401 (*dp->attach)(isdp); 402 if (isdp->id_irq) { 403 if (mp) 404 INTRMASK(*mp, isdp->id_irq); 405 register_intr(ffs(isdp->id_irq) - 1, isdp->id_id, 406 isdp->id_ri_flags, isdp->id_intr, 407 mp ? *mp : 0, isdp->id_unit); 408 INTREN(isdp->id_irq); 409 } 410 } else { | 431 (*dp->attach)(isdp); 432 if (isdp->id_irq) { 433 if (mp) 434 INTRMASK(*mp, isdp->id_irq); 435 register_intr(ffs(isdp->id_irq) - 1, isdp->id_id, 436 isdp->id_ri_flags, isdp->id_intr, 437 mp ? *mp : 0, isdp->id_unit); 438 INTREN(isdp->id_irq); 439 } 440 } else { |
411 printf("%s%d not found", dp->name, isdp->id_unit); 412 if (isdp->id_iobase) { 413 printf(" at 0x%x", isdp->id_iobase); | 441 if (isdp->id_reconfig) { 442 (*dp->attach)(isdp); /* reconfiguration attach */ |
414 } | 443 } |
415 printf("\n"); | 444 if (!last_alive) { 445 if (!isdp->id_reconfig) { 446 printf("%s%d not found", dp->name, isdp->id_unit); 447 if (isdp->id_iobase) { 448 printf(" at 0x%x", isdp->id_iobase); 449 } 450 printf("\n"); 451 } 452 } 453 else { 454 /* This code has not been tested.... */ 455 if (isdp->id_irq) { 456 INTRDIS(isdp->id_irq); 457 unregister_intr(ffs(isdp->id_irq) - 1, 458 isdp->id_intr); 459 if (mp) 460 INTRUNMASK(*mp, isdp->id_irq); 461 } 462 } |
416 } 417} 418 419/* 420 * Fill in default interrupt table (in case of spuruious interrupt 421 * during configuration of kernel, setup interrupt control unit 422 */ 423void --- 416 unchanged lines hidden --- | 463 } 464} 465 466/* 467 * Fill in default interrupt table (in case of spuruious interrupt 468 * during configuration of kernel, setup interrupt control unit 469 */ 470void --- 416 unchanged lines hidden --- |