diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2010-03-05 12:47:57 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-03-14 20:08:38 -0400 |
commit | 7e0e9c042790d4ea44c6a00ddaad8b8bbcc3f17f (patch) | |
tree | b0caf1f008ae1f2f2f32bfecfaba7c8ba9986c6f /drivers | |
parent | fa35b49260b615d634bfa1f767aa315fa323c2e9 (diff) |
PNPACPI: add bus number support
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pnp/base.h | 3 | ||||
-rw-r--r-- | drivers/pnp/interface.c | 1 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 14 | ||||
-rw-r--r-- | drivers/pnp/resource.c | 27 | ||||
-rw-r--r-- | drivers/pnp/support.c | 4 |
5 files changed, 47 insertions, 2 deletions
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h index 0b8d14050efa..0bab84ebb15d 100644 --- a/drivers/pnp/base.h +++ b/drivers/pnp/base.h | |||
@@ -166,6 +166,9 @@ struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev, | |||
166 | struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev, | 166 | struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev, |
167 | resource_size_t start, | 167 | resource_size_t start, |
168 | resource_size_t end, int flags); | 168 | resource_size_t end, int flags); |
169 | struct pnp_resource *pnp_add_bus_resource(struct pnp_dev *dev, | ||
170 | resource_size_t start, | ||
171 | resource_size_t end); | ||
169 | 172 | ||
170 | extern int pnp_debug; | 173 | extern int pnp_debug; |
171 | 174 | ||
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index ba437b704de8..cfaf5b73540b 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -278,6 +278,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, | |||
278 | switch (pnp_resource_type(res)) { | 278 | switch (pnp_resource_type(res)) { |
279 | case IORESOURCE_IO: | 279 | case IORESOURCE_IO: |
280 | case IORESOURCE_MEM: | 280 | case IORESOURCE_MEM: |
281 | case IORESOURCE_BUS: | ||
281 | pnp_printf(buffer, " %#llx-%#llx%s\n", | 282 | pnp_printf(buffer, " %#llx-%#llx%s\n", |
282 | (unsigned long long) res->start, | 283 | (unsigned long long) res->start, |
283 | (unsigned long long) res->end, | 284 | (unsigned long long) res->end, |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 0d7d61da63fc..54514aa35b09 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -265,6 +265,14 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev, | |||
265 | pnp_add_mem_resource(dev, start, end, flags); | 265 | pnp_add_mem_resource(dev, start, end, flags); |
266 | } | 266 | } |
267 | 267 | ||
268 | static void pnpacpi_parse_allocated_busresource(struct pnp_dev *dev, | ||
269 | u64 start, u64 len) | ||
270 | { | ||
271 | u64 end = start + len - 1; | ||
272 | |||
273 | pnp_add_bus_resource(dev, start, end); | ||
274 | } | ||
275 | |||
268 | static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, | 276 | static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, |
269 | struct acpi_resource *res) | 277 | struct acpi_resource *res) |
270 | { | 278 | { |
@@ -290,6 +298,9 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, | |||
290 | p->minimum, p->address_length, | 298 | p->minimum, p->address_length, |
291 | p->granularity == 0xfff ? ACPI_DECODE_10 : | 299 | p->granularity == 0xfff ? ACPI_DECODE_10 : |
292 | ACPI_DECODE_16, window); | 300 | ACPI_DECODE_16, window); |
301 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) | ||
302 | pnpacpi_parse_allocated_busresource(dev, p->minimum, | ||
303 | p->address_length); | ||
293 | } | 304 | } |
294 | 305 | ||
295 | static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, | 306 | 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, | |||
309 | p->minimum, p->address_length, | 320 | p->minimum, p->address_length, |
310 | p->granularity == 0xfff ? ACPI_DECODE_10 : | 321 | p->granularity == 0xfff ? ACPI_DECODE_10 : |
311 | ACPI_DECODE_16, window); | 322 | ACPI_DECODE_16, window); |
323 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) | ||
324 | pnpacpi_parse_allocated_busresource(dev, p->minimum, | ||
325 | p->address_length); | ||
312 | } | 326 | } |
313 | 327 | ||
314 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 328 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index 64d0596bafb5..5b277dbaacde 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
@@ -470,7 +470,8 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res) | |||
470 | unsigned long pnp_resource_type(struct resource *res) | 470 | unsigned long pnp_resource_type(struct resource *res) |
471 | { | 471 | { |
472 | return res->flags & (IORESOURCE_IO | IORESOURCE_MEM | | 472 | return res->flags & (IORESOURCE_IO | IORESOURCE_MEM | |
473 | IORESOURCE_IRQ | IORESOURCE_DMA); | 473 | IORESOURCE_IRQ | IORESOURCE_DMA | |
474 | IORESOURCE_BUS); | ||
474 | } | 475 | } |
475 | 476 | ||
476 | struct resource *pnp_get_resource(struct pnp_dev *dev, | 477 | struct resource *pnp_get_resource(struct pnp_dev *dev, |
@@ -590,6 +591,30 @@ struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev, | |||
590 | return pnp_res; | 591 | return pnp_res; |
591 | } | 592 | } |
592 | 593 | ||
594 | struct pnp_resource *pnp_add_bus_resource(struct pnp_dev *dev, | ||
595 | resource_size_t start, | ||
596 | resource_size_t end) | ||
597 | { | ||
598 | struct pnp_resource *pnp_res; | ||
599 | struct resource *res; | ||
600 | |||
601 | pnp_res = pnp_new_resource(dev); | ||
602 | if (!pnp_res) { | ||
603 | dev_err(&dev->dev, "can't add resource for BUS %#llx-%#llx\n", | ||
604 | (unsigned long long) start, | ||
605 | (unsigned long long) end); | ||
606 | return NULL; | ||
607 | } | ||
608 | |||
609 | res = &pnp_res->res; | ||
610 | res->flags = IORESOURCE_BUS; | ||
611 | res->start = start; | ||
612 | res->end = end; | ||
613 | |||
614 | pnp_dbg(&dev->dev, " add %pr\n", res); | ||
615 | return pnp_res; | ||
616 | } | ||
617 | |||
593 | /* | 618 | /* |
594 | * Determine whether the specified resource is a possible configuration | 619 | * Determine whether the specified resource is a possible configuration |
595 | * for this device. | 620 | * for this device. |
diff --git a/drivers/pnp/support.c b/drivers/pnp/support.c index 9585c1c1cc36..f5beb24d036a 100644 --- a/drivers/pnp/support.c +++ b/drivers/pnp/support.c | |||
@@ -69,8 +69,10 @@ char *pnp_resource_type_name(struct resource *res) | |||
69 | return "irq"; | 69 | return "irq"; |
70 | case IORESOURCE_DMA: | 70 | case IORESOURCE_DMA: |
71 | return "dma"; | 71 | return "dma"; |
72 | case IORESOURCE_BUS: | ||
73 | return "bus"; | ||
72 | } | 74 | } |
73 | return NULL; | 75 | return "unknown"; |
74 | } | 76 | } |
75 | 77 | ||
76 | void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc) | 78 | void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc) |