blob: 63093fdb4d4e42e9b0cf9c9a27ae6cbade919651 [file] [log] [blame]
Etienne Carriere02fd1262020-09-09 18:44:00 +02001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2020, Linaro Limited
4 */
5
6#ifndef __SANDBOX_SCMI_TEST_H
7#define __SANDBOX_SCMI_TEST_H
8
9struct udevice;
10struct sandbox_scmi_agent;
11struct sandbox_scmi_service;
12
13/**
Etienne Carriere2d94c08fa2020-09-09 18:44:05 +020014 * struct sandbox_scmi_clk - Simulated clock exposed by SCMI
15 * @id: Identifier of the clock used in the SCMI protocol
16 * @enabled: Clock state: true if enabled, false if disabled
17 * @rate: Clock rate in Hertz
18 */
19struct sandbox_scmi_clk {
20 uint id;
21 bool enabled;
22 ulong rate;
23};
24
25/**
Etienne Carriere02fd1262020-09-09 18:44:00 +020026 * struct sandbox_scmi_agent - Simulated SCMI service seen by SCMI agent
27 * @idx: Identifier for the SCMI agent, its index
Etienne Carriere2d94c08fa2020-09-09 18:44:05 +020028 * @clk: Simulated clocks
29 * @clk_count: Simulated clocks array size
Etienne Carriere02fd1262020-09-09 18:44:00 +020030 */
31struct sandbox_scmi_agent {
32 uint idx;
Etienne Carriere2d94c08fa2020-09-09 18:44:05 +020033 struct sandbox_scmi_clk *clk;
34 size_t clk_count;
Etienne Carriere02fd1262020-09-09 18:44:00 +020035};
36
37/**
38 * struct sandbox_scmi_service - Reference to simutaed SCMI agents/services
39 * @agent: Pointer to SCMI sandbox agent pointers array
40 * @agent_count: Number of emulated agents exposed in array @agent.
41 */
42struct sandbox_scmi_service {
43 struct sandbox_scmi_agent **agent;
44 size_t agent_count;
45};
46
Etienne Carriere2d94c08fa2020-09-09 18:44:05 +020047/**
48 * struct sandbox_scmi_devices - Reference to devices probed through SCMI
49 * @clk: Array the clock devices
50 * @clk_count: Number of clock devices probed
51 */
52struct sandbox_scmi_devices {
53 struct clk *clk;
54 size_t clk_count;
55};
56
Etienne Carriere02fd1262020-09-09 18:44:00 +020057#ifdef CONFIG_SCMI_FIRMWARE
58/**
59 * sandbox_scmi_service_context - Get the simulated SCMI services context
60 * @return: Reference to backend simulated resources state
61 */
62struct sandbox_scmi_service *sandbox_scmi_service_ctx(void);
Etienne Carriere2d94c08fa2020-09-09 18:44:05 +020063
64/**
65 * sandbox_scmi_devices_get_ref - Get references to devices accessed through SCMI
66 * @dev: Reference to the test device used get test resources
67 * @return: Reference to the devices probed by the SCMI test
68 */
69struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev);
Etienne Carriere02fd1262020-09-09 18:44:00 +020070#else
71static inline struct sandbox_scmi_service *sandbox_scmi_service_ctx(void)
72{
73 return NULL;
74}
Etienne Carriere2d94c08fa2020-09-09 18:44:05 +020075
76static inline
77struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev)
78{
79 return NULL;
80}
Etienne Carriere02fd1262020-09-09 18:44:00 +020081#endif /* CONFIG_SCMI_FIRMWARE */
82#endif /* __SANDBOX_SCMI_TEST_H */