Skip to content

Commit 1fa0510

Browse files
committed
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>
1 parent 6df68f2 commit 1fa0510

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎arch/arm/include/asm/mach/pci.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct hw_pci {
2222
struct msi_controller *msi_ctrl;
2323
struct pci_ops *ops;
2424
int nr_controllers;
25+
unsigned int io_optional:1;
2526
void **private_data;
2627
int (*setup)(int nr, struct pci_sys_data *);
2728
struct pci_bus *(*scan)(int nr, struct pci_sys_data *);

‎arch/arm/kernel/bios32.c‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,8 @@ static int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
410410
return irq;
411411
}
412412

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)
414415
{
415416
int ret;
416417
struct resource_entry *window;
@@ -420,6 +421,14 @@ static int pcibios_init_resources(int busnr, struct pci_sys_data *sys)
420421
&iomem_resource, sys->mem_offset);
421422
}
422423

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+
423432
resource_list_for_each_entry(window, &sys->resources)
424433
if (resource_type(window->res) == IORESOURCE_IO)
425434
return 0;
@@ -466,7 +475,7 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
466475
if (ret > 0) {
467476
struct pci_host_bridge *host_bridge;
468477

469-
ret = pcibios_init_resources(nr, sys);
478+
ret = pcibios_init_resource(nr, sys, hw->io_optional);
470479
if (ret) {
471480
kfree(sys);
472481
break;

0 commit comments

Comments
 (0)