[acpi] Add support for ACPI power off

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2016-07-10 19:25:26 +01:00
parent 74222cd2c1
commit e19c0a8fd2
9 changed files with 519 additions and 4 deletions

View File

@@ -32,6 +32,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/reboot.h>
#include <realmode.h>
#include <bios.h>
#include <ipxe/apm.h>
#include <ipxe/acpipwr.h>
/**
* Reboot system
@@ -49,4 +51,24 @@ static void bios_reboot ( int warm ) {
__asm__ __volatile__ ( REAL_CODE ( "ljmp $0xf000, $0xfff0" ) );
}
/**
* Power off system
*
* @ret rc Return status code
*/
static int bios_poweroff ( void ) {
int rc;
/* Try APM */
if ( ( rc = apm_poweroff() ) != 0 )
DBG ( "APM power off failed: %s\n", strerror ( rc ) );
/* Try ACPI */
if ( ( rc = acpi_poweroff() ) != 0 )
DBG ( "ACPI power off failed: %s\n", strerror ( rc ) );
return rc;
}
PROVIDE_REBOOT ( pcbios, reboot, bios_reboot );
PROVIDE_REBOOT ( pcbios, poweroff, bios_poweroff );