All of lore.kernel.org
 help / color / mirror / Atom feed
* [ppc patch] add "enter" command
@ 2004-09-14  1:12 Hollis Blanchard
  2004-09-14  9:04 ` Yoshinori K. Okuji
  0 siblings, 1 reply; 12+ messages in thread
From: Hollis Blanchard @ 2004-09-14  1:12 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

This command allows one to drop from the Grub prompt to the Open 
Firmware prompt, then resume Grub again. This is very very useful to 
inspect the state of the device tree, or run the "reset-all" command 
(reboot).

Resuming Grub may not work until future memory-related patches are 
committed; on Old World I was unable to resume until it mysteriously 
started working as I worked on other code. But even so, I believe this 
it is still useful to allow the user to reboot the system.

2004-09-13	Hollis Blanchard	<hollis@penguinppc.org>

	* boot/powerpc/ieee1275/ieee1275.c (grub_ieee1275_enter): New function.
	* include/grub/powerpc/ieee1275/ieee1275.h (grub_ieee1275_enter): New 
prototype.
	* kern/powerpc/ieee1275/init.c (enter_command): New function.
	(grub_machine_init): call grub_register_command for the new command.

-Hollis

[-- Attachment #2: 03-ppc-enter.diff --]
[-- Type: application/octet-stream, Size: 2519 bytes --]

Index: boot/powerpc/ieee1275/ieee1275.c
===================================================================
RCS file: /cvsroot/grub/grub2/boot/powerpc/ieee1275/ieee1275.c,v
retrieving revision 1.3
diff -u -r1.3 ieee1275.c
--- boot/powerpc/ieee1275/ieee1275.c	27 Jul 2004 17:47:37 -0000	1.3
+++ boot/powerpc/ieee1275/ieee1275.c	14 Sep 2004 00:33:16 -0000
@@ -348,6 +349,20 @@
 }
 
 int
+grub_ieee1275_enter (void)
+{
+  struct enter_args {
+    struct grub_ieee1275_common_hdr common;
+  } args;
+
+  INIT_IEEE1275_COMMON (&args.common, "enter", 0, 0);
+
+  if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
+    return -1;
+  return 0;
+}
+
+int
 grub_ieee1275_exit (void)
 {
   struct exit_args {
Index: include/grub/powerpc/ieee1275/ieee1275.h
===================================================================
RCS file: /cvsroot/grub/grub2/include/grub/powerpc/ieee1275/ieee1275.h,v
retrieving revision 1.3
diff -u -r1.3 ieee1275.h
--- include/grub/powerpc/ieee1275/ieee1275.h	27 Jul 2004 17:47:37 -0000	1.3
+++ include/grub/powerpc/ieee1275/ieee1275.h	14 Sep 2004 00:33:16 -0000
@@ -78,6 +79,7 @@
 				      grub_ieee1275_phandle_t *result);
 int EXPORT_FUNC(grub_ieee1275_parent) (grub_ieee1275_phandle_t node,
 				       grub_ieee1275_phandle_t *result);
+int EXPORT_FUNC(grub_ieee1275_enter) (void);
 int EXPORT_FUNC(grub_ieee1275_exit) (void);
 int EXPORT_FUNC(grub_ieee1275_open) (char *node,
 				     grub_ieee1275_ihandle_t *result);
Index: kern/powerpc/ieee1275/init.c
===================================================================
RCS file: /cvsroot/grub/grub2/kern/powerpc/ieee1275/init.c,v
retrieving revision 1.4
diff -u -r1.4 init.c
--- kern/powerpc/ieee1275/init.c	27 Jul 2004 17:47:37 -0000	1.4
+++ kern/powerpc/ieee1275/init.c	14 Sep 2004 00:33:16 -0000
@@ -28,6 +28,7 @@
 #include <grub/fs.h>
 #include <grub/setjmp.h>
 #include <grub/env.h>
+#include <grub/misc.h>
 
 void grub_ofdisk_init (void);
 void grub_console_init (void);
@@ -43,6 +44,16 @@
   for (;;);
 }
 
+grub_err_t
+enter_command (struct grub_arg_list *state __attribute__ ((unused)),
+	       int argc __attribute__ ((unused)),
+	       char **args __attribute__ ((unused)))
+{
+  grub_printf("Run 'go' to resume GRUB.\n");
+  grub_ieee1275_enter();
+  return 0;
+}
+
 void
 grub_machine_init (void)
 {
@@ -64,6 +75,9 @@
   grub_linux_normal_init ();
   grub_ofdisk_init ();
   grub_console_init ();
+
+  grub_register_command ("enter", enter_command, GRUB_COMMAND_FLAG_BOTH,
+			 "enter", "Drop into Open Firmware.", 0);
 }
 
 int

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-09-16  2:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-14  1:12 [ppc patch] add "enter" command Hollis Blanchard
2004-09-14  9:04 ` Yoshinori K. Okuji
2004-09-14 11:50   ` M. Gerards
2004-09-14 12:54     ` Yoshinori K. Okuji
2004-09-14 15:06       ` Hollis Blanchard
2004-09-14 15:22         ` Marco Gerards
2004-09-14 17:15           ` Hollis Blanchard
2004-09-15  9:38             ` Yoshinori K. Okuji
2004-09-15 14:21               ` Hollis Blanchard
2004-09-15 14:37                 ` Stefan Reinauer
2004-09-15 14:44                   ` Marco Gerards
2004-09-15 14:48                   ` Hollis Blanchard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.