
Hi Caleb,
On 17/06/2024 10:32, Caleb Connolly wrote:
Introduce two Qualcomm SoC drivers, the RPMh and cmd-db. RPMh is a the name for the second generation Resource Power Management hub on Qualcomm SoCs. Most core regulators have to be controlled via this hub.
The cmd-db is a region of memory which contains offsets and data about how to communicate with the RPMh.
Signed-off-by: Caleb Connolly caleb.connolly@linaro.org
drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/qcom/Kconfig | 25 ++ drivers/soc/qcom/Makefile | 4 + drivers/soc/qcom/cmd-db.c | 246 ++++++++++++++++ drivers/soc/qcom/rpmh-internal.h | 141 +++++++++ drivers/soc/qcom/rpmh-rsc.c | 619 +++++++++++++++++++++++++++++++++++++++ drivers/soc/qcom/rpmh.c | 110 +++++++ include/soc/qcom/cmd-db.h | 42 +++ include/soc/qcom/rpmh.h | 29 ++ include/soc/qcom/tcs.h | 78 +++++ 11 files changed, 1296 insertions(+)
<snip>
+static int cmd_db_get_header(const char *id, const struct entry_header **eh,
const struct rsc_hdr **rh)
+{
- const struct rsc_hdr *rsc_hdr;
- const struct entry_header *ent;
- int i, j;
- u8 query[sizeof(ent->id)] __nonstring;
- /*
* Pad out query string to same length as in DB. NOTE: the output
* query string is not necessarily '\0' terminated if it bumps up
* against the max size. That's OK and expected.
*/
- strncpy(query, id, sizeof(query));
- for (i = 0; i < MAX_SLV_ID; i++) {
rsc_hdr = &cmd_db_header->header[i];
if (!rsc_hdr->slv_id)
break;
ent = rsc_to_entry_header(rsc_hdr);
for (j = 0; j < le16_to_cpu(rsc_hdr->cnt); j++, ent++) {
if (memcmp(ent->id, query, sizeof(ent->id)) == 0) {
I had to change to: if (strncmp(ent->id, query, sizeof(ent->id)) == 0) { otherwise I get: Failed to read RPMh address for bobb1 ...
on SM8550 and SM8650.
Linux uses memcmp, but it pads the buffer with strtomem_pad(), strncpy doesn't seem to do the padding. Neil
if (eh)
*eh = ent;
if (rh)
*rh = rsc_hdr;
return 0;
}
}
- }
- return -ENODEV;
+}
<snip>