[DM/FIXUP] Fixup PCI device ofw private node for MSI

Some PCI device devicetree is like:
```dts
pcie@fe270000 {
    device_type = "pci";
    msi-map = <0x1000 0x9c 0x1000 0x1000>;

    pcie@10 {
        reg = <0x100000 0x00 0x00 0x00 0x00>;
        #address-cells = <0x03>;
        #size-cells = <0x02>;

        pcie@10,0 {
            reg = <0x00 0x00 0x00 0x00 0x00>;
        };
    };
};
```

that the pcie@10,0 have a private ofw node, it will find
property name `msi-map` or `msi-parent` fail.
We should only find the property in host bridge's ofw node.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
This commit is contained in:
GuEe-GUI 2024-11-07 13:52:55 +08:00 committed by Rbb666
parent 5346c87fe2
commit 1ac8044294
1 changed files with 8 additions and 20 deletions

View File

@ -461,7 +461,7 @@ static void ofw_msi_pic_init(struct rt_pci_device *pdev)
{
#ifdef RT_PCI_MSI
rt_uint32_t rid;
struct rt_pci_bus *bus;
struct rt_pci_host_bridge *bridge;
struct rt_ofw_node *np, *msi_ic_np = RT_NULL;
/*
@ -473,26 +473,14 @@ static void ofw_msi_pic_init(struct rt_pci_device *pdev)
*/
rid = rt_pci_dev_id(pdev);
for (bus = pdev->bus; bus; bus = bus->parent)
{
if (rt_pci_is_root_bus(bus))
{
np = bus->host_bridge->parent.ofw_node;
}
else
{
np = bus->self->parent.ofw_node;
}
bridge = rt_pci_find_host_bridge(pdev->bus);
RT_ASSERT(bridge != RT_NULL);
if ((msi_ic_np = rt_ofw_parse_phandle(np, "msi-parent", 0)))
{
break;
}
np = bridge->parent.ofw_node;
if (!rt_ofw_map_id(np, rid, "msi-map", "msi-map-mask", &msi_ic_np, RT_NULL))
if (!(msi_ic_np = rt_ofw_parse_phandle(np, "msi-parent", 0)))
{
break;
}
rt_ofw_map_id(np, rid, "msi-map", "msi-map-mask", &msi_ic_np, RT_NULL);
}
if (!msi_ic_np)