IOpener.h 992 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. /** 0 is not a valid service ID. */
  9. #define IOpener_INVALID_ID UINT32_C(0)
  10. #define IOpener_ERROR_NOT_FOUND INT32_C(10)
  11. #define IOpener_ERROR_PRIVILEGE INT32_C(11)
  12. #define IOpener_ERROR_NOT_SUPPORTED INT32_C(12)
  13. #define IOpener_OP_open 0
  14. static inline int32_t
  15. IOpener_release(struct Object self)
  16. {
  17. return Object_invoke(self, Object_OP_release, 0, 0);
  18. }
  19. static inline int32_t
  20. IOpener_retain(struct Object self)
  21. {
  22. return Object_invoke(self, Object_OP_retain, 0, 0);
  23. }
  24. static inline int32_t
  25. IOpener_open(struct Object self, uint32_t id_val,struct Object *obj_ptr)
  26. {
  27. union ObjectArg a[2];
  28. int32_t result;
  29. a[0].b = (struct ObjectBuf) { &id_val, sizeof(uint32_t) };
  30. result = Object_invoke(self, IOpener_OP_open, a, ObjectCounts_pack(1, 0, 0, 1));
  31. *obj_ptr = a[1].o;
  32. return result;
  33. }