]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2008-02-12 Alexandre Boeglin <alex@boeglin.org>
authorboeglin <boeglin@localhost>
Tue, 12 Feb 2008 23:47:07 +0000 (23:47 +0000)
committerboeglin <boeglin@localhost>
Tue, 12 Feb 2008 23:47:07 +0000 (23:47 +0000)
  * conf/i386-efi.rmk (grub_emu_SOURCES): Replace commands/i386/pc/halt.c and
  reboot.c by commands/halt.c and reboot.c.
  (grub_install_SOURCES): Add halt.mod and reboot.mod.
  (halt_mod_SOURCES): New variable.
  (halt_mod_CFLAGS): Likewise.
  (halt_mod_LDFLAGS): Likewise.
  (reboot_mod_SOURCES): Likewise.
  (reboot_mod_CFLAGS): Likewise.
  (reboot_mod_LDFLAGS): Likewise.

  * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Replace commands/ieee1275/halt.c
  and reboot.c by commands/halt.c and reboot.c.
  (halt_mod_SOURCES): Likewise.
  (reboot_mod_SOURCES): Likewise.

  * conf/i386-pc.rmk (grub_emu_SOURCES): Replace commands/i386/pc/reboot.c by
  commands/reboot.c.
  (reboot_mod_SOURCES): Likewise.

  * commands/i386/pc/reboot.c: merge this file ...

  * commands/ieee1275/reboot.c: ... and this file ...

  * commands/reboot.c: ... to this file.
  Add some precompiler directive to include the correct header for each
  machine.

  * commands/ieee1275/halt.c: move this file ...

  * commands/halt.c: ... to here.
  Add some precompiler directive to include the correct header for each
  machine.

  * include/grub/efi/efi.h (grub_reboot): New function declaration.
  (grub_halt): Likewise.

  * kern/efi/efi.c (grub_reboot): New function.
  (grub_halt): Likewise.

ChangeLog
commands/halt.c [moved from commands/ieee1275/halt.c with 84% similarity]
commands/ieee1275/reboot.c [deleted file]
commands/reboot.c [moved from commands/i386/pc/reboot.c with 82% similarity]
conf/i386-efi.rmk
conf/i386-ieee1275.rmk
conf/i386-pc.rmk
include/grub/efi/efi.h
kern/efi/efi.c

index a78bb0961538bc04c558d5bce62c96d28468c335..ede054640fc432346e12b28287f16e1d344faa88 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,44 @@
+2008-02-12  Alexandre Boeglin  <alex@boeglin.org>
+
+       * conf/i386-efi.rmk (grub_emu_SOURCES): Replace commands/i386/pc/halt.c and
+       reboot.c by commands/halt.c and reboot.c.
+       (grub_install_SOURCES): Add halt.mod and reboot.mod.
+       (halt_mod_SOURCES): New variable.
+       (halt_mod_CFLAGS): Likewise.
+       (halt_mod_LDFLAGS): Likewise.
+       (reboot_mod_SOURCES): Likewise.
+       (reboot_mod_CFLAGS): Likewise.
+       (reboot_mod_LDFLAGS): Likewise.
+
+       * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Replace commands/ieee1275/halt.c
+       and reboot.c by commands/halt.c and reboot.c.
+       (halt_mod_SOURCES): Likewise.
+       (reboot_mod_SOURCES): Likewise.
+
+       * conf/i386-pc.rmk (grub_emu_SOURCES): Replace commands/i386/pc/reboot.c by
+       commands/reboot.c.
+       (reboot_mod_SOURCES): Likewise.
+
+       * commands/i386/pc/reboot.c: merge this file ...
+
+       * commands/ieee1275/reboot.c: ... and this file ...
+
+       * commands/reboot.c: ... to this file.
+       Add some precompiler directive to include the correct header for each
+       machine.
+
+       * commands/ieee1275/halt.c: move this file ...
+
+       * commands/halt.c: ... to here.
+       Add some precompiler directive to include the correct header for each
+       machine.
+
+       * include/grub/efi/efi.h (grub_reboot): New function declaration.
+       (grub_halt): Likewise.
+
+       * kern/efi/efi.c (grub_reboot): New function.
+       (grub_halt): Likewise.
+
 2008-02-12  Robert Millan  <rmh@aybabtu.com>
 
        * util/getroot.c (grub_guess_root_device): Inspect /dev/evms before
