#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 */
#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" ) : : );
/**
* 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 ) {}
* 02110-1301, USA.
*/
+#include <getopt.h>
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <ipxe/reboot.h>
*/
/** "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
return rc;
/* Reboot system */
- reboot();
+ reboot ( opts.warm );
return 0;
}
/**
* Reboot system
*
+ * @v warm Perform a warm reboot
*/
-void reboot ( void );
+void reboot ( int warm );
#endif /* _IPXE_REBOOT_H */
/**
* 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 );