Lines Matching +full:cmd +full:- +full:db
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. */
13 #include <soc/qcom/cmd-db.h>
57 * struct cmd_db_header: The DB header information
59 * @version: The cmd db version
76 * DOC: Description of the Command DB database.
78 * At the start of the command DB memory is the cmd_db_header structure.
98 const u8 *magic = header->magic; in cmd_db_magic_matches()
107 u16 offset = le16_to_cpu(hdr->header_offset); in rsc_to_entry_header()
109 return cmd_db_header->data + offset; in rsc_to_entry_header()
115 u16 offset = le16_to_cpu(hdr->data_offset); in rsc_offset()
116 u16 loffset = le16_to_cpu(ent->offset); in rsc_offset()
118 return cmd_db_header->data + offset + loffset; in rsc_offset()
122 * cmd_db_ready - Indicates if command DB is available
129 return -EPROBE_DEFER; in cmd_db_ready()
131 return -EINVAL; in cmd_db_ready()
149 /* Pad out query string to same length as in DB */ in cmd_db_get_header()
153 rsc_hdr = &cmd_db_header->header[i]; in cmd_db_get_header()
154 if (!rsc_hdr->slv_id) in cmd_db_get_header()
158 for (j = 0; j < le16_to_cpu(rsc_hdr->cnt); j++, ent++) { in cmd_db_get_header()
159 if (memcmp(ent->id, query, sizeof(ent->id)) == 0) { in cmd_db_get_header()
169 return -ENODEV; in cmd_db_get_header()
173 * cmd_db_read_addr() - Query command db for resource id address.
189 return ret < 0 ? 0 : le32_to_cpu(ent->addr); in cmd_db_read_addr()
194 * cmd_db_read_aux_data() - Query command db for aux data.
212 *len = le16_to_cpu(ent->len); in cmd_db_read_aux_data()
219 * cmd_db_read_slave_id - Get the slave ID for a given resource address
221 * @id: Resource id to query the DB for version
235 addr = le32_to_cpu(ent->addr); in cmd_db_read_slave_id()
250 seq_puts(seq, "Command DB DUMP\n"); in cmd_db_debugfs_dump()
253 rsc = &cmd_db_header->header[i]; in cmd_db_debugfs_dump()
254 if (!rsc->slv_id) in cmd_db_debugfs_dump()
257 switch (le16_to_cpu(rsc->slv_id)) { in cmd_db_debugfs_dump()
272 version = le16_to_cpu(rsc->version); in cmd_db_debugfs_dump()
277 seq_puts(seq, "-------------------------\n"); in cmd_db_debugfs_dump()
280 for (j = 0; j < le16_to_cpu(rsc->cnt); j++, ent++) { in cmd_db_debugfs_dump()
281 seq_printf(seq, "0x%05x: %*pEp", le32_to_cpu(ent->addr), in cmd_db_debugfs_dump()
282 (int)sizeof(ent->id), ent->id); in cmd_db_debugfs_dump()
284 len = le16_to_cpu(ent->len); in cmd_db_debugfs_dump()
298 return single_open(file, cmd_db_debugfs_dump, inode->i_private); in open_cmd_db_debugfs()
316 rmem = of_reserved_mem_lookup(pdev->dev.of_node); in cmd_db_dev_probe()
318 dev_err(&pdev->dev, "failed to acquire memory region\n"); in cmd_db_dev_probe()
319 return -EINVAL; in cmd_db_dev_probe()
322 cmd_db_header = memremap(rmem->base, rmem->size, MEMREMAP_WB); in cmd_db_dev_probe()
324 ret = -ENOMEM; in cmd_db_dev_probe()
330 dev_err(&pdev->dev, "Invalid Command DB Magic\n"); in cmd_db_dev_probe()
331 return -EINVAL; in cmd_db_dev_probe()
334 debugfs_create_file("cmd-db", 0400, NULL, NULL, &cmd_db_debugfs_ops); in cmd_db_dev_probe()
340 { .compatible = "qcom,cmd-db" },
347 .name = "cmd-db",