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

* Re: [ppc patch] add "enter" command
  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
  0 siblings, 1 reply; 12+ messages in thread
From: Yoshinori K. Okuji @ 2004-09-14  9:04 UTC (permalink / raw)
  To: The development of GRUB 2

On Tuesday 14 September 2004 03:12, Hollis Blanchard wrote:
> 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).

I feel that "enter" is too generic. Is there any better name? 
"openfirmware"?

Okuji



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

* Re: [ppc patch] add "enter" command
  2004-09-14  9:04 ` Yoshinori K. Okuji
@ 2004-09-14 11:50   ` M. Gerards
  2004-09-14 12:54     ` Yoshinori K. Okuji
  0 siblings, 1 reply; 12+ messages in thread
From: M. Gerards @ 2004-09-14 11:50 UTC (permalink / raw)
  To: The development of GRUB 2, Yoshinori K. Okuji

Quoting "Yoshinori K. Okuji" <okuji@enbug.org>:

> On Tuesday 14 September 2004 03:12, Hollis Blanchard wrote:
> > 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).
> 
> I feel that "enter" is too generic. Is there any better name? 
> "openfirmware"?

Actually, we can make it something generic.  I can imagine it is
possible to go back to the firmware with other kinds of firmware
as well.  How about something unix like, "suspend" for example.
Other than that we could implement generic commands like "exit", "reboot",
"halt", "powerdown", for example.

--
Marco



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

* Re: [ppc patch] add "enter" command
  2004-09-14 11:50   ` M. Gerards
@ 2004-09-14 12:54     ` Yoshinori K. Okuji
  2004-09-14 15:06       ` Hollis Blanchard
  0 siblings, 1 reply; 12+ messages in thread
From: Yoshinori K. Okuji @ 2004-09-14 12:54 UTC (permalink / raw)
  To: The development of GRUB 2

On Tuesday 14 September 2004 13:50, M. Gerards wrote:
> Actually, we can make it something generic.  I can imagine it is
> possible to go back to the firmware with other kinds of firmware
> as well.  How about something unix like, "suspend" for example.
> Other than that we could implement generic commands like "exit",
> "reboot", "halt", "powerdown", for example.

"suspend" looks good. It is impossible on PC, though.

"reboot" and "halt" are nice. They are implemented for GRUB Legacy and I 
want them in GRUB 2 as well.

Okuji



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

* Re: [ppc patch] add "enter" command
  2004-09-14 12:54     ` Yoshinori K. Okuji
@ 2004-09-14 15:06       ` Hollis Blanchard
  2004-09-14 15:22         ` Marco Gerards
  0 siblings, 1 reply; 12+ messages in thread
From: Hollis Blanchard @ 2004-09-14 15:06 UTC (permalink / raw)
  To: The development of GRUB 2

On Sep 14, 2004, at 7:54 AM, Yoshinori K. Okuji wrote:

> On Tuesday 14 September 2004 13:50, M. Gerards wrote:
>> Actually, we can make it something generic.  I can imagine it is
>> possible to go back to the firmware with other kinds of firmware
>> as well.  How about something unix like, "suspend" for example.
>> Other than that we could implement generic commands like "exit",
>> "reboot", "halt", "powerdown", for example.
>
> "suspend" looks good. It is impossible on PC, though.
>
> "reboot" and "halt" are nice. They are implemented for GRUB Legacy and 
> I
> want them in GRUB 2 as well.

"reboot" and "halt" will also be implemented as commands that call Open 
Firmware, but since the user wouldn't see that I think it would be ok 
to name the "enter" command "openfirmware".

On the other hand is such a thing possible under e.g. EFI firmware? 
Perhaps we should name it a more generic "firmware", just as "reboot" 
can be expected to work across architectures (if we were naming things 
OF-style we would call that "reset-all").

-Hollis




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

* Re: [ppc patch] add "enter" command
  2004-09-14 15:06       ` Hollis Blanchard
@ 2004-09-14 15:22         ` Marco Gerards
  2004-09-14 17:15           ` Hollis Blanchard
  0 siblings, 1 reply; 12+ messages in thread
From: Marco Gerards @ 2004-09-14 15:22 UTC (permalink / raw)
  To: The development of GRUB 2

Hollis Blanchard <hollis@penguinppc.org> writes:

> "reboot" and "halt" will also be implemented as commands that call
> Open Firmware, but since the user wouldn't see that I think it would
> be ok to name the "enter" command "openfirmware".
>
> On the other hand is such a thing possible under e.g. EFI firmware?
> Perhaps we should name it a more generic "firmware", just as "reboot"
> can be expected to work across architectures (if we were naming things
> OF-style we would call that "reset-all").

How about just suspend like I said?  That does not imply we are really
using firmware?  It could be possible GRUB is just a program on some
systems.  What I want to say is that we do not know the environments
that would be used and make it really generic.

Thanks,
Marco




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

* Re: [ppc patch] add "enter" command
  2004-09-14 15:22         ` Marco Gerards
@ 2004-09-14 17:15           ` Hollis Blanchard
  2004-09-15  9:38             ` Yoshinori K. Okuji
  0 siblings, 1 reply; 12+ messages in thread
From: Hollis Blanchard @ 2004-09-14 17:15 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, 2004-09-14 at 15:22, Marco Gerards wrote:
> Hollis Blanchard <hollis@penguinppc.org> writes:
> 
> > "reboot" and "halt" will also be implemented as commands that call
> > Open Firmware, but since the user wouldn't see that I think it would
> > be ok to name the "enter" command "openfirmware".
> >
> > On the other hand is such a thing possible under e.g. EFI firmware?
> > Perhaps we should name it a more generic "firmware", just as "reboot"
> > can be expected to work across architectures (if we were naming things
> > OF-style we would call that "reset-all").
> 
> How about just suspend like I said?  That does not imply we are really
> using firmware?  It could be possible GRUB is just a program on some
> systems.  What I want to say is that we do not know the environments
> that would be used and make it really generic.

Ah, when I saw "suspend" I thought you meant sleep. That might confuse
other users too...

Marco elaborated that he was thinking about running GRUB on a system
where it could replace the running OS, like aboot on Amiga or (Linux)
BootX on Mac OS. In that case I don't know what "suspend" would do:
something like spawn a subshell? Why not just "quit"?

But I really don't care what it's called, I would just like the
functionality. :)

-Hollis




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

* Re: [ppc patch] add "enter" command
  2004-09-14 17:15           ` Hollis Blanchard
