Linux-ACPI Archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/4] Simple ACPI based PCI support for arm64
@ 2015-12-07 17:20 Jayachandran C
  2015-12-07 17:20 ` [RFC PATCH v2 1/4] arm64: pci: Add ACPI support Jayachandran C
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jayachandran C @ 2015-12-07 17:20 UTC (permalink / raw
  To: linux-pci, Bjorn Helgaas, linux-acpi, Arnd Bergmann,
	linux-arm-kernel
  Cc: Jayachandran C, Lorenzo Pieralisi, Tomasz Nowicki

This is a very simple and generic implementation of a PCI host controller
based on ACPI. This approach does not pull in the MMCONFIG and ECAM code
from x86. The MCFG table is a simple ACPI table, and there is no need to
move the complex code from x86 (sorted linked list with a lot of global
vars) to acpi for parsing it.

The config space access is done with pci-host-generic style simple
mapping and generic PCI config read/write.

This is tested with arm64 QEMU and OVMF. Comments are very welcome.

I would also add that I am posting this as an option, if another
implementation is accepted upstream, I would happily drop this.

Thanks,
JC.

v1->v2:
 - use CONFIG_PCI_MMCONFIG on arm64, provide a weak implementation
   of pci_mmcfg_late_init for arm64.
 - The real implementation of pci_mmcfg_late_init is in pci-host-acpi.c
   and it will save the MCFG table entries to an array. Earlier this
   was done with an arch_init call
 - remove unneeded pci_bus_add_devices call and fix MCFG saving code
 - Added a patch to ACPI pci_root.c to handle arm64 PCI IO resources

Jayachandran C (4):
  arm64: pci: Add ACPI support
  PCI: Handle NULL parent in pci_bus_assign_domain_nr
  PCI: ACPI: Add a generic ACPI based host controller
  ACPI: PCI: Support platforms that need pci_remap_iospace

 arch/arm64/Kconfig               |   3 +
 arch/arm64/kernel/pci.c          |  50 +++++++++-
 drivers/acpi/pci_root.c          |  62 +++++++++++-
 drivers/acpi/resource.c          |   2 +
 drivers/pci/host/Kconfig         |   7 ++
 drivers/pci/host/Makefile        |   1 +
 drivers/pci/host/pci-host-acpi.c | 209 +++++++++++++++++++++++++++++++++++++++
 drivers/pci/pci.c                |   7 +-
 8 files changed, 335 insertions(+), 6 deletions(-)
 create mode 100644 drivers/pci/host/pci-host-acpi.c

-- 
1.9.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [RFC PATCH v2 1/4] arm64: pci: Add ACPI support
  2015-12-07 17:20 [RFC PATCH v2 0/4] Simple ACPI based PCI support for arm64 Jayachandran C
@ 2015-12-07 17:20 ` Jayachandran C
  2015-12-07 17:20 ` [RFC PATCH v2 2/4] PCI: Handle NULL parent in pci_bus_assign_domain_nr Jayachandran C
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jayachandran C @ 2015-12-07 17:20 UTC (permalink / raw
  To: linux-pci, Bjorn Helgaas, linux-acpi, Arnd Bergmann,
	linux-arm-kernel
  Cc: Jayachandran C, Lorenzo Pieralisi, Tomasz Nowicki

Add functions needed for ACPI support on arm64.

pci_acpi_scan_root(struct acpi_pci_root *root) is marked as weak so
that it can be implemented by the generic acpi pci driver.
pcibios_root_bridge_prepare is defined and it assumes that the
sysdata is struct acpi_pci_root_info.

pcibios_enable_device and pcibios_disable_device handle acpi irq enable
and disable. And, pcibios_add_bus and pcibios_remove_bus have been
added call the corresponding acpi functions.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
---
 arch/arm64/Kconfig      |  3 +++
 arch/arm64/kernel/pci.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 871f217..8c93af2 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -203,6 +203,9 @@ config PCI_DOMAINS_GENERIC
 config PCI_SYSCALL
 	def_bool PCI
 
+config PCI_MMCONFIG
+	def_bool PCI && ACPI
+
 source "drivers/pci/Kconfig"
 source "drivers/pci/pcie/Kconfig"
 source "drivers/pci/hotplug/Kconfig"
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
index b3d098b..ffa0ab2 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -17,6 +17,7 @@
 #include <linux/mm.h>
 #include <linux/of_pci.h>
 #include <linux/of_platform.h>
+#include <linux/pci-acpi.h>
 #include <linux/slab.h>
 
 #include <asm/pci-bridge.h>
@@ -48,9 +49,22 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
 	if (pci_has_flag(PCI_PROBE_ONLY))
 		return 0;
 
+#ifdef CONFIG_ACPI
+	if (acpi_find_root_bridge_handle(dev))
+		acpi_pci_irq_enable(dev);
+#endif
+
 	return pci_enable_resources(dev, mask);
 }
 
+void pcibios_disable_device(struct pci_dev *dev)
+{
+#ifdef CONFIG_ACPI
+	if (acpi_find_root_bridge_handle(dev))
+		acpi_pci_irq_disable(dev);
+#endif
+}
+
 /*
  * Try to assign the IRQ number from DT when adding a new device
  */
@@ -77,10 +91,40 @@ int raw_pci_write(unsigned int domain, unsigned int bus,
 }
 
 #ifdef CONFIG_ACPI
-/* Root bridge scanning */
-struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
+
+void pcibios_add_bus(struct pci_bus *bus)
+{
+	acpi_pci_add_bus(bus);
+}
+
+void pcibios_remove_bus(struct pci_bus *bus)
+{
+	acpi_pci_remove_bus(bus);
+}
+
+int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
+{
+	/* ACPI root bus is created with NULL parent */
+	if (!acpi_disabled && bridge->dev.parent == NULL) {
+		struct pci_bus *b = bridge->bus;
+		struct acpi_pci_root_info *ci = b->sysdata;
+
+		ACPI_COMPANION_SET(&bridge->dev, ci->bridge);
+		b->domain_nr = ci->root->segment;
+	}
+	return 0;
+}
+
+/*
+ * Provide weak implementations of ACPI PCI hooks needed.
+ * Leave it to the ACPI PCI driver implementation to do it
+ */
+struct pci_bus *__weak pci_acpi_scan_root(struct acpi_pci_root *root)
 {
-	/* TODO: Should be revisited when implementing PCI on ACPI */
 	return NULL;
 }
+
+void __init __weak pci_mmcfg_late_init(void)
+{
+}
 #endif
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RFC PATCH v2 2/4] PCI: Handle NULL parent in pci_bus_assign_domain_nr
  2015-12-07 17:20 [RFC PATCH v2 0/4] Simple ACPI based PCI support for arm64 Jayachandran C
  2015-12-07 17:20 ` [RFC PATCH v2 1/4] arm64: pci: Add ACPI support Jayachandran C
