]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2005-03-26 Hollis Blanchard <hollis@penguinppc.org>
authorhollisb <hollisb@localhost>
Sat, 26 Mar 2005 17:34:50 +0000 (17:34 +0000)
committerhollisb <hollisb@localhost>
Sat, 26 Mar 2005 17:34:50 +0000 (17:34 +0000)
* commands/ieee1275/halt.c (grub_cmd_halt): Call grub_halt
instead of grub_ieee1275_interpret.
(grub_halt_init): New function.
(grub_halt_fini): Likewise.
(GRUB_MOD_INIT): Correct message grammar.
* commands/ieee1275/reboot.c (grub_cmd_reboot): Call grub_reboot
instead of grub_ieee1275_interpret.
(grub_reboot_init): New function.
(grub_reboot_fini): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Replace
commands/i386/pc/halt.c, commands/i386/pc/reboot.c, and
util/i386/pc/misc.c with commands/ieee1275/halt.c,
commands/ieee1275/reboot.c, and util/powerpc/ieee1275/misc.c.
* disk/powerpc/ieee1275/ofdisk.c (grub_ofdisk_fini): New
function.
* include/grub/powerpc/ieee1275/console.h (grub_console_fini):
Add prototype.
* include/grub/powerpc/ieee1275/ieee1275.h (grub_reboot): Add
prototype.
(grub_halt): Likewise.
* include/grub/powerpc/ieee1275/init.h: Remove inaccurate comment.
(cmain): Remove __attribute__((unused)).
* kern/powerpc/ieee1275/init.c (grub_heap_start): New variable.
(grub_heap_len): Likewise.
(grub_machine_fini): New function.
* kern/powerpc/ieee1275/openfw.c (grub_reboot): New function.
(grub_halt): Likewise.
* term/powerpc/ieee1275/ofconsole.c (grub_console_fini): New
function.
* util/powerpc/ieee1275/misc.c: New file.

13 files changed:
ChangeLog
commands/ieee1275/halt.c
commands/ieee1275/reboot.c
conf/powerpc-ieee1275.mk
conf/powerpc-ieee1275.rmk
disk/powerpc/ieee1275/ofdisk.c
include/grub/powerpc/ieee1275/console.h
include/grub/powerpc/ieee1275/ieee1275.h
include/grub/powerpc/ieee1275/init.h
kern/powerpc/ieee1275/init.c
kern/powerpc/ieee1275/openfw.c
term/powerpc/ieee1275/ofconsole.c
util/powerpc/ieee1275/misc.c [new file with mode: 0644]

index 32b610efac576865f547c41968d0794406550d8d..882b020f84a3bd5dbaf39ea5943c187c438753ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2005-03-26  Hollis Blanchard  <hollis@penguinppc.org>
+
+       * commands/ieee1275/halt.c (grub_cmd_halt): Call grub_halt
+       instead of grub_ieee1275_interpret.
+       (grub_halt_init): New function.
+       (grub_halt_fini): Likewise.
+       (GRUB_MOD_INIT): Correct message grammar.
+       * commands/ieee1275/reboot.c (grub_cmd_reboot): Call grub_reboot
+       instead of grub_ieee1275_interpret.
+       (grub_reboot_init): New function.
+       (grub_reboot_fini): Likewise.
+       * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Replace
+       commands/i386/pc/halt.c, commands/i386/pc/reboot.c, and
+       util/i386/pc/misc.c with commands/ieee1275/halt.c,
+       commands/ieee1275/reboot.c, and util/powerpc/ieee1275/misc.c.
+       * disk/powerpc/ieee1275/ofdisk.c (grub_ofdisk_fini): New
+       function.
+       * include/grub/powerpc/ieee1275/console.h (grub_console_fini):
+       Add prototype.
+       * include/grub/powerpc/ieee1275/ieee1275.h (grub_reboot): Add
+       prototype.
+       (grub_halt): Likewise.
+       * include/grub/powerpc/ieee1275/init.h: Remove inaccurate comment.
+       (cmain): Remove __attribute__((unused)).
+       * kern/powerpc/ieee1275/init.c (grub_heap_start): New variable.
+       (grub_heap_len): Likewise.
+       (grub_machine_fini): New function.
+       * kern/powerpc/ieee1275/openfw.c (grub_reboot): New function.
+       (grub_halt): Likewise.
+       * term/powerpc/ieee1275/ofconsole.c (grub_console_fini): New
+       function.
+       * util/powerpc/ieee1275/misc.c: New file.
+
 2005-03-19  Yoshinori K. Okuji  <okuji@enbug.org>
 
        * DISTLIST: New file.
