[SeaBIOS] [PATCH 3/3] acpi: revert d9f5cdbdf (DSDT: Fix HPET _CRS Method)

Gabriel L. Somlo gsomlo at gmail.com
Mon Dec 10 19:13:37 CET 2012

On Mon, Dec 10, 2012 at 08:04:11AM +0100, Gerd Hoffmann wrote:
> >>> +        Method(_STA, 0) {
> >>> +            Store(0x10, CMDP)    // APPLESMC_READ_CMD
> >>> +            Store(CMDP, Local0)
> >>> +            If (LEqual(Local0, 0x0c)) {
> > 
> > Also, once you've tickled the CMDP, the SMC internal state is no
> > longer what OS X expects, so it gets all hung up on that later during
> > the boot process. I guess I'll put "gain thorough understanding of the
> > qemu applesmc state machine" on my ToDo list :)
> _STA having side effects isn't exactly nice.  Doing that once in _INI
> instead might work better.

But _INI relies on _STA being evaluated first, so unless I'm missing
something that'd be a catch-22 :(

So, I can think of a couple of alternatives:

	1. 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)

		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);

			  _STA() could return 0xB if the magic number
			  is there, or 0x0 otherwise

	2. have a hardcoded SMC._STA() that always returns 0xB

		a) This is where my ACPI n00b-ness starts to show. This
		   would require somehow compiling the DSDT during QEMU
		   startup, once we know whether '-device applesmc' was
		   given on the qemu command line or not.

		b) Kevin mentioned the SSDT and/or "BDAT" as other
		   potential mechanisms to make something like this
		   happen, but I'm not sure whether an SMC device node
		   in the SSDT (as opposed to the DSDT) would be enough
		   to "placate" OS X, aside from the (maybe simple)
		   problem of figuring out how to control whether it
		   gets included or not from the surrounding SeaBIOS
		   and/or QEMU C code.

		   As for BDAT, grepping through the SeaBIOS source
		   only gets me a few lines in acpi.c and
		   acpi-dsdt-pci-crs.dsl, something related to an
		   "operating region", not too clear how I'd
		   get "there" from "here"...

Looking at the above, I think 1.b is my favorite, but then again,
I may be wrong...

Any clue, advice, or feedback much appreciated !


More information about the SeaBIOS mailing list