]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h
ArmPkg: Introduce SCMI protocol
[mirror_edk2.git] / ArmPkg / Drivers / ArmScmiDxe / ArmScmiClockProtocolPrivate.h
1 /** @file
2
3 Copyright (c) 2017-2018, Arm Limited. All rights reserved.
4
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 System Control and Management Interface V1.0
14 http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/
15 DEN0056A_System_Control_and_Management_Interface.pdf
16 **/
17
18 #ifndef ARM_SCMI_CLOCK_PROTOCOL_PRIVATE_H_
19 #define ARM_SCMI_CLOCK_PROTOCOL_PRIVATE_H_
20
21 #pragma pack(1)
22
23 // Clock rate in two 32bit words.
24 typedef struct {
25 UINT32 Low;
26 UINT32 High;
27 } CLOCK_RATE_DWORD;
28
29 // Format of the returned rate array. Linear or Non-linear,.RatesFlag Bit[12]
30 #define RATE_FORMAT_SHIFT 12
31 #define RATE_FORMAT_MASK 0x0001
32 #define RATE_FORMAT(RatesFlags) ((RatesFlags >> RATE_FORMAT_SHIFT) \
33 & RATE_FORMAT_MASK)
34
35 // Number of remaining rates after a call to the SCP, RatesFlag Bits[31:16]
36 #define NUM_REMAIN_RATES_SHIFT 16
37 #define NUM_REMAIN_RATES(RatesFlags) ((RatesFlags >> NUM_REMAIN_RATES_SHIFT))
38
39 // Number of rates that are returned by a call.to the SCP, RatesFlag Bits[11:0]
40 #define NUM_RATES_MASK 0x0FFF
41 #define NUM_RATES(RatesFlags) (RatesFlags & NUM_RATES_MASK)
42
43 // Return values for the CLOCK_DESCRIBER_RATE command.
44 typedef struct {
45 UINT32 NumRatesFlags;
46
47 // NOTE: Since EDK2 does not allow flexible array member [] we declare
48 // here array of 1 element length. However below is used as a variable
49 // length array.
50 CLOCK_RATE_DWORD Rates[1];
51 } CLOCK_DESCRIBE_RATES;
52
53 #define CLOCK_SET_DEFAULT_FLAGS 0
54
55 // Message parameters for CLOCK_RATE_SET command.
56 typedef struct {
57 UINT32 Flags;
58 UINT32 ClockId;
59 CLOCK_RATE_DWORD Rate;
60 } CLOCK_RATE_SET_ATTRIBUTES;
61
62 // if ClockAttr Bit[0] is set then clock device is enabled.
63 #define CLOCK_ENABLE_MASK 0x1
64 #define CLOCK_ENABLED(ClockAttr) ((ClockAttr & CLOCK_ENABLE_MASK) == 1)
65
66 typedef struct {
67 UINT32 Attributes;
68 UINT8 ClockName[SCMI_MAX_STR_LEN];
69 } CLOCK_ATTRIBUTES;
70
71 #pragma pack()
72
73 /** Initialize clock management protocol and install protocol on a given handle.
74
75 @param[in] Handle Handle to install clock management protocol.
76
77 @retval EFI_SUCCESS Clock protocol interface installed successfully.
78 **/
79 EFI_STATUS
80 ScmiClockProtocolInit (
81 IN EFI_HANDLE *Handle
82 );
83
84 #endif /* ARM_SCMI_CLOCK_PROTOCOL_PRIVATE_H_ */