mirror of
https://github.com/ipxe/ipxe
synced 2025-12-26 01:22:37 +03:00
[acpi] Add support for ACPI power off
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user