qld_api.h 2.9 KB

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