arm-trusted-firmware/drivers/scmi-msg/base.h

76 lines
1.8 KiB
C
Raw Normal View History

drivers/scmi-msg: driver for processing scmi messages This change introduces drivers to allow a platform to create a basic SCMI service and register handlers for client request (SCMI agent) on system resources. This is the first piece of the drivers: an entry function, the SCMI base protocol support and helpers for create the response message. With this change, scmi_process_message() is the entry function to process an incoming SCMI message. The function expect the message is already copied from shared memory into secure memory. The message structure stores message reference and output buffer reference where response message shall be stored. scmi_process_message() calls the SCMI protocol driver according to the protocol ID in the message. The SCMI protocol driver will call defined platform handlers according to the message content. This change introduces only the SCMI base protocol as defined in SCMI specification v2.0 [1]. Not all the messages defined in the specification are supported. The SCMI message implementation is derived from the OP-TEE project [2] itself based on the SCP-firmware implementation [3] of the SCMI protocol server side. Link: [1] http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/DEN0056A_System_Control_and_Management_Interface.pdf Link: [2] https://github.com/OP-TEE/optee_os/commit/ae8c8068098d291e6e55744dbc237ec39fd9840a Link: [3] https://github.com/ARM-software/SCP-firmware/tree/v2.6.0 Change-Id: I639c4154a39fca60606264baf8d32452641f45e9 Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2019-11-28 08:13:34 +00:00
/* SPDX-License-Identifier: BSD-3-Clause */
/*
* Copyright (c) 2015-2019, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2019-2020, Linaro Limited
*/
#ifndef SCMI_MSG_BASE_H
#define SCMI_MSG_BASE_H
#include <stdint.h>
#define SCMI_PROTOCOL_VERSION_BASE 0x20000U
#define SCMI_DEFAULT_STRING_LENGTH 16U
enum scmi_base_message_id {
SCMI_BASE_DISCOVER_VENDOR = 0x003,
SCMI_BASE_DISCOVER_SUB_VENDOR = 0x004,
SCMI_BASE_DISCOVER_IMPLEMENTATION_VERSION = 0x005,
SCMI_BASE_DISCOVER_LIST_PROTOCOLS = 0x006,
SCMI_BASE_DISCOVER_AGENT = 0x007,
SCMI_BASE_NOTIFY_ERRORS = 0x008,
};
/*
* PROTOCOL_ATTRIBUTES
*/
#define SCMI_BASE_PROTOCOL_ATTRS_NUM_PROTOCOLS_POS 0
#define SCMI_BASE_PROTOCOL_ATTRS_NUM_AGENTS_POS 8
#define SCMI_BASE_PROTOCOL_ATTRS_NUM_PROTOCOLS_MASK 0xFFU
#define SCMI_BASE_PROTOCOL_ATTRS_NUM_AGENTS_MASK 0xFF00U
#define SCMI_BASE_PROTOCOL_ATTRIBUTES(NUM_PROTOCOLS, NUM_AGENTS) \
((((NUM_PROTOCOLS) << SCMI_BASE_PROTOCOL_ATTRS_NUM_PROTOCOLS_POS) & \
SCMI_BASE_PROTOCOL_ATTRS_NUM_PROTOCOLS_MASK) | \
(((NUM_AGENTS) << SCMI_BASE_PROTOCOL_ATTRS_NUM_AGENTS_POS) & \
SCMI_BASE_PROTOCOL_ATTRS_NUM_AGENTS_MASK))
/*
* BASE_DISCOVER_VENDOR
*/
struct scmi_base_discover_vendor_p2a {
int32_t status;
char vendor_identifier[SCMI_DEFAULT_STRING_LENGTH];
};
/*
* BASE_DISCOVER_SUB_VENDOR
*/
struct scmi_base_discover_sub_vendor_p2a {
int32_t status;
char sub_vendor_identifier[SCMI_DEFAULT_STRING_LENGTH];
};
/*
* BASE_DISCOVER_IMPLEMENTATION_VERSION
* No special structure right now, see protocol_version.
*/
/*
* BASE_DISCOVER_LIST_PROTOCOLS
*/
struct scmi_base_discover_list_protocols_a2p {
uint32_t skip;
};
struct scmi_base_discover_list_protocols_p2a {
int32_t status;
uint32_t num_protocols;
uint32_t protocols[];
};
#endif /* SCMI_MSG_BASE_H */