IQSEEComCompat.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* SPDX-License-Identifier: GPL-2.0-only
  2. *
  3. * Copyright (c) 2021 The Linux Foundation. All rights reserved.
  4. */
  5. #include "smcinvoke_object.h"
  6. #define IQSEEComCompat_ERROR_APP_UNAVAILABLE INT32_C(10)
  7. #define IQSEEComCompat_OP_sendRequest 0
  8. #define IQSEEComCompat_OP_disconnect 1
  9. #define IQSEEComCompat_OP_unload 2
  10. static inline int32_t
  11. IQSEEComCompat_release(struct Object self)
  12. {
  13. return Object_invoke(self, Object_OP_release, 0, 0);
  14. }
  15. static inline int32_t
  16. IQSEEComCompat_retain(struct Object self)
  17. {
  18. return Object_invoke(self, Object_OP_retain, 0, 0);
  19. }
  20. static inline int32_t
  21. IQSEEComCompat_sendRequest(struct Object self,
  22. const void *reqIn_ptr, size_t reqIn_len,
  23. const void *rspIn_ptr, size_t rspIn_len,
  24. void *reqOut_ptr, size_t reqOut_len, size_t *reqOut_lenout,
  25. void *rspOut_ptr, size_t rspOut_len, size_t *rspOut_lenout,
  26. const uint32_t *embeddedBufOffsets_ptr,
  27. size_t embeddedBufOffsets_len, uint32_t is64_val,
  28. struct Object smo1_val, struct Object smo2_val,
  29. struct Object smo3_val, struct Object smo4_val)
  30. {
  31. union ObjectArg a[10];
  32. int32_t result;
  33. a[0].bi = (struct ObjectBufIn) { reqIn_ptr, reqIn_len * 1 };
  34. a[1].bi = (struct ObjectBufIn) { rspIn_ptr, rspIn_len * 1 };
  35. a[4].b = (struct ObjectBuf) { reqOut_ptr, reqOut_len * 1 };
  36. a[5].b = (struct ObjectBuf) { rspOut_ptr, rspOut_len * 1 };
  37. a[2].bi = (struct ObjectBufIn) { embeddedBufOffsets_ptr,
  38. embeddedBufOffsets_len * sizeof(uint32_t) };
  39. a[3].b = (struct ObjectBuf) { &is64_val, sizeof(uint32_t) };
  40. a[6].o = smo1_val;
  41. a[7].o = smo2_val;
  42. a[8].o = smo3_val;
  43. a[9].o = smo4_val;
  44. result = Object_invoke(self, IQSEEComCompat_OP_sendRequest, a,
  45. ObjectCounts_pack(4, 2, 4, 0));
  46. *reqOut_lenout = a[4].b.size / 1;
  47. *rspOut_lenout = a[5].b.size / 1;
  48. return result;
  49. }
  50. static inline int32_t
  51. IQSEEComCompat_disconnect(struct Object self)
  52. {
  53. return Object_invoke(self, IQSEEComCompat_OP_disconnect, 0, 0);
  54. }
  55. static inline int32_t
  56. IQSEEComCompat_unload(struct Object self)
  57. {
  58. return Object_invoke(self, IQSEEComCompat_OP_unload, 0, 0);
  59. }