diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2016-06-21 11:54:29 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-06-21 11:54:29 -0400 |
commit | 1fa051018d85b829e4b9a7ed20147df8760293ee (patch) | |
tree | 6a324aaed509fd326635df88fae8f20b371dad00 /arch/arm/kernel | |
parent | 6df68f22df726ffdda3199602ace4d03ec012372 (diff) |
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>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/bios32.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index 05e61a2eeabe..65f12ef6aa62 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c | |||
@@ -410,7 +410,8 @@ static int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
410 | return irq; | 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 | int ret; | 416 | int ret; |
416 | struct resource_entry *window; | 417 | struct resource_entry *window; |
@@ -420,6 +421,14 @@ static int pcibios_init_resources(int busnr, struct pci_sys_data *sys) | |||
420 | &iomem_resource, sys->mem_offset); | 421 | &iomem_resource, sys->mem_offset); |
421 | } | 422 | } |
422 | 423 | ||
424 | /* | ||
425 | * If a platform says I/O port support is optional, we don't add | ||
426 | * the default I/O space. The platform is responsible for adding | ||
427 | * any I/O space it needs. | ||
428 | */ | ||
429 | if (io_optional) | ||
430 | return 0; | ||
431 | |||
423 | resource_list_for_each_entry(window, &sys->resources) | 432 | resource_list_for_each_entry(window, &sys->resources) |
424 | if (resource_type(window->res) == IORESOURCE_IO) | 433 | if (resource_type(window->res) == IORESOURCE_IO) |
425 | return 0; | 434 | return 0; |
@@ -466,7 +475,7 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, | |||
466 | if (ret > 0) { | 475 | if (ret > 0) { |
467 | struct pci_host_bridge *host_bridge; | 476 | struct pci_host_bridge *host_bridge; |
468 | 477 | ||
469 | ret = pcibios_init_resources(nr, sys); | 478 | ret = pcibios_init_resource(nr, sys, hw->io_optional); |
470 | if (ret) { | 479 | if (ret) { |
471 | kfree(sys); | 480 | kfree(sys); |
472 | break; | 481 | break; |