Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358386
b: refs/heads/master
c: c7f4bbc
h: refs/heads/master
v: v3
  • Loading branch information
Yinghai Lu authored and Bjorn Helgaas committed Jan 7, 2013
1 parent c2d9ab5 commit 8ddd6b5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 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: f7ac356dc3da1f69dc52cb6273e08e53b85b4884
refs/heads/master: c7f4bbc92feee2986212ef3b42c806e2257197dc
42 changes: 23 additions & 19 deletions trunk/arch/x86/pci/i386.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,8 @@ struct pci_check_idx_range {
int end;
};

static void __init pcibios_allocate_resources(int pass)
static void __init pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)
{
struct pci_dev *dev = NULL;
int idx, disabled, i;
u16 command;
struct resource *r;
Expand All @@ -246,14 +245,13 @@ static void __init pcibios_allocate_resources(int pass)
#endif
};

for_each_pci_dev(dev) {
pci_read_config_word(dev, PCI_COMMAND, &command);
for (i = 0; i < ARRAY_SIZE(idx_range); i++)
pci_read_config_word(dev, PCI_COMMAND, &command);
for (i = 0; i < ARRAY_SIZE(idx_range); i++)
for (idx = idx_range[i].start; idx <= idx_range[i].end; idx++) {
r = &dev->resource[idx];
if (r->parent) /* Already allocated */
if (r->parent) /* Already allocated */
continue;
if (!r->start) /* Address not assigned at all */
if (!r->start) /* Address not assigned at all */
continue;
if (r->flags & IORESOURCE_IO)
disabled = !(command & PCI_COMMAND_IO);
Expand All @@ -272,23 +270,29 @@ static void __init pcibios_allocate_resources(int pass)
}
}
}
if (!pass) {
r = &dev->resource[PCI_ROM_RESOURCE];
if (r->flags & IORESOURCE_ROM_ENABLE) {
/* Turn the ROM off, leave the resource region,
* but keep it unregistered. */
u32 reg;
dev_dbg(&dev->dev, "disabling ROM %pR\n", r);
r->flags &= ~IORESOURCE_ROM_ENABLE;
pci_read_config_dword(dev,
dev->rom_base_reg, &reg);
pci_write_config_dword(dev, dev->rom_base_reg,
if (!pass) {
r = &dev->resource[PCI_ROM_RESOURCE];
if (r->flags & IORESOURCE_ROM_ENABLE) {
/* Turn the ROM off, leave the resource region,
* but keep it unregistered. */
u32 reg;
dev_dbg(&dev->dev, "disabling ROM %pR\n", r);
r->flags &= ~IORESOURCE_ROM_ENABLE;
pci_read_config_dword(dev, dev->rom_base_reg, &reg);
pci_write_config_dword(dev, dev->rom_base_reg,
reg & ~PCI_ROM_ADDRESS_ENABLE);
}
}
}
}

static void __init pcibios_allocate_resources(int pass)
{
struct pci_dev *dev = NULL;

for_each_pci_dev(dev)
pcibios_allocate_dev_resources(dev, pass);
}

static int __init pcibios_assign_resources(void)
{
struct pci_dev *dev = NULL;
Expand Down

0 comments on commit 8ddd6b5

Please sign in to comment.