From: Rene Herman <rene.herman@keyaccess.nl>
To: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Len Brown <lenb@kernel.org>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
Adam Belay <ambx1@neo.rr.com>, Adam M Belay <abelay@mit.edu>,
Li Shaohua <shaohua.li@intel.com>,
Matthieu Castet <castet.matthieu@free.fr>,
Thomas Renninger <trenn@suse.de>,
Jaroslav Kysela <perex@perex.cz>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [patch 21/54] PNP: add debug when assigning PNP resources
Date: Sat, 26 Apr 2008 23:26:20 +0200 [thread overview]
Message-ID: <48139DFC.500@keyaccess.nl> (raw)
In-Reply-To: <20080425183928.375529075@ldl.fc.hp.com>
On 25-04-08 20:38, Bjorn Helgaas wrote:
Comments inline:
> This patch adds code to dump PNP resources before and after
> assigning resources and before writing them to the device.
>
> This is enabled by CONFIG_PNP_DEBUG=y.
>
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
>
> Index: work10/drivers/pnp/base.h
> ===================================================================
> --- work10.orig/drivers/pnp/base.h 2008-04-25 11:14:51.000000000 -0600
> +++ work10/drivers/pnp/base.h 2008-04-25 11:14:57.000000000 -0600
> @@ -16,3 +16,5 @@
> int pnp_check_mem(struct pnp_dev * dev, int idx);
> int pnp_check_irq(struct pnp_dev * dev, int idx);
> int pnp_check_dma(struct pnp_dev * dev, int idx);
> +
> +void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc);
> Index: work10/drivers/pnp/support.c
> ===================================================================
> --- work10.orig/drivers/pnp/support.c 2008-04-25 11:14:48.000000000 -0600
> +++ work10/drivers/pnp/support.c 2008-04-25 11:14:57.000000000 -0600
> @@ -51,3 +51,44 @@
> str[6] = hex_asc((id >> 0) & 0xf);
> str[7] = '\0';
> }
> +
> +#ifdef DEBUG
> +void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)
> +{
> + struct resource *res;
> + int i;
> +
> + dev_dbg(&dev->dev, "current resources: %s\n", desc);
> +
> + for (i = 0; i < PNP_MAX_IRQ; i++) {
> + res = &dev->res.irq_resource[i];
> + if (!(res->flags & IORESOURCE_UNSET))
> + dev_dbg(&dev->dev, " irq %lld flags 0x%lx\n",
> + (unsigned long long) res->start, res->flags);
> + }
> + for (i = 0; i < PNP_MAX_DMA; i++) {
> + res = &dev->res.dma_resource[i];
> + if (!(res->flags & IORESOURCE_UNSET))
> + dev_dbg(&dev->dev, " dma %lld flags 0x%lx\n",
> + (unsigned long long) res->start, res->flags);
> + }
> + for (i = 0; i < PNP_MAX_PORT; i++) {
> + res = &dev->res.port_resource[i];
> + if (!(res->flags & IORESOURCE_UNSET))
> + dev_dbg(&dev->dev, " io 0x%llx-0x%llx flags 0x%lx\n",
> + (unsigned long long) res->start,
> + (unsigned long long) res->end, res->flags);
> + }
> + for (i = 0; i < PNP_MAX_MEM; i++) {
> + res = &dev->res.mem_resource[i];
> + if (!(res->flags & IORESOURCE_UNSET))
> + dev_dbg(&dev->dev, " mem 0x%llx-0x%llx flags 0x%lx\n",
> + (unsigned long long) res->start,
> + (unsigned long long) res->end, res->flags);
> + }
> +}
> +#else
> +void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)
> +{
> +}
> +#endif
Not too important, but #ifdef could be inside body.
> Index: work10/drivers/pnp/manager.c
> ===================================================================
> --- work10.orig/drivers/pnp/manager.c 2008-04-25 11:14:55.000000000 -0600
> +++ work10/drivers/pnp/manager.c 2008-04-25 11:14:57.000000000 -0600
> @@ -28,20 +28,25 @@
> return 1;
> }
>
> - /* check if this resource has been manually set, if so skip */
> - if (!(dev->res.port_resource[idx].flags & IORESOURCE_AUTO))
> - return 1;
> -
> start = &dev->res.port_resource[idx].start;
> end = &dev->res.port_resource[idx].end;
> flags = &dev->res.port_resource[idx].flags;
>
> + /* check if this resource has been manually set, if so skip */
> + if (!(dev->res.port_resource[idx].flags & IORESOURCE_AUTO)) {
> + dev_dbg(&dev->dev, " io %d already set to 0x%llx-0x%llx "
> + "flags 0x%x\n", idx, (unsigned long long) *start,
> + (unsigned long long) *end, (int) *flags);
I wanted to ask/comment why you're casting the flags to int though. It's an
unsigned long, both in the resource and by type here. Ie, 0x%lx and no
casting? (I btw also like %#lx better then the explicit 0x, but that doesn't
really matter).
> + return 1;
> + }
> +
> /* set the initial values */
> *flags |= rule->flags | IORESOURCE_IO;
> *flags &= ~IORESOURCE_UNSET;
>
> if (!rule->size) {
> *flags |= IORESOURCE_DISABLED;
> + dev_dbg(&dev->dev, " io %d disabled\n", idx);
> return 1; /* skip disabled resource requests */
> }
>
> @@ -52,9 +57,13 @@
> while (!pnp_check_port(dev, idx)) {
> *start += rule->align;
> *end = *start + rule->size - 1;
> - if (*start > rule->max || !rule->align)
> + if (*start > rule->max || !rule->align) {
> + dev_dbg(&dev->dev, " couldn't assign io %d\n", idx);
> return 0;
> + }
> }
> + dev_dbg(&dev->dev, " assign io %d 0x%llx-0x%llx\n", idx,
> + (unsigned long long) *start, (unsigned long long) *end);
> return 1;
> }
>
> @@ -69,14 +78,18 @@
> return 1;
> }
>
> - /* check if this resource has been manually set, if so skip */
> - if (!(dev->res.mem_resource[idx].flags & IORESOURCE_AUTO))
> - return 1;
> -
> start = &dev->res.mem_resource[idx].start;
> end = &dev->res.mem_resource[idx].end;
> flags = &dev->res.mem_resource[idx].flags;
>
> + /* check if this resource has been manually set, if so skip */
> + if (!(dev->res.mem_resource[idx].flags & IORESOURCE_AUTO)) {
> + dev_dbg(&dev->dev, " mem %d already set to 0x%llx-0x%llx "
> + "flags 0x%x\n", idx, (unsigned long long) *start,
> + (unsigned long long) *end, (int) *flags);
Ditto.
> + return 1;
> + }
> +
> /* set the initial values */
> *flags |= rule->flags | IORESOURCE_MEM;
> *flags &= ~IORESOURCE_UNSET;
> @@ -93,6 +106,7 @@
>
> if (!rule->size) {
> *flags |= IORESOURCE_DISABLED;
> + dev_dbg(&dev->dev, " mem %d disabled\n", idx);
> return 1; /* skip disabled resource requests */
> }
>
> @@ -103,9 +117,13 @@
> while (!pnp_check_mem(dev, idx)) {
> *start += rule->align;
> *end = *start + rule->size - 1;
> - if (*start > rule->max || !rule->align)
> + if (*start > rule->max || !rule->align) {
> + dev_dbg(&dev->dev, " couldn't assign mem %d\n", idx);
> return 0;
> + }
> }
> + dev_dbg(&dev->dev, " assign mem %d 0x%llx-0x%llx\n", idx,
> + (unsigned long long) *start, (unsigned long long) *end);
> return 1;
> }
>
> @@ -126,20 +144,24 @@
> return 1;
> }
>
> - /* check if this resource has been manually set, if so skip */
> - if (!(dev->res.irq_resource[idx].flags & IORESOURCE_AUTO))
> - return 1;
> -
> start = &dev->res.irq_resource[idx].start;
> end = &dev->res.irq_resource[idx].end;
> flags = &dev->res.irq_resource[idx].flags;
>
> + /* check if this resource has been manually set, if so skip */
> + if (!(dev->res.irq_resource[idx].flags & IORESOURCE_AUTO)) {
> + dev_dbg(&dev->dev, " irq %d already set to %d flags 0x%x\n",
> + idx, (int) *start, (int) *flags);
Ditto.
> + return 1;
> + }
> +
> /* set the initial values */
> *flags |= rule->flags | IORESOURCE_IRQ;
> *flags &= ~IORESOURCE_UNSET;
>
> if (bitmap_empty(rule->map, PNP_IRQ_NR)) {
> *flags |= IORESOURCE_DISABLED;
> + dev_dbg(&dev->dev, " irq %d disabled\n", idx);
> return 1; /* skip disabled resource requests */
> }
>
> @@ -147,15 +169,20 @@
> *start = find_next_bit(rule->map, PNP_IRQ_NR, 16);
> if (*start < PNP_IRQ_NR) {
> *end = *start;
> + dev_dbg(&dev->dev, " assign irq %d %d\n", idx, (int) *start);
> return 1;
> }
> for (i = 0; i < 16; i++) {
> if (test_bit(xtab[i], rule->map)) {
> *start = *end = xtab[i];
> - if (pnp_check_irq(dev, idx))
> + if (pnp_check_irq(dev, idx)) {
> + dev_dbg(&dev->dev, " assign irq %d %d\n", idx,
> + (int) *start);
> return 1;
> + }
> }
> }
> + dev_dbg(&dev->dev, " couldn't assign irq %d\n", idx);
> return 0;
> }
>
> @@ -175,14 +202,17 @@
> return;
> }
>
> - /* check if this resource has been manually set, if so skip */
> - if (!(dev->res.dma_resource[idx].flags & IORESOURCE_AUTO))
> - return;
> -
> start = &dev->res.dma_resource[idx].start;
> end = &dev->res.dma_resource[idx].end;
> flags = &dev->res.dma_resource[idx].flags;
>
> + /* check if this resource has been manually set, if so skip */
> + if (!(dev->res.dma_resource[idx].flags & IORESOURCE_AUTO)) {
> + dev_dbg(&dev->dev, " dma %d already set to %d flags 0x%x\n",
> + idx, (int) *start, (int) *flags);
... and ditto.
Rene
next prev parent reply other threads:[~2008-04-26 21:26 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-25 18:38 [patch 00/54] PNP cleanup, v4 Bjorn Helgaas
2008-04-25 18:38 ` [patch 01/54] PNP: turn on -DDEBUG when CONFIG_PNP_DEBUG is set Bjorn Helgaas
2008-04-25 18:38 ` [patch 02/54] ISAPNP: move config register addresses out of isapnp.h Bjorn Helgaas
2008-04-25 18:38 ` [patch 03/54] PNPACPI: continue after _CRS and _PRS errors Bjorn Helgaas
2008-04-25 18:38 ` [patch 04/54] PNP: make pnp_add_id() internal to PNP core Bjorn Helgaas
2008-04-25 18:38 ` [patch 05/54] PNP: change pnp_add_id() to allocate its own pnp_id structures Bjorn Helgaas
2008-04-25 18:38 ` [patch 06/54] PNP: add pnp_eisa_id_to_string() Bjorn Helgaas
2008-04-25 18:38 ` [patch 07/54] PNP: add pnp_alloc_dev() Bjorn Helgaas
2008-04-25 18:38 ` [patch 08/54] PNP: make pnp_add_card_id() internal to PNP core Bjorn Helgaas
2008-04-25 18:38 ` [patch 09/54] PNP: change pnp_add_card_id() to allocate its own pnp_id structures Bjorn Helgaas
2008-04-25 18:38 ` [patch 10/54] ISAPNP: pull pnp_add_card_id() out of isapnp_parse_card_id() Bjorn Helgaas
2008-04-25 18:38 ` [patch 11/54] PNP: add pnp_alloc_card() Bjorn Helgaas
2008-04-25 18:38 ` [patch 12/54] PNPACPI: pnpacpi_encode_ext_irq() wrongly set "irq" instead of "extended_irq" Bjorn Helgaas
2008-04-25 18:38 ` [patch 13/54] PNPACPI: use temporaries to reduce repetition Bjorn Helgaas
2008-04-25 18:38 ` [patch 14/54] PNPACPI: hoist dma_flags() out of pnpacpi_parse_allocated_dmaresource() Bjorn Helgaas
2008-04-25 18:38 ` [patch 15/54] PNPACPI: extend irq_flags() to set IORESOURCE_IRQ_SHAREABLE when appropriate Bjorn Helgaas
2008-04-25 18:38 ` [patch 16/54] PNPACPI: pass pnp_dev instead of acpi_handle Bjorn Helgaas
2008-04-25 18:38 ` [patch 17/54] PNP: add debug output to option registration Bjorn Helgaas
2008-04-25 18:38 ` [patch 18/54] PNP: remove pnp_resource_table from internal get/set interfaces Bjorn Helgaas
2008-04-25 18:38 ` [patch 19/54] PNP: remove more pnp_resource_table arguments Bjorn Helgaas
2008-04-25 18:38 ` [patch 20/54] PNP: add debug output to encoders Bjorn Helgaas
2008-04-25 18:38 ` [patch 21/54] PNP: add debug when assigning PNP resources Bjorn Helgaas
2008-04-26 21:26 ` Rene Herman [this message]
2008-04-28 15:25 ` Bjorn Helgaas
2008-04-25 18:38 ` [patch 22/54] PNP: add pnp_init_resources(struct pnp_dev *) interface Bjorn Helgaas
2008-04-25 18:38 ` [patch 23/54] PNP: remove pnp_resource_table from internal pnp_clean_resource_table interface Bjorn Helgaas
2008-04-25 18:38 ` [patch 24/54] PNP: remove unused interfaces using pnp_resource_table Bjorn Helgaas
2008-04-25 18:38 ` [patch 25/54] PNP: use dev_printk when possible Bjorn Helgaas
2008-04-25 18:38 ` [patch 26/54] PNP: factor pnp_init_resource_table() and pnp_clean_resource_table() Bjorn Helgaas
2008-04-26 21:33 ` Rene Herman
2008-04-28 17:15 ` Bjorn Helgaas
2008-04-25 18:38 ` [patch 27/54] PNP: add pnp_get_resource() interface Bjorn Helgaas
2008-04-25 18:38 ` [patch 28/54] PNP: remove pnp_mem_flags() as an lvalue Bjorn Helgaas
2008-04-25 18:38 ` [patch 29/54] PNP: convert resource accessors to use pnp_get_resource(), not pnp_resource_table Bjorn Helgaas
2008-04-26 21:42 ` Rene Herman
2008-04-28 17:19 ` Bjorn Helgaas
2008-04-25 18:38 ` [patch 30/54] PNP: use conventional "i" for loop indices Bjorn Helgaas
2008-04-25 18:38 ` [patch 31/54] PNP: reduce redundancy in pnp_assign_port() and others Bjorn Helgaas
2008-04-25 18:38 ` [patch 32/54] PNP: reduce redundancy in pnp_check_port() " Bjorn Helgaas
2008-04-25 18:38 ` [patch 33/54] PNP: reduce redundancy in pnp_set_current_resources() Bjorn Helgaas
2008-04-25 18:38 ` [patch 34/54] PNP: check for conflicts with all resources, not just earlier ones Bjorn Helgaas
2008-04-25 18:38 ` [patch 35/54] PNP: pass resources, not indexes, to pnp_check_port(), et al Bjorn Helgaas
2008-04-25 18:38 ` [patch 36/54] PNP: convert resource checks to use pnp_get_resource(), not pnp_resource_table Bjorn Helgaas
2008-04-25 18:38 ` [patch 37/54] PNP: convert encoders " Bjorn Helgaas
2008-04-25 18:38 ` [patch 38/54] PNP: remove PNP_MAX_* uses Bjorn Helgaas
2008-04-26 22:10 ` Rene Herman
2008-04-25 18:38 ` [patch 39/54] rtc: dont reference pnp_resource_table directly Bjorn Helgaas
2008-04-25 18:38 ` [patch 40/54] PNP: make pnp_resource_table private to PNP core Bjorn Helgaas
2008-04-25 18:38 ` [patch 41/54] PNP: remove pnp_resource_table references from resource decoders Bjorn Helgaas
2008-04-26 22:28 ` Rene Herman
2008-04-28 20:36 ` Bjorn Helgaas
2008-04-28 20:41 ` Rene Herman
2008-04-25 18:38 ` [patch 42/54] PNP: add struct pnp_resource Bjorn Helgaas
2008-04-25 18:38 ` [patch 43/54] PNP: add pnp_resource index for ISAPNP Bjorn Helgaas
2008-04-25 18:38 ` [patch 44/54] PNP: add pnp_new_resource() to find a new unset pnp_resource Bjorn Helgaas
2008-04-26 22:37 ` Rene Herman
2008-04-28 20:43 ` Bjorn Helgaas
2008-04-25 18:38 ` [patch 45/54] PNP: make generic pnp_add_irq_resource() Bjorn Helgaas
2008-04-25 18:38 ` [patch 46/54] PNP: make generic pnp_add_dma_resource() Bjorn Helgaas
2008-04-25 18:38 ` [patch 47/54] PNP: make generic pnp_add_io_resource() Bjorn Helgaas
2008-04-25 18:38 ` [patch 48/54] PNP: make generic pnp_add_mem_resource() Bjorn Helgaas
2008-04-25 18:38 ` [patch 49/54] PNP: use pnp_get_pnp_resource() in resource assignment functions Bjorn Helgaas
2008-04-25 18:38 ` [patch 50/54] ISAPNP: fold isapnp_read_resources() back into isapnp_get_resources() Bjorn Helgaas
2008-04-26 23:07 ` Rene Herman
2008-04-28 21:07 ` Bjorn Helgaas
2008-04-29 6:53 ` 2.6.25 pci=noacpi Richard
2008-04-29 7:04 ` Andrew Morton
2008-04-29 7:17 ` Richard
2008-04-29 7:27 ` Richard
2008-05-04 19:23 ` Rene Herman
2008-05-08 6:59 ` Richard
2008-05-08 7:08 ` Richard
2008-05-08 11:50 ` Rene Herman
2008-04-25 18:38 ` [patch 51/54] PNPACPI: move _CRS/_PRS warnings closer to the action Bjorn Helgaas
2008-04-25 18:38 ` [patch 52/54] PNP: make interfaces private to the PNP core Bjorn Helgaas
2008-04-25 18:39 ` [patch 53/54] ISAPNP: remove unused pnp_dev->regs field Bjorn Helgaas
2008-04-25 18:39 ` [patch 54/54] PNPBIOS: remove include/linux/pnpbios.h Bjorn Helgaas
2008-04-26 23:34 ` [patch 00/54] PNP cleanup, v4 Rene Herman
2008-04-26 23:47 ` Rene Herman
2008-04-28 21:16 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48139DFC.500@keyaccess.nl \
--to=rene.herman@keyaccess.nl \
--cc=abelay@mit.edu \
--cc=akpm@linux-foundation.org \
--cc=ambx1@neo.rr.com \
--cc=bjorn.helgaas@hp.com \
--cc=castet.matthieu@free.fr \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=shaohua.li@intel.com \
--cc=trenn@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox