* [ppc] [patch] more cleanups
@ 2005-05-10 1:39 Hollis Blanchard
2005-05-10 18:01 ` Marco Gerards
0 siblings, 1 reply; 4+ messages in thread
From: Hollis Blanchard @ 2005-05-10 1:39 UTC (permalink / raw)
To: grub-devel
I've found a few more things that needed cleaning, so here is the
updated patch. I have tested it.
- instead of needing to find "/chosen" in a variety of places, we find
it once and save it in a global.
- some of the functions in boot/powerpc/ieee1275/ieee1275.c had slightly
inconsistent prototypes.
- we were initializing initrd_addr to 0xc0000000 even when we didn't
have one loaded.
I will resist the urge to keep growing this patch. ;)
-Hollis
2005-05-08 Hollis Blanchard <hollis@penguinppc.org>
* boot/powerpc/ieee1275/cmain.c (module_info): Remove definition.
(grub_ieee1275_chosen): New variable.
(cmain): Initialize and use `grub_ieee1275_chosen' instead of
`chosen'.
* boot/powerpc/ieee1275/crt0.S (init_stack): Remove stack space.
* boot/powerpc/ieee1275/ieee1275.c (grub_ieee1275_get_property):
Rename first argument to `phandle' for consistency.
(grub_ieee1275_get_property_length): Likewise.
(grub_ieee1275_next_property): Likewise. Change type of first argument
to grub_ieee1275_phandle_t.
* include/grub/powerpc/ieee1275/ieee1275.h (grub_ieee1275_entry_fn):
Move export next to declaration.
(grub_ieee1275_chosen): New variable.
* include/grub/powerpc/ieee1275/kernel.h (GRUB_IEEE1275_MODULE_BASE):
Correct cosmetic typo.
* kern/powerpc/ieee1275/init.c (grub_set_prefix): Use
`grub_ieee1275_chosen'.
* kern/powerpc/ieee1275/openfw.c (grub_map): Likewise.
* loader/powerpc/ieee1275/linux.c (grub_linux_boot): Likewise.
(grub_rescue_cmd_linux): Set `initrd_addr' to 0.
* term/powerpc/ieee1275/ofconsole.c (grub_ofconsole_refresh): Use
`grub_ieee1275_chosen'.
Index: boot/powerpc/ieee1275/cmain.c
===================================================================
RCS file: /cvsroot/grub/grub2/boot/powerpc/ieee1275/cmain.c,v
retrieving revision 1.7
diff -u -p -r1.7 cmain.c
--- boot/powerpc/ieee1275/cmain.c 1 May 2005 03:45:35 -0000 1.7
+++ boot/powerpc/ieee1275/cmain.c 10 May 2005 01:27:33 -0000
@@ -24,15 +24,11 @@
#include <grub/machine/ieee1275.h>
#include <grub/kernel.h>
-struct module_info
-{
- uint32_t start;
- uint32_t end;
-};
-
/* OpenFirmware entry point passed to us from the real bootloader. */
intptr_t (*grub_ieee1275_entry_fn) (void *);
+grub_ieee1275_phandle_t grub_ieee1275_chosen;
+
static grub_uint32_t grub_ieee1275_flags;
\f
@@ -77,7 +73,6 @@ void
cmain (uint32_t r3, uint32_t r4 __attribute__((unused)), uint32_t r5)
{
char **argv, args[256];
- grub_ieee1275_phandle_t chosen;
int argc = 0, actual;
if (r5 == 0xdeadbeef)
@@ -111,8 +106,8 @@ cmain (uint32_t r3, uint32_t r4 __attrib
be null (just the nul-character), so check that the size
is actually greater than one. */
- grub_ieee1275_finddevice ("/chosen", &chosen);
- if (grub_ieee1275_get_property (chosen, "bootargs", args,
+ grub_ieee1275_finddevice ("/chosen", &grub_ieee1275_chosen);
+ if (grub_ieee1275_get_property (grub_ieee1275_chosen, "bootargs", args,
sizeof args, &actual) == 0
&& actual > 1)
{
Index: boot/powerpc/ieee1275/crt0.S
===================================================================
RCS file: /cvsroot/grub/grub2/boot/powerpc/ieee1275/crt0.S,v
retrieving revision 1.5
diff -u -p -r1.5 crt0.S
--- boot/powerpc/ieee1275/crt0.S 4 Jan 2005 14:01:45 -0000 1.5
+++ boot/powerpc/ieee1275/crt0.S 10 May 2005 01:27:33 -0000
@@ -41,8 +41,3 @@ _start:
bl cmain
1: b 1b
-
- .section ".bss"
- .lcomm _ppc_init_stack, 4096*2, 16
-init_stack:
-
Index: boot/powerpc/ieee1275/ieee1275.c
===================================================================
RCS file: /cvsroot/grub/grub2/boot/powerpc/ieee1275/ieee1275.c,v
retrieving revision 1.11
diff -u -p -r1.11 ieee1275.c
--- boot/powerpc/ieee1275/ieee1275.c 31 Jan 2005 21:28:34 -0000 1.11
+++ boot/powerpc/ieee1275/ieee1275.c 10 May 2005 01:27:33 -0000
@@ -56,7 +56,7 @@ grub_ieee1275_finddevice (char *name, gr
}
int
-grub_ieee1275_get_property (grub_ieee1275_phandle_t handle,
+grub_ieee1275_get_property (grub_ieee1275_phandle_t phandle,
const char *property, void *buf,
grub_size_t size, grub_size_t *actual)
{
@@ -70,7 +70,7 @@ grub_ieee1275_get_property (grub_ieee127
} args;
INIT_IEEE1275_COMMON (&args.common, "getprop", 4, 1);
- args.phandle = handle;
+ args.phandle = phandle;
args.prop = property;
args.buf = buf;
args.buflen = size;
@@ -85,8 +85,8 @@ grub_ieee1275_get_property (grub_ieee127
}
int
-grub_ieee1275_next_property (int handle, char *prev_prop, char *prop,
- int *flags)
+grub_ieee1275_next_property (grub_ieee1275_phandle_t phandle, char *prev_prop,
+ char *prop, int *flags)
{
struct get_property_args {
struct grub_ieee1275_common_hdr common;
@@ -97,7 +97,7 @@ grub_ieee1275_next_property (int handle,
} args;
INIT_IEEE1275_COMMON (&args.common, "nextprop", 3, 1);
- args.phandle = handle;
+ args.phandle = phandle;
args.prev_prop = prev_prop;
args.next_prop = prop;
args.flags = -1;
@@ -110,7 +110,7 @@ grub_ieee1275_next_property (int handle,
}
int
-grub_ieee1275_get_property_length (grub_ieee1275_phandle_t handle,
+grub_ieee1275_get_property_length (grub_ieee1275_phandle_t phandle,
const char *prop, grub_size_t *length)
{
struct get_property_args {
@@ -121,7 +121,7 @@ grub_ieee1275_get_property_length (grub_
} args;
INIT_IEEE1275_COMMON (&args.common, "getproplen", 2, 1);
- args.phandle = handle;
+ args.phandle = phandle;
args.prop = prop;
args.length = -1;
Index: include/grub/powerpc/ieee1275/ieee1275.h
===================================================================
RCS file: /cvsroot/grub/grub2/include/grub/powerpc/ieee1275/ieee1275.h,v
retrieving revision 1.17
diff -u -p -r1.17 ieee1275.h
--- include/grub/powerpc/ieee1275/ieee1275.h 1 May 2005 03:45:35 -0000 1.17
+++ include/grub/powerpc/ieee1275/ieee1275.h 10 May 2005 01:27:36 -0000
@@ -39,8 +39,6 @@ struct grub_ieee1275_mem_region
unsigned int size;
};
-extern intptr_t(* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *);
-
#ifndef IEEE1275_CALL_ENTRY_FN
#define IEEE1275_CALL_ENTRY_FN(args) (*grub_ieee1275_entry_fn) (args)
#endif
@@ -64,7 +62,10 @@ struct grub_ieee1275_common_hdr
typedef intptr_t grub_ieee1275_ihandle_t;
typedef intptr_t grub_ieee1275_phandle_t;
+extern grub_ieee1275_phandle_t grub_ieee1275_chosen;
+extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen);
extern intptr_t (*grub_ieee1275_entry_fn) (void *);
+extern intptr_t (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *);
enum grub_ieee1275_flag
{
Index: include/grub/powerpc/ieee1275/kernel.h
===================================================================
RCS file: /cvsroot/grub/grub2/include/grub/powerpc/ieee1275/kernel.h,v
retrieving revision 1.1
diff -u -p -r1.1 kernel.h
--- include/grub/powerpc/ieee1275/kernel.h 4 Jan 2005 14:01:45 -0000 1.1
+++ include/grub/powerpc/ieee1275/kernel.h 10 May 2005 01:27:36 -0000
@@ -21,6 +21,6 @@
#define GRUB_KERNEL_MACHINE_HEADER 1
/* Where grub-mkimage places the core modules in memory. */
-#define GRUB_IEEE1275_MODULE_BASE 0x0300000
+#define GRUB_IEEE1275_MODULE_BASE 0x00300000
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
Index: kern/powerpc/ieee1275/init.c
===================================================================
RCS file: /cvsroot/grub/grub2/kern/powerpc/ieee1275/init.c,v
retrieving revision 1.17
diff -u -p -r1.17 init.c
--- kern/powerpc/ieee1275/init.c 1 May 2005 03:45:36 -0000 1.17
+++ kern/powerpc/ieee1275/init.c 10 May 2005 01:27:36 -0000
@@ -68,10 +68,8 @@ grub_set_prefix (void)
char bootpath[64]; /* XXX check length */
char *filename;
char *prefix;
- grub_ieee1275_phandle_t chosen;
- grub_ieee1275_finddevice ("/chosen", &chosen);
- if (grub_ieee1275_get_property (chosen, "bootpath", &bootpath,
+ if (grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", &bootpath,
sizeof (bootpath), 0))
{
/* Should never happen. */
Index: kern/powerpc/ieee1275/openfw.c
===================================================================
RCS file: /cvsroot/grub/grub2/kern/powerpc/ieee1275/openfw.c,v
retrieving revision 1.10
diff -u -p -r1.10 openfw.c
--- kern/powerpc/ieee1275/openfw.c 1 May 2005 03:45:36 -0000 1.10
+++ kern/powerpc/ieee1275/openfw.c 10 May 2005 01:27:36 -0000
@@ -165,14 +165,10 @@ grub_map (grub_addr_t phys, grub_addr_t
int catch_result;
} args;
grub_ieee1275_ihandle_t mmu;
- grub_ieee1275_ihandle_t chosen;
int len;
- grub_ieee1275_finddevice ("/chosen", &chosen);
- if (chosen == 0)
- return -1;
-
- grub_ieee1275_get_property (chosen, "mmu", &mmu, sizeof mmu, &len);
+ grub_ieee1275_get_property (grub_ieee1275_chosen, "mmu", &mmu, sizeof mmu,
+ &len);
if (len != sizeof mmu)
return -1;
Index: loader/powerpc/ieee1275/linux.c
===================================================================
RCS file: /cvsroot/grub/grub2/loader/powerpc/ieee1275/linux.c,v
retrieving revision 1.6
diff -u -p -r1.6 linux.c
--- loader/powerpc/ieee1275/linux.c 14 Feb 2005 18:41:33 -0000 1.6
+++ loader/powerpc/ieee1275/linux.c 10 May 2005 01:27:36 -0000
@@ -47,13 +47,10 @@ static grub_err_t
grub_linux_boot (void)
{
kernel_entry_t linuxmain;
- grub_ieee1275_phandle_t chosen;
grub_size_t actual;
- grub_ieee1275_finddevice ("/chosen", &chosen);
-
/* Set the command line arguments. */
- grub_ieee1275_set_property (chosen, "bootargs", linux_args,
+ grub_ieee1275_set_property (grub_ieee1275_chosen, "bootargs", linux_args,
grub_strlen (linux_args) + 1, &actual);
/* Boot the kernel. */
@@ -236,7 +233,7 @@ grub_rescue_cmd_linux (int argc, char *a
else
{
grub_loader_set (grub_linux_boot, grub_linux_unload);
- initrd_addr = 0xc0000000;
+ initrd_addr = 0;
loaded = 1;
}
Index: term/powerpc/ieee1275/ofconsole.c
===================================================================
RCS file: /cvsroot/grub/grub2/term/powerpc/ieee1275/ofconsole.c,v
retrieving revision 1.6
diff -u -p -r1.6 ofconsole.c
--- term/powerpc/ieee1275/ofconsole.c 26 Mar 2005 17:34:50 -0000 1.6
+++ term/powerpc/ieee1275/ofconsole.c 10 May 2005 01:27:36 -0000
@@ -241,23 +241,19 @@ grub_ofconsole_refresh (void)
static grub_err_t
grub_ofconsole_init (void)
{
- grub_ieee1275_phandle_t chosen;
char data[4];
grub_size_t actual;
int col;
- if (grub_ieee1275_finddevice ("/chosen", &chosen))
- return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find /chosen");
-
- if (grub_ieee1275_get_property (chosen, "stdout", data, sizeof data,
- &actual)
+ if (grub_ieee1275_get_property (grub_ieee1275_chosen, "stdout", data,
+ sizeof data, &actual)
|| actual != sizeof data)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdout");
stdout_ihandle = grub_ieee1275_decode_int_4 (data);
- if (grub_ieee1275_get_property (chosen, "stdin", data, sizeof data,
- &actual)
+ if (grub_ieee1275_get_property (grub_ieee1275_chosen, "stdin", data,
+ sizeof data, &actual)
|| actual != sizeof data)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [ppc] [patch] more cleanups
2005-05-10 1:39 [ppc] [patch] more cleanups Hollis Blanchard
@ 2005-05-10 18:01 ` Marco Gerards
2005-05-10 22:34 ` Hollis Blanchard
0 siblings, 1 reply; 4+ messages in thread
From: Marco Gerards @ 2005-05-10 18:01 UTC (permalink / raw)
To: The development of GRUB 2
Hollis Blanchard <hollis@penguinppc.org> writes:
> I've found a few more things that needed cleaning, so here is the
> updated patch. I have tested it.
It looks fine to me. I have a few questions:
> (grub_ieee1275_next_property): Likewise. Change type of first argument
> to grub_ieee1275_phandle_t.
Please use double spaces.
> --- include/grub/powerpc/ieee1275/kernel.h 4 Jan 2005 14:01:45 -0000 1.1
> +++ include/grub/powerpc/ieee1275/kernel.h 10 May 2005 01:27:36 -0000
> @@ -21,6 +21,6 @@
> #define GRUB_KERNEL_MACHINE_HEADER 1
>
> /* Where grub-mkimage places the core modules in memory. */
> -#define GRUB_IEEE1275_MODULE_BASE 0x0300000
> +#define GRUB_IEEE1275_MODULE_BASE 0x00300000
Huh? Can you explain this? I would even prefer:
#define GRUB_IEEE1275_MODULE_BASE 0x300000
> Index: loader/powerpc/ieee1275/linux.c
[...]
> - initrd_addr = 0xc0000000;
> + initrd_addr = 0;
Does loading linux with an initrd still work?
Thanks,
Marco
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ppc] [patch] more cleanups
2005-05-10 18:01 ` Marco Gerards
@ 2005-05-10 22:34 ` Hollis Blanchard
2005-05-11 6:37 ` Marco Gerards
0 siblings, 1 reply; 4+ messages in thread
From: Hollis Blanchard @ 2005-05-10 22:34 UTC (permalink / raw)
To: The development of GRUB 2
On May 10, 2005, at 1:01 PM, Marco Gerards wrote:
> Hollis Blanchard <hollis@penguinppc.org> writes:
>> --- include/grub/powerpc/ieee1275/kernel.h 4 Jan 2005 14:01:45
>> -0000 1.1
>> +++ include/grub/powerpc/ieee1275/kernel.h 10 May 2005 01:27:36 -0000
>> @@ -21,6 +21,6 @@
>> #define GRUB_KERNEL_MACHINE_HEADER 1
>>
>> /* Where grub-mkimage places the core modules in memory. */
>> -#define GRUB_IEEE1275_MODULE_BASE 0x0300000
>> +#define GRUB_IEEE1275_MODULE_BASE 0x00300000
>
> Huh? Can you explain this? I would even prefer:
>
> #define GRUB_IEEE1275_MODULE_BASE 0x300000
What is to explain? The address has 7 chars in it when it should have
8. The leading zeroes make it easier to read.
>> Index: loader/powerpc/ieee1275/linux.c
>
> [...]
>
>> - initrd_addr = 0xc0000000;
>> + initrd_addr = 0;
>
> Does loading linux with an initrd still work?
I said it did...
-Hollis
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ppc] [patch] more cleanups
2005-05-10 22:34 ` Hollis Blanchard
@ 2005-05-11 6:37 ` Marco Gerards
0 siblings, 0 replies; 4+ messages in thread
From: Marco Gerards @ 2005-05-11 6:37 UTC (permalink / raw)
To: The development of GRUB 2
Hollis Blanchard <hollis@penguinppc.org> writes:
>>> /* Where grub-mkimage places the core modules in memory. */
>>> -#define GRUB_IEEE1275_MODULE_BASE 0x0300000
>>> +#define GRUB_IEEE1275_MODULE_BASE 0x00300000
>>
>> Huh? Can you explain this? I would even prefer:
>>
>> #define GRUB_IEEE1275_MODULE_BASE 0x300000
>
> What is to explain? The address has 7 chars in it when it should have
> 8. The leading zeroes make it easier to read.
Ok, that makes sense.
>> Does loading linux with an initrd still work?
>
> I said it did...
I must have missed that, sorry.
Feel free to commit your patch.
Thanks,
Marco
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-05-11 6:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-10 1:39 [ppc] [patch] more cleanups Hollis Blanchard
2005-05-10 18:01 ` Marco Gerards
2005-05-10 22:34 ` Hollis Blanchard
2005-05-11 6:37 ` Marco Gerards
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.