2008-01-20 Robert Millan <rmh@aybabtu.com>

Fix detection of "real mode" when /options/real-mode? doesn't exist.

        * include/grub/ieee1275/ieee1275.h (grub_ieee1275_mmu): New variable
        declaration.
        * kern/powerpc/ieee1275/cmain.c (grub_ieee1275_mmu): New variable.
        (grub_ieee1275_find_options): If `grub_ieee1275_mmu' is 0, set
        `GRUB_IEEE1275_FLAG_REAL_MODE'.
        (cmain): Intialize `grub_ieee1275_mmu' (using /chosen/mmu integer
        property).
        * kern/powerpc/ieee1275/openfw.c (grub_map): Rely on pre-initialized
        `grub_ieee1275_mmu' rather than obtaining a handler on every call.
This commit is contained in:
robertmh 2008-01-20 14:08:54 +00:00
parent 33bf70a759
commit 0bf74728de
4 changed files with 22 additions and 9 deletions

View file

@ -1,3 +1,17 @@
2008-01-20 Robert Millan <rmh@aybabtu.com>
Fix detection of "real mode" when /options/real-mode? doesn't exist.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_mmu): New variable
declaration.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_mmu): New variable.
(grub_ieee1275_find_options): If `grub_ieee1275_mmu' is 0, set
`GRUB_IEEE1275_FLAG_REAL_MODE'.
(cmain): Intialize `grub_ieee1275_mmu' (using /chosen/mmu integer
property).
* kern/powerpc/ieee1275/openfw.c (grub_map): Rely on pre-initialized
`grub_ieee1275_mmu' rather than obtaining a handler on every call.
2008-01-19 Robert Millan <rmh@aybabtu.com> 2008-01-19 Robert Millan <rmh@aybabtu.com>
Get rid of confusing function (superceeded by Get rid of confusing function (superceeded by

View file

@ -64,6 +64,7 @@ typedef grub_ieee1275_cell_t grub_ieee1275_ihandle_t;
typedef grub_ieee1275_cell_t grub_ieee1275_phandle_t; typedef grub_ieee1275_cell_t grub_ieee1275_phandle_t;
extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen); extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen);
extern grub_ieee1275_ihandle_t EXPORT_VAR(grub_ieee1275_mmu);
extern int (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *); extern int (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *);
enum grub_ieee1275_flag enum grub_ieee1275_flag

View file

@ -28,6 +28,7 @@
int (*grub_ieee1275_entry_fn) (void *); int (*grub_ieee1275_entry_fn) (void *);
grub_ieee1275_phandle_t grub_ieee1275_chosen; grub_ieee1275_phandle_t grub_ieee1275_chosen;
grub_ieee1275_ihandle_t grub_ieee1275_mmu;
static grub_uint32_t grub_ieee1275_flags; static grub_uint32_t grub_ieee1275_flags;
@ -58,7 +59,7 @@ grub_ieee1275_find_options (void)
grub_ieee1275_finddevice ("/options", &options); grub_ieee1275_finddevice ("/options", &options);
rc = grub_ieee1275_get_integer_property (options, "real-mode?", &realmode, rc = grub_ieee1275_get_integer_property (options, "real-mode?", &realmode,
sizeof realmode, 0); sizeof realmode, 0);
if ((rc >= 0) && realmode) if (((rc >= 0) && realmode) || (grub_ieee1275_mmu == 0))
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_REAL_MODE); grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_REAL_MODE);
grub_ieee1275_finddevice ("/openprom", &openprom); grub_ieee1275_finddevice ("/openprom", &openprom);
@ -108,6 +109,10 @@ cmain (void)
{ {
grub_ieee1275_finddevice ("/chosen", &grub_ieee1275_chosen); grub_ieee1275_finddevice ("/chosen", &grub_ieee1275_chosen);
if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "mmu", &grub_ieee1275_mmu,
sizeof grub_ieee1275_mmu, 0) < 0)
grub_ieee1275_mmu = 0;
grub_ieee1275_find_options (); grub_ieee1275_find_options ();
/* Now invoke the main function. */ /* Now invoke the main function. */

View file

@ -200,17 +200,10 @@ grub_map (grub_addr_t phys, grub_addr_t virt, grub_uint32_t size,
grub_uint32_t phys; grub_uint32_t phys;
int catch_result; int catch_result;
} args; } args;
grub_ieee1275_ihandle_t mmu;
int len;
grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "mmu", &mmu, sizeof mmu,
&len);
if (len != sizeof mmu)
return -1;
INIT_IEEE1275_COMMON (&args.common, "call-method", 6, 1); INIT_IEEE1275_COMMON (&args.common, "call-method", 6, 1);
args.method = "map"; args.method = "map";
args.ihandle = mmu; args.ihandle = grub_ieee1275_mmu;
args.phys = phys; args.phys = phys;
args.virt = virt; args.virt = virt;
args.size = size; args.size = size;