iPXE
Functions
bios_reboot.c File Reference

Standard PC-BIOS reboot mechanism. More...

#include <ipxe/reboot.h>
#include <realmode.h>
#include <bios.h>
#include <ipxe/apm.h>
#include <ipxe/acpipwr.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static void bios_reboot (int warm)
 Reboot system.
static int bios_poweroff (void)
 Power off system.
 PROVIDE_REBOOT (pcbios, reboot, bios_reboot)
 PROVIDE_REBOOT (pcbios, poweroff, bios_poweroff)

Detailed Description

Standard PC-BIOS reboot mechanism.

Definition in file bios_reboot.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static void bios_reboot ( int  warm) [static]

Reboot system.

Parameters:
warmPerform a warm reboot

Definition at line 43 of file bios_reboot.c.

References __asm__(), BDA_REBOOT, BDA_REBOOT_WARM, BDA_SEG, flag, put_real, and REAL_CODE.

                                     {
        uint16_t flag;

        /* Configure BIOS for cold/warm reboot */
        flag = ( warm ? BDA_REBOOT_WARM : 0 );
        put_real ( flag, BDA_SEG, BDA_REBOOT );

        /* Jump to system reset vector */
        __asm__ __volatile__ ( REAL_CODE ( "ljmp $0xf000, $0xfff0" ) : );
}
static int bios_poweroff ( void  ) [static]

Power off system.

Return values:
rcReturn status code

Definition at line 59 of file bios_reboot.c.

References acpi_poweroff(), apm_poweroff(), DBG, rc, and strerror().

                                  {
        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   
)