Re: Re: ATX Power off & SMP-Kernel

Mike (mike@oxlug.org)
Sun, 2 May 1999 10:13:32 +0100 (GMT)


On Tue, 27 Apr 1999, Michael Mess wrote:

> But I would appreciate it, if "ATX Power off" could be configured
> separately and independent from SMP and APM in "make menuconfig" or
> "make xconfig".

At the moment, it should be able to be enabled by putting
apm=smp-power-off on the kernel command line, but this doesn't work
because the code that checks for smp is in the wrong place.

The following patch fixes that, and also changes the default to be for
power-off to work on SMP boxes *unless* apm=no-smp-power-off is specified.

diff -urN linux-2.2.7-clean/arch/i386/kernel/apm.c linux/arch/i386/kernel/apm.c
--- linux-2.2.7-clean/arch/i386/kernel/apm.c Fri Jan 15 06:57:25 1999
+++ linux/arch/i386/kernel/apm.c Thu Apr 29 15:53:01 1999
@@ -294,7 +294,7 @@
unsigned short segment;
} apm_bios_entry;
static int apm_enabled = 0;
-static int smp_hack = 0;
+static int smp_hack = 1;
#ifdef CONFIG_APM_CPU_IDLE
static int clock_slowed = 0;
#endif
@@ -1378,14 +1378,6 @@
(apm_bios_info.dseg_len - 1) & 0xffff);
}
#endif
-#ifdef CONFIG_SMP
- if (smp_num_cpus > 1) {
- printk(KERN_NOTICE "apm: disabled - APM is not SMP safe.\n");
- if (smp_hack)
- smp_hack = 2;
- return;
- }
-#endif
if (apm_bios_info.version > 0x100) {
/*
* We only support BIOSs up to version 1.2
@@ -1459,6 +1451,14 @@
if (apm_engage_power_management(0x0001) == APM_SUCCESS)
apm_bios_info.flags &= ~APM_BIOS_DISENGAGED;
}
+#ifdef CONFIG_SMP
+ if (smp_num_cpus > 1) {
+ printk(KERN_NOTICE "apm: disabled - APM is not SMP safe.\n");
+ if (smp_hack)
+ smp_hack = 2;
+ return;
+ }
+#endif

init_timer(&apm_timer);
apm_timer.function = do_apm_timer;

-- 
Mike <rickettm@ox.compsoc.net>

But you shall not escape my iambics. -- Gaius Valerius Catullus

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/