7
7
#include "iavf_adminq.h"
8
8
#include "iavf_prototype.h"
9
9
10
- /**
11
- * iavf_adminq_init_regs - Initialize AdminQ registers
12
- * @hw: pointer to the hardware structure
13
- *
14
- * This assumes the alloc_asq and alloc_arq functions have already been called
15
- **/
16
- static void iavf_adminq_init_regs (struct iavf_hw * hw )
17
- {
18
- /* set head and tail registers in our local struct */
19
- hw -> aq .asq .tail = IAVF_VF_ATQT1 ;
20
- hw -> aq .asq .head = IAVF_VF_ATQH1 ;
21
- hw -> aq .asq .len = IAVF_VF_ATQLEN1 ;
22
- hw -> aq .asq .bal = IAVF_VF_ATQBAL1 ;
23
- hw -> aq .asq .bah = IAVF_VF_ATQBAH1 ;
24
- hw -> aq .arq .tail = IAVF_VF_ARQT1 ;
25
- hw -> aq .arq .head = IAVF_VF_ARQH1 ;
26
- hw -> aq .arq .len = IAVF_VF_ARQLEN1 ;
27
- hw -> aq .arq .bal = IAVF_VF_ARQBAL1 ;
28
- hw -> aq .arq .bah = IAVF_VF_ARQBAH1 ;
29
- }
30
-
31
10
/**
32
11
* iavf_alloc_adminq_asq_ring - Allocate Admin Queue send rings
33
12
* @hw: pointer to the hardware structure
@@ -259,17 +238,17 @@ static enum iavf_status iavf_config_asq_regs(struct iavf_hw *hw)
259
238
u32 reg = 0 ;
260
239
261
240
/* Clear Head and Tail */
262
- wr32 (hw , hw -> aq . asq . head , 0 );
263
- wr32 (hw , hw -> aq . asq . tail , 0 );
241
+ wr32 (hw , IAVF_VF_ATQH1 , 0 );
242
+ wr32 (hw , IAVF_VF_ATQT1 , 0 );
264
243
265
244
/* set starting point */
266
- wr32 (hw , hw -> aq . asq . len , (hw -> aq .num_asq_entries |
245
+ wr32 (hw , IAVF_VF_ATQLEN1 , (hw -> aq .num_asq_entries |
267
246
IAVF_VF_ATQLEN1_ATQENABLE_MASK ));
268
- wr32 (hw , hw -> aq . asq . bal , lower_32_bits (hw -> aq .asq .desc_buf .pa ));
269
- wr32 (hw , hw -> aq . asq . bah , upper_32_bits (hw -> aq .asq .desc_buf .pa ));
247
+ wr32 (hw , IAVF_VF_ATQBAL1 , lower_32_bits (hw -> aq .asq .desc_buf .pa ));
248
+ wr32 (hw , IAVF_VF_ATQBAH1 , upper_32_bits (hw -> aq .asq .desc_buf .pa ));
270
249
271
250
/* Check one register to verify that config was applied */
272
- reg = rd32 (hw , hw -> aq . asq . bal );
251
+ reg = rd32 (hw , IAVF_VF_ATQBAL1 );
273
252
if (reg != lower_32_bits (hw -> aq .asq .desc_buf .pa ))
274
253
ret_code = IAVF_ERR_ADMIN_QUEUE_ERROR ;
275
254
@@ -288,20 +267,20 @@ static enum iavf_status iavf_config_arq_regs(struct iavf_hw *hw)
288
267
u32 reg = 0 ;
289
268
290
269
/* Clear Head and Tail */
291
- wr32 (hw , hw -> aq . arq . head , 0 );
292
- wr32 (hw , hw -> aq . arq . tail , 0 );
270
+ wr32 (hw , IAVF_VF_ARQH1 , 0 );
271
+ wr32 (hw , IAVF_VF_ARQT1 , 0 );
293
272
294
273
/* set starting point */
295
- wr32 (hw , hw -> aq . arq . len , (hw -> aq .num_arq_entries |
274
+ wr32 (hw , IAVF_VF_ARQLEN1 , (hw -> aq .num_arq_entries |
296
275
IAVF_VF_ARQLEN1_ARQENABLE_MASK ));
297
- wr32 (hw , hw -> aq . arq . bal , lower_32_bits (hw -> aq .arq .desc_buf .pa ));
298
- wr32 (hw , hw -> aq . arq . bah , upper_32_bits (hw -> aq .arq .desc_buf .pa ));
276
+ wr32 (hw , IAVF_VF_ARQBAL1 , lower_32_bits (hw -> aq .arq .desc_buf .pa ));
277
+ wr32 (hw , IAVF_VF_ARQBAH1 , upper_32_bits (hw -> aq .arq .desc_buf .pa ));
299
278
300
279
/* Update tail in the HW to post pre-allocated buffers */
301
- wr32 (hw , hw -> aq . arq . tail , hw -> aq .num_arq_entries - 1 );
280
+ wr32 (hw , IAVF_VF_ARQT1 , hw -> aq .num_arq_entries - 1 );
302
281
303
282
/* Check one register to verify that config was applied */
304
- reg = rd32 (hw , hw -> aq . arq . bal );
283
+ reg = rd32 (hw , IAVF_VF_ARQBAL1 );
305
284
if (reg != lower_32_bits (hw -> aq .arq .desc_buf .pa ))
306
285
ret_code = IAVF_ERR_ADMIN_QUEUE_ERROR ;
307
286
@@ -455,11 +434,11 @@ static enum iavf_status iavf_shutdown_asq(struct iavf_hw *hw)
455
434
}
456
435
457
436
/* Stop firmware AdminQ processing */
458
- wr32 (hw , hw -> aq . asq . head , 0 );
459
- wr32 (hw , hw -> aq . asq . tail , 0 );
460
- wr32 (hw , hw -> aq . asq . len , 0 );
461
- wr32 (hw , hw -> aq . asq . bal , 0 );
462
- wr32 (hw , hw -> aq . asq . bah , 0 );
437
+ wr32 (hw , IAVF_VF_ATQH1 , 0 );
438
+ wr32 (hw , IAVF_VF_ATQT1 , 0 );
439
+ wr32 (hw , IAVF_VF_ATQLEN1 , 0 );
440
+ wr32 (hw , IAVF_VF_ATQBAL1 , 0 );
441
+ wr32 (hw , IAVF_VF_ATQBAH1 , 0 );
463
442
464
443
hw -> aq .asq .count = 0 ; /* to indicate uninitialized queue */
465
444
@@ -489,11 +468,11 @@ static enum iavf_status iavf_shutdown_arq(struct iavf_hw *hw)
489
468
}
490
469
491
470
/* Stop firmware AdminQ processing */
492
- wr32 (hw , hw -> aq . arq . head , 0 );
493
- wr32 (hw , hw -> aq . arq . tail , 0 );
494
- wr32 (hw , hw -> aq . arq . len , 0 );
495
- wr32 (hw , hw -> aq . arq . bal , 0 );
496
- wr32 (hw , hw -> aq . arq . bah , 0 );
471
+ wr32 (hw , IAVF_VF_ARQH1 , 0 );
472
+ wr32 (hw , IAVF_VF_ARQT1 , 0 );
473
+ wr32 (hw , IAVF_VF_ARQLEN1 , 0 );
474
+ wr32 (hw , IAVF_VF_ARQBAL1 , 0 );
475
+ wr32 (hw , IAVF_VF_ARQBAH1 , 0 );
497
476
498
477
hw -> aq .arq .count = 0 ; /* to indicate uninitialized queue */
499
478
@@ -529,9 +508,6 @@ enum iavf_status iavf_init_adminq(struct iavf_hw *hw)
529
508
goto init_adminq_exit ;
530
509
}
531
510
532
- /* Set up register offsets */
533
- iavf_adminq_init_regs (hw );
534
-
535
511
/* setup ASQ command write back timeout */
536
512
hw -> aq .asq_cmd_timeout = IAVF_ASQ_CMD_TIMEOUT ;
537
513
@@ -587,9 +563,9 @@ static u16 iavf_clean_asq(struct iavf_hw *hw)
587
563
588
564
desc = IAVF_ADMINQ_DESC (* asq , ntc );
589
565
details = IAVF_ADMINQ_DETAILS (* asq , ntc );
590
- while (rd32 (hw , hw -> aq . asq . head ) != ntc ) {
566
+ while (rd32 (hw , IAVF_VF_ATQH1 ) != ntc ) {
591
567
iavf_debug (hw , IAVF_DEBUG_AQ_MESSAGE ,
592
- "ntc %d head %d.\n" , ntc , rd32 (hw , hw -> aq . asq . head ));
568
+ "ntc %d head %d.\n" , ntc , rd32 (hw , IAVF_VF_ATQH1 ));
593
569
594
570
if (details -> callback ) {
595
571
IAVF_ADMINQ_CALLBACK cb_func =
@@ -624,7 +600,7 @@ bool iavf_asq_done(struct iavf_hw *hw)
624
600
/* AQ designers suggest use of head for better
625
601
* timing reliability than DD bit
626
602
*/
627
- return rd32 (hw , hw -> aq . asq . head ) == hw -> aq .asq .next_to_use ;
603
+ return rd32 (hw , IAVF_VF_ATQH1 ) == hw -> aq .asq .next_to_use ;
628
604
}
629
605
630
606
/**
@@ -663,7 +639,7 @@ enum iavf_status iavf_asq_send_command(struct iavf_hw *hw,
663
639
664
640
hw -> aq .asq_last_status = IAVF_AQ_RC_OK ;
665
641
666
- val = rd32 (hw , hw -> aq . asq . head );
642
+ val = rd32 (hw , IAVF_VF_ATQH1 );
667
643
if (val >= hw -> aq .num_asq_entries ) {
668
644
iavf_debug (hw , IAVF_DEBUG_AQ_MESSAGE ,
669
645
"AQTX: head overrun at %d\n" , val );
@@ -755,7 +731,7 @@ enum iavf_status iavf_asq_send_command(struct iavf_hw *hw,
755
731
if (hw -> aq .asq .next_to_use == hw -> aq .asq .count )
756
732
hw -> aq .asq .next_to_use = 0 ;
757
733
if (!details -> postpone )
758
- wr32 (hw , hw -> aq . asq . tail , hw -> aq .asq .next_to_use );
734
+ wr32 (hw , IAVF_VF_ATQT1 , hw -> aq .asq .next_to_use );
759
735
760
736
/* if cmd_details are not defined or async flag is not set,
761
737
* we need to wait for desc write back
@@ -810,7 +786,7 @@ enum iavf_status iavf_asq_send_command(struct iavf_hw *hw,
810
786
/* update the error if time out occurred */
811
787
if ((!cmd_completed ) &&
812
788
(!details -> async && !details -> postpone )) {
813
- if (rd32 (hw , hw -> aq . asq . len ) & IAVF_VF_ATQLEN1_ATQCRIT_MASK ) {
789
+ if (rd32 (hw , IAVF_VF_ATQLEN1 ) & IAVF_VF_ATQLEN1_ATQCRIT_MASK ) {
814
790
iavf_debug (hw , IAVF_DEBUG_AQ_MESSAGE ,
815
791
"AQTX: AQ Critical error.\n" );
816
792
status = IAVF_ERR_ADMIN_QUEUE_CRITICAL_ERROR ;
@@ -878,7 +854,7 @@ enum iavf_status iavf_clean_arq_element(struct iavf_hw *hw,
878
854
}
879
855
880
856
/* set next_to_use to head */
881
- ntu = rd32 (hw , hw -> aq . arq . head ) & IAVF_VF_ARQH1_ARQH_MASK ;
857
+ ntu = rd32 (hw , IAVF_VF_ARQH1 ) & IAVF_VF_ARQH1_ARQH_MASK ;
882
858
if (ntu == ntc ) {
883
859
/* nothing to do - shouldn't need to update ring's values */
884
860
ret_code = IAVF_ERR_ADMIN_QUEUE_NO_WORK ;
@@ -926,7 +902,7 @@ enum iavf_status iavf_clean_arq_element(struct iavf_hw *hw,
926
902
desc -> params .external .addr_low = cpu_to_le32 (lower_32_bits (bi -> pa ));
927
903
928
904
/* set tail = the last cleaned desc index. */
929
- wr32 (hw , hw -> aq . arq . tail , ntc );
905
+ wr32 (hw , IAVF_VF_ARQT1 , ntc );
930
906
/* ntc is updated to tail + 1 */
931
907
ntc ++ ;
932
908
if (ntc == hw -> aq .num_arq_entries )
0 commit comments