Skip to content

Commit 7eea5b8

Browse files
committed
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: leds-hp-disk: fix build warning ACPI: Oops in ACPI with git latest ACPI suspend: build fix for ACPI_SLEEP=n && XEN_SAVE_RESTORE=y. toshiba_acpi: always call input_sync() after input_report_switch() ACPI: Always report a sync event after a lid state change ACPI: cpufreq, processor: fix compile error in drivers/acpi/processor_perflib.c i7300_idle: Fix compile warning CONFIG_I7300_IDLE_IOAT_CHANNEL not defined i7300_idle: Cleanup based review comments i7300_idle: Disable ioat channel only on platforms where ile driver can load
2 parents 0173a32 + 9fb3c5c commit 7eea5b8

File tree

10 files changed

+129
-94
lines changed

10 files changed

+129
-94
lines changed

drivers/acpi/button.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ static int acpi_lid_send_state(struct acpi_button *button)
262262
return -ENODEV;
263263
/* input layer checks if event is redundant */
264264
input_report_switch(button->input, SW_LID, !state);
265+
input_sync(button->input);
265266
return 0;
266267
}
267268

@@ -285,8 +286,8 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
285286
input_report_key(input, keycode, 1);
286287
input_sync(input);
287288
input_report_key(input, keycode, 0);
289+
input_sync(input);
288290
}
289-
input_sync(input);
290291

291292
acpi_bus_generate_proc_event(button->device, event,
292293
++button->pushed);

drivers/acpi/processor_perflib.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@
3838

3939
#include <asm/uaccess.h>
4040
#endif
41+
42+
#ifdef CONFIG_X86
4143
#include <asm/cpufeature.h>
44+
#endif
4245

4346
#include <acpi/acpi_bus.h>
4447
#include <acpi/processor.h>
@@ -360,11 +363,13 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr)
360363
* the BIOS is older than the CPU and does not know its frequencies
361364
*/
362365
update_bios:
366+
#ifdef CONFIG_X86
363367
if (ACPI_SUCCESS(acpi_get_handle(pr->handle, "_PPC", &handle))){
364368
if(boot_cpu_has(X86_FEATURE_EST))
365369
printk(KERN_WARNING FW_BUG "BIOS needs update for CPU "
366370
"frequency support\n");
367371
}
372+
#endif
368373
return result;
369374
}
370375

drivers/acpi/sleep/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ static void acpi_pm_end(void)
163163
acpi_target_sleep_state = ACPI_STATE_S0;
164164
acpi_sleep_tts_switch(acpi_target_sleep_state);
165165
}
166+
#else /* !CONFIG_ACPI_SLEEP */
167+
#define acpi_target_sleep_state ACPI_STATE_S0
166168
#endif /* CONFIG_ACPI_SLEEP */
167169

168170
#ifdef CONFIG_SUSPEND

drivers/acpi/toshiba_acpi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ static void bt_poll_rfkill(struct input_polled_dev *poll_dev)
371371
RFKILL_STATE_HARD_BLOCKED);
372372
input_report_switch(poll_dev->input, SW_RFKILL_ALL,
373373
new_rfk_state);
374+
input_sync(poll_dev->input);
374375
}
375376
}
376377

@@ -842,6 +843,7 @@ static int __init toshiba_acpi_init(void)
842843
set_bit(EV_SW, toshiba_acpi.poll_dev->input->evbit);
843844
set_bit(SW_RFKILL_ALL, toshiba_acpi.poll_dev->input->swbit);
844845
input_report_switch(toshiba_acpi.poll_dev->input, SW_RFKILL_ALL, TRUE);
846+
input_sync(toshiba_acpi.poll_dev->input);
845847

