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