]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Include/Protocol/ArmScmiBaseProtocol.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / ArmPkg / Include / Protocol / ArmScmiBaseProtocol.h
1 /** @file
2
3 Copyright (c) 2017-2021, Arm Limited. All rights reserved.<BR>
4
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 @par Specification Reference:
8 - Arm System Control and Management Interface - Platform Design Document
9 (https://developer.arm.com/documentation/den0056/)
10 **/
11
12 #ifndef ARM_SCMI_BASE_PROTOCOL_H_
13 #define ARM_SCMI_BASE_PROTOCOL_H_
14
15 #include <Protocol/ArmScmi.h>
16
17 #define BASE_PROTOCOL_VERSION_V1 0x10000
18 #define BASE_PROTOCOL_VERSION_V2 0x20000
19
20 #define NUM_PROTOCOL_MASK 0xFFU
21 #define NUM_AGENT_MASK 0xFFU
22
23 #define NUM_AGENT_SHIFT 0x8
24
25 /** Returns total number of protocols that are
26 implemented (excluding the Base protocol)
27 */
28 #define SCMI_TOTAL_PROTOCOLS(Attr) (Attr & NUM_PROTOCOL_MASK)
29
30 // Returns total number of agents in the system.
31 #define SCMI_TOTAL_AGENTS(Attr) ((Attr >> NUM_AGENT_SHIFT) & NUM_AGENT_MASK)
32
33 #define ARM_SCMI_BASE_PROTOCOL_GUID { \
34 0xd7e5abe9, 0x33ab, 0x418e, {0x9f, 0x91, 0x72, 0xda, 0xe2, 0xba, 0x8e, 0x2f} \
35 }
36
37 extern EFI_GUID gArmScmiBaseProtocolGuid;
38
39 typedef struct _SCMI_BASE_PROTOCOL SCMI_BASE_PROTOCOL;
40
41 /** Return version of the Base protocol supported by SCP firmware.
42
43 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
44
45 @param[out] Version Version of the supported SCMI Base protocol.
46
47 @retval EFI_SUCCESS The version of the protocol is returned.
48 @retval EFI_DEVICE_ERROR SCP returns an SCMI error.
49 @retval !(EFI_SUCCESS) Other errors.
50 **/
51 typedef
52 EFI_STATUS
53 (EFIAPI *SCMI_BASE_GET_VERSION)(
54 IN SCMI_BASE_PROTOCOL *This,
55 OUT UINT32 *Version
56 );
57
58 /** Return total number of SCMI protocols supported by the SCP firmware.
59
60 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
61
62 @param[out] TotalProtocols Total number of SCMI protocols supported.
63
64 @retval EFI_SUCCESS Total number of protocols supported are returned.
65 @retval EFI_DEVICE_ERROR SCP returns a SCMI error.
66 @retval !(EFI_SUCCESS) Other errors.
67 **/
68 typedef
69 EFI_STATUS
70 (EFIAPI *SCMI_BASE_GET_TOTAL_PROTOCOLS)(
71 IN SCMI_BASE_PROTOCOL *This,
72 OUT UINT32 *TotalProtocols
73 );
74
75 /** Return vendor name.
76
77 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
78
79 @param[out] VendorIdentifier Null terminated ASCII string of up to
80 16 bytes with a vendor name.
81
82 @retval EFI_SUCCESS VendorIdentifier is returned.
83 @retval EFI_DEVICE_ERROR SCP returns a SCMI error.
84 @retval !(EFI_SUCCESS) Other errors.
85 **/
86 typedef
87 EFI_STATUS
88 (EFIAPI *SCMI_BASE_DISCOVER_VENDOR)(
89 IN SCMI_BASE_PROTOCOL *This,
90 OUT UINT8 VendorIdentifier[SCMI_MAX_STR_LEN]
91 );
92
93 /** Return sub vendor name.
94
95 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
96
97 @param[out] VendorIdentifier Null terminated ASCII string of up to
98 16 bytes with a vendor name.
99
100 @retval EFI_SUCCESS VendorIdentifier is returned.
101 @retval EFI_DEVICE_ERROR SCP returns a SCMI error.
102 @retval !(EFI_SUCCESS) Other errors.
103 **/
104 typedef
105 EFI_STATUS
106 (EFIAPI *SCMI_BASE_DISCOVER_SUB_VENDOR)(
107 IN SCMI_BASE_PROTOCOL *This,
108 OUT UINT8 VendorIdentifier[SCMI_MAX_STR_LEN]
109 );
110
111 /** Return implementation version.
112
113 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
114
115 @param[out] ImplementationVersion Vendor specific implementation version.
116
117 @retval EFI_SUCCESS Implementation version is returned.
118 @retval EFI_DEVICE_ERROR SCP returns a SCMI error.
119 @retval !(EFI_SUCCESS) Other errors.
120 **/
121 typedef
122 EFI_STATUS
123 (EFIAPI *SCMI_BASE_DISCOVER_IMPLEMENTATION_VERSION)(
124 IN SCMI_BASE_PROTOCOL *This,
125 OUT UINT32 *ImplementationVersion
126 );
127
128 /** Return list of protocols.
129
130 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
131
132 @param[out] ProtocolListSize Size of the ProtocolList.
133
134 @param[out] ProtocolList Protocol list.
135
136 @retval EFI_SUCCESS List of protocols is returned.
137 @retval EFI_BUFFER_TOO_SMALL ProtocolListSize is too small for the result.
138 It has been updated to the size needed.
139 @retval EFI_DEVICE_ERROR SCP returns a SCMI error.
140 @retval !(EFI_SUCCESS) Other errors.
141 **/
142 typedef
143 EFI_STATUS
144 (EFIAPI *SCMI_BASE_DISCOVER_LIST_PROTOCOLS)(
145 IN SCMI_BASE_PROTOCOL *This,
146 IN OUT UINT32 *ProtocolListSize,
147 OUT UINT8 *ProtocolList
148 );
149
150 // Base protocol.
151 typedef struct _SCMI_BASE_PROTOCOL {
152 SCMI_BASE_GET_VERSION GetVersion;
153 SCMI_BASE_GET_TOTAL_PROTOCOLS GetTotalProtocols;
154 SCMI_BASE_DISCOVER_VENDOR DiscoverVendor;
155 SCMI_BASE_DISCOVER_SUB_VENDOR DiscoverSubVendor;
156 SCMI_BASE_DISCOVER_IMPLEMENTATION_VERSION DiscoverImplementationVersion;
157 SCMI_BASE_DISCOVER_LIST_PROTOCOLS DiscoverListProtocols;
158 } SCMI_BASE_PROTOCOL;
159
160 // SCMI Message IDs for Base protocol.
161 typedef enum {
162 ScmiMessageIdBaseDiscoverVendor = 0x3,
163 ScmiMessageIdBaseDiscoverSubVendor = 0x4,
164 ScmiMessageIdBaseDiscoverImplementationVersion = 0x5,
165 ScmiMessageIdBaseDiscoverListProtocols = 0x6
166 } SCMI_MESSAGE_ID_BASE;
167
168 #endif /* ARM_SCMI_BASE_PROTOCOL_H_ */