26
26
* other than data transfer to another endpoint.
27
27
*
28
28
* Immediate commands are represented by GSI transactions just like other
29
- * transfer requests, represented by a single GSI TRE. Each immediate
30
- * command has a well-defined format, having a payload of a known length.
31
- * This allows the transfer element's length field to be used to hold an
32
- * immediate command's opcode. The payload for a command resides in DRAM
33
- * and is described by a single scatterlist entry in its transaction.
34
- * Commands do not require a transaction completion callback. To commit
35
- * an immediate command transaction, either gsi_trans_commit_wait() or
36
- * gsi_trans_commit_wait_timeout() is used.
29
+ * transfer requests, and use a single GSI TRE. Each immediate command
30
+ * has a well-defined format, having a payload of a known length. This
31
+ * allows the transfer element's length field to be used to hold an
32
+ * immediate command's opcode. The payload for a command resides in AP
33
+ * memory and is described by a single scatterlist entry in its transaction.
34
+ * Commands do not require a transaction completion callback, and are
35
+ * (currently) always issued using gsi_trans_commit_wait().
37
36
*/
38
37
39
38
/* Some commands can wait until indicated pipeline stages are clear */
@@ -350,7 +349,6 @@ int ipa_cmd_pool_init(struct gsi_channel *channel, u32 tre_max)
350
349
{
351
350
struct gsi_trans_info * trans_info = & channel -> trans_info ;
352
351
struct device * dev = channel -> gsi -> dev ;
353
- int ret ;
354
352
355
353
/* This is as good a place as any to validate build constants */
356
354
ipa_cmd_validate_build ();
@@ -359,28 +357,16 @@ int ipa_cmd_pool_init(struct gsi_channel *channel, u32 tre_max)
359
357
* a single transaction can require up to tlv_count of them,
360
358
* so we treat them as if that many can be allocated at once.
361
359
*/
362
- ret = gsi_trans_pool_init_dma (dev , & trans_info -> cmd_pool ,
363
- sizeof (union ipa_cmd_payload ),
364
- tre_max , channel -> tlv_count );
365
- if (ret )
366
- return ret ;
367
-
368
- /* Each TRE needs a command info structure */
369
- ret = gsi_trans_pool_init (& trans_info -> info_pool ,
370
- sizeof (struct ipa_cmd_info ),
371
- tre_max , channel -> tlv_count );
372
- if (ret )
373
- gsi_trans_pool_exit_dma (dev , & trans_info -> cmd_pool );
374
-
375
- return ret ;
360
+ return gsi_trans_pool_init_dma (dev , & trans_info -> cmd_pool ,
361
+ sizeof (union ipa_cmd_payload ),
362
+ tre_max , channel -> tlv_count );
376
363
}
377
364
378
365
void ipa_cmd_pool_exit (struct gsi_channel * channel )
379
366
{
380
367
struct gsi_trans_info * trans_info = & channel -> trans_info ;
381
368
struct device * dev = channel -> gsi -> dev ;
382
369
383
- gsi_trans_pool_exit (& trans_info -> info_pool );
384
370
gsi_trans_pool_exit_dma (dev , & trans_info -> cmd_pool );
385
371
}
386
372
@@ -403,7 +389,6 @@ void ipa_cmd_table_init_add(struct gsi_trans *trans,
403
389
dma_addr_t hash_addr )
404
390
{
405
391
struct ipa * ipa = container_of (trans -> gsi , struct ipa , gsi );
406
- enum dma_data_direction direction = DMA_TO_DEVICE ;
407
392
struct ipa_cmd_hw_ip_fltrt_init * payload ;
408
393
union ipa_cmd_payload * cmd_payload ;
409
394
dma_addr_t payload_addr ;
@@ -434,7 +419,7 @@ void ipa_cmd_table_init_add(struct gsi_trans *trans,
434
419
payload -> nhash_rules_addr = cpu_to_le64 (addr );
435
420
436
421
gsi_trans_cmd_add (trans , payload , sizeof (* payload ), payload_addr ,
437
- direction , opcode );
422
+ opcode );
438
423
}
439
424
440
425
/* Initialize header space in IPA-local memory */
@@ -443,7 +428,6 @@ void ipa_cmd_hdr_init_local_add(struct gsi_trans *trans, u32 offset, u16 size,
443
428
{
444
429
struct ipa * ipa = container_of (trans -> gsi , struct ipa , gsi );
445
430
enum ipa_cmd_opcode opcode = IPA_CMD_HDR_INIT_LOCAL ;
446
- enum dma_data_direction direction = DMA_TO_DEVICE ;
447
431
struct ipa_cmd_hw_hdr_init_local * payload ;
448
432
union ipa_cmd_payload * cmd_payload ;
449
433
dma_addr_t payload_addr ;
@@ -465,7 +449,7 @@ void ipa_cmd_hdr_init_local_add(struct gsi_trans *trans, u32 offset, u16 size,
465
449
payload -> flags = cpu_to_le32 (flags );
466
450
467
451
gsi_trans_cmd_add (trans , payload , sizeof (* payload ), payload_addr ,
468
- direction , opcode );
452
+ opcode );
469
453
}
470
454
471
455
void ipa_cmd_register_write_add (struct gsi_trans * trans , u32 offset , u32 value ,
@@ -522,15 +506,14 @@ void ipa_cmd_register_write_add(struct gsi_trans *trans, u32 offset, u32 value,
522
506
payload -> clear_options = cpu_to_le32 (options );
523
507
524
508
gsi_trans_cmd_add (trans , payload , sizeof (* payload ), payload_addr ,
525
- DMA_NONE , opcode );
509
+ opcode );
526
510
}
527
511
528
512
/* Skip IP packet processing on the next data transfer on a TX channel */
529
513
static void ipa_cmd_ip_packet_init_add (struct gsi_trans * trans , u8 endpoint_id )
530
514
{
531
515
struct ipa * ipa = container_of (trans -> gsi , struct ipa , gsi );
532
516
enum ipa_cmd_opcode opcode = IPA_CMD_IP_PACKET_INIT ;
533
- enum dma_data_direction direction = DMA_TO_DEVICE ;
534
517
struct ipa_cmd_ip_packet_init * payload ;
535
518
union ipa_cmd_payload * cmd_payload ;
536
519
dma_addr_t payload_addr ;
@@ -542,7 +525,7 @@ static void ipa_cmd_ip_packet_init_add(struct gsi_trans *trans, u8 endpoint_id)
542
525
IPA_PACKET_INIT_DEST_ENDPOINT_FMASK );
543
526
544
527
gsi_trans_cmd_add (trans , payload , sizeof (* payload ), payload_addr ,
545
- direction , opcode );
528
+ opcode );
546
529
}
547
530
548
531
/* Use a DMA command to read or write a block of IPA-resident memory */
@@ -553,7 +536,6 @@ void ipa_cmd_dma_shared_mem_add(struct gsi_trans *trans, u32 offset, u16 size,
553
536
enum ipa_cmd_opcode opcode = IPA_CMD_DMA_SHARED_MEM ;
554
537
struct ipa_cmd_hw_dma_mem_mem * payload ;
555
538
union ipa_cmd_payload * cmd_payload ;
556
- enum dma_data_direction direction ;
557
539
dma_addr_t payload_addr ;
558
540
u16 flags ;
559
541
@@ -584,17 +566,14 @@ void ipa_cmd_dma_shared_mem_add(struct gsi_trans *trans, u32 offset, u16 size,
584
566
payload -> flags = cpu_to_le16 (flags );
585
567
payload -> system_addr = cpu_to_le64 (addr );
586
568
587
- direction = toward_ipa ? DMA_TO_DEVICE : DMA_FROM_DEVICE ;
588
-
589
569
gsi_trans_cmd_add (trans , payload , sizeof (* payload ), payload_addr ,
590
- direction , opcode );
570
+ opcode );
591
571
}
592
572
593
573
static void ipa_cmd_ip_tag_status_add (struct gsi_trans * trans )
594
574
{
595
575
struct ipa * ipa = container_of (trans -> gsi , struct ipa , gsi );
596
576
enum ipa_cmd_opcode opcode = IPA_CMD_IP_PACKET_TAG_STATUS ;
597
- enum dma_data_direction direction = DMA_TO_DEVICE ;
598
577
struct ipa_cmd_ip_packet_tag_status * payload ;
599
578
union ipa_cmd_payload * cmd_payload ;
600
579
dma_addr_t payload_addr ;
@@ -605,14 +584,13 @@ static void ipa_cmd_ip_tag_status_add(struct gsi_trans *trans)
605
584
payload -> tag = le64_encode_bits (0 , IP_PACKET_TAG_STATUS_TAG_FMASK );
606
585
607
586
gsi_trans_cmd_add (trans , payload , sizeof (* payload ), payload_addr ,
608
- direction , opcode );
587
+ opcode );
609
588
}
610
589
611
590
/* Issue a small command TX data transfer */
612
591
static void ipa_cmd_transfer_add (struct gsi_trans * trans )
613
592
{
614
593
struct ipa * ipa = container_of (trans -> gsi , struct ipa , gsi );
615
- enum dma_data_direction direction = DMA_TO_DEVICE ;
616
594
enum ipa_cmd_opcode opcode = IPA_CMD_NONE ;
617
595
union ipa_cmd_payload * payload ;
618
596
dma_addr_t payload_addr ;
@@ -621,7 +599,7 @@ static void ipa_cmd_transfer_add(struct gsi_trans *trans)
621
599
payload = ipa_cmd_payload_alloc (ipa , & payload_addr );
622
600
623
601
gsi_trans_cmd_add (trans , payload , sizeof (* payload ), payload_addr ,
624
- direction , opcode );
602
+ opcode );
625
603
}
626
604
627
605
/* Add immediate commands to a transaction to clear the hardware pipeline */
@@ -661,28 +639,16 @@ void ipa_cmd_pipeline_clear_wait(struct ipa *ipa)
661
639
wait_for_completion (& ipa -> completion );
662
640
}
663
641
664
- static struct ipa_cmd_info *
665
- ipa_cmd_info_alloc (struct ipa_endpoint * endpoint , u32 tre_count )
666
- {
667
- struct gsi_channel * channel ;
668
-
669
- channel = & endpoint -> ipa -> gsi .channel [endpoint -> channel_id ];
670
-
671
- return gsi_trans_pool_alloc (& channel -> trans_info .info_pool , tre_count );
672
- }
673
-
674
642
/* Allocate a transaction for the command TX endpoint */
675
643
struct gsi_trans * ipa_cmd_trans_alloc (struct ipa * ipa , u32 tre_count )
676
644
{
677
645
struct ipa_endpoint * endpoint ;
678
- struct gsi_trans * trans ;
679
646
680
- endpoint = ipa -> name_map [IPA_ENDPOINT_AP_COMMAND_TX ];
647
+ if (WARN_ON (tre_count > IPA_COMMAND_TRANS_TRE_MAX ))
648
+ return NULL ;
681
649
682
- trans = gsi_channel_trans_alloc (& ipa -> gsi , endpoint -> channel_id ,
683
- tre_count , DMA_NONE );
684
- if (trans )
685
- trans -> info = ipa_cmd_info_alloc (endpoint , tre_count );
650
+ endpoint = ipa -> name_map [IPA_ENDPOINT_AP_COMMAND_TX ];
686
651
687
- return trans ;
652
+ return gsi_channel_trans_alloc (& ipa -> gsi , endpoint -> channel_id ,
653
+ tre_count , DMA_NONE );
688
654
}
0 commit comments