summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx
diff options
context:
space:
mode:
authorKeerthy <j-keerthy@ti.com>2020-02-12 13:55:03 +0530
committerLokesh Vutla <lokeshvutla@ti.com>2020-03-03 13:08:14 +0530
commit805b3cac1e0cae04d16ab893f5cffb446ec74c9c (patch)
tree9c1b7780a1a354313d421c7529802eece5c1a19c /arch/arm/mach-imx
parent0900254c8caf0736e4816fd579596989bd6b4eb9 (diff)
lib: elf: Move the generic elf loading/validating functions to lib
Move the generic elf loading/validating functions to lib/ so that they can be re-used and accessed by code existing outside cmd. While at it remove the duplicate static version of load_elf_image_phdr under arch/arm/mach-imx/imx_bootaux.c. Signed-off-by: Keerthy <j-keerthy@ti.com> Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r--arch/arm/mach-imx/imx_bootaux.c64
1 files changed, 0 insertions, 64 deletions
diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
index 21e96f8c88..ec0da1164f 100644
--- a/arch/arm/mach-imx/imx_bootaux.c
+++ b/arch/arm/mach-imx/imx_bootaux.c
@@ -12,70 +12,6 @@
#include <linux/compiler.h>
#include <cpu_func.h>
-#ifndef CONFIG_IMX8M
-const __weak struct rproc_att hostmap[] = { };
-
-static const struct rproc_att *get_host_mapping(unsigned long auxcore)
-{
- const struct rproc_att *mmap = hostmap;
-
- while (mmap && mmap->size) {
- if (mmap->da <= auxcore &&
- mmap->da + mmap->size > auxcore)
- return mmap;
- mmap++;
- }
-
- return NULL;
-}
-
-/*
- * A very simple elf loader, assumes the image is valid, returns the
- * entry point address.
- */
-static unsigned long load_elf_image_phdr(unsigned long addr)
-{
- Elf32_Ehdr *ehdr; /* ELF header structure pointer */
- Elf32_Phdr *phdr; /* Program header structure pointer */
- int i;
-
- ehdr = (Elf32_Ehdr *)addr;
- phdr = (Elf32_Phdr *)(addr + ehdr->e_phoff);
-
- /* Load each program header */
- for (i = 0; i < ehdr->e_phnum; ++i, ++phdr) {
- const struct rproc_att *mmap = get_host_mapping(phdr->p_paddr);
- void *dst, *src;
-
- if (phdr->p_type != PT_LOAD)
- continue;
-
- if (!mmap) {
- printf("Invalid aux core address: %08x",
- phdr->p_paddr);
- return 0;
- }
-
- dst = (void *)(phdr->p_paddr - mmap->da) + mmap->sa;
- src = (void *)addr + phdr->p_offset;
-
- debug("Loading phdr %i to 0x%p (%i bytes)\n",
- i, dst, phdr->p_filesz);
-
- if (phdr->p_filesz)
- memcpy(dst, src, phdr->p_filesz);
- if (phdr->p_filesz != phdr->p_memsz)
- memset(dst + phdr->p_filesz, 0x00,
- phdr->p_memsz - phdr->p_filesz);
- flush_cache((unsigned long)dst &
- ~(CONFIG_SYS_CACHELINE_SIZE - 1),
- ALIGN(phdr->p_filesz, CONFIG_SYS_CACHELINE_SIZE));
- }
-
- return ehdr->e_entry;
-}
-#endif
-
int arch_auxiliary_core_up(u32 core_id, ulong addr)
{
ulong stack, pc;