arm64 linux loader: improve type portability

In preparation for turning this into a common loader for 32-bit and 64-bit
platforms, ensure the code will compile cleanly for either.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
Leif Lindholm 2017-08-03 11:04:26 +01:00 committed by Vincent Batts
parent 793b90c851
commit 01f3dcc70a
2 changed files with 10 additions and 13 deletions

View file

@ -59,8 +59,6 @@ grub_arm64_uefi_check_image (struct grub_arm64_linux_kernel_header * lh)
N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled")); N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled"));
grub_dprintf ("linux", "UEFI stub kernel:\n"); grub_dprintf ("linux", "UEFI stub kernel:\n");
grub_dprintf ("linux", "text_offset = 0x%012llx\n",
(long long unsigned) lh->text_offset);
grub_dprintf ("linux", "PE/COFF header @ %08x\n", lh->hdr_offset); grub_dprintf ("linux", "PE/COFF header @ %08x\n", lh->hdr_offset);
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
@ -88,8 +86,8 @@ finalize_params_linux (void)
/* Set initrd info */ /* Set initrd info */
if (initrd_start && initrd_end > initrd_start) if (initrd_start && initrd_end > initrd_start)
{ {
grub_dprintf ("linux", "Initrd @ 0x%012lx-0x%012lx\n", grub_dprintf ("linux", "Initrd @ %p-%p\n",
initrd_start, initrd_end); (void *) initrd_start, (void *) initrd_end);
retval = grub_fdt_set_prop64 (fdt, node, "linux,initrd-start", retval = grub_fdt_set_prop64 (fdt, node, "linux,initrd-start",
initrd_start); initrd_start);
@ -163,7 +161,7 @@ grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size, char *args)
/* When successful, not reached */ /* When successful, not reached */
b->unload_image (image_handle); b->unload_image (image_handle);
grub_efi_free_pages ((grub_efi_physical_address_t) loaded_image->load_options, grub_efi_free_pages ((grub_addr_t) loaded_image->load_options,
GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size)); GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
return grub_errno; return grub_errno;
@ -190,7 +188,7 @@ grub_linux_unload (void)
initrd_start = initrd_end = 0; initrd_start = initrd_end = 0;
grub_free (linux_args); grub_free (linux_args);
if (kernel_addr) if (kernel_addr)
grub_efi_free_pages ((grub_efi_physical_address_t) kernel_addr, grub_efi_free_pages ((grub_addr_t) kernel_addr,
GRUB_EFI_BYTES_TO_PAGES (kernel_size)); GRUB_EFI_BYTES_TO_PAGES (kernel_size));
grub_fdt_unload (); grub_fdt_unload ();
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
@ -242,8 +240,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
fail: fail:
grub_initrd_close (&initrd_ctx); grub_initrd_close (&initrd_ctx);
if (initrd_mem && !initrd_start) if (initrd_mem && !initrd_start)
grub_efi_free_pages ((grub_efi_physical_address_t) initrd_mem, grub_efi_free_pages ((grub_addr_t) initrd_mem, initrd_pages);
initrd_pages);
return grub_errno; return grub_errno;
} }
@ -332,7 +329,7 @@ fail:
grub_free (linux_args); grub_free (linux_args);
if (kernel_addr && !loaded) if (kernel_addr && !loaded)
grub_efi_free_pages ((grub_efi_physical_address_t) kernel_addr, grub_efi_free_pages ((grub_addr_t) kernel_addr,
GRUB_EFI_BYTES_TO_PAGES (kernel_size)); GRUB_EFI_BYTES_TO_PAGES (kernel_size));
return grub_errno; return grub_errno;

View file

@ -32,12 +32,12 @@ void *
grub_fdt_load (grub_size_t additional_size) grub_fdt_load (grub_size_t additional_size)
{ {
void *raw_fdt; void *raw_fdt;
grub_size_t size; unsigned int size;
if (fdt) if (fdt)
{ {
size = GRUB_EFI_BYTES_TO_PAGES (grub_fdt_get_totalsize (fdt)); size = GRUB_EFI_BYTES_TO_PAGES (grub_fdt_get_totalsize (fdt));
grub_efi_free_pages ((grub_efi_physical_address_t) fdt, size); grub_efi_free_pages ((grub_addr_t) fdt, size);
} }
if (loaded_fdt) if (loaded_fdt)
@ -49,7 +49,7 @@ grub_fdt_load (grub_size_t additional_size)
raw_fdt ? grub_fdt_get_totalsize (raw_fdt) : GRUB_FDT_EMPTY_TREE_SZ; raw_fdt ? grub_fdt_get_totalsize (raw_fdt) : GRUB_FDT_EMPTY_TREE_SZ;
size += additional_size; size += additional_size;
grub_dprintf ("linux", "allocating %ld bytes for fdt\n", size); grub_dprintf ("linux", "allocating %d bytes for fdt\n", size);
fdt = grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (size)); fdt = grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (size));
if (!fdt) if (!fdt)
return NULL; return NULL;
@ -88,7 +88,7 @@ grub_fdt_unload (void) {
if (!fdt) { if (!fdt) {
return; return;
} }
grub_efi_free_pages ((grub_efi_physical_address_t) fdt, grub_efi_free_pages ((grub_addr_t) fdt,
GRUB_EFI_BYTES_TO_PAGES (grub_fdt_get_totalsize (fdt))); GRUB_EFI_BYTES_TO_PAGES (grub_fdt_get_totalsize (fdt)));
fdt = NULL; fdt = NULL;
} }