Accessing PCI expansion ROMs

Martin Schwenke (martin@meltin.net)
Mon, 28 Oct 2002 16:29:40 +1100


I want to extract VPD (Vital Product Data) from the expansion ROMs on
PCI 2.0/2.1 devices. The PCI specification tells me all I need to
know once I can actually access the ROM I'm after.

On ppc I can use xmon (or write a dedicated utility) to get to
expansion ROMs and extract the required part. On i386, expansion ROMs
don't have addresses assigned and the PCI initialisation code seems to
explicitly disable and unassign them (and this seems to be recommended
by the PCI specification).

So, it looks like there might be a few options...

* Userspace. Is there a reliable way of accessing the ROMs from
userspace? Does it work the same way on different architectures?

I know I can assign an address and enable a ROM via PCI
configuration space, but I don't know if either of these things can
be done safely from userspace.

* Kernel. Write some kernel code to dynamically retrieve the contents
of expansion ROMs.

This might involve assigning an address, enabling the ROM, reading
data, disabling the ROM and then possibly unassigning it again.

* Kernel. Write some kernel code that hooks into the PCI
initialisation/hotplug to grab the contents of expansion ROMs before
they are unassigned and disabled. Copy the data and put it into
/proc or /devices - yep, a bit gross, but the amount of data tends
to be small.

Any ideas? I'd really like it to be architecture independent,
preferably userspace. However, it can't be done there, it'll have to
be done in the kernel... and then possibly architecture by
architecture...

Please copy me on replies, since I'm not subscribed to linux-kernel.

Thanks...

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