[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC v2 5/8] xen/arm: introduce SCMI-SMC mediator driver
On 09/02/2022 15:02, Oleksandr Andrushchenko wrote:
+{
+ return FIELD_PREP(HDR_ID, hdr->id) |
+ FIELD_PREP(HDR_TYPE, hdr->type) |
+ FIELD_PREP(HDR_PROTO, hdr->protocol);
+}
+
+/*
+ * unpack_scmi_header() - unpacks and records message and protocol id
+ *
+ * @msg_hdr: 32-bit packed message header sent from the platform
+ * @hdr: pointer to header to fetch message and protocol id.
+ */
+static inline void unpack_scmi_header(uint32_t msg_hdr, scmi_msg_header_t *hdr)
+{
+ hdr->id = FIELD_GET(HDR_ID, msg_hdr);
+ hdr->type = FIELD_GET(HDR_TYPE, msg_hdr);
+ hdr->protocol = FIELD_GET(HDR_PROTO, msg_hdr);
+}
+
+static inline int channel_is_free(struct scmi_channel *chan_info)
+{
+ return ( chan_info->shmem->channel_status
+ & SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE ) ? 0 : -EBUSY;
+}
+
+/*
+ * Copy data from IO memory space to "real" memory space.
+ */
+void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
This seems to be a copy of [2].
We should think about moving this into a dedicated file like in Linux,
preserving the authorship+
+1. Also this should be in a separate patch.
Cheers,
--
Julien Grall
|