]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-12-02 Robert Millan <rmh.grub@aybabtu.com>
authorRobert Millan <rmh@aybabtu.com>
Wed, 2 Dec 2009 22:48:02 +0000 (22:48 +0000)
committerRobert Millan <rmh@aybabtu.com>
Wed, 2 Dec 2009 22:48:02 +0000 (22:48 +0000)
        Use the same reboot approach on i386 coreboot and qemu as we do on
        BIOS.

        * conf/i386-coreboot.rmk (kernel_img_HEADERS): Add `cpu/reboot.h'.
        (reboot_mod_SOURCES): Remove `kern/i386/reboot.c'.
        * kern/i386/reboot.c: Remove.
        * include/grub/i386/reboot.h (grub_reboot): Export function.
        * kern/i386/pc/startup.S (grub_reboot): Move from here ...
        * kern/i386/realmode.S (grub_reboot): ... to here.  Jump to
        0xf000:0xfff0 instead of 0xffff:0x0000.
        [!GRUB_MACHINE_PCBIOS] (prot_to_real): Do not restore interrupts.
        * kern/i386/qemu/startup.S: Include `"../realmode.S"'.

ChangeLog
conf/i386-coreboot.rmk
include/grub/i386/reboot.h
kern/i386/pc/startup.S
kern/i386/qemu/startup.S
kern/i386/realmode.S
kern/i386/reboot.c [deleted file]

index de76474103ae8ed412be99659b4f71aec21f285c..db94fca9ef49b6c61ecca01daa04c62d2b3fe7bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2009-12-02  Robert Millan  <rmh.grub@aybabtu.com>
+
+       Use the same reboot approach on i386 coreboot and qemu as we do on
+       BIOS.
+
+       * conf/i386-coreboot.rmk (kernel_img_HEADERS): Add `cpu/reboot.h'.
+       (reboot_mod_SOURCES): Remove `kern/i386/reboot.c'.
+       * kern/i386/reboot.c: Remove.
+       * include/grub/i386/reboot.h (grub_reboot): Export function.
+       * kern/i386/pc/startup.S (grub_reboot): Move from here ...
+       * kern/i386/realmode.S (grub_reboot): ... to here.  Jump to
+       0xf000:0xfff0 instead of 0xffff:0x0000.
+       [!GRUB_MACHINE_PCBIOS] (prot_to_real): Do not restore interrupts.
+       * kern/i386/qemu/startup.S: Include `"../realmode.S"'.
+
 2009-11-30  Robert Millan  <rmh.grub@aybabtu.com>
 
        Fix $srcdir != $objdir build.
index ccc326f5c857957f43b44a7eead4b74b8eb02f28..541b0777e274293aaf2c54a378d8cbb788635717 100644 (file)
@@ -33,6 +33,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
 kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
        env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
        partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
+       cpu/reboot.h \
        machine/boot.h machine/console.h machine/init.h \
        machine/memory.h machine/loader.h list.h handler.h command.h i18n.h
 kernel_img_CFLAGS = $(COMMON_CFLAGS)
@@ -76,6 +77,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \
 kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
        env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
        partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
+       cpu/reboot.h \
        machine/boot.h machine/console.h machine/init.h \
        machine/memory.h machine/loader.h list.h handler.h command.h i18n.h
 kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
@@ -124,7 +126,7 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
 linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For reboot.mod.
-reboot_mod_SOURCES = commands/reboot.c kern/i386/reboot.c
+reboot_mod_SOURCES = commands/reboot.c
 reboot_mod_CFLAGS = $(COMMON_CFLAGS)
 reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
index 5bcbb5d6469dcc6f5cbaf82895fe4e566293d1b0..1f2da1d5ccf24cad013f49d8867b190ce8ec9949 100644 (file)
@@ -16,4 +16,4 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-extern void grub_reboot (void);
+extern void EXPORT_FUNC(grub_reboot) (void);
index da3624c894d5afabd9c0da21d816dbd73f416887..87365c0ed0a99c30bb36d09ddd8e7ed436fcbc88 100644 (file)
@@ -484,21 +484,6 @@ FUNCTION(grub_exit)
        jmp     cold_reboot
        .code32
 
-/*
- * grub_reboot()
- *
- * Reboot the system. At the moment, rely on BIOS.
- */
-FUNCTION(grub_reboot)
-       call    prot_to_real
-       .code16
-cold_reboot:
-       /* cold boot */
-       movw    $0x0472, %di
-       movw    %ax, (%di)
-       ljmp    $0xFFFF, $0x0000
-       .code32
-
 /*
  * grub_halt(int no_apm)
  *
index 0be5ae84fd6cdfc3ddffd75fa7735cf7cc817e94..7d3cb1b5e644214534e05fa95ca32c5a206eb111 100644 (file)
@@ -95,3 +95,5 @@ codestart:
 
        /* This should never happen.  */
        jmp     EXT_C(grub_stop)
+
+#include "../realmode.S"
index 11f4d534770b34d9e465da9e3567f51eb1afed86..424dd0eca51a6d1da37e6ad2129e5e58d2c3c6ea 100644 (file)
@@ -215,10 +215,27 @@ realcseg:
        movw    %ax, %gs
        movw    %ax, %ss
 
+#ifdef GRUB_MACHINE_PCBIOS
        /* restore interrupts */
        sti
+#endif
 
        /* return on new stack! */
        DATA32  ret
 
        .code32
+
+/*
+ * grub_reboot()
+ *
+ * Reboot the system. At the moment, rely on BIOS.
+ */
+FUNCTION(grub_reboot)
+       call    prot_to_real
+       .code16
+cold_reboot:
+       /* set 0x472 to 0x0000 for cold boot (0x1234 for warm boot) */
+       movw    $0x0472, %di
+       movw    %ax, (%di)
+       ljmp    $0xf000, $0xfff0
+       .code32
diff --git a/kern/i386/reboot.c b/kern/i386/reboot.c
deleted file mode 100644 (file)
index 6d562f8..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2008  Free Software Foundation, Inc.
- *
- *  GRUB is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <grub/cpu/io.h>
-#include <grub/cpu/at_keyboard.h>
-#include <grub/cpu/reboot.h>
-#include <grub/misc.h>
-
-void
-grub_reboot (void)
-{
-  /* Use the keyboard controller to reboot.  That's what keyboards were
-     designed for, isn't it?  */
-  grub_outb (KEYBOARD_COMMAND_REBOOT, KEYBOARD_REG_STATUS);
-
-  grub_printf ("GRUB doesn't know how to reboot this machine yet!\n");
-}