Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bjorn Helgaas and committed by
Len Brown
7e0e9c04 fa35b492

+47 -2
+3
drivers/pnp/base.h
··· 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
+1
drivers/pnp/interface.c
··· 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,
+14
drivers/pnp/pnpacpi/rsparser.c
··· 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 { ··· 298 290 p->minimum, p->address_length, 299 291 p->granularity == 0xfff ? ACPI_DECODE_10 : 300 292 ACPI_DECODE_16, window); 293 + else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) 294 + pnpacpi_parse_allocated_busresource(dev, p->minimum, 295 + p->address_length); 301 296 } 302 297 303 298 static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, ··· 320 309 p->minimum, p->address_length, 321 310 p->granularity == 0xfff ? ACPI_DECODE_10 : 322 311 ACPI_DECODE_16, window); 312 + else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) 313 + pnpacpi_parse_allocated_busresource(dev, p->minimum, 314 + p->address_length); 323 315 } 324 316 325 317 static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
+26 -1
drivers/pnp/resource.c
··· 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, ··· 584 583 585 584 res = &pnp_res->res; 586 585 res->flags = IORESOURCE_MEM | flags; 586 + res->start = start; 587 + res->end = end; 588 + 589 + pnp_dbg(&dev->dev, " add %pr\n", res); 590 + return pnp_res; 591 + } 592 + 593 + struct pnp_resource *pnp_add_bus_resource(struct pnp_dev *dev, 594 + resource_size_t start, 595 + resource_size_t end) 596 + { 597 + struct pnp_resource *pnp_res; 598 + struct resource *res; 599 + 600 + pnp_res = pnp_new_resource(dev); 601 + if (!pnp_res) { 602 + dev_err(&dev->dev, "can't add resource for BUS %#llx-%#llx\n", 603 + (unsigned long long) start, 604 + (unsigned long long) end); 605 + return NULL; 606 + } 607 + 608 + res = &pnp_res->res; 609 + res->flags = IORESOURCE_BUS; 587 610 res->start = start; 588 611 res->end = end; 589 612
+3 -1
drivers/pnp/support.c
··· 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)