On 06.12.2012, at 20:11, Gabriel L. Somlo wrote:
On Thu, Dec 06, 2012 at 06:10:46PM +0100, Alexander Graf wrote:
If I could figure out how to write a reliable _STA method for the SMC, that would detect whether or not it was supplied as "-device applesmc" on the qemu command line, I think we might be on to something...
You should be able to poke fw_cfg in the _STA method. The machine file could search its bus on init (or on machine create notify) and populate a fw_cfg variable to indicate whether it found an applesmc.
So the fw_cfg looks like this in 'info qtree':
dev: fw_cfg, id "" ctl_iobase = 0x510 data_iobase = 0x511 irq 0 mmio ffffffffffffffff/0000000000000002 mmio ffffffffffffffff/0000000000000001
I'm confused by the mmio values (start at the very top of memory, go for one or two bytes from there ?)
No idea what they're doing there. Just ignore them for now.
I also found this patch by Gerd, which doesn't seem to have made it upstream (yet):
http://www.mail-archive.com/qemu-devel@nongnu.org/msg110131.html
That patch suggests that I could just write stuff to 0x510 and read from 0x511, and if I get it "right" the values I read will end up making sense :)
Yup :). And the value could be the STA result.
Can anyone can point me to an example of how to interact with fw_cfg ?
Sure! Check out
http://git.qemu.org/?p=qemu.git;a=blob;f=pc-bios/optionrom/optionrom.h;h=3da...
Alex