Skip to content

Commit dbbe464

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: ACPI / Sleep: Allow the NVS saving to be skipped during suspend to RAM ACPI: create "processor.bm_check_disable" boot param ACPI: skip checking BM_STS if the BIOS doesn't ask for it ACPI: fix unused function warning ACPI: processor: fix processor_physically_present on UP ACPI video: fix string mismatch for Sony SR290 laptop ACPI battery: don't invoke power_supply_changed twice when battery is hot-added ACPI: handle systems which asynchoronously enable ACPI mode
2 parents 24b1442 + 0e1cf38 commit dbbe464

File tree

12 files changed

+74
-36
lines changed

12 files changed

+74
-36
lines changed

Documentation/feature-removal-schedule.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,3 +647,10 @@ Who: Stefan Richter <[email protected]>
647647

648648
----------------------------
649649

650+
What: The acpi_sleep=s4_nonvs command line option
651+
When: 2.6.37
652+
Files: arch/x86/kernel/acpi/sleep.c
653+
Why: superseded by acpi_sleep=nonvs
654+
Who: Rafael J. Wysocki <[email protected]>
655+
656+
----------------------------

Documentation/kernel-parameters.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ and is between 256 and 4096 characters. It is defined in the file
254254
control method, with respect to putting devices into
255255
low power states, to be enforced (the ACPI 2.0 ordering
256256
of _PTS is used by default).
257-
s4_nonvs prevents the kernel from saving/restoring the
258-
ACPI NVS memory during hibernation.
257+
nonvs prevents the kernel from saving/restoring the
258+
ACPI NVS memory during suspend/hibernation and resume.
259259
sci_force_enable causes the kernel to set SCI_EN directly
260260
on resume from S1/S3 (which is against the ACPI spec,
261261
but some broken systems don't work without it).

arch/x86/kernel/acpi/cstate.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
145145
percpu_entry->states[cx->index].eax = cx->address;
146146
percpu_entry->states[cx->index].ecx = MWAIT_ECX_INTERRUPT_BREAK;
147147
}
148+
149+
/*
150+
* For _CST FFH on Intel, if GAS.access_size bit 1 is cleared,
151+
* then we should skip checking BM_STS for this C-state.
152+
* ref: "Intel Processor Vendor-Specific ACPI Interface Specification"
153+
*/
154+
if ((c->x86_vendor == X86_VENDOR_INTEL) && !(reg->access_size & 0x2))
155+
cx->bm_sts_skip = 1;
156+
148157
return retval;
149158
}
150159
EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe);

arch/x86/kernel/acpi/sleep.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,14 @@ static int __init acpi_sleep_setup(char *str)
157157
#ifdef CONFIG_HIBERNATION
158158
if (strncmp(str, "s4_nohwsig", 10) == 0)
159159
acpi_no_s4_hw_signature();
160-
if (strncmp(str, "s4_nonvs", 8) == 0)
161-
acpi_s4_no_nvs();
160+
if (strncmp(str, "s4_nonvs", 8) == 0) {
161+
pr_warning("ACPI: acpi_sleep=s4_nonvs is deprecated, "
162+
"please use acpi_sleep=nonvs instead");
163+
acpi_nvs_nosave();
164+
}
162165
#endif
166+
if (strncmp(str, "nonvs", 5) == 0)
167+
acpi_nvs_nosave();
163168
if (strncmp(str, "old_ordering", 12) == 0)
164169
acpi_old_suspend_ordering();
165170
str = strchr(str, ',');

