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/pnpacpi | |
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/pnpacpi')
-rw-r--r-- | drivers/pnp/pnpacpi/core.c | 2 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 90 |
2 files changed, 66 insertions, 26 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 3fd2416d6795..1ac894d2df5a 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -77,6 +77,7 @@ static int pnpacpi_get_resources(struct pnp_dev *dev) | |||
77 | { | 77 | { |
78 | acpi_status status; | 78 | acpi_status status; |
79 | 79 | ||
80 | dev_dbg(&dev->dev, "get resources\n"); | ||
80 | status = pnpacpi_parse_allocated_resource(dev); | 81 | status = pnpacpi_parse_allocated_resource(dev); |
81 | return ACPI_FAILURE(status) ? -ENODEV : 0; | 82 | return ACPI_FAILURE(status) ? -ENODEV : 0; |
82 | } | 83 | } |
@@ -88,6 +89,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) | |||
88 | int ret; | 89 | int ret; |
89 | acpi_status status; | 90 | acpi_status status; |
90 | 91 | ||
92 | dev_dbg(&dev->dev, "set resources\n"); | ||
91 | ret = pnpacpi_build_resource_template(dev, &buffer); | 93 | ret = pnpacpi_build_resource_template(dev, &buffer); |
92 | if (ret) | 94 | if (ret) |
93 | return ret; | 95 | return ret; |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 8a0617687723..c5adf7631ac2 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -408,6 +408,8 @@ acpi_status pnpacpi_parse_allocated_resource(struct pnp_dev *dev) | |||
408 | { | 408 | { |
409 | acpi_handle handle = dev->data; | 409 | acpi_handle handle = dev->data; |
410 | 410 | ||
411 | dev_dbg(&dev->dev, "parse allocated resources\n"); | ||
412 | |||
411 | /* Blank the resource table values */ | 413 | /* Blank the resource table values */ |
412 | pnp_init_resource_table(&dev->res); | 414 | pnp_init_resource_table(&dev->res); |
413 | 415 | ||
@@ -738,6 +740,8 @@ acpi_status __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev) | |||
738 | acpi_status status; | 740 | acpi_status status; |
739 | struct acpipnp_parse_option_s parse_data; | 741 | struct acpipnp_parse_option_s parse_data; |
740 | 742 | ||
743 | dev_dbg(&dev->dev, "parse resource options\n"); | ||
744 | |||
741 | parse_data.option = pnp_register_independent_option(dev); | 745 | parse_data.option = pnp_register_independent_option(dev); |
742 | if (!parse_data.option) | 746 | if (!parse_data.option) |
743 | return AE_ERROR; | 747 | return AE_ERROR; |
@@ -814,7 +818,7 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev, | |||
814 | buffer->pointer = kzalloc(buffer->length - 1, GFP_KERNEL); | 818 | buffer->pointer = kzalloc(buffer->length - 1, GFP_KERNEL); |
815 | if (!buffer->pointer) | 819 | if (!buffer->pointer) |
816 | return -ENOMEM; | 820 | return -ENOMEM; |
817 | pnp_dbg("Res cnt %d", res_cnt); | 821 | |
818 | resource = (struct acpi_resource *)buffer->pointer; | 822 | resource = (struct acpi_resource *)buffer->pointer; |
819 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | 823 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, |
820 | pnpacpi_type_resources, &resource); | 824 | pnpacpi_type_resources, &resource); |
@@ -829,7 +833,8 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev, | |||
829 | return 0; | 833 | return 0; |
830 | } | 834 | } |
831 | 835 | ||
832 | static void pnpacpi_encode_irq(struct acpi_resource *resource, | 836 | static void pnpacpi_encode_irq(struct pnp_dev *dev, |
837 | struct acpi_resource *resource, | ||
833 | struct resource *p) | 838 | struct resource *p) |
834 | { | 839 | { |
835 | struct acpi_resource_irq *irq = &resource->data.irq; | 840 | struct acpi_resource_irq *irq = &resource->data.irq; |
@@ -844,9 +849,15 @@ static void pnpacpi_encode_irq(struct acpi_resource *resource, | |||
844 | irq->sharable = ACPI_SHARED; | 849 | irq->sharable = ACPI_SHARED; |
845 | irq->interrupt_count = 1; | 850 | irq->interrupt_count = 1; |
846 | irq->interrupts[0] = p->start; | 851 | irq->interrupts[0] = p->start; |
852 | |||
853 | dev_dbg(&dev->dev, " encode irq %d %s %s %s\n", (int) p->start, | ||
854 | triggering == ACPI_LEVEL_SENSITIVE ? "level" : "edge", | ||
855 | polarity == ACPI_ACTIVE_LOW ? "low" : "high", | ||
856 | irq->sharable == ACPI_SHARED ? "shared" : "exclusive"); | ||
847 | } | 857 | } |
848 | 858 | ||
849 | static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, | 859 | static void pnpacpi_encode_ext_irq(struct pnp_dev *dev, |
860 | struct acpi_resource *resource, | ||
850 | struct resource *p) | 861 | struct resource *p) |
851 | { | 862 | { |
852 | struct acpi_resource_extended_irq *extended_irq = &resource->data.extended_irq; | 863 | struct acpi_resource_extended_irq *extended_irq = &resource->data.extended_irq; |
@@ -862,9 +873,15 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, | |||
862 | extended_irq->sharable = ACPI_SHARED; | 873 | extended_irq->sharable = ACPI_SHARED; |
863 | extended_irq->interrupt_count = 1; | 874 | extended_irq->interrupt_count = 1; |
864 | extended_irq->interrupts[0] = p->start; | 875 | extended_irq->interrupts[0] = p->start; |
876 | |||
877 | dev_dbg(&dev->dev, " encode irq %d %s %s %s\n", (int) p->start, | ||
878 | triggering == ACPI_LEVEL_SENSITIVE ? "level" : "edge", | ||
879 | polarity == ACPI_ACTIVE_LOW ? "low" : "high", | ||
880 | extended_irq->sharable == ACPI_SHARED ? "shared" : "exclusive"); | ||
865 | } | 881 | } |
866 | 882 | ||
867 | static void pnpacpi_encode_dma(struct acpi_resource *resource, | 883 | static void pnpacpi_encode_dma(struct pnp_dev *dev, |
884 | struct acpi_resource *resource, | ||
868 | struct resource *p) | 885 | struct resource *p) |
869 | { | 886 | { |
870 | struct acpi_resource_dma *dma = &resource->data.dma; | 887 | struct acpi_resource_dma *dma = &resource->data.dma; |
@@ -898,9 +915,14 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource, | |||
898 | dma->bus_master = !!(p->flags & IORESOURCE_DMA_MASTER); | 915 | dma->bus_master = !!(p->flags & IORESOURCE_DMA_MASTER); |
899 | dma->channel_count = 1; | 916 | dma->channel_count = 1; |
900 | dma->channels[0] = p->start; | 917 | dma->channels[0] = p->start; |
918 | |||
919 | dev_dbg(&dev->dev, " encode dma %d " | ||
920 | "type %#x transfer %#x master %d\n", | ||
921 | (int) p->start, dma->type, dma->transfer, dma->bus_master); | ||
901 | } | 922 | } |
902 | 923 | ||
903 | static void pnpacpi_encode_io(struct acpi_resource *resource, | 924 | static void pnpacpi_encode_io(struct pnp_dev *dev, |
925 | struct acpi_resource *resource, | ||
904 | struct resource *p) | 926 | struct resource *p) |
905 | { | 927 | { |
906 | struct acpi_resource_io *io = &resource->data.io; | 928 | struct acpi_resource_io *io = &resource->data.io; |
@@ -912,18 +934,27 @@ static void pnpacpi_encode_io(struct acpi_resource *resource, | |||
912 | io->maximum = p->end; | 934 | io->maximum = p->end; |
913 | io->alignment = 0; /* Correct? */ | 935 | io->alignment = 0; /* Correct? */ |
914 | io->address_length = p->end - p->start + 1; | 936 | io->address_length = p->end - p->start + 1; |
937 | |||
938 | dev_dbg(&dev->dev, " encode io %#llx-%#llx decode %#x\n", | ||
939 | (unsigned long long) p->start, (unsigned long long) p->end, | ||
940 | io->io_decode); | ||
915 | } | 941 | } |
916 | 942 | ||
917 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, | 943 | static void pnpacpi_encode_fixed_io(struct pnp_dev *dev, |
944 | struct acpi_resource *resource, | ||
918 | struct resource *p) | 945 | struct resource *p) |
919 | { | 946 | { |
920 | struct acpi_resource_fixed_io *fixed_io = &resource->data.fixed_io; | 947 | struct acpi_resource_fixed_io *fixed_io = &resource->data.fixed_io; |
921 | 948 | ||
922 | fixed_io->address = p->start; | 949 | fixed_io->address = p->start; |
923 | fixed_io->address_length = p->end - p->start + 1; | 950 | fixed_io->address_length = p->end - p->start + 1; |
951 | |||
952 | dev_dbg(&dev->dev, " encode fixed_io %#llx-%#llx\n", | ||
953 | (unsigned long long) p->start, (unsigned long long) p->end); | ||
924 | } | 954 | } |
925 | 955 | ||
926 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, | 956 | static void pnpacpi_encode_mem24(struct pnp_dev *dev, |
957 | struct acpi_resource *resource, | ||
927 | struct resource *p) | 958 | struct resource *p) |
928 | { | 959 | { |
929 | struct acpi_resource_memory24 *memory24 = &resource->data.memory24; | 960 | struct acpi_resource_memory24 *memory24 = &resource->data.memory24; |
@@ -936,9 +967,14 @@ static void pnpacpi_encode_mem24(struct acpi_resource *resource, | |||
936 | memory24->maximum = p->end; | 967 | memory24->maximum = p->end; |
937 | memory24->alignment = 0; | 968 | memory24->alignment = 0; |
938 | memory24->address_length = p->end - p->start + 1; | 969 | memory24->address_length = p->end - p->start + 1; |
970 | |||
971 | dev_dbg(&dev->dev, " encode mem24 %#llx-%#llx write_protect %#x\n", | ||
972 | (unsigned long long) p->start, (unsigned long long) p->end, | ||
973 | memory24->write_protect); | ||
939 | } | 974 | } |
940 | 975 | ||
941 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, | 976 | static void pnpacpi_encode_mem32(struct pnp_dev *dev, |
977 | struct acpi_resource *resource, | ||
942 | struct resource *p) | 978 | struct resource *p) |
943 | { | 979 | { |
944 | struct acpi_resource_memory32 *memory32 = &resource->data.memory32; | 980 | struct acpi_resource_memory32 *memory32 = &resource->data.memory32; |
@@ -950,9 +986,14 @@ static void pnpacpi_encode_mem32(struct acpi_resource *resource, | |||
950 | memory32->maximum = p->end; | 986 | memory32->maximum = p->end; |
951 | memory32->alignment = 0; | 987 | memory32->alignment = 0; |
952 | memory32->address_length = p->end - p->start + 1; | 988 | memory32->address_length = p->end - p->start + 1; |
989 | |||
990 | dev_dbg(&dev->dev, " encode mem32 %#llx-%#llx write_protect %#x\n", | ||
991 | (unsigned long long) p->start, (unsigned long long) p->end, | ||
992 | memory32->write_protect); | ||
953 | } | 993 | } |
954 | 994 | ||
955 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, | 995 | static void pnpacpi_encode_fixed_mem32(struct pnp_dev *dev, |
996 | struct acpi_resource *resource, | ||
956 | struct resource *p) | 997 | struct resource *p) |
957 | { | 998 | { |
958 | struct acpi_resource_fixed_memory32 *fixed_memory32 = &resource->data.fixed_memory32; | 999 | struct acpi_resource_fixed_memory32 *fixed_memory32 = &resource->data.fixed_memory32; |
@@ -962,6 +1003,11 @@ static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, | |||
962 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 1003 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
963 | fixed_memory32->address = p->start; | 1004 | fixed_memory32->address = p->start; |
964 | fixed_memory32->address_length = p->end - p->start + 1; | 1005 | fixed_memory32->address_length = p->end - p->start + 1; |
1006 | |||
1007 | dev_dbg(&dev->dev, " encode fixed_mem32 %#llx-%#llx " | ||
1008 | "write_protect %#x\n", | ||
1009 | (unsigned long long) p->start, (unsigned long long) p->end, | ||
1010 | fixed_memory32->write_protect); | ||
965 | } | 1011 | } |
966 | 1012 | ||
967 | int pnpacpi_encode_resources(struct pnp_dev *dev, struct acpi_buffer *buffer) | 1013 | int pnpacpi_encode_resources(struct pnp_dev *dev, struct acpi_buffer *buffer) |
@@ -973,57 +1019,49 @@ int pnpacpi_encode_resources(struct pnp_dev *dev, struct acpi_buffer *buffer) | |||
973 | struct acpi_resource *resource = buffer->pointer; | 1019 | struct acpi_resource *resource = buffer->pointer; |
974 | int port = 0, irq = 0, dma = 0, mem = 0; | 1020 | int port = 0, irq = 0, dma = 0, mem = 0; |
975 | 1021 | ||
976 | pnp_dbg("res cnt %d", res_cnt); | 1022 | dev_dbg(&dev->dev, "encode %d resources\n", res_cnt); |
977 | while (i < res_cnt) { | 1023 | while (i < res_cnt) { |
978 | switch (resource->type) { | 1024 | switch (resource->type) { |
979 | case ACPI_RESOURCE_TYPE_IRQ: | 1025 | case ACPI_RESOURCE_TYPE_IRQ: |
980 | pnp_dbg("Encode irq"); | 1026 | pnpacpi_encode_irq(dev, resource, |
981 | pnpacpi_encode_irq(resource, | ||
982 | &res_table->irq_resource[irq]); | 1027 | &res_table->irq_resource[irq]); |
983 | irq++; | 1028 | irq++; |
984 | break; | 1029 | break; |
985 | 1030 | ||
986 | case ACPI_RESOURCE_TYPE_DMA: | 1031 | case ACPI_RESOURCE_TYPE_DMA: |
987 | pnp_dbg("Encode dma"); | 1032 | pnpacpi_encode_dma(dev, resource, |
988 | pnpacpi_encode_dma(resource, | ||
989 | &res_table->dma_resource[dma]); | 1033 | &res_table->dma_resource[dma]); |
990 | dma++; | 1034 | dma++; |
991 | break; | 1035 | break; |
992 | case ACPI_RESOURCE_TYPE_IO: | 1036 | case ACPI_RESOURCE_TYPE_IO: |
993 | pnp_dbg("Encode io"); | 1037 | pnpacpi_encode_io(dev, resource, |
994 | pnpacpi_encode_io(resource, | ||
995 | &res_table->port_resource[port]); | 1038 | &res_table->port_resource[port]); |
996 | port++; | 1039 | port++; |
997 | break; | 1040 | break; |
998 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 1041 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
999 | pnp_dbg("Encode fixed io"); | 1042 | pnpacpi_encode_fixed_io(dev, resource, |
1000 | pnpacpi_encode_fixed_io(resource, | ||
1001 | &res_table-> | 1043 | &res_table-> |
1002 | port_resource[port]); | 1044 | port_resource[port]); |
1003 | port++; | 1045 | port++; |
1004 | break; | 1046 | break; |
1005 | case ACPI_RESOURCE_TYPE_MEMORY24: | 1047 | case ACPI_RESOURCE_TYPE_MEMORY24: |
1006 | pnp_dbg("Encode mem24"); | 1048 | pnpacpi_encode_mem24(dev, resource, |
1007 | pnpacpi_encode_mem24(resource, | ||
1008 | &res_table->mem_resource[mem]); | 1049 | &res_table->mem_resource[mem]); |
1009 | mem++; | 1050 | mem++; |
1010 | break; | 1051 | break; |
1011 | case ACPI_RESOURCE_TYPE_MEMORY32: | 1052 | case ACPI_RESOURCE_TYPE_MEMORY32: |
1012 | pnp_dbg("Encode mem32"); | 1053 | pnpacpi_encode_mem32(dev, resource, |
1013 | pnpacpi_encode_mem32(resource, | ||
1014 | &res_table->mem_resource[mem]); | 1054 | &res_table->mem_resource[mem]); |
1015 | mem++; | 1055 | mem++; |
1016 | break; | 1056 | break; |
1017 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 1057 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
1018 | pnp_dbg("Encode fixed mem32"); | 1058 | pnpacpi_encode_fixed_mem32(dev, resource, |
1019 | pnpacpi_encode_fixed_mem32(resource, | ||
1020 | &res_table-> | 1059 | &res_table-> |
1021 | mem_resource[mem]); | 1060 | mem_resource[mem]); |
1022 | mem++; | 1061 | mem++; |
1023 | break; | 1062 | break; |
1024 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 1063 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
1025 | pnp_dbg("Encode ext irq"); | 1064 | pnpacpi_encode_ext_irq(dev, resource, |
1026 | pnpacpi_encode_ext_irq(resource, | ||
1027 | &res_table->irq_resource[irq]); | 1065 | &res_table->irq_resource[irq]); |
1028 | irq++; | 1066 | irq++; |
1029 | break; | 1067 | break; |