Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 314a140

Browse files
vwaxrichardweinberger
authored andcommitted
um: virt-pci: implement pcibios_get_phb_of_node()
Implement pcibios_get_phb_of_node() as x86 does in order to allow PCI busses to be associated with devicetree nodes. Signed-off-by: Vincent Whitchurch <[email protected]> Acked-by: Johannes Berg <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 83e913f commit 314a140

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

arch/um/drivers/virt-pci.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,25 @@ static void um_pci_irq_vq_cb(struct virtqueue *vq)
533533
}
534534
}
535535

536+
/* Copied from arch/x86/kernel/devicetree.c */
537+
struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
538+
{
539+
struct device_node *np;
540+
541+
for_each_node_by_type(np, "pci") {
542+
const void *prop;
543+
unsigned int bus_min;
544+
545+
prop = of_get_property(np, "bus-range", NULL);
546+
if (!prop)
547+
continue;
548+
bus_min = be32_to_cpup(prop);
549+
if (bus->number == bus_min)
550+
return np;
551+
}
552+
return NULL;
553+
}
554+
536555
static int um_pci_init_vqs(struct um_pci_device *dev)
537556
{
538557
struct virtqueue *vqs[2];

0 commit comments

Comments
 (0)