drivers/acpi/acpica/evxfevnt.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
7070
acpi_status acpi_enable(void)
7171
{
7272
acpi_status status;
73+
int retry;
7374

7475
ACPI_FUNCTION_TRACE(acpi_enable);
7576

@@ -98,16 +99,18 @@ acpi_status acpi_enable(void)
9899

99100
/* Sanity check that transition succeeded */
100101

101-
if (acpi_hw_get_mode() != ACPI_SYS_MODE_ACPI) {
102-
ACPI_ERROR((AE_INFO,
103-
"Hardware did not enter ACPI mode"));
104-
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
102+
for (retry = 0; retry < 30000; ++retry) {
103+
if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
104+
if (retry != 0)
105+
ACPI_WARNING((AE_INFO,
106+
"Platform took > %d00 usec to enter ACPI mode", retry));
107+
return_ACPI_STATUS(AE_OK);
108+
}
109+
acpi_os_stall(100); /* 100 usec */
105110
}
106111

107-
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
108-
"Transition to ACPI mode successful\n"));
109-
110-
return_ACPI_STATUS(AE_OK);
112+
ACPI_ERROR((AE_INFO, "Hardware did not enter ACPI mode"));
113+
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
111114
}
112115

113116
ACPI_EXPORT_SYMBOL(acpi_enable)

drivers/acpi/battery.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,9 +868,15 @@ static void acpi_battery_remove_fs(struct acpi_device *device)
868868
static void acpi_battery_notify(struct acpi_device *device, u32 event)
869869
{
870870
struct acpi_battery *battery = acpi_driver_data(device);
871+
#ifdef CONFIG_ACPI_SYSFS_POWER
872+
struct device *old;
873+
#endif
871874

872875
if (!battery)
873876
return;
877+
#ifdef CONFIG_ACPI_SYSFS_POWER
878+
old = battery->bat.dev;
879+
#endif
874880
acpi_battery_update(battery);
875881
acpi_bus_generate_proc_event(device, event,
876882
acpi_battery_present(battery));
@@ -879,7 +885,7 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event)
879885
acpi_battery_present(battery));
880886
#ifdef CONFIG_ACPI_SYSFS_POWER
881887
/* acpi_battery_update could remove power_supply object */
882-
if (battery->bat.dev)
888+
if (old && battery->bat.dev)
883889
power_supply_changed(&battery->bat);
884890
#endif
885891
}