@ 2004-09-15  9:38             ` Yoshinori K. Okuji
  2004-09-15 14:21               ` Hollis Blanchard
  0 siblings, 1 reply; 12+ messages in thread
From: Yoshinori K. Okuji @ 2004-09-15  9:38 UTC (permalink / raw)
  To: The development of GRUB 2

On Tuesday 14 September 2004 19:15, Hollis Blanchard wrote:
> Ah, when I saw "suspend" I thought you meant sleep. That might
> confuse other users too...

But "suspend" is compatible with Bash. "exit" is also acceptable, but it 
sounds like you may not go back to GRUB. Please choose "suspend" or 
"exit". I like Bash-like naming.

Okuji



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

* Re: [ppc patch] add "enter" command
  2004-09-15  9:38             ` Yoshinori K. Okuji
@ 2004-09-15 14:21               ` Hollis Blanchard
  2004-09-15 14:37                 ` Stefan Reinauer
  0 siblings, 1 reply; 12+ messages in thread
From: Hollis Blanchard @ 2004-09-15 14:21 UTC (permalink / raw)
  To: The development of GRUB 2

On Sep 15, 2004, at 4:38 AM, Yoshinori K. Okuji wrote:

> On Tuesday 14 September 2004 19:15, Hollis Blanchard wrote:
>> Ah, when I saw "suspend" I thought you meant sleep. That might
>> confuse other users too...
>
> But "suspend" is compatible with Bash. "exit" is also acceptable, but 
> it
> sounds like you may not go back to GRUB. Please choose "suspend" or
> "exit". I like Bash-like naming.

Sure. However Marco pointed out that this should live in commands/ , 
and also should be a module... so I will resubmit later. I guess there 
should be a commands/powerpc/ieee1275 directory though, to allow 
multiple commands to implement "suspend" for different archs without 
conflicting?

For that matter why isn't "linux" in the commands directory?

-Hollis




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

* Re: [ppc patch] add "enter" command
  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
  0 siblings, 2 replies; 12+ messages in thread
From: Stefan Reinauer @ 2004-09-15 14:37 UTC (permalink / raw)
  To: The development of GRUB 2

* Hollis Blanchard <hollis@penguinppc.org> [040915 16:21]:
> Sure. However Marco pointed out that this should live in commands/ , 
> and also should be a module... so I will resubmit later. I guess there 
> should be a commands/powerpc/ieee1275 directory though, to allow 
> multiple commands to implement "suspend" for different archs without 
> conflicting?

what about a generic commands/ieee1275 directory? These commands should
be the same on all openfirmware based platforms, ie sparc, arm, ...

Stefan




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

* Re: [ppc patch] add "enter" command
  2004-09-15 14:37                 ` Stefan Reinauer
@ 2004-09-15 14:44                   ` Marco Gerards
  2004-09-15 14:48                   ` Hollis Blanchard
  1 sibling, 0 replies; 12+ messages in thread
From: Marco Gerards @ 2004-09-15 14:44 UTC (permalink / raw)
  To: The development of GRUB 2

Stefan Reinauer <stepan@openbios.org> writes:

> * Hollis Blanchard <hollis@penguinppc.org> [040915 16:21]:
>> Sure. However Marco pointed out that this should live in commands/ , 
>> and also should be a module... so I will resubmit later. I guess there 
>> should be a commands/powerpc/ieee1275 directory though, to allow 
>> multiple commands to implement "suspend" for different archs without 
>> conflicting?
>
> what about a generic commands/ieee1275 directory? These commands should
> be the same on all openfirmware based platforms, ie sparc, arm, ...

That sounds sane.  Perhaps things that currently are in
foo/powerpc/ieee1275 can be moved to foo/ieee1275.  When GRUB is
ported to the sparc this is one of the main things to take care of.

Thanks,
Marco





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

* Re: [ppc patch] add "enter" command
  2004-09-15 14:37                 ` Stefan Reinauer
  2004-09-15 14:44                   ` Marco Gerards
@ 2004-09-15 14:48                   ` Hollis Blanchard
  1 sibling, 0 replies; 12+ messages in thread
From: Hollis Blanchard @ 2004-09-15 14:48 UTC (permalink / raw)
  To: The development of GRUB 2

On Sep 15, 2004, at 9:37 AM, Stefan Reinauer wrote:

> * Hollis Blanchard <hollis@penguinppc.org> [040915 16:21]:
>> Sure. However Marco pointed out that this should live in commands/ ,
>> and also should be a module... so I will resubmit later. I guess there
>> should be a commands/powerpc/ieee1275 directory though, to allow
>> multiple commands to implement "suspend" for different archs without
>> conflicting?
>
> what about a generic commands/ieee1275 directory? These commands should
> be the same on all openfirmware based platforms, ie sparc, arm, ...

Yup, agreed. Should it turn out later that any ieee1275 arch needs 
special treatment, a commands/<arch>/ieee1275 dir can be created, and 
let the Makefiles sort out which one to use...

-Hollis




^ 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.