88
99static void i40e_resume_aq (struct i40e_hw * hw );
1010
11- /**
12- * i40e_adminq_init_regs - Initialize AdminQ registers
13- * @hw: pointer to the hardware structure
14- *
15- * This assumes the alloc_asq and alloc_arq functions have already been called
16- **/
17- static void i40e_adminq_init_regs (struct i40e_hw * hw )
18- {
19- /* set head and tail registers in our local struct */
20- hw -> aq .asq .tail = I40E_PF_ATQT ;
21- hw -> aq .asq .head = I40E_PF_ATQH ;
22- hw -> aq .asq .len = I40E_PF_ATQLEN ;
23- hw -> aq .asq .bal = I40E_PF_ATQBAL ;
24- hw -> aq .asq .bah = I40E_PF_ATQBAH ;
25- hw -> aq .arq .tail = I40E_PF_ARQT ;
26- hw -> aq .arq .head = I40E_PF_ARQH ;
27- hw -> aq .arq .len = I40E_PF_ARQLEN ;
28- hw -> aq .arq .bal = I40E_PF_ARQBAL ;
29- hw -> aq .arq .bah = I40E_PF_ARQBAH ;
30- }
31-
3211/**
3312 * i40e_alloc_adminq_asq_ring - Allocate Admin Queue send rings
3413 * @hw: pointer to the hardware structure
@@ -254,17 +233,17 @@ static int i40e_config_asq_regs(struct i40e_hw *hw)
254233 u32 reg = 0 ;
255234
256235 /* Clear Head and Tail */
257- wr32 (hw , hw -> aq . asq . head , 0 );
258- wr32 (hw , hw -> aq . asq . tail , 0 );
236+ wr32 (hw , I40E_PF_ATQH , 0 );
237+ wr32 (hw , I40E_PF_ATQT , 0 );
259238
260239 /* set starting point */
261- wr32 (hw , hw -> aq . asq . len , (hw -> aq .num_asq_entries |
240+ wr32 (hw , I40E_PF_ATQLEN , (hw -> aq .num_asq_entries |
262241 I40E_PF_ATQLEN_ATQENABLE_MASK ));
263- wr32 (hw , hw -> aq . asq . bal , lower_32_bits (hw -> aq .asq .desc_buf .pa ));
264- wr32 (hw , hw -> aq . asq . bah , upper_32_bits (hw -> aq .asq .desc_buf .pa ));
242+ wr32 (hw , I40E_PF_ATQBAL , lower_32_bits (hw -> aq .asq .desc_buf .pa ));
243+ wr32 (hw , I40E_PF_ATQBAH , upper_32_bits (hw -> aq .asq .desc_buf .pa ));
265244
266245 /* Check one register to verify that config was applied */
267- reg = rd32 (hw , hw -> aq . asq . bal );
246+ reg = rd32 (hw , I40E_PF_ATQBAL );
268247 if (reg != lower_32_bits (hw -> aq .asq .desc_buf .pa ))
269248 ret_code = - EIO ;
270249
@@ -283,20 +262,20 @@ static int i40e_config_arq_regs(struct i40e_hw *hw)
283262 u32 reg = 0 ;
284263
285264 /* Clear Head and Tail */
286- wr32 (hw , hw -> aq . arq . head , 0 );
287- wr32 (hw , hw -> aq . arq . tail , 0 );
265+ wr32 (hw , I40E_PF_ARQH , 0 );
266+ wr32 (hw , I40E_PF_ARQT , 0 );
288267
289268 /* set starting point */
290- wr32 (hw , hw -> aq . arq . len , (hw -> aq .num_arq_entries |
269+ wr32 (hw , I40E_PF_ARQLEN , (hw -> aq .num_arq_entries |
291270 I40E_PF_ARQLEN_ARQENABLE_MASK ));
292- wr32 (hw , hw -> aq . arq . bal , lower_32_bits (hw -> aq .arq .desc_buf .pa ));
293- wr32 (hw , hw -> aq . arq . bah , upper_32_bits (hw -> aq .arq .desc_buf .pa ));
271+ wr32 (hw , I40E_PF_ARQBAL , lower_32_bits (hw -> aq .arq .desc_buf .pa ));
272+ wr32 (hw , I40E_PF_ARQBAH , upper_32_bits (hw -> aq .arq .desc_buf .pa ));
294273
295274 /* Update tail in the HW to post pre-allocated buffers */
296- wr32 (hw , hw -> aq . arq . tail , hw -> aq .num_arq_entries - 1 );
275+ wr32 (hw , I40E_PF_ARQT , hw -> aq .num_arq_entries - 1 );
297276
298277 /* Check one register to verify that config was applied */
299- reg = rd32 (hw , hw -> aq . arq . bal );
278+ reg = rd32 (hw , I40E_PF_ARQBAL );
300279 if (reg != lower_32_bits (hw -> aq .arq .desc_buf .pa ))
301280 ret_code = - EIO ;
302281
@@ -439,11 +418,11 @@ static int i40e_shutdown_asq(struct i40e_hw *hw)
439418 }
440419
441420 /* Stop firmware AdminQ processing */
442- wr32 (hw , hw -> aq . asq . head , 0 );
443- wr32 (hw , hw -> aq . asq . tail , 0 );
444- wr32 (hw , hw -> aq . asq . len , 0 );
445- wr32 (hw , hw -> aq . asq . bal , 0 );
446- wr32 (hw , hw -> aq . asq . bah , 0 );
421+ wr32 (hw , I40E_PF_ATQH , 0 );
422+ wr32 (hw , I40E_PF_ATQT , 0 );
423+ wr32 (hw , I40E_PF_ATQLEN , 0 );
424+ wr32 (hw , I40E_PF_ATQBAL , 0 );
425+ wr32 (hw , I40E_PF_ATQBAH , 0 );
447426
448427 hw -> aq .asq .count = 0 ; /* to indicate uninitialized queue */
449428
@@ -473,11 +452,11 @@ static int i40e_shutdown_arq(struct i40e_hw *hw)
473452 }
474453
475454 /* Stop firmware AdminQ processing */
476- wr32 (hw , hw -> aq . arq . head , 0 );
477- wr32 (hw , hw -> aq . arq . tail , 0 );
478- wr32 (hw , hw -> aq . arq . len , 0 );
479- wr32 (hw , hw -> aq . arq . bal , 0 );
480- wr32 (hw , hw -> aq . arq . bah , 0 );
455+ wr32 (hw , I40E_PF_ARQH , 0 );
456+ wr32 (hw , I40E_PF_ARQT , 0 );
457+ wr32 (hw , I40E_PF_ARQLEN , 0 );
458+ wr32 (hw , I40E_PF_ARQBAL , 0 );
459+ wr32 (hw , I40E_PF_ARQBAH , 0 );
481460
482461 hw -> aq .arq .count = 0 ; /* to indicate uninitialized queue */
483462
@@ -608,9 +587,6 @@ int i40e_init_adminq(struct i40e_hw *hw)
608587 goto init_adminq_exit ;
609588 }
610589
611- /* Set up register offsets */
612- i40e_adminq_init_regs (hw );
613-
614590 /* setup ASQ command write back timeout */
615591 hw -> aq .asq_cmd_timeout = I40E_ASQ_CMD_TIMEOUT ;
616592
@@ -720,9 +696,9 @@ static u16 i40e_clean_asq(struct i40e_hw *hw)
720696
721697 desc = I40E_ADMINQ_DESC (* asq , ntc );
722698 details = I40E_ADMINQ_DETAILS (* asq , ntc );
723- while (rd32 (hw , hw -> aq . asq . head ) != ntc ) {
699+ while (rd32 (hw , I40E_PF_ATQH ) != ntc ) {
724700 i40e_debug (hw , I40E_DEBUG_AQ_COMMAND ,
725- "ntc %d head %d.\n" , ntc , rd32 (hw , hw -> aq . asq . head ));
701+ "ntc %d head %d.\n" , ntc , rd32 (hw , I40E_PF_ATQH ));
726702
727703 if (details -> callback ) {
728704 I40E_ADMINQ_CALLBACK cb_func =
@@ -756,7 +732,7 @@ static bool i40e_asq_done(struct i40e_hw *hw)
756732 /* AQ designers suggest use of head for better
757733 * timing reliability than DD bit
758734 */
759- return rd32 (hw , hw -> aq . asq . head ) == hw -> aq .asq .next_to_use ;
735+ return rd32 (hw , I40E_PF_ATQH ) == hw -> aq .asq .next_to_use ;
760736
761737}
762738
@@ -797,7 +773,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
797773
798774 hw -> aq .asq_last_status = I40E_AQ_RC_OK ;
799775
800- val = rd32 (hw , hw -> aq . asq . head );
776+ val = rd32 (hw , I40E_PF_ATQH );
801777 if (val >= hw -> aq .num_asq_entries ) {
802778 i40e_debug (hw , I40E_DEBUG_AQ_MESSAGE ,
803779 "AQTX: head overrun at %d\n" , val );
@@ -889,7 +865,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
889865 if (hw -> aq .asq .next_to_use == hw -> aq .asq .count )
890866 hw -> aq .asq .next_to_use = 0 ;
891867 if (!details -> postpone )
892- wr32 (hw , hw -> aq . asq . tail , hw -> aq .asq .next_to_use );
868+ wr32 (hw , I40E_PF_ATQT , hw -> aq .asq .next_to_use );
893869
894870 /* if cmd_details are not defined or async flag is not set,
895871 * we need to wait for desc write back
@@ -949,7 +925,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
949925 /* update the error if time out occurred */
950926 if ((!cmd_completed ) &&
951927 (!details -> async && !details -> postpone )) {
952- if (rd32 (hw , hw -> aq . asq . len ) & I40E_GL_ATQLEN_ATQCRIT_MASK ) {
928+ if (rd32 (hw , I40E_PF_ATQLEN ) & I40E_GL_ATQLEN_ATQCRIT_MASK ) {
953929 i40e_debug (hw , I40E_DEBUG_AQ_MESSAGE ,
954930 "AQTX: AQ Critical error.\n" );
955931 status = - EIO ;
@@ -1103,7 +1079,7 @@ int i40e_clean_arq_element(struct i40e_hw *hw,
11031079 }
11041080
11051081 /* set next_to_use to head */
1106- ntu = rd32 (hw , hw -> aq . arq . head ) & I40E_PF_ARQH_ARQH_MASK ;
1082+ ntu = rd32 (hw , I40E_PF_ARQH ) & I40E_PF_ARQH_ARQH_MASK ;
11071083 if (ntu == ntc ) {
11081084 /* nothing to do - shouldn't need to update ring's values */
11091085 ret_code = - EALREADY ;
@@ -1151,7 +1127,7 @@ int i40e_clean_arq_element(struct i40e_hw *hw,
11511127 desc -> params .external .addr_low = cpu_to_le32 (lower_32_bits (bi -> pa ));
11521128
11531129 /* set tail = the last cleaned desc index. */
1154- wr32 (hw , hw -> aq . arq . tail , ntc );
1130+ wr32 (hw , I40E_PF_ARQT , ntc );
11551131 /* ntc is updated to tail + 1 */
11561132 ntc ++ ;
11571133 if (ntc == hw -> aq .num_arq_entries )
0 commit comments