qal_devnode.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Copyright (c) 2021 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: qal_devnode
  20. * QCA driver framework for device node related APIs prototype
  21. */
  22. #ifndef __QAL_DEVNODE_H
  23. #define __QAL_DEVNODE_H
  24. /* Include Files */
  25. #include "qdf_types.h"
  26. #include "qdf_trace.h"
  27. #include "i_qal_devnode.h"
  28. #define PCI_DOMAIN_ID_MIN 0x0000
  29. #define PCI_DOMAIN_ID_MAX 0xFFFF
  30. typedef __qdf_devnode_t qdf_devnode_t;
  31. #ifdef ENHANCED_OS_ABSTRACTION
  32. /**
  33. * qal_devnode_read_u32_array() - Find and read an array of 32 bit integers
  34. * from a property.
  35. * @devnode: device node from which the property value is to be read.
  36. * @pname: name of the property to be searched.
  37. * @u32_val: pointer to return value, modified only if return value is 0.
  38. * @elem: number of array elements to read
  39. *
  40. * Return: QDF_STATUS_SUCCESS on success, error code
  41. */
  42. QDF_STATUS
  43. qal_devnode_read_u32_array(const qdf_devnode_t devnode,
  44. const char *pname, uint32_t *u32_val, size_t elem);
  45. /**
  46. * qal_devnode_read_u32() - Find and read 32 bit integer from a property.
  47. * @devnode: device node from which the property value is to be read.
  48. * @pname: name of the property to be searched.
  49. * @u32_val: pointer to return value, modified only if return value is 0.
  50. *
  51. * Return: QDF_STATUS_SUCCESS on success, error code
  52. */
  53. QDF_STATUS
  54. qal_devnode_read_u32(const qdf_devnode_t devnode,
  55. const char *pname, uint32_t *u32_val);
  56. #else
  57. static inline QDF_STATUS
  58. qal_devnode_read_u32_array(const qdf_devnode_t devnode,
  59. const char *pname, uint32_t *u32_val, size_t elem)
  60. {
  61. return __qal_devnode_read_u32_array(devnode, pname, u32_val, elem);
  62. }
  63. static inline QDF_STATUS
  64. qal_devnode_read_u32(const qdf_devnode_t devnode,
  65. const char *pname, uint32_t *u32_val)
  66. {
  67. return __qal_devnode_read_u32(devnode, pname, u32_val);
  68. }
  69. #endif
  70. #endif /* __QAL_DEVNODE_H */