77#include "iavf_adminq.h"
88#include "iavf_prototype.h"
99
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-
3110/**
3211 * iavf_alloc_adminq_asq_ring - Allocate Admin Queue send rings
3312 * @hw: pointer to the hardware structure
@@ -259,17 +238,17 @@ static enum iavf_status iavf_config_asq_regs(struct iavf_hw *hw)
259238 u32 reg = 0 ;
260239
261240 /* 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 );
264243
265244 /* 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 |
267246 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 ));
270249
271250 /* Check one register to verify that config was applied */
272- reg = rd32 (hw , hw -> aq . asq . bal );
251+ reg = rd32 (hw , IAVF_VF_ATQBAL1 );
273252 if (reg != lower_32_bits (hw -> aq .asq .desc_buf .pa ))
274253 ret_code = IAVF_ERR_ADMIN_QUEUE_ERROR ;
275254
@@ -288,20 +267,20 @@ static enum iavf_status iavf_config_arq_regs(struct iavf_hw *hw)
288267 u32 reg = 0 ;
289268
290269 /* 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 );
293272
294273 /* 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 |
296275 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 ));
299278
300279 /* 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 );
302281
303282 /* Check one register to verify that config was applied */
304- reg = rd32 (hw , hw -> aq . arq . bal );
283+ reg = rd32 (hw , IAVF_VF_ARQBAL1 );
305284 if (reg != lower_32_bits (hw -> aq .arq .desc_buf .pa ))
306285 ret_code = IAVF_ERR_ADMIN_QUEUE_ERROR ;
307286
@@ -455,11 +434,11 @@ static enum iavf_status iavf_shutdown_asq(struct iavf_hw *hw)
455434 }
456435
457436 /* 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 );
463442
464443 hw -> aq .asq .count = 0 ; /* to indicate uninitialized queue */
465444
@@ -489,11 +468,11 @@ static enum iavf_status iavf_shutdown_arq(struct iavf_hw *hw)
489468 }
490469
491470 /* 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 );
497476
498477 hw -> aq .arq .count = 0 ; /* to indicate uninitialized queue */
499478
@@ -529,9 +508,6 @@ enum iavf_status iavf_init_adminq(struct iavf_hw *hw)
529508 goto init_adminq_exit ;
530509 }
531510
532- /* Set up register offsets */
533- iavf_adminq_init_regs (hw );
534-
535511 /* setup ASQ command write back timeout */
536512 hw -> aq .asq_cmd_timeout = IAVF_ASQ_CMD_TIMEOUT ;
537513
@@ -587,9 +563,9 @@ static u16 iavf_clean_asq(struct iavf_hw *hw)
587563
588564 desc = IAVF_ADMINQ_DESC (* asq , ntc );
589565 details = IAVF_ADMINQ_DETAILS (* asq , ntc );
590- while (rd32 (hw , hw -> aq . asq . head ) != ntc ) {
566+ while (rd32 (hw , IAVF_VF_ATQH1 ) != ntc ) {
591567 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 ));
593569
594570 if (details -> callback ) {
595571 IAVF_ADMINQ_CALLBACK cb_func =
@@ -624,7 +600,7 @@ bool iavf_asq_done(struct iavf_hw *hw)
624600 /* AQ designers suggest use of head for better
625601 * timing reliability than DD bit
626602 */
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 ;
628604}
629605
630606/**
@@ -663,7 +639,7 @@ enum iavf_status iavf_asq_send_command(struct iavf_hw *hw,
663639
664640 hw -> aq .asq_last_status = IAVF_AQ_RC_OK ;
665641
666- val = rd32 (hw , hw -> aq . asq . head );
642+ val = rd32 (hw , IAVF_VF_ATQH1 );
667643 if (val >= hw -> aq .num_asq_entries ) {
668644 iavf_debug (hw , IAVF_DEBUG_AQ_MESSAGE ,
669645 "AQTX: head overrun at %d\n" , val );
@@ -755,7 +731,7 @@ enum iavf_status iavf_asq_send_command(struct iavf_hw *hw,
755731 if (hw -> aq .asq .next_to_use == hw -> aq .asq .count )
756732 hw -> aq .asq .next_to_use = 0 ;
757733 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 );
759735
760736 /* if cmd_details are not defined or async flag is not set,
761737 * we need to wait for desc write back
@@ -810,7 +786,7 @@ enum iavf_status iavf_asq_send_command(struct iavf_hw *hw,
810786 /* update the error if time out occurred */
811787 if ((!cmd_completed ) &&
812788 (!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 ) {
814790 iavf_debug (hw , IAVF_DEBUG_AQ_MESSAGE ,
815791 "AQTX: AQ Critical error.\n" );
816792 status = IAVF_ERR_ADMIN_QUEUE_CRITICAL_ERROR ;
@@ -878,7 +854,7 @@ enum iavf_status iavf_clean_arq_element(struct iavf_hw *hw,
878854 }
879855
880856 /* 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 ;
882858 if (ntu == ntc ) {
883859 /* nothing to do - shouldn't need to update ring's values */
884860 ret_code = IAVF_ERR_ADMIN_QUEUE_NO_WORK ;
@@ -926,7 +902,7 @@ enum iavf_status iavf_clean_arq_element(struct iavf_hw *hw,
926902 desc -> params .external .addr_low = cpu_to_le32 (lower_32_bits (bi -> pa ));
927903
928904 /* set tail = the last cleaned desc index. */
929- wr32 (hw , hw -> aq . arq . tail , ntc );
905+ wr32 (hw , IAVF_VF_ARQT1 , ntc );
930906 /* ntc is updated to tail + 1 */
931907 ntc ++ ;
932908 if (ntc == hw -> aq .num_arq_entries )
0 commit comments