From: Matthew Garrett on
On Wed, Jun 02, 2010 at 07:47:17PM -0600, Robert Hancock wrote:
> On Wed, Jun 2, 2010 at 7:37 PM, Matthew Garrett <mjg59(a)srcf.ucam.org> wrote:
> > That's pretty infuriating. The ACPI-provided definition doesn't work,
> > and there's no ACPI mechanism for expressing the more complex cf9
> > behaviour. Windows doesn't appear to special case this, so we're
> > probably left trying to figure out why the keyboard controller method
> > doesn't work. Sigh.
>
> Do these Macs even have a PC keyboard controller? A recent thread on
> PS/2 keyboard/mouse controller probing suggests they may not..

Possibly an SMM trap...

> Justin, what happens if you try the simple outb(6, 0xcf9) test program
> multiple times, does that do anything?

Huh. That might work, yes. Windows does the ACPI write, an i8042 write,
the ACPI write, another i8042 write and then gives up. If that happens
sufficiently quickly, this might get us somewhere. Justin, can you try:

#include <sys/io.h>
#include <unistd.h>

int main() {
iopl(3);
outb(6, 0xcf9);
usleep(100);
outb(6, 0xcf9);
return 0;
}

and see if that reboots?

--
Matthew Garrett | mjg59(a)srcf.ucam.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Matthew Garrett on
On Wed, Jun 02, 2010 at 07:15:36PM -0700, Justin P. Mattock wrote:
> as soon as I change:
>
> int main() {
> iopl(3);
> outb(6, 0xcf9);
> usleep(100);
> outb(6, 0xcf9);
> return 0;
> }
> (the above gave a command prompt
> with numerous tries)

Ok, so it's not that straghtforward. Sigh. There's various hacky
workarounds we could do here, but Windows doesn't seem to do them so I
lean towards suspecting that there's something wrong with our keyboard
controller reboot mechanism. I'll try doing some more tracing.

--
Matthew Garrett | mjg59(a)srcf.ucam.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Matthew Garrett on
On Thu, Jun 03, 2010 at 10:54:38AM +0100, Alan Cox wrote:

> At least some PCs you need to issue the reboot outb calls on the boot
> processor so the userspace tests won't be reliable.

The cf9 write is supposed to be handled by the chipset rather than via
SMM, I believe? The SMM code I've seen for reboots seems to implement
the actual reboot by hitting that port itself...

--
Matthew Garrett | mjg59(a)srcf.ucam.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/