Sanitize APM a bit. Convert various #ifdef to id_flags instead.
You may want to add "flags 0x31" to apm0 if you have a lousy implementation. Read LINT.
This commit is contained in:
parent
958a83b970
commit
3d4d8fe94d
@ -11,7 +11,7 @@
|
|||||||
# device lines is present in the ./LINT configuration file. If you are
|
# device lines is present in the ./LINT configuration file. If you are
|
||||||
# in doubt as to the purpose or necessity of a line, check first in LINT.
|
# in doubt as to the purpose or necessity of a line, check first in LINT.
|
||||||
#
|
#
|
||||||
# $Id: GENERIC,v 1.87 1997/03/12 19:59:58 se Exp $
|
# $Id: GENERIC,v 1.88 1997/03/13 19:03:58 bde Exp $
|
||||||
|
|
||||||
machine "i386"
|
machine "i386"
|
||||||
cpu "I386_CPU"
|
cpu "I386_CPU"
|
||||||
@ -107,8 +107,8 @@ device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
|
|||||||
#
|
#
|
||||||
# Laptop support (see LINT for more options)
|
# Laptop support (see LINT for more options)
|
||||||
#
|
#
|
||||||
device apm0 at isa? disable # Advanced Power Management
|
device apm0 at isa? disable flags 0x31 # Advanced Power Management
|
||||||
options APM_BROKEN_STATCLOCK # Workaround some buggy APM BIOS
|
|
||||||
# PCCARD (PCMCIA) support
|
# PCCARD (PCMCIA) support
|
||||||
#controller crd0
|
#controller crd0
|
||||||
#device pcic0 at crd?
|
#device pcic0 at crd?
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# LINT -- config file for checking all the sources, tries to pull in
|
# LINT -- config file for checking all the sources, tries to pull in
|
||||||
# as much of the source tree as it can.
|
# as much of the source tree as it can.
|
||||||
#
|
#
|
||||||
# $Id: LINT,v 1.323 1997/03/26 17:20:24 ache Exp $
|
# $Id: LINT,v 1.324 1997/03/26 17:46:03 ache Exp $
|
||||||
#
|
#
|
||||||
# NB: You probably don't want to try running a kernel built from this
|
# NB: You probably don't want to try running a kernel built from this
|
||||||
# file. Instead, you should start from GENERIC, and add options from
|
# file. Instead, you should start from GENERIC, and add options from
|
||||||
@ -881,14 +881,11 @@ device pca0 at isa? port IO_TIMER1 tty
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Notes on APM
|
# Notes on APM
|
||||||
# Some APM implementations will not work with the `statistics clock'
|
# The flags takes the following meaning for apm0:
|
||||||
# enabled, so it's disabled by default if the APM driver is enabled.
|
# 0x0020 Statclock is broken.
|
||||||
# However, this is not true for all laptops. Try removing the option
|
# 0x0011 Limit APM protocol to 1.1 or 1.0
|
||||||
# APM_BROKEN_STATCLOCK and see if suspend/resume work
|
# 0x0010 Limit APM protocol to 1.0
|
||||||
#
|
#
|
||||||
|
|
||||||
options APM_IDLE_CPU # Tell APM to idle rather than halt'ing the cpu
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Notes on the spigot:
|
# Notes on the spigot:
|
||||||
# The video spigot is at 0xad6. This port address can not be changed.
|
# The video spigot is at 0xad6. This port address can not be changed.
|
||||||
@ -939,8 +936,7 @@ device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr
|
|||||||
device ctx0 at isa? port 0x230 iomem 0xd0000
|
device ctx0 at isa? port 0x230 iomem 0xd0000
|
||||||
device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000 vector spigintr
|
device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000 vector spigintr
|
||||||
device qcam0 at isa? port "IO_LPT3" tty
|
device qcam0 at isa? port "IO_LPT3" tty
|
||||||
device apm0 at isa?
|
device apm0 at isa?
|
||||||
options APM_BROKEN_STATCLOCK
|
|
||||||
device gp0 at isa? port 0x2c0 tty
|
device gp0 at isa? port 0x2c0 tty
|
||||||
device gsc0 at isa? port "IO_GSC1" tty drq 3
|
device gsc0 at isa? port "IO_GSC1" tty drq 3
|
||||||
device joy0 at isa? port "IO_GAME"
|
device joy0 at isa? port "IO_GAME"
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
* Copyright (c) 1994 UKAI, Fumitoshi.
|
* Copyright (c) 1994 UKAI, Fumitoshi.
|
||||||
* Copyright (c) 1994-1995 by HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org>
|
* Copyright (c) 1994-1995 by HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org>
|
||||||
* Copyright (c) 1996 Nate Williams <nate@FreeBSD.org>
|
* Copyright (c) 1996 Nate Williams <nate@FreeBSD.org>
|
||||||
|
* Copyright (c) 1997 Poul-Henning Kamp <phk@FreeBSD.org>
|
||||||
*
|
*
|
||||||
* This software may be used, modified, copied, and distributed, in
|
* This software may be used, modified, copied, and distributed, in
|
||||||
* both source and binary form provided that the above copyright and
|
* both source and binary form provided that the above copyright and
|
||||||
@ -14,7 +15,7 @@
|
|||||||
*
|
*
|
||||||
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
||||||
*
|
*
|
||||||
* $Id: apm.c,v 1.53 1997/02/22 09:29:49 peter Exp $
|
* $Id: apm.c,v 1.54 1997/03/28 18:38:19 phk Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -98,32 +99,26 @@ setup_apm_gdt(u_int code32_base, u_int code16_base, u_int data_base, u_int code_
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 48bit far pointer */
|
/* 48bit far pointer */
|
||||||
static struct addr48 {
|
struct addr48 {
|
||||||
u_long offset;
|
u_long offset;
|
||||||
u_short segment;
|
u_short segment;
|
||||||
} apm_addr;
|
} apm_addr;
|
||||||
|
|
||||||
static int apm_errno;
|
static int apm_errno;
|
||||||
|
|
||||||
inline
|
|
||||||
int
|
int
|
||||||
apm_int(u_long *eax, u_long *ebx, u_long *ecx)
|
apm_int(u_long *eax, u_long *ebx, u_long *ecx)
|
||||||
{
|
{
|
||||||
u_long cf;
|
struct apm_bios_arg apa;
|
||||||
__asm __volatile("
|
int cf;
|
||||||
pushfl
|
|
||||||
cli
|
apa.eax = *eax;
|
||||||
lcall _apm_addr
|
apa.ebx = *ebx;
|
||||||
movl $0, %3
|
apa.ecx = *ecx;
|
||||||
jnc 1f
|
cf = apm_bios_call(&apa);
|
||||||
incl %3
|
*eax = apa.eax;
|
||||||
1:
|
*ebx = apa.ebx;
|
||||||
popfl
|
*ecx = apa.ecx;
|
||||||
"
|
|
||||||
: "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=D" (cf)
|
|
||||||
: "0" (*eax), "1" (*ebx), "2" (*ecx)
|
|
||||||
: "dx", "si", "memory"
|
|
||||||
);
|
|
||||||
apm_errno = ((*eax) >> 8) & 0xff;
|
apm_errno = ((*eax) >> 8) & 0xff;
|
||||||
return cf;
|
return cf;
|
||||||
}
|
}
|
||||||
@ -147,21 +142,16 @@ apm_enable_disable_pm(int enable)
|
|||||||
return apm_int(&eax, &ebx, &ecx);
|
return apm_int(&eax, &ebx, &ecx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell APM-BIOS that WE will do 1.2 and see what they say... */
|
|
||||||
static void
|
static void
|
||||||
apm_driver_version(void)
|
apm_driver_version(int version)
|
||||||
{
|
{
|
||||||
u_long eax, ebx, ecx;
|
u_long eax, ebx, ecx;
|
||||||
|
|
||||||
|
/* First try APM 1.2 */
|
||||||
eax = (APM_BIOS << 8) | APM_DRVVERSION;
|
eax = (APM_BIOS << 8) | APM_DRVVERSION;
|
||||||
ebx = 0x0;
|
ebx = 0x0;
|
||||||
/* First try APM 1.2 */
|
ecx = version;
|
||||||
ecx = 0x0102;
|
if(!apm_int(&eax, &ebx, &ecx))
|
||||||
if(!apm_int(&eax, &ebx, &ecx))
|
|
||||||
apm_version = eax & 0xffff;
|
|
||||||
/* Then try APM 1.1 */
|
|
||||||
ecx = 0x0101;
|
|
||||||
if(!apm_int(&eax, &ebx, &ecx))
|
|
||||||
apm_version = eax & 0xffff;
|
apm_version = eax & 0xffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,9 +573,8 @@ apmprobe(struct isa_device *dvp)
|
|||||||
printf("apm: 32-bit connection error.\n");
|
printf("apm: 32-bit connection error.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef APM_BROKEN_STATCLOCK
|
if (dvp->id_flags & 0x20)
|
||||||
statclock_disable = 1;
|
statclock_disable = 1;
|
||||||
#endif
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -635,7 +624,7 @@ apm_processevent(void)
|
|||||||
OPMEV_DEBUGMESSAGE(PMEV_UPDATETIME);
|
OPMEV_DEBUGMESSAGE(PMEV_UPDATETIME);
|
||||||
inittodr(0); /* adjust time to RTC */
|
inittodr(0); /* adjust time to RTC */
|
||||||
break;
|
break;
|
||||||
OPMEV_DEBUGMESSAGE(PMEV_NOEVENT);
|
case PMEV_NOEVENT:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Unknown Original APM Event 0x%x\n", apm_event);
|
printf("Unknown Original APM Event 0x%x\n", apm_event);
|
||||||
@ -702,15 +691,21 @@ apmattach(struct isa_device *dvp)
|
|||||||
apm_addr.segment = GSEL(GAPMCODE32_SEL, SEL_KPL);
|
apm_addr.segment = GSEL(GAPMCODE32_SEL, SEL_KPL);
|
||||||
apm_addr.offset = sc->cs_entry;
|
apm_addr.offset = sc->cs_entry;
|
||||||
|
|
||||||
#ifdef FORCE_APM10
|
if ((dvp->id_flags & 0x10)) {
|
||||||
apm_version = 0x100;
|
if ((dvp->id_flags & 0xf) => 0x2) {
|
||||||
sc->majorversion = 1;
|
apm_driver_version(0x102);
|
||||||
sc->minorversion = 0;
|
}
|
||||||
sc->intversion = INTVERSION(sc->majorversion, sc->minorversion);
|
if (!apm_version && (dvp->id_flags & 0xf) => 0x1) {
|
||||||
printf("apm: running in APM 1.0 compatible mode\n");
|
apm_driver_version(0x101);
|
||||||
#else
|
}
|
||||||
/* Try to kick bios into 1.1 or greater mode */
|
} else {
|
||||||
apm_driver_version();
|
apm_driver_version(0x102);
|
||||||
|
if (!apm_version)
|
||||||
|
apm_driver_version(0x101);
|
||||||
|
}
|
||||||
|
if (!apm_version)
|
||||||
|
apm_version = 0x100;
|
||||||
|
|
||||||
sc->minorversion = ((apm_version & 0x00f0) >> 4) * 10 +
|
sc->minorversion = ((apm_version & 0x00f0) >> 4) * 10 +
|
||||||
((apm_version & 0x000f) >> 0);
|
((apm_version & 0x000f) >> 0);
|
||||||
sc->majorversion = ((apm_version & 0xf000) >> 12) * 10 +
|
sc->majorversion = ((apm_version & 0xf000) >> 12) * 10 +
|
||||||
@ -725,7 +720,6 @@ apmattach(struct isa_device *dvp)
|
|||||||
|
|
||||||
printf("apm: found APM BIOS version %d.%d\n",
|
printf("apm: found APM BIOS version %d.%d\n",
|
||||||
sc->majorversion, sc->minorversion);
|
sc->majorversion, sc->minorversion);
|
||||||
#endif /* FORCE_APM10 */
|
|
||||||
|
|
||||||
#ifdef APM_DEBUG
|
#ifdef APM_DEBUG
|
||||||
printf("apm: Slow Idling CPU %s\n", is_enabled(sc->slow_idle_cpu));
|
printf("apm: Slow Idling CPU %s\n", is_enabled(sc->slow_idle_cpu));
|
||||||
@ -835,6 +829,10 @@ apmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
|
|||||||
if (apm_display(newstate))
|
if (apm_display(newstate))
|
||||||
error = ENXIO;
|
error = ENXIO;
|
||||||
break;
|
break;
|
||||||
|
case APMIO_BIOS:
|
||||||
|
if (apm_bios_call((struct apm_bios_arg*)addr))
|
||||||
|
error = EIO;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
error = EINVAL;
|
error = EINVAL;
|
||||||
break;
|
break;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
* Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id: apm_setup.h,v 1.7 1997/02/22 09:29:49 peter Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern u_long apm_version;
|
extern u_long apm_version;
|
||||||
@ -22,3 +22,5 @@ extern u_short apm_cs_limit;
|
|||||||
extern u_short apm_ds_limit;
|
extern u_short apm_ds_limit;
|
||||||
extern u_short apm_flags;
|
extern u_short apm_flags;
|
||||||
extern u_short kernelbase;
|
extern u_short kernelbase;
|
||||||
|
|
||||||
|
int apm_bios_call __P((struct apm_bios_arg *));
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 1994 by HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org>
|
* Copyright (C) 1994 by HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org>
|
||||||
|
* Copyright (C) 1997 by Poul-Henning Kamp <phk@FreeBSD.org>
|
||||||
*
|
*
|
||||||
* This software may be used, modified, copied, distributed, and sold,
|
* This software may be used, modified, copied, distributed, and sold,
|
||||||
* in both source and binary form provided that the above copyright and
|
* in both source and binary form provided that the above copyright and
|
||||||
@ -10,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
* Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
* Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id: apm_setup.s,v 1.10 1997/02/22 09:29:50 peter Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "apm.h"
|
#include "apm.h"
|
||||||
@ -174,4 +175,38 @@ _apm_setup:
|
|||||||
movw %di, PADDR(_apm_flags)
|
movw %di, PADDR(_apm_flags)
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.text
|
||||||
|
.align 2
|
||||||
|
.globl _apm_bios_call
|
||||||
|
_apm_bios_call:
|
||||||
|
pushl %ebp
|
||||||
|
movl 8(%esp),%ebp
|
||||||
|
pushl %esi
|
||||||
|
pushl %edi
|
||||||
|
pushl %ebx
|
||||||
|
movl 20(%ebp),%edi
|
||||||
|
movl 16(%ebp),%esi
|
||||||
|
movl 12(%ebp),%edx
|
||||||
|
movl 8(%ebp),%ecx
|
||||||
|
movl 4(%ebp),%ebx
|
||||||
|
movl 0(%ebp),%eax
|
||||||
|
pushl %ebp
|
||||||
|
lcall _apm_addr
|
||||||
|
popl %ebp
|
||||||
|
movl %eax,0(%ebp)
|
||||||
|
jc 1f
|
||||||
|
xorl %eax,%eax
|
||||||
|
jz 2f
|
||||||
|
1: movl $1, %eax
|
||||||
|
2: movl %ebx,4(%ebp)
|
||||||
|
movl %ecx,8(%ebp)
|
||||||
|
movl %edx,12(%ebp)
|
||||||
|
movl %esi,16(%ebp)
|
||||||
|
movl %edi,20(%ebp)
|
||||||
|
popl %ebx
|
||||||
|
popl %edi
|
||||||
|
popl %esi
|
||||||
|
popl %ebp
|
||||||
|
ret
|
||||||
#endif NAPM > 0
|
#endif NAPM > 0
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
* Copyright (c) 1994 UKAI, Fumitoshi.
|
* Copyright (c) 1994 UKAI, Fumitoshi.
|
||||||
* Copyright (c) 1994-1995 by HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org>
|
* Copyright (c) 1994-1995 by HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org>
|
||||||
* Copyright (c) 1996 Nate Williams <nate@FreeBSD.org>
|
* Copyright (c) 1996 Nate Williams <nate@FreeBSD.org>
|
||||||
|
* Copyright (c) 1997 Poul-Henning Kamp <phk@FreeBSD.org>
|
||||||
*
|
*
|
||||||
* This software may be used, modified, copied, and distributed, in
|
* This software may be used, modified, copied, and distributed, in
|
||||||
* both source and binary form provided that the above copyright and
|
* both source and binary form provided that the above copyright and
|
||||||
@ -14,7 +15,7 @@
|
|||||||
*
|
*
|
||||||
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
||||||
*
|
*
|
||||||
* $Id: apm.c,v 1.53 1997/02/22 09:29:49 peter Exp $
|
* $Id: apm.c,v 1.54 1997/03/28 18:38:19 phk Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -98,32 +99,26 @@ setup_apm_gdt(u_int code32_base, u_int code16_base, u_int data_base, u_int code_
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 48bit far pointer */
|
/* 48bit far pointer */
|
||||||
static struct addr48 {
|
struct addr48 {
|
||||||
u_long offset;
|
u_long offset;
|
||||||
u_short segment;
|
u_short segment;
|
||||||
} apm_addr;
|
} apm_addr;
|
||||||
|
|
||||||
static int apm_errno;
|
static int apm_errno;
|
||||||
|
|
||||||
inline
|
|
||||||
int
|
int
|
||||||
apm_int(u_long *eax, u_long *ebx, u_long *ecx)
|
apm_int(u_long *eax, u_long *ebx, u_long *ecx)
|
||||||
{
|
{
|
||||||
u_long cf;
|
struct apm_bios_arg apa;
|
||||||
__asm __volatile("
|
int cf;
|
||||||
pushfl
|
|
||||||
cli
|
apa.eax = *eax;
|
||||||
lcall _apm_addr
|
apa.ebx = *ebx;
|
||||||
movl $0, %3
|
apa.ecx = *ecx;
|
||||||
jnc 1f
|
cf = apm_bios_call(&apa);
|
||||||
incl %3
|
*eax = apa.eax;
|
||||||
1:
|
*ebx = apa.ebx;
|
||||||
popfl
|
*ecx = apa.ecx;
|
||||||
"
|
|
||||||
: "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=D" (cf)
|
|
||||||
: "0" (*eax), "1" (*ebx), "2" (*ecx)
|
|
||||||
: "dx", "si", "memory"
|
|
||||||
);
|
|
||||||
apm_errno = ((*eax) >> 8) & 0xff;
|
apm_errno = ((*eax) >> 8) & 0xff;
|
||||||
return cf;
|
return cf;
|
||||||
}
|
}
|
||||||
@ -147,21 +142,16 @@ apm_enable_disable_pm(int enable)
|
|||||||
return apm_int(&eax, &ebx, &ecx);
|
return apm_int(&eax, &ebx, &ecx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell APM-BIOS that WE will do 1.2 and see what they say... */
|
|
||||||
static void
|
static void
|
||||||
apm_driver_version(void)
|
apm_driver_version(int version)
|
||||||
{
|
{
|
||||||
u_long eax, ebx, ecx;
|
u_long eax, ebx, ecx;
|
||||||
|
|
||||||
|
/* First try APM 1.2 */
|
||||||
eax = (APM_BIOS << 8) | APM_DRVVERSION;
|
eax = (APM_BIOS << 8) | APM_DRVVERSION;
|
||||||
ebx = 0x0;
|
ebx = 0x0;
|
||||||
/* First try APM 1.2 */
|
ecx = version;
|
||||||
ecx = 0x0102;
|
if(!apm_int(&eax, &ebx, &ecx))
|
||||||
if(!apm_int(&eax, &ebx, &ecx))
|
|
||||||
apm_version = eax & 0xffff;
|
|
||||||
/* Then try APM 1.1 */
|
|
||||||
ecx = 0x0101;
|
|
||||||
if(!apm_int(&eax, &ebx, &ecx))
|
|
||||||
apm_version = eax & 0xffff;
|
apm_version = eax & 0xffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,9 +573,8 @@ apmprobe(struct isa_device *dvp)
|
|||||||
printf("apm: 32-bit connection error.\n");
|
printf("apm: 32-bit connection error.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef APM_BROKEN_STATCLOCK
|
if (dvp->id_flags & 0x20)
|
||||||
statclock_disable = 1;
|
statclock_disable = 1;
|
||||||
#endif
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -635,7 +624,7 @@ apm_processevent(void)
|
|||||||
OPMEV_DEBUGMESSAGE(PMEV_UPDATETIME);
|
OPMEV_DEBUGMESSAGE(PMEV_UPDATETIME);
|
||||||
inittodr(0); /* adjust time to RTC */
|
inittodr(0); /* adjust time to RTC */
|
||||||
break;
|
break;
|
||||||
OPMEV_DEBUGMESSAGE(PMEV_NOEVENT);
|
case PMEV_NOEVENT:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Unknown Original APM Event 0x%x\n", apm_event);
|
printf("Unknown Original APM Event 0x%x\n", apm_event);
|
||||||
@ -702,15 +691,21 @@ apmattach(struct isa_device *dvp)
|
|||||||
apm_addr.segment = GSEL(GAPMCODE32_SEL, SEL_KPL);
|
apm_addr.segment = GSEL(GAPMCODE32_SEL, SEL_KPL);
|
||||||
apm_addr.offset = sc->cs_entry;
|
apm_addr.offset = sc->cs_entry;
|
||||||
|
|
||||||
#ifdef FORCE_APM10
|
if ((dvp->id_flags & 0x10)) {
|
||||||
apm_version = 0x100;
|
if ((dvp->id_flags & 0xf) => 0x2) {
|
||||||
sc->majorversion = 1;
|
apm_driver_version(0x102);
|
||||||
sc->minorversion = 0;
|
}
|
||||||
sc->intversion = INTVERSION(sc->majorversion, sc->minorversion);
|
if (!apm_version && (dvp->id_flags & 0xf) => 0x1) {
|
||||||
printf("apm: running in APM 1.0 compatible mode\n");
|
apm_driver_version(0x101);
|
||||||
#else
|
}
|
||||||
/* Try to kick bios into 1.1 or greater mode */
|
} else {
|
||||||
apm_driver_version();
|
apm_driver_version(0x102);
|
||||||
|
if (!apm_version)
|
||||||
|
apm_driver_version(0x101);
|
||||||
|
}
|
||||||
|
if (!apm_version)
|
||||||
|
apm_version = 0x100;
|
||||||
|
|
||||||
sc->minorversion = ((apm_version & 0x00f0) >> 4) * 10 +
|
sc->minorversion = ((apm_version & 0x00f0) >> 4) * 10 +
|
||||||
((apm_version & 0x000f) >> 0);
|
((apm_version & 0x000f) >> 0);
|
||||||
sc->majorversion = ((apm_version & 0xf000) >> 12) * 10 +
|
sc->majorversion = ((apm_version & 0xf000) >> 12) * 10 +
|
||||||
@ -725,7 +720,6 @@ apmattach(struct isa_device *dvp)
|
|||||||
|
|
||||||
printf("apm: found APM BIOS version %d.%d\n",
|
printf("apm: found APM BIOS version %d.%d\n",
|
||||||
sc->majorversion, sc->minorversion);
|
sc->majorversion, sc->minorversion);
|
||||||
#endif /* FORCE_APM10 */
|
|
||||||
|
|
||||||
#ifdef APM_DEBUG
|
#ifdef APM_DEBUG
|
||||||
printf("apm: Slow Idling CPU %s\n", is_enabled(sc->slow_idle_cpu));
|
printf("apm: Slow Idling CPU %s\n", is_enabled(sc->slow_idle_cpu));
|
||||||
@ -835,6 +829,10 @@ apmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
|
|||||||
if (apm_display(newstate))
|
if (apm_display(newstate))
|
||||||
error = ENXIO;
|
error = ENXIO;
|
||||||
break;
|
break;
|
||||||
|
case APMIO_BIOS:
|
||||||
|
if (apm_bios_call((struct apm_bios_arg*)addr))
|
||||||
|
error = EIO;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
error = EINVAL;
|
error = EINVAL;
|
||||||
break;
|
break;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
* Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id: apm_setup.h,v 1.7 1997/02/22 09:29:49 peter Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern u_long apm_version;
|
extern u_long apm_version;
|
||||||
@ -22,3 +22,5 @@ extern u_short apm_cs_limit;
|
|||||||
extern u_short apm_ds_limit;
|
extern u_short apm_ds_limit;
|
||||||
extern u_short apm_flags;
|
extern u_short apm_flags;
|
||||||
extern u_short kernelbase;
|
extern u_short kernelbase;
|
||||||
|
|
||||||
|
int apm_bios_call __P((struct apm_bios_arg *));
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 1994 by HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org>
|
* Copyright (C) 1994 by HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org>
|
||||||
|
* Copyright (C) 1997 by Poul-Henning Kamp <phk@FreeBSD.org>
|
||||||
*
|
*
|
||||||
* This software may be used, modified, copied, distributed, and sold,
|
* This software may be used, modified, copied, distributed, and sold,
|
||||||
* in both source and binary form provided that the above copyright and
|
* in both source and binary form provided that the above copyright and
|
||||||
@ -10,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
* Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
* Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id: apm_setup.s,v 1.10 1997/02/22 09:29:50 peter Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "apm.h"
|
#include "apm.h"
|
||||||
@ -174,4 +175,38 @@ _apm_setup:
|
|||||||
movw %di, PADDR(_apm_flags)
|
movw %di, PADDR(_apm_flags)
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.text
|
||||||
|
.align 2
|
||||||
|
.globl _apm_bios_call
|
||||||
|
_apm_bios_call:
|
||||||
|
pushl %ebp
|
||||||
|
movl 8(%esp),%ebp
|
||||||
|
pushl %esi
|
||||||
|
pushl %edi
|
||||||
|
pushl %ebx
|
||||||
|
movl 20(%ebp),%edi
|
||||||
|
movl 16(%ebp),%esi
|
||||||
|
movl 12(%ebp),%edx
|
||||||
|
movl 8(%ebp),%ecx
|
||||||
|
movl 4(%ebp),%ebx
|
||||||
|
movl 0(%ebp),%eax
|
||||||
|
pushl %ebp
|
||||||
|
lcall _apm_addr
|
||||||
|
popl %ebp
|
||||||
|
movl %eax,0(%ebp)
|
||||||
|
jc 1f
|
||||||
|
xorl %eax,%eax
|
||||||
|
jz 2f
|
||||||
|
1: movl $1, %eax
|
||||||
|
2: movl %ebx,4(%ebp)
|
||||||
|
movl %ecx,8(%ebp)
|
||||||
|
movl %edx,12(%ebp)
|
||||||
|
movl %esi,16(%ebp)
|
||||||
|
movl %edi,20(%ebp)
|
||||||
|
popl %ebx
|
||||||
|
popl %edi
|
||||||
|
popl %esi
|
||||||
|
popl %ebp
|
||||||
|
ret
|
||||||
#endif NAPM > 0
|
#endif NAPM > 0
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
# device lines is present in the ./LINT configuration file. If you are
|
# device lines is present in the ./LINT configuration file. If you are
|
||||||
# in doubt as to the purpose or necessity of a line, check first in LINT.
|
# in doubt as to the purpose or necessity of a line, check first in LINT.
|
||||||
#
|
#
|
||||||
# $Id: GENERIC,v 1.87 1997/03/12 19:59:58 se Exp $
|
# $Id: GENERIC,v 1.88 1997/03/13 19:03:58 bde Exp $
|
||||||
|
|
||||||
machine "i386"
|
machine "i386"
|
||||||
cpu "I386_CPU"
|
cpu "I386_CPU"
|
||||||
@ -107,8 +107,8 @@ device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
|
|||||||
#
|
#
|
||||||
# Laptop support (see LINT for more options)
|
# Laptop support (see LINT for more options)
|
||||||
#
|
#
|
||||||
device apm0 at isa? disable # Advanced Power Management
|
device apm0 at isa? disable flags 0x31 # Advanced Power Management
|
||||||
options APM_BROKEN_STATCLOCK # Workaround some buggy APM BIOS
|
|
||||||
# PCCARD (PCMCIA) support
|
# PCCARD (PCMCIA) support
|
||||||
#controller crd0
|
#controller crd0
|
||||||
#device pcic0 at crd?
|
#device pcic0 at crd?
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# LINT -- config file for checking all the sources, tries to pull in
|
# LINT -- config file for checking all the sources, tries to pull in
|
||||||
# as much of the source tree as it can.
|
# as much of the source tree as it can.
|
||||||
#
|
#
|
||||||
# $Id: LINT,v 1.323 1997/03/26 17:20:24 ache Exp $
|
# $Id: LINT,v 1.324 1997/03/26 17:46:03 ache Exp $
|
||||||
#
|
#
|
||||||
# NB: You probably don't want to try running a kernel built from this
|
# NB: You probably don't want to try running a kernel built from this
|
||||||
# file. Instead, you should start from GENERIC, and add options from
|
# file. Instead, you should start from GENERIC, and add options from
|
||||||
@ -881,14 +881,11 @@ device pca0 at isa? port IO_TIMER1 tty
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Notes on APM
|
# Notes on APM
|
||||||
# Some APM implementations will not work with the `statistics clock'
|
# The flags takes the following meaning for apm0:
|
||||||
# enabled, so it's disabled by default if the APM driver is enabled.
|
# 0x0020 Statclock is broken.
|
||||||
# However, this is not true for all laptops. Try removing the option
|
# 0x0011 Limit APM protocol to 1.1 or 1.0
|
||||||
# APM_BROKEN_STATCLOCK and see if suspend/resume work
|
# 0x0010 Limit APM protocol to 1.0
|
||||||
#
|
#
|
||||||
|
|
||||||
options APM_IDLE_CPU # Tell APM to idle rather than halt'ing the cpu
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Notes on the spigot:
|
# Notes on the spigot:
|
||||||
# The video spigot is at 0xad6. This port address can not be changed.
|
# The video spigot is at 0xad6. This port address can not be changed.
|
||||||
@ -939,8 +936,7 @@ device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr
|
|||||||
device ctx0 at isa? port 0x230 iomem 0xd0000
|
device ctx0 at isa? port 0x230 iomem 0xd0000
|
||||||
device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000 vector spigintr
|
device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000 vector spigintr
|
||||||
device qcam0 at isa? port "IO_LPT3" tty
|
device qcam0 at isa? port "IO_LPT3" tty
|
||||||
device apm0 at isa?
|
device apm0 at isa?
|
||||||
options APM_BROKEN_STATCLOCK
|
|
||||||
device gp0 at isa? port 0x2c0 tty
|
device gp0 at isa? port 0x2c0 tty
|
||||||
device gsc0 at isa? port "IO_GSC1" tty drq 3
|
device gsc0 at isa? port "IO_GSC1" tty drq 3
|
||||||
device joy0 at isa? port "IO_GAME"
|
device joy0 at isa? port "IO_GAME"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# LINT -- config file for checking all the sources, tries to pull in
|
# LINT -- config file for checking all the sources, tries to pull in
|
||||||
# as much of the source tree as it can.
|
# as much of the source tree as it can.
|
||||||
#
|
#
|
||||||
# $Id: LINT,v 1.323 1997/03/26 17:20:24 ache Exp $
|
# $Id: LINT,v 1.324 1997/03/26 17:46:03 ache Exp $
|
||||||
#
|
#
|
||||||
# NB: You probably don't want to try running a kernel built from this
|
# NB: You probably don't want to try running a kernel built from this
|
||||||
# file. Instead, you should start from GENERIC, and add options from
|
# file. Instead, you should start from GENERIC, and add options from
|
||||||
@ -881,14 +881,11 @@ device pca0 at isa? port IO_TIMER1 tty
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Notes on APM
|
# Notes on APM
|
||||||
# Some APM implementations will not work with the `statistics clock'
|
# The flags takes the following meaning for apm0:
|
||||||
# enabled, so it's disabled by default if the APM driver is enabled.
|
# 0x0020 Statclock is broken.
|
||||||
# However, this is not true for all laptops. Try removing the option
|
# 0x0011 Limit APM protocol to 1.1 or 1.0
|
||||||
# APM_BROKEN_STATCLOCK and see if suspend/resume work
|
# 0x0010 Limit APM protocol to 1.0
|
||||||
#
|
#
|
||||||
|
|
||||||
options APM_IDLE_CPU # Tell APM to idle rather than halt'ing the cpu
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Notes on the spigot:
|
# Notes on the spigot:
|
||||||
# The video spigot is at 0xad6. This port address can not be changed.
|
# The video spigot is at 0xad6. This port address can not be changed.
|
||||||
@ -939,8 +936,7 @@ device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr
|
|||||||
device ctx0 at isa? port 0x230 iomem 0xd0000
|
device ctx0 at isa? port 0x230 iomem 0xd0000
|
||||||
device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000 vector spigintr
|
device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000 vector spigintr
|
||||||
device qcam0 at isa? port "IO_LPT3" tty
|
device qcam0 at isa? port "IO_LPT3" tty
|
||||||
device apm0 at isa?
|
device apm0 at isa?
|
||||||
options APM_BROKEN_STATCLOCK
|
|
||||||
device gp0 at isa? port 0x2c0 tty
|
device gp0 at isa? port 0x2c0 tty
|
||||||
device gsc0 at isa? port "IO_GSC1" tty drq 3
|
device gsc0 at isa? port "IO_GSC1" tty drq 3
|
||||||
device joy0 at isa? port "IO_GAME"
|
device joy0 at isa? port "IO_GAME"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
*
|
*
|
||||||
* Aug, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
* Aug, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
||||||
*
|
*
|
||||||
* $Id: apm_bios.h,v 1.15 1997/02/22 09:33:54 peter Exp $
|
* $Id: apm_bios.h,v 1.16 1997/03/09 16:40:13 kato Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MACHINE_APM_BIOS_H_
|
#ifndef _MACHINE_APM_BIOS_H_
|
||||||
@ -195,6 +195,15 @@ typedef struct apm_info {
|
|||||||
u_int ai_status; /* Status of APM support (enabled/disabled) */
|
u_int ai_status; /* Status of APM support (enabled/disabled) */
|
||||||
} *apm_info_t;
|
} *apm_info_t;
|
||||||
|
|
||||||
|
struct apm_bios_arg {
|
||||||
|
u_long eax;
|
||||||
|
u_long ebx;
|
||||||
|
u_long ecx;
|
||||||
|
u_long edx;
|
||||||
|
u_long esi;
|
||||||
|
u_long edi;
|
||||||
|
};
|
||||||
|
|
||||||
#define APMIO_SUSPEND _IO('P', 1)
|
#define APMIO_SUSPEND _IO('P', 1)
|
||||||
#define APMIO_GETINFO _IOR('P', 2, struct apm_info)
|
#define APMIO_GETINFO _IOR('P', 2, struct apm_info)
|
||||||
#define APMIO_ENABLE _IO('P', 5)
|
#define APMIO_ENABLE _IO('P', 5)
|
||||||
@ -202,6 +211,7 @@ typedef struct apm_info {
|
|||||||
#define APMIO_HALTCPU _IO('P', 7)
|
#define APMIO_HALTCPU _IO('P', 7)
|
||||||
#define APMIO_NOTHALTCPU _IO('P', 8)
|
#define APMIO_NOTHALTCPU _IO('P', 8)
|
||||||
#define APMIO_DISPLAY _IOW('P', 9, int)
|
#define APMIO_DISPLAY _IOW('P', 9, int)
|
||||||
|
#define APMIO_BIOS _IOWR('P', 10, struct apm_bios_arg)
|
||||||
|
|
||||||
#endif /* !ASSEMBLER && !INITIALIZER */
|
#endif /* !ASSEMBLER && !INITIALIZER */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user