Re: Exposing ROM's though sysfs

From: Matthew Wilcox
Date: Fri Jul 30 2004 - 13:18:38 EST


On Fri, Jul 30, 2004 at 10:57:12AM -0700, Jesse Barnes wrote:
> willy brings up a good point though, we may want to disable the rom file
> entirely after its been read, since it can be a source of trouble. Here's
> the latest patch.

My problem is with this is the following passage from PCI 2.2 and PCI 2.3:

In order to minimize the number of address decoders needed, a device
may share a decoder between the Expansion ROM Base Address register and
other Base Address registers. When expansion ROM decode is enabled,
the decoder is used for accesses to the expansion ROM and device
independent software must not access the device through any other Base
Address registers.

ie while we're reading the ROM, we have to prevent any other accesses
to the contents of the BARs. This patch is a loaded gun, pointed right
at your face. Sure, we can say it's root's fault for pulling the trigger,
but it'd be nice to have some kind of safety lock.

I don't see a good way of doing this, unfortunately. It'd probably be
enough to call ->suspend on the driver while you read the contents of
the ROM, but that's pretty ugly.

How about reading the contents of the ROM at pci_scan_bus() time? It'd
waste a bunch of memory, but hey, people love sysfs.

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
-
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/