View | Details | Raw Unified | Return to bug 4041 | Differences between
and this patch

Collapse All | Expand All

(-)a/drivers/acpi/sleep/main.c (-3 / +14 lines)
Lines 31-36 Link Here
31
	[PM_SUSPEND_STANDBY]	= ACPI_STATE_S1,
31
	[PM_SUSPEND_STANDBY]	= ACPI_STATE_S1,
32
	[PM_SUSPEND_MEM]	= ACPI_STATE_S3,
32
	[PM_SUSPEND_MEM]	= ACPI_STATE_S3,
33
	[PM_SUSPEND_DISK]	= ACPI_STATE_S4,
33
	[PM_SUSPEND_DISK]	= ACPI_STATE_S4,
34
	[PM_SUSPEND_MAX]	= ACPI_STATE_S5
34
};
35
};
35
36
36
static int init_8259A_after_S1;
37
static int init_8259A_after_S1;
Lines 48-56 Link Here
48
{
49
{
49
	u32 acpi_state = acpi_suspend_states[pm_state];
50
	u32 acpi_state = acpi_suspend_states[pm_state];
50
51
51
	if (!sleep_states[acpi_state])
52
	if (!sleep_states[acpi_state]) {
53
		printk("acpi_pm_prepare does not support %d \n", pm_state);
52
		return -EPERM;
54
		return -EPERM;
53
55
	}
54
	/* do we have a wakeup address for S2 and S3? */
56
	/* do we have a wakeup address for S2 and S3? */
55
	/* Here, we support only S4BIOS, those we set the wakeup address */
57
	/* Here, we support only S4BIOS, those we set the wakeup address */
56
	/* S4OS is only supported for now via swsusp.. */
58
	/* S4OS is only supported for now via swsusp.. */
Lines 62-68 Link Here
62
				(void *)acpi_wakeup_address));
64
				(void *)acpi_wakeup_address));
63
	}
65
	}
64
	ACPI_FLUSH_CPU_CACHE();
66
	ACPI_FLUSH_CPU_CACHE();
67
	printk("acpi_pm_prepare with %d\n", pm_state);
65
	acpi_enable_wakeup_device_prep(acpi_state);
68
	acpi_enable_wakeup_device_prep(acpi_state);
69
	if (acpi_state == ACPI_STATE_S5) {
70
	        acpi_wakeup_gpe_poweroff_prepare();
71
	}
66
	acpi_enter_sleep_state_prep(acpi_state);
72
	acpi_enter_sleep_state_prep(acpi_state);
67
	return 0;
73
	return 0;
68
}
74
}
Lines 112-117 Link Here
112
		else
118
		else
113
			do_suspend_lowlevel_s4bios();
119
			do_suspend_lowlevel_s4bios();
114
		break;
120
		break;
121
	case PM_SUSPEND_MAX:
122
		/* Some SMP machines only can poweroff in boot CPU */
123
		set_cpus_allowed(current, cpumask_of_cpu(0));	
124
		acpi_enter_sleep_state(acpi_state);
115
	default:
125
	default:
116
		return -EINVAL;
126
		return -EINVAL;
117
	}
127
	}
Lines 163-171 Link Here
163
		[1]	= PM_SUSPEND_STANDBY,
173
		[1]	= PM_SUSPEND_STANDBY,
164
		[3]	= PM_SUSPEND_MEM,
174
		[3]	= PM_SUSPEND_MEM,
165
		[4]	= PM_SUSPEND_DISK,
175
		[4]	= PM_SUSPEND_DISK,
176
		[5]	= PM_SUSPEND_MAX
166
	};
177
	};
167
178
168
	if (acpi_state <= 4 && states[acpi_state])
179
	if (acpi_state < 6 && states[acpi_state])
169
		return pm_suspend(states[acpi_state]);
180
		return pm_suspend(states[acpi_state]);
170
	return -EINVAL;
181
	return -EINVAL;
171
}
182
}
(-)a/drivers/acpi/sleep/poweroff.c (-6 / +3 lines)
Lines 15-26 Link Here
15
acpi_power_off (void)
15
acpi_power_off (void)
16
{
16
{
17
	printk("%s called\n",__FUNCTION__);
17
	printk("%s called\n",__FUNCTION__);
18
	/* Some SMP machines only can poweroff in boot CPU */
18
	if (pm_ops && pm_ops->enter) {
19
	set_cpus_allowed(current, cpumask_of_cpu(0));
19
		pm_ops->enter(PM_SUSPEND_MAX);
20
	acpi_wakeup_gpe_poweroff_prepare();
20
	}
21
	acpi_enter_sleep_state_prep(ACPI_STATE_S5);
22
	ACPI_DISABLE_IRQS();
23
	acpi_enter_sleep_state(ACPI_STATE_S5);
24
}
21
}
25
22
26
static int acpi_poweroff_init(void)
23
static int acpi_poweroff_init(void)
(-)a/drivers/base/sys.c (-1 / +6 lines)
Lines 20-26 Link Here
20
#include <linux/init.h>
20
#include <linux/init.h>
21
#include <linux/slab.h>
21
#include <linux/slab.h>
22
#include <linux/string.h>
22
#include <linux/string.h>
23
23
#include <linux/pm.h>
24
24
25
extern struct subsystem devices_subsys;
25
extern struct subsystem devices_subsys;
26
26
Lines 254-259 Link Here
254
	struct sysdev_class * cls;
254
	struct sysdev_class * cls;
255
255
256
	pr_debug("Shutting Down System Devices\n");
256
	pr_debug("Shutting Down System Devices\n");
257
258
	/* Tell the power management system that we are preparing for shutdown */
259
	if (pm_ops && pm_ops->prepare) {
260
		pm_ops->prepare(PM_SUSPEND_MAX);
261
	}
257
262
258
	down_write(&system_subsys.rwsem);
263
	down_write(&system_subsys.rwsem);
259
	list_for_each_entry_reverse(cls, &system_subsys.kset.list,
264
	list_for_each_entry_reverse(cls, &system_subsys.kset.list,
(-)a/include/linux/pm.h (-1 / +1 lines)
Lines 185-191 Link Here
185
};
185
};
186
186
187
extern void pm_set_ops(struct pm_ops *);
187
extern void pm_set_ops(struct pm_ops *);
188
188
extern struct pm_ops *pm_ops;
189
extern int pm_suspend(suspend_state_t state);
189
extern int pm_suspend(suspend_state_t state);
190
190
191
191
(-)a/kernel/power/main.c (-1 / +1 lines)
Lines 186-192 Link Here
186
186
187
int pm_suspend(suspend_state_t state)
187
int pm_suspend(suspend_state_t state)
188
{
188
{
189
	if (state > PM_SUSPEND_ON && state < PM_SUSPEND_MAX)
189
	if (state > PM_SUSPEND_ON && state <= PM_SUSPEND_MAX)
190
		return enter_state(state);
190
		return enter_state(state);
191
	return -EINVAL;
191
	return -EINVAL;
192
}
192
}

Return to bug 4041