* grub-core/kern/ieee1275/init.c (grub_claim_heap): Improve handling

of GRUB_IEEE1275_FLAG_FORCE_CLAIM.
	* grub-core/loader/powerpc/ieee1275/linux.c
	(grub_linux_claimmap_iterate): Handle GRUB_IEEE1275_FLAG_FORCE_CLAIM.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-04-19 15:27:09 +02:00
parent f32555dd93
commit 90ec4b7f6c
5 changed files with 34 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2013-04-19 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/ieee1275/init.c (grub_claim_heap): Improve handling
of GRUB_IEEE1275_FLAG_FORCE_CLAIM.
* grub-core/loader/powerpc/ieee1275/linux.c
(grub_linux_claimmap_iterate): Handle GRUB_IEEE1275_FLAG_FORCE_CLAIM.
2013-04-19 Vladimir Serbinenko <phcoder@gmail.com> 2013-04-19 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): * grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options):

View file

@ -225,8 +225,9 @@ grub_claim_heap (void)
{ {
unsigned long total = 0; unsigned long total = 0;
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET)) if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
heap_init (HEAP_MAX_ADDR - HEAP_MIN_SIZE, HEAP_MIN_SIZE, 1, &total); heap_init (GRUB_IEEE1275_STATIC_HEAP_START, GRUB_IEEE1275_STATIC_HEAP_LEN,
1, &total);
else else
grub_machine_mmap_iterate (heap_init, &total); grub_machine_mmap_iterate (heap_init, &total);
} }

View file

@ -38,7 +38,7 @@ grub_relocator_firmware_get_max_events (void)
{ {
int counter = 0; int counter = 0;
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET)) if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
return 0; return 0;
grub_machine_mmap_iterate (count, &counter); grub_machine_mmap_iterate (count, &counter);
return 2 * counter; return 2 * counter;
@ -92,7 +92,7 @@ grub_relocator_firmware_fill_events (struct grub_relocator_mmap_event *events)
.counter = 0 .counter = 0
}; };
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET)) if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
return 0; return 0;
grub_machine_mmap_iterate (grub_relocator_firmware_fill_events_iter, &ctx); grub_machine_mmap_iterate (grub_relocator_firmware_fill_events_iter, &ctx);
return ctx.counter; return ctx.counter;

View file

@ -111,6 +111,20 @@ grub_linux_claimmap_iterate (grub_addr_t target, grub_size_t size,
.found_addr = (grub_addr_t) -1 .found_addr = (grub_addr_t) -1
}; };
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
{
grub_uint64_t addr = target;
if (addr < GRUB_IEEE1275_STATIC_HEAP_START
+ GRUB_IEEE1275_STATIC_HEAP_LEN)
addr = GRUB_IEEE1275_STATIC_HEAP_START
+ GRUB_IEEE1275_STATIC_HEAP_LEN;
addr = ALIGN_UP (addr, align);
if (grub_claimmap (addr, size) == GRUB_ERR_NONE)
return addr;
return (grub_addr_t) -1;
}
grub_machine_mmap_iterate (alloc_mem, &ctx); grub_machine_mmap_iterate (alloc_mem, &ctx);
return ctx.found_addr; return ctx.found_addr;

View file

@ -78,6 +78,14 @@ extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen);
extern grub_ieee1275_ihandle_t EXPORT_VAR(grub_ieee1275_mmu); 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 *);
/* Static heap, used only if FORCE_CLAIM is set,
happens on Open Hack'Ware. Should be in platform-specific
header but is used only on PPC anyway.
*/
#define GRUB_IEEE1275_STATIC_HEAP_START 0x1000000
#define GRUB_IEEE1275_STATIC_HEAP_LEN 0x1000000
enum grub_ieee1275_flag enum grub_ieee1275_flag
{ {
/* Old World Macintosh firmware fails seek when "dev:0" is opened. */ /* Old World Macintosh firmware fails seek when "dev:0" is opened. */