Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Interfaces for ARM System Control and Management Interface (SCMI). More...

Topics

 Protocols
 Standard SCMI Protocol definitions.
 Transport
 SCMI Transport Layer abstraction and definitions.
 Utilities
 Helper macros and utilities for SCMI drivers.

Files

file  protocol.h
 Header file for the SCMI (System Control and Management Interface) driver API.

Data Structures

struct  scmi_protocol
 SCMI protocol structure. More...
struct  scmi_protocol_version
 SCMI protocol version. More...
struct  scmi_message
 SCMI message structure. More...

Macros

#define SCMI_SHORT_NAME_MAX_SIZE   16
 Maximum size of strings to describe SCMI names, including NUL terminator.
#define SCMI_MESSAGE_HDR_MAKE(id, type, proto, token)
 Build an SCMI message header.

Enumerations

enum  scmi_message_type { SCMI_COMMAND = 0x0 , SCMI_DELAYED_REPLY = 0x2 , SCMI_NOTIFICATION = 0x3 }
 SCMI message type. More...
enum  scmi_status_code {
  SCMI_SUCCESS = 0 , SCMI_NOT_SUPPORTED = -1 , SCMI_INVALID_PARAMETERS = -2 , SCMI_DENIED = -3 ,
  SCMI_NOT_FOUND = -4 , SCMI_OUT_OF_RANGE = -5 , SCMI_BUSY = -6 , SCMI_COMMS_ERROR = -7 ,
  SCMI_GENERIC_ERROR = -8 , SCMI_HARDWARE_ERROR = -9 , SCMI_PROTOCOL_ERROR = -10 , SCMI_IN_USE = -11
}
 SCMI status codes. More...

Functions

int scmi_status_to_errno (int scmi_status)
 Convert an SCMI status code to its Linux equivalent (if possible).
int scmi_send_message (struct scmi_protocol *proto, struct scmi_message *msg, struct scmi_message *reply, bool use_polling)
 Send an SCMI message and wait for its reply.
int scmi_protocol_get_version (struct scmi_protocol *proto, uint32_t *version)
 Get protocol version.
int scmi_protocol_attributes_get (struct scmi_protocol *proto, uint32_t *attributes)
 Get protocol attributes.
int scmi_protocol_message_attributes_get (struct scmi_protocol *proto, uint32_t message_id, uint32_t *attributes)
 Get protocol message attributes.
int scmi_protocol_version_negotiate (struct scmi_protocol *proto, uint32_t version)
 Negotiate protocol version.

Detailed Description

Interfaces for ARM System Control and Management Interface (SCMI).

Macro Definition Documentation

◆ SCMI_MESSAGE_HDR_MAKE

#define SCMI_MESSAGE_HDR_MAKE ( id,
type,
proto,
token )

#include <zephyr/drivers/firmware/scmi/protocol.h>

Value:
(SCMI_FIELD_MAKE(id, GENMASK(7, 0), 0) | SCMI_FIELD_MAKE(type, GENMASK(1, 0), 8) | \
SCMI_FIELD_MAKE(proto, GENMASK(7, 0), 10) | SCMI_FIELD_MAKE(token, GENMASK(9, 0), 18))
#define SCMI_FIELD_MAKE(x, mask, shift)
Create an SCMI message field.
Definition util.h:353
#define GENMASK(h, l)
Create a contiguous bitmask starting at bit position l and ending at position h.
Definition util.h:80

Build an SCMI message header.

Builds an SCMI message header based on the fields that make it up. The resulting 32-bit header is laid out as follows:

  • bits [7:0] message ID
  • bits [9:8] message type (see scmi_message_type)
  • bits [17:10] protocol ID
  • bits [27:18] message token
Parameters
idmessage ID
typemessage type
protoprotocol ID
tokenmessage token

◆ SCMI_SHORT_NAME_MAX_SIZE

#define SCMI_SHORT_NAME_MAX_SIZE   16

#include <zephyr/drivers/firmware/scmi/protocol.h>