index 58edd09c637179a39ea33e5b63df5e86c85026e8..b27b60344ff4573538199025895f321eb4e2a280 100644 (file)
@@ -28,21 +28,36 @@ grub_cmd_halt (struct grub_arg_list *state __attribute__ ((unused)),
               int argc __attribute__ ((unused)),
               char **args __attribute__ ((unused)))
 {
-  grub_ieee1275_interpret ("shut-down", 0);
+  grub_halt ();
   return 0;
 }
 
 \f
+#ifdef GRUB_UTIL
+void
+grub_halt_init (void)
+{
+  grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
+                        "halt", "halts the computer.  This command does not"
+                        " work on all firmware.", 0);
+}
+
+void
+grub_halt_fini (void)
+{
+  grub_unregister_command ("halt");
+}
+#else /* ! GRUB_UTIL */
 GRUB_MOD_INIT
 {
   (void)mod;                   /* To stop warning. */
   grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
                         "halt", "halts the computer.  This command does not"
-                        " work on every firmware.", 0);
+                        " work on all firmware.", 0);
 }
 
 GRUB_MOD_FINI
 {
   grub_unregister_command ("halt");
 }
-
+#endif
index 52c8436ef8ddf0303b5b9eb60ecfccc374cde843..1b897aa1cf79615ae364b236ec703e29baee29cd 100644 (file)
@@ -28,11 +28,25 @@ grub_cmd_reboot (struct grub_arg_list *state __attribute__ ((unused)),
                 int argc __attribute__ ((unused)),
                 char **args __attribute__ ((unused)))
 {
-  grub_ieee1275_interpret ("reset-all", 0);
+  grub_reboot ();
   return 0;
 }
 
 \f
