Commit 7e0e9c042790d4ea44c6a00ddaad8b8bbcc3f17f

Authored by Bjorn Helgaas
Committed by Len Brown
1 parent fa35b49260

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

... ... @@ -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
... ... @@ -278,6 +278,7 @@
278 278 switch (pnp_resource_type(res)) {
279 279 case IORESOURCE_IO:
280 280 case IORESOURCE_MEM:
  281 + case IORESOURCE_BUS:
281 282 pnp_printf(buffer, " %#llx-%#llx%s\n",
282 283 (unsigned long long) res->start,
283 284 (unsigned long long) res->end,
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
... ... @@ -69,8 +69,10 @@
69 69 return "irq";
70 70 case IORESOURCE_DMA:
71 71 return "dma";
  72 + case IORESOURCE_BUS:
  73 + return "bus";
72 74 }
73   - return NULL;
  75 + return "unknown";
74 76 }
75 77  
76 78 void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)