inhibiting apm at boot time

Marty Leisner (leisner@sdsp.mc.xerox.com)
Sun, 21 Dec 1997 19:31:44 PST


I'm not sure how apm works...

I have an old compaq 486DX2/50...I almost sure it doesn't have
apm...but 2.0.33 with apm compiled in says:

installed.4:28 compaq kernel: APM BIOS version 1.0 Flags 0x02 (Driver version 1
.2) 19 15:24:28 compaq kernel: Entry f000:9864 cseg16 f000 dseg f000
Dec 19 15:24:28 compaq kernel: AC on line, battery status unknown, battery l

This is harmless, but I get the annoying:
Dec 19 14:34:53 compaq kernel: apm_bios: set display standby: Unable to enter re
quested state
Dec 19 14:34:53 compaq kernel: apm_bios: set display ready: Unable to enter requ
ested state

continously...I want to compile the same kernel for my laptop and my test
machine...so I added a bootconfig option called
"noapm" (I suppose it would be better to have apm be a module, but it
doesn't work that way...

This seems to do what I want...

--- drivers/char/apm_bios.c 1997/12/20 05:52:11 1.1
+++ drivers/char/apm_bios.c 1997/12/20 18:05:37
@@ -325,6 +325,10 @@
unsigned short segment;
} apm_bios_entry;
static int apm_enabled = 0;
+
+/* if 1, never use apm... set by boot option noapm */
+static int apm_inhibit = 0;
+
#ifdef CONFIG_APM_CPU_IDLE
static int clock_slowed = 0;
#endif
@@ -1079,6 +1083,9 @@
char * power_stat;
char * bat_stat;

+ if(1 == apm_inhibit)
+ return;
+
if (apm_bios_info.version == 0) {
printk("APM BIOS not found.\n");
return;
@@ -1211,3 +1218,11 @@

apm_enabled = 1;
}
+
+
+void apm_setup(char *str, int *ints)
+{
+ printk("Inhibiting apm\n");
+ apm_inhibit = 1;
+}
+
--- init/main.c 1997/12/20 05:50:11 1.1
+++ init/main.c 1997/12/20 18:00:21
@@ -104,6 +104,9 @@
extern void scsi_luns_setup(char *str, int *ints);
extern void sound_setup(char *str, int *ints);
extern void reboot_setup(char *str, int *ints);
+#ifdef CONFIG_APM
+extern void apm_setup(char *str, int *ints);
+#endif
#ifdef CONFIG_CDU31A
extern void cdu31a_setup(char *str, int *ints);
#endif CONFIG_CDU31A
@@ -410,6 +413,9 @@
#endif
#ifdef CONFIG_ISDN_DRV_PCBIT
{ "pcbit=", pcbit_setup },
+#endif
+#ifdef CONFIG_APM
+ { "noapm", apm_setup },
#endif
#ifdef CONFIG_ATARIMOUSE
{ "atamouse=", atari_mouse_setup },

Now I can have one kernel for a variety of machines...

marty leisner@sdsp.mc.xerox.com
Don't confuse education with schooling.
Milton Friedman to Yogi Berra