From 819d43daf6a609524a662ef360708414e55e6785 Mon Sep 17 00:00:00 2001 From: msmith Date: Fri, 30 Jul 1999 19:35:03 +0000 Subject: Reenable the APMIO_BIOS ioctl and translate arguments into the new format (which is more like the old than I thought). Requested-by: imp --- sys/i386/apm/apm.c | 21 ++++++++++++++++++++- sys/i386/bios/apm.c | 21 ++++++++++++++++++++- sys/i386/include/apm_bios.h | 12 +++++++++++- 3 files changed, 51 insertions(+), 3 deletions(-) (limited to 'sys/i386') diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c index 464739a..cf75c0f 100644 --- a/sys/i386/apm/apm.c +++ b/sys/i386/apm/apm.c @@ -15,7 +15,7 @@ * * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm.c,v 1.95 1999/07/29 18:15:33 iwasaki Exp $ + * $Id: apm.c,v 1.96 1999/07/30 08:24:19 msmith Exp $ */ #include "opt_devfs.h" @@ -1070,6 +1070,7 @@ static int apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) { struct apm_softc *sc = &apm_softc; + struct apm_bios_arg *args; int error = 0; int newstate; @@ -1130,6 +1131,24 @@ apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) if (apm_display(newstate)) error = ENXIO; break; + case APMIO_BIOS: + /* XXX compatibility with the old interface */ + args = (struct apm_bios_arg *)addr; + sc->bios.r.eax = args->eax; + sc->bios.r.ebx = args->ebx; + sc->bios.r.ecx = args->ecx; + sc->bios.r.edx = args->edx; + sc->bios.r.esi = args->esi; + sc->bios.r.edi = args->edi; + if (apm_bioscall()) + sc->bios.r.eax &= 0xff; + args->eax = sc->bios.r.eax; + args->ebx = sc->bios.r.ebx; + args->ecx = sc->bios.r.ecx; + args->edx = sc->bios.r.edx; + args->esi = sc->bios.r.esi; + args->edi = sc->bios.r.edi; + break; default: error = EINVAL; break; diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index 464739a..cf75c0f 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -15,7 +15,7 @@ * * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm.c,v 1.95 1999/07/29 18:15:33 iwasaki Exp $ + * $Id: apm.c,v 1.96 1999/07/30 08:24:19 msmith Exp $ */ #include "opt_devfs.h" @@ -1070,6 +1070,7 @@ static int apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) { struct apm_softc *sc = &apm_softc; + struct apm_bios_arg *args; int error = 0; int newstate; @@ -1130,6 +1131,24 @@ apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) if (apm_display(newstate)) error = ENXIO; break; + case APMIO_BIOS: + /* XXX compatibility with the old interface */ + args = (struct apm_bios_arg *)addr; + sc->bios.r.eax = args->eax; + sc->bios.r.ebx = args->ebx; + sc->bios.r.ecx = args->ecx; + sc->bios.r.edx = args->edx; + sc->bios.r.esi = args->esi; + sc->bios.r.edi = args->edi; + if (apm_bioscall()) + sc->bios.r.eax &= 0xff; + args->eax = sc->bios.r.eax; + args->ebx = sc->bios.r.ebx; + args->ecx = sc->bios.r.ecx; + args->edx = sc->bios.r.edx; + args->esi = sc->bios.r.esi; + args->edi = sc->bios.r.edi; + break; default: error = EINVAL; break; diff --git a/sys/i386/include/apm_bios.h b/sys/i386/include/apm_bios.h index aa10a76..5f7cf5b 100644 --- a/sys/i386/include/apm_bios.h +++ b/sys/i386/include/apm_bios.h @@ -12,7 +12,7 @@ * * Aug, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm_bios.h,v 1.23 1999/07/29 01:49:19 msmith Exp $ + * $Id: apm_bios.h,v 1.24 1999/07/30 08:24:23 msmith Exp $ */ #ifndef _MACHINE_APM_BIOS_H_ @@ -219,6 +219,15 @@ typedef struct apm_info { u_int ai_spare[6]; /* For future expansion */ } *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; +}; + struct apm_event_info { u_int type; u_int index; @@ -232,6 +241,7 @@ struct apm_event_info { #define APMIO_HALTCPU _IO('P', 7) #define APMIO_NOTHALTCPU _IO('P', 8) #define APMIO_DISPLAY _IOW('P', 9, int) +#define APMIO_BIOS _IOWR('P', 10, struct apm_bios_arg) #define APMIO_GETINFO _IOR('P', 11, struct apm_info) #define APMIO_STANDBY _IO('P', 12) /* for /dev/apmctl */ -- cgit v1.1