drivers/acpi/blacklist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
214214
.ident = "Sony VGN-SR290J",
215215
.matches = {
216216
DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
217-
DMI_MATCH(DMI_PRODUCT_NAME, "Sony VGN-SR290J"),
217+
DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR290J"),
218218
},
219219
},
220220
{

drivers/acpi/processor_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static bool processor_physically_present(acpi_handle handle)
223223
type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0;
224224
cpuid = acpi_get_cpuid(handle, type, acpi_id);
225225

226-
if (cpuid == -1)
226+
if ((cpuid == -1) && (num_possible_cpus() > 1))
227227
return false;
228228

229229
return true;

drivers/acpi/processor_idle.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,19 @@ static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
7676
module_param(max_cstate, uint, 0000);
7777
static unsigned int nocst __read_mostly;
7878
module_param(nocst, uint, 0000);
79+
static int bm_check_disable __read_mostly;
80+
module_param(bm_check_disable, uint, 0000);
7981

8082
static unsigned int latency_factor __read_mostly = 2;
8183
module_param(latency_factor, uint, 0644);
8284

85+
#ifdef CONFIG_ACPI_PROCFS
8386
static u64 us_to_pm_timer_ticks(s64 t)
8487
{
8588
return div64_u64(t * PM_TIMER_FREQUENCY, 1000000);
8689
}
90+
#endif
91+
8792
/*
8893
* IBM ThinkPad R40e crashes mysteriously when going into C2 or C3.
8994
* For now disable this. Probably a bug somewhere else.
@@ -763,6 +768,9 @@ static int acpi_idle_bm_check(void)
763768
{
764769
u32 bm_status = 0;
765770

771+
if (bm_check_disable)
772+
return 0;
773+
766774
acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status);
767775
if (bm_status)
768776
acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_STATUS, 1);
@@ -947,7 +955,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
947955
if (acpi_idle_suspend)
948956
return(acpi_idle_enter_c1(dev, state));
949957

950-
if (acpi_idle_bm_check()) {
958+
if (!cx->bm_sts_skip && acpi_idle_bm_check()) {
951959
if (dev->safe_state) {
952960
dev->last_state = dev->safe_state;
953961
return dev->safe_state->enter(dev, dev->safe_state);

drivers/acpi/sleep.c

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,20 @@ static int acpi_sleep_prepare(u32 acpi_state)
8181
#ifdef CONFIG_ACPI_SLEEP
8282
static u32 acpi_target_sleep_state = ACPI_STATE_S0;
8383

84+
/*
85+
* The ACPI specification wants us to save NVS memory regions during hibernation
86+
* and to restore them during the subsequent resume. Windows does that also for
87+
* suspend to RAM. However, it is known that this mechanism does not work on
88+
* all machines, so we allow the user to disable it with the help of the
89+
* 'acpi_sleep=nonvs' kernel command line option.
90+
*/
91+
static bool nvs_nosave;
92+
93+
void __init acpi_nvs_nosave(void)
94+
{
95+
nvs_nosave = true;
96+
}
97+
8498
/*
8599
* ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the
86100
* user to request that behavior by using the 'acpi_old_suspend_ordering'
@@ -197,8 +211,7 @@ static int acpi_suspend_begin(suspend_state_t pm_state)
197211
u32 acpi_state = acpi_suspend_states[pm_state];
198212
int error = 0;
199213

200-
error = suspend_nvs_alloc();
201-
214+
error = nvs_nosave ? 0 : suspend_nvs_alloc();
202215
if (error)
203216
return error;
204217

@@ -388,20 +401,6 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
388401
#endif /* CONFIG_SUSPEND */
389402

390403
#ifdef CONFIG_HIBERNATION
391-
/*
392-
* The ACPI specification wants us to save NVS memory regions during hibernation
393-
* and to restore them during the subsequent resume. However, it is not certain
394-
* if this mechanism is going to work on all machines, so we allow the user to
395-
* disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line
396-
* option.
397-
*/
398-
static bool s4_no_nvs;
399-
400-
void __init acpi_s4_no_nvs(void)
401-
{
402-
s4_no_nvs = true;
403-
}
404-
405404
static unsigned long s4_hardware_signature;
406405
static struct acpi_table_facs *facs;
407406
static bool nosigcheck;
@@ -415,7 +414,7 @@ static int acpi_hibernation_begin(void)
415414
{
416415
int error;
417416

418-
error = s4_no_nvs ? 0 : suspend_nvs_alloc();
417+
error = nvs_nosave ? 0 : suspend_nvs_alloc();
419418
if (!error) {
420419
acpi_target_sleep_state = ACPI_STATE_S4;
421420
acpi_sleep_tts_switch(acpi_target_sleep_state);
@@ -510,7 +509,7 @@ static int acpi_hibernation_begin_old(void)
510509
error = acpi_sleep_prepare(ACPI_STATE_S4);
511510

512511
if (!error) {
513-
if (!s4_no_nvs)
512+
if (!nvs_nosave)
514513
error = suspend_nvs_alloc();
515514
if (!error)
516515
acpi_target_sleep_state = ACPI_STATE_S4;

include/acpi/processor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct acpi_power_register {
4848
u8 space_id;
4949
u8 bit_width;
5050
u8 bit_offset;
51-
u8 reserved;
51+
u8 access_size;
5252
u64 address;
5353
} __attribute__ ((packed));
5454

@@ -63,6 +63,7 @@ struct acpi_processor_cx {
6363
u32 power;
6464
u32 usage;
6565
u64 time;
66+
u8 bm_sts_skip;
6667
char desc[ACPI_CX_DESC_LEN];
6768
};
6869

include/linux/acpi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ int acpi_resources_are_enforced(void);
253253
#ifdef CONFIG_PM_SLEEP
254254
void __init acpi_no_s4_hw_signature(void);
255255
void __init acpi_old_suspend_ordering(void);
256-
void __init acpi_s4_no_nvs(void);
256+
void __init acpi_nvs_nosave(void);
257257
#endif /* CONFIG_PM_SLEEP */
258258

259259
struct acpi_osc_context {

0 commit comments

Comments
 (0)