diff options
author | Lokesh Vutla <lokeshvutla@ti.com> | 2019-09-04 16:01:31 +0530 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-10-11 10:07:34 -0400 |
commit | 81e39fbd9251bfbef3bc156735e95b67cd7a828f (patch) | |
tree | e5b8fa24f4dab9809992280ddb9f7c11c08ea40a /drivers/remoteproc | |
parent | 856c0ad413f52d20963ef6b0fe982a0ca91086f2 (diff) | |
download | u-boot-81e39fbd9251bfbef3bc156735e95b67cd7a828f.zip u-boot-81e39fbd9251bfbef3bc156735e95b67cd7a828f.tar.gz u-boot-81e39fbd9251bfbef3bc156735e95b67cd7a828f.tar.bz2 |
remoteproc: elf_loader: Introduce rproc_elf_get_boot_addr() api
Introduce rproc_elf_get_boot_addr() that returns the entry point of
the elf file. This api auto detects the 64/32 bit elf file and returns
the boot addr accordingly.
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r-- | drivers/remoteproc/rproc-elf-loader.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/remoteproc/rproc-elf-loader.c b/drivers/remoteproc/rproc-elf-loader.c index 42a78f4..b38a226 100644 --- a/drivers/remoteproc/rproc-elf-loader.c +++ b/drivers/remoteproc/rproc-elf-loader.c @@ -251,3 +251,27 @@ int rproc_elf_load_image(struct udevice *dev, ulong addr, ulong size) else return rproc_elf32_load_image(dev, addr, size); } + +static ulong rproc_elf32_get_boot_addr(ulong addr) +{ + Elf32_Ehdr *ehdr = (Elf32_Ehdr *)addr; + + return ehdr->e_entry; +} + +static ulong rproc_elf64_get_boot_addr(ulong addr) +{ + Elf64_Ehdr *ehdr = (Elf64_Ehdr *)addr; + + return ehdr->e_entry; +} + +ulong rproc_elf_get_boot_addr(struct udevice *dev, ulong addr) +{ + Elf32_Ehdr *ehdr = (Elf32_Ehdr *)addr; + + if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) + return rproc_elf64_get_boot_addr(addr); + else + return rproc_elf32_get_boot_addr(addr); +} |