@ 2015-12-07 17:20 ` Jayachandran C
  2015-12-07 17:20 ` [RFC PATCH v2 3/4] PCI: ACPI: Add a generic ACPI based host controller Jayachandran C
  2015-12-07 17:20 ` [RFC PATCH v2 4/4] ACPI: PCI: Support platforms that need pci_remap_iospace Jayachandran C
  3 siblings, 0 replies; 5+ messages in thread
From: Jayachandran C @ 2015-12-07 17:20 UTC (permalink / raw
  To: linux-pci, Bjorn Helgaas, linux-acpi, Arnd Bergmann,
	linux-arm-kernel
  Cc: Jayachandran C, Lorenzo Pieralisi, Tomasz Nowicki

pci_create_root_bus is called with NULL as parent in ACPI. On arm64
this ends up calling pci_bus_assign_domain_nr, which crashes when
dereferencing parent.

To fix this, update pci_bus_assign_domain_nr to return if parent is
NULL. Setting up the domain number will be handled from
pcibios_root_bridge_prepare on arm64 when booted with ACPI.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
---
 drivers/pci/pci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 314db8c..a96c356 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4772,8 +4772,13 @@ int pci_get_new_domain_nr(void)
 void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
 {
 	static int use_dt_domains = -1;
-	int domain = of_get_pci_domain_nr(parent->of_node);
+	int domain;
 
+	/* in case of ACPI, parent is NULL */
+	if (parent == NULL)
+		return;
+
+	domain = of_get_pci_domain_nr(parent->of_node);
 	/*
 	 * Check DT domain and use_dt_domains values.
 	 *
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RFC PATCH v2 3/4] PCI: ACPI: Add a generic ACPI based host controller
  2015-12-07 17:20 [RFC PATCH v2 0/4] Simple ACPI based PCI support for arm64 Jayachandran C
  2015-12-07 17:20 ` [RFC PATCH v2 1/4] arm64: pci: Add ACPI support Jayachandran C
  2015-12-07 17:20 ` [RFC PATCH v2 2/4] PCI: Handle NULL parent in pci_bus_assign_domain_nr Jayachandran C
@ 2015-12-07 17:20 ` Jayachandran C
  2015-12-07 17:20 ` [RFC PATCH v2 4/4] ACPI: PCI: Support platforms that need pci_remap_iospace Jayachandran C
  3 siblings, 0 replies; 5+ messages in thread
From: Jayachandran C @ 2015-12-07 17:20 UTC (permalink / raw
  To: linux-pci, Bjorn Helgaas, linux-acpi, Arnd Bergmann,
	linux-arm-kernel
  Cc: Jayachandran C, Lorenzo Pieralisi, Tomasz Nowicki

Add a simple ACPI based PCI host controller. This is done by
providing a simple implementation for pci_acpi_scan_root().
The MCFG table is parsed early and saved so that it can be
mapped when ACPI calls pci_acpi_scan_root.

This is enabled only for ARM64 now.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
---
 drivers/pci/host/Kconfig         |   7 ++
 drivers/pci/host/Makefile        |   1 +
 drivers/pci/host/pci-host-acpi.c | 209 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 217 insertions(+)
 create mode 100644 drivers/pci/host/pci-host-acpi.c

diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig
index f131ba9..8321efc 100644
--- a/drivers/pci/host/Kconfig
+++ b/drivers/pci/host/Kconfig
@@ -53,6 +53,13 @@ config PCI_RCAR_GEN2_PCIE
 	help
 	  Say Y here if you want PCIe controller support on R-Car Gen2 SoCs.
 
+config PCI_HOST_GENERIC_ACPI
+	bool "Generic ACPI PCI host controller"
+	depends on ARM64 && ACPI
+	help
+	  Say Y here if you want to support a simple generic ACPI PCI host
+	  controller.
+
 config PCI_HOST_GENERIC
 	bool "Generic PCI host controller"
 	depends on (ARM || ARM64) && OF
diff --git a/drivers/pci/host/Makefile b/drivers/pci/host/Makefile
index 9d4d3c6..bc31852 100644
--- a/drivers/pci/host/Makefile
+++ b/drivers/pci/host/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o
 obj-$(CONFIG_PCI_TEGRA) += pci-tegra.o
 obj-$(CONFIG_PCI_RCAR_GEN2) += pci-rcar-gen2.o
 obj-$(CONFIG_PCI_RCAR_GEN2_PCIE) += pcie-rcar.o
+obj-$(CONFIG_PCI_HOST_GENERIC_ACPI) += pci-host-acpi.o
 obj-$(CONFIG_PCI_HOST_GENERIC) += pci-host-generic.o
 obj-$(CONFIG_PCIE_SPEAR13XX) += pcie-spear13xx.o
 obj-$(CONFIG_PCI_KEYSTONE) += pci-keystone-dw.o pci-keystone.o
diff --git a/drivers/pci/host/pci-host-acpi.c b/drivers/pci/host/pci-host-acpi.c
new file mode 100644
index 0000000..38fb589
--- /dev/null
+++ b/drivers/pci/host/pci-host-acpi.c
@@ -0,0 +1,209 @@
+/*
+ * Generic PCI host controller driver for ACPI based systems
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright (c) 2015 Broadcom Corporation
+ *
+ * Based on drivers/pci/host/pci-host-generic.c
+ * Copyright (C) 2014 ARM Limited
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/acpi.h>
+#include <linux/pci-acpi.h>
+#include <linux/sfi_acpi.h>
+#include <linux/slab.h>
+
+#define PREFIX			"pci-host-acpi:"
+#define MCFG_NAMELEN		32
+#define MCFG_SHIFT		20
+
+/* ECFG window for this root bus */
+struct gen_mcfg_window {
+	struct resource		res;
+	unsigned int		domain_nr;
+	unsigned int		bus_start;
+	unsigned int		bus_end;
+	char			name[MCFG_NAMELEN];
+	void __iomem		*win;
+};
+
+/* sysdata pointer is ->root_info */
+struct gen_acpi_pci {
+	struct acpi_pci_root_info	root_info;
+	struct gen_mcfg_window		cfg;
+};
+
+/* MCFG entries  */
+struct mcfg_entry {
+	int			segment;
+	int			bus_start;
+	int			bus_end;
+	u64			addr;
+};
+
+/* Globals */
+static struct mcfg_entries {
+	int			size;
+	struct mcfg_entry	*entries;
+} mcfg_sav;
+
+/* find mapping of a MCFG area */
+static void __iomem *gen_acpi_map_cfg_bus(struct pci_bus *bus,
+			unsigned int devfn, int where)
+{
+	struct gen_acpi_pci *pci = bus->sysdata;
+	struct gen_mcfg_window *cfg = &pci->cfg;
+
+	if (bus->number < cfg->bus_start || bus->number > cfg->bus_end)
+		return NULL;
+
+	return cfg->win + ((bus->number - cfg->bus_start) << MCFG_SHIFT) +
+			((devfn << 12) | where);
+}
+
+/* Map the ECFG area for a root bus */
+static int gen_acpi_pci_map_mcfg(struct acpi_pci_root *root,
+				struct gen_acpi_pci *pci)
+{
+	struct gen_mcfg_window *cfg = &pci->cfg;
+	struct acpi_device *device = root->device;
+	void __iomem  *vaddr;
+
+	/* if there is info from _CBA, use that, otherwise use MCFG table */
+	if (root->mcfg_addr) {
+		cfg->bus_start = root->secondary.start;
+		cfg->bus_end = root->secondary.end;
+		cfg->res.start = root->mcfg_addr;
+	} else {
+		struct mcfg_entry *e = mcfg_sav.entries;
+		int i, n = mcfg_sav.size;
+
+		for (i = 0; i < n; i++, e++)
+			if (e->segment == root->segment)
+				break;
+		if (i >= n)
+			return -ENODEV;
+		cfg->bus_start = e->bus_start;
+		cfg->bus_end = e->bus_end;
+		cfg->res.start = e->addr;
+	}
+
+	cfg->res.flags = IORESOURCE_MEM;
+	cfg->res.name = cfg->name;
+	cfg->res.end = cfg->res.start +
+			((cfg->bus_end - cfg->bus_start + 1) << MCFG_SHIFT) - 1;
+	snprintf(cfg->name, MCFG_NAMELEN, "PCI MMCONFIG %04x [bus %02x-%02x]",
+		 root->segment, cfg->bus_start, cfg->bus_end);
+
+	/* map ECFG space for the bus range */
+	vaddr = devm_ioremap_resource(&device->dev, &cfg->res);
+	if (IS_ERR(vaddr))
+		return PTR_ERR(vaddr);
+
+	cfg->win = vaddr;
+	return 0;
+}
+
+static struct pci_ops gen_acpi_pci_ops = {
+	.map_bus	= gen_acpi_map_cfg_bus,
+	.read		= pci_generic_config_read,
+	.write		= pci_generic_config_write,
+};
+
+static struct acpi_pci_root_ops pci_acpi_root_ops = {
+	.pci_ops = &gen_acpi_pci_ops,
+};
+
+struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
+{
+	struct acpi_device *device = root->device;
+	struct gen_acpi_pci *pci;
+	struct pci_bus *bus, *child;
+	int err;
+
+	/* allocate acpi_info/sysdata */
+	pci = devm_kzalloc(&device->dev, sizeof(*pci), GFP_KERNEL);
+	if (!pci) {
+		dev_err(&device->dev,
+			"pci_bus %04x:%02x: ignored (out of memory)\n",
+			root->segment, (int)root->secondary.start);
+		return NULL;
+	}
+
+	err = gen_acpi_pci_map_mcfg(root, pci);
+	if (err) {
+		dev_err(&device->dev, "MCFG lookup for domain %d failed",
+			root->segment);
+		return NULL;
+	}
+	bus =  acpi_pci_root_create(root, &pci_acpi_root_ops,
+					&pci->root_info, pci);
+	if (!bus) {
+		dev_err(&device->dev, "Scanning rootbus failed");
+		return NULL;
+	}
+
+	list_for_each_entry(child, &bus->children, node)
+		pcie_bus_configure_settings(child);
+
+	return bus;
+}
+
+/* save MCFG entries */
+static __init int handle_mcfg(struct acpi_table_header *header)
+{
+	struct acpi_table_mcfg *mcfg;
+	struct acpi_mcfg_allocation *mptr;
+	struct mcfg_entry *e;
+	int i, n;
+
+	if (!header)
+		return -EINVAL;
+
+	mcfg = (struct acpi_table_mcfg *)header;
+	mptr = (struct acpi_mcfg_allocation *) &mcfg[1];
+	n = (header->length - sizeof(*mcfg)) / sizeof(*mptr);
+	if (n <= 0 || n > 255) {
+		pr_err(PREFIX " MCFG has incorrect entries (%d).\n", n);
+		return -EINVAL;
+	}
+	mcfg_sav.entries = e = kcalloc(n, sizeof(*e), GFP_KERNEL);
+	if (e == NULL)
+		return -ENOMEM;
+	mcfg_sav.size = n;
+	for (i = 0; i < n; i++, e++, mptr++) {
+		e->segment = mptr->pci_segment;
+		e->bus_start = mptr->start_bus_number;
+		e->bus_end = mptr->end_bus_number;
+		e->addr = mptr->address;
+	}
+	return 0;
+}
+
+void __init pci_mmcfg_late_init(void)
+{
+	int err;
+
+	err = acpi_sfi_table_parse(ACPI_SIG_MCFG, handle_mcfg);
+	if (err) {
+		pr_err(PREFIX " Failed to parse MCFG (%d)\n", err);
+		mcfg_sav.size = -1;
+	} else {
+		pr_info(PREFIX " MCFG table at %p, %d entries.\n",
+			mcfg_sav.entries, mcfg_sav.size);
+	}
+}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RFC PATCH v2 4/4] ACPI: PCI: Support platforms that need pci_remap_iospace
  2015-12-07 17:20 [RFC PATCH v2 0/4] Simple ACPI based PCI support for arm64 Jayachandran C
                   ` (2 preceding siblings ...)
  2015-12-07 17:20 ` [RFC PATCH v2 3/4] PCI: ACPI: Add a generic ACPI based host controller Jayachandran C
@ 2015-12-07 17:20 ` Jayachandran C
  3 siblings, 0 replies; 5+ messages in thread
