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