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