diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 16:34:07 -0600 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:21 -0400 |
commit | 72dcc883d8e5b59105e75ee5265442e458740575 (patch) | |
tree | abe950093416aba615a92c6653f2d32f37a58d45 | |
parent | 4ab55d8d4f7b910c4c60e0f8ff70d0dfdd484f02 (diff) | |
download | linux-3.10-72dcc883d8e5b59105e75ee5265442e458740575.tar.gz linux-3.10-72dcc883d8e5b59105e75ee5265442e458740575.tar.bz2 linux-3.10-72dcc883d8e5b59105e75ee5265442e458740575.zip |
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>
-rw-r--r-- | drivers/pnp/isapnp/core.c | 18 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/core.c | 2 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 90 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/core.c | 2 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/rsparser.c | 58 |
5 files changed, 127 insertions, 43 deletions
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index b8e639f4f22..6740016437d 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) { int ret; + dev_dbg(&dev->dev, "get resources\n"); pnp_init_resource_table(&dev->res); isapnp_cfg_begin(dev->card->number, dev->number); ret = isapnp_read_resources(dev); @@ -992,15 +993,19 @@ static int isapnp_set_resources(struct pnp_dev *dev) struct pnp_resource_table *res = &dev->res; int tmp; + dev_dbg(&dev->dev, "set resources\n"); isapnp_cfg_begin(dev->card->number, dev->number); dev->active = 1; for (tmp = 0; tmp < ISAPNP_MAX_PORT && (res->port_resource[tmp]. flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO; - tmp++) + tmp++) { + dev_dbg(&dev->dev, " set io %d to %#llx\n", + tmp, (unsigned long long) res->port_resource[tmp].start); isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1), res->port_resource[tmp].start); + } for (tmp = 0; tmp < ISAPNP_MAX_IRQ && (res->irq_resource[tmp]. @@ -1009,22 +1014,29 @@ static int isapnp_set_resources(struct pnp_dev *dev) int irq = res->irq_resource[tmp].start; if (irq == 2) irq = 9; + dev_dbg(&dev->dev, " set irq %d to %d\n", tmp, irq); isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq); } for (tmp = 0; tmp < ISAPNP_MAX_DMA && (res->dma_resource[tmp]. flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA; - tmp++) + tmp++) { + dev_dbg(&dev->dev, " set dma %d to %lld\n", + tmp, (unsigned long long) res->dma_resource[tmp].start); isapnp_write_byte(ISAPNP_CFG_DMA + tmp, res->dma_resource[tmp].start); + } for (tmp = 0; tmp < ISAPNP_MAX_MEM && (res->mem_resource[tmp]. flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM; - tmp++) + tmp++) { + dev_dbg(&dev->dev, " set mem %d to %#llx\n", + tmp, (unsigned long long) res->mem_resource[tmp].start); isapnp_write_word(ISAPNP_CFG_MEM + (tmp << 3), (res->mem_resource[tmp].start >> 8) & 0xffff); + } /* FIXME: We aren't handling 32bit mems properly here */ isapnp_activate(dev->number); isapnp_cfg_end(); diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 3fd2416d679..1ac894d2df5 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) { acpi_status status; + dev_dbg(&dev->dev, "get resources\n"); status = pnpacpi_parse_allocated_resource(dev); return ACPI_FAILURE(status) ? -ENODEV : 0; } @@ -88,6 +89,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) int ret; acpi_status status; + dev_dbg(&dev->dev, "set resources\n"); ret = pnpacpi_build_resource_template(dev, &buffer); if (ret) return ret; diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 8a061768772..c5adf7631ac 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) { acpi_handle handle = dev->data; + dev_dbg(&dev->dev, "parse allocated resources\n"); + /* Blank the resource table values */ pnp_init_resource_table(&dev->res); @@ -738,6 +740,8 @@ acpi_status __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev) acpi_status status; struct acpipnp_parse_option_s parse_data; + dev_dbg(&dev->dev, "parse resource options\n"); + parse_data.option = pnp_register_independent_option(dev); if (!parse_data.option) return AE_ERROR; @@ -814,7 +818,7 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev, buffer->pointer = kzalloc(buffer->length - 1, GFP_KERNEL); if (!buffer->pointer) return -ENOMEM; - pnp_dbg("Res cnt %d", res_cnt); + resource = (struct acpi_resource *)buffer->pointer; status = acpi_walk_resources(handle, METHOD_NAME__CRS, pnpacpi_type_resources, &resource); @@ -829,7 +833,8 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev, return 0; } -static void pnpacpi_encode_irq(struct acpi_resource *resource, +static void pnpacpi_encode_irq(struct pnp_dev *dev, + struct acpi_resource *resource, struct resource *p) { struct acpi_resource_irq *irq = &resource->data.irq; @@ -844,9 +849,15 @@ static void pnpacpi_encode_irq(struct acpi_resource *resource, irq->sharable = ACPI_SHARED; irq->interrupt_count = 1; irq->interrupts[0] = p->start; + + dev_dbg(&dev->dev, " encode irq %d %s %s %s\n", (int) p->start, + triggering == ACPI_LEVEL_SENSITIVE ? "level" : "edge", + polarity == ACPI_ACTIVE_LOW ? "low" : "high", + irq->sharable == ACPI_SHARED ? "shared" : "exclusive"); } -static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, +static void pnpacpi_encode_ext_irq(struct pnp_dev *dev, + struct acpi_resource *resource, struct resource *p) { 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, extended_irq->sharable = ACPI_SHARED; extended_irq->interrupt_count = 1; extended_irq->interrupts[0] = p->start; + + dev_dbg(&dev->dev, " encode irq %d %s %s %s\n", (int) p->start, + triggering == ACPI_LEVEL_SENSITIVE ? "level" : "edge", + polarity == ACPI_ACTIVE_LOW ? "low" : "high", + extended_irq->sharable == ACPI_SHARED ? "shared" : "exclusive"); } -static void pnpacpi_encode_dma(struct acpi_resource *resource, +static void pnpacpi_encode_dma(struct pnp_dev *dev, + struct acpi_resource *resource, struct resource *p) { struct acpi_resource_dma *dma = &resource->data.dma; @@ -898,9 +915,14 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource, dma->bus_master = !!(p->flags & IORESOURCE_DMA_MASTER); dma->channel_count = 1; dma->channels[0] = p->start; + + dev_dbg(&dev->dev, " encode dma %d " + "type %#x transfer %#x master %d\n", + (int) p->start, dma->type, dma->transfer, dma->bus_master); } -static void pnpacpi_encode_io(struct acpi_resource *resource, +static void pnpacpi_encode_io(struct pnp_dev *dev, + struct acpi_resource *resource, struct resource *p) { struct acpi_resource_io *io = &resource->data.io; @@ -912,18 +934,27 @@ static void pnpacpi_encode_io(struct acpi_resource *resource, io->maximum = p->end; io->alignment = 0; /* Correct? */ io->address_length = p->end - p->start + 1; + + dev_dbg(&dev->dev, " encode io %#llx-%#llx decode %#x\n", + (unsigned long long) p->start, (unsigned long long) p->end, + io->io_decode); } -static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, +static void pnpacpi_encode_fixed_io(struct pnp_dev *dev, + struct acpi_resource *resource, struct resource *p) { struct acpi_resource_fixed_io *fixed_io = &resource->data.fixed_io; fixed_io->address = p->start; fixed_io->address_length = p->end - p->start + 1; + + dev_dbg(&dev->dev, " encode fixed_io %#llx-%#llx\n", + (unsigned long long) p->start, (unsigned long long) p->end); } -static void pnpacpi_encode_mem24(struct acpi_resource *resource, +static void pnpacpi_encode_mem24(struct pnp_dev *dev, + struct acpi_resource *resource, struct resource *p) { struct acpi_resource_memory24 *memory24 = &resource->data.memory24; @@ -936,9 +967,14 @@ static void pnpacpi_encode_mem24(struct acpi_resource *resource, memory24->maximum = p->end; memory24->alignment = 0; memory24->address_length = p->end - p->start + 1; + + dev_dbg(&dev->dev, " encode mem24 %#llx-%#llx write_protect %#x\n", + (unsigned long long) p->start, (unsigned long long) p->end, + memory24->write_protect); } -static void pnpacpi_encode_mem32(struct acpi_resource *resource, +static void pnpacpi_encode_mem32(struct pnp_dev *dev, + struct acpi_resource *resource, struct resource *p) { struct acpi_resource_memory32 *memory32 = &resource->data.memory32; @@ -950,9 +986,14 @@ static void pnpacpi_encode_mem32(struct acpi_resource *resource, memory32->maximum = p->end; memory32->alignment = 0; memory32->address_length = p->end - p->start + 1; + + dev_dbg(&dev->dev, " encode mem32 %#llx-%#llx write_protect %#x\n", + (unsigned long long) p->start, (unsigned long long) p->end, + memory32->write_protect); } -static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, +static void pnpacpi_encode_fixed_mem32(struct pnp_dev *dev, + struct acpi_resource *resource, struct resource *p) { 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, ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; fixed_memory32->address = p->start; fixed_memory32->address_length = p->end - p->start + 1; + + dev_dbg(&dev->dev, " encode fixed_mem32 %#llx-%#llx " + "write_protect %#x\n", + (unsigned long long) p->start, (unsigned long long) p->end, + fixed_memory32->write_protect); } 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) struct acpi_resource *resource = buffer->pointer; int port = 0, irq = 0, dma = 0, mem = 0; - pnp_dbg("res cnt %d", res_cnt); + dev_dbg(&dev->dev, "encode %d resources\n", res_cnt); while (i < res_cnt) { switch (resource->type) { case ACPI_RESOURCE_TYPE_IRQ: - pnp_dbg("Encode irq"); - pnpacpi_encode_irq(resource, + pnpacpi_encode_irq(dev, resource, &res_table->irq_resource[irq]); irq++; break; case ACPI_RESOURCE_TYPE_DMA: - pnp_dbg("Encode dma"); - pnpacpi_encode_dma(resource, + pnpacpi_encode_dma(dev, resource, &res_table->dma_resource[dma]); dma++; break; case ACPI_RESOURCE_TYPE_IO: - pnp_dbg("Encode io"); - pnpacpi_encode_io(resource, + pnpacpi_encode_io(dev, resource, &res_table->port_resource[port]); port++; break; case ACPI_RESOURCE_TYPE_FIXED_IO: - pnp_dbg("Encode fixed io"); - pnpacpi_encode_fixed_io(resource, + pnpacpi_encode_fixed_io(dev, resource, &res_table-> port_resource[port]); port++; break; case ACPI_RESOURCE_TYPE_MEMORY24: - pnp_dbg("Encode mem24"); - pnpacpi_encode_mem24(resource, + pnpacpi_encode_mem24(dev, resource, &res_table->mem_resource[mem]); mem++; break; case ACPI_RESOURCE_TYPE_MEMORY32: - pnp_dbg("Encode mem32"); - pnpacpi_encode_mem32(resource, + pnpacpi_encode_mem32(dev, resource, &res_table->mem_resource[mem]); mem++; break; case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: - pnp_dbg("Encode fixed mem32"); - pnpacpi_encode_fixed_mem32(resource, + pnpacpi_encode_fixed_mem32(dev, resource, &res_table-> mem_resource[mem]); mem++; break; case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - pnp_dbg("Encode ext irq"); - pnpacpi_encode_ext_irq(resource, + pnpacpi_encode_ext_irq(dev, resource, &res_table->irq_resource[irq]); irq++; break; diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index 1711e7f2961..76d398531da 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) if (!pnpbios_is_dynamic(dev)) return -EPERM; + dev_dbg(&dev->dev, "get resources\n"); node = kzalloc(node_info.max_node_size, GFP_KERNEL); if (!node) return -1; @@ -234,6 +235,7 @@ static int pnpbios_set_resources(struct pnp_dev *dev) if (!pnpbios_is_dynamic(dev)) return -EPERM; + dev_dbg(&dev->dev, "set resources\n"); node = kzalloc(node_info.max_node_size, GFP_KERNEL); if (!node) return -1; diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index 1b8f30ff192..7428f62db4d 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, if (!p) return NULL; + dev_dbg(&dev->dev, "parse allocated resources\n"); + /* Blank the resource table values */ pnp_init_resource_table(&dev->res); @@ -390,6 +392,8 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end, if (!p) return NULL; + dev_dbg(&dev->dev, "parse resource options\n"); + option_independent = option = pnp_register_independent_option(dev); if (!option) return NULL; @@ -574,7 +578,8 @@ len_err: * Allocated Resource Encoding */ -static void pnpbios_encode_mem(unsigned char *p, struct resource *res) +static void pnpbios_encode_mem(struct pnp_dev *dev, unsigned char *p, + struct resource *res) { unsigned long base = res->start; unsigned long len = res->end - res->start + 1; @@ -585,9 +590,13 @@ static void pnpbios_encode_mem(unsigned char *p, struct resource *res) p[7] = ((base >> 8) >> 8) & 0xff; p[10] = (len >> 8) & 0xff; p[11] = ((len >> 8) >> 8) & 0xff; + + dev_dbg(&dev->dev, " encode mem %#llx-%#llx\n", + (unsigned long long) res->start, (unsigned long long) res->end); } -static void pnpbios_encode_mem32(unsigned char *p, struct resource *res) +static void pnpbios_encode_mem32(struct pnp_dev *dev, unsigned char *p, + struct resource *res) { unsigned long base = res->start; unsigned long len = res->end - res->start + 1; @@ -604,9 +613,13 @@ static void pnpbios_encode_mem32(unsigned char *p, struct resource *res) p[17] = (len >> 8) & 0xff; p[18] = (len >> 16) & 0xff; p[19] = (len >> 24) & 0xff; + + dev_dbg(&dev->dev, " encode mem32 %#llx-%#llx\n", + (unsigned long long) res->start, (unsigned long long) res->end); } -static void pnpbios_encode_fixed_mem32(unsigned char *p, struct resource *res) +static void pnpbios_encode_fixed_mem32(struct pnp_dev *dev, unsigned char *p, + struct resource *res) { unsigned long base = res->start; unsigned long len = res->end - res->start + 1; @@ -619,26 +632,36 @@ static void pnpbios_encode_fixed_mem32(unsigned char *p, struct resource *res) p[9] = (len >> 8) & 0xff; p[10] = (len >> 16) & 0xff; p[11] = (len >> 24) & 0xff; + + dev_dbg(&dev->dev, " encode fixed_mem32 %#llx-%#llx\n", + (unsigned long long) res->start, (unsigned long long) res->end); } -static void pnpbios_encode_irq(unsigned char *p, struct resource *res) +static void pnpbios_encode_irq(struct pnp_dev *dev, unsigned char *p, + struct resource *res) { unsigned long map = 0; map = 1 << res->start; p[1] = map & 0xff; p[2] = (map >> 8) & 0xff; + + dev_dbg(&dev->dev, " encode irq %d\n", res->start); } -static void pnpbios_encode_dma(unsigned char *p, struct resource *res) +static void pnpbios_encode_dma(struct pnp_dev *dev, unsigned char *p, + struct resource *res) { unsigned long map = 0; map = 1 << res->start; p[1] = map & 0xff; + + dev_dbg(&dev->dev, " encode dma %d\n", res->start); } -static void pnpbios_encode_port(unsigned char *p, struct resource *res) +static void pnpbios_encode_port(struct pnp_dev *dev, unsigned char *p, + struct resource *res) { unsigned long base = res->start; unsigned long len = res->end - res->start + 1; @@ -648,9 +671,13 @@ static void pnpbios_encode_port(unsigned char *p, struct resource *res) p[4] = base & 0xff; p[5] = (base >> 8) & 0xff; p[7] = len & 0xff; + + dev_dbg(&dev->dev, " encode io %#llx-%#llx\n", + (unsigned long long) res->start, (unsigned long long) res->end); } -static void pnpbios_encode_fixed_port(unsigned char *p, struct resource *res) +static void pnpbios_encode_fixed_port(struct pnp_dev *dev, unsigned char *p, + struct resource *res) { unsigned long base = res->start; unsigned long len = res->end - res->start + 1; @@ -658,6 +685,9 @@ static void pnpbios_encode_fixed_port(unsigned char *p, struct resource *res) p[1] = base & 0xff; p[2] = (base >> 8) & 0xff; p[3] = len & 0xff; + + dev_dbg(&dev->dev, " encode fixed_io %#llx-%#llx\n", + (unsigned long long) res->start, (unsigned long long) res->end); } 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 case LARGE_TAG_MEM: if (len != 9) goto len_err; - pnpbios_encode_mem(p, &res->mem_resource[mem]); + pnpbios_encode_mem(dev, p, &res->mem_resource[mem]); mem++; break; case LARGE_TAG_MEM32: if (len != 17) goto len_err; - pnpbios_encode_mem32(p, &res->mem_resource[mem]); + pnpbios_encode_mem32(dev, p, &res->mem_resource[mem]); mem++; break; case LARGE_TAG_FIXEDMEM32: if (len != 9) goto len_err; - pnpbios_encode_fixed_mem32(p, &res->mem_resource[mem]); + pnpbios_encode_fixed_mem32(dev, p, &res->mem_resource[mem]); mem++; break; case SMALL_TAG_IRQ: if (len < 2 || len > 3) goto len_err; - pnpbios_encode_irq(p, &res->irq_resource[irq]); + pnpbios_encode_irq(dev, p, &res->irq_resource[irq]); irq++; break; case SMALL_TAG_DMA: if (len != 2) goto len_err; - pnpbios_encode_dma(p, &res->dma_resource[dma]); + pnpbios_encode_dma(dev, p, &res->dma_resource[dma]); dma++; break; case SMALL_TAG_PORT: if (len != 7) goto len_err; - pnpbios_encode_port(p, &res->port_resource[port]); + pnpbios_encode_port(dev, p, &res->port_resource[port]); port++; break; @@ -734,7 +764,7 @@ static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev case SMALL_TAG_FIXEDPORT: if (len != 3) goto len_err; - pnpbios_encode_fixed_port(p, &res->port_resource[port]); + pnpbios_encode_fixed_port(dev, p, &res->port_resource[port]); port++; break; |