]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Include/Protocol/ArmScmiBaseProtocol.h
ecc41f2181ecc9f835950ab46c7cfd2e476a7073
[mirror_edk2.git] / ArmPkg / Include / Protocol / ArmScmiBaseProtocol.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_BASE_PROTOCOL_H_
19 #define ARM_SCMI_BASE_PROTOCOL_H_
20
21 #include <Protocol/ArmScmi.h>
22
23 #define BASE_PROTOCOL_VERSION 0x10000
24
25 #define NUM_PROTOCOL_MASK 0xFFU
26 #define NUM_AGENT_MASK 0xFFU
27
28 #define NUM_AGENT_SHIFT 0x8
29
30 /** Returns total number of protocols that are
31 implemented (excluding the Base protocol)
32 */
33 #define SCMI_TOTAL_PROTOCOLS(Attr) (Attr & NUM_PROTOCOL_MASK)
34
35 // Returns total number of agents in the system.
36 #define SCMI_TOTAL_AGENTS(Attr) ((Attr >> NUM_AGENT_SHIFT) & NUM_AGENT_MASK)
37
38 #define ARM_SCMI_BASE_PROTOCOL_GUID { \
39 0xd7e5abe9, 0x33ab, 0x418e, {0x9f, 0x91, 0x72, 0xda, 0xe2, 0xba, 0x8e, 0x2f} \
40 }
41
42 extern EFI_GUID gArmScmiBaseProtocolGuid;
43
44 typedef struct _SCMI_BASE_PROTOCOL SCMI_BASE_PROTOCOL;
45
46 /** Return version of the Base protocol supported by SCP firmware.
47
48 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
49
50 @param[out] Version Version of the supported SCMI Base protocol.
51
52 @retval EFI_SUCCESS The version of the protocol is returned.
53 @retval EFI_DEVICE_ERROR SCP returns an SCMI error.
54 @retval !(EFI_SUCCESS) Other errors.
55 **/
56 typedef
57 EFI_STATUS
58 (EFIAPI *SCMI_BASE_GET_VERSION) (
59 IN SCMI_BASE_PROTOCOL *This,
60 OUT UINT32 *Version
61 );
62
63 /** Return total number of SCMI protocols supported by the SCP firmware.
64
65 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
66
67 @param[out] TotalProtocols Total number of SCMI protocols supported.
68
69 @retval EFI_SUCCESS Total number of protocols supported are returned.
70 @retval EFI_DEVICE_ERROR SCP returns a SCMI error.
71 @retval !(EFI_SUCCESS) Other errors.
72 **/
73 typedef
74 EFI_STATUS
75 (EFIAPI *SCMI_BASE_GET_TOTAL_PROTOCOLS) (
76 IN SCMI_BASE_PROTOCOL *This,
77 OUT UINT32 *TotalProtocols
78 );
79
80 /** Return vendor name.
81
82 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
83
84 @param[out] VendorIdentifier Null terminated ASCII string of up to
85 16 bytes with a vendor name.
86
87 @retval EFI_SUCCESS VendorIdentifier is returned.
88 @retval EFI_DEVICE_ERROR SCP returns a SCMI error.
89 @retval !(EFI_SUCCESS) Other errors.
90 **/
91 typedef
92 EFI_STATUS
93 (EFIAPI *SCMI_BASE_DISCOVER_VENDOR) (
94 IN SCMI_BASE_PROTOCOL *This,
95 OUT UINT8 VendorIdentifier[SCMI_MAX_STR_LEN]
96 );
97
98 /** Return sub vendor name.
99
100 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
101
102 @param[out] VendorIdentifier Null terminated ASCII string of up to
103 16 bytes with a vendor name.
104
105 @retval EFI_SUCCESS VendorIdentifier is returned.
106 @retval EFI_DEVICE_ERROR SCP returns a SCMI error.
107 @retval !(EFI_SUCCESS) Other errors.
108 **/
109 typedef
110 EFI_STATUS
111 (EFIAPI *SCMI_BASE_DISCOVER_SUB_VENDOR) (
112 IN SCMI_BASE_PROTOCOL *This,
113 OUT UINT8 VendorIdentifier[SCMI_MAX_STR_LEN]
114 );
115
116 /** Return implementation version.
117
118 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
119
120 @param[out] ImplementationVersion Vendor specific implementation version.
121
122 @retval EFI_SUCCESS Implementation version is returned.
123 @retval EFI_DEVICE_ERROR SCP returns a SCMI error.
124 @retval !(EFI_SUCCESS) Other errors.
125 **/
126 typedef
127 EFI_STATUS
128 (EFIAPI *SCMI_BASE_DISCOVER_IMPLEMENTATION_VERSION) (
129 IN SCMI_BASE_PROTOCOL *This,
130 OUT UINT32 *ImplementationVersion
131 );
132
133 /** Return list of protocols.
134
135 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
136
137 @param[out] ProtocolListSize Size of the ProtocolList.
138
139 @param[out] ProtocolList Protocol list.
140
141 @retval EFI_SUCCESS List of protocols is returned.
142 @retval EFI_BUFFER_TOO_SMALL ProtocolListSize is too small for the result.
143 It has been updated to the size needed.
144 @retval EFI_DEVICE_ERROR SCP returns a SCMI error.
145 @retval !(EFI_SUCCESS) Other errors.
146 **/
147 typedef
148 EFI_STATUS
149 (EFIAPI *SCMI_BASE_DISCOVER_LIST_PROTOCOLS) (
150 IN SCMI_BASE_PROTOCOL *This,
151 IN OUT UINT32 *ProtocolListSize,
152 OUT UINT8 *ProtocolList
153 );
154
155 // Base protocol.
156 typedef struct _SCMI_BASE_PROTOCOL {
157 SCMI_BASE_GET_VERSION GetVersion;
158 SCMI_BASE_GET_TOTAL_PROTOCOLS GetTotalProtocols;
159 SCMI_BASE_DISCOVER_VENDOR DiscoverVendor;
160 SCMI_BASE_DISCOVER_SUB_VENDOR DiscoverSubVendor;
161 SCMI_BASE_DISCOVER_IMPLEMENTATION_VERSION DiscoverImplementationVersion;
162 SCMI_BASE_DISCOVER_LIST_PROTOCOLS DiscoverListProtocols;
163 } SCMI_BASE_PROTOCOL;
164
165 // SCMI Message IDs for Base protocol.
166 typedef enum {
167 SCMI_MESSAGE_ID_BASE_DISCOVER_VENDOR = 0x3,
168 SCMI_MESSAGE_ID_BASE_DISCOVER_SUB_VENDOR = 0x4,
169 SCMI_MESSAGE_ID_BASE_DISCOVER_IMPLEMENTATION_VERSION = 0x5,
170 SCMI_MESSAGE_ID_BASE_DISCOVER_LIST_PROTOCOLS = 0x6
171 } SCMI_MESSAGE_ID_BASE;
172
173 #endif /* ARM_SCMI_BASE_PROTOCOL_H_ */
174