aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apm_32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/apm_32.c')
-rw-r--r--arch/x86/kernel/apm_32.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 4c9c67bf09b7..965a7666c283 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -66,7 +66,7 @@
66 * 1.5: Fix segment register reloading (in case of bad segments saved 66 * 1.5: Fix segment register reloading (in case of bad segments saved
67 * across BIOS call). 67 * across BIOS call).
68 * Stephen Rothwell 68 * Stephen Rothwell
69 * 1.6: Cope with complier/assembler differences. 69 * 1.6: Cope with compiler/assembler differences.
70 * Only try to turn off the first display device. 70 * Only try to turn off the first display device.
71 * Fix OOPS at power off with no APM BIOS by Jan Echternach 71 * Fix OOPS at power off with no APM BIOS by Jan Echternach
72 * <echter@informatik.uni-rostock.de> 72 * <echter@informatik.uni-rostock.de>
@@ -189,8 +189,8 @@
189 * Intel Order Number 241704-001. Microsoft Part Number 781-110-X01. 189 * Intel Order Number 241704-001. Microsoft Part Number 781-110-X01.
190 * 190 *
191 * [This document is available free from Intel by calling 800.628.8686 (fax 191 * [This document is available free from Intel by calling 800.628.8686 (fax
192 * 916.356.6100) or 800.548.4725; or via anonymous ftp from 192 * 916.356.6100) or 800.548.4725; or from
193 * ftp://ftp.intel.com/pub/IAL/software_specs/apmv11.doc. It is also 193 * http://www.microsoft.com/whdc/archive/amp_12.mspx It is also
194 * available from Microsoft by calling 206.882.8080.] 194 * available from Microsoft by calling 206.882.8080.]
195 * 195 *
196 * APM 1.2 Reference: 196 * APM 1.2 Reference:
@@ -227,6 +227,8 @@
227#include <linux/suspend.h> 227#include <linux/suspend.h>
228#include <linux/kthread.h> 228#include <linux/kthread.h>
229#include <linux/jiffies.h> 229#include <linux/jiffies.h>
230#include <linux/acpi.h>
231#include <linux/syscore_ops.h>
230 232
231#include <asm/system.h> 233#include <asm/system.h>
232#include <asm/uaccess.h> 234#include <asm/uaccess.h>
@@ -359,6 +361,7 @@ struct apm_user {
359 * idle percentage above which bios idle calls are done 361 * idle percentage above which bios idle calls are done
360 */ 362 */
361#ifdef CONFIG_APM_CPU_IDLE 363#ifdef CONFIG_APM_CPU_IDLE
364#warning deprecated CONFIG_APM_CPU_IDLE will be deleted in 2012
362#define DEFAULT_IDLE_THRESHOLD 95 365#define DEFAULT_IDLE_THRESHOLD 95
363#else 366#else
364#define DEFAULT_IDLE_THRESHOLD 100 367#define DEFAULT_IDLE_THRESHOLD 100
@@ -902,6 +905,7 @@ static void apm_cpu_idle(void)
902 unsigned int jiffies_since_last_check = jiffies - last_jiffies; 905 unsigned int jiffies_since_last_check = jiffies - last_jiffies;
903 unsigned int bucket; 906 unsigned int bucket;
904 907
908 WARN_ONCE(1, "deprecated apm_cpu_idle will be deleted in 2012");
905recalc: 909recalc:
906 if (jiffies_since_last_check > IDLE_CALC_LIMIT) { 910 if (jiffies_since_last_check > IDLE_CALC_LIMIT) {
907 use_apm_idle = 0; 911 use_apm_idle = 0;
@@ -975,20 +979,10 @@ recalc:
975 979
976static void apm_power_off(void) 980static void apm_power_off(void)
977{ 981{
978 unsigned char po_bios_call[] = {
979 0xb8, 0x00, 0x10, /* movw $0x1000,ax */
980 0x8e, 0xd0, /* movw ax,ss */
981 0xbc, 0x00, 0xf0, /* movw $0xf000,sp */
982 0xb8, 0x07, 0x53, /* movw $0x5307,ax */
983 0xbb, 0x01, 0x00, /* movw $0x0001,bx */
984 0xb9, 0x03, 0x00, /* movw $0x0003,cx */
985 0xcd, 0x15 /* int $0x15 */
986 };
987
988 /* Some bioses don't like being called from CPU != 0 */ 982 /* Some bioses don't like being called from CPU != 0 */
989 if (apm_info.realmode_power_off) { 983 if (apm_info.realmode_power_off) {
990 set_cpus_allowed_ptr(current, cpumask_of(0)); 984 set_cpus_allowed_ptr(current, cpumask_of(0));
991 machine_real_restart(po_bios_call, sizeof(po_bios_call)); 985 machine_real_restart(MRR_APM);
992 } else { 986 } else {
993 (void)set_system_power_state(APM_STATE_OFF); 987 (void)set_system_power_state(APM_STATE_OFF);
994 } 988 }
@@ -1246,7 +1240,7 @@ static int suspend(int vetoable)
1246 dpm_suspend_noirq(PMSG_SUSPEND); 1240 dpm_suspend_noirq(PMSG_SUSPEND);
1247 1241
1248 local_irq_disable(); 1242 local_irq_disable();
1249 sysdev_suspend(PMSG_SUSPEND); 1243 syscore_suspend();
1250 1244
1251 local_irq_enable(); 1245 local_irq_enable();
1252 1246
@@ -1264,7 +1258,7 @@ static int suspend(int vetoable)
1264 apm_error("suspend", err); 1258 apm_error("suspend", err);
1265 err = (err == APM_SUCCESS) ? 0 : -EIO; 1259 err = (err == APM_SUCCESS) ? 0 : -EIO;
1266 1260
1267 sysdev_resume(); 1261 syscore_resume();
1268 local_irq_enable(); 1262 local_irq_enable();
1269 1263
1270 dpm_resume_noirq(PMSG_RESUME); 1264 dpm_resume_noirq(PMSG_RESUME);
@@ -1288,7 +1282,7 @@ static void standby(void)
1288 dpm_suspend_noirq(PMSG_SUSPEND); 1282 dpm_suspend_noirq(PMSG_SUSPEND);
1289 1283
1290 local_irq_disable(); 1284 local_irq_disable();
1291 sysdev_suspend(PMSG_SUSPEND); 1285 syscore_suspend();
1292 local_irq_enable(); 1286 local_irq_enable();
1293 1287
1294 err = set_system_power_state(APM_STATE_STANDBY); 1288 err = set_system_power_state(APM_STATE_STANDBY);
@@ -1296,7 +1290,7 @@ static void standby(void)
1296 apm_error("standby", err); 1290 apm_error("standby", err);
1297 1291
1298 local_irq_disable(); 1292 local_irq_disable();
1299 sysdev_resume(); 1293 syscore_resume();
1300 local_irq_enable(); 1294 local_irq_enable();
1301 1295
1302 dpm_resume_noirq(PMSG_RESUME); 1296 dpm_resume_noirq(PMSG_RESUME);
@@ -1926,6 +1920,7 @@ static const struct file_operations apm_bios_fops = {
1926 .unlocked_ioctl = do_ioctl, 1920 .unlocked_ioctl = do_ioctl,
1927 .open = do_open, 1921 .open = do_open,
1928 .release = do_release, 1922 .release = do_release,
1923 .llseek = noop_llseek,
1929}; 1924};
1930 1925
1931static struct miscdevice apm_device = { 1926static struct miscdevice apm_device = {
@@ -2330,12 +2325,11 @@ static int __init apm_init(void)
2330 apm_info.disabled = 1; 2325 apm_info.disabled = 1;
2331 return -ENODEV; 2326 return -ENODEV;
2332 } 2327 }
2333 if (pm_flags & PM_ACPI) { 2328 if (!acpi_disabled) {
2334 printk(KERN_NOTICE "apm: overridden by ACPI.\n"); 2329 printk(KERN_NOTICE "apm: overridden by ACPI.\n");
2335 apm_info.disabled = 1; 2330 apm_info.disabled = 1;
2336 return -ENODEV; 2331 return -ENODEV;
2337 } 2332 }
2338 pm_flags |= PM_APM;
2339 2333
2340 /* 2334 /*
2341 * Set up the long jump entry point to the APM BIOS, which is called 2335 * Set up the long jump entry point to the APM BIOS, which is called
@@ -2427,7 +2421,6 @@ static void __exit apm_exit(void)
2427 kthread_stop(kapmd_task); 2421 kthread_stop(kapmd_task);
2428 kapmd_task = NULL; 2422 kapmd_task = NULL;
2429 } 2423 }
2430 pm_flags &= ~PM_APM;
2431} 2424}
2432 2425
2433module_init(apm_init); 2426module_init(apm_init);