]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h
ArmPkg/ArmScmiDxe: Add clock enable function
[mirror_edk2.git] / ArmPkg / Drivers / ArmScmiDxe / ArmScmiClockProtocolPrivate.h
CommitLineData
4f2494cf
GP
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_CLOCK_PROTOCOL_PRIVATE_H_\r
19#define ARM_SCMI_CLOCK_PROTOCOL_PRIVATE_H_\r
20\r
21#pragma pack(1)\r
22\r
23// Clock rate in two 32bit words.\r
24typedef struct {\r
25 UINT32 Low;\r
26 UINT32 High;\r
27} CLOCK_RATE_DWORD;\r
28\r
29// Format of the returned rate array. Linear or Non-linear,.RatesFlag Bit[12]\r
30#define RATE_FORMAT_SHIFT 12\r
31#define RATE_FORMAT_MASK 0x0001\r
32#define RATE_FORMAT(RatesFlags) ((RatesFlags >> RATE_FORMAT_SHIFT) \\r
33 & RATE_FORMAT_MASK)\r
34\r
35// Number of remaining rates after a call to the SCP, RatesFlag Bits[31:16]\r
36#define NUM_REMAIN_RATES_SHIFT 16\r
37#define NUM_REMAIN_RATES(RatesFlags) ((RatesFlags >> NUM_REMAIN_RATES_SHIFT))\r
38\r
39// Number of rates that are returned by a call.to the SCP, RatesFlag Bits[11:0]\r
40#define NUM_RATES_MASK 0x0FFF\r
41#define NUM_RATES(RatesFlags) (RatesFlags & NUM_RATES_MASK)\r
42\r
43// Return values for the CLOCK_DESCRIBER_RATE command.\r
44typedef struct {\r
45 UINT32 NumRatesFlags;\r
46\r
47 // NOTE: Since EDK2 does not allow flexible array member [] we declare\r
48 // here array of 1 element length. However below is used as a variable\r
49 // length array.\r
50 CLOCK_RATE_DWORD Rates[1];\r
51} CLOCK_DESCRIBE_RATES;\r
52\r
53#define CLOCK_SET_DEFAULT_FLAGS 0\r
54\r
55// Message parameters for CLOCK_RATE_SET command.\r
56typedef struct {\r
57 UINT32 Flags;\r
58 UINT32 ClockId;\r
59 CLOCK_RATE_DWORD Rate;\r
60} CLOCK_RATE_SET_ATTRIBUTES;\r
61\r
559a07d8
JB
62\r
63// Message parameters for CLOCK_CONFIG_SET command.\r
64typedef struct {\r
65 UINT32 ClockId;\r
66 UINT32 Attributes;\r
67} CLOCK_CONFIG_SET_ATTRIBUTES;\r
68\r
4f2494cf
GP
69// if ClockAttr Bit[0] is set then clock device is enabled.\r
70#define CLOCK_ENABLE_MASK 0x1\r
71#define CLOCK_ENABLED(ClockAttr) ((ClockAttr & CLOCK_ENABLE_MASK) == 1)\r
72\r
73typedef struct {\r
74 UINT32 Attributes;\r
75 UINT8 ClockName[SCMI_MAX_STR_LEN];\r
76} CLOCK_ATTRIBUTES;\r
77\r
78#pragma pack()\r
79\r
80/** Initialize clock management protocol and install protocol on a given handle.\r
81\r
82 @param[in] Handle Handle to install clock management protocol.\r
83\r
84 @retval EFI_SUCCESS Clock protocol interface installed successfully.\r
85**/\r
86EFI_STATUS\r
87ScmiClockProtocolInit (\r
88 IN EFI_HANDLE *Handle\r
89 );\r
90\r
91#endif /* ARM_SCMI_CLOCK_PROTOCOL_PRIVATE_H_ */\r