Re: [patch 2/2] PNP: don't check disabled PCI BARs for conflicts in quirk_system_pci_resources()

Rene Herman
2008-09-30T19:34:15Z

[-- Attachment #1: Type: text/plain, Size: 942 bytes --]

On 30-09-08 19:21, Linus Torvalds wrote:

> It looks like both of these will fall afoul of the fact that ACPI
> currently seems to _expect_ to be called in the old order, ie I get some
> oops in acpi_irq_penalty_init() apparently because it knew that it got
> called later (thanks to being called from pci_acpi_init in the
> arch-specific directory), and knew that the other ACPI subsys setup
> routines had been done before.

Yes, I also get that oops but other than that, both link order versions
you sent out work -- ie, booting with acpi=noirq gets me to a functional
system with the quirk having run for PNP0c02 (acpi=off disables all of
PNP0c02) and doing its job.

For some reason only some of your messages seem to be making it into my
inbox (in order, at least) but either of these that is:

http://lkml.org/lkml/2008/9/30/242
http://lkml.org/lkml/2008/9/30/261

With the attached on top, all's working fine for me.

Rene.

[-- Attachment #2: quirk_system_pci_resources.diff --]
[-- Type: text/plain, Size: 2096 bytes --]

diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 0bdf9b8..0cf4ccf 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -230,7 +230,8 @@ static void quirk_ad1815_mpu_resources(struct pnp_dev *dev)
static void quirk_system_pci_resources(struct pnp_dev *dev)
{
struct pci_dev *pdev = NULL;
- struct resource *res;
+ struct resource *pci_res;
+ struct resource *pnp_res;
resource_size_t pnp_start, pnp_end, pci_start, pci_end;
int i, j;

@@ -247,20 +248,27 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
unsigned int type;

- type = pci_resource_flags(pdev, i) &
- (IORESOURCE_IO | IORESOURCE_MEM);
- if (!type || pci_resource_len(pdev, i) == 0)
+ pci_res = &pdev->resource[i];
+
+ /* skip unregistered resources */
+ if (!pci_res->parent)
+ continue;
+
+ type = pci_res->flags &
+ (IORESOURCE_IO | IORESOURCE_MEM);
+ if (!type)
continue;

- pci_start = pci_resource_start(pdev, i);
- pci_end = pci_resource_end(pdev, i);
+ pci_start = pci_res->start;
+ pci_end = pci_res->end;
+
for (j = 0;
- (res = pnp_get_resource(dev, type, j)); j++) {
- if (res->start == 0 && res->end == 0)
- continue;
+ (pnp_res = pnp_get_resource(dev, type, j)); j++) {
+ pnp_start = pnp_res->start;
+ pnp_end = pnp_res->end;

- pnp_start = res->start;
- pnp_end = res->end;
+ if (pnp_end < pnp_start || !pnp_end)
+ continue;

/*
* If the PNP region doesn't overlap the PCI
@@ -288,13 +296,13 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
dev_warn(&dev->dev, "%s resource "
"(0x%llx-0x%llx) overlaps %s BAR %d "
"(0x%llx-0x%llx), disabling\n",
- pnp_resource_type_name(res),
+ pnp_resource_type_name(pnp_res),
(unsigned long long) pnp_start,
(unsigned long long) pnp_end,
pci_name(pdev), i,
(unsigned long long) pci_start,
(unsigned long long) pci_end);
- res->flags |= IORESOURCE_DISABLED;
+ pnp_res->flags |= IORESOURCE_DISABLED;
}
}
}