Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 180981
b: refs/heads/master
c: 32180e4
h: refs/heads/master
i:
  180979: 7c80b05
v: v3
  • Loading branch information
Yinghai Lu authored and Jesse Barnes committed Feb 23, 2010
1 parent 6e5ef9e commit 043b7dc
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 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: 9789ac979b6b6ae6cc09f7b29c88e95ecb14ec39
refs/heads/master: 32180e402f9ff1f3389c99edf3f393425e706080
51 changes: 50 additions & 1 deletion trunk/drivers/pci/setup-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,12 +964,61 @@ pci_assign_unassigned_resources(void)
void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
{
struct pci_bus *parent = bridge->subordinate;
int tried_times = 0;
struct resource_list_x head, *list;
int retval;
unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
IORESOURCE_PREFETCH;

head.next = NULL;

again:
pci_bus_size_bridges(parent);
__pci_bridge_assign_resources(bridge, NULL);
__pci_bridge_assign_resources(bridge, &head);
retval = pci_reenable_device(bridge);
pci_set_master(bridge);
pci_enable_bridges(parent);

tried_times++;

if (!head.next)
return;

if (tried_times >= 2) {
/* still fail, don't need to try more */
free_failed_list(&head);
return;
}

printk(KERN_DEBUG "PCI: No. %d try to assign unassigned res\n",
tried_times + 1);

/*
* Try to release leaf bridge's resources that doesn't fit resource of
* child device under that bridge
*/
for (list = head.next; list;) {
struct pci_bus *bus = list->dev->bus;
unsigned long flags = list->flags;

pci_bus_release_bridge_resources(bus, flags & type_mask,
whole_subtree);
list = list->next;
}
/* restore size and flags */
for (list = head.next; list;) {
struct resource *res = list->res;

res->start = list->start;
res->end = list->end;
res->flags = list->flags;
if (list->dev->subordinate)
res->flags = 0;

list = list->next;
}
free_failed_list(&head);

goto again;
}
EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources);

0 comments on commit 043b7dc

Please sign in to comment.