Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a95128b3 authored by Pratik Patel's avatar Pratik Patel
Browse files

soc: qcom: peripheral-loader: zero initialize pil imem region



Zero initialize the pil imem region so that clients that rely on
info in the imem region can determine the number of valid records
present in the region. Also move pil_image_info to the header so
its accessible to the clients.

Change-Id: I0e4d8c9176ac3b2977664005e41259df490b3967
Signed-off-by: default avatarPratik Patel <pratikp@codeaurora.org>
parent 6e580894
Loading
Loading
Loading
Loading
+16 −17
Original line number Diff line number Diff line
@@ -96,18 +96,6 @@ struct pil_seg {
	bool relocated;
};

/**
 * struct pil_image_info - information in IMEM about image and where it is loaded
 * @name: name of image (may or may not be NULL terminated)
 * @start: indicates physical address where image starts (little endian)
 * @size: size of image (little endian)
 */
struct pil_image_info {
	char name[8];
	__le64 start;
	__le32 size;
} __attribute__((__packed__));

/**
 * struct pil_priv - Private state for a pil_desc
 * @proxy: work item used to run the proxy unvoting routine
@@ -919,16 +907,27 @@ static struct notifier_block pil_pm_notifier = {
static int __init msm_pil_init(void)
{
	struct device_node *np;
	struct resource res;
	int i;

	np = of_find_compatible_node(NULL, NULL, "qcom,msm-imem-pil");
	if (np) {
		pil_info_base = of_iomap(np, 0);
		if (!pil_info_base)
			pr_warn("pil: could not map imem region\n");
	} else {
	if (!np) {
		pr_warn("pil: failed to find qcom,msm-imem-pil node\n");
		goto out;
	}
	if (of_address_to_resource(np, 0, &res)) {
		pr_warn("pil: address to resource on imem region failed\n");
		goto out;
	}
	pil_info_base = ioremap(res.start, resource_size(&res));
	if (!pil_info_base) {
		pr_warn("pil: could not map imem region\n");
		goto out;
	}
	for (i = 0; i < resource_size(&res)/sizeof(u32); i++)
		writel_relaxed(0, pil_info_base + (i * sizeof(u32)));

out:
	return register_pm_notifier(&pil_pm_notifier);
}
device_initcall(msm_pil_init);
+12 −0
Original line number Diff line number Diff line
@@ -51,6 +51,18 @@ struct pil_desc {
	void *map_data;
};

/**
 * struct pil_image_info - info in IMEM about image and where it is loaded
 * @name: name of image (may or may not be NULL terminated)
 * @start: indicates physical address where image starts (little endian)
 * @size: size of image (little endian)
 */
struct pil_image_info {
	char name[8];
	__le64 start;
	__le32 size;
} __attribute__((__packed__));

/**
 * struct pil_reset_ops - PIL operations
 * @init_image: prepare an image for authentication