@@ -111,7 +111,7 @@ struct scmi_chan_info {
111
111
* @handle: Instance of SCMI handle to send to clients
112
112
* @version: SCMI revision information containing protocol version,
113
113
* implementation version and (sub-)vendor identification.
114
- * @minfo: Message info
114
+ * @tx_minfo: Universal Transmit Message management info
115
115
* @tx_idr: IDR object to map protocol id to Tx channel info pointer
116
116
* @rx_idr: IDR object to map protocol id to Rx channel info pointer
117
117
* @protocols_imp: List of protocols implemented, currently maximum of
@@ -124,7 +124,7 @@ struct scmi_info {
124
124
const struct scmi_desc * desc ;
125
125
struct scmi_revision_info version ;
126
126
struct scmi_handle handle ;
127
- struct scmi_xfers_info minfo ;
127
+ struct scmi_xfers_info tx_minfo ;
128
128
struct idr tx_idr ;
129
129
struct idr rx_idr ;
130
130
u8 * protocols_imp ;
@@ -251,6 +251,7 @@ static void scmi_tx_prepare(struct mbox_client *cl, void *m)
251
251
* scmi_xfer_get() - Allocate one message
252
252
*
253
253
* @handle: Pointer to SCMI entity handle
254
+ * @minfo: Pointer to Tx/Rx Message management info based on channel type
254
255
*
255
256
* Helper function which is used by various message functions that are
256
257
* exposed to clients of this driver for allocating a message traffic event.
@@ -261,13 +262,13 @@ static void scmi_tx_prepare(struct mbox_client *cl, void *m)
261
262
*
262
263
* Return: 0 if all went fine, else corresponding error.
263
264
*/
264
- static struct scmi_xfer * scmi_xfer_get (const struct scmi_handle * handle )
265
+ static struct scmi_xfer * scmi_xfer_get (const struct scmi_handle * handle ,
266
+ struct scmi_xfers_info * minfo )
265
267
{
266
268
u16 xfer_id ;
267
269
struct scmi_xfer * xfer ;
268
270
unsigned long flags , bit_pos ;
269
271
struct scmi_info * info = handle_to_scmi_info (handle );
270
- struct scmi_xfers_info * minfo = & info -> minfo ;
271
272
272
273
/* Keep the locked section as small as possible */
273
274
spin_lock_irqsave (& minfo -> xfer_lock , flags );
@@ -290,18 +291,17 @@ static struct scmi_xfer *scmi_xfer_get(const struct scmi_handle *handle)
290
291
}
291
292
292
293
/**
293
- * scmi_xfer_put () - Release a message
294
+ * __scmi_xfer_put () - Release a message
294
295
*
295
- * @handle : Pointer to SCMI entity handle
296
+ * @minfo : Pointer to Tx/Rx Message management info based on channel type
296
297
* @xfer: message that was reserved by scmi_xfer_get
297
298
*
298
299
* This holds a spinlock to maintain integrity of internal data structures.
299
300
*/
300
- void scmi_xfer_put (const struct scmi_handle * handle , struct scmi_xfer * xfer )
301
+ static void
302
+ __scmi_xfer_put (struct scmi_xfers_info * minfo , struct scmi_xfer * xfer )
301
303
{
302
304
unsigned long flags ;
303
- struct scmi_info * info = handle_to_scmi_info (handle );
304
- struct scmi_xfers_info * minfo = & info -> minfo ;
305
305
306
306
/*
307
307
* Keep the locked section as small as possible
@@ -332,7 +332,7 @@ static void scmi_rx_callback(struct mbox_client *cl, void *m)
332
332
struct scmi_chan_info * cinfo = client_to_scmi_chan_info (cl );
333
333
struct device * dev = cinfo -> dev ;
334
334
struct scmi_info * info = handle_to_scmi_info (cinfo -> handle );
335
- struct scmi_xfers_info * minfo = & info -> minfo ;
335
+ struct scmi_xfers_info * minfo = & info -> tx_minfo ;
336
336
struct scmi_shared_mem __iomem * mem = cinfo -> payload ;
337
337
338
338
xfer_id = MSG_XTRACT_TOKEN (ioread32 (& mem -> msg_header ));
@@ -351,6 +351,19 @@ static void scmi_rx_callback(struct mbox_client *cl, void *m)
351
351
complete (& xfer -> done );
352
352
}
353
353
354
+ /**
355
+ * scmi_xfer_put() - Release a transmit message
356
+ *
357
+ * @handle: Pointer to SCMI entity handle
358
+ * @xfer: message that was reserved by scmi_xfer_get
359
+ */
360
+ void scmi_xfer_put (const struct scmi_handle * handle , struct scmi_xfer * xfer )
361
+ {
362
+ struct scmi_info * info = handle_to_scmi_info (handle );
363
+
364
+ __scmi_xfer_put (& info -> tx_minfo , xfer );
365
+ }
366
+
354
367
static bool
355
368
scmi_xfer_poll_done (const struct scmi_chan_info * cinfo , struct scmi_xfer * xfer )
356
369
{
@@ -440,7 +453,7 @@ int scmi_do_xfer(const struct scmi_handle *handle, struct scmi_xfer *xfer)
440
453
}
441
454
442
455
/**
443
- * scmi_xfer_get_init() - Allocate and initialise one message
456
+ * scmi_xfer_get_init() - Allocate and initialise one message for transmit
444
457
*
445
458
* @handle: Pointer to SCMI entity handle
446
459
* @msg_id: Message identifier
@@ -461,14 +474,15 @@ int scmi_xfer_get_init(const struct scmi_handle *handle, u8 msg_id, u8 prot_id,
461
474
int ret ;
462
475
struct scmi_xfer * xfer ;
463
476
struct scmi_info * info = handle_to_scmi_info (handle );
477
+ struct scmi_xfers_info * minfo = & info -> tx_minfo ;
464
478
struct device * dev = info -> dev ;
465
479
466
480
/* Ensure we have sane transfer sizes */
467
481
if (rx_size > info -> desc -> max_msg_size ||
468
482
tx_size > info -> desc -> max_msg_size )
469
483
return - ERANGE ;
470
484
471
- xfer = scmi_xfer_get (handle );
485
+ xfer = scmi_xfer_get (handle , minfo );
472
486
if (IS_ERR (xfer )) {
473
487
ret = PTR_ERR (xfer );
474
488
dev_err (dev , "failed to get free message slot(%d)\n" , ret );
@@ -607,7 +621,7 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo)
607
621
struct scmi_xfer * xfer ;
608
622
struct device * dev = sinfo -> dev ;
609
623
const struct scmi_desc * desc = sinfo -> desc ;
610
- struct scmi_xfers_info * info = & sinfo -> minfo ;
624
+ struct scmi_xfers_info * info = & sinfo -> tx_minfo ;
611
625
612
626
/* Pre-allocated messages, no more than what hdr.seq can support */
613
627
if (WARN_ON (desc -> max_msg >= MSG_TOKEN_MAX )) {
0 commit comments