aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/boot
diff options
context:
space:
mode:
authorRoy Franz <roy.franz@linaro.org>2013-09-22 18:45:31 -0400
committerMatt Fleming <matt.fleming@intel.com>2013-09-25 07:34:37 -0400
commitc6866d7238d4f26055de8db9c1d5a700e554b2d4 (patch)
treeaafea85b4a8276b233332b2e0503bb009f29efde /arch/x86/boot
parent38dd9c02c3f2ed461165db22b93fae7f3ddde9ac (diff)
efi: Move relocate_kernel() to shared file.
The relocate_kernel() function will be generalized and used by all architectures, as they all have similar requirements. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'arch/x86/boot')
-rw-r--r--arch/x86/boot/compressed/eboot.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 2a4430a0fb03..5bbba868e2bc 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -677,40 +677,6 @@ free_mem_map:
677 return status; 677 return status;
678} 678}
679 679
680static efi_status_t relocate_kernel(struct setup_header *hdr)
681{
682 unsigned long start, nr_pages;
683 efi_status_t status;
684
685 /*
686 * The EFI firmware loader could have placed the kernel image
687 * anywhere in memory, but the kernel has various restrictions
688 * on the max physical address it can run at. Attempt to move
689 * the kernel to boot_params.pref_address, or as low as
690 * possible.
691 */
692 start = hdr->pref_address;
693 nr_pages = round_up(hdr->init_size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
694
695 status = efi_call_phys4(sys_table->boottime->allocate_pages,
696 EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
697 nr_pages, &start);
698 if (status != EFI_SUCCESS) {
699 status = efi_low_alloc(sys_table, hdr->init_size,
700 hdr->kernel_alignment, &start);
701 if (status != EFI_SUCCESS)
702 efi_printk(sys_table, "Failed to alloc mem for kernel\n");
703 }
704
705 if (status == EFI_SUCCESS)
706 memcpy((void *)start, (void *)(unsigned long)hdr->code32_start,
707 hdr->init_size);
708
709 hdr->pref_address = hdr->code32_start;
710 hdr->code32_start = (__u32)start;
711
712 return status;
713}
714 680
715/* 681/*
716 * On success we return a pointer to a boot_params structure, and NULL 682 * On success we return a pointer to a boot_params structure, and NULL