3 Copyright (c) 2017-2021, Arm Limited. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
7 @par Specification Reference:
8 - Arm System Control and Management Interface - Platform Design Document
9 (https://developer.arm.com/documentation/den0056/)
12 #ifndef ARM_SCMI_BASE_PROTOCOL_H_
13 #define ARM_SCMI_BASE_PROTOCOL_H_
15 #include <Protocol/ArmScmi.h>
17 #define BASE_PROTOCOL_VERSION_V1 0x10000
18 #define BASE_PROTOCOL_VERSION_V2 0x20000
20 #define NUM_PROTOCOL_MASK 0xFFU
21 #define NUM_AGENT_MASK 0xFFU
23 #define NUM_AGENT_SHIFT 0x8
25 /** Returns total number of protocols that are
26 implemented (excluding the Base protocol)
28 #define SCMI_TOTAL_PROTOCOLS(Attr) (Attr & NUM_PROTOCOL_MASK)
30 // Returns total number of agents in the system.
31 #define SCMI_TOTAL_AGENTS(Attr) ((Attr >> NUM_AGENT_SHIFT) & NUM_AGENT_MASK)
33 #define ARM_SCMI_BASE_PROTOCOL_GUID { \
34 0xd7e5abe9, 0x33ab, 0x418e, {0x9f, 0x91, 0x72, 0xda, 0xe2, 0xba, 0x8e, 0x2f} \
37 extern EFI_GUID gArmScmiBaseProtocolGuid
;
39 typedef struct _SCMI_BASE_PROTOCOL SCMI_BASE_PROTOCOL
;
41 /** Return version of the Base protocol supported by SCP firmware.
43 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
45 @param[out] Version Version of the supported SCMI Base protocol.
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.
53 (EFIAPI
*SCMI_BASE_GET_VERSION
)(
54 IN SCMI_BASE_PROTOCOL
*This
,
58 /** Return total number of SCMI protocols supported by the SCP firmware.
60 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
62 @param[out] TotalProtocols Total number of SCMI protocols supported.
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.
70 (EFIAPI
*SCMI_BASE_GET_TOTAL_PROTOCOLS
)(
71 IN SCMI_BASE_PROTOCOL
*This
,
72 OUT UINT32
*TotalProtocols
75 /** Return vendor name.
77 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
79 @param[out] VendorIdentifier Null terminated ASCII string of up to
80 16 bytes with a vendor name.
82 @retval EFI_SUCCESS VendorIdentifier is returned.
83 @retval EFI_DEVICE_ERROR SCP returns a SCMI error.
84 @retval !(EFI_SUCCESS) Other errors.
88 (EFIAPI
*SCMI_BASE_DISCOVER_VENDOR
)(
89 IN SCMI_BASE_PROTOCOL
*This
,
90 OUT UINT8 VendorIdentifier
[SCMI_MAX_STR_LEN
]
93 /** Return sub vendor name.
95 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
97 @param[out] VendorIdentifier Null terminated ASCII string of up to
98 16 bytes with a vendor name.
100 @retval EFI_SUCCESS VendorIdentifier is returned.
101 @retval EFI_DEVICE_ERROR SCP returns a SCMI error.
102 @retval !(EFI_SUCCESS) Other errors.
106 (EFIAPI
*SCMI_BASE_DISCOVER_SUB_VENDOR
)(
107 IN SCMI_BASE_PROTOCOL
*This
,
108 OUT UINT8 VendorIdentifier
[SCMI_MAX_STR_LEN
]
111 /** Return implementation version.
113 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
115 @param[out] ImplementationVersion Vendor specific implementation version.
117 @retval EFI_SUCCESS Implementation version is returned.
118 @retval EFI_DEVICE_ERROR SCP returns a SCMI error.
119 @retval !(EFI_SUCCESS) Other errors.
123 (EFIAPI
*SCMI_BASE_DISCOVER_IMPLEMENTATION_VERSION
)(
124 IN SCMI_BASE_PROTOCOL
*This
,
125 OUT UINT32
*ImplementationVersion
128 /** Return list of protocols.
130 @param[in] This A Pointer to SCMI_BASE_PROTOCOL Instance.
132 @param[out] ProtocolListSize Size of the ProtocolList.
134 @param[out] ProtocolList Protocol list.
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.
144 (EFIAPI
*SCMI_BASE_DISCOVER_LIST_PROTOCOLS
)(
145 IN SCMI_BASE_PROTOCOL
*This
,
146 IN OUT UINT32
*ProtocolListSize
,
147 OUT UINT8
*ProtocolList
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
;
160 // SCMI Message IDs for Base protocol.
162 ScmiMessageIdBaseDiscoverVendor
= 0x3,
163 ScmiMessageIdBaseDiscoverSubVendor
= 0x4,
164 ScmiMessageIdBaseDiscoverImplementationVersion
= 0x5,
165 ScmiMessageIdBaseDiscoverListProtocols
= 0x6
166 } SCMI_MESSAGE_ID_BASE
;
168 #endif /* ARM_SCMI_BASE_PROTOCOL_H_ */