diff options
Diffstat (limited to 'drivers/pnp/isapnp/core.c')
-rw-r--r-- | drivers/pnp/isapnp/core.c | 253 |
1 files changed, 97 insertions, 156 deletions
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index f1bccdbdeb08..101a835e8759 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
@@ -429,154 +429,135 @@ static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card, | |||
429 | * Add IRQ resource to resources list. | 429 | * Add IRQ resource to resources list. |
430 | */ | 430 | */ |
431 | static void __init isapnp_parse_irq_resource(struct pnp_dev *dev, | 431 | static void __init isapnp_parse_irq_resource(struct pnp_dev *dev, |
432 | struct pnp_option *option, | 432 | unsigned int option_flags, |
433 | int size) | 433 | int size) |
434 | { | 434 | { |
435 | unsigned char tmp[3]; | 435 | unsigned char tmp[3]; |
436 | struct pnp_irq *irq; | ||
437 | unsigned long bits; | 436 | unsigned long bits; |
437 | pnp_irq_mask_t map; | ||
438 | unsigned char flags = IORESOURCE_IRQ_HIGHEDGE; | ||
438 | 439 | ||
439 | isapnp_peek(tmp, size); | 440 | isapnp_peek(tmp, size); |
440 | irq = kzalloc(sizeof(struct pnp_irq), GFP_KERNEL); | ||
441 | if (!irq) | ||
442 | return; | ||
443 | bits = (tmp[1] << 8) | tmp[0]; | 441 | bits = (tmp[1] << 8) | tmp[0]; |
444 | bitmap_copy(irq->map, &bits, 16); | 442 | |
443 | bitmap_zero(map.bits, PNP_IRQ_NR); | ||
444 | bitmap_copy(map.bits, &bits, 16); | ||
445 | |||
445 | if (size > 2) | 446 | if (size > 2) |
446 | irq->flags = tmp[2]; | 447 | flags = tmp[2]; |
447 | else | 448 | |
448 | irq->flags = IORESOURCE_IRQ_HIGHEDGE; | 449 | pnp_register_irq_resource(dev, option_flags, &map, flags); |
449 | pnp_register_irq_resource(dev, option, irq); | ||
450 | } | 450 | } |
451 | 451 | ||
452 | /* | 452 | /* |
453 | * Add DMA resource to resources list. | 453 | * Add DMA resource to resources list. |
454 | */ | 454 | */ |
455 | static void __init isapnp_parse_dma_resource(struct pnp_dev *dev, | 455 | static void __init isapnp_parse_dma_resource(struct pnp_dev *dev, |
456 | struct pnp_option *option, | 456 | unsigned int option_flags, |
457 | int size) | 457 | int size) |
458 | { | 458 | { |
459 | unsigned char tmp[2]; | 459 | unsigned char tmp[2]; |
460 | struct pnp_dma *dma; | ||
461 | 460 | ||
462 | isapnp_peek(tmp, size); | 461 | isapnp_peek(tmp, size); |
463 | dma = kzalloc(sizeof(struct pnp_dma), GFP_KERNEL); | 462 | pnp_register_dma_resource(dev, option_flags, tmp[0], tmp[1]); |
464 | if (!dma) | ||
465 | return; | ||
466 | dma->map = tmp[0]; | ||
467 | dma->flags = tmp[1]; | ||
468 | pnp_register_dma_resource(dev, option, dma); | ||
469 | } | 463 | } |
470 | 464 | ||
471 | /* | 465 | /* |
472 | * Add port resource to resources list. | 466 | * Add port resource to resources list. |
473 | */ | 467 | */ |
474 | static void __init isapnp_parse_port_resource(struct pnp_dev *dev, | 468 | static void __init isapnp_parse_port_resource(struct pnp_dev *dev, |
475 | struct pnp_option *option, | 469 | unsigned int option_flags, |
476 | int size) | 470 | int size) |
477 | { | 471 | { |
478 | unsigned char tmp[7]; | 472 | unsigned char tmp[7]; |
479 | struct pnp_port *port; | 473 | resource_size_t min, max, align, len; |
474 | unsigned char flags; | ||
480 | 475 | ||
481 | isapnp_peek(tmp, size); | 476 | isapnp_peek(tmp, size); |
482 | port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); | 477 | min = (tmp[2] << 8) | tmp[1]; |
483 | if (!port) | 478 | max = (tmp[4] << 8) | tmp[3]; |
484 | return; | 479 | align = tmp[5]; |
485 | port->min = (tmp[2] << 8) | tmp[1]; | 480 | len = tmp[6]; |
486 | port->max = (tmp[4] << 8) | tmp[3]; | 481 | flags = tmp[0] ? IORESOURCE_IO_16BIT_ADDR : 0; |
487 | port->align = tmp[5]; | 482 | pnp_register_port_resource(dev, option_flags, |
488 | port->size = tmp[6]; | 483 | min, max, align, len, flags); |
489 | port->flags = tmp[0] ? PNP_PORT_FLAG_16BITADDR : 0; | ||
490 | pnp_register_port_resource(dev, option, port); | ||
491 | } | 484 | } |
492 | 485 | ||
493 | /* | 486 | /* |
494 | * Add fixed port resource to resources list. | 487 | * Add fixed port resource to resources list. |
495 | */ | 488 | */ |
496 | static void __init isapnp_parse_fixed_port_resource(struct pnp_dev *dev, | 489 | static void __init isapnp_parse_fixed_port_resource(struct pnp_dev *dev, |
497 | struct pnp_option *option, | 490 | unsigned int option_flags, |
498 | int size) | 491 | int size) |
499 | { | 492 | { |
500 | unsigned char tmp[3]; | 493 | unsigned char tmp[3]; |
501 | struct pnp_port *port; | 494 | resource_size_t base, len; |
502 | 495 | ||
503 | isapnp_peek(tmp, size); | 496 | isapnp_peek(tmp, size); |
504 | port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); | 497 | base = (tmp[1] << 8) | tmp[0]; |
505 | if (!port) | 498 | len = tmp[2]; |
506 | return; | 499 | pnp_register_port_resource(dev, option_flags, base, base, 0, len, |
507 | port->min = port->max = (tmp[1] << 8) | tmp[0]; | 500 | IORESOURCE_IO_FIXED); |
508 | port->size = tmp[2]; | ||
509 | port->align = 0; | ||
510 | port->flags = PNP_PORT_FLAG_FIXED; | ||
511 | pnp_register_port_resource(dev, option, port); | ||
512 | } | 501 | } |
513 | 502 | ||
514 | /* | 503 | /* |
515 | * Add memory resource to resources list. | 504 | * Add memory resource to resources list. |
516 | */ | 505 | */ |
517 | static void __init isapnp_parse_mem_resource(struct pnp_dev *dev, | 506 | static void __init isapnp_parse_mem_resource(struct pnp_dev *dev, |
518 | struct pnp_option *option, | 507 | unsigned int option_flags, |
519 | int size) | 508 | int size) |
520 | { | 509 | { |
521 | unsigned char tmp[9]; | 510 | unsigned char tmp[9]; |
522 | struct pnp_mem *mem; | 511 | resource_size_t min, max, align, len; |
512 | unsigned char flags; | ||
523 | 513 | ||
524 | isapnp_peek(tmp, size); | 514 | isapnp_peek(tmp, size); |
525 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); | 515 | min = ((tmp[2] << 8) | tmp[1]) << 8; |
526 | if (!mem) | 516 | max = ((tmp[4] << 8) | tmp[3]) << 8; |
527 | return; | 517 | align = (tmp[6] << 8) | tmp[5]; |
528 | mem->min = ((tmp[2] << 8) | tmp[1]) << 8; | 518 | len = ((tmp[8] << 8) | tmp[7]) << 8; |
529 | mem->max = ((tmp[4] << 8) | tmp[3]) << 8; | 519 | flags = tmp[0]; |
530 | mem->align = (tmp[6] << 8) | tmp[5]; | 520 | pnp_register_mem_resource(dev, option_flags, |
531 | mem->size = ((tmp[8] << 8) | tmp[7]) << 8; | 521 | min, max, align, len, flags); |
532 | mem->flags = tmp[0]; | ||
533 | pnp_register_mem_resource(dev, option, mem); | ||
534 | } | 522 | } |
535 | 523 | ||
536 | /* | 524 | /* |
537 | * Add 32-bit memory resource to resources list. | 525 | * Add 32-bit memory resource to resources list. |
538 | */ | 526 | */ |
539 | static void __init isapnp_parse_mem32_resource(struct pnp_dev *dev, | 527 | static void __init isapnp_parse_mem32_resource(struct pnp_dev *dev, |
540 | struct pnp_option *option, | 528 | unsigned int option_flags, |
541 | int size) | 529 | int size) |
542 | { | 530 | { |
543 | unsigned char tmp[17]; | 531 | unsigned char tmp[17]; |
544 | struct pnp_mem *mem; | 532 | resource_size_t min, max, align, len; |
533 | unsigned char flags; | ||
545 | 534 | ||
546 | isapnp_peek(tmp, size); | 535 | isapnp_peek(tmp, size); |
547 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); | 536 | min = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1]; |
548 | if (!mem) | 537 | max = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5]; |
549 | return; | 538 | align = (tmp[12] << 24) | (tmp[11] << 16) | (tmp[10] << 8) | tmp[9]; |
550 | mem->min = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1]; | 539 | len = (tmp[16] << 24) | (tmp[15] << 16) | (tmp[14] << 8) | tmp[13]; |
551 | mem->max = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5]; | 540 | flags = tmp[0]; |
552 | mem->align = | 541 | pnp_register_mem_resource(dev, option_flags, |
553 | (tmp[12] << 24) | (tmp[11] << 16) | (tmp[10] << 8) | tmp[9]; | 542 | min, max, align, len, flags); |
554 | mem->size = | ||
555 | (tmp[16] << 24) | (tmp[15] << 16) | (tmp[14] << 8) | tmp[13]; | ||
556 | mem->flags = tmp[0]; | ||
557 | pnp_register_mem_resource(dev, option, mem); | ||
558 | } | 543 | } |
559 | 544 | ||
560 | /* | 545 | /* |
561 | * Add 32-bit fixed memory resource to resources list. | 546 | * Add 32-bit fixed memory resource to resources list. |
562 | */ | 547 | */ |
563 | static void __init isapnp_parse_fixed_mem32_resource(struct pnp_dev *dev, | 548 | static void __init isapnp_parse_fixed_mem32_resource(struct pnp_dev *dev, |
564 | struct pnp_option *option, | 549 | unsigned int option_flags, |
565 | int size) | 550 | int size) |
566 | { | 551 | { |
567 | unsigned char tmp[9]; | 552 | unsigned char tmp[9]; |
568 | struct pnp_mem *mem; | 553 | resource_size_t base, len; |
554 | unsigned char flags; | ||
569 | 555 | ||
570 | isapnp_peek(tmp, size); | 556 | isapnp_peek(tmp, size); |
571 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); | 557 | base = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1]; |
572 | if (!mem) | 558 | len = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5]; |
573 | return; | 559 | flags = tmp[0]; |
574 | mem->min = mem->max = | 560 | pnp_register_mem_resource(dev, option_flags, base, base, 0, len, flags); |
575 | (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1]; | ||
576 | mem->size = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5]; | ||
577 | mem->align = 0; | ||
578 | mem->flags = tmp[0]; | ||
579 | pnp_register_mem_resource(dev, option, mem); | ||
580 | } | 561 | } |
581 | 562 | ||
582 | /* | 563 | /* |
@@ -604,20 +585,16 @@ isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size) | |||
604 | static int __init isapnp_create_device(struct pnp_card *card, | 585 | static int __init isapnp_create_device(struct pnp_card *card, |
605 | unsigned short size) | 586 | unsigned short size) |
606 | { | 587 | { |
607 | int number = 0, skip = 0, priority = 0, compat = 0; | 588 | int number = 0, skip = 0, priority, compat = 0; |
608 | unsigned char type, tmp[17]; | 589 | unsigned char type, tmp[17]; |
609 | struct pnp_option *option; | 590 | unsigned int option_flags; |
610 | struct pnp_dev *dev; | 591 | struct pnp_dev *dev; |
611 | u32 eisa_id; | 592 | u32 eisa_id; |
612 | char id[8]; | 593 | char id[8]; |
613 | 594 | ||
614 | if ((dev = isapnp_parse_device(card, size, number++)) == NULL) | 595 | if ((dev = isapnp_parse_device(card, size, number++)) == NULL) |
615 | return 1; | 596 | return 1; |
616 | option = pnp_register_independent_option(dev); | 597 | option_flags = 0; |
617 | if (!option) { | ||
618 | kfree(dev); | ||
619 | return 1; | ||
620 | } | ||
621 | pnp_add_card_device(card, dev); | 598 | pnp_add_card_device(card, dev); |
622 | 599 | ||
623 | while (1) { | 600 | while (1) { |
@@ -634,16 +611,11 @@ static int __init isapnp_create_device(struct pnp_card *card, | |||
634 | return 1; | 611 | return 1; |
635 | size = 0; | 612 | size = 0; |
636 | skip = 0; | 613 | skip = 0; |
637 | option = pnp_register_independent_option(dev); | 614 | option_flags = 0; |
638 | if (!option) { | ||
639 | kfree(dev); | ||
640 | return 1; | ||
641 | } | ||
642 | pnp_add_card_device(card, dev); | 615 | pnp_add_card_device(card, dev); |
643 | } else { | 616 | } else { |
644 | skip = 1; | 617 | skip = 1; |
645 | } | 618 | } |
646 | priority = 0; | ||
647 | compat = 0; | 619 | compat = 0; |
648 | break; | 620 | break; |
649 | case _STAG_COMPATDEVID: | 621 | case _STAG_COMPATDEVID: |
@@ -660,44 +632,42 @@ static int __init isapnp_create_device(struct pnp_card *card, | |||
660 | case _STAG_IRQ: | 632 | case _STAG_IRQ: |
661 | if (size < 2 || size > 3) | 633 | if (size < 2 || size > 3) |
662 | goto __skip; | 634 | goto __skip; |
663 | isapnp_parse_irq_resource(dev, option, size); | 635 | isapnp_parse_irq_resource(dev, option_flags, size); |
664 | size = 0; | 636 | size = 0; |
665 | break; | 637 | break; |
666 | case _STAG_DMA: | 638 | case _STAG_DMA: |
667 | if (size != 2) | 639 | if (size != 2) |
668 | goto __skip; | 640 | goto __skip; |
669 | isapnp_parse_dma_resource(dev, option, size); | 641 | isapnp_parse_dma_resource(dev, option_flags, size); |
670 | size = 0; | 642 | size = 0; |
671 | break; | 643 | break; |
672 | case _STAG_STARTDEP: | 644 | case _STAG_STARTDEP: |
673 | if (size > 1) | 645 | if (size > 1) |
674 | goto __skip; | 646 | goto __skip; |
675 | priority = 0x100 | PNP_RES_PRIORITY_ACCEPTABLE; | 647 | priority = PNP_RES_PRIORITY_ACCEPTABLE; |
676 | if (size > 0) { | 648 | if (size > 0) { |
677 | isapnp_peek(tmp, size); | 649 | isapnp_peek(tmp, size); |
678 | priority = 0x100 | tmp[0]; | 650 | priority = tmp[0]; |
679 | size = 0; | 651 | size = 0; |
680 | } | 652 | } |
681 | option = pnp_register_dependent_option(dev, priority); | 653 | option_flags = pnp_new_dependent_set(dev, priority); |
682 | if (!option) | ||
683 | return 1; | ||
684 | break; | 654 | break; |
685 | case _STAG_ENDDEP: | 655 | case _STAG_ENDDEP: |
686 | if (size != 0) | 656 | if (size != 0) |
687 | goto __skip; | 657 | goto __skip; |
688 | priority = 0; | 658 | option_flags = 0; |
689 | dev_dbg(&dev->dev, "end dependent options\n"); | ||
690 | break; | 659 | break; |
691 | case _STAG_IOPORT: | 660 | case _STAG_IOPORT: |
692 | if (size != 7) | 661 | if (size != 7) |
693 | goto __skip; | 662 | goto __skip; |
694 | isapnp_parse_port_resource(dev, option, size); | 663 | isapnp_parse_port_resource(dev, option_flags, size); |
695 | size = 0; | 664 | size = 0; |
696 | break; | 665 | break; |
697 | case _STAG_FIXEDIO: | 666 | case _STAG_FIXEDIO: |
698 | if (size != 3) | 667 | if (size != 3) |
699 | goto __skip; | 668 | goto __skip; |
700 | isapnp_parse_fixed_port_resource(dev, option, size); | 669 | isapnp_parse_fixed_port_resource(dev, option_flags, |
670 | size); | ||
701 | size = 0; | 671 | size = 0; |
702 | break; | 672 | break; |
703 | case _STAG_VENDOR: | 673 | case _STAG_VENDOR: |
@@ -705,7 +675,7 @@ static int __init isapnp_create_device(struct pnp_card *card, | |||
705 | case _LTAG_MEMRANGE: | 675 | case _LTAG_MEMRANGE: |
706 | if (size != 9) | 676 | if (size != 9) |
707 | goto __skip; | 677 | goto __skip; |
708 | isapnp_parse_mem_resource(dev, option, size); | 678 | isapnp_parse_mem_resource(dev, option_flags, size); |
709 | size = 0; | 679 | size = 0; |
710 | break; | 680 | break; |
711 | case _LTAG_ANSISTR: | 681 | case _LTAG_ANSISTR: |
@@ -720,13 +690,14 @@ static int __init isapnp_create_device(struct pnp_card *card, | |||
720 | case _LTAG_MEM32RANGE: | 690 | case _LTAG_MEM32RANGE: |
721 | if (size != 17) | 691 | if (size != 17) |
722 | goto __skip; | 692 | goto __skip; |
723 | isapnp_parse_mem32_resource(dev, option, size); | 693 | isapnp_parse_mem32_resource(dev, option_flags, size); |
724 | size = 0; | 694 | size = 0; |
725 | break; | 695 | break; |
726 | case _LTAG_FIXEDMEM32RANGE: | 696 | case _LTAG_FIXEDMEM32RANGE: |
727 | if (size != 9) | 697 | if (size != 9) |
728 | goto __skip; | 698 | goto __skip; |
729 | isapnp_parse_fixed_mem32_resource(dev, option, size); | 699 | isapnp_parse_fixed_mem32_resource(dev, option_flags, |
700 | size); | ||
730 | size = 0; | 701 | size = 0; |
731 | break; | 702 | break; |
732 | case _STAG_END: | 703 | case _STAG_END: |
@@ -928,7 +899,6 @@ EXPORT_SYMBOL(isapnp_write_byte); | |||
928 | 899 | ||
929 | static int isapnp_get_resources(struct pnp_dev *dev) | 900 | static int isapnp_get_resources(struct pnp_dev *dev) |
930 | { | 901 | { |
931 | struct pnp_resource *pnp_res; | ||
932 | int i, ret; | 902 | int i, ret; |
933 | 903 | ||
934 | dev_dbg(&dev->dev, "get resources\n"); | 904 | dev_dbg(&dev->dev, "get resources\n"); |
@@ -940,35 +910,23 @@ static int isapnp_get_resources(struct pnp_dev *dev) | |||
940 | 910 | ||
941 | for (i = 0; i < ISAPNP_MAX_PORT; i++) { | 911 | for (i = 0; i < ISAPNP_MAX_PORT; i++) { |
942 | ret = isapnp_read_word(ISAPNP_CFG_PORT + (i << 1)); | 912 | ret = isapnp_read_word(ISAPNP_CFG_PORT + (i << 1)); |
943 | if (ret) { | 913 | pnp_add_io_resource(dev, ret, ret, |
944 | pnp_res = pnp_add_io_resource(dev, ret, ret, 0); | 914 | ret == 0 ? IORESOURCE_DISABLED : 0); |
945 | if (pnp_res) | ||
946 | pnp_res->index = i; | ||
947 | } | ||
948 | } | 915 | } |
949 | for (i = 0; i < ISAPNP_MAX_MEM; i++) { | 916 | for (i = 0; i < ISAPNP_MAX_MEM; i++) { |
950 | ret = isapnp_read_word(ISAPNP_CFG_MEM + (i << 3)) << 8; | 917 | ret = isapnp_read_word(ISAPNP_CFG_MEM + (i << 3)) << 8; |
951 | if (ret) { | 918 | pnp_add_mem_resource(dev, ret, ret, |
952 | pnp_res = pnp_add_mem_resource(dev, ret, ret, 0); | 919 | ret == 0 ? IORESOURCE_DISABLED : 0); |
953 | if (pnp_res) | ||
954 | pnp_res->index = i; | ||
955 | } | ||
956 | } | 920 | } |
957 | for (i = 0; i < ISAPNP_MAX_IRQ; i++) { | 921 | for (i = 0; i < ISAPNP_MAX_IRQ; i++) { |
958 | ret = isapnp_read_word(ISAPNP_CFG_IRQ + (i << 1)) >> 8; | 922 | ret = isapnp_read_word(ISAPNP_CFG_IRQ + (i << 1)) >> 8; |
959 | if (ret) { | 923 | pnp_add_irq_resource(dev, ret, |
960 | pnp_res = pnp_add_irq_resource(dev, ret, 0); | 924 | ret == 0 ? IORESOURCE_DISABLED : 0); |
961 | if (pnp_res) | ||
962 | pnp_res->index = i; | ||
963 | } | ||
964 | } | 925 | } |
965 | for (i = 0; i < ISAPNP_MAX_DMA; i++) { | 926 | for (i = 0; i < ISAPNP_MAX_DMA; i++) { |
966 | ret = isapnp_read_byte(ISAPNP_CFG_DMA + i); | 927 | ret = isapnp_read_byte(ISAPNP_CFG_DMA + i); |
967 | if (ret != 4) { | 928 | pnp_add_dma_resource(dev, ret, |
968 | pnp_res = pnp_add_dma_resource(dev, ret, 0); | 929 | ret == 4 ? IORESOURCE_DISABLED : 0); |
969 | if (pnp_res) | ||
970 | pnp_res->index = i; | ||
971 | } | ||
972 | } | 930 | } |
973 | 931 | ||
974 | __end: | 932 | __end: |
@@ -978,62 +936,45 @@ __end: | |||
978 | 936 | ||
979 | static int isapnp_set_resources(struct pnp_dev *dev) | 937 | static int isapnp_set_resources(struct pnp_dev *dev) |
980 | { | 938 | { |
981 | struct pnp_resource *pnp_res; | ||
982 | struct resource *res; | 939 | struct resource *res; |
983 | int tmp, index; | 940 | int tmp; |
984 | 941 | ||
985 | dev_dbg(&dev->dev, "set resources\n"); | 942 | dev_dbg(&dev->dev, "set resources\n"); |
986 | isapnp_cfg_begin(dev->card->number, dev->number); | 943 | isapnp_cfg_begin(dev->card->number, dev->number); |
987 | dev->active = 1; | 944 | dev->active = 1; |
988 | for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) { | 945 | for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) { |
989 | pnp_res = pnp_get_pnp_resource(dev, IORESOURCE_IO, tmp); | 946 | res = pnp_get_resource(dev, IORESOURCE_IO, tmp); |
990 | if (!pnp_res) | 947 | if (pnp_resource_enabled(res)) { |
991 | continue; | ||
992 | res = &pnp_res->res; | ||
993 | if (pnp_resource_valid(res)) { | ||
994 | index = pnp_res->index; | ||
995 | dev_dbg(&dev->dev, " set io %d to %#llx\n", | 948 | dev_dbg(&dev->dev, " set io %d to %#llx\n", |
996 | index, (unsigned long long) res->start); | 949 | tmp, (unsigned long long) res->start); |
997 | isapnp_write_word(ISAPNP_CFG_PORT + (index << 1), | 950 | isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1), |
998 | res->start); | 951 | res->start); |
999 | } | 952 | } |
1000 | } | 953 | } |
1001 | for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) { | 954 | for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) { |
1002 | pnp_res = pnp_get_pnp_resource(dev, IORESOURCE_IRQ, tmp); | 955 | res = pnp_get_resource(dev, IORESOURCE_IRQ, tmp); |
1003 | if (!pnp_res) | 956 | if (pnp_resource_enabled(res)) { |
1004 | continue; | ||
1005 | res = &pnp_res->res; | ||
1006 | if (pnp_resource_valid(res)) { | ||
1007 | int irq = res->start; | 957 | int irq = res->start; |
1008 | if (irq == 2) | 958 | if (irq == 2) |
1009 | irq = 9; | 959 | irq = 9; |
1010 | index = pnp_res->index; | 960 | dev_dbg(&dev->dev, " set irq %d to %d\n", tmp, irq); |
1011 | dev_dbg(&dev->dev, " set irq %d to %d\n", index, irq); | 961 | isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq); |
1012 | isapnp_write_byte(ISAPNP_CFG_IRQ + (index << 1), irq); | ||
1013 | } | 962 | } |
1014 | } | 963 | } |
1015 | for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) { | 964 | for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) { |
1016 | pnp_res = pnp_get_pnp_resource(dev, IORESOURCE_DMA, tmp); | 965 | res = pnp_get_resource(dev, IORESOURCE_DMA, tmp); |
1017 | if (!pnp_res) | 966 | if (pnp_resource_enabled(res)) { |
1018 | continue; | ||
1019 | res = &pnp_res->res; | ||
1020 | if (pnp_resource_valid(res)) { | ||
1021 | index = pnp_res->index; | ||
1022 | dev_dbg(&dev->dev, " set dma %d to %lld\n", | 967 | dev_dbg(&dev->dev, " set dma %d to %lld\n", |
1023 | index, (unsigned long long) res->start); | 968 | tmp, (unsigned long long) res->start); |
1024 | isapnp_write_byte(ISAPNP_CFG_DMA + index, res->start); | 969 | isapnp_write_byte(ISAPNP_CFG_DMA + tmp, res->start); |
1025 | } | 970 | } |
1026 | } | 971 | } |
1027 | for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) { | 972 | for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) { |
1028 | pnp_res = pnp_get_pnp_resource(dev, IORESOURCE_MEM, tmp); | 973 | res = pnp_get_resource(dev, IORESOURCE_MEM, tmp); |
1029 | if (!pnp_res) | 974 | if (pnp_resource_enabled(res)) { |
1030 | continue; | ||
1031 | res = &pnp_res->res; | ||
1032 | if (pnp_resource_valid(res)) { | ||
1033 | index = pnp_res->index; | ||
1034 | dev_dbg(&dev->dev, " set mem %d to %#llx\n", | 975 | dev_dbg(&dev->dev, " set mem %d to %#llx\n", |
1035 | index, (unsigned long long) res->start); | 976 | tmp, (unsigned long long) res->start); |
1036 | isapnp_write_word(ISAPNP_CFG_MEM + (index << 3), | 977 | isapnp_write_word(ISAPNP_CFG_MEM + (tmp << 3), |
1037 | (res->start >> 8) & 0xffff); | 978 | (res->start >> 8) & 0xffff); |
1038 | } | 979 | } |
1039 | } | 980 | } |