1 /* 2 * Copyright (c) 2019 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /** 20 * DOC: qld_api.h 21 * QLD: This file provides public exposed functions 22 */ 23 24 #ifndef _QLD_API_H_ 25 #define _QLD_API_H_ 26 27 #define QLD_MAX_NAME 48 28 29 /** 30 * struct qld_entry - Individual entry in qld_event 31 * @addr: Start address of object to dump 32 * @size: Size of memory dump 33 * @name: Name of memory dump 34 */ 35 struct qld_entry { 36 uint64_t addr; 37 size_t size; 38 char name[QLD_MAX_NAME]; 39 }; 40 41 /** 42 * typedef qld_iter_func - qld callback function 43 * @req: opaque pointer 44 * @qld_entry: qld_entry 45 * 46 * Return: 0 - OK -EINVAL - On failure 47 */ 48 typedef int (*qld_iter_func)(void *req, struct qld_entry *entry); 49 50 /** 51 * qld_iterate_list() - qld list iteration routine 52 * @gen_table: callback function to genrate table 53 * @req: opaque request 54 * 55 * Return: 0 - OK -EINVAL - On failure 56 */ 57 int qld_iterate_list(qld_iter_func gen_table, void *req); 58 59 /** 60 * qld_register() - Register qld for the given address 61 * @addr: starting address the dump 62 * @size: size of memory to dump 63 * @name: name identifier of dump 64 * 65 * Return: 0 - OK -EINVAL -ENOMEM - On failure 66 */ 67 int qld_register(void *addr, size_t size, char *name); 68 69 /** 70 * qld_unregister() - Un-register qld for the given address 71 * @addr: starting address the dump 72 * 73 * Return: 0 - OK -EINVAL - On failure 74 */ 75 int qld_unregister(void *addr); 76 77 /** 78 * qld_list_init() - Initialize qld list 79 * @max_list: maximum size list supports 80 * 81 * Return: 0 - OK -EINVAL -ENOMEM - On failure 82 */ 83 int qld_list_init(uint32_t max_list); 84 85 /** 86 * qld_list_delete() - empty qld list 87 * 88 * Return: 0 - OK -EINVAL - On failure 89 */ 90 int qld_list_delete(void); 91 92 /** 93 * qld_list_deinit() - De-initialize qld list 94 * 95 * Return: 0 - OK -EINVAL - On failure 96 */ 97 int qld_list_deinit(void); 98 99 /** 100 * qld_get_list_count () - get size of qld list 101 * @list_count: list_count to set 102 * 103 * Return: 0 - OK -EINVAL - On failure 104 */ 105 int qld_get_list_count(uint32_t *list_count); 106 107 /** 108 * is_qld_enable() - check if qld feature is set 109 * 110 * Return: true on success, false on failure 111 */ 112 bool is_qld_enable(void); 113 114 #endif /* _QLD_API_H_ */ 115