Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294687
b: refs/heads/master
c: 6535943
h: refs/heads/master
i:
  294685: a5b030e
  294683: c26ace8
  294679: 64bddcc
  294671: e461cae
  294655: ea89e9e
v: v3
  • Loading branch information
Myron Stowe authored and Jesse Barnes committed Feb 14, 2012
1 parent a545934 commit ba17b23
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 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: 925845bd49c6de437dfab3bf8dc654ea3ae21d74
refs/heads/master: 6535943fbf25c8e9419a6b20ca992633baa0bf99
4 changes: 3 additions & 1 deletion trunk/arch/x86/pci/i386.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ static void __init pcibios_allocate_resources(int pass)
idx, r, disabled, pass);
if (pci_claim_resource(dev, idx) < 0) {
/* We'll assign a new address later */
dev->fw_addr[idx] = r->start;
pcibios_save_fw_addr(dev,
idx, r->start);
r->end -= r->start;
r->start = 0;
}
Expand Down Expand Up @@ -307,6 +308,7 @@ static int __init pcibios_assign_resources(void)
}

pci_assign_unassigned_resources();
pcibios_fw_addr_list_del();

return 0;
}
Expand Down
24 changes: 21 additions & 3 deletions trunk/drivers/pci/setup-res.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,34 @@ static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev,
return ret;
}

/*
* Generic function that returns a value indicating that the device's
* original BIOS BAR address was not saved and so is not available for
* reinstatement.
*
* Can be over-ridden by architecture specific code that implements
* reinstatement functionality rather than leaving it disabled when
* normal allocation attempts fail.
*/
resource_size_t __weak pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx)
{
return 0;
}

static int pci_revert_fw_address(struct resource *res, struct pci_dev *dev,
int resno, resource_size_t size)
{
struct resource *root, *conflict;
resource_size_t start, end;
resource_size_t fw_addr, start, end;
int ret = 0;

fw_addr = pcibios_retrieve_fw_addr(dev, resno);
if (!fw_addr)
return 1;

start = res->start;
end = res->end;
res->start = dev->fw_addr[resno];
res->start = fw_addr;
res->end = res->start + size - 1;

root = pci_find_parent_resource(dev, res);
Expand Down Expand Up @@ -271,7 +289,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
* where firmware left it. That at least has a chance of
* working, which is better than just leaving it disabled.
*/
if (ret < 0 && dev->fw_addr[resno])
if (ret < 0)
ret = pci_revert_fw_address(res, dev, resno, size);

if (!ret) {
Expand Down
1 change: 0 additions & 1 deletion trunk/include/linux/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ struct pci_dev {
*/
unsigned int irq;
struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
resource_size_t fw_addr[DEVICE_COUNT_RESOURCE]; /* FW-assigned addr */

/* These fields are used by common fixups */
unsigned int transparent:1; /* Transparent PCI bridge */
Expand Down

0 comments on commit ba17b23

Please sign in to comment.