similarity index 84%
rename from commands/ieee1275/halt.c
rename to commands/halt.c
index e6ec52c95e7798606e7c9b4c24c935b77ae90c24..65da1ea0a55d63851f2ba9933730b070bf6d21ed 100644 (file)
@@ -1,7 +1,7 @@
 /* halt.c - command to halt the computer.  */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2005,2007,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
 
 #include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/misc.h>
+#include <grub/machine/machine.h>
+
+#if defined(GRUB_MACHINE_IEEE1275)
 #include <grub/machine/kernel.h>
+#elif defined(GRUB_MACHINE_EFI)
+#include <grub/efi/efi.h>
+#endif
 
 static grub_err_t
 grub_cmd_halt (struct grub_arg_list *state __attribute__ ((unused)),
@@ -32,7 +37,7 @@ grub_cmd_halt (struct grub_arg_list *state __attribute__ ((unused)),
 }
 
 \f
-GRUB_MOD_INIT(ieee1275_halt)
+GRUB_MOD_INIT(halt)
 {
   (void)mod;                   /* To stop warning. */
   grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
@@ -40,7 +45,7 @@ GRUB_MOD_INIT(ieee1275_halt)
                         " work on all firmware.", 0);
 }
 
-GRUB_MOD_FINI(ieee1275_halt)
+GRUB_MOD_FINI(halt)
 {
   grub_unregister_command ("halt");
 }
diff --git a/commands/ieee1275/reboot.c b/commands/ieee1275/reboot.c
deleted file mode 100644 (file)
index c0a3e9c..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/* reboot.c - command to reboot the computer.  */
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2007  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/normal.h>
-#include <grub/dl.h>
-#include <grub/misc.h>
-#include <grub/machine/kernel.h>
-
-static grub_err_t
-grub_cmd_reboot (struct grub_arg_list *state __attribute__ ((unused)),
-                int argc __attribute__ ((unused)),
-                char **args __attribute__ ((unused)))
-{
-  grub_reboot ();
-  return 0;
-}
-
-\f
-GRUB_MOD_INIT(ieee1275_reboot)
-{
-  (void)mod;                   /* To stop warning. */
-  grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
-                        "reboot", "Reboot the computer", 0);
-}
-
-GRUB_MOD_FINI(ieee1275_reboot)
-{
-  grub_unregister_command ("reboot");
-}
similarity index 82%
rename from commands/i386/pc/reboot.c
rename to commands/reboot.c
index df691d557687d13598d800bebd196bc65c911845..c668b36bd8b3c9ffe86a54ed60f2fde6302b8df2 100644 (file)
@@ -1,7 +1,7 @@
 /* reboot.c - command to reboot the computer.  */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2005,2007,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
 
 #include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
+#include <grub/machine/machine.h>
+
+#if defined(GRUB_MACHINE_IEEE1275)
+#include <grub/machine/kernel.h>
+#elif defined(GRUB_MACHINE_EFI)
+#include <grub/efi/efi.h>
+#elif defined(GRUB_MACHINE_PCBIOS)
 #include <grub/machine/init.h>
+#endif
+
 
 static grub_err_t
 grub_cmd_reboot (struct grub_arg_list *state __attribute__ ((unused)),
                 int argc __attribute__ ((unused)),
                 char **args __attribute__ ((unused)))
-
 {
   grub_reboot ();
   return 0;
 }
 
