diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:34:07 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:21 -0400 |
commit | 72dcc883d8e5b59105e75ee5265442e458740575 (patch) | |
tree | abe950093416aba615a92c6653f2d32f37a58d45 /drivers/pnp/pnpbios/rsparser.c | |
parent | 4ab55d8d4f7b910c4c60e0f8ff70d0dfdd484f02 (diff) |
PNP: add debug output to encoders
Add debug output to encoders (enabled by CONFIG_PNP_DEBUG). This
uses dev_printk, so I had to add pnp_dev arguments at the same time.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-By: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/pnpbios/rsparser.c')
-rw-r--r-- | drivers/pnp/pnpbios/rsparser.c | 58 |
1 files changed, 44 insertions, 14 deletions
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index 1b8f30ff192a..7428f62db4d2 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c | |||
@@ -143,6 +143,8 @@ static unsigned char *pnpbios_parse_allocated_resource_data(struct pnp_dev *dev, | |||
143 | if (!p) | 143 | if (!p) |
144 | return NULL; | 144 | return NULL; |
145 | 145 | ||
146 | dev_dbg(&dev->dev, "parse allocated resources\n"); | ||
147 | |||
146 | /* Blank the resource table values */ | 148 | /* Blank the resource table values */ |
147 | pnp_init_resource_table(&dev->res); | 149 | pnp_init_resource_table(&dev->res); |
148 | 150 | ||
@@ -390,6 +392,8 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end, | |||
390 | if (!p) | 392 | if (!p) |
391 | return NULL; | 393 | return NULL; |
392 | 394 | ||
395 | dev_dbg(&dev->dev, "parse resource options\n"); | ||
396 | |||
393 | option_independent = option = pnp_register_independent_option(dev); | 397 | option_independent = option = pnp_register_independent_option(dev); |
394 | if (!option) | 398 | if (!option) |
395 | return NULL; | 399 | return NULL; |
@@ -574,7 +578,8 @@ len_err: | |||
574 | * Allocated Resource Encoding | 578 | * Allocated Resource Encoding |
575 | */ | 579 | */ |
576 | 580 | ||
577 | static void pnpbios_encode_mem(unsigned char *p, struct resource *res) | 581 | static void pnpbios_encode_mem(struct pnp_dev *dev, unsigned char *p, |
582 | struct resource *res) | ||
578 | { | 583 | { |
579 | unsigned long base = res->start; | 584 | unsigned long base = res->start; |
580 | unsigned long len = res->end - res->start + 1; | 585 | unsigned long len = res->end - res->start + 1; |
@@ -585,9 +590,13 @@ static void pnpbios_encode_mem(unsigned char *p, struct resource *res) | |||
585 | p[7] = ((base >> 8) >> 8) & 0xff; | 590 | p[7] = ((base >> 8) >> 8) & 0xff; |
586 | p[10] = (len >> 8) & 0xff; | 591 | p[10] = (len >> 8) & 0xff; |
587 | p[11] = ((len >> 8) >> 8) & 0xff; | 592 | p[11] = ((len >> 8) >> 8) & 0xff; |
593 | |||
594 | dev_dbg(&dev->dev, " encode mem %#llx-%#llx\n", | ||
595 | (unsigned long long) res->start, (unsigned long long) res->end); | ||
588 | } | 596 | } |
589 | 597 | ||
590 | static void pnpbios_encode_mem32(unsigned char *p, struct resource *res) | 598 | static void pnpbios_encode_mem32(struct pnp_dev *dev, unsigned char *p, |
599 | struct resource *res) | ||
591 | { | 600 | { |
592 | unsigned long base = res->start; | 601 | unsigned long base = res->start; |
593 | unsigned long len = res->end - res->start + 1; | 602 | unsigned long len = res->end - res->start + 1; |
@@ -604,9 +613,13 @@ static void pnpbios_encode_mem32(unsigned char *p, struct resource *res) | |||
604 | p[17] = (len >> 8) & 0xff; | 613 | p[17] = (len >> 8) & 0xff; |
605 | p[18] = (len >> 16) & 0xff; | 614 | p[18] = (len >> 16) & 0xff; |
606 | p[19] = (len >> 24) & 0xff; | 615 | p[19] = (len >> 24) & 0xff; |
616 | |||
617 | dev_dbg(&dev->dev, " encode mem32 %#llx-%#llx\n", | ||
618 | (unsigned long long) res->start, (unsigned long long) res->end); | ||
607 | } | 619 | } |
608 | 620 | ||
609 | static void pnpbios_encode_fixed_mem32(unsigned char *p, struct resource *res) | 621 | static void pnpbios_encode_fixed_mem32(struct pnp_dev *dev, unsigned char *p, |
622 | struct resource *res) | ||
610 | { | 623 | { |
611 | unsigned long base = res->start; | 624 | unsigned long base = res->start; |
612 | unsigned long len = res->end - res->start + 1; | 625 | unsigned long len = res->end - res->start + 1; |
@@ -619,26 +632,36 @@ static void pnpbios_encode_fixed_mem32(unsigned char *p, struct resource *res) | |||
619 | p[9] = (len >> 8) & 0xff; | 632 | p[9] = (len >> 8) & 0xff; |
620 | p[10] = (len >> 16) & 0xff; | 633 | p[10] = (len >> 16) & 0xff; |
621 | p[11] = (len >> 24) & 0xff; | 634 | p[11] = (len >> 24) & 0xff; |
635 | |||
636 | dev_dbg(&dev->dev, " encode fixed_mem32 %#llx-%#llx\n", | ||
637 | (unsigned long long) res->start, (unsigned long long) res->end); | ||
622 | } | 638 | } |
623 | 639 | ||
624 | static void pnpbios_encode_irq(unsigned char *p, struct resource *res) | 640 | static void pnpbios_encode_irq(struct pnp_dev *dev, unsigned char *p, |
641 | struct resource *res) | ||
625 | { | 642 | { |
626 | unsigned long map = 0; | 643 | unsigned long map = 0; |
627 | 644 | ||
628 | map = 1 << res->start; | 645 | map = 1 << res->start; |
629 | p[1] = map & 0xff; | 646 | p[1] = map & 0xff; |
630 | p[2] = (map >> 8) & 0xff; | 647 | p[2] = (map >> 8) & 0xff; |
648 | |||
649 | dev_dbg(&dev->dev, " encode irq %d\n", res->start); | ||
631 | } | 650 | } |
632 | 651 | ||
633 | static void pnpbios_encode_dma(unsigned char *p, struct resource *res) | 652 | static void pnpbios_encode_dma(struct pnp_dev *dev, unsigned char *p, |
653 | struct resource *res) | ||
634 | { | 654 | { |
635 | unsigned long map = 0; | 655 | unsigned long map = 0; |
636 | 656 | ||
637 | map = 1 << res->start; | 657 | map = 1 << res->start; |
638 | p[1] = map & 0xff; | 658 | p[1] = map & 0xff; |
659 | |||
660 | dev_dbg(&dev->dev, " encode dma %d\n", res->start); | ||
639 | } | 661 | } |
640 | 662 | ||
641 | static void pnpbios_encode_port(unsigned char *p, struct resource *res) | 663 | static void pnpbios_encode_port(struct pnp_dev *dev, unsigned char *p, |
664 | struct resource *res) | ||
642 | { | 665 | { |
643 | unsigned long base = res->start; | 666 | unsigned long base = res->start; |
644 | unsigned long len = res->end - res->start + 1; | 667 | unsigned long len = res->end - res->start + 1; |
@@ -648,9 +671,13 @@ static void pnpbios_encode_port(unsigned char *p, struct resource *res) | |||
648 | p[4] = base & 0xff; | 671 | p[4] = base & 0xff; |
649 | p[5] = (base >> 8) & 0xff; | 672 | p[5] = (base >> 8) & 0xff; |
650 | p[7] = len & 0xff; | 673 | p[7] = len & 0xff; |
674 | |||
675 | dev_dbg(&dev->dev, " encode io %#llx-%#llx\n", | ||
676 | (unsigned long long) res->start, (unsigned long long) res->end); | ||
651 | } | 677 | } |
652 | 678 | ||
653 | static void pnpbios_encode_fixed_port(unsigned char *p, struct resource *res) | 679 | static void pnpbios_encode_fixed_port(struct pnp_dev *dev, unsigned char *p, |
680 | struct resource *res) | ||
654 | { | 681 | { |
655 | unsigned long base = res->start; | 682 | unsigned long base = res->start; |
656 | unsigned long len = res->end - res->start + 1; | 683 | unsigned long len = res->end - res->start + 1; |
@@ -658,6 +685,9 @@ static void pnpbios_encode_fixed_port(unsigned char *p, struct resource *res) | |||
658 | p[1] = base & 0xff; | 685 | p[1] = base & 0xff; |
659 | p[2] = (base >> 8) & 0xff; | 686 | p[2] = (base >> 8) & 0xff; |
660 | p[3] = len & 0xff; | 687 | p[3] = len & 0xff; |
688 | |||
689 | dev_dbg(&dev->dev, " encode fixed_io %#llx-%#llx\n", | ||
690 | (unsigned long long) res->start, (unsigned long long) res->end); | ||
661 | } | 691 | } |
662 | 692 | ||
663 | static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev | 693 | static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev |
@@ -688,42 +718,42 @@ static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev | |||
688 | case LARGE_TAG_MEM: | 718 | case LARGE_TAG_MEM: |
689 | if (len != 9) | 719 | if (len != 9) |
690 | goto len_err; | 720 | goto len_err; |
691 | pnpbios_encode_mem(p, &res->mem_resource[mem]); | 721 | pnpbios_encode_mem(dev, p, &res->mem_resource[mem]); |
692 | mem++; | 722 | mem++; |
693 | break; | 723 | break; |
694 | 724 | ||
695 | case LARGE_TAG_MEM32: | 725 | case LARGE_TAG_MEM32: |
696 | if (len != 17) | 726 | if (len != 17) |
697 | goto len_err; | 727 | goto len_err; |
698 | pnpbios_encode_mem32(p, &res->mem_resource[mem]); | 728 | pnpbios_encode_mem32(dev, p, &res->mem_resource[mem]); |
699 | mem++; | 729 | mem++; |
700 | break; | 730 | break; |
701 | 731 | ||
702 | case LARGE_TAG_FIXEDMEM32: | 732 | case LARGE_TAG_FIXEDMEM32: |
703 | if (len != 9) | 733 | if (len != 9) |
704 | goto len_err; | 734 | goto len_err; |
705 | pnpbios_encode_fixed_mem32(p, &res->mem_resource[mem]); | 735 | pnpbios_encode_fixed_mem32(dev, p, &res->mem_resource[mem]); |
706 | mem++; | 736 | mem++; |
707 | break; | 737 | break; |
708 | 738 | ||
709 | case SMALL_TAG_IRQ: | 739 | case SMALL_TAG_IRQ: |
710 | if (len < 2 || len > 3) | 740 | if (len < 2 || len > 3) |
711 | goto len_err; | 741 | goto len_err; |
712 | pnpbios_encode_irq(p, &res->irq_resource[irq]); | 742 | pnpbios_encode_irq(dev, p, &res->irq_resource[irq]); |
713 | irq++; | 743 | irq++; |
714 | break; | 744 | break; |
715 | 745 | ||
716 | case SMALL_TAG_DMA: | 746 | case SMALL_TAG_DMA: |
717 | if (len != 2) | 747 | if (len != 2) |
718 | goto len_err; | 748 | goto len_err; |
719 | pnpbios_encode_dma(p, &res->dma_resource[dma]); | 749 | pnpbios_encode_dma(dev, p, &res->dma_resource[dma]); |
720 | dma++; | 750 | dma++; |
721 | break; | 751 | break; |
722 | 752 | ||
723 | case SMALL_TAG_PORT: | 753 | case SMALL_TAG_PORT: |
724 | if (len != 7) | 754 | if (len != 7) |
725 | goto len_err; | 755 | goto len_err; |
726 | pnpbios_encode_port(p, &res->port_resource[port]); | 756 | pnpbios_encode_port(dev, p, &res->port_resource[port]); |
727 | port++; | 757 | port++; |
728 | break; | 758 | break; |
729 | 759 | ||
@@ -734,7 +764,7 @@ static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev | |||
734 | case SMALL_TAG_FIXEDPORT: | 764 | case SMALL_TAG_FIXEDPORT: |
735 | if (len != 3) | 765 | if (len != 3) |
736 | goto len_err; | 766 | goto len_err; |
737 | pnpbios_encode_fixed_port(p, &res->port_resource[port]); | 767 | pnpbios_encode_fixed_port(dev, p, &res->port_resource[port]); |
738 | port++; | 768 | port++; |
739 | break; | 769 | break; |
740 | 770 | ||