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