[SeaBIOS] Saving a few bytes across a reboot
stefanb at linux.vnet.ibm.com
Tue Jan 9 20:02:52 CET 2018
On 01/09/2018 10:14 AM, Kevin O'Connor wrote:
> On Tue, Jan 09, 2018 at 10:00:44AM -0500, Stefan Berger wrote:
>> is it possible to save a few bytes, a pointer, across a reboot? I have
>> tried to do this by allocating a memory chunk in the fsegement and storing
>> the pointer there surrounded by 2 'magic' 32 bit values. When trying to find
>> the magic values on reboot early in handle_post() it doesn't seem to find
>> them anymore. Is there another memory segment where SeaBIOS could store the
>> few bytes and find them again?
> Didn't you have that implemented with the "Support Physical Presence
> Interface Spec" patches you made back in 2015?
Yes. Back then the bytes shared between BIOS and ACPI were located in a
MMIO memory area of the TPM TIS, which was basically a hack to save the
few bytes across reboot. This time we are trying to embed these bytes in
the ACPI stream where it would be allocated similar to the log area for
the TPM. Besides that there would be a QEMU ACPI table (with name
'QEMU') to get the address from for that memory area. An ACPI variable
would also get that address and use it in the address field of
OperationRegion(). This works fine. Once we reboot, the ACPI stream gets
re-initialized and everything there is gone. However, if we can save
that memory early on during boot and restore it back into the expected
location after ACPI has been re-done, this also works (I know this
because I can test this with a hard coded address where that share
memory is every time on my machine). Problem is just finding the address
to the share memory. A possibility would be to again abuse a device's
memory area as before to now hold only those 4 bytes...
Another twist is that Intel's EDK2 also implements this but the data
structure layout is different and they use SMM + SMIs etc.
QEMU would also be generating the ACPI for this UEFI I suppose. So now
who needs to adapt to whom? And can EDK2 be adapted to do something
different or should it remain as-is and SeaBIOS would have to work
similarly as EDK2 does? I don't know much about SMM / SMIs and how it
work unfortunately and whether it can work from the OS when ACPI raises
an SMI. Any opinions ?
> Everything in low memory gets wiped out on a reboot. Any storage
> would have to be above 1M (or in a hardware register somewhere).
> BTW, can we move this discussion onto one of the mailing lists?
Sure. I had cc'ed SeaBIOS mailing list this time.
More information about the SeaBIOS