35
35
#define I7300_IDLE_DRIVER_VERSION "1.55"
36
36
#define I7300_PRINT "i7300_idle:"
37
37
38
+ #define MAX_STOP_RETRIES 10
39
+
38
40
static int debug ;
39
41
module_param_named (debug , debug , uint , 0644 );
40
42
MODULE_PARM_DESC (debug , "Enable debug printks in this driver" );
@@ -47,12 +49,12 @@ MODULE_PARM_DESC(debug, "Enable debug printks in this driver");
47
49
* 0 = No throttling
48
50
* 1 = Throttle when > 4 activations per eval window (Maximum throttling)
49
51
* 2 = Throttle when > 8 activations
50
- * 168 = Throttle when > 168 activations (Minimum throttling)
52
+ * 168 = Throttle when > 672 activations (Minimum throttling)
51
53
*/
52
- #define MAX_THRTLWLIMIT 168
53
- static uint i7300_idle_thrtlowlm = 1 ;
54
- module_param_named (thrtlwlimit , i7300_idle_thrtlowlm , uint , 0644 );
55
- MODULE_PARM_DESC (thrtlwlimit ,
54
+ #define MAX_THROTTLE_LOW_LIMIT 168
55
+ static uint throttle_low_limit = 1 ;
56
+ module_param_named (throttle_low_limit , throttle_low_limit , uint , 0644 );
57
+ MODULE_PARM_DESC (throttle_low_limit ,
56
58
"Value for THRTLOWLM activation field "
57
59
"(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)" );
58
60
@@ -111,9 +113,9 @@ static int i7300_idle_ioat_start(void)
111
113
static void i7300_idle_ioat_stop (void )
112
114
{
113
115
int i ;
114
- u8 sts ;
116
+ u64 sts ;
115
117
116
- for (i = 0 ; i < 5 ; i ++ ) {
118
+ for (i = 0 ; i < MAX_STOP_RETRIES ; i ++ ) {
117
119
writeb (IOAT_CHANCMD_RESET ,
118
120
ioat_chanbase + IOAT1_CHANCMD_OFFSET );
119
121
@@ -127,9 +129,10 @@ static void i7300_idle_ioat_stop(void)
127
129
128
130
}
129
131
130
- if (i == 5 )
131
- dprintk ("failed to suspend+reset I/O AT after 5 retries\n" );
132
-
132
+ if (i == MAX_STOP_RETRIES ) {
133
+ dprintk ("failed to stop I/O AT after %d retries\n" ,
134
+ MAX_STOP_RETRIES );
135
+ }
133
136
}
134
137
135
138
/* Test I/O AT by copying 1024 byte from 2k to 1k */
@@ -276,7 +279,7 @@ static void __exit i7300_idle_ioat_exit(void)
276
279
i7300_idle_ioat_stop ();
277
280
278
281
/* Wait for a while for the channel to halt before releasing */
279
- for (i = 0 ; i < 10 ; i ++ ) {
282
+ for (i = 0 ; i < MAX_STOP_RETRIES ; i ++ ) {
280
283
writeb (IOAT_CHANCMD_RESET ,
281
284
ioat_chanbase + IOAT1_CHANCMD_OFFSET );
282
285
@@ -390,9 +393,9 @@ static void i7300_idle_start(void)
390
393
new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT ;
391
394
pci_write_config_byte (fbd_dev , DIMM_THRTCTL , new_ctl );
392
395
393
- limit = i7300_idle_thrtlowlm ;
394
- if (unlikely (limit > MAX_THRTLWLIMIT ))
395
- limit = MAX_THRTLWLIMIT ;
396
+ limit = throttle_low_limit ;
397
+ if (unlikely (limit > MAX_THROTTLE_LOW_LIMIT ))
398
+ limit = MAX_THROTTLE_LOW_LIMIT ;
396
399
397
400
pci_write_config_byte (fbd_dev , DIMM_THRTLOW , limit );
398
401
@@ -441,7 +444,7 @@ static int i7300_idle_notifier(struct notifier_block *nb, unsigned long val,
441
444
static ktime_t idle_begin_time ;
442
445
static int time_init = 1 ;
443
446
444
- if (!i7300_idle_thrtlowlm )
447
+ if (!throttle_low_limit )
445
448
return 0 ;
446
449
447
450
if (unlikely (time_init )) {
0 commit comments