Maximum size of strings to describe SCMI names, including NUL terminator.

Enumeration Type Documentation

◆ scmi_message_type

#include <zephyr/drivers/firmware/scmi/protocol.h>

SCMI message type.

Enumerator
SCMI_COMMAND 

Command message.

SCMI_DELAYED_REPLY 

Delayed reply message.

SCMI_NOTIFICATION 

Notification message.

◆ scmi_status_code

#include <zephyr/drivers/firmware/scmi/protocol.h>

SCMI status codes.

Enumerator
SCMI_SUCCESS 

Successful completion.

SCMI_NOT_SUPPORTED 

The command is not supported.

SCMI_INVALID_PARAMETERS 

One or more parameters are invalid.

SCMI_DENIED 

The caller is not permitted to perform the operation.

SCMI_NOT_FOUND 

The entity referenced by the command was not found.

SCMI_OUT_OF_RANGE 

A parameter or value is out of the supported range.

SCMI_BUSY 

The platform is busy and cannot service the command.

SCMI_COMMS_ERROR 

A communication error occurred.

SCMI_GENERIC_ERROR 

An unspecified error occurred.

SCMI_HARDWARE_ERROR 

A hardware error occurred.

SCMI_PROTOCOL_ERROR 

A protocol error (e.g.

malformed message) occurred

SCMI_IN_USE 

The resource is already in use.

Function Documentation

◆ scmi_protocol_attributes_get()

int scmi_protocol_attributes_get ( struct scmi_protocol * proto,
uint32_t * attributes )

#include <zephyr/drivers/firmware/scmi/protocol.h>

Get protocol attributes.

Parameters
protoProtocol instance
attributesPointer to store protocol attributes
Returns
0 on success, negative errno value on failure.

◆ scmi_protocol_get_version()

int scmi_protocol_get_version ( struct scmi_protocol * proto,
uint32_t * version )

#include <zephyr/drivers/firmware/scmi/protocol.h>

Get protocol version.

Parameters
protoProtocol instance
versionPointer to store protocol version
Returns
0 on success, negative errno value on failure.

◆ scmi_protocol_message_attributes_get()

int scmi_protocol_message_attributes_get ( struct scmi_protocol * proto,
uint32_t message_id,
uint32_t * attributes )

#include <zephyr/drivers/firmware/scmi/protocol.h>

Get protocol message attributes.

Parameters
protoProtocol instance
message_idMessage ID to query
attributesPointer to store message attributes
Returns
0 on success, negative errno value on failure.

◆ scmi_protocol_version_negotiate()

int scmi_protocol_version_negotiate ( struct scmi_protocol * proto,
uint32_t version )

#include <zephyr/drivers/firmware/scmi/protocol.h>

Negotiate protocol version.

Parameters
protoProtocol instance
versionDesired protocol version
Returns
0 on success, negative errno value on failure.

◆ scmi_send_message()

int scmi_send_message ( struct scmi_protocol * proto,
struct scmi_message * msg,
struct scmi_message * reply,
bool use_polling )

#include <zephyr/drivers/firmware/scmi/protocol.h>

Send an SCMI message and wait for its reply.

Blocking function used to send an SCMI message over a given channel and wait for its reply

Parameters
protopointer to SCMI protocol
msgpointer to SCMI message to send
replypointer to SCMI message in which the reply is to be written
use_pollingSpecifies the communication mechanism used by the scmi platform to interact with agents.
  • true: Polling mode — the platform actively checks the message status to determine if it has been processed
  • false: Interrupt mode — the platform relies on SCMI interrupts to detect when a message has been handled.
Returns
0 on success, negative errno value on failure.

◆ scmi_status_to_errno()

int scmi_status_to_errno ( int scmi_status)

#include <zephyr/drivers/firmware/scmi/protocol.h>

Convert an SCMI status code to its Linux equivalent (if possible).

Parameters
scmi_statusSCMI status code as shown in enum scmi_status_code
Returns
Linux (errno) equivalent of the given SCMI status code