rm.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2016 Freescale Semiconductor, Inc.
  4. * Copyright 2017-2020 NXP
  5. *
  6. * Header file containing the public API for the System Controller (SC)
  7. * Resource Management (RM) function. This includes functions for
  8. * partitioning resources, pads, and memory regions.
  9. *
  10. * RM_SVC (SVC) Resource Management Service
  11. *
  12. * Module for the Resource Management (RM) service.
  13. */
  14. #ifndef _SC_RM_API_H
  15. #define _SC_RM_API_H
  16. #include <linux/firmware/imx/sci.h>
  17. /*
  18. * This type is used to indicate RPC RM function calls.
  19. */
  20. enum imx_sc_rm_func {
  21. IMX_SC_RM_FUNC_UNKNOWN = 0,
  22. IMX_SC_RM_FUNC_PARTITION_ALLOC = 1,
  23. IMX_SC_RM_FUNC_SET_CONFIDENTIAL = 31,
  24. IMX_SC_RM_FUNC_PARTITION_FREE = 2,
  25. IMX_SC_RM_FUNC_GET_DID = 26,
  26. IMX_SC_RM_FUNC_PARTITION_STATIC = 3,
  27. IMX_SC_RM_FUNC_PARTITION_LOCK = 4,
  28. IMX_SC_RM_FUNC_GET_PARTITION = 5,
  29. IMX_SC_RM_FUNC_SET_PARENT = 6,
  30. IMX_SC_RM_FUNC_MOVE_ALL = 7,
  31. IMX_SC_RM_FUNC_ASSIGN_RESOURCE = 8,
  32. IMX_SC_RM_FUNC_SET_RESOURCE_MOVABLE = 9,
  33. IMX_SC_RM_FUNC_SET_SUBSYS_RSRC_MOVABLE = 28,
  34. IMX_SC_RM_FUNC_SET_MASTER_ATTRIBUTES = 10,
  35. IMX_SC_RM_FUNC_SET_MASTER_SID = 11,
  36. IMX_SC_RM_FUNC_SET_PERIPHERAL_PERMISSIONS = 12,
  37. IMX_SC_RM_FUNC_IS_RESOURCE_OWNED = 13,
  38. IMX_SC_RM_FUNC_GET_RESOURCE_OWNER = 33,
  39. IMX_SC_RM_FUNC_IS_RESOURCE_MASTER = 14,
  40. IMX_SC_RM_FUNC_IS_RESOURCE_PERIPHERAL = 15,
  41. IMX_SC_RM_FUNC_GET_RESOURCE_INFO = 16,
  42. IMX_SC_RM_FUNC_MEMREG_ALLOC = 17,
  43. IMX_SC_RM_FUNC_MEMREG_SPLIT = 29,
  44. IMX_SC_RM_FUNC_MEMREG_FRAG = 32,
  45. IMX_SC_RM_FUNC_MEMREG_FREE = 18,
  46. IMX_SC_RM_FUNC_FIND_MEMREG = 30,
  47. IMX_SC_RM_FUNC_ASSIGN_MEMREG = 19,
  48. IMX_SC_RM_FUNC_SET_MEMREG_PERMISSIONS = 20,
  49. IMX_SC_RM_FUNC_IS_MEMREG_OWNED = 21,
  50. IMX_SC_RM_FUNC_GET_MEMREG_INFO = 22,
  51. IMX_SC_RM_FUNC_ASSIGN_PAD = 23,
  52. IMX_SC_RM_FUNC_SET_PAD_MOVABLE = 24,
  53. IMX_SC_RM_FUNC_IS_PAD_OWNED = 25,
  54. IMX_SC_RM_FUNC_DUMP = 27,
  55. };
  56. #if IS_ENABLED(CONFIG_IMX_SCU)
  57. bool imx_sc_rm_is_resource_owned(struct imx_sc_ipc *ipc, u16 resource);
  58. int imx_sc_rm_get_resource_owner(struct imx_sc_ipc *ipc, u16 resource, u8 *pt);
  59. #else
  60. static inline bool
  61. imx_sc_rm_is_resource_owned(struct imx_sc_ipc *ipc, u16 resource)
  62. {
  63. return true;
  64. }
  65. static inline int imx_sc_rm_get_resource_owner(struct imx_sc_ipc *ipc, u16 resource, u8 *pt)
  66. {
  67. return -EOPNOTSUPP;
  68. }
  69. #endif
  70. #endif