Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Apr 2000 10:42:02 -0700 (PDT)
From:      asaddi@philosophysw.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   i386/18162: APM: Add flag to disable timer-based BIOS requests [PATCH]
Message-ID:  <200004221742.KAA00536@trantor.philosophysw.com>

next in thread | raw e-mail | index | archive | help

>Number:         18162
>Category:       i386
>Synopsis:       APM: Add flag to disable timer-based BIOS requests [PATCH]
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          wish
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 22 10:50:02 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Allan Saddi
>Release:        FreeBSD 4.0-STABLE i386
>Organization:
Philosophy SoftWorks
>Environment:

FreeBSD trantor.philosophysw.com 4.0-STABLE FreeBSD 4.0-STABLE #42: Sat Apr 22 03:46:31 PDT 2000     root@utopia.philosophysw.com:/usr/src/sys/compile/TRANTOR  i386

>Description:

On my Compaq Presario 1215, the timer-based suspend/standby requests
from BIOS interfere with normal APM operation. For example, when I use
'zzz' to suspend, my laptop will wake up on its own after 15 minutes
due to a BIOS request. (I can only assume it's attempting a suspend-to-
disk operation, which I really haven't gotten to work yet.)

I cannot disable these requests from BIOS setup, hence this patch. I am
using device flag 0x40, which does not appear to be used, to signify
that BIOS timer requests should be disabled from apm_attach().

>How-To-Repeat:

Suspend using 'zzz' when on battery power. Wait 15 minutes.

>Fix:

--- sys/i386/apm/apm.c.orig	Sun Feb  6 06:57:05 2000
+++ sys/i386/apm/apm.c	Sat Apr 22 04:17:55 2000
@@ -219,6 +219,19 @@
 	return (apm_bioscall());
 }
  
+/* enable/disable timer-based standby/suspend requests (APM 1.2 or later) */
+static int
+apm_enable_disable_timer_req(int enable)
+{
+	struct apm_softc *sc = &apm_softc;
+
+	sc->bios.r.eax = (APM_BIOS << 8) | APM_TIMERREQUESTS;
+	sc->bios.r.ebx = PMDV_APMBIOS;
+	sc->bios.r.ecx = enable;
+	sc->bios.r.edx = 0;
+	return (apm_bioscall());
+}
+
 /* get PM event */
 static u_int
 apm_getevent(void)
@@ -1072,6 +1085,16 @@
 			printf("apm: *Warning* engage function failed err=[%x]",
 				(sc->bios.r.eax >> 8) & 0xff);
 			printf(" (Docked or using external power?).\n");
+#endif
+		}
+	}
+
+	/* disable timer requests, if flag 0x40 is set (APM 1.2 or later) */
+	if (sc->intversion >= INTVERSION(1, 2) && (flags & 0x40)) {
+		if (apm_enable_disable_timer_req(0)) {
+#ifdef APM_DEBUG
+			printf("apm: *Warning* timer request function failed! [%x]\n",
+				(sc->bios.r.eax >> 8) & 0xff);
 #endif
 		}
 	}

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004221742.KAA00536>