[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

APM in the default kernel



Just to dispel those nasty rumours that "Debian can NEVER have APM in the
default kernel..."

Here's a patch that lets you disable it at boot time in the 2.1.129 kernel. 
I still think a sysctl would be better, but...

Oh, anyone who tests this (regardless of success or failure), let me know. 
I'm the apmd maintainer and I'm interested in these things.

Have fun,

Avery



----- Forwarded message from Pavel Machek <pavel@bug.ucw.cz> -----

Date: Thu, 26 Nov 1998 14:11:09 +0100
From: Pavel Machek <pavel@bug.ucw.cz>
To: Avery Pennarun <apenwarr@worldvisions.ca>,
        Stephen.Rothwell@canb.auug.org.au
Cc: linux-kernel@vger.rutgers.edu
Subject: Re: Debian: Things left to do for release. (fwd)
X-Mailer: Mutt 0.81
In-Reply-To: <19981124141734.A24399@worldvisions.ca>; from Avery Pennarun on Tue, Nov 24, 1998 at 02:17:34PM -0500

Hi!

> Well, the problem is that on some broken computers, making APM BIOS calls
> crashes the computer.  So we would need a command line option (or sysctl in
> /proc/sys) to _enable_ it.  That may be what you meant :)

As in my prev. mail, no. Anyway, here is command line option to
DISABLE apm. I belive Debian would like this option for their install
disks (so that they can have APM always in but disabled - some
machines crash when APM is enabled). Please merge to linus at next
convience,

									Pavel

--- clean//init/main.c	Thu Nov 26 00:20:42 1998
+++ linux/init/main.c	Thu Nov 26 00:12:29 1998
@@ -252,6 +257,9 @@ extern void epca_setup(char *str, int *i
 #ifdef CONFIG_ISDN_DRV_PCBIT
 extern void pcbit_setup(char *str, int *ints);
 #endif
+#ifdef CONFIG_APM
+extern void apm_setup(char *str, int *ints);
+#endif
 
 #ifdef CONFIG_ATARIMOUSE
 extern void atari_mouse_setup (char *str, int *ints);
@@ -577,6 +593,9 @@ static struct kernel_param cooked_params
 	{ "no387", no_387 },
 	{ "reboot=", reboot_setup },
 #endif
+#ifdef CONFIG_APM
+	{ "no-apm", apm_setup },
+#endif
 #ifdef CONFIG_INET
 	{ "ether=", eth_setup },
 #endif
--- clean//arch/i386/kernel/apm.c	Sun Oct 18 16:25:23 1998
+++ linux/arch/i386/kernel/apm.c	Thu Nov 26 13:57:23 1998
@@ -167,7 +168,7 @@ extern unsigned long get_cmos_time(void)
  *
  * U: TI 4000M TravelMate: BIOS is *NOT* APM compliant
  *                         [Confirmed by TI representative]
- * U: ACER 486DX4/75: uses dseg 0040, in violation of APM specification
+ * ?: ACER 486DX4/75: uses dseg 0040, in violation of APM specification
  *                    [Confirmed by BIOS disassembly]
  *                    [This may work now ...]
  * P: Toshiba 1950S: battery life information only gets updated after resume
@@ -251,6 +252,9 @@ extern void	apm_unregister_callback(int 
 /*
  * Local variables
  */
+
+int	apm_disabled = 0;
+
 static asmlinkage struct {
 	unsigned long	offset;
 	unsigned short	segment;
@@ -663,7 +667,7 @@ static int queue_event(apm_event_t event
 			static int notified;
 
 			if (notified == 0) {
-			    printk( "apm_bios: an event queue overflowed\n" );
+			    printk(KERN_ERR "apm_bios: an event queue overflowed\n" );
 			    notified = 1;
 			}
 			as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS;
@@ -1168,6 +1172,11 @@ int apm_get_info(char *buf, char **start
 }
 #endif
 
+void __init apm_setup(char *str, int *ints)
+{
+	apm_disabled = 1;
+}
+
 void __init apm_bios_init(void)
 {
 	unsigned short	bx;
@@ -1178,6 +1188,11 @@ void __init apm_bios_init(void)
 	char *		bat_stat;
 	static struct proc_dir_entry *ent;
 
+	if (apm_disabled) {
+		printk(KERN_NOTICE "APM disabled on user request.\n" );
+		return;
+	}
+
 #ifdef __SMP__
 	if (smp_num_cpus > 1) {
 		printk(KERN_NOTICE "APM disabled: APM is not SMP safe.\n");

-- 
Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).
I'm really pavel@atrey.karlin.mff.cuni.cz. 	   Pavel



----- End forwarded message -----


Reply to: