xref: /rk3399_ARM-atf/drivers/scmi-msg/base.h (revision 26dccba6dd1313113252357f433c8085f2c63a09)
1*b4734308SPeng Fan /* SPDX-License-Identifier: BSD-3-Clause */
2*b4734308SPeng Fan /*
3*b4734308SPeng Fan  * Copyright (c) 2015-2019, Arm Limited and Contributors. All rights reserved.
4*b4734308SPeng Fan  * Copyright (c) 2019-2020, Linaro Limited
5*b4734308SPeng Fan  */
6*b4734308SPeng Fan 
7*b4734308SPeng Fan #ifndef SCMI_MSG_BASE_H
8*b4734308SPeng Fan #define SCMI_MSG_BASE_H
9*b4734308SPeng Fan 
10*b4734308SPeng Fan #include <stdint.h>
11*b4734308SPeng Fan 
12*b4734308SPeng Fan #define SCMI_PROTOCOL_VERSION_BASE	0x20000U
13*b4734308SPeng Fan 
14*b4734308SPeng Fan #define SCMI_DEFAULT_STRING_LENGTH	16U
15*b4734308SPeng Fan 
16*b4734308SPeng Fan enum scmi_base_message_id {
17*b4734308SPeng Fan 	SCMI_BASE_DISCOVER_VENDOR			= 0x003,
18*b4734308SPeng Fan 	SCMI_BASE_DISCOVER_SUB_VENDOR			= 0x004,
19*b4734308SPeng Fan 	SCMI_BASE_DISCOVER_IMPLEMENTATION_VERSION	= 0x005,
20*b4734308SPeng Fan 	SCMI_BASE_DISCOVER_LIST_PROTOCOLS		= 0x006,
21*b4734308SPeng Fan 	SCMI_BASE_DISCOVER_AGENT			= 0x007,
22*b4734308SPeng Fan 	SCMI_BASE_NOTIFY_ERRORS				= 0x008,
23*b4734308SPeng Fan };
24*b4734308SPeng Fan 
25*b4734308SPeng Fan /*
26*b4734308SPeng Fan  * PROTOCOL_ATTRIBUTES
27*b4734308SPeng Fan  */
28*b4734308SPeng Fan 
29*b4734308SPeng Fan #define SCMI_BASE_PROTOCOL_ATTRS_NUM_PROTOCOLS_POS	0
30*b4734308SPeng Fan #define SCMI_BASE_PROTOCOL_ATTRS_NUM_AGENTS_POS		8
31*b4734308SPeng Fan 
32*b4734308SPeng Fan #define SCMI_BASE_PROTOCOL_ATTRS_NUM_PROTOCOLS_MASK	0xFFU
33*b4734308SPeng Fan #define SCMI_BASE_PROTOCOL_ATTRS_NUM_AGENTS_MASK	0xFF00U
34*b4734308SPeng Fan 
35*b4734308SPeng Fan #define SCMI_BASE_PROTOCOL_ATTRIBUTES(NUM_PROTOCOLS, NUM_AGENTS) \
36*b4734308SPeng Fan 	((((NUM_PROTOCOLS) << SCMI_BASE_PROTOCOL_ATTRS_NUM_PROTOCOLS_POS) & \
37*b4734308SPeng Fan 	  SCMI_BASE_PROTOCOL_ATTRS_NUM_PROTOCOLS_MASK) | \
38*b4734308SPeng Fan 	(((NUM_AGENTS) << SCMI_BASE_PROTOCOL_ATTRS_NUM_AGENTS_POS) & \
39*b4734308SPeng Fan 	 SCMI_BASE_PROTOCOL_ATTRS_NUM_AGENTS_MASK))
40*b4734308SPeng Fan 
41*b4734308SPeng Fan /*
42*b4734308SPeng Fan  * BASE_DISCOVER_VENDOR
43*b4734308SPeng Fan  */
44*b4734308SPeng Fan struct scmi_base_discover_vendor_p2a {
45*b4734308SPeng Fan 	int32_t status;
46*b4734308SPeng Fan 	char vendor_identifier[SCMI_DEFAULT_STRING_LENGTH];
47*b4734308SPeng Fan };
48*b4734308SPeng Fan 
49*b4734308SPeng Fan /*
50*b4734308SPeng Fan  * BASE_DISCOVER_SUB_VENDOR
51*b4734308SPeng Fan  */
52*b4734308SPeng Fan struct scmi_base_discover_sub_vendor_p2a {
53*b4734308SPeng Fan 	int32_t status;
54*b4734308SPeng Fan 	char sub_vendor_identifier[SCMI_DEFAULT_STRING_LENGTH];
55*b4734308SPeng Fan };
56*b4734308SPeng Fan 
57*b4734308SPeng Fan /*
58*b4734308SPeng Fan  * BASE_DISCOVER_IMPLEMENTATION_VERSION
59*b4734308SPeng Fan  * No special structure right now, see protocol_version.
60*b4734308SPeng Fan  */
61*b4734308SPeng Fan 
62*b4734308SPeng Fan /*
63*b4734308SPeng Fan  * BASE_DISCOVER_LIST_PROTOCOLS
64*b4734308SPeng Fan  */
65*b4734308SPeng Fan struct scmi_base_discover_list_protocols_a2p {
66*b4734308SPeng Fan 	uint32_t skip;
67*b4734308SPeng Fan };
68*b4734308SPeng Fan 
69*b4734308SPeng Fan struct scmi_base_discover_list_protocols_p2a {
70*b4734308SPeng Fan 	int32_t status;
71*b4734308SPeng Fan 	uint32_t num_protocols;
72*b4734308SPeng Fan 	uint32_t protocols[];
73*b4734308SPeng Fan };
74*b4734308SPeng Fan 
75*b4734308SPeng Fan #endif /* SCMI_MSG_BASE_H */
76