]>
Commit | Line | Data |
---|---|---|
559a07d8 JB |
1 | /** @file\r |
2 | \r | |
3 | Copyright (c) 2017-2018, Arm Limited. All rights reserved.\r | |
4 | \r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | System Control and Management Interface V1.0\r | |
14 | http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/\r | |
15 | DEN0056A_System_Control_and_Management_Interface.pdf\r | |
16 | **/\r | |
17 | \r | |
18 | #ifndef ARM_SCMI_CLOCK2_PROTOCOL_H_\r | |
19 | #define ARM_SCMI_CLOCK2_PROTOCOL_H_\r | |
20 | \r | |
21 | #include <Protocol/ArmScmi.h>\r | |
22 | #include <Protocol/ArmScmiClockProtocol.h>\r | |
23 | \r | |
24 | #define ARM_SCMI_CLOCK2_PROTOCOL_GUID { \\r | |
25 | 0xb8d8caf2, 0x9e94, 0x462c, { 0xa8, 0x34, 0x6c, 0x99, 0xfc, 0x05, 0xef, 0xcf } \\r | |
26 | }\r | |
27 | \r | |
28 | extern EFI_GUID gArmScmiClock2ProtocolGuid;\r | |
29 | \r | |
30 | #define SCMI_CLOCK2_PROTOCOL_VERSION 1\r | |
31 | \r | |
32 | typedef struct _SCMI_CLOCK2_PROTOCOL SCMI_CLOCK2_PROTOCOL;\r | |
33 | \r | |
34 | // Protocol Interface functions.\r | |
35 | \r | |
36 | /** Return version of the clock management protocol supported by SCP firmware.\r | |
37 | \r | |
38 | @param[in] This A Pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
39 | \r | |
40 | @param[out] Version Version of the supported SCMI Clock management protocol.\r | |
41 | \r | |
42 | @retval EFI_SUCCESS The version is returned.\r | |
43 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
44 | @retval !(EFI_SUCCESS) Other errors.\r | |
45 | **/\r | |
46 | typedef\r | |
47 | EFI_STATUS\r | |
48 | (EFIAPI *SCMI_CLOCK2_GET_VERSION) (\r | |
49 | IN SCMI_CLOCK2_PROTOCOL *This,\r | |
50 | OUT UINT32 *Version\r | |
51 | );\r | |
52 | \r | |
53 | /** Return total number of clock devices supported by the clock management\r | |
54 | protocol.\r | |
55 | \r | |
56 | @param[in] This A Pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
57 | \r | |
58 | @param[out] TotalClocks Total number of clocks supported.\r | |
59 | \r | |
60 | @retval EFI_SUCCESS Total number of clocks supported is returned.\r | |
61 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
62 | @retval !(EFI_SUCCESS) Other errors.\r | |
63 | **/\r | |
64 | typedef\r | |
65 | EFI_STATUS\r | |
66 | (EFIAPI *SCMI_CLOCK2_GET_TOTAL_CLOCKS) (\r | |
67 | IN SCMI_CLOCK2_PROTOCOL *This,\r | |
68 | OUT UINT32 *TotalClocks\r | |
69 | );\r | |
70 | \r | |
71 | /** Return attributes of a clock device.\r | |
72 | \r | |
73 | @param[in] This A Pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
74 | @param[in] ClockId Identifier for the clock device.\r | |
75 | \r | |
76 | @param[out] Enabled If TRUE, the clock device is enabled.\r | |
77 | @param[out] ClockAsciiName A NULL terminated ASCII string with the clock\r | |
78 | name, of up to 16 bytes.\r | |
79 | \r | |
80 | @retval EFI_SUCCESS Clock device attributes are returned.\r | |
81 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
82 | @retval !(EFI_SUCCESS) Other errors.\r | |
83 | **/\r | |
84 | typedef\r | |
85 | EFI_STATUS\r | |
86 | (EFIAPI *SCMI_CLOCK2_GET_CLOCK_ATTRIBUTES) (\r | |
87 | IN SCMI_CLOCK2_PROTOCOL *This,\r | |
88 | IN UINT32 ClockId,\r | |
89 | OUT BOOLEAN *Enabled,\r | |
90 | OUT CHAR8 *ClockAsciiName\r | |
91 | );\r | |
92 | \r | |
93 | /** Return list of rates supported by a given clock device.\r | |
94 | \r | |
95 | @param[in] This A pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
96 | @param[in] ClockId Identifier for the clock device.\r | |
97 | \r | |
98 | @param[out] Format SCMI_CLOCK_RATE_FORMAT_DISCRETE: Clock device\r | |
99 | supports range of clock rates which are non-linear.\r | |
100 | \r | |
101 | SCMI_CLOCK_RATE_FORMAT_LINEAR: Clock device supports\r | |
102 | range of linear clock rates from Min to Max in steps.\r | |
103 | \r | |
104 | @param[out] TotalRates Total number of rates.\r | |
105 | \r | |
106 | @param[in,out] RateArraySize Size of the RateArray.\r | |
107 | \r | |
108 | @param[out] RateArray List of clock rates.\r | |
109 | \r | |
110 | @retval EFI_SUCCESS List of clock rates are returned.\r | |
111 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
112 | @retval EFI_BUFFER_TOO_SMALL RateArraySize is too small for the result.\r | |
113 | It has been updated to the size needed.\r | |
114 | @retval !(EFI_SUCCESS) Other errors.\r | |
115 | **/\r | |
116 | typedef\r | |
117 | EFI_STATUS\r | |
118 | (EFIAPI *SCMI_CLOCK2_DESCRIBE_RATES) (\r | |
119 | IN SCMI_CLOCK2_PROTOCOL *This,\r | |
120 | IN UINT32 ClockId,\r | |
121 | OUT SCMI_CLOCK_RATE_FORMAT *Format,\r | |
122 | OUT UINT32 *TotalRates,\r | |
123 | IN OUT UINT32 *RateArraySize,\r | |
124 | OUT SCMI_CLOCK_RATE *RateArray\r | |
125 | );\r | |
126 | \r | |
127 | /** Get clock rate.\r | |
128 | \r | |
129 | @param[in] This A Pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
130 | @param[in] ClockId Identifier for the clock device.\r | |
131 | \r | |
132 | @param[out] Rate Clock rate.\r | |
133 | \r | |
134 | @retval EFI_SUCCESS Clock rate is returned.\r | |
135 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
136 | @retval !(EFI_SUCCESS) Other errors.\r | |
137 | **/\r | |
138 | typedef\r | |
139 | EFI_STATUS\r | |
140 | (EFIAPI *SCMI_CLOCK2_RATE_GET) (\r | |
141 | IN SCMI_CLOCK2_PROTOCOL *This,\r | |
142 | IN UINT32 ClockId,\r | |
143 | OUT UINT64 *Rate\r | |
144 | );\r | |
145 | \r | |
146 | /** Set clock rate.\r | |
147 | \r | |
148 | @param[in] This A Pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
149 | @param[in] ClockId Identifier for the clock device.\r | |
150 | @param[in] Rate Clock rate.\r | |
151 | \r | |
152 | @retval EFI_SUCCESS Clock rate set success.\r | |
153 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
154 | @retval !(EFI_SUCCESS) Other errors.\r | |
155 | **/\r | |
156 | typedef\r | |
157 | EFI_STATUS\r | |
158 | (EFIAPI *SCMI_CLOCK2_RATE_SET) (\r | |
159 | IN SCMI_CLOCK2_PROTOCOL *This,\r | |
160 | IN UINT32 ClockId,\r | |
161 | IN UINT64 Rate\r | |
162 | );\r | |
163 | \r | |
164 | /** Enable/Disable specified clock.\r | |
165 | Function is only available under gArmScmiClock2ProtocolGuid\r | |
166 | \r | |
167 | @param[in] This A Pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
168 | @param[in] ClockId Identifier for the clock device.\r | |
169 | @param[in] Enable TRUE to enable, FALSE to disable.\r | |
170 | \r | |
171 | @retval EFI_SUCCESS Clock enable/disable successful.\r | |
172 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
173 | @retval !(EFI_SUCCESS) Other errors.\r | |
174 | **/\r | |
175 | typedef\r | |
176 | EFI_STATUS\r | |
177 | (EFIAPI *SCMI_CLOCK2_ENABLE) (\r | |
178 | IN SCMI_CLOCK2_PROTOCOL *This,\r | |
179 | IN UINT32 ClockId,\r | |
180 | IN BOOLEAN Enable\r | |
181 | );\r | |
182 | \r | |
183 | typedef struct _SCMI_CLOCK2_PROTOCOL {\r | |
184 | SCMI_CLOCK2_GET_VERSION GetVersion;\r | |
185 | SCMI_CLOCK2_GET_TOTAL_CLOCKS GetTotalClocks;\r | |
186 | SCMI_CLOCK2_GET_CLOCK_ATTRIBUTES GetClockAttributes;\r | |
187 | SCMI_CLOCK2_DESCRIBE_RATES DescribeRates;\r | |
188 | SCMI_CLOCK2_RATE_GET RateGet;\r | |
189 | SCMI_CLOCK2_RATE_SET RateSet;\r | |
190 | \r | |
191 | // Extension to original ClockProtocol, added here so SCMI_CLOCK2_PROTOCOL\r | |
192 | // can be cast to SCMI_CLOCK_PROTOCOL\r | |
193 | UINTN Version; // For future expandability\r | |
194 | SCMI_CLOCK2_ENABLE Enable;\r | |
195 | } SCMI_CLOCK2_PROTOCOL;\r | |
196 | \r | |
197 | #endif /* ARM_SCMI_CLOCK2_PROTOCOL_H_ */\r |