diff options
| author | Michael Brown | 2013-03-22 14:42:16 +0100 |
|---|---|---|
| committer | Michael Brown | 2013-03-22 14:44:02 +0100 |
| commit | 71cd50883896dc043f1025a3b96f3c0c7f3b2184 (patch) | |
| tree | 0d8ec2942571e93d5dfc96e2ac8ff08823735ceb /src/arch | |
| parent | [build] Avoid strict-aliasing warning for gcc 4.3 (diff) | |
| download | ipxe-71cd50883896dc043f1025a3b96f3c0c7f3b2184.tar.gz ipxe-71cd50883896dc043f1025a3b96f3c0c7f3b2184.tar.xz ipxe-71cd50883896dc043f1025a3b96f3c0c7f3b2184.zip | |
[efi] Add "reboot" command for EFI
Abstract out the ability to reboot the system to a separate reboot()
function (with platform-specific implementations), add an EFI
implementation, and make the existing "reboot" command available under
EFI.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch')
| -rw-r--r-- | src/arch/i386/include/bits/reboot.h | 14 | ||||
| -rw-r--r-- | src/arch/i386/include/ipxe/bios_reboot.h | 18 | ||||
| -rw-r--r-- | src/arch/i386/interface/pcbios/bios_reboot.c (renamed from src/arch/i386/hci/commands/reboot_cmd.c) | 40 | ||||
| -rw-r--r-- | src/arch/x86_64/include/bits/reboot.h | 12 |
4 files changed, 51 insertions, 33 deletions
diff --git a/src/arch/i386/include/bits/reboot.h b/src/arch/i386/include/bits/reboot.h new file mode 100644 index 000000000..5b09e95f7 --- /dev/null +++ b/src/arch/i386/include/bits/reboot.h @@ -0,0 +1,14 @@ +#ifndef _BITS_REBOOT_H +#define _BITS_REBOOT_H + +/** @file + * + * i386-specific reboot API implementations + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include <ipxe/bios_reboot.h> + +#endif /* _BITS_REBOOT_H */ diff --git a/src/arch/i386/include/ipxe/bios_reboot.h b/src/arch/i386/include/ipxe/bios_reboot.h new file mode 100644 index 000000000..a0845328d --- /dev/null +++ b/src/arch/i386/include/ipxe/bios_reboot.h @@ -0,0 +1,18 @@ +#ifndef _IPXE_BIOS_REBOOT_H +#define _IPXE_BIOS_REBOOT_H + +/** @file + * + * Standard PC-BIOS reboot mechanism + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#ifdef REBOOT_PCBIOS +#define REBOOT_PREFIX_pcbios +#else +#define REBOOT_PREFIX_pcbios __pcbios_ +#endif + +#endif /* _IPXE_BIOS_REBOOT_H */ diff --git a/src/arch/i386/hci/commands/reboot_cmd.c b/src/arch/i386/interface/pcbios/bios_reboot.c index 74c69c94e..86f4e3eb3 100644 --- a/src/arch/i386/hci/commands/reboot_cmd.c +++ b/src/arch/i386/interface/pcbios/bios_reboot.c @@ -17,51 +17,25 @@ * 02110-1301, USA. */ -#include <realmode.h> -#include <ipxe/command.h> -#include <ipxe/parseopt.h> - FILE_LICENCE ( GPL2_OR_LATER ); /** @file * - * Reboot command + * Standard PC-BIOS reboot mechanism * */ -/** "reboot" options */ -struct reboot_options {}; - -/** "reboot" option list */ -static struct option_descriptor reboot_opts[] = {}; - -/** "reboot" command descriptor */ -static struct command_descriptor reboot_cmd = - COMMAND_DESC ( struct reboot_options, reboot_opts, 0, 0, "" ); +#include <ipxe/reboot.h> +#include <realmode.h> /** - * The "reboot" command + * Reboot system * - * @v argc Argument count - * @v argv Argument list - * @ret rc Return status code */ -static int reboot_exec ( int argc, char **argv ) { - struct reboot_options opts; - int rc; - - /* Parse options */ - if ( ( rc = parse_options ( argc, argv, &reboot_cmd, &opts ) ) != 0 ) - return rc; +static void bios_reboot ( void ) { - /* Reboot system */ + /* Jump to system reset vector */ __asm__ __volatile__ ( REAL_CODE ( "ljmp $0xf000, $0xfff0" ) : : ); - - return 0; } -/** "reboot" command */ -struct command reboot_command __command = { - .name = "reboot", - .exec = reboot_exec, -}; +PROVIDE_REBOOT ( pcbios, reboot, bios_reboot ); diff --git a/src/arch/x86_64/include/bits/reboot.h b/src/arch/x86_64/include/bits/reboot.h new file mode 100644 index 000000000..f1bce0540 --- /dev/null +++ b/src/arch/x86_64/include/bits/reboot.h @@ -0,0 +1,12 @@ +#ifndef _BITS_REBOOT_H +#define _BITS_REBOOT_H + +/** @file + * + * x86_64-specific reboot API implementations + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#endif /* _BITS_REBOOT_H */ |