+#ifdef GRUB_UTIL
+void
+grub_reboot_init (void)
+{
+  grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
+                        "reboot", "Reboot the computer", 0);
+}
+
+void
+grub_reboot_fini (void)
+{
+  grub_unregister_command ("reboot");
+}
+#else /* ! GRUB_UTIL */
 GRUB_MOD_INIT
 {
   (void)mod;                   /* To stop warning. */
@@ -44,3 +58,4 @@ GRUB_MOD_FINI
 {
   grub_unregister_command ("reboot");
 }
+#endif
index 8ed4a4206942fed5e67fc85abbedce7c78bdb617..34fccec729b76c32ea80eda58c26caa92b2213f3 100644 (file)
@@ -65,7 +65,7 @@ grub_mkimage-util_resolve.d: util/resolve.c
 grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c       \
        commands/configfile.c commands/default.c commands/help.c        \
        commands/terminal.c commands/ls.c commands/timeout.c            \
-       commands/i386/pc/halt.c commands/i386/pc/reboot.c               \
+       commands/ieee1275/halt.c commands/ieee1275/reboot.c             \
        disk/loopback.c                                                 \
        fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c   \
        fs/minix.c fs/ufs.c                                             \
@@ -77,11 +77,11 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c    \
        partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c      \
        util/console.c util/grub-emu.c util/misc.c                      \
        util/i386/pc/biosdisk.c util/i386/pc/getroot.c                  \
-       util/i386/pc/misc.c
-CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o
-MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_timeout.d grub_emu-commands_i386_pc_halt.d grub_emu-commands_i386_pc_reboot.d grub_emu-disk_loopback.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_ufs.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_i386_pc_misc.d
+       util/powerpc/ieee1275/misc.c
+CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o
+MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_timeout.d grub_emu-commands_ieee1275_halt.d grub_emu-commands_ieee1275_reboot.d grub_emu-disk_loopback.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_ufs.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_powerpc_ieee1275_misc.d
 
-grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o
+grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o
        $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
 
 grub_emu-commands_boot.o: commands/boot.c
@@ -156,21 +156,21 @@ grub_emu-commands_timeout.d: commands/timeout.c
 
 -include grub_emu-commands_timeout.d
 
-grub_emu-commands_i386_pc_halt.o: commands/i386/pc/halt.c
-       $(BUILD_CC) -Icommands/i386/pc -I$(srcdir)/commands/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-commands_ieee1275_halt.o: commands/ieee1275/halt.c
+       $(BUILD_CC) -Icommands/ieee1275 -I$(srcdir)/commands/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-commands_i386_pc_halt.d: commands/i386/pc/halt.c
-       set -e;           $(BUILD_CC) -Icommands/i386/pc -I$(srcdir)/commands/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,halt\.o[ :]*,grub_emu-commands_i386_pc_halt.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+grub_emu-commands_ieee1275_halt.d: commands/ieee1275/halt.c
+       set -e;           $(BUILD_CC) -Icommands/ieee1275 -I$(srcdir)/commands/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<          | sed 's,halt\.o[ :]*,grub_emu-commands_ieee1275_halt.o $@ : ,g' > $@;          [ -s $@ ] || rm -f $@
 
--include grub_emu-commands_i386_pc_halt.d
+-include grub_emu-commands_ieee1275_halt.d
 
-grub_emu-commands_i386_pc_reboot.o: commands/i386/pc/reboot.c
-       $(BUILD_CC) -Icommands/i386/pc -I$(srcdir)/commands/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-commands_ieee1275_reboot.o: commands/ieee1275/reboot.c
+       $(BUILD_CC) -Icommands/ieee1275 -I$(srcdir)/commands/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-commands_i386_pc_reboot.d: commands/i386/pc/reboot.c
-       set -e;           $(BUILD_CC) -Icommands/i386/pc -I$(srcdir)/commands/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,reboot\.o[ :]*,grub_emu-commands_i386_pc_reboot.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+grub_emu-commands_ieee1275_reboot.d: commands/ieee1275/reboot.c
+       set -e;           $(BUILD_CC) -Icommands/ieee1275 -I$(srcdir)/commands/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<          | sed 's,reboot\.o[ :]*,grub_emu-commands_ieee1275_reboot.o $@ : ,g' > $@;      [ -s $@ ] || rm -f $@
 
--include grub_emu-commands_i386_pc_reboot.d
+-include grub_emu-commands_ieee1275_reboot.d
 
 grub_emu-disk_loopback.o: disk/loopback.c
        $(BUILD_CC) -Idisk -I$(srcdir)/disk $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
@@ -476,13 +476,13 @@ grub_emu-util_i386_pc_getroot.d: util/i386/pc/getroot.c
 
 -include grub_emu-util_i386_pc_getroot.d
 
-grub_emu-util_i386_pc_misc.o: util/i386/pc/misc.c
-       $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+grub_emu-util_powerpc_ieee1275_misc.o: util/powerpc/ieee1275/misc.c
+       $(BUILD_CC) -Iutil/powerpc/ieee1275 -I$(srcdir)/util/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
-grub_emu-util_i386_pc_misc.d: util/i386/pc/misc.c
-       set -e;           $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,misc\.o[ :]*,grub_emu-util_i386_pc_misc.o $@ : ,g' > $@;       [ -s $@ ] || rm -f $@
+grub_emu-util_powerpc_ieee1275_misc.d: util/powerpc/ieee1275/misc.c
+       set -e;           $(BUILD_CC) -Iutil/powerpc/ieee1275 -I$(srcdir)/util/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<          | sed 's,misc\.o[ :]*,grub_emu-util_powerpc_ieee1275_misc.o $@ : ,g' > $@;      [ -s $@ ] || rm -f $@
 
--include grub_emu-util_i386_pc_misc.d
+-include grub_emu-util_powerpc_ieee1275_misc.d
 
 
 grub_emu_LDFLAGS = -lncurses
index 5d68b7f6eda11e1a15e440aea50b62bde9505078..5f507759428f3970aa4314c9c29c84132211dcab 100644 (file)
@@ -35,7 +35,7 @@ grub_mkimage_SOURCES = util/powerpc/ieee1275/grub-mkimage.c util/misc.c \
 grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c       \
        commands/configfile.c commands/default.c commands/help.c        \
        commands/terminal.c commands/ls.c commands/timeout.c            \
-       commands/i386/pc/halt.c commands/i386/pc/reboot.c               \
+       commands/ieee1275/halt.c commands/ieee1275/reboot.c             \
        disk/loopback.c                                                 \
        fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c   \
        fs/minix.c fs/ufs.c                                             \
@@ -47,7 +47,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c      \
        partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c      \
        util/console.c util/grub-emu.c util/misc.c                      \
        util/i386/pc/biosdisk.c util/i386/pc/getroot.c                  \
-       util/i386/pc/misc.c
+       util/powerpc/ieee1275/misc.c
 
 grub_emu_LDFLAGS = -lncurses
 
index 344f03daa25ea329fe238bc89bb75e0168223557..8914b3c6d3d8d0e9b12050fcd35ab7b24a68c29d 100644 (file)
@@ -164,3 +164,9 @@ grub_ofdisk_init (void)
 {
   grub_disk_dev_register (&grub_ofdisk_dev);
 }
+
+void
+grub_ofdisk_fini (void)
+{
+  grub_disk_dev_unregister (&grub_ofdisk_dev);
+}
index e15420cf6596bcabf20cc5ce0ee8a193a306168b..d9256412d65de851714bfefaf7603a3152f7a33c 100644 (file)
@@ -51,6 +51,9 @@ void grub_console_setcursor (int on);
 /* Initialize the console system.  */
 void grub_console_init (void);
 
+/* Finish the console system.  */
+void grub_console_fini (void);
+
 #endif
 
 #endif /* ! GRUB_CONSOLE_MACHINE_HEADER */
index 8928ae6db2aea4862718d1335b5a1511856d76b5..fc9ac31405f662f2e12642b7a9587f1746e72fe7 100644 (file)
@@ -131,6 +131,8 @@ grub_err_t EXPORT_FUNC(grub_children_iterate) (char *devpath,
 int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size);
 
 void EXPORT_FUNC(abort) (void);
+void EXPORT_FUNC (grub_reboot) (void);
+void EXPORT_FUNC (grub_halt) (void);
 
 
 #endif /* ! GRUB_IEEE1275_MACHINE_HEADER */
index eb54898a5fa8a81ced46b213bc788575e74b59f0..4c87a85856fff8a95c79e1182cd28ea5fbd66cd1 100644 (file)
@@ -1,4 +1,3 @@
-/* ieee1275.h - Access the Open Firmware client interface.  */
 /*
  *  GRUB  --  GRand Unified Bootloader
  *  Copyright (C) 2004  Free Software Foundation, Inc.
@@ -21,7 +20,7 @@
 #ifndef GRUB_INIT_MACHINE_HEADER
 #define GRUB_INIT_MACHINE_HEADER       1
 
-void cmain (uint32_t r3, uint32_t r4 __attribute__((unused)), uint32_t r5);
+void cmain (uint32_t r3, uint32_t r4, uint32_t r5);
 void grub_ofdisk_init (void);
 void grub_console_init (void);
 
index 2339113620833417acd032a0302bf6da014ad179..d9b3a1af0d527b0034f0ac55ed3b3707fbcc6797 100644 (file)
 #include <grub/machine/time.h>
 #include <grub/machine/kernel.h>
 
+/* Apple OF 1.0.5 reserves 0x0 to 0x4000 for the exception handlers.  */
+static const grub_addr_t grub_heap_start = 0x4000;
+static grub_addr_t grub_heap_len;
+
 void
 abort (void)
 {
@@ -46,30 +50,38 @@ void
 grub_machine_init (void)
 {
   extern char _start;
-  grub_addr_t heap_start;
-  grub_addr_t heap_len;
 
   grub_console_init ();
 
-  /* Apple OF 1.0.5 reserves 0x4000 bytes for the exception handlers.  */
-  heap_start = 0x4000;
   /* Apple OF 3.1.1 reserves an extra 0x1000 bytes below the load address
      of an ELF file.  */
-  heap_len = (grub_addr_t) &_start - 0x1000 - heap_start;
+  grub_heap_len = (grub_addr_t) &_start - 0x1000 - grub_heap_start;
 
-  if (grub_ieee1275_claim (heap_start, heap_len, 0, 0))
+  if (grub_ieee1275_claim (grub_heap_start, grub_heap_len, 0, 0))
     {
-      grub_printf ("Failed to claim heap at 0x%x, len 0x%x\n", heap_start,
-                  heap_len);
+      grub_printf ("Failed to claim heap at 0x%x, len 0x%x\n", grub_heap_start,
+                  grub_heap_len);
       abort ();
     }
-  grub_mm_init_region ((void *) heap_start, heap_len);
+  grub_mm_init_region ((void *) grub_heap_start, grub_heap_len);
 
   grub_env_set ("prefix", "");
 
   grub_ofdisk_init ();
 }
 
+void
+grub_machine_fini (void)
+{
+  grub_loader_unset ();
+
+  grub_ofdisk_fini ();
+  grub_console_fini ();
+
+  grub_ieee1275_release (grub_heap_start, grub_heap_len);
+  /* XXX Release memory claimed for Old World firmware.  */
+}
+
 void
 grub_stop (void)
 {
index 60607c5e859e471c20583bab0aae66490cd9219f..b1406f3ce019a97776622339703463285561393f 100644 (file)
@@ -199,3 +199,15 @@ grub_claimmap (grub_addr_t addr, grub_size_t size)
 
   return 0;
 }
+
+void
+grub_reboot (void)
+{
+  grub_ieee1275_interpret ("reset-all", 0);
+}
+
+void
+grub_halt (void)
+{
+  grub_ieee1275_interpret ("shut-down", 0);
+}
index 6a76597ef34384a6e5e3fc06a1af2a3e7bd29741..036504ddcbb139aaf2d6f5724532b447e05971e2 100644 (file)
@@ -307,3 +307,9 @@ grub_console_init (void)
   grub_term_register (&grub_ofconsole_term);
   grub_term_set_current (&grub_ofconsole_term);
 }
+
+void
+grub_console_fini (void)
+{
+  grub_term_unregister (&grub_ofconsole_term);
+}
diff --git a/util/powerpc/ieee1275/misc.c b/util/powerpc/ieee1275/misc.c
new file mode 100644 (file)
index 0000000..d03de9a
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <setjmp.h>
+
+#include <grub/util/misc.h>
+
+void
+grub_reboot (void)
+{
+  longjmp (main_env, 1);
+}
+
+void
+grub_halt (void)
+{
+  grub_reboot ();
+}