smcinvoke_object.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef __SMCINVOKE_OBJECT_H
  13. #define __SMCINVOKE_OBJECT_H
  14. #include <linux/types.h>
  15. #define object_op_METHOD_MASK ((uint32_t)0x0000FFFFu)
  16. #define object_op_RELEASE (object_op_METHOD_MASK - 0)
  17. #define object_op_RETAIN (object_op_METHOD_MASK - 1)
  18. #define object_counts_max_BI 0xF
  19. #define object_counts_max_BO 0xF
  20. #define object_counts_max_OI 0xF
  21. #define object_counts_max_OO 0xF
  22. /* unpack counts */
  23. #define object_counts_num_BI(k) ((size_t) (((k) >> 0) & object_counts_max_BI))
  24. #define object_counts_num_BO(k) ((size_t) (((k) >> 4) & object_counts_max_BO))
  25. #define object_counts_num_OI(k) ((size_t) (((k) >> 8) & object_counts_max_OI))
  26. #define object_counts_num_OO(k) ((size_t) (((k) >> 12) & object_counts_max_OO))
  27. #define object_counts_num_buffers(k) \
  28. (object_counts_num_BI(k) + object_counts_num_BO(k))
  29. #define object_counts_num_objects(k) \
  30. (object_counts_num_OI(k) + object_counts_num_OO(k))
  31. /* Indices into args[] */
  32. #define object_counts_index_BI(k) 0
  33. #define object_counts_index_BO(k) \
  34. (object_counts_index_BI(k) + object_counts_num_BI(k))
  35. #define object_counts_index_OI(k) \
  36. (object_counts_index_BO(k) + object_counts_num_BO(k))
  37. #define object_counts_index_OO(k) \
  38. (object_counts_index_OI(k) + object_counts_num_OI(k))
  39. #define object_counts_total(k) \
  40. (object_counts_index_OO(k) + object_counts_num_OO(k))
  41. #endif /* __SMCINVOKE_OBJECT_H */