]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
PNPACPI: add bus number support
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Fri, 5 Mar 2010 17:47:57 +0000 (10:47 -0700)
committerLen Brown <len.brown@intel.com>
Mon, 15 Mar 2010 00:08:38 +0000 (20:08 -0400)
Add support for bus number resources.  This is for bridges with a range of
bus numbers behind them.  Previously, PNP ignored bus number resources.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/pnp/base.h
drivers/pnp/interface.c
drivers/pnp/pnpacpi/rsparser.c
drivers/pnp/resource.c
drivers/pnp/support.c

index 0b8d14050efaf2e424b11c5a07515d1c2eb1f6c1..0bab84ebb15da8961e20be1ebfd120355ea3cdea 100644 (file)
@@ -166,6 +166,9 @@ struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev,
 struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev,
                                          resource_size_t start,
                                          resource_size_t end, int flags);
+struct pnp_resource *pnp_add_bus_resource(struct pnp_dev *dev,
+                                         resource_size_t start,
+                                         resource_size_t end);
 
 extern int pnp_debug;
 
index ba437b704de88b4fb282698b73ecba4cebb74bb5..cfaf5b73540bbc6b958ad7e5f15ea4822ab7c8d6 100644 (file)
@@ -278,6 +278,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev,
                switch (pnp_resource_type(res)) {
                case IORESOURCE_IO:
                case IORESOURCE_MEM:
+               case IORESOURCE_BUS:
                        pnp_printf(buffer, " %#llx-%#llx%s\n",
                                   (unsigned long long) res->start,
                                   (unsigned long long) res->end,
index 0d7d61da63fcb8accad915d4394c4723467316a3..54514aa35b093f27d11604d4bca986e5b6c53e5c 100644 (file)
@@ -265,6 +265,14 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev,
        pnp_add_mem_resource(dev, start, end, flags);
 }
 
+static void pnpacpi_parse_allocated_busresource(struct pnp_dev *dev,
+                                               u64 start, u64 len)
+{
+       u64 end = start + len - 1;
+
+       pnp_add_bus_resource(dev, start, end);
+}
+
 static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,
                                                  struct acpi_resource *res)
 {
@@ -290,6 +298,9 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,
                        p->minimum, p->address_length,
                        p->granularity == 0xfff ? ACPI_DECODE_10 :
                                ACPI_DECODE_16, window);
+       else if (p->resource_type == ACPI_BUS_NUMBER_RANGE)
+               pnpacpi_parse_allocated_busresource(dev, p->minimum,
+                                                   p->address_length);
 }
 
 static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev,
@@ -309,6 +320,9 @@ static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev,
                        p->minimum, p->address_length,
                        p->granularity == 0xfff ? ACPI_DECODE_10 :
                                ACPI_DECODE_16, window);
+       else if (p->resource_type == ACPI_BUS_NUMBER_RANGE)
+               pnpacpi_parse_allocated_busresource(dev, p->minimum,
+                                                   p->address_length);
 }
 
 static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
index 64d0596bafb5949aacc8e1ae9c6bffdd578f91fe..5b277dbaacde5df589b227ac754056fe86757428 100644 (file)
@@ -470,7 +470,8 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
 unsigned long pnp_resource_type(struct resource *res)
 {
        return res->flags & (IORESOURCE_IO  | IORESOURCE_MEM |
-                            IORESOURCE_IRQ | IORESOURCE_DMA);
+                            IORESOURCE_IRQ | IORESOURCE_DMA |
+                            IORESOURCE_BUS);
 }
 
 struct resource *pnp_get_resource(struct pnp_dev *dev,
@@ -590,6 +591,30 @@ struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev,
        return pnp_res;
 }
 
+struct pnp_resource *pnp_add_bus_resource(struct pnp_dev *dev,
+                                         resource_size_t start,
+                                         resource_size_t end)
+{
+       struct pnp_resource *pnp_res;
+       struct resource *res;
+
+       pnp_res = pnp_new_resource(dev);
+       if (!pnp_res) {
+               dev_err(&dev->dev, "can't add resource for BUS %#llx-%#llx\n",
+                       (unsigned long long) start,
+                       (unsigned long long) end);
+               return NULL;
+       }
+
+       res = &pnp_res->res;
+       res->flags = IORESOURCE_BUS;
+       res->start = start;
+       res->end = end;
+
+       pnp_dbg(&dev->dev, "  add %pr\n", res);
+       return pnp_res;
+}
+
 /*
  * Determine whether the specified resource is a possible configuration
  * for this device.
index 9585c1c1cc3669783653deb6841d14fe0c10b292..f5beb24d036a334b942b1dccaeb9494a76ffde72 100644 (file)
@@ -69,8 +69,10 @@ char *pnp_resource_type_name(struct resource *res)
                return "irq";
        case IORESOURCE_DMA:
                return "dma";
+       case IORESOURCE_BUS:
+               return "bus";
        }
-       return NULL;
+       return "unknown";
 }
 
 void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)