qdf_dev.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * Copyright (c) 2018-2020 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: qdf_dev
  20. * QCA driver framework (QDF) device management APIs
  21. */
  22. #if !defined(__QDF_DEV_H)
  23. #define __QDF_DEV_H
  24. /* Include Files */
  25. #include <qdf_types.h>
  26. #include "i_qdf_dev.h"
  27. #define qdf_cpumask_pr_args(maskp) __qdf_cpumask_pr_args(maskp)
  28. #define qdf_for_each_possible_cpu(cpu) __qdf_for_each_possible_cpu(cpu)
  29. #define qdf_for_each_online_cpu(cpu) __qdf_for_each_online_cpu(cpu)
  30. #define qdf_for_each_cpu(cpu, maskp) __qdf_for_each_cpu(cpu, maskp)
  31. #define qdf_for_each_cpu_not(cpu, maskp) \
  32. __qdf_for_each_cpu_not(cpu, maskp)
  33. #ifdef ENHANCED_OS_ABSTRACTION
  34. /**
  35. * qdf_dev_alloc_mem() - allocate memory
  36. * @qdfdev: Device handle
  37. * @mrptr: Pointer to the allocated memory
  38. * @reqsize: Allocation request in bytes
  39. * @mask: Property mask to be associated to the allocated memory
  40. *
  41. * This function will acquire memory to be associated with a device
  42. *
  43. * Return: QDF_STATUS_SUCCESS on success
  44. */
  45. QDF_STATUS
  46. qdf_dev_alloc_mem(struct qdf_dev *qdfdev, struct qdf_devm **mrptr,
  47. uint32_t reqsize, uint32_t mask);
  48. /**
  49. * qdf_dev_release_mem() - release memory
  50. * @qdfdev: Device handle
  51. * @mrptr: Pointer to the allocated memory
  52. *
  53. * This function will acquire memory to be associated with a device
  54. *
  55. * Return: QDF_STATUS_SUCCESS on success
  56. */
  57. QDF_STATUS
  58. qdf_dev_release_mem(struct qdf_dev *qdfdev, struct qdf_devm *mrptr);
  59. /**
  60. * qdf_dev_modify_irq() - modify irq
  61. * @irnum: irq number
  62. * @cmask: Bitmap to be cleared for the property mask
  63. * @smask: Bitmap to be set for the property mask
  64. *
  65. * This function will acquire memory to be associated with a device
  66. *
  67. * Return: QDF_STATUS_SUCCESS on success
  68. */
  69. QDF_STATUS
  70. qdf_dev_modify_irq_status(uint32_t irnum, unsigned long cmask,
  71. unsigned long smask);
  72. /**
  73. * qdf_dev_set_irq_affinity() - set irq affinity
  74. * @irnum: irq number
  75. * @cpmask: cpu affinity bitmap
  76. *
  77. * This function will set the affinity level for an irq
  78. *
  79. * Return: QDF_STATUS_SUCCESS on success
  80. */
  81. QDF_STATUS
  82. qdf_dev_set_irq_affinity(uint32_t irnum, struct qdf_cpu_mask *cpmask);
  83. #else
  84. static inline QDF_STATUS
  85. qdf_dev_alloc_mem(struct qdf_dev *qdfdev, struct qdf_devm **mrptr,
  86. uint32_t reqsize, uint32_t mask)
  87. {
  88. return __qdf_dev_alloc_mem(qdfdev, mrptr, reqsize, mask);
  89. }
  90. static inline QDF_STATUS
  91. qdf_dev_release_mem(struct qdf_dev *qdfdev, struct qdf_devm *mrptr)
  92. {
  93. return __qdf_dev_release_mem(qdfdev, mrptr);
  94. }
  95. static inline QDF_STATUS
  96. qdf_dev_modify_irq_status(uint32_t irnum, unsigned long cmask,
  97. unsigned long smask)
  98. {
  99. return __qdf_dev_modify_irq_status(irnum, cmask, smask);
  100. }
  101. static inline QDF_STATUS
  102. qdf_dev_set_irq_affinity(uint32_t irnum, struct qdf_cpu_mask *cpmask)
  103. {
  104. return __qdf_dev_set_irq_affinity(irnum, cpmask);
  105. }
  106. #endif
  107. static inline int qdf_topology_physical_package_id(unsigned int cpu)
  108. {
  109. return __qdf_topology_physical_package_id(cpu);
  110. }
  111. static inline int qdf_cpumask_subset(qdf_cpu_mask *srcp1,
  112. const qdf_cpu_mask *srcp2)
  113. {
  114. return __qdf_cpumask_subset(srcp1, srcp2);
  115. }
  116. static inline int qdf_cpumask_intersects(qdf_cpu_mask *srcp1,
  117. const qdf_cpu_mask *srcp2)
  118. {
  119. return __qdf_cpumask_intersects(srcp1, srcp2);
  120. }
  121. static inline int qdf_core_ctl_set_boost(bool boost)
  122. {
  123. return __qdf_core_ctl_set_boost(boost);
  124. }
  125. #endif /* __QDF_DEV_H */