TianoCore EDK2 master
Loading...
Searching...
No Matches
ArmScmiClockProtocol.h
Go to the documentation of this file.
1
12#ifndef ARM_SCMI_CLOCK_PROTOCOL_H_
13#define ARM_SCMI_CLOCK_PROTOCOL_H_
14
15#include <Protocol/ArmScmi.h>
16
17#define ARM_SCMI_CLOCK_PROTOCOL_GUID {\
18 0x91ce67a8, 0xe0aa, 0x4012, {0xb9, 0x9f, 0xb6, 0xfc, 0xf3, 0x4, 0x8e, 0xaa} \
19 }
20
21extern EFI_GUID gArmScmiClockProtocolGuid;
22
23// Message Type for clock management protocol.
24typedef enum {
25 ScmiMessageIdClockAttributes = 0x3,
26 ScmiMessageIdClockDescribeRates = 0x4,
27 ScmiMessageIdClockRateSet = 0x5,
28 ScmiMessageIdClockRateGet = 0x6,
29 ScmiMessageIdClockConfigSet = 0x7
30} SCMI_MESSAGE_ID_CLOCK;
31
32typedef enum {
33 ScmiClockRateFormatDiscrete, // Non-linear range.
34 ScmiClockRateFormatLinear // Linear range.
35} SCMI_CLOCK_RATE_FORMAT;
36
37// Clock management protocol version.
38#define SCMI_CLOCK_PROTOCOL_VERSION 0x10000
39
40#define SCMI_CLOCK_PROTOCOL_PENDING_ASYNC_RATES_MASK 0xFFU
41#define SCMI_CLOCK_PROTOCOL_PENDING_ASYNC_RATES_SHIFT 16
42#define SCMI_CLOCK_PROTOCOL_NUM_CLOCKS_MASK 0xFFFFU
43
47#define SCMI_CLOCK_PROTOCOL_MAX_ASYNC_CLK_RATES(Attr) ( \
48 (Attr >> SCMI_CLOCK_PROTOCOL_PENDING_ASYNC_RATES_SHIFT) && \
49 SCMI_CLOCK_PROTOCOL_PENDING_ASYNC_RATES_MASK)
50
51// Total of clock devices supported by the SCP, Attr Bits[15:0]
52#define SCMI_CLOCK_PROTOCOL_TOTAL_CLKS(Attr) (Attr & SCMI_CLOCK_PROTOCOL_NUM_CLOCKS_MASK)
53
54#pragma pack(1)
55
56/* Depending on the format (linear/non-linear) supported by a clock device
57 either Rate or Min/Max/Step triplet is valid.
58*/
59typedef struct {
60 UINT64 Min;
61 UINT64 Max;
62 UINT64 Step;
64
65typedef struct {
66 UINT64 Rate;
68
69typedef union {
70 SCMI_CLOCK_RATE_CONTINUOUS ContinuousRate;
71 SCMI_CLOCK_RATE_DISCRETE DiscreteRate;
73
74#pragma pack()
75
77
78// Protocol Interface functions.
79
90typedef
94 OUT UINT32 *Version
95 );
96
108typedef
112 OUT UINT32 *TotalClocks
113 );
114
128typedef
132 IN UINT32 ClockId,
133 OUT BOOLEAN *Enabled,
134 OUT CHAR8 *ClockAsciiName
135 );
136
160typedef
164 IN UINT32 ClockId,
165 OUT SCMI_CLOCK_RATE_FORMAT *Format,
166 OUT UINT32 *TotalRates,
167 IN OUT UINT32 *RateArraySize,
168 OUT SCMI_CLOCK_RATE *RateArray
169 );
170
182typedef
184(EFIAPI *SCMI_CLOCK_RATE_GET)(
186 IN UINT32 ClockId,
187 OUT UINT64 *Rate
188 );
189
200typedef
202(EFIAPI *SCMI_CLOCK_RATE_SET)(
204 IN UINT32 ClockId,
205 IN UINT64 Rate
206 );
207
208typedef struct _SCMI_CLOCK_PROTOCOL {
209 SCMI_CLOCK_GET_VERSION GetVersion;
210 SCMI_CLOCK_GET_TOTAL_CLOCKS GetTotalClocks;
211 SCMI_CLOCK_GET_CLOCK_ATTRIBUTES GetClockAttributes;
212 SCMI_CLOCK_DESCRIBE_RATES DescribeRates;
213 SCMI_CLOCK_RATE_GET RateGet;
214 SCMI_CLOCK_RATE_SET RateSet;
216
217#endif /* ARM_SCMI_CLOCK_PROTOCOL_H_ */
EFI_STATUS(EFIAPI * SCMI_CLOCK_DESCRIBE_RATES)(IN SCMI_CLOCK_PROTOCOL *This, IN UINT32 ClockId, OUT SCMI_CLOCK_RATE_FORMAT *Format, OUT UINT32 *TotalRates, IN OUT UINT32 *RateArraySize, OUT SCMI_CLOCK_RATE *RateArray)
EFI_STATUS(EFIAPI * SCMI_CLOCK_RATE_GET)(IN SCMI_CLOCK_PROTOCOL *This, IN UINT32 ClockId, OUT UINT64 *Rate)
EFI_STATUS(EFIAPI * SCMI_CLOCK_GET_TOTAL_CLOCKS)(IN SCMI_CLOCK_PROTOCOL *This, OUT UINT32 *TotalClocks)
EFI_STATUS(EFIAPI * SCMI_CLOCK_GET_CLOCK_ATTRIBUTES)(IN SCMI_CLOCK_PROTOCOL *This, IN UINT32 ClockId, OUT BOOLEAN *Enabled, OUT CHAR8 *ClockAsciiName)
EFI_STATUS(EFIAPI * SCMI_CLOCK_GET_VERSION)(IN SCMI_CLOCK_PROTOCOL *This, OUT UINT32 *Version)
EFI_STATUS(EFIAPI * SCMI_CLOCK_RATE_SET)(IN SCMI_CLOCK_PROTOCOL *This, IN UINT32 ClockId, IN UINT64 Rate)
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
Definition: Base.h:213