mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 21:21:37 +00:00
x86: Use the IRQ device when setting up the mptable
Instead of searching for the device tree node, use the IRQ device which has a record of it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
d3b884b294
commit
b565d66d2c
2 changed files with 11 additions and 19 deletions
|
@ -88,7 +88,7 @@ __weak void cpu_irq_init(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int create_pirq_routing_table(void)
|
static int create_pirq_routing_table(struct udevice *dev)
|
||||||
{
|
{
|
||||||
const void *blob = gd->fdt_blob;
|
const void *blob = gd->fdt_blob;
|
||||||
struct fdt_pci_addr addr;
|
struct fdt_pci_addr addr;
|
||||||
|
@ -102,16 +102,8 @@ static int create_pirq_routing_table(void)
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_IRQ_ROUTER);
|
node = dev->of_offset;
|
||||||
if (node < 0) {
|
parent = dev->parent->of_offset;
|
||||||
debug("%s: Cannot find irq router node\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO(sjg@chromium.org): Drop this when PIRQ is a driver */
|
|
||||||
parent = fdt_parent_offset(blob, node);
|
|
||||||
if (parent < 0)
|
|
||||||
return -EINVAL;
|
|
||||||
ret = fdtdec_get_pci_addr(blob, parent, FDT_PCI_SPACE_CONFIG,
|
ret = fdtdec_get_pci_addr(blob, parent, FDT_PCI_SPACE_CONFIG,
|
||||||
"reg", &addr);
|
"reg", &addr);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -237,7 +229,7 @@ int irq_router_common_init(struct udevice *dev)
|
||||||
|
|
||||||
cpu_irq_init();
|
cpu_irq_init();
|
||||||
|
|
||||||
ret = create_pirq_routing_table();
|
ret = create_pirq_routing_table(dev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("Failed to create pirq routing table\n");
|
debug("Failed to create pirq routing table\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -292,19 +292,19 @@ static int mptable_add_intsrc(struct mp_config_table *mc,
|
||||||
struct mpc_config_intsrc *intsrc_base;
|
struct mpc_config_intsrc *intsrc_base;
|
||||||
int intsrc_entries = 0;
|
int intsrc_entries = 0;
|
||||||
const void *blob = gd->fdt_blob;
|
const void *blob = gd->fdt_blob;
|
||||||
int node;
|
struct udevice *dev;
|
||||||
int len, count;
|
int len, count;
|
||||||
const u32 *cell;
|
const u32 *cell;
|
||||||
int i;
|
int i, ret;
|
||||||
|
|
||||||
/* Get I/O interrupt information from device tree */
|
ret = uclass_first_device(UCLASS_IRQ, &dev);
|
||||||
node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_IRQ_ROUTER);
|
if (ret && ret != -ENODEV) {
|
||||||
if (node < 0) {
|
|
||||||
debug("%s: Cannot find irq router node\n", __func__);
|
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)
|
if (!cell)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue