Commit 7e0e9c042790d4ea44c6a00ddaad8b8bbcc3f17f
Committed by
Len Brown
1 parent
fa35b49260
Exists in
master
and in
4 other branches
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>
Showing 5 changed files with 47 additions and 2 deletions Side-by-side Diff
drivers/pnp/base.h
... | ... | @@ -166,6 +166,9 @@ |
166 | 166 | struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev, |
167 | 167 | resource_size_t start, |
168 | 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 | 173 | extern int pnp_debug; |
171 | 174 |
drivers/pnp/interface.c
drivers/pnp/pnpacpi/rsparser.c
... | ... | @@ -265,6 +265,14 @@ |
265 | 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 | 276 | static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, |
269 | 277 | struct acpi_resource *res) |
270 | 278 | { |
... | ... | @@ -290,6 +298,9 @@ |
290 | 298 | p->minimum, p->address_length, |
291 | 299 | p->granularity == 0xfff ? ACPI_DECODE_10 : |
292 | 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 | 306 | static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, |
... | ... | @@ -309,6 +320,9 @@ |
309 | 320 | p->minimum, p->address_length, |
310 | 321 | p->granularity == 0xfff ? ACPI_DECODE_10 : |
311 | 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 | 328 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
drivers/pnp/resource.c
... | ... | @@ -470,7 +470,8 @@ |
470 | 470 | unsigned long pnp_resource_type(struct resource *res) |
471 | 471 | { |
472 | 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 | 477 | struct resource *pnp_get_resource(struct pnp_dev *dev, |
... | ... | @@ -583,6 +584,30 @@ |
583 | 584 | |
584 | 585 | res = &pnp_res->res; |
585 | 586 | res->flags = IORESOURCE_MEM | flags; |
587 | + res->start = start; | |
588 | + res->end = end; | |
589 | + | |
590 | + pnp_dbg(&dev->dev, " add %pr\n", res); | |
591 | + return pnp_res; | |
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; | |
586 | 611 | res->start = start; |
587 | 612 | res->end = end; |
588 | 613 |
drivers/pnp/support.c