Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[sfrench/cifs-2.6.git] / drivers / pnp / pnpacpi / rsparser.c
index 0e3b8d0ff06b78a3432d9846a904e2c29a1f2e75..6b9840cce0f4a8cdf9b1a2a51c48e186e53015f2 100644 (file)
@@ -75,6 +75,8 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
 {
        int i = 0;
        int irq;
+       int p, t;
+       static unsigned char warned;
 
        if (!valid_IRQ(gsi))
                return;
@@ -82,8 +84,28 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
        while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
               i < PNP_MAX_IRQ)
                i++;
-       if (i >= PNP_MAX_IRQ)
+       if (i >= PNP_MAX_IRQ && !warned) {
+               printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ "
+                               "resources: %d \n", PNP_MAX_IRQ);
+               warned = 1;
                return;
+       }
+       /*
+        * in IO-APIC mode, use overrided attribute. Two reasons:
+        * 1. BIOS bug in DSDT
+        * 2. BIOS uses IO-APIC mode Interrupt Source Override
+        */
+       if (!acpi_get_override_irq(gsi, &t, &p)) {
+               t = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
+               p = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
+
+               if (triggering != t || polarity != p) {
+                       pnp_warn("IRQ %d override to %s, %s",
+                               gsi, t ? "edge":"level", p ? "low":"high");
+                       triggering = t;
+                       polarity = p;
+               }
+       }
 
        res->irq_resource[i].flags = IORESOURCE_IRQ;    // Also clears _UNSET flag
        res->irq_resource[i].flags |= irq_flags(triggering, polarity);
@@ -149,6 +171,7 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
                                                int bus_master, int transfer)
 {
        int i = 0;
+       static unsigned char warned;
 
        while (i < PNP_MAX_DMA &&
               !(res->dma_resource[i].flags & IORESOURCE_UNSET))
@@ -163,6 +186,10 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
                }
                res->dma_resource[i].start = dma;
                res->dma_resource[i].end = dma;
+       } else if (!warned) {
+               printk(KERN_ERR "pnpacpi: exceeded the max number of DMA "
+                               "resources: %d \n", PNP_MAX_DMA);
+               warned = 1;
        }
 }
 
@@ -170,6 +197,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
                                               u64 io, u64 len, int io_decode)
 {
        int i = 0;
+       static unsigned char warned;
 
        while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
               i < PNP_MAX_PORT)
@@ -184,6 +212,10 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
                }
                res->port_resource[i].start = io;
                res->port_resource[i].end = io + len - 1;
+       } else if (!warned) {
+               printk(KERN_ERR "pnpacpi: exceeded the max number of IO "
+                               "resources: %d \n", PNP_MAX_PORT);
+               warned = 1;
        }
 }
 
@@ -192,6 +224,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
                                                int write_protect)
 {
        int i = 0;
+       static unsigned char warned;
 
        while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
               (i < PNP_MAX_MEM))
@@ -207,6 +240,10 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
 
                res->mem_resource[i].start = mem;
                res->mem_resource[i].end = mem + len - 1;
+       } else if (!warned) {
+               printk(KERN_ERR "pnpacpi: exceeded the max number of mem "
+                               "resources: %d\n", PNP_MAX_MEM);
+               warned = 1;
        }
 }