OSDev.org https://forum.osdev.org/ |
|
ACPI shutdown on real hardware with ACPICA https://forum.osdev.org/viewtopic.php?f=1&t=33640 |
Page 1 of 1 |
Author: | no92 [ Fri Apr 12, 2019 2:53 pm ] |
Post subject: | ACPI shutdown on real hardware with ACPICA |
Hi, I've been busy with ACPICA the time I was able to allocate to osdev (wish it could be more, but that's life -.-). This really is a heads up, which should go in the wiki, but that will have to wait because the entire ACPICA page needs a lot more info to be seriously useful (working on it, albeit slowly!). So after you've completed incorporating ACPICA, got rid of all the bugs in your OS-specific layer (yay), you'll want to enter some sleep state (say S5, the soft shutdown, for the sake of argument). You do whatever the manual says and it works - in your emulator at least (I tested qemu and VirtualBox, and IIRC VMWare, too). On real hardware, things will change: ACPICA will spit out errors regarding some AML, and with the two machines I tested, the following warning appeared when calling AcpiInitializeObjects: ACPICA wrote: ACPI Error: No handler for Region [ECOR] (fffffe00000d28b0) [EmbeddedControl] (2019/evregion-180) ACPI Error: Region EmbeddedControl (ID=3) has no handler (20190405/exfldio-320) This is no fun, because when you decide to call AcpiEnterSleepStatePrep(5), it will reappear with a bit more information: ACPICA wrote: ACPI Error: No handler for Region [ECOR] (fffffe00000d28b0) [EmbeddedControl] (2019/evregion-180) ACPI Error: Region EmbeddedControl (ID=3) has no handler (20190405/exfldio-320) ACPI Error: Aborting method \OPTS due to previous error (AE_NOT_EXIST) (20190405/psparse-581) ACPI Error: Aborting method \_PTS due to previous error (AE_NOT_EXIST) (20190405/psparse-581) evxfevnt-0166 Disable: ACPI mode disabled It will return with error code 6, which should be AE_NOT_EXIST. Needless to say, this is bad. By methods of trial and error (given my superficial understanding of ACPI for now), I found a simple fix. You will install an address space handler for the Embedded Controller, which doesn't necessarily have to do everything. Should you be content with that, the additional code becomes: Code: static ACPI_STATUS acpi_ex_handler(uint32_t function, ACPI_PHYSICAL_ADDRESS address, uint32_t bits, uint64_t *value, void *handler_context, void *region_context) { return AE_OK; } This goes just before the call to AcpiEnableSubsystem: Code: status = AcpiInstallAddressSpaceHandler(ACPI_ROOT_OBJECT, ACPI_ADR_SPACE_EC, &acpi_ec_handler, NULL, NULL); Cheers, Leo |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |