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