]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h
ArmPkg: Apply uncrustify changes
[mirror_edk2.git] / ArmPkg / Drivers / ArmScmiDxe / ArmScmiClockProtocolPrivate.h
1 /** @file
2
3 Copyright (c) 2017-2018, Arm Limited. All rights reserved.
4
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 System Control and Management Interface V1.0
8 http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/
9 DEN0056A_System_Control_and_Management_Interface.pdf
10 **/
11
12 #ifndef ARM_SCMI_CLOCK_PROTOCOL_PRIVATE_H_
13 #define ARM_SCMI_CLOCK_PROTOCOL_PRIVATE_H_
14
15 #pragma pack(1)
16
17 // Clock rate in two 32bit words.
18 typedef struct {
19 UINT32 Low;
20 UINT32 High;
21 } CLOCK_RATE_DWORD;
22
23 // Format of the returned rate array. Linear or Non-linear,.RatesFlag Bit[12]
24 #define RATE_FORMAT_SHIFT 12
25 #define RATE_FORMAT_MASK 0x0001
26 #define RATE_FORMAT(RatesFlags) ((RatesFlags >> RATE_FORMAT_SHIFT) \
27 & RATE_FORMAT_MASK)
28
29 // Number of remaining rates after a call to the SCP, RatesFlag Bits[31:16]
30 #define NUM_REMAIN_RATES_SHIFT 16
31 #define NUM_REMAIN_RATES(RatesFlags) ((RatesFlags >> NUM_REMAIN_RATES_SHIFT))
32
33 // Number of rates that are returned by a call.to the SCP, RatesFlag Bits[11:0]
34 #define NUM_RATES_MASK 0x0FFF
35 #define NUM_RATES(RatesFlags) (RatesFlags & NUM_RATES_MASK)
36
37 // Return values for the CLOCK_DESCRIBER_RATE command.
38 typedef struct {
39 UINT32 NumRatesFlags;
40
41 // NOTE: Since EDK2 does not allow flexible array member [] we declare
42 // here array of 1 element length. However below is used as a variable
43 // length array.
44 CLOCK_RATE_DWORD Rates[1];
45 } CLOCK_DESCRIBE_RATES;
46
47 #define CLOCK_SET_DEFAULT_FLAGS 0
48
49 // Message parameters for CLOCK_RATE_SET command.
50 typedef struct {
51 UINT32 Flags;
52 UINT32 ClockId;
53 CLOCK_RATE_DWORD Rate;
54 } CLOCK_RATE_SET_ATTRIBUTES;
55
56 // Message parameters for CLOCK_CONFIG_SET command.
57 typedef struct {
58 UINT32 ClockId;
59 UINT32 Attributes;
60 } CLOCK_CONFIG_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_ */