|
|
@@ -30,9 +30,9 @@ Signed-off-by: George Moussalem <[email protected]>
|
|
|
+ __le64 blk_size;
|
|
|
+};
|
|
|
|
|
|
- static bool mdt_phdr_valid(const struct elf32_phdr *phdr)
|
|
|
+ static bool mdt_header_valid(const struct firmware *fw)
|
|
|
{
|
|
|
-@@ -67,6 +77,56 @@ static ssize_t mdt_load_split_segment(vo
|
|
|
+@@ -98,6 +108,56 @@ static ssize_t mdt_load_split_segment(vo
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
@@ -89,7 +89,7 @@ Signed-off-by: George Moussalem <[email protected]>
|
|
|
/**
|
|
|
* qcom_mdt_get_size() - acquire size of the memory region needed to load mdt
|
|
|
* @fw: firmware object for the mdt file
|
|
|
-@@ -293,7 +353,8 @@ static bool qcom_mdt_bins_are_split(cons
|
|
|
+@@ -333,7 +393,8 @@ static bool qcom_mdt_bins_are_split(cons
|
|
|
static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,
|
|
|
const char *fw_name, int pas_id, void *mem_region,
|
|
|
phys_addr_t mem_phys, size_t mem_size,
|
|
|
@@ -99,7 +99,7 @@ Signed-off-by: George Moussalem <[email protected]>
|
|
|
{
|
|
|
const struct elf32_phdr *phdrs;
|
|
|
const struct elf32_phdr *phdr;
|
|
|
-@@ -347,6 +408,14 @@ static int __qcom_mdt_load(struct device
|
|
|
+@@ -390,6 +451,14 @@ static int __qcom_mdt_load(struct device
|
|
|
if (!mdt_phdr_valid(phdr))
|
|
|
continue;
|
|
|
|
|
|
@@ -114,7 +114,7 @@ Signed-off-by: George Moussalem <[email protected]>
|
|
|
offset = phdr->p_paddr - mem_reloc;
|
|
|
if (offset < 0 || offset + phdr->p_memsz > mem_size) {
|
|
|
dev_err(dev, "segment outside memory range\n");
|
|
|
-@@ -364,7 +433,11 @@ static int __qcom_mdt_load(struct device
|
|
|
+@@ -407,7 +476,11 @@ static int __qcom_mdt_load(struct device
|
|
|
|
|
|
ptr = mem_region + offset;
|
|
|
|
|
|
@@ -127,7 +127,7 @@ Signed-off-by: George Moussalem <[email protected]>
|
|
|
/* Firmware is large enough to be non-split */
|
|
|
if (phdr->p_offset + phdr->p_filesz > fw->size) {
|
|
|
dev_err(dev, "file %s segment %d would be truncated\n",
|
|
|
-@@ -381,7 +454,7 @@ static int __qcom_mdt_load(struct device
|
|
|
+@@ -424,7 +497,7 @@ static int __qcom_mdt_load(struct device
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
@@ -136,7 +136,7 @@ Signed-off-by: George Moussalem <[email protected]>
|
|
|
memset(ptr + phdr->p_filesz, 0, phdr->p_memsz - phdr->p_filesz);
|
|
|
}
|
|
|
|
|
|
-@@ -416,7 +489,7 @@ int qcom_mdt_load(struct device *dev, co
|
|
|
+@@ -459,7 +532,7 @@ int qcom_mdt_load(struct device *dev, co
|
|
|
return ret;
|
|
|
|
|
|
return __qcom_mdt_load(dev, fw, firmware, pas_id, mem_region, mem_phys,
|
|
|
@@ -145,7 +145,7 @@ Signed-off-by: George Moussalem <[email protected]>
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(qcom_mdt_load);
|
|
|
|
|
|
-@@ -439,9 +512,36 @@ int qcom_mdt_load_no_init(struct device
|
|
|
+@@ -482,9 +555,36 @@ int qcom_mdt_load_no_init(struct device
|
|
|
size_t mem_size, phys_addr_t *reloc_base)
|
|
|
{
|
|
|
return __qcom_mdt_load(dev, fw, firmware, pas_id, mem_region, mem_phys,
|