Lines Matching +full:rpmh +full:- +full:rsc

1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2016-2018, 2020, The Linux Foundation. All rights reserved.
18 #include <soc/qcom/cmd-db.h>
105 const u8 *magic = header->magic; in cmd_db_magic_matches()
114 u16 offset = le16_to_cpu(hdr->header_offset); in rsc_to_entry_header()
116 return cmd_db_header->data + offset; in rsc_to_entry_header()
122 u16 offset = le16_to_cpu(hdr->data_offset); in rsc_offset()
123 u16 loffset = le16_to_cpu(ent->offset); in rsc_offset()
125 return cmd_db_header->data + offset + loffset; in rsc_offset()
129 * cmd_db_ready - Indicates if command DB is available
136 return -EPROBE_DEFER; in cmd_db_ready()
138 return -EINVAL; in cmd_db_ready()
150 u8 query[sizeof(ent->id)] __nonstring; in cmd_db_get_header()
159 rsc_hdr = &cmd_db_header->header[i]; in cmd_db_get_header()
160 if (!rsc_hdr->slv_id) in cmd_db_get_header()
164 for (j = 0; j < le16_to_cpu(rsc_hdr->cnt); j++, ent++) { in cmd_db_get_header()
165 if (memcmp(ent->id, query, sizeof(ent->id)) == 0) { in cmd_db_get_header()
175 return -ENODEV; in cmd_db_get_header()
179 * cmd_db_read_addr() - Query command db for resource id address.
195 return ret < 0 ? 0 : le32_to_cpu(ent->addr); in cmd_db_read_addr()
200 * cmd_db_read_aux_data() - Query command db for aux data.
218 *len = le16_to_cpu(ent->len); in cmd_db_read_aux_data()
225 * cmd_db_match_resource_addr() - Compare if both Resource addresses are same
235 * Each RPMh VRM accelerator resource has 3 or 4 contiguous 4-byte in cmd_db_match_resource_addr()
249 * cmd_db_read_slave_id - Get the slave ID for a given resource address
265 addr = le32_to_cpu(ent->addr); in cmd_db_read_slave_id()
274 const struct rsc_hdr *rsc; in cmd_db_debugfs_dump() local
283 rsc = &cmd_db_header->header[i]; in cmd_db_debugfs_dump()
284 if (!rsc->slv_id) in cmd_db_debugfs_dump()
287 switch (le16_to_cpu(rsc->slv_id)) { in cmd_db_debugfs_dump()
302 version = le16_to_cpu(rsc->version); in cmd_db_debugfs_dump()
307 seq_puts(seq, "-------------------------\n"); in cmd_db_debugfs_dump()
309 ent = rsc_to_entry_header(rsc); in cmd_db_debugfs_dump()
310 for (j = 0; j < le16_to_cpu(rsc->cnt); j++, ent++) { in cmd_db_debugfs_dump()
311 seq_printf(seq, "0x%05x: %*pEp", le32_to_cpu(ent->addr), in cmd_db_debugfs_dump()
312 (int)strnlen(ent->id, sizeof(ent->id)), ent->id); in cmd_db_debugfs_dump()
314 len = le16_to_cpu(ent->len); in cmd_db_debugfs_dump()
317 len, rsc_offset(rsc, ent)); in cmd_db_debugfs_dump()
328 return single_open(file, cmd_db_debugfs_dump, inode->i_private); in open_cmd_db_debugfs()
346 rmem = of_reserved_mem_lookup(pdev->dev.of_node); in cmd_db_dev_probe()
348 dev_err(&pdev->dev, "failed to acquire memory region\n"); in cmd_db_dev_probe()
349 return -EINVAL; in cmd_db_dev_probe()
352 cmd_db_header = memremap(rmem->base, rmem->size, MEMREMAP_WC); in cmd_db_dev_probe()
354 ret = -ENOMEM; in cmd_db_dev_probe()
360 dev_err(&pdev->dev, "Invalid Command DB Magic\n"); in cmd_db_dev_probe()
361 return -EINVAL; in cmd_db_dev_probe()
364 debugfs_create_file("cmd-db", 0400, NULL, NULL, &cmd_db_debugfs_ops); in cmd_db_dev_probe()
366 device_set_pm_not_required(&pdev->dev); in cmd_db_dev_probe()
372 { .compatible = "qcom,cmd-db" },
380 .name = "cmd-db",