[U-Boot] [PATCH v3 4/8] x86: Use the IRQ device when setting up the mptable

Simon Glass sjg at chromium.org
Wed Jan 20 05:32:28 CET 2016


Instead of searching for the device tree node, use the IRQ device which has
a record of it.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v3:
- Add new patch to use the IRQ device when setting up the mptable

Changes in v2: None

 arch/x86/cpu/irq.c    | 16 ++++------------
 arch/x86/lib/mpspec.c | 14 +++++++-------
 2 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/arch/x86/cpu/irq.c b/arch/x86/cpu/irq.c
index e2feba7..d6151e0 100644
--- a/arch/x86/cpu/irq.c
+++ b/arch/x86/cpu/irq.c
@@ -88,7 +88,7 @@ __weak void cpu_irq_init(void)
 	return;
 }
 
-static int create_pirq_routing_table(void)
+static int create_pirq_routing_table(struct udevice *dev)
 {
 	const void *blob = gd->fdt_blob;
 	struct fdt_pci_addr addr;
@@ -102,16 +102,8 @@ static int create_pirq_routing_table(void)
 	int i;
 	int ret;
 
-	node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_IRQ_ROUTER);
-	if (node < 0) {
-		debug("%s: Cannot find irq router node\n", __func__);
-		return -EINVAL;
-	}
-
-	/* TODO(sjg at chromium.org): Drop this when PIRQ is a driver */
-	parent = fdt_parent_offset(blob, node);
-	if (parent < 0)
-		return -EINVAL;
+	node = dev->of_offset;
+	parent = dev->parent->of_offset;
 	ret = fdtdec_get_pci_addr(blob, parent, FDT_PCI_SPACE_CONFIG,
 				  "reg", &addr);
 	if (ret)
@@ -237,7 +229,7 @@ int irq_router_common_init(struct udevice *dev)
 
 	cpu_irq_init();
 
-	ret = create_pirq_routing_table();
+	ret = create_pirq_routing_table(dev);
 	if (ret) {
 		debug("Failed to create pirq routing table\n");
 		return ret;
diff --git a/arch/x86/lib/mpspec.c b/arch/x86/lib/mpspec.c
index f3ad116..0faa582 100644
--- a/arch/x86/lib/mpspec.c
+++ b/arch/x86/lib/mpspec.c
@@ -292,19 +292,19 @@ static int mptable_add_intsrc(struct mp_config_table *mc,
 	struct mpc_config_intsrc *intsrc_base;
 	int intsrc_entries = 0;
 	const void *blob = gd->fdt_blob;
-	int node;
+	struct udevice *dev;
 	int len, count;
 	const u32 *cell;
-	int i;
+	int i, ret;
 
-	/* Get I/O interrupt information from device tree */
-	node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_IRQ_ROUTER);
-	if (node < 0) {
+	ret = uclass_first_device(UCLASS_IRQ, &dev);
+	if (ret && ret != -ENODEV) {
 		debug("%s: Cannot find irq router node\n", __func__);
-		return -ENOENT;
+		return ret;
 	}
 
-	cell = fdt_getprop(blob, node, "intel,pirq-routing", &len);
+	/* Get I/O interrupt information from device tree */
+	cell = fdt_getprop(blob, dev->of_offset, "intel,pirq-routing", &len);
 	if (!cell)
 		return -ENOENT;
 
-- 
2.7.0.rc3.207.g0ac5344



More information about the U-Boot mailing list