From: Jayachandran C @ 2015-12-07 17:20 UTC (permalink / raw
  To: linux-pci, Bjorn Helgaas, linux-acpi, Arnd Bergmann,
	linux-arm-kernel
  Cc: Jayachandran C, Lorenzo Pieralisi, Tomasz Nowicki

On some platforms (in this case ARM64), the PCI iospace needs to
be mapped with pci_remap_iospace and the resources have to be
adjusted for the iospace physical address.

This has to be done before acpi_pci_root_validate_resources()
checks and removes resource windows. Handle this by adding
a function acpi_pci_root_remap_iospace that is called in
acpi_pci_probe_root_resources(), before the validate call.

Also fix the address check in acpi_dev_ioresource_flags for
similar platforms.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
---
 drivers/acpi/pci_root.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++--
 drivers/acpi/resource.c |  2 ++
 2 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 850d7bf..58093ba 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -720,6 +720,61 @@ next:
 	}
 }
 
+#ifdef PCI_IOBASE
+/*
+ * The IO ports are mapped to a memory range, fixup IO resources to
+ * handle that
+ */
+static int acpi_pci_root_remap_iospace(struct acpi_pci_root_info *ci)
+{
+	struct resource_entry *entry;
+	struct resource iores;
+	resource_size_t iostart;
+	int err;
+
+	iores.flags = IORESOURCE_IO;
+	iores.start = (resource_size_t)-1;
+	iores.end = 0;
+	resource_list_for_each_entry(entry, &ci->resources) {
+		if (entry->res->flags & IORESOURCE_IO) {
+			iores.start = min(entry->res->start, iores.start);
+			iores.end = max(entry->res->end, iores.end);
+		}
+	}
+	if (iores.end == 0)
+		return 0;
+	iostart = iores.start;
+
+	resource_list_for_each_entry(entry, &ci->resources) {
+		if (entry->res->flags & IORESOURCE_IO) {
+			entry->res->start -= iostart;
+			entry->res->end -= iostart;
+			entry->offset -= iostart;
+		}
+	}
+	iores.start -= iostart;
+	iores.end -= iostart;
+
+	err = pci_remap_iospace(&iores, iostart);
+	if (err) {
+		pr_err("PCI: ACPI: err %d mapping IO %pR\n", err, &iores);
+		return -ENODEV;
+	}
+	pr_info(PREFIX "Mapped %pR at %#lx for IO.\n",
+			&iores, (unsigned long)iostart);
+	return 0;
+}
+#else
+/*
+ * The IO ports are mapped to a memory range, fixup IO resources to
+ * handle that
+ */
+static int acpi_pci_root_remap_iospace(struct acpi_pci_root_info *ci)
+{
+	return 0;
+}
+#endif /* PCI_IOBASE */
+
 int acpi_pci_probe_root_resources(struct acpi_pci_root_info *info)
 {
 	int ret;
@@ -745,10 +800,13 @@ int acpi_pci_probe_root_resources(struct acpi_pci_root_info *info)
 			else
 				entry->res->name = info->name;
 		}
