|
30 | 30 | #include "common.h"
|
31 | 31 |
|
32 | 32 | #define MSG_ID_MASK GENMASK(7, 0)
|
| 33 | +#define MSG_XTRACT_ID(hdr) FIELD_GET(MSG_ID_MASK, (hdr)) |
33 | 34 | #define MSG_TYPE_MASK GENMASK(9, 8)
|
| 35 | +#define MSG_XTRACT_TYPE(hdr) FIELD_GET(MSG_TYPE_MASK, (hdr)) |
| 36 | +#define MSG_TYPE_COMMAND 0 |
| 37 | +#define MSG_TYPE_DELAYED_RESP 2 |
| 38 | +#define MSG_TYPE_NOTIFICATION 3 |
34 | 39 | #define MSG_PROTOCOL_ID_MASK GENMASK(17, 10)
|
| 40 | +#define MSG_XTRACT_PROT_ID(hdr) FIELD_GET(MSG_PROTOCOL_ID_MASK, (hdr)) |
35 | 41 | #define MSG_TOKEN_ID_MASK GENMASK(27, 18)
|
36 | 42 | #define MSG_XTRACT_TOKEN(hdr) FIELD_GET(MSG_TOKEN_ID_MASK, (hdr))
|
37 | 43 | #define MSG_TOKEN_MAX (MSG_XTRACT_TOKEN(MSG_TOKEN_ID_MASK) + 1)
|
@@ -214,6 +220,18 @@ static inline u32 pack_scmi_header(struct scmi_msg_hdr *hdr)
|
214 | 220 | FIELD_PREP(MSG_PROTOCOL_ID_MASK, hdr->protocol_id);
|
215 | 221 | }
|
216 | 222 |
|
| 223 | +/** |
| 224 | + * unpack_scmi_header() - unpacks and records message and protocol id |
| 225 | + * |
| 226 | + * @msg_hdr: 32-bit packed message header sent from the platform |
| 227 | + * @hdr: pointer to header to fetch message and protocol id. |
| 228 | + */ |
| 229 | +static inline void unpack_scmi_header(u32 msg_hdr, struct scmi_msg_hdr *hdr) |
| 230 | +{ |
| 231 | + hdr->id = MSG_XTRACT_ID(msg_hdr); |
| 232 | + hdr->protocol_id = MSG_XTRACT_PROT_ID(msg_hdr); |
| 233 | +} |
| 234 | + |
217 | 235 | /**
|
218 | 236 | * scmi_tx_prepare() - mailbox client callback to prepare for the transfer
|
219 | 237 | *
|
|
0 commit comments