On 11.12.2012, at 07:57, Gerd Hoffmann kraxel@redhat.com wrote:
Hi,
But _INI relies on _STA being evaluated first, so unless I'm missing something that'd be a catch-22 :(
Oops, indeed.
So, I can think of a couple of alternatives:
have a SMC._STA() method that queries something
a) could be fw_cfg (may require hacking qemu/hw/applesmc.c *and* fw_cfg.c to make that happen)
I'd avoid fw_cfg if possible.
b) could be the emulated SMC itself: - right now, only the Data (0x300) and Command (0x304) ports are ever read/written, so we could set aside a magic qemu-smc-only "port" (e.g. 0x308, but anything within the 32-byte range should work) and have it always return a "magic" number when read (via a qemu/hw/applesmc.c patch);
Sounds sensible. Although the smc emulation in qemu looks incomplete, there are a bunch of #defines which are never ever used. Maybe a more complete emulation offers a way to detect the smc without side effects. Failing that some magic register looks ok to me. We should makes sure this doesn't conflict with anything the real hardware does though.
So what if SeaBIOS maps some PCI BAR to 0x300 with a device that goes wild if you write that detection sequence?
The whole point of a DSDT is to free the OS from probing devices.
Alex
b) Kevin mentioned the SSDT and/or "BDAT" as other potential mechanisms to make something like this
I don't think this helps much. This just moves the smc detection from AML code to C code (and BDAT would be used to store the result in a way accessible from AML).
cheers, Gerd