scmi_test.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2020, Linaro Limited
  4. */
  5. #ifndef __SANDBOX_SCMI_TEST_H
  6. #define __SANDBOX_SCMI_TEST_H
  7. struct udevice;
  8. struct sandbox_scmi_agent;
  9. struct sandbox_scmi_service;
  10. /**
  11. * struct sandbox_scmi_clk - Simulated clock exposed by SCMI
  12. * @id: Identifier of the clock used in the SCMI protocol
  13. * @enabled: Clock state: true if enabled, false if disabled
  14. * @rate: Clock rate in Hertz
  15. */
  16. struct sandbox_scmi_clk {
  17. uint id;
  18. bool enabled;
  19. ulong rate;
  20. };
  21. /**
  22. * struct sandbox_scmi_reset - Simulated reset controller exposed by SCMI
  23. * @asserted: Reset control state: true if asserted, false if desasserted
  24. */
  25. struct sandbox_scmi_reset {
  26. uint id;
  27. bool asserted;
  28. };
  29. /**
  30. * struct sandbox_scmi_agent - Simulated SCMI service seen by SCMI agent
  31. * @idx: Identifier for the SCMI agent, its index
  32. * @clk: Simulated clocks
  33. * @clk_count: Simulated clocks array size
  34. * @clk: Simulated reset domains
  35. * @clk_count: Simulated reset domains array size
  36. */
  37. struct sandbox_scmi_agent {
  38. uint idx;
  39. struct sandbox_scmi_clk *clk;
  40. size_t clk_count;
  41. struct sandbox_scmi_reset *reset;
  42. size_t reset_count;
  43. };
  44. /**
  45. * struct sandbox_scmi_service - Reference to simutaed SCMI agents/services
  46. * @agent: Pointer to SCMI sandbox agent pointers array
  47. * @agent_count: Number of emulated agents exposed in array @agent.
  48. */
  49. struct sandbox_scmi_service {
  50. struct sandbox_scmi_agent **agent;
  51. size_t agent_count;
  52. };
  53. /**
  54. * struct sandbox_scmi_devices - Reference to devices probed through SCMI
  55. * @clk: Array the clock devices
  56. * @clk_count: Number of clock devices probed
  57. * @reset: Array the reset controller devices
  58. * @reset_count: Number of reset controller devices probed
  59. */
  60. struct sandbox_scmi_devices {
  61. struct clk *clk;
  62. size_t clk_count;
  63. struct reset_ctl *reset;
  64. size_t reset_count;
  65. };
  66. #ifdef CONFIG_SCMI_FIRMWARE
  67. /**
  68. * sandbox_scmi_service_context - Get the simulated SCMI services context
  69. * @return: Reference to backend simulated resources state
  70. */
  71. struct sandbox_scmi_service *sandbox_scmi_service_ctx(void);
  72. /**
  73. * sandbox_scmi_devices_get_ref - Get references to devices accessed through SCMI
  74. * @dev: Reference to the test device used get test resources
  75. * @return: Reference to the devices probed by the SCMI test
  76. */
  77. struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev);
  78. #else
  79. static inline struct sandbox_scmi_service *sandbox_scmi_service_ctx(void)
  80. {
  81. return NULL;
  82. }
  83. static inline
  84. struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev)
  85. {
  86. return NULL;
  87. }
  88. #endif /* CONFIG_SCMI_FIRMWARE */
  89. #endif /* __SANDBOX_SCMI_TEST_H */