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'.
This commit is contained in:
parent
ca5baa3fc2
commit
168d6e5810
10 changed files with 47 additions and 43 deletions
25
ChangeLog
25
ChangeLog
|
@ -1,3 +1,28 @@
|
||||||
|
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'.
|
||||||
|
|
||||||
2005-05-10 Hollis Blanchard <hollis@penguinppc.org>
|
2005-05-10 Hollis Blanchard <hollis@penguinppc.org>
|
||||||
|
|
||||||
* boot/powerpc/ieee1275/cmain.c (cmain): Remove code to parse
|
* boot/powerpc/ieee1275/cmain.c (cmain): Remove code to parse
|
||||||
|
|
|
@ -24,15 +24,11 @@
|
||||||
#include <grub/machine/ieee1275.h>
|
#include <grub/machine/ieee1275.h>
|
||||||
#include <grub/kernel.h>
|
#include <grub/kernel.h>
|
||||||
|
|
||||||
struct module_info
|
|
||||||
{
|
|
||||||
uint32_t start;
|
|
||||||
uint32_t end;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* OpenFirmware entry point passed to us from the real bootloader. */
|
/* OpenFirmware entry point passed to us from the real bootloader. */
|
||||||
intptr_t (*grub_ieee1275_entry_fn) (void *);
|
intptr_t (*grub_ieee1275_entry_fn) (void *);
|
||||||
|
|
||||||
|
grub_ieee1275_phandle_t grub_ieee1275_chosen;
|
||||||
|
|
||||||
static grub_uint32_t grub_ieee1275_flags;
|
static grub_uint32_t grub_ieee1275_flags;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,3 @@ _start:
|
||||||
|
|
||||||
bl cmain
|
bl cmain
|
||||||
1: b 1b
|
1: b 1b
|
||||||
|
|
||||||
.section ".bss"
|
|
||||||
.lcomm _ppc_init_stack, 4096*2, 16
|
|
||||||
init_stack:
|
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ grub_ieee1275_finddevice (char *name, grub_ieee1275_phandle_t *phandlep)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_ieee1275_get_property (grub_ieee1275_phandle_t handle,
|
grub_ieee1275_get_property (grub_ieee1275_phandle_t phandle,
|
||||||
const char *property, void *buf,
|
const char *property, void *buf,
|
||||||
grub_size_t size, grub_size_t *actual)
|
grub_size_t size, grub_size_t *actual)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ grub_ieee1275_get_property (grub_ieee1275_phandle_t handle,
|
||||||
} args;
|
} args;
|
||||||
|
|
||||||
INIT_IEEE1275_COMMON (&args.common, "getprop", 4, 1);
|
INIT_IEEE1275_COMMON (&args.common, "getprop", 4, 1);
|
||||||
args.phandle = handle;
|
args.phandle = phandle;
|
||||||
args.prop = property;
|
args.prop = property;
|
||||||
args.buf = buf;
|
args.buf = buf;
|
||||||
args.buflen = size;
|
args.buflen = size;
|
||||||
|
@ -85,8 +85,8 @@ grub_ieee1275_get_property (grub_ieee1275_phandle_t handle,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_ieee1275_next_property (int handle, char *prev_prop, char *prop,
|
grub_ieee1275_next_property (grub_ieee1275_phandle_t phandle, char *prev_prop,
|
||||||
int *flags)
|
char *prop, int *flags)
|
||||||
{
|
{
|
||||||
struct get_property_args {
|
struct get_property_args {
|
||||||
struct grub_ieee1275_common_hdr common;
|
struct grub_ieee1275_common_hdr common;
|
||||||
|
@ -97,7 +97,7 @@ grub_ieee1275_next_property (int handle, char *prev_prop, char *prop,
|
||||||
} args;
|
} args;
|
||||||
|
|
||||||
INIT_IEEE1275_COMMON (&args.common, "nextprop", 3, 1);
|
INIT_IEEE1275_COMMON (&args.common, "nextprop", 3, 1);
|
||||||
args.phandle = handle;
|
args.phandle = phandle;
|
||||||
args.prev_prop = prev_prop;
|
args.prev_prop = prev_prop;
|
||||||
args.next_prop = prop;
|
args.next_prop = prop;
|
||||||
args.flags = -1;
|
args.flags = -1;
|
||||||
|
@ -110,7 +110,7 @@ grub_ieee1275_next_property (int handle, char *prev_prop, char *prop,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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)
|
const char *prop, grub_size_t *length)
|
||||||
{
|
{
|
||||||
struct get_property_args {
|
struct get_property_args {
|
||||||
|
@ -121,7 +121,7 @@ grub_ieee1275_get_property_length (grub_ieee1275_phandle_t handle,
|
||||||
} args;
|
} args;
|
||||||
|
|
||||||
INIT_IEEE1275_COMMON (&args.common, "getproplen", 2, 1);
|
INIT_IEEE1275_COMMON (&args.common, "getproplen", 2, 1);
|
||||||
args.phandle = handle;
|
args.phandle = phandle;
|
||||||
args.prop = prop;
|
args.prop = prop;
|
||||||
args.length = -1;
|
args.length = -1;
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,6 @@ struct grub_ieee1275_mem_region
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern intptr_t(* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *);
|
|
||||||
|
|
||||||
#ifndef IEEE1275_CALL_ENTRY_FN
|
#ifndef IEEE1275_CALL_ENTRY_FN
|
||||||
#define IEEE1275_CALL_ENTRY_FN(args) (*grub_ieee1275_entry_fn) (args)
|
#define IEEE1275_CALL_ENTRY_FN(args) (*grub_ieee1275_entry_fn) (args)
|
||||||
#endif
|
#endif
|
||||||
|
@ -64,7 +62,10 @@ struct grub_ieee1275_common_hdr
|
||||||
typedef intptr_t grub_ieee1275_ihandle_t;
|
typedef intptr_t grub_ieee1275_ihandle_t;
|
||||||
typedef intptr_t grub_ieee1275_phandle_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 (*grub_ieee1275_entry_fn) (void *);
|
||||||
|
extern intptr_t (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *);
|
||||||
|
|
||||||
enum grub_ieee1275_flag
|
enum grub_ieee1275_flag
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,6 @@
|
||||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||||
|
|
||||||
/* Where grub-mkimage places the core modules in memory. */
|
/* 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 */
|
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||||
|
|
|
@ -68,10 +68,8 @@ grub_set_prefix (void)
|
||||||
char bootpath[64]; /* XXX check length */
|
char bootpath[64]; /* XXX check length */
|
||||||
char *filename;
|
char *filename;
|
||||||
char *prefix;
|
char *prefix;
|
||||||
grub_ieee1275_phandle_t chosen;
|
|
||||||
|
|
||||||
grub_ieee1275_finddevice ("/chosen", &chosen);
|
if (grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", &bootpath,
|
||||||
if (grub_ieee1275_get_property (chosen, "bootpath", &bootpath,
|
|
||||||
sizeof (bootpath), 0))
|
sizeof (bootpath), 0))
|
||||||
{
|
{
|
||||||
/* Should never happen. */
|
/* Should never happen. */
|
||||||
|
|
|
@ -165,14 +165,10 @@ grub_map (grub_addr_t phys, grub_addr_t virt, grub_uint32_t size,
|
||||||
int catch_result;
|
int catch_result;
|
||||||
} args;
|
} args;
|
||||||
grub_ieee1275_ihandle_t mmu;
|
grub_ieee1275_ihandle_t mmu;
|
||||||
grub_ieee1275_ihandle_t chosen;
|
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
grub_ieee1275_finddevice ("/chosen", &chosen);
|
grub_ieee1275_get_property (grub_ieee1275_chosen, "mmu", &mmu, sizeof mmu,
|
||||||
if (chosen == 0)
|
&len);
|
||||||
return -1;
|
|
||||||
|
|
||||||
grub_ieee1275_get_property (chosen, "mmu", &mmu, sizeof mmu, &len);
|
|
||||||
if (len != sizeof mmu)
|
if (len != sizeof mmu)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
@ -47,13 +47,10 @@ static grub_err_t
|
||||||
grub_linux_boot (void)
|
grub_linux_boot (void)
|
||||||
{
|
{
|
||||||
kernel_entry_t linuxmain;
|
kernel_entry_t linuxmain;
|
||||||
grub_ieee1275_phandle_t chosen;
|
|
||||||
grub_size_t actual;
|
grub_size_t actual;
|
||||||
|
|
||||||
grub_ieee1275_finddevice ("/chosen", &chosen);
|
|
||||||
|
|
||||||
/* Set the command line arguments. */
|
/* 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);
|
grub_strlen (linux_args) + 1, &actual);
|
||||||
|
|
||||||
/* Boot the kernel. */
|
/* Boot the kernel. */
|
||||||
|
@ -236,7 +233,7 @@ grub_rescue_cmd_linux (int argc, char *argv[])
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grub_loader_set (grub_linux_boot, grub_linux_unload);
|
grub_loader_set (grub_linux_boot, grub_linux_unload);
|
||||||
initrd_addr = 0xc0000000;
|
initrd_addr = 0;
|
||||||
loaded = 1;
|
loaded = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,23 +241,19 @@ grub_ofconsole_refresh (void)
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_ofconsole_init (void)
|
grub_ofconsole_init (void)
|
||||||
{
|
{
|
||||||
grub_ieee1275_phandle_t chosen;
|
|
||||||
char data[4];
|
char data[4];
|
||||||
grub_size_t actual;
|
grub_size_t actual;
|
||||||
int col;
|
int col;
|
||||||
|
|
||||||
if (grub_ieee1275_finddevice ("/chosen", &chosen))
|
if (grub_ieee1275_get_property (grub_ieee1275_chosen, "stdout", data,
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find /chosen");
|
sizeof data, &actual)
|
||||||
|
|
||||||
if (grub_ieee1275_get_property (chosen, "stdout", data, sizeof data,
|
|
||||||
&actual)
|
|
||||||
|| actual != sizeof data)
|
|| actual != sizeof data)
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdout");
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdout");
|
||||||
|
|
||||||
stdout_ihandle = grub_ieee1275_decode_int_4 (data);
|
stdout_ihandle = grub_ieee1275_decode_int_4 (data);
|
||||||
|
|
||||||
if (grub_ieee1275_get_property (chosen, "stdin", data, sizeof data,
|
if (grub_ieee1275_get_property (grub_ieee1275_chosen, "stdin", data,
|
||||||
&actual)
|
sizeof data, &actual)
|
||||||
|| actual != sizeof data)
|
|| actual != sizeof data)
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue