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