smci_qseecomcompatapploader.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* SPDX-License-Identifier: GPL-2.0-only
  2. *
  3. * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #ifndef __SMCI_QSEECOMCOMPATAPPLOADER_H
  6. #define __SMCI_QSEECOMCOMPATAPPLOADER_H
  7. #include "smci_object.h"
  8. #include "IQSEEComCompatAppLoader.h"
  9. #define SMCI_QSEECOMCOMPATAPPLOADER_MAX_FILENAME_LEN UINT32_C(64)
  10. #define SMCI_QSEECOMCOMPATAPPLOADER_ELFCLASS32 UINT32_C(1)
  11. #define SMCI_QSEECOMCOMPATAPPLOADER_ELFCLASS64 UINT32_C(2)
  12. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_INVALID_BUFFER INT32_C(10)
  13. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_PIL_ROLLBACK_FAILURE INT32_C(11)
  14. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_ELF_SIGNATURE_ERROR INT32_C(12)
  15. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_METADATA_INVALID INT32_C(13)
  16. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_MAX_NUM_APPS INT32_C(14)
  17. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_NO_NAME_IN_METADATA INT32_C(15)
  18. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_ALREADY_LOADED INT32_C(16)
  19. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_EMBEDDED_IMAGE_NOT_FOUND INT32_C(17)
  20. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_TZ_HEAP_MALLOC_FAILURE INT32_C(18)
  21. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_TA_APP_REGION_MALLOC_FAILURE INT32_C(19)
  22. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_CLIENT_CRED_PARSING_FAILURE INT32_C(20)
  23. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_APP_UNTRUSTED_CLIENT INT32_C(21)
  24. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_APP_BLACKLISTED INT32_C(22)
  25. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_APP_NOT_LOADED INT32_C(23)
  26. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_NOT_QSEECOM_COMPAT_APP INT32_C(24)
  27. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_FILENAME_TOO_LONG INT32_C(25)
  28. #define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_APP_ARCH_NOT_SUPPORTED INT32_C(26)
  29. #define SMCI_QSEECOMCOMPATAPPLOADER_OP_LOADFROMREGION 0
  30. #define SMCI_QSEECOMCOMPATAPPLOADER_OP_LOADFROMBUFFER 1
  31. #define SMCI_QSEECOMCOMPATAPPLOADER_OP_LOOKUPTA 2
  32. static inline int32_t
  33. smci_qseecomcompatapploader_release(struct smci_object self)
  34. {
  35. return IQSEEComCompatAppLoader_release(self);
  36. }
  37. static inline int32_t
  38. smci_qseecomcompatapploader_retain(struct smci_object self)
  39. {
  40. return IQSEEComCompatAppLoader_retain(self);
  41. }
  42. static inline int32_t
  43. smci_qseecomcompatapploader_loadfromregion(struct smci_object self,
  44. struct smci_object app_elf_val, const void *filename_ptr,
  45. size_t filename_len, struct smci_object *app_compat_ptr)
  46. {
  47. return IQSEEComCompatAppLoader_loadFromRegion(self,
  48. app_elf_val, filename_ptr,
  49. filename_len, app_compat_ptr);
  50. }
  51. static inline int32_t
  52. smci_qseecomcompatapploader_loadfrombuffer(struct smci_object self,
  53. const void *app_elf_ptr, size_t app_elf_len,
  54. const void *filename_ptr, size_t filename_len,
  55. void *dist_name_ptr, size_t dist_name_len,
  56. size_t *dist_name_lenout, struct smci_object *app_compat_ptr)
  57. {
  58. return IQSEEComCompatAppLoader_loadFromBuffer(self,
  59. app_elf_ptr, app_elf_len,
  60. filename_ptr, filename_len,
  61. dist_name_ptr, dist_name_len,
  62. dist_name_lenout, app_compat_ptr);
  63. }
  64. static inline int32_t
  65. smci_qseecomcompatapploader_lookupta(struct smci_object self, const void *app_name_ptr,
  66. size_t app_name_len, struct smci_object *app_compat_ptr)
  67. {
  68. return IQSEEComCompatAppLoader_lookupTA(self, app_name_ptr,
  69. app_name_len, app_compat_ptr);
  70. }
  71. #endif /* __SMCI_QSEECOMCOMPATAPPLOADER_H */