846848
ret = input_register_polled_device(toshiba_acpi.poll_dev);
847849
if (ret) {

drivers/dma/ioat_dma.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <linux/delay.h>
3434
#include <linux/dma-mapping.h>
3535
#include <linux/workqueue.h>
36+
#include <linux/i7300_idle.h>
3637
#include "ioatdma.h"
3738
#include "ioatdma_registers.h"
3839
#include "ioatdma_hw.h"
@@ -171,8 +172,10 @@ static int ioat_dma_enumerate_channels(struct ioatdma_device *device)
171172
xfercap_scale = readb(device->reg_base + IOAT_XFERCAP_OFFSET);
172173
xfercap = (xfercap_scale == 0 ? -1 : (1UL << xfercap_scale));
173174

174-
#if CONFIG_I7300_IDLE_IOAT_CHANNEL
175-
device->common.chancnt--;
175+
#ifdef CONFIG_I7300_IDLE_IOAT_CHANNEL
176+
if (i7300_idle_platform_probe(NULL, NULL) == 0) {
177+
device->common.chancnt--;
178+
}
176179
#endif
177180
for (i = 0; i < device->common.chancnt; i++) {
178181
ioat_chan = kzalloc(sizeof(*ioat_chan), GFP_KERNEL);

drivers/idle/Kconfig

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ config I7300_IDLE_IOAT_CHANNEL
55
bool
66

77
config I7300_IDLE
8-
tristate "Intel chipset idle power saving driver"
8+
tristate "Intel chipset idle memory power saving driver"
99
select I7300_IDLE_IOAT_CHANNEL
10-
depends on X86_64
10+
depends on X86_64 && EXPERIMENTAL
1111
help
12-
Enable idle power savings with certain Intel server chipsets.
13-
The chipset must have I/O AT support, such as the Intel 7300.
14-
The power savings depends on the type and quantity of DRAM devices.
12+
Enable memory power savings when idle with certain Intel server
13+
chipsets. The chipset must have I/O AT support, such as the
14+
Intel 7300. The power savings depends on the type and quantity of
15+
DRAM devices.
1516

1617
endmenu

drivers/idle/i7300_idle.c

Lines changed: 20 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/delay.h>
2626
#include <linux/debugfs.h>
2727
#include <linux/stop_machine.h>
28+
#include <linux/i7300_idle.h>
2829

2930
#include <asm/idle.h>
3031

@@ -34,6 +35,8 @@
3435
#define I7300_IDLE_DRIVER_VERSION "1.55"
3536
#define I7300_PRINT "i7300_idle:"
3637

38+
#define MAX_STOP_RETRIES 10
39+
3740
static int debug;
3841
module_param_named(debug, debug, uint, 0644);
3942
MODULE_PARM_DESC(debug, "Enable debug printks in this driver");
@@ -46,12 +49,12 @@ MODULE_PARM_DESC(debug, "Enable debug printks in this driver");
4649
* 0 = No throttling
4750
* 1 = Throttle when > 4 activations per eval window (Maximum throttling)
4851
* 2 = Throttle when > 8 activations
49-
* 168 = Throttle when > 168 activations (Minimum throttling)
52+
* 168 = Throttle when > 672 activations (Minimum throttling)
5053
*/
51-
#define MAX_THRTLWLIMIT 168
52-
static uint i7300_idle_thrtlowlm = 1;
53-
module_param_named(thrtlwlimit, i7300_idle_thrtlowlm, uint, 0644);
54-
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,
5558
"Value for THRTLOWLM activation field "
5659
"(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)");
5760

@@ -110,9 +113,9 @@ static int i7300_idle_ioat_start(void)
110113
static void i7300_idle_ioat_stop(void)
111114
{
112115
int i;
113-
u8 sts;
116+
u64 sts;
114117

115-
for (i = 0; i < 5; i++) {
118+
for (i = 0; i < MAX_STOP_RETRIES; i++) {
116119
writeb(IOAT_CHANCMD_RESET,
117120
ioat_chanbase + IOAT1_CHANCMD_OFFSET);
118121

@@ -126,9 +129,10 @@ static void i7300_idle_ioat_stop(void)
126129

127130
}
128131

129-
if (i == 5)
130-
dprintk("failed to suspend+reset I/O AT after 5 retries\n");
131-
132+
if (i == MAX_STOP_RETRIES) {
133+
dprintk("failed to stop I/O AT after %d retries\n",
134+
MAX_STOP_RETRIES);
135+
}
132136
}
133137

134138
/* Test I/O AT by copying 1024 byte from 2k to 1k */
@@ -275,7 +279,7 @@ static void __exit i7300_idle_ioat_exit(void)
275279
i7300_idle_ioat_stop();
276280

277281
/* Wait for a while for the channel to halt before releasing */
278-
for (i = 0; i < 10; i++) {
282+
for (i = 0; i < MAX_STOP_RETRIES; i++) {
279283
writeb(IOAT_CHANCMD_RESET,
280284
ioat_chanbase + IOAT1_CHANCMD_OFFSET);
281285

@@ -389,9 +393,9 @@ static void i7300_idle_start(void)
389393
new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT;
390394
pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl);
391395

392-
limit = i7300_idle_thrtlowlm;
393-
if (unlikely(limit > MAX_THRTLWLIMIT))
394-
limit = MAX_THRTLWLIMIT;
396+
limit = throttle_low_limit;
397+
if (unlikely(limit > MAX_THROTTLE_LOW_LIMIT))
398+
limit = MAX_THROTTLE_LOW_LIMIT;
395399

396400
pci_write_config_byte(fbd_dev, DIMM_THRTLOW, limit);
397401

@@ -440,7 +444,7 @@ static int i7300_idle_notifier(struct notifier_block *nb, unsigned long val,
440444
static ktime_t idle_begin_time;
441445
static int time_init = 1;
442446

443-
if (!i7300_idle_thrtlowlm)
447+
if (!throttle_low_limit)
444448
return 0;
445449

446450
if (unlikely(time_init)) {
@@ -505,77 +509,8 @@ static struct notifier_block i7300_idle_nb = {
505509
.notifier_call = i7300_idle_notifier,
506510
};
507511

508-
/*
509-
* I/O AT controls (PCI bus 0 device 8 function 0)
510-
* DIMM controls (PCI bus 0 device 16 function 1)
511-
*/
512-
#define IOAT_BUS 0
513-
#define IOAT_DEVFN PCI_DEVFN(8, 0)
514-
#define MEMCTL_BUS 0
515-
#define MEMCTL_DEVFN PCI_DEVFN(16, 1)
516-
517-
struct fbd_ioat {
518-
unsigned int vendor;
519-
unsigned int ioat_dev;
520-
};
521-
522-
/*
523-
* The i5000 chip-set has the same hooks as the i7300
524-
* but support is disabled by default because this driver
525-
* has not been validated on that platform.
526-
*/
527-
#define SUPPORT_I5000 0
528-
529-
static const struct fbd_ioat fbd_ioat_list[] = {
530-
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB},
531-
#if SUPPORT_I5000
532-
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT},
533-
#endif
534-
{0, 0}
535-
};
536-
537-
/* table of devices that work with this driver */
538-
static const struct pci_device_id pci_tbl[] = {
539-
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_FBD_CNB) },
540-
#if SUPPORT_I5000
541-
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
542-
#endif
543-
{ } /* Terminating entry */
544-
};
545-
546512
MODULE_DEVICE_TABLE(pci, pci_tbl);
547513

548-
/* Check for known platforms with I/O-AT */
549-
static int __init i7300_idle_platform_probe(void)
550-
{
551-
int i;
552-
553-
fbd_dev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN);
554-
if (!fbd_dev)
555-
return -ENODEV;
556-
557-
for (i = 0; pci_tbl[i].vendor != 0; i++) {
558-
if (fbd_dev->vendor == pci_tbl[i].vendor &&
559-
fbd_dev->device == pci_tbl[i].device) {
560-
break;
561-
}
562-
}
563-
if (pci_tbl[i].vendor == 0)
564-
return -ENODEV;
565-
566-
ioat_dev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN);
567-
if (!ioat_dev)
568-
return -ENODEV;
569-
570-
for (i = 0; fbd_ioat_list[i].vendor != 0; i++) {
571-
if (ioat_dev->vendor == fbd_ioat_list[i].vendor &&
572-
ioat_dev->device == fbd_ioat_list[i].ioat_dev) {
573-
return 0;
574-
}
575-
}
576-
return -ENODEV;
577-
}
578-
579514
int stats_open_generic(struct inode *inode, struct file *fp)
580515
{
581516
fp->private_data = inode->i_private;
@@ -617,7 +552,7 @@ static int __init i7300_idle_init(void)
617552
cpus_clear(idle_cpumask);
618553
total_us = 0;
619554

620-
if (i7300_idle_platform_probe())
555+
if (i7300_idle_platform_probe(&fbd_dev, &ioat_dev))
621556
return -ENODEV;
622557

623558
if (i7300_idle_thrt_save())

drivers/leds/leds-hp-disk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static struct acpi_hpled adev;
4949

5050
static acpi_status hpled_acpi_write(acpi_handle handle, int reg)
5151
{
52-
unsigned long ret; /* Not used when writing */
52+
unsigned long long ret; /* Not used when writing */
5353
union acpi_object in_obj[1];
5454
struct acpi_object_list args = { 1, in_obj };
5555

drivers/pci/pci-acpi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ static acpi_status acpi_run_osc(acpi_handle handle,
8383
if (ACPI_FAILURE(status))
8484
return status;
8585

86+
if (!output.length)
87+
return AE_NULL_OBJECT;
88+
8689
out_obj = output.pointer;
8790
if (out_obj->type != ACPI_TYPE_BUFFER) {
8891
printk(KERN_DEBUG "Evaluate _OSC returns wrong type\n");

include/linux/i7300_idle.h

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
2+
#ifndef I7300_IDLE_H
3+
#define I7300_IDLE_H
4+
5+
#include <linux/pci.h>
6+
7+
/*
8+
* I/O AT controls (PCI bus 0 device 8 function 0)
9+
* DIMM controls (PCI bus 0 device 16 function 1)
10+
*/
11+
#define IOAT_BUS 0
12+
#define IOAT_DEVFN PCI_DEVFN(8, 0)
13+
#define MEMCTL_BUS 0
14+
#define MEMCTL_DEVFN PCI_DEVFN(16, 1)
15+
16+
struct fbd_ioat {
17+
unsigned int vendor;
18+
unsigned int ioat_dev;
19+
};
20+
21+
/*
22+
* The i5000 chip-set has the same hooks as the i7300
23+
* but support is disabled by default because this driver
24+
* has not been validated on that platform.
25+
*/
26+
#define SUPPORT_I5000 0
27+
28+
static const struct fbd_ioat fbd_ioat_list[] = {
29+
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB},
30+
#if SUPPORT_I5000
31+
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT},
32+
#endif
33+
{0, 0}
34+
};
35+
36+
/* table of devices that work with this driver */
37+
static const struct pci_device_id pci_tbl[] = {
38+
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_FBD_CNB) },
39+
#if SUPPORT_I5000
40+
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
41+
#endif
42+
{ } /* Terminating entry */
43+
};
44+
45+
/* Check for known platforms with I/O-AT */
46+
static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev,
47+
struct pci_dev **ioat_dev)
48+
{
49+
int i;
50+
struct pci_dev *memdev, *dmadev;
51+
52+
memdev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN);
53+
if (!memdev)
54+
return -ENODEV;
55+
56+
for (i = 0; pci_tbl[i].vendor != 0; i++) {
57+
if (memdev->vendor == pci_tbl[i].vendor &&
58+
memdev->device == pci_tbl[i].device) {
59+
break;
60+
}
61+
}
62+
if (pci_tbl[i].vendor == 0)
63+
return -ENODEV;
64+
65+
dmadev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN);
66+
if (!dmadev)
67+
return -ENODEV;
68+
69+
for (i = 0; fbd_ioat_list[i].vendor != 0; i++) {
70+
if (dmadev->vendor == fbd_ioat_list[i].vendor &&
71+
dmadev->device == fbd_ioat_list[i].ioat_dev) {
72+
if (fbd_dev)
73+
*fbd_dev = memdev;
74+
if (ioat_dev)
75+
*ioat_dev = dmadev;
76+
77+
return 0;
78+
}
79+
}
80+
return -ENODEV;
81+
}
82+
83+
#endif

0 commit comments

Comments
 (0)