From a3bd8f9f9fd30b36fe67127e16325369578454df Mon Sep 17 00:00:00 2001 From: Srinivas Kandagatla Date: Tue, 24 Nov 2015 17:30:25 +0000 Subject: [PATCH] WIP:remoteproc:q6pil: add segment_is_loadable and segment_is_relocatable macros Signed-off-by: Srinivas Kandagatla --- drivers/remoteproc/qcom_q6v5_pil.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c index b510ecfa7677..d379b95626f4 100644 --- a/drivers/remoteproc/qcom_q6v5_pil.c +++ b/drivers/remoteproc/qcom_q6v5_pil.c @@ -164,6 +164,18 @@ struct qproc { #define QDSP6SS_ACC_OVERRIDE_VAL 0x20 +static int segment_is_loadable(const struct elf32_phdr *p) +{ + return (p->p_type == PT_LOAD) && + !segment_is_hash(p->p_flags) && + p->p_memsz; +} + +static bool segment_is_relocatable(const struct elf32_phdr *p) +{ + return !!(p->p_flags & BIT(27)); +} + static int qproc_sanity_check(struct rproc *rproc, const struct firmware *fw) { @@ -473,16 +485,11 @@ static int qproc_verify_segments(struct qproc *qproc, const struct firmware *fw) phys_addr_t da = phdr->p_paddr; u32 memsz = phdr->p_memsz; - if (phdr->p_type != PT_LOAD) + if (!segment_is_loadable(phdr)) continue; dev_err(qproc->dev, "0x%x %d %d\n", phdr->p_paddr, segment_is_hash(phdr->p_flags), !!(phdr->p_flags & BIT(27))); - if (segment_is_hash(phdr->p_flags)) - continue; - - if (memsz == 0) - continue; if (da < min_addr) min_addr = da; -- 2.39.5