Lines Matching +full:scmi +full:- +full:shmem
1 /* SPDX-License-Identifier: GPL-2.0 */
3 * System Control and Management Interface (SCMI) Message Protocol
5 * and function prototypes used in all the different SCMI protocols.
7 * Copyright (C) 2018-2024 ARM Ltd.
36 SCMI_ERR_SUPPORT = -1, /* Not supported */
37 SCMI_ERR_PARAMS = -2, /* Invalid Parameters */
38 SCMI_ERR_ACCESS = -3, /* Invalid access/permission denied */
39 SCMI_ERR_ENTRY = -4, /* Not found */
40 SCMI_ERR_RANGE = -5, /* Value out of range */
41 SCMI_ERR_BUSY = -6, /* Device busy */
42 SCMI_ERR_COMMS = -7, /* Communication Error */
43 SCMI_ERR_GENERIC = -8, /* Generic Error */
44 SCMI_ERR_HARDWARE = -9, /* Hardware Error */
45 SCMI_ERR_PROTOCOL = -10,/* Protocol Error */
51 -EOPNOTSUPP, /* SCMI_ERR_SUPPORT */
52 -EINVAL, /* SCMI_ERR_PARAM */
53 -EACCES, /* SCMI_ERR_ACCESS */
54 -ENOENT, /* SCMI_ERR_ENTRY */
55 -ERANGE, /* SCMI_ERR_RANGE */
56 -EBUSY, /* SCMI_ERR_BUSY */
57 -ECOMM, /* SCMI_ERR_COMMS */
58 -EIO, /* SCMI_ERR_GENERIC */
59 -EREMOTEIO, /* SCMI_ERR_HARDWARE */
60 -EPROTO, /* SCMI_ERR_PROTOCOL */
65 int err_idx = -errno; in scmi_to_linux_errno()
69 return -EIO; in scmi_to_linux_errno()
88 * maximum number of in-flight messages on a specific platform, but such value
96 * pack_scmi_header() - packs and returns 32-bit header
101 * Return: 32-bit packed message header to be sent to the platform.
105 return FIELD_PREP(MSG_ID_MASK, hdr->id) | in pack_scmi_header()
106 FIELD_PREP(MSG_TYPE_MASK, hdr->type) | in pack_scmi_header()
107 FIELD_PREP(MSG_TOKEN_ID_MASK, hdr->seq) | in pack_scmi_header()
108 FIELD_PREP(MSG_PROTOCOL_ID_MASK, hdr->protocol_id); in pack_scmi_header()
112 * unpack_scmi_header() - unpacks and records message and protocol id
114 * @msg_hdr: 32-bit packed message header sent from the platform
119 hdr->id = MSG_XTRACT_ID(msg_hdr); in unpack_scmi_header()
120 hdr->protocol_id = MSG_XTRACT_PROT_ID(msg_hdr); in unpack_scmi_header()
121 hdr->type = MSG_XTRACT_TYPE(msg_hdr); in unpack_scmi_header()
134 if (xfer_->hdr.seq == k_) \
158 /* SCMI Transport */
160 * struct scmi_chan_info - Structure representing a SCMI channel information
164 * @dev: Reference to device in the SCMI hierarchy corresponding to this
168 * @handle: Pointer to SCMI entity handle
171 * This can be dynamically set by transports at run-time
186 * struct scmi_transport_ops - Structure representing a SCMI transport ops
220 * struct scmi_desc - Description of SoC integration
228 * @force_polling: Flag to force this whole transport to use SCMI core polling
231 * synchronous-command messages are atomically
254 return cinfo->no_completion_irq || desc->force_polling; in is_polling_required()
259 return desc->ops->poll_done || desc->sync_cmds_completed_on_ret; in is_transport_polling_capable()
307 MSG_UNEXPECTED = -1,
308 MSG_INVALID = -2,
309 MSG_UNKNOWN = -3,
310 MSG_NOMEM = -4,
311 MSG_MBOX_SPURIOUS = -5,
314 /* shmem related declarations */
318 * struct scmi_shared_mem_operations - Transport core operations for
321 * @tx_prepare: Prepare the @xfer message for transmission on the chosen @shmem
322 * @read_header: Read header of the message currently hold in @shmem
323 * @fetch_response: Copy the message response from @shmem into @xfer
324 * @fetch_notification: Copy the message notification from @shmem into @xfer
325 * @clear_channel: Clear the @shmem channel busy flag
326 * @poll_done: Check if poll has completed for @xfer on @shmem
327 * @channel_free: Check if @shmem channel is marked as free
328 * @channel_intr_enabled: Check is @shmem channel has requested a completion irq
332 void (*tx_prepare)(struct scmi_shared_mem __iomem *shmem,
335 u32 (*read_header)(struct scmi_shared_mem __iomem *shmem);
337 void (*fetch_response)(struct scmi_shared_mem __iomem *shmem,
339 void (*fetch_notification)(struct scmi_shared_mem __iomem *shmem,
341 void (*clear_channel)(struct scmi_shared_mem __iomem *shmem);
342 bool (*poll_done)(struct scmi_shared_mem __iomem *shmem,
344 bool (*channel_free)(struct scmi_shared_mem __iomem *shmem);
345 bool (*channel_intr_enabled)(struct scmi_shared_mem __iomem *shmem);
360 * struct scmi_message_operations - Transport core operations for Message
383 * struct scmi_transport_core_operations - Transpoert core operations
387 * @shmem: Datagram operations for shared memory based transports
395 const struct scmi_shared_mem_operations *shmem; member
400 * struct scmi_transport - A structure representing a configured transport
403 * the core SCMI stack
405 * @core_ops: A pointer to a pointer used by the core SCMI stack to make the
424 struct device *dev = &pdev->dev; \
429 spdev = platform_device_alloc("arm-scmi", PLATFORM_DEVID_AUTO); \
431 return -ENOMEM; \
433 device_set_of_node_from_dev(&spdev->dev, dev); \