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