-
 \f
 GRUB_MOD_INIT(reboot)
 {
index 8310e6b9324a48e01a4a8b6b5575e5ef39d0bba0..ffba6128dd2e72f5b9c50f58115f652c1f2690ba 100644 (file)
@@ -37,7 +37,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c      \
        commands/configfile.c commands/help.c                           \
        commands/terminal.c commands/ls.c commands/test.c               \
        commands/search.c commands/hexdump.c                            \
-       commands/i386/pc/halt.c commands/i386/pc/reboot.c               \
+       commands/halt.c commands/reboot.c                               \
        commands/i386/cpuid.c                                           \
        disk/loopback.c                                                 \
        \
@@ -75,7 +75,7 @@ grub_install_SOURCES = util/i386/efi/grub-install.in
 
 # Modules.
 pkglib_MODULES = kernel.mod normal.mod _chain.mod chain.mod \
-       _linux.mod linux.mod cpuid.mod
+       _linux.mod linux.mod cpuid.mod halt.mod reboot.mod
 
 # For kernel.mod.
 kernel_mod_EXPORTS = no
@@ -138,4 +138,14 @@ cpuid_mod_SOURCES = commands/i386/cpuid.c
 cpuid_mod_CFLAGS = $(COMMON_CFLAGS)
 cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
+# For halt.mod.
+halt_mod_SOURCES = commands/halt.c
+halt_mod_CFLAGS = $(COMMON_CFLAGS)
+halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+# For reboot.mod.
+reboot_mod_SOURCES = commands/reboot.c
+reboot_mod_CFLAGS = $(COMMON_CFLAGS)
+reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 include $(srcdir)/conf/common.mk
index 98d78c191af59565df4acd89a5ae7efcc9201c49..01e354879eb118d321d5e7ae966a88402b0da382 100644 (file)
@@ -62,7 +62,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c      \
        commands/configfile.c commands/echo.c commands/help.c           \
        commands/terminal.c commands/ls.c commands/test.c               \
        commands/search.c commands/blocklist.c commands/hexdump.c       \
-       commands/ieee1275/halt.c commands/ieee1275/reboot.c             \
+       commands/halt.c commands/reboot.c                               \
        commands/i386/cpuid.c                                           \
        disk/host.c disk/loopback.c                                     \
        \
@@ -125,12 +125,12 @@ suspend_mod_CFLAGS = $(COMMON_CFLAGS)
 suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For reboot.mod
-reboot_mod_SOURCES = commands/ieee1275/reboot.c
+reboot_mod_SOURCES = commands/reboot.c
 reboot_mod_CFLAGS = $(COMMON_CFLAGS)
 reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For halt.mod
-halt_mod_SOURCES = commands/ieee1275/halt.c
+halt_mod_SOURCES = commands/halt.c
 halt_mod_CFLAGS = $(COMMON_CFLAGS)
 halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
index 06e9a7e5740e880e80a408cf08527f89916e4dc4..a03f721d69a0cad499c89b95a183e113fcb596c0 100644 (file)
@@ -106,7 +106,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c    \
        commands/configfile.c commands/echo.c commands/help.c           \
        commands/terminal.c commands/ls.c commands/test.c               \
        commands/search.c commands/blocklist.c commands/hexdump.c       \
-       commands/i386/pc/halt.c commands/i386/pc/reboot.c               \
+       commands/i386/pc/halt.c commands/reboot.c                       \
        commands/i386/cpuid.c                                           \
        disk/host.c disk/loopback.c                                     \
        fs/fshelp.c     \
@@ -191,7 +191,7 @@ normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
 normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For reboot.mod.
-reboot_mod_SOURCES = commands/i386/pc/reboot.c
+reboot_mod_SOURCES = commands/reboot.c
 reboot_mod_CFLAGS = $(COMMON_CFLAGS)
 reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
index fbc6be9852997d39ecf7a00bc8de21b0be622e5e..8c277c00fc55ac21e2a1c5560c24eb435a179fda 100644 (file)
@@ -1,7 +1,7 @@
 /* efi.h - declare variables and functions for EFI support */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2006,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2006,2007,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
@@ -54,6 +54,8 @@ char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
 grub_efi_device_path_t *
 EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle);
 int EXPORT_FUNC(grub_efi_exit_boot_services) (grub_efi_uintn_t map_key);
+void EXPORT_FUNC (grub_reboot) (void);
+void EXPORT_FUNC (grub_halt) (void);
 
 void grub_efi_mm_init (void);
 void grub_efi_mm_fini (void);
index 49128a2390ba402d83ba66166dc37c29dd5c66ae..11dac5891aefb885758e445026dac798dad2f5fa 100644 (file)
@@ -1,7 +1,7 @@
 /* efi.c - generic EFI support */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2006,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2006,2007,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
@@ -162,6 +162,22 @@ grub_exit (void)
                                              0, 0);
 }
 
+void
+grub_reboot (void)
+{
+  grub_efi_fini ();
+  grub_efi_system_table->runtime_services->
+    reset_system (GRUB_EFI_RESET_COLD, GRUB_EFI_SUCCESS, 0, NULL);
+}
+
+void
+grub_halt (void)
+{
+  grub_efi_fini ();
+  grub_efi_system_table->runtime_services->
+    reset_system (GRUB_EFI_RESET_SHUTDOWN, GRUB_EFI_SUCCESS, 0, NULL);
+}
+
 int
 grub_efi_exit_boot_services (grub_efi_uintn_t map_key)
 {