Re: Ignore disabled ROM resources at setup

From: Linus Torvalds
Date: Tue Aug 30 2005 - 00:32:00 EST




On Tue, 30 Aug 2005, Benjamin Herrenschmidt wrote:
>
> I was just testing a slightly different one that appear to fix the
> problem :
...
> + rom_addr = region.start | (res->flags & PCI_REGION_FLAG_MASK);

I worry about this one. It's not really correct. The low en bits are
"reserved", and while I don't know whether writing zero is always correct,
I do know that just writing the low 4 bits with the old value is a bit
strange. And the flags don't save the other bits.

So I'd prefer either my previous diff, or one that just re-reads the bits
entirely, something like the appended..

What does the PCI spec say about the reserved bits? Do we have to save
them?

Linus

---
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -24,9 +24,16 @@
static void pci_enable_rom(struct pci_dev *pdev)
{
u32 rom_addr;
+ struct resource *res = pdev->resource + PCI_ROM_RESOURCE;
+ struct pci_bus_region region;

+ if (!res->flags)
+ return;
+
+ pcibios_resource_to_bus(pdev, &region, res);
pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_addr);
- rom_addr |= PCI_ROM_ADDRESS_ENABLE;
+ rom_addr &= ~PCI_ROM_ADDRESS_MASK;
+ rom_addr |= region.start | PCI_ROM_ADDRESS_ENABLE;
pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/