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

ARM: Make PCI I/O space optional

For callers of pci_common_init_dev(), we previously always required a PCI
I/O port resource. If the caller's ->setup() function had added an I/O
resource, we used that; otherwise, we added a default 64K I/O port space
for it.

There are PCI host bridges that do not support I/O port space, and we
should not add fictitious spaces for them.

If a caller sets struct hw_pci.io_optional, assume it is responsible for
adding any I/O port resource it desires, and do not add any default I/O
port space.

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

+12 -2
+1
arch/arm/include/asm/mach/pci.h
··· 22 22 struct msi_controller *msi_ctrl; 23 23 struct pci_ops *ops; 24 24 int nr_controllers; 25 + unsigned int io_optional:1; 25 26 void **private_data; 26 27 int (*setup)(int nr, struct pci_sys_data *); 27 28 struct pci_bus *(*scan)(int nr, struct pci_sys_data *);
+11 -2
arch/arm/kernel/bios32.c
··· 410 410 return irq; 411 411 } 412 412 413 - static int pcibios_init_resources(int busnr, struct pci_sys_data *sys) 413 + static int pcibios_init_resource(int busnr, struct pci_sys_data *sys, 414 + int io_optional) 414 415 { 415 416 int ret; 416 417 struct resource_entry *window; ··· 420 419 pci_add_resource_offset(&sys->resources, 421 420 &iomem_resource, sys->mem_offset); 422 421 } 422 + 423 + /* 424 + * If a platform says I/O port support is optional, we don't add 425 + * the default I/O space. The platform is responsible for adding 426 + * any I/O space it needs. 427 + */ 428 + if (io_optional) 429 + return 0; 423 430 424 431 resource_list_for_each_entry(window, &sys->resources) 425 432 if (resource_type(window->res) == IORESOURCE_IO) ··· 475 466 if (ret > 0) { 476 467 struct pci_host_bridge *host_bridge; 477 468 478 - ret = pcibios_init_resources(nr, sys); 469 + ret = pcibios_init_resource(nr, sys, hw->io_optional); 479 470 if (ret) { 480 471 kfree(sys); 481 472 break;