On Tue, Dec 20, 2011 at 11:59 AM, Mark Marshall Mark.Marshall@csr.com wrote:
Hi.
This patch series looks very interesting to me. This patch has been dropped from the V2 series?
According to the bits of the PCI spec that I can find, the option ROM is copied into RAM which is left read-write while the initialisation vector is called, and the RAM is then set to read-only after this time. Does your VGA option ROM use this feature? Do you know of any other's that do? (This is in the V2.1 and V3.0 PCI spec's. Also in at least the V3.0 PCI spec is says that the initialisation code is run in "big real mode", with 4G segments, do you know of any code that uses this feature?).
(I understand that you might be using PMM memory because you want read-write memory at run time, so my comments might not be of help, but you could at least store the pointer to your block in the ROM. I have found some BIOSs that do modify the ROM image in this way (another common thing to store is the PCI BDF of the device, and the BAR locations).)
If you want to look at how I use the PMM stuff, you can see it here: https://github.com/jpidancet/seabios/blob/xengfx/vgasrc/xengfx.c
Among all the global variables that I use in this driver, only one really needs to be writable at runtime (after the initialization vector is called), which is current_mode which holds the current vesa mode number.
The BOCHS driver version I submitted in the V2 is inspired from BOCHS LGPL'd vgabios (http://nongnu.org/vgabios/), which stores the vesa mode number in the BIOS BDA segment.
Every OS has his own way of executing the VGA ROM, and often first check that the checksum of the ROM image is correct before calling it. That's why variables located inside the image really need to be read only after the initialization, you can also see that we rechecksum the image at the end of the initialization vector.