qld_api.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. * DOC: qld_api.h
  20. * QLD: This file provides public exposed functions
  21. */
  22. #ifndef _QLD_API_H_
  23. #define _QLD_API_H_
  24. #define QLD_MAX_NAME 48
  25. /**
  26. * struct qld_entry - Individual entry in qld_event
  27. * @addr: Start address of object to dump
  28. * @size: Size of memory dump
  29. * @name: Name of memory dump
  30. */
  31. struct qld_entry {
  32. uint64_t addr;
  33. size_t size;
  34. char name[QLD_MAX_NAME];
  35. };
  36. /**
  37. * typedef qld_iter_func - qld callback function
  38. * @req: opaque pointer
  39. * @qld_entry: qld_entry
  40. *
  41. * Return: 0 - OK -EINVAL - On failure
  42. */
  43. typedef int (*qld_iter_func)(void *req, struct qld_entry *entry);
  44. /**
  45. * qld_iterate_list() - qld list iteration routine
  46. * @gen_table: callback function to genrate table
  47. * @req: opaque request
  48. *
  49. * Return: 0 - OK -EINVAL - On failure
  50. */
  51. int qld_iterate_list(qld_iter_func gen_table, void *req);
  52. /**
  53. * qld_register() - Register qld for the given address
  54. * @addr: starting address the dump
  55. * @size: size of memory to dump
  56. * @name: name identifier of dump
  57. *
  58. * Return: 0 - OK -EINVAL -ENOMEM - On failure
  59. */
  60. int qld_register(void *addr, size_t size, char *name);
  61. /**
  62. * qld_unregister() - Un-register qld for the given address
  63. * @addr: starting address the dump
  64. *
  65. * Return: 0 - OK -EINVAL - On failure
  66. */
  67. int qld_unregister(void *addr);
  68. /**
  69. * qld_list_init() - Initialize qld list
  70. * @max_list: maximum size list supports
  71. *
  72. * Return: 0 - OK -EINVAL -ENOMEM - On failure
  73. */
  74. int qld_list_init(uint32_t max_list);
  75. /**
  76. * qld_list_delete() - empty qld list
  77. *
  78. * Return: 0 - OK -EINVAL - On failure
  79. */
  80. int qld_list_delete(void);
  81. /**
  82. * qld_list_deinit() - De-initialize qld list
  83. *
  84. * Return: 0 - OK -EINVAL - On failure
  85. */
  86. int qld_list_deinit(void);
  87. /**
  88. * qld_get_list_count () - get size of qld list
  89. * @list_count: list_count to set
  90. *
  91. * Return: 0 - OK -EINVAL - On failure
  92. */
  93. int qld_get_list_count(uint32_t *list_count);
  94. /**
  95. * is_qld_enable() - check if qld feature is set
  96. *
  97. * Return: true on success, false on failure
  98. */
  99. bool is_qld_enable(void);
  100. #endif /* _QLD_API_H_ */