ipa_rm_peers_list.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _IPA_RM_PEERS_LIST_H_
  6. #define _IPA_RM_PEERS_LIST_H_
  7. #include "ipa_rm_resource.h"
  8. struct ipa_rm_resource_peer {
  9. struct ipa_rm_resource *resource;
  10. bool userspace_dep;
  11. };
  12. /**
  13. * struct ipa_rm_peers_list - IPA RM resource peers list
  14. * @peers: the list of references to resources dependent on this resource
  15. * in case of producer or list of dependencies in case of consumer
  16. * @max_peers: maximum number of peers for this resource
  17. * @peers_count: actual number of peers for this resource
  18. */
  19. struct ipa_rm_peers_list {
  20. struct ipa_rm_resource_peer *peers;
  21. int max_peers;
  22. int peers_count;
  23. };
  24. int ipa_rm_peers_list_create(int max_peers,
  25. struct ipa_rm_peers_list **peers_list);
  26. void ipa_rm_peers_list_delete(struct ipa_rm_peers_list *peers_list);
  27. void ipa_rm_peers_list_remove_peer(
  28. struct ipa_rm_peers_list *peers_list,
  29. enum ipa_rm_resource_name resource_name);
  30. void ipa_rm_peers_list_add_peer(
  31. struct ipa_rm_peers_list *peers_list,
  32. struct ipa_rm_resource *resource,
  33. bool userspace_dep);
  34. bool ipa_rm_peers_list_check_dependency(
  35. struct ipa_rm_peers_list *resource_peers,
  36. enum ipa_rm_resource_name resource_name,
  37. struct ipa_rm_peers_list *depends_on_peers,
  38. enum ipa_rm_resource_name depends_on_name,
  39. bool *userspace_dep);
  40. struct ipa_rm_resource *ipa_rm_peers_list_get_resource(int resource_index,
  41. struct ipa_rm_peers_list *peers_list);
  42. bool ipa_rm_peers_list_get_userspace_dep(int resource_index,
  43. struct ipa_rm_peers_list *resource_peers);
  44. int ipa_rm_peers_list_get_size(struct ipa_rm_peers_list *peers_list);
  45. bool ipa_rm_peers_list_is_empty(struct ipa_rm_peers_list *peers_list);
  46. bool ipa_rm_peers_list_has_last_peer(
  47. struct ipa_rm_peers_list *peers_list);
  48. #endif /* _IPA_RM_PEERS_LIST_H_ */