grub/kern/powerpc/ieee1275/cmain.c
robertmh ad0686cc6d 2007-07-22 Robert Millan <rmh@aybabtu.com>
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): Add
	GRUB_IEEE1275_FLAG_BROKEN_OUTPUT flag.
	* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options): Set this
	flag when running on SmartFirmware.
	* term/ieee1275/ofconsole.c (grub_ofconsole_init): Avoid running
	"output-device output" command when GRUB_IEEE1275_FLAG_BROKEN_OUTPUT
	was set.

	* kern/powerpc/ieee1275/openfw.c (grub_ieee1275_encode_devname):
	Increase partno when GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS flag is set,
	rather than decreasing it.

	* util/i386/pc/grub-setup.c (setup): When embedding is required, but
	there's not enough space to do it, fail in the same way as when it
	can't be done because there are no partitions.

	* util/powerpc/ieee1275/grub-install.in: Improve error message shown
	when nvsetenv failed.
2007-07-22 09:05:11 +00:00

85 lines
2.3 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* cmain.c - Startup code for the PowerPC. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2004,2005,2006,2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <alloca.h>
#include <stdint.h>
#include <grub/kernel.h>
#include <grub/misc.h>
#include <grub/types.h>
#include <grub/machine/kernel.h>
#include <grub/ieee1275/ieee1275.h>
int (*grub_ieee1275_entry_fn) (void *);
grub_ieee1275_phandle_t grub_ieee1275_chosen;
static grub_uint32_t grub_ieee1275_flags;
int
grub_ieee1275_test_flag (enum grub_ieee1275_flag flag)
{
return (grub_ieee1275_flags & (1 << flag));
}
void
grub_ieee1275_set_flag (enum grub_ieee1275_flag flag)
{
grub_ieee1275_flags |= (1 << flag);
}
static void
grub_ieee1275_find_options (void)
{
grub_ieee1275_phandle_t options;
grub_ieee1275_phandle_t openprom;
int rc;
int realmode = 0;
grub_ieee1275_finddevice ("/options", &options);
rc = grub_ieee1275_get_property (options, "real-mode?", &realmode,
sizeof realmode, 0);
if ((rc >= 0) && realmode)
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_REAL_MODE);
grub_ieee1275_finddevice ("/openprom", &openprom);
rc = grub_ieee1275_get_property (openprom, "SmartFirmware-version", 0, 0, 0);
if (rc >= 0)
{
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS);
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_OUTPUT);
}
}
void cmain (uint32_t r3, uint32_t r4, uint32_t r5);
void
cmain (UNUSED uint32_t r3, UNUSED uint32_t r4, uint32_t r5)
{
grub_ieee1275_entry_fn = (int (*)(void *)) r5;
grub_ieee1275_finddevice ("/chosen", &grub_ieee1275_chosen);
grub_ieee1275_find_options ();
/* Now invoke the main function. */
grub_main ();
/* Never reached. */
}