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_H 8*ae8c8068SEtienne Carriere #define SCMI_MSG_H 9*ae8c8068SEtienne Carriere 10*ae8c8068SEtienne Carriere #include <compiler.h> 11*ae8c8068SEtienne Carriere #include <kernel/panic.h> 12*ae8c8068SEtienne Carriere #include <mm/core_memprot.h> 13*ae8c8068SEtienne Carriere #include <stdbool.h> 14*ae8c8068SEtienne Carriere #include <stddef.h> 15*ae8c8068SEtienne Carriere #include <stdint.h> 16*ae8c8068SEtienne Carriere 17*ae8c8068SEtienne Carriere /* Minimum size expected for SMT based shared memory message buffers */ 18*ae8c8068SEtienne Carriere #define SMT_BUF_SLOT_SIZE 128 19*ae8c8068SEtienne Carriere 20*ae8c8068SEtienne Carriere /* A channel abstract a communication path between agent and server */ 21*ae8c8068SEtienne Carriere struct scmi_msg_channel; 22*ae8c8068SEtienne Carriere 23*ae8c8068SEtienne Carriere /* 24*ae8c8068SEtienne Carriere * struct scmi_msg_channel - Shared memory buffer for a agent-to-server channel 25*ae8c8068SEtienne Carriere * 26*ae8c8068SEtienne Carriere * @shm_addr: Address of the shared memory for the SCMI channel 27*ae8c8068SEtienne Carriere * @shm_size: Byte size of the shared memory for the SCMI channel 28*ae8c8068SEtienne Carriere * @busy: True when channel is busy, flase when channel is free 29*ae8c8068SEtienne Carriere * @threaded: True is executed in a threaded context, false otherwise 30*ae8c8068SEtienne Carriere * @agent_name: Optional agent name, SCMI protocol exposes 16 bytes max 31*ae8c8068SEtienne Carriere */ 32*ae8c8068SEtienne Carriere struct scmi_msg_channel { 33*ae8c8068SEtienne Carriere struct io_pa_va shm_addr; 34*ae8c8068SEtienne Carriere size_t shm_size; 35*ae8c8068SEtienne Carriere bool busy; 36*ae8c8068SEtienne Carriere bool threaded; 37*ae8c8068SEtienne Carriere const char *agent_name; 38*ae8c8068SEtienne Carriere }; 39*ae8c8068SEtienne Carriere 40*ae8c8068SEtienne Carriere /* Platform callback functions */ 41*ae8c8068SEtienne Carriere 42*ae8c8068SEtienne Carriere /* 43*ae8c8068SEtienne Carriere * Return the SCMI channel related to an agent 44*ae8c8068SEtienne Carriere * @agent_id: SCMI agent ID 45*ae8c8068SEtienne Carriere * Return a pointer to channel on success, NULL otherwise 46*ae8c8068SEtienne Carriere */ 47*ae8c8068SEtienne Carriere struct scmi_msg_channel *plat_scmi_get_channel(unsigned int agent_id); 48*ae8c8068SEtienne Carriere 49*ae8c8068SEtienne Carriere /* 50*ae8c8068SEtienne Carriere * Return how many SCMI protocols supported by the platform 51*ae8c8068SEtienne Carriere * According to the SCMI specification, this function does not target 52*ae8c8068SEtienne Carriere * a specific agent ID and shall return all platform known capabilities. 53*ae8c8068SEtienne Carriere */ 54*ae8c8068SEtienne Carriere size_t plat_scmi_protocol_count(void); 55*ae8c8068SEtienne Carriere 56*ae8c8068SEtienne Carriere /* 57*ae8c8068SEtienne Carriere * Get the count and list of SCMI protocols (but base) supported for an agent 58*ae8c8068SEtienne Carriere * 59*ae8c8068SEtienne Carriere * @agent_id: SCMI agent ID 60*ae8c8068SEtienne Carriere * Return a pointer to a null terminated array supported protocol IDs. 61*ae8c8068SEtienne Carriere */ 62*ae8c8068SEtienne Carriere const uint8_t *plat_scmi_protocol_list(unsigned int agent_id); 63*ae8c8068SEtienne Carriere 64*ae8c8068SEtienne Carriere /* Get the name of the SCMI vendor for the platform */ 65*ae8c8068SEtienne Carriere const char *plat_scmi_vendor_name(void); 66*ae8c8068SEtienne Carriere 67*ae8c8068SEtienne Carriere /* Get the name of the SCMI sub-vendor for the platform */ 68*ae8c8068SEtienne Carriere const char *plat_scmi_sub_vendor_name(void); 69*ae8c8068SEtienne Carriere 70*ae8c8068SEtienne Carriere #endif /* SCMI_MSG_H */ 71