IClientEnv.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
  2. /*
  3. *
  4. * Copyright (c) 2021 The Linux Foundation. All rights reserved.
  5. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  6. */
  7. #define IClientEnv_OP_open 0
  8. #define IClientEnv_OP_registerLegacy 1
  9. #define IClientEnv_OP_register 2
  10. #define IClientEnv_OP_registerWithWhitelist 3
  11. #define IClientEnv_OP_notifyDomainChange 4
  12. #define IClientEnv_OP_registerWithCredentials 5
  13. #define IClientEnv_OP_loadCmnlibFromBuffer 6
  14. #define IClientEnv_OP_configTaRegion 7
  15. #define IClientEnv_OP_adciAccept 8
  16. #define IClientEnv_OP_adciShutdown 9
  17. #include "smcinvoke_object.h"
  18. static inline int32_t
  19. IClientEnv_release(struct Object self)
  20. {
  21. return Object_invoke(self, Object_OP_release, 0, 0);
  22. }
  23. static inline int32_t
  24. IClientEnv_retain(struct Object self)
  25. {
  26. return Object_invoke(self, Object_OP_retain, 0, 0);
  27. }
  28. static inline int32_t
  29. IClientEnv_open(struct Object self, uint32_t uid_val, struct Object *obj_ptr)
  30. {
  31. union ObjectArg a[2];
  32. int32_t result;
  33. a[0].b = (struct ObjectBuf) { &uid_val, sizeof(uint32_t) };
  34. result = Object_invoke(self, IClientEnv_OP_open, a, ObjectCounts_pack(1, 0, 0, 1));
  35. *obj_ptr = a[1].o;
  36. return result;
  37. }
  38. static inline int32_t
  39. IClientEnv_registerLegacy(struct Object self, const void *credentials_ptr, size_t credentials_len,
  40. struct Object *clientEnv_ptr)
  41. {
  42. union ObjectArg a[2];
  43. int32_t result;
  44. a[0].bi = (struct ObjectBufIn) { credentials_ptr, credentials_len * 1 };
  45. result = Object_invoke(self, IClientEnv_OP_registerLegacy, a,
  46. ObjectCounts_pack(1, 0, 0, 1));
  47. *clientEnv_ptr = a[1].o;
  48. return result;
  49. }
  50. static inline int32_t
  51. IClientEnv_register(struct Object self, struct Object credentials_val,
  52. struct Object *clientEnv_ptr)
  53. {
  54. union ObjectArg a[2];
  55. int32_t result;
  56. a[0].o = credentials_val;
  57. result = Object_invoke(self, IClientEnv_OP_register, a,
  58. ObjectCounts_pack(0, 0, 1, 1));
  59. *clientEnv_ptr = a[1].o;
  60. return result;
  61. }
  62. static inline int32_t
  63. IClientEnv_registerWithWhitelist(struct Object self,
  64. struct Object credentials_val, const uint32_t *uids_ptr,
  65. size_t uids_len, struct Object *clientEnv_ptr)
  66. {
  67. union ObjectArg a[3];
  68. int32_t result;
  69. a[1].o = credentials_val;
  70. a[0].bi = (struct ObjectBufIn) { uids_ptr, uids_len *
  71. sizeof(uint32_t) };
  72. result = Object_invoke(self, IClientEnv_OP_registerWithWhitelist, a,
  73. ObjectCounts_pack(1, 0, 1, 1));
  74. *clientEnv_ptr = a[2].o;
  75. return result;
  76. }
  77. static inline int32_t
  78. IClientEnv_notifyDomainChange(struct Object self)
  79. {
  80. return Object_invoke(self, IClientEnv_OP_notifyDomainChange, 0, 0);
  81. }
  82. static inline int32_t
  83. IClientEnv_registerWithCredentials(struct Object self, struct Object
  84. credentials_val, struct Object *clientEnv_ptr)
  85. {
  86. union ObjectArg a[2]={{{0,0}}};
  87. int32_t result;
  88. a[0].o = credentials_val;
  89. result = Object_invoke(self, IClientEnv_OP_registerWithCredentials, a,
  90. ObjectCounts_pack(0, 0, 1, 1));
  91. *clientEnv_ptr = a[1].o;
  92. return result;
  93. }
  94. static inline int32_t
  95. IClientEnv_loadCmnlibFromBuffer(struct Object self, const void *cmnlibElf_ptr, size_t cmnlibElf_len)
  96. {
  97. union ObjectArg a[1]={{{0,0}}};
  98. a[0].bi = (struct ObjectBufIn) { cmnlibElf_ptr, cmnlibElf_len * 1 };
  99. return Object_invoke(self, IClientEnv_OP_loadCmnlibFromBuffer, a, ObjectCounts_pack(1, 0, 0, 0));
  100. }
  101. static inline int32_t
  102. IClientEnv_configTaRegion(struct Object self, uint64_t appRgnAddr_val, uint32_t appRgnSize_val)
  103. {
  104. union ObjectArg a[1]={{{0,0}}};
  105. struct {
  106. uint64_t m_appRgnAddr;
  107. uint32_t m_appRgnSize;
  108. } i;
  109. a[0].b = (struct ObjectBuf) { &i, 12 };
  110. i.m_appRgnAddr = appRgnAddr_val;
  111. i.m_appRgnSize = appRgnSize_val;
  112. return Object_invoke(self, IClientEnv_OP_configTaRegion, a, ObjectCounts_pack(1, 0, 0, 0));
  113. }
  114. static inline int32_t
  115. IClientEnv_adciAccept(struct Object self)
  116. {
  117. return Object_invoke(self, IClientEnv_OP_adciAccept, 0, 0);
  118. }
  119. static inline int32_t
  120. IClientEnv_adciShutdown(struct Object self)
  121. {
  122. return Object_invoke(self, IClientEnv_OP_adciShutdown, 0, 0);
  123. }