1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Reenable the APMIO_BIOS ioctl and translate arguments into the new format

(which is more like the old than I thought).

Requested-by:	imp
This commit is contained in:
Mike Smith 1999-07-30 19:35:03 +00:00
parent 430256ad16
commit 600d8382d9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=49292
3 changed files with 51 additions and 3 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 */