-		acpi_pci_root_validate_resources(&device->dev, list,
+		ret = acpi_pci_root_remap_iospace(info);
+		if (ret >= 0) {
+			acpi_pci_root_validate_resources(&device->dev, list,
 						 IORESOURCE_MEM);
-		acpi_pci_root_validate_resources(&device->dev, list,
+			acpi_pci_root_validate_resources(&device->dev, list,
 						 IORESOURCE_IO);
+		}
 	}
 
 	return ret;
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index cdc5c25..530cad4 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -126,8 +126,10 @@ static void acpi_dev_ioresource_flags(struct resource *res, u64 len,
 	if (!acpi_dev_resource_len_valid(res->start, res->end, len, true))
 		res->flags |= IORESOURCE_DISABLED | IORESOURCE_UNSET;
 
+#ifndef PCI_IOBASE
 	if (res->end >= 0x10003)
 		res->flags |= IORESOURCE_DISABLED | IORESOURCE_UNSET;
+#endif
 
 	if (io_decode == ACPI_DECODE_16)
 		res->flags |= IORESOURCE_IO_16BIT_ADDR;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-07 17:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-07 17:20 [RFC PATCH v2 0/4] Simple ACPI based PCI support for arm64 Jayachandran C
2015-12-07 17:20 ` [RFC PATCH v2 1/4] arm64: pci: Add ACPI support Jayachandran C
2015-12-07 17:20 ` [RFC PATCH v2 2/4] PCI: Handle NULL parent in pci_bus_assign_domain_nr Jayachandran C
2015-12-07 17:20 ` [RFC PATCH v2 3/4] PCI: ACPI: Add a generic ACPI based host controller Jayachandran C
2015-12-07 17:20 ` [RFC PATCH v2 4/4] ACPI: PCI: Support platforms that need pci_remap_iospace Jayachandran C

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).