ACPI Shutdown and reboot

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
johnsa
Member
Member
Posts: 296
Joined: Mon Oct 15, 2007 3:04 pm

ACPI Shutdown and reboot

Post by johnsa »

I've finished my basic ACPI code, all the table scanning, enable/disable, global lock acquisition for the FACS and i've started writing an AML interpreter (but that is a big job and going to take me some time).

In the meantime however I would like to have working shutdown and reboot.

SHUTDOWN:
For shutdown I followed the guide on the wiki and the details in the ACPI spec about parsing the _S5_ object, getting the SLPTypa/b values and writing them out to the PM1a/b control register blocks.
I've verified that the PM1a/b values coming back in BOCHS and VirtualBox and on real hardware are valid as well as the slp_typ (I've seen 0 and 7 and ports 0xb004, 0x0404).
The shutdown works in Bochs but seems to have no effect in VirtualBox or on real hardware.
I would have assumed the ACPI implementations between Bochs/Qemu and VirtualBox would be the same or at least very similar but it appears not.
I've had a look through some extracted ASL from my real machines for the _PTS and _GTS methods and I cannot see anything in there specifically which would prevent the shutdown if they weren't called.
Not sure if anyone has encountered this as the article seems to indicate that it works on all machines tested thus-far (albeit not ideal by not calling the respective acpi methods).

REBOOT:
On VirtualBox (which has XSDT/ACPI2+) and my real machines I have access to RESET register in ACPI->FADT which seems to work perfectly to perform a reboot (writing ResetValue to it).
This however is not available in Bochs ACPI or on one of my real machines. Temporarily I added in a second call to the 8042 keyboard controller to perform the cpu reset if the acpi call fails or isn't available.
This seems to work in Bochs, but not on the real machine (assuming it's emulation of 8042 doesn't go that far if at all).
What is the suggested method(s) to perform a reboot/restart?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: ACPI Shutdown and reboot

Post by Combuster »

What is the suggested method(s) to perform a reboot/restart?
The KBC might be nonexistent on newer systems. Causing a triple fault guarantees a reset on real hardware, but tends to make VMs complain about the system having crashed instead.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: ACPI Shutdown and reboot

Post by Owen »

Combuster wrote:
What is the suggested method(s) to perform a reboot/restart?
The KBC might be nonexistent on newer systems. Causing a triple fault guarantees a reset on real hardware, but tends to make VMs complain about the system having crashed instead.
Not all systems reset on triple.
Post Reply