aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:34:07 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:21 -0400
commit72dcc883d8e5b59105e75ee5265442e458740575 (patch)
treeabe950093416aba615a92c6653f2d32f37a58d45 /drivers
parent4ab55d8d4f7b910c4c60e0f8ff70d0dfdd484f02 (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')
-rw-r--r--drivers/pnp/isapnp/core.c18
-rw-r--r--drivers/pnp/pnpacpi/core.c2
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c90
-rw-r--r--drivers/pnp/pnpbios/core.c2
-rw-r--r--drivers/pnp/pnpbios/rsparser.c58
5 files changed, 127 insertions, 43 deletions
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index b8e639f4f227..6740016437d9 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -980,6 +980,7 @@ static int isapnp_get_resources(struct pnp_dev *dev)
980{ 980{
981 int ret; 981 int ret;
982 982
983 dev_dbg(&dev->dev, "get resources\n");
983 pnp_init_resource_table(&dev->res); 984 pnp_init_resource_table(&dev->res);
984 isapnp_cfg_begin(dev->card->number, dev->number); 985 isapnp_cfg_begin(dev->card->number, dev->number);
985 ret = isapnp_read_resources(dev); 986 ret = isapnp_read_resources(dev);
@@ -992,15 +993,19 @@ static int isapnp_set_resources(struct pnp_dev *dev)
992 struct pnp_resource_table *res = &dev->res; 993 struct pnp_resource_table *res = &dev->res;
993 int tmp; 994 int tmp;
994 995
996 dev_dbg(&dev->dev, "set resources\n");
995 isapnp_cfg_begin(dev->card->number, dev->number); 997 isapnp_cfg_begin(dev->card->number, dev->number);
996 dev->active = 1; 998 dev->active = 1;
997 for (tmp = 0; 999 for (tmp = 0;
998 tmp < ISAPNP_MAX_PORT 1000 tmp < ISAPNP_MAX_PORT
999 && (res->port_resource[tmp]. 1001 && (res->port_resource[tmp].
1000 flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO; 1002 flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO;
1001 tmp++) 1003 tmp++) {
1004 dev_dbg(&dev->dev, " set io %d to %#llx\n",
1005 tmp, (unsigned long long) res->port_resource[tmp].start);
1002 isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1), 1006 isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1),
1003 res->port_resource[tmp].start); 1007 res->port_resource[tmp].start);
1008 }
1004 for (tmp = 0; 1009 for (tmp = 0;
1005 tmp < ISAPNP_MAX_IRQ 1010 tmp < ISAPNP_MAX_IRQ
1006 && (res->irq_resource[tmp]. 1011 && (res->irq_resource[tmp].
@@ -1009,22 +1014,29 @@ static int isapnp_set_resources(struct pnp_dev *dev)
1009 int irq = res->irq_resource[tmp].start; 1014 int irq = res->irq_resource[tmp].start;
1010 if (irq == 2) 1015 if (irq == 2)
1011 irq = 9; 1016 irq = 9;
1017 dev_dbg(&dev->dev, " set irq %d to %d\n", tmp, irq);
1012 isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq); 1018 isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq);
1013 } 1019 }
1014 for (tmp = 0; 1020 for (tmp = 0;
1015 tmp < ISAPNP_MAX_DMA 1021 tmp < ISAPNP_MAX_DMA
1016 && (res->dma_resource[tmp]. 1022 && (res->dma_resource[tmp].
1017 flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA; 1023 flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA;
1018 tmp++) 1024 tmp++) {
1025 dev_dbg(&dev->dev, " set dma %d to %lld\n",
1026 tmp, (unsigned long long) res->dma_resource[tmp].start);
1019 isapnp_write_byte(ISAPNP_CFG_DMA + tmp, 1027 isapnp_write_byte(ISAPNP_CFG_DMA + tmp,
1020 res->dma_resource[tmp].start); 1028 res->dma_resource[tmp].start);
1029 }
1021 for (tmp = 0; 1030 for (tmp = 0;
1022 tmp < ISAPNP_MAX_MEM 1031 tmp < ISAPNP_MAX_MEM
1023 && (res->mem_resource[tmp]. 1032 && (res->mem_resource[tmp].
1024 flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM; 1033 flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM;
1025 tmp++) 1034 tmp++) {
1035 dev_dbg(&dev->dev, " set mem %d to %#llx\n",
1036 tmp, (unsigned long long) res->mem_resource[tmp].start);
1026 isapnp_write_word(ISAPNP_CFG_MEM + (tmp << 3), 1037 isapnp_write_word(ISAPNP_CFG_MEM + (tmp << 3),
1027 (res->mem_resource[tmp].start >> 8) & 0xffff); 1038 (res->mem_resource[tmp].start >> 8) & 0xffff);
1039 }
1028 /* FIXME: We aren't handling 32bit mems properly here */ 1040 /* FIXME: We aren't handling 32bit mems properly here */
1029 isapnp_activate(dev->number); 1041 isapnp_activate(dev->number);
1030 isapnp_cfg_end(); 1042 isapnp_cfg_end();
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
832static void pnpacpi_encode_irq(struct acpi_resource *resource, 836static 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
849static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, 859static 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
867static void pnpacpi_encode_dma(struct acpi_resource *resource, 883static 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
903static void pnpacpi_encode_io(struct acpi_resource *resource, 924static 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
917static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, 943static 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
926static void pnpacpi_encode_mem24(struct acpi_resource *resource, 956static 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
941static void pnpacpi_encode_mem32(struct acpi_resource *resource, 976static 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
955static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, 995static 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
967int pnpacpi_encode_resources(struct pnp_dev *dev, struct acpi_buffer *buffer) 1013int 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;
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 1711e7f29613..76d398531da6 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -212,6 +212,7 @@ static int pnpbios_get_resources(struct pnp_dev *dev)
212 if (!pnpbios_is_dynamic(dev)) 212 if (!pnpbios_is_dynamic(dev))
213 return -EPERM; 213 return -EPERM;
214 214
215 dev_dbg(&dev->dev, "get resources\n");
215 node = kzalloc(node_info.max_node_size, GFP_KERNEL); 216 node = kzalloc(node_info.max_node_size, GFP_KERNEL);
216 if (!node) 217 if (!node)
217 return -1; 218 return -1;
@@ -234,6 +235,7 @@ static int pnpbios_set_resources(struct pnp_dev *dev)
234 if (!pnpbios_is_dynamic(dev)) 235 if (!pnpbios_is_dynamic(dev))
235 return -EPERM; 236 return -EPERM;
236 237
238 dev_dbg(&dev->dev, "set resources\n");
237 node = kzalloc(node_info.max_node_size, GFP_KERNEL); 239 node = kzalloc(node_info.max_node_size, GFP_KERNEL);
238 if (!node) 240 if (!node)
239 return -1; 241 return -1;
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
577static void pnpbios_encode_mem(unsigned char *p, struct resource *res) 581static 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
590static void pnpbios_encode_mem32(unsigned char *p, struct resource *res) 598static 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
609static void pnpbios_encode_fixed_mem32(unsigned char *p, struct resource *res) 621static 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
624static void pnpbios_encode_irq(unsigned char *p, struct resource *res) 640static 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
633static void pnpbios_encode_dma(unsigned char *p, struct resource *res) 652static 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
641static void pnpbios_encode_port(unsigned char *p, struct resource *res) 663static 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
653static void pnpbios_encode_fixed_port(unsigned char *p, struct resource *res) 679static 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
663static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev 693static 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