IAppController.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /* SPDX-License-Identifier: GPL-2.0-only
  2. *
  3. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. /** @cond */
  6. #pragma once
  7. #include "smcinvoke_object.h"
  8. #define IAppController_CBO_INTERFACE_WAIT UINT32_C(1)
  9. #define IAppController_ERROR_APP_SUSPENDED INT32_C(10)
  10. #define IAppController_ERROR_APP_BLOCKED_ON_LISTENER INT32_C(11)
  11. #define IAppController_ERROR_APP_UNLOADED INT32_C(12)
  12. #define IAppController_ERROR_APP_IN_USE INT32_C(13)
  13. #define IAppController_ERROR_NOT_SUPPORTED INT32_C(14)
  14. #define IAppController_ERROR_CBO_UNKNOWN INT32_C(15)
  15. #define IAppController_ERROR_APP_UNLOAD_NOT_ALLOWED INT32_C(16)
  16. #define IAppController_ERROR_APP_DISCONNECTED INT32_C(17)
  17. #define IAppController_ERROR_USER_DISCONNECT_REJECTED INT32_C(18)
  18. #define IAppController_ERROR_STILL_RUNNING INT32_C(19)
  19. #define IAppController_OP_openSession 0
  20. #define IAppController_OP_unload 1
  21. #define IAppController_OP_getAppObject 2
  22. #define IAppController_OP_installCBO 3
  23. #define IAppController_OP_disconnect 4
  24. #define IAppController_OP_restart 5
  25. static inline int32_t
  26. IAppController_release(struct Object self)
  27. {
  28. return Object_invoke(self, Object_OP_release, 0, 0);
  29. }
  30. static inline int32_t
  31. IAppController_retain(struct Object self)
  32. {
  33. return Object_invoke(self, Object_OP_retain, 0, 0);
  34. }
  35. static inline int32_t
  36. IAppController_openSession(struct Object self, uint32_t cancelCode_val, uint32_t connectionMethod_val, uint32_t connectionData_val, uint32_t paramTypes_val, uint32_t exParamTypes_val, const void *i1_ptr, size_t i1_len, const void *i2_ptr, size_t i2_len, const void *i3_ptr, size_t i3_len, const void *i4_ptr, size_t i4_len, void *o1_ptr, size_t o1_len, size_t *o1_lenout, void *o2_ptr, size_t o2_len, size_t *o2_lenout, void *o3_ptr, size_t o3_len, size_t *o3_lenout, void *o4_ptr, size_t o4_len, size_t *o4_lenout,struct Object imem1_val,struct Object imem2_val,struct Object imem3_val,struct Object imem4_val, uint32_t *memrefOutSz1_ptr, uint32_t *memrefOutSz2_ptr, uint32_t *memrefOutSz3_ptr, uint32_t *memrefOutSz4_ptr,struct Object *session_ptr, uint32_t *retValue_ptr, uint32_t *retOrigin_ptr)
  37. {
  38. union ObjectArg a[15];
  39. struct {
  40. uint32_t m_cancelCode;
  41. uint32_t m_connectionMethod;
  42. uint32_t m_connectionData;
  43. uint32_t m_paramTypes;
  44. uint32_t m_exParamTypes;
  45. } i;
  46. struct {
  47. uint32_t m_memrefOutSz1;
  48. uint32_t m_memrefOutSz2;
  49. uint32_t m_memrefOutSz3;
  50. uint32_t m_memrefOutSz4;
  51. uint32_t m_retValue;
  52. uint32_t m_retOrigin;
  53. } o;
  54. int32_t result;
  55. a[0].b = (struct ObjectBuf) { &i, 20 };
  56. a[5].b = (struct ObjectBuf) { &o, 24 };
  57. i.m_cancelCode = cancelCode_val;
  58. i.m_connectionMethod = connectionMethod_val;
  59. i.m_connectionData = connectionData_val;
  60. i.m_paramTypes = paramTypes_val;
  61. i.m_exParamTypes = exParamTypes_val;
  62. a[1].bi = (struct ObjectBufIn) { i1_ptr, i1_len * 1 };
  63. a[2].bi = (struct ObjectBufIn) { i2_ptr, i2_len * 1 };
  64. a[3].bi = (struct ObjectBufIn) { i3_ptr, i3_len * 1 };
  65. a[4].bi = (struct ObjectBufIn) { i4_ptr, i4_len * 1 };
  66. a[6].b = (struct ObjectBuf) { o1_ptr, o1_len * 1 };
  67. a[7].b = (struct ObjectBuf) { o2_ptr, o2_len * 1 };
  68. a[8].b = (struct ObjectBuf) { o3_ptr, o3_len * 1 };
  69. a[9].b = (struct ObjectBuf) { o4_ptr, o4_len * 1 };
  70. a[10].o = imem1_val;
  71. a[11].o = imem2_val;
  72. a[12].o = imem3_val;
  73. a[13].o = imem4_val;
  74. result = Object_invoke(self, IAppController_OP_openSession, a, ObjectCounts_pack(5, 5, 4, 1));
  75. *o1_lenout = a[6].b.size / 1;
  76. *o2_lenout = a[7].b.size / 1;
  77. *o3_lenout = a[8].b.size / 1;
  78. *o4_lenout = a[9].b.size / 1;
  79. *memrefOutSz1_ptr = o.m_memrefOutSz1;
  80. *memrefOutSz2_ptr = o.m_memrefOutSz2;
  81. *memrefOutSz3_ptr = o.m_memrefOutSz3;
  82. *memrefOutSz4_ptr = o.m_memrefOutSz4;
  83. *session_ptr = a[14].o;
  84. *retValue_ptr = o.m_retValue;
  85. *retOrigin_ptr = o.m_retOrigin;
  86. return result;
  87. }
  88. static inline int32_t
  89. IAppController_unload(struct Object self)
  90. {
  91. return Object_invoke(self, IAppController_OP_unload, 0, 0);
  92. }
  93. static inline int32_t
  94. IAppController_getAppObject(struct Object self,struct Object *obj_ptr)
  95. {
  96. union ObjectArg a[1];
  97. int32_t result = Object_invoke(self, IAppController_OP_getAppObject, a, ObjectCounts_pack(0, 0, 0, 1));
  98. *obj_ptr = a[0].o;
  99. return result;
  100. }
  101. static inline int32_t
  102. IAppController_installCBO(struct Object self, uint32_t uid_val,struct Object obj_val)
  103. {
  104. union ObjectArg a[2];
  105. a[0].b = (struct ObjectBuf) { &uid_val, sizeof(uint32_t) };
  106. a[1].o = obj_val;
  107. return Object_invoke(self, IAppController_OP_installCBO, a, ObjectCounts_pack(1, 0, 1, 0));
  108. }
  109. static inline int32_t
  110. IAppController_disconnect(struct Object self)
  111. {
  112. return Object_invoke(self, IAppController_OP_disconnect, 0, 0);
  113. }
  114. static inline int32_t
  115. IAppController_restart(struct Object self)
  116. {
  117. return Object_invoke(self, IAppController_OP_restart, 0, 0);
  118. }