Workaround yet another IEEE1275 bug.

* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): New enum value
	GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS.
	* grub-core/kern/ieee1275/mmap.c (grub_machine_mmap_iterate): Ignore
	adress_cells and size:cells if GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS
	is set.
	* grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set
	GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS on powermacs.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-02-12 10:22:55 +03:00
parent d998657dcf
commit 028501a0e0
4 changed files with 27 additions and 0 deletions

View file

@ -1,3 +1,15 @@
2011-02-12 Vladimir Serbinenko <phcoder@gmail.com>
Workaround yet another IEEE1275 bug.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): New enum value
GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS.
* grub-core/kern/ieee1275/mmap.c (grub_machine_mmap_iterate): Ignore
adress_cells and size:cells if GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS
is set.
* grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set
GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS on powermacs.
2011-02-12 Vladimir Serbinenko <phcoder@gmail.com> 2011-02-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/partmap/msdos.c (pc_partition_map_embed): Fix off by one * grub-core/partmap/msdos.c (pc_partition_map_embed): Fix off by one

View file

@ -84,6 +84,9 @@ grub_ieee1275_find_options (void)
if (rc >= 0 && !grub_strcmp (tmp, "Emulated PC")) if (rc >= 0 && !grub_strcmp (tmp, "Emulated PC"))
is_qemu = 1; is_qemu = 1;
if (grub_strncmp (tmp, "PowerMac", sizeof ("PowerMac") - 1) == 0)
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS);
if (is_smartfirmware) if (is_smartfirmware)
{ {
/* Broken in all versions */ /* Broken in all versions */

View file

@ -50,6 +50,12 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"couldn't examine /memory/available property"); "couldn't examine /memory/available property");
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS))
{
address_cells = 1;
size_cells = 1;
}
/* Decode each entry and call `hook'. */ /* Decode each entry and call `hook'. */
i = 0; i = 0;
available_size /= sizeof (grub_uint32_t); available_size /= sizeof (grub_uint32_t);

View file

@ -106,6 +106,12 @@ enum grub_ieee1275_flag
/* OLPC / XO firmware has the cursor ON/OFF routines. */ /* OLPC / XO firmware has the cursor ON/OFF routines. */
GRUB_IEEE1275_FLAG_HAS_CURSORONOFF, GRUB_IEEE1275_FLAG_HAS_CURSORONOFF,
/* Some PowerMacs claim to use 2 address cells but in fact use only 1.
Other PowerMacs claim to use only 1 and really do so. Always assume
1 address cell is used on PowerMacs.
*/
GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS,
}; };
extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag); extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);