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