2005-03-26 Hollis Blanchard <hollis@penguinppc.org>
* commands/ieee1275/halt.c (grub_cmd_halt): Call grub_halt instead of grub_ieee1275_interpret. (grub_halt_init): New function. (grub_halt_fini): Likewise. (GRUB_MOD_INIT): Correct message grammar. * commands/ieee1275/reboot.c (grub_cmd_reboot): Call grub_reboot instead of grub_ieee1275_interpret. (grub_reboot_init): New function. (grub_reboot_fini): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Replace commands/i386/pc/halt.c, commands/i386/pc/reboot.c, and util/i386/pc/misc.c with commands/ieee1275/halt.c, commands/ieee1275/reboot.c, and util/powerpc/ieee1275/misc.c. * disk/powerpc/ieee1275/ofdisk.c (grub_ofdisk_fini): New function. * include/grub/powerpc/ieee1275/console.h (grub_console_fini): Add prototype. * include/grub/powerpc/ieee1275/ieee1275.h (grub_reboot): Add prototype. (grub_halt): Likewise. * include/grub/powerpc/ieee1275/init.h: Remove inaccurate comment. (cmain): Remove __attribute__((unused)). * kern/powerpc/ieee1275/init.c (grub_heap_start): New variable. (grub_heap_len): Likewise. (grub_machine_fini): New function. * kern/powerpc/ieee1275/openfw.c (grub_reboot): New function. (grub_halt): Likewise. * term/powerpc/ieee1275/ofconsole.c (grub_console_fini): New function. * util/powerpc/ieee1275/misc.c: New file.
This commit is contained in:
parent
0058f7712f
commit
a5ce3a4a04
13 changed files with 174 additions and 37 deletions
|
@ -33,6 +33,10 @@
|
|||
#include <grub/machine/time.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
|
||||
/* Apple OF 1.0.5 reserves 0x0 to 0x4000 for the exception handlers. */
|
||||
static const grub_addr_t grub_heap_start = 0x4000;
|
||||
static grub_addr_t grub_heap_len;
|
||||
|
||||
void
|
||||
abort (void)
|
||||
{
|
||||
|
@ -46,30 +50,38 @@ void
|
|||
grub_machine_init (void)
|
||||
{
|
||||
extern char _start;
|
||||
grub_addr_t heap_start;
|
||||
grub_addr_t heap_len;
|
||||
|
||||
grub_console_init ();
|
||||
|
||||
/* Apple OF 1.0.5 reserves 0x4000 bytes for the exception handlers. */
|
||||
heap_start = 0x4000;
|
||||
/* Apple OF 3.1.1 reserves an extra 0x1000 bytes below the load address
|
||||
of an ELF file. */
|
||||
heap_len = (grub_addr_t) &_start - 0x1000 - heap_start;
|
||||
grub_heap_len = (grub_addr_t) &_start - 0x1000 - grub_heap_start;
|
||||
|
||||
if (grub_ieee1275_claim (heap_start, heap_len, 0, 0))
|
||||
if (grub_ieee1275_claim (grub_heap_start, grub_heap_len, 0, 0))
|
||||
{
|
||||
grub_printf ("Failed to claim heap at 0x%x, len 0x%x\n", heap_start,
|
||||
heap_len);
|
||||
grub_printf ("Failed to claim heap at 0x%x, len 0x%x\n", grub_heap_start,
|
||||
grub_heap_len);
|
||||
abort ();
|
||||
}
|
||||
grub_mm_init_region ((void *) heap_start, heap_len);
|
||||
grub_mm_init_region ((void *) grub_heap_start, grub_heap_len);
|
||||
|
||||
grub_env_set ("prefix", "");
|
||||
|
||||
grub_ofdisk_init ();
|
||||
}
|
||||
|
||||
void
|
||||
grub_machine_fini (void)
|
||||
{
|
||||
grub_loader_unset ();
|
||||
|
||||
grub_ofdisk_fini ();
|
||||
grub_console_fini ();
|
||||
|
||||
grub_ieee1275_release (grub_heap_start, grub_heap_len);
|
||||
/* XXX Release memory claimed for Old World firmware. */
|
||||
}
|
||||
|
||||
void
|
||||
grub_stop (void)
|
||||
{
|
||||
|
|
|
@ -199,3 +199,15 @@ grub_claimmap (grub_addr_t addr, grub_size_t size)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
grub_reboot (void)
|
||||
{
|
||||
grub_ieee1275_interpret ("reset-all", 0);
|
||||
}
|
||||
|
||||
void
|
||||
grub_halt (void)
|
||||
{
|
||||
grub_ieee1275_interpret ("shut-down", 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue