summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/i386/include/bios.h2
-rw-r--r--src/arch/i386/interface/pcbios/bios_reboot.c9
-rw-r--r--src/core/null_reboot.c3
-rw-r--r--src/hci/commands/reboot_cmd.c15
-rw-r--r--src/include/ipxe/reboot.h3
-rw-r--r--src/interface/efi/efi_reboot.c5
6 files changed, 28 insertions, 9 deletions
diff --git a/src/arch/i386/include/bios.h b/src/arch/i386/include/bios.h
index fadb9f1b7..3e6a845e3 100644
--- a/src/arch/i386/include/bios.h
+++ b/src/arch/i386/include/bios.h
@@ -6,6 +6,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define BDA_SEG 0x0040
#define BDA_EQUIPMENT_WORD 0x0010
#define BDA_FBMS 0x0013
+#define BDA_REBOOT 0x0072
+#define BDA_REBOOT_WARM 0x1234
#define BDA_NUM_DRIVES 0x0075
#endif /* BIOS_H */
diff --git a/src/arch/i386/interface/pcbios/bios_reboot.c b/src/arch/i386/interface/pcbios/bios_reboot.c
index 86f4e3eb3..68546b2e5 100644
--- a/src/arch/i386/interface/pcbios/bios_reboot.c
+++ b/src/arch/i386/interface/pcbios/bios_reboot.c
@@ -27,12 +27,19 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/reboot.h>
#include <realmode.h>
+#include <bios.h>
/**
* Reboot system
*
+ * @v warm Perform a warm reboot
*/
-static void bios_reboot ( void ) {
+static void bios_reboot ( int warm ) {
+ 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" ) : : );
diff --git a/src/core/null_reboot.c b/src/core/null_reboot.c
index b7e55bce8..8e3ed0bb6 100644
--- a/src/core/null_reboot.c
+++ b/src/core/null_reboot.c
@@ -32,8 +32,9 @@ FILE_LICENCE ( GPL2_OR_LATER );
/**
* Reboot system
*
+ * @v warm Perform a warm reboot
*/
-static void null_reboot ( void ) {
+static void null_reboot ( int warm __unused ) {
printf ( "Cannot reboot; not implemented\n" );
while ( 1 ) {}
diff --git a/src/hci/commands/reboot_cmd.c b/src/hci/commands/reboot_cmd.c
index 19d3d6df4..44dcfc71c 100644
--- a/src/hci/commands/reboot_cmd.c
+++ b/src/hci/commands/reboot_cmd.c
@@ -17,6 +17,7 @@
* 02110-1301, USA.
*/
+#include <getopt.h>
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <ipxe/reboot.h>
@@ -30,14 +31,20 @@ FILE_LICENCE ( GPL2_OR_LATER );
*/
/** "reboot" options */
-struct reboot_options {};
+struct reboot_options {
+ /** Perform a warm reboot */
+ int warm;
+};
/** "reboot" option list */
-static struct option_descriptor reboot_opts[] = {};
+static struct option_descriptor reboot_opts[] = {
+ OPTION_DESC ( "warm", 'w', no_argument,
+ struct reboot_options, warm, parse_flag ),
+};
/** "reboot" command descriptor */
static struct command_descriptor reboot_cmd =
- COMMAND_DESC ( struct reboot_options, reboot_opts, 0, 0, "" );
+ COMMAND_DESC ( struct reboot_options, reboot_opts, 0, 0, "[--warm]" );
/**
* The "reboot" command
@@ -55,7 +62,7 @@ static int reboot_exec ( int argc, char **argv ) {
return rc;
/* Reboot system */
- reboot();
+ reboot ( opts.warm );
return 0;
}
diff --git a/src/include/ipxe/reboot.h b/src/include/ipxe/reboot.h
index 043c5e10b..5d882d3dd 100644
--- a/src/include/ipxe/reboot.h
+++ b/src/include/ipxe/reboot.h
@@ -51,7 +51,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
/**
* Reboot system
*
+ * @v warm Perform a warm reboot
*/
-void reboot ( void );
+void reboot ( int warm );
#endif /* _IPXE_REBOOT_H */
diff --git a/src/interface/efi/efi_reboot.c b/src/interface/efi/efi_reboot.c
index 1ecccc460..bfee36aa3 100644
--- a/src/interface/efi/efi_reboot.c
+++ b/src/interface/efi/efi_reboot.c
@@ -32,12 +32,13 @@ FILE_LICENCE ( GPL2_OR_LATER );
/**
* Reboot system
*
+ * @v warm Perform a warm reboot
*/
-static void efi_reboot ( void ) {
+static void efi_reboot ( int warm ) {
EFI_RUNTIME_SERVICES *rs = efi_systab->RuntimeServices;
/* Use runtime services to reset system */
- rs->ResetSystem ( EfiResetCold, 0, 0, NULL );
+ rs->ResetSystem ( ( warm ? EfiResetWarm : EfiResetCold ), 0, 0, NULL );
}
PROVIDE_REBOOT ( efi, reboot, efi_reboot );