Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256794
b: refs/heads/master
c: 3d5fe5a
h: refs/heads/master
v: v3
  • Loading branch information
Benjamin Herrenschmidt committed Jun 7, 2011
1 parent f712e1d commit 4f11e60
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 43 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bf13a6fa09b8db7f1fd59b5e2ed3674a89a6a25c
refs/heads/master: 3d5fe5a65af9c0b609d6e26b8d63fe5923c4e512
60 changes: 18 additions & 42 deletions trunk/arch/x86/kernel/devicetree.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,24 @@ static int __init add_bus_probe(void)
module_init(add_bus_probe);

#ifdef CONFIG_PCI
struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
{
struct device_node *np;

for_each_node_by_type(np, "pci") {
const void *prop;
unsigned int bus_min;

prop = of_get_property(np, "bus-range", NULL);
if (!prop)
continue;
bus_min = be32_to_cpup(prop);
if (bus->number == bus_min)
return np;
}
return NULL;
}

static int x86_of_pci_irq_enable(struct pci_dev *dev)
{
struct of_irq oirq;
Expand Down Expand Up @@ -154,50 +172,8 @@ static void x86_of_pci_irq_disable(struct pci_dev *dev)

void __cpuinit x86_of_pci_init(void)
{
struct device_node *np;

pcibios_enable_irq = x86_of_pci_irq_enable;
pcibios_disable_irq = x86_of_pci_irq_disable;

for_each_node_by_type(np, "pci") {
const void *prop;
struct pci_bus *bus;
unsigned int bus_min;
struct device_node *child;

prop = of_get_property(np, "bus-range", NULL);
if (!prop)
continue;
bus_min = be32_to_cpup(prop);

bus = pci_find_bus(0, bus_min);
if (!bus) {
printk(KERN_ERR "Can't find a node for bus %s.\n",
np->full_name);
continue;
}

if (bus->self)
bus->self->dev.of_node = np;
else
bus->dev.of_node = np;

for_each_child_of_node(np, child) {
struct pci_dev *dev;
u32 devfn;

prop = of_get_property(child, "reg", NULL);
if (!prop)
continue;

devfn = (be32_to_cpup(prop) >> 8) & 0xff;
dev = pci_get_slot(bus, devfn);
if (!dev)
continue;
dev->dev.of_node = child;
pci_dev_put(dev);
}
}
}
#endif

Expand Down

0 comments on commit 4f11e60

Please sign in to comment.