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