Lines Matching +full:cmd +full:- +full:db

1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2016-2018, 2020, The Linux Foundation. All rights reserved. */
14 #include <soc/qcom/cmd-db.h>
58 * struct cmd_db_header: The DB header information
60 * @version: The cmd db version
77 * DOC: Description of the Command DB database.
79 * At the start of the command DB memory is the cmd_db_header structure.
99 const u8 *magic = header->magic; in cmd_db_magic_matches()
108 u16 offset = le16_to_cpu(hdr->header_offset); in rsc_to_entry_header()
110 return cmd_db_header->data + offset; in rsc_to_entry_header()
116 u16 offset = le16_to_cpu(hdr->data_offset); in rsc_offset()
117 u16 loffset = le16_to_cpu(ent->offset); in rsc_offset()
119 return cmd_db_header->data + offset + loffset; in rsc_offset()
123 * cmd_db_ready - Indicates if command DB is available
130 return -EPROBE_DEFER; in cmd_db_ready()
132 return -EINVAL; in cmd_db_ready()
144 u8 query[sizeof(ent->id)] __nonstring; in cmd_db_get_header()
151 * Pad out query string to same length as in DB. NOTE: the output in cmd_db_get_header()
158 rsc_hdr = &cmd_db_header->header[i]; in cmd_db_get_header()
159 if (!rsc_hdr->slv_id) in cmd_db_get_header()
163 for (j = 0; j < le16_to_cpu(rsc_hdr->cnt); j++, ent++) { in cmd_db_get_header()
164 if (memcmp(ent->id, query, sizeof(ent->id)) == 0) { in cmd_db_get_header()
174 return -ENODEV; in cmd_db_get_header()
178 * cmd_db_read_addr() - Query command db for resource id address.
194 return ret < 0 ? 0 : le32_to_cpu(ent->addr); in cmd_db_read_addr()
199 * cmd_db_read_aux_data() - Query command db for aux data.
217 *len = le16_to_cpu(ent->len); in cmd_db_read_aux_data()
224 * cmd_db_read_slave_id - Get the slave ID for a given resource address
226 * @id: Resource id to query the DB for version
240 addr = le32_to_cpu(ent->addr); in cmd_db_read_slave_id()
255 seq_puts(seq, "Command DB DUMP\n"); in cmd_db_debugfs_dump()
258 rsc = &cmd_db_header->header[i]; in cmd_db_debugfs_dump()
259 if (!rsc->slv_id) in cmd_db_debugfs_dump()
262 switch (le16_to_cpu(rsc->slv_id)) { in cmd_db_debugfs_dump()
277 version = le16_to_cpu(rsc->version); in cmd_db_debugfs_dump()
282 seq_puts(seq, "-------------------------\n"); in cmd_db_debugfs_dump()
285 for (j = 0; j < le16_to_cpu(rsc->cnt); j++, ent++) { in cmd_db_debugfs_dump()
286 seq_printf(seq, "0x%05x: %*pEp", le32_to_cpu(ent->addr), in cmd_db_debugfs_dump()
287 (int)sizeof(ent->id), ent->id); in cmd_db_debugfs_dump()
289 len = le16_to_cpu(ent->len); in cmd_db_debugfs_dump()
303 return single_open(file, cmd_db_debugfs_dump, inode->i_private); in open_cmd_db_debugfs()
321 rmem = of_reserved_mem_lookup(pdev->dev.of_node); in cmd_db_dev_probe()
323 dev_err(&pdev->dev, "failed to acquire memory region\n"); in cmd_db_dev_probe()
324 return -EINVAL; in cmd_db_dev_probe()
327 cmd_db_header = memremap(rmem->base, rmem->size, MEMREMAP_WB); in cmd_db_dev_probe()
329 ret = -ENOMEM; in cmd_db_dev_probe()
335 dev_err(&pdev->dev, "Invalid Command DB Magic\n"); in cmd_db_dev_probe()
336 return -EINVAL; in cmd_db_dev_probe()
339 debugfs_create_file("cmd-db", 0400, NULL, NULL, &cmd_db_debugfs_ops); in cmd_db_dev_probe()
345 { .compatible = "qcom,cmd-db" },
353 .name = "cmd-db",
365 MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Command DB Driver");