8
8
9
9
static void i40e_resume_aq (struct i40e_hw * hw );
10
10
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
-
32
11
/**
33
12
* i40e_alloc_adminq_asq_ring - Allocate Admin Queue send rings
34
13
* @hw: pointer to the hardware structure
@@ -254,17 +233,17 @@ static int i40e_config_asq_regs(struct i40e_hw *hw)
254
233
u32 reg = 0 ;
255
234
256
235
/* 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 );
259
238
260
239
/* 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 |
262
241
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 ));
265
244
266
245
/* Check one register to verify that config was applied */
267
- reg = rd32 (hw , hw -> aq . asq . bal );
246
+ reg = rd32 (hw , I40E_PF_ATQBAL );
268
247
if (reg != lower_32_bits (hw -> aq .asq .desc_buf .pa ))
269
248
ret_code = - EIO ;
270
249
@@ -283,20 +262,20 @@ static int i40e_config_arq_regs(struct i40e_hw *hw)
283
262
u32 reg = 0 ;
284
263
285
264
/* 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 );
288
267
289
268
/* 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 |
291
270
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 ));
294
273
295
274
/* 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 );
297
276
298
277
/* Check one register to verify that config was applied */
299
- reg = rd32 (hw , hw -> aq . arq . bal );
278
+ reg = rd32 (hw , I40E_PF_ARQBAL );
300
279
if (reg != lower_32_bits (hw -> aq .arq .desc_buf .pa ))
301
280
ret_code = - EIO ;
302
281
@@ -439,11 +418,11 @@ static int i40e_shutdown_asq(struct i40e_hw *hw)
439
418
}
440
419
441
420
/* 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 );
447
426
448
427
hw -> aq .asq .count = 0 ; /* to indicate uninitialized queue */
449
428
@@ -473,11 +452,11 @@ static int i40e_shutdown_arq(struct i40e_hw *hw)
473
452
}
474
453
475
454
/* 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 );
481
460
482
461
hw -> aq .arq .count = 0 ; /* to indicate uninitialized queue */
483
462
@@ -608,9 +587,6 @@ int i40e_init_adminq(struct i40e_hw *hw)
608
587
goto init_adminq_exit ;
609
588
}
610
589
611
- /* Set up register offsets */
612
- i40e_adminq_init_regs (hw );
613
-
614
590
/* setup ASQ command write back timeout */
615
591
hw -> aq .asq_cmd_timeout = I40E_ASQ_CMD_TIMEOUT ;
616
592
@@ -720,9 +696,9 @@ static u16 i40e_clean_asq(struct i40e_hw *hw)
720
696
721
697
desc = I40E_ADMINQ_DESC (* asq , ntc );
722
698
details = I40E_ADMINQ_DETAILS (* asq , ntc );
723
- while (rd32 (hw , hw -> aq . asq . head ) != ntc ) {
699
+ while (rd32 (hw , I40E_PF_ATQH ) != ntc ) {
724
700
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 ));
726
702
727
703
if (details -> callback ) {
728
704
I40E_ADMINQ_CALLBACK cb_func =
@@ -756,7 +732,7 @@ static bool i40e_asq_done(struct i40e_hw *hw)
756
732
/* AQ designers suggest use of head for better
757
733
* timing reliability than DD bit
758
734
*/
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 ;
760
736
761
737
}
762
738
@@ -797,7 +773,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
797
773
798
774
hw -> aq .asq_last_status = I40E_AQ_RC_OK ;
799
775
800
- val = rd32 (hw , hw -> aq . asq . head );
776
+ val = rd32 (hw , I40E_PF_ATQH );
801
777
if (val >= hw -> aq .num_asq_entries ) {
802
778
i40e_debug (hw , I40E_DEBUG_AQ_MESSAGE ,
803
779
"AQTX: head overrun at %d\n" , val );
@@ -889,7 +865,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
889
865
if (hw -> aq .asq .next_to_use == hw -> aq .asq .count )
890
866
hw -> aq .asq .next_to_use = 0 ;
891
867
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 );
893
869
894
870
/* if cmd_details are not defined or async flag is not set,
895
871
* we need to wait for desc write back
@@ -949,7 +925,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
949
925
/* update the error if time out occurred */
950
926
if ((!cmd_completed ) &&
951
927
(!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 ) {
953
929
i40e_debug (hw , I40E_DEBUG_AQ_MESSAGE ,
954
930
"AQTX: AQ Critical error.\n" );
955
931
status = - EIO ;
@@ -1103,7 +1079,7 @@ int i40e_clean_arq_element(struct i40e_hw *hw,
1103
1079
}
1104
1080
1105
1081
/* 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 ;
1107
1083
if (ntu == ntc ) {
1108
1084
/* nothing to do - shouldn't need to update ring's values */
1109
1085
ret_code = - EALREADY ;
@@ -1151,7 +1127,7 @@ int i40e_clean_arq_element(struct i40e_hw *hw,
1151
1127
desc -> params .external .addr_low = cpu_to_le32 (lower_32_bits (bi -> pa ));
1152
1128
1153
1129
/* set tail = the last cleaned desc index. */
1154
- wr32 (hw , hw -> aq . arq . tail , ntc );
1130
+ wr32 (hw , I40E_PF_ARQT , ntc );
1155
1131
/* ntc is updated to tail + 1 */
1156
1132
ntc ++ ;
1157
1133
if (ntc == hw -> aq .num_arq_entries )
0 commit comments