put in place a proper bioscall.h (sorry about that!)

finish up incomplete job of moving structure used by bioscall() to
<machine/bioscall.h>, with associated changes in include file strategy,
genassym stuff, etc.
This commit is contained in:
jtk 1997-10-15 01:20:33 +00:00
parent 4321b83ee2
commit d6c9c08d70
7 changed files with 106 additions and 62 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: apm.c,v 1.26 1997/10/09 08:53:15 jtc Exp $ */
/* $NetBSD: apm.c,v 1.27 1997/10/15 01:20:41 jtk Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -76,6 +76,7 @@
#include <i386/isa/nvram.h>
#include <dev/isa/isavar.h>
#include <machine/bioscall.h>
#include <machine/apmvar.h>
#if defined(APMDEBUG)
@ -125,14 +126,14 @@ static int apmmatch __P((struct device *, void *, void *));
static void apm_devpowmgt_enable __P((int, u_int));
static void apm_disconnect __P((void *));
#endif
static void apm_event_handle __P((struct apm_softc *, struct apmregs *));
static int apm_get_event __P((struct apmregs *));
static int apm_get_powstat __P((struct apmregs *));
static void apm_event_handle __P((struct apm_softc *, struct bioscallregs *));
static int apm_get_event __P((struct bioscallregs *));
static int apm_get_powstat __P((struct bioscallregs *));
static void apm_get_powstate __P((u_int));
static void apm_periodic_check __P((void *));
static void apm_perror __P((const char *, struct apmregs *, ...))
static void apm_perror __P((const char *, struct bioscallregs *, ...))
__kprintf_attribute__((__format__(__printf__,1,3)));
static void apm_power_print __P((struct apm_softc *, struct apmregs *));
static void apm_power_print __P((struct apm_softc *, struct bioscallregs *));
static void apm_powmgt_enable __P((int));
static void apm_powmgt_engage __P((int, u_int));
static int apm_record_event __P((struct apm_softc *, u_int));
@ -188,12 +189,12 @@ int apm_damn_fool_bios, apm_op_inprog;
int apm_evindex;
#ifdef APMDEBUG
int apmcall_debug(int, struct apmregs *, int);
int apmcall_debug(int, struct bioscallregs *, int);
int
apmcall_debug(func, regs, line)
int func;
struct apmregs *regs;
struct bioscallregs *regs;
int line;
{
int rv;
@ -246,7 +247,7 @@ apm_strerror(code)
}
static void
apm_perror(const char *str, struct apmregs *regs, ...) /* XXX cgd */
apm_perror(const char *str, struct bioscallregs *regs, ...) /* XXX cgd */
{
va_list ap;
@ -259,7 +260,7 @@ apm_perror(const char *str, struct apmregs *regs, ...) /* XXX cgd */
static void
apm_power_print(sc, regs)
struct apm_softc *sc;
struct apmregs *regs;
struct bioscallregs *regs;
{
if (APM_BATT_LIFE(regs) != APM_BATT_LIFE_UNKNOWN) {
@ -332,7 +333,7 @@ static void
apm_get_powstate(dev)
u_int dev;
{
struct apmregs regs;
struct bioscallregs regs;
int rval;
regs.bx = dev;
@ -386,10 +387,10 @@ apm_record_event(sc, event_type)
static void
apm_event_handle(sc, regs)
struct apm_softc *sc;
struct apmregs *regs;
struct bioscallregs *regs;
{
int error;
struct apmregs nregs;
struct bioscallregs nregs;
switch(regs->bx) {
case APM_USER_STANDBY_REQ:
@ -502,7 +503,7 @@ apm_event_handle(sc, regs)
static int
apm_get_event(regs)
struct apmregs *regs;
struct bioscallregs *regs;
{
return (apmcall(APM_GET_PM_EVENT, regs));
@ -512,7 +513,7 @@ static void
apm_periodic_check(arg)
void *arg;
{
struct apmregs regs;
struct bioscallregs regs;
struct apm_softc *sc = arg;
/*
@ -543,7 +544,7 @@ static void
apm_powmgt_enable(onoff)
int onoff;
{
struct apmregs regs;
struct bioscallregs regs;
regs.bx = apm_minver == 0 ? APM_MGT_ALL : APM_DEV_ALLDEVS;
regs.cx = onoff ? APM_MGT_ENABLE : APM_MGT_DISABLE;
@ -557,7 +558,7 @@ apm_powmgt_engage(onoff, dev)
int onoff;
u_int dev;
{
struct apmregs regs;
struct bioscallregs regs;
if (apm_minver == 0)
return;
@ -573,7 +574,7 @@ apm_devpowmgt_enable(onoff, dev)
int onoff;
u_int dev;
{
struct apmregs regs;
struct bioscallregs regs;
if (apm_minver == 0)
return;
@ -595,7 +596,7 @@ int
apm_set_powstate(dev, state)
u_int dev, state;
{
struct apmregs regs;
struct bioscallregs regs;
if (!apm_inited || (apm_minver == 0 && state > APM_SYS_OFF))
return EINVAL;
regs.bx = dev;
@ -610,7 +611,7 @@ apm_set_powstate(dev, state)
void
apm_cpu_busy()
{
struct apmregs regs;
struct bioscallregs regs;
if (!apm_inited || !apm_do_idle)
return;
@ -622,7 +623,7 @@ apm_cpu_busy()
void
apm_cpu_idle()
{
struct apmregs regs;
struct bioscallregs regs;
if (!apm_inited || !apm_do_idle)
return;
@ -634,7 +635,7 @@ static void
apm_set_ver(self)
struct apm_softc *self;
{
struct apmregs regs;
struct bioscallregs regs;
int error;
regs.cx = 0x0101; /* APM Version 1.1 */
@ -668,7 +669,7 @@ apm_set_ver(self)
static int
apm_get_powstat(regs)
struct apmregs *regs;
struct bioscallregs *regs;
{
regs->bx = APM_DEV_ALLDEVS;
@ -680,7 +681,7 @@ static void
apm_disconnect(xxx)
void *xxx;
{
struct apmregs regs;
struct bioscallregs regs;
regs.bx = apm_minver == 1 ? APM_DEV_ALLDEVS : APM_DEFAULTS_ALL;
if (apmcall(APM_SYSTEM_DEFAULTS, &regs))
@ -701,7 +702,7 @@ apm_disconnect(xxx)
int
apm_busprobe()
{
struct apmregs regs;
struct bioscallregs regs;
#ifdef APMDEBUG
char bits[128];
#endif
@ -771,7 +772,7 @@ apmattach(parent, self, aux)
{
extern int biosbasemem;
struct apm_softc *apmsc = (void *)self;
struct apmregs regs;
struct bioscallregs regs;
int error, apm_data_seg_ok;
u_int okbases[] = { 0, biosbasemem*1024 };
u_int oklimits[] = { NBPG, IOM_END-1 };
@ -1193,7 +1194,7 @@ apmioctl(dev, cmd, data, flag, p)
struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)];
struct apm_power_info *powerp;
struct apm_event_info *evp;
struct apmregs regs;
struct bioscallregs regs;
struct apm_ctl *actl;
int i;

View File

@ -1,4 +1,4 @@
/* $NetBSD: apmcall.s,v 1.1 1997/10/14 03:54:18 jtk Exp $ */
/* $NetBSD: apmcall.s,v 1.2 1997/10/15 01:21:05 jtk Exp $ */
/*
* Copyright (c) 1997 John T. Kohl
* All rights reserved.
@ -31,9 +31,10 @@
#include "assym.h"
#include <machine/asm.h>
#include <machine/apmvar.h>
#include <machine/bioscall.h>
/*
* int apmcall(int function, struct apmregs *regs):
* int apmcall(int function, struct bioscallregs *regs):
* call the APM protected mode bios function FUNCTION for BIOS selection
* WHICHBIOS.
* Fills in *regs with registers as returned by APM.
@ -63,9 +64,9 @@ NENTRY(apmcall)
movb %cs:8(%ebp),%al
movb $0x53,%ah
movl %cs:12(%ebp),%ebx
movw %cs:APMREG_CX(%ebx),%cx
movw %cs:APMREG_DX(%ebx),%dx
movw %cs:APMREG_BX(%ebx),%bx
movw %cs:BIOSCALLREG_CX(%ebx),%cx
movw %cs:BIOSCALLREG_DX(%ebx),%dx
movw %cs:BIOSCALLREG_BX(%ebx),%bx
pushfl
cli
pushl %ds
@ -81,10 +82,10 @@ NENTRY(apmcall)
popl %ds # see above
#endif
movl 12(%ebp),%esi
movw %ax,APMREG_AX(%esi)
movw %bx,APMREG_BX(%esi)
movw %cx,APMREG_CX(%esi)
movw %dx,APMREG_DX(%esi)
movw %ax,BIOSCALLREG_AX(%esi)
movw %bx,BIOSCALLREG_BX(%esi)
movw %cx,BIOSCALLREG_CX(%esi)
movw %dx,BIOSCALLREG_DX(%esi)
/* todo: do something with %edi? */
movl $1,%eax
cmpl $0,apmstatus

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.2 1997/03/15 18:09:51 is Exp $
# $NetBSD: genassym.cf,v 1.3 1997/10/15 01:21:00 jtk Exp $
#
# Copyright (c) 1995, 1997 Charles M. Hannum. All rights reserved.
@ -54,6 +54,7 @@ include <machine/vmparam.h>
include "apm.h"
if NAPM > 0
include <machine/bioscall.h>
include <machine/apmvar.h>
endif
@ -162,11 +163,11 @@ define APM_DATA_LEN offsetof(struct apm_connect_info, apm_data_seg_len)
define APM_ENTRY offsetof(struct apm_connect_info, apm_entrypt)
define APM_DETAIL offsetof(struct apm_connect_info, apm_detail)
define APM_SIZE sizeof(struct apm_connect_info)
define APMREG_AX offsetof(struct apmregs, ax)
define APMREG_BX offsetof(struct apmregs, bx)
define APMREG_CX offsetof(struct apmregs, cx)
define APMREG_DX offsetof(struct apmregs, dx)
define APMREG_SI offsetof(struct apmregs, si)
define APMREG_DI offsetof(struct apmregs, di)
define APMREG_FLAGS offsetof(struct apmregs, flags)
define BIOSCALLREG_AX offsetof(struct bioscallregs, ax)
define BIOSCALLREG_BX offsetof(struct bioscallregs, bx)
define BIOSCALLREG_CX offsetof(struct bioscallregs, cx)
define BIOSCALLREG_DX offsetof(struct bioscallregs, dx)
define BIOSCALLREG_SI offsetof(struct bioscallregs, si)
define BIOSCALLREG_DI offsetof(struct bioscallregs, di)
define BIOSCALLREG_FLAGS offsetof(struct bioscallregs, flags)
endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.258 1997/10/14 03:55:06 jtk Exp $ */
/* $NetBSD: machdep.c,v 1.259 1997/10/15 01:20:51 jtk Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -154,14 +154,14 @@
#include "apm.h"
#include "bioscall.h"
#if NAPM > 0
#include <machine/apmvar.h>
#endif
#if NBIOSCALL > 0
#include <machine/bioscall.h>
#endif
#if NAPM > 0
#include <machine/apmvar.h>
#endif
#include "isa.h"
#include "isadma.h"
#include "npx.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: mainbus.c,v 1.18 1997/08/30 06:54:34 mycroft Exp $ */
/* $NetBSD: mainbus.c,v 1.19 1997/10/15 01:20:33 jtk Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -49,6 +49,7 @@
#include "apm.h"
#if NAPM > 0
#include <machine/bioscall.h>
#include <machine/apmvar.h>
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: apmvar.h,v 1.5 1996/11/22 00:19:09 jtk Exp $ */
/* $NetBSD: apmvar.h,v 1.6 1997/10/15 01:21:20 jtk Exp $ */
/*
* Copyright (c) 1995 John T. Kohl
* All rights reserved.
@ -184,15 +184,6 @@
#ifndef _LOCORE
/* filled in by apmcall */
struct apmregs {
u_short ax;
u_short bx;
u_short cx;
u_short dx;
u_short si;
u_short di;
u_short flags;
};
struct apm_connect_info {
u_int apm_code32_seg_base; /* real-mode style segment selector */
@ -240,8 +231,8 @@ struct apm_attach_args {
#ifdef _KERNEL
extern struct apm_connect_info apminfo; /* in locore */
extern int apmpresent;
extern int apmcall __P((int function, struct apmregs *regs));
extern void bioscall __P((int function, struct apmregs *regs));
extern int apmcall __P((int function, struct bioscallregs *regs));
extern void bioscall __P((int function, struct bioscallregs *regs));
extern void apm_cpu_busy __P((void));
extern void apm_cpu_idle __P((void));
extern void apminit __P((void));

View File

@ -1 +1,50 @@
/* $NetBSD: bioscall.h,v 1.2 1997/10/15 01:21:25 jtk Exp $ */
/*
* Copyright (c) 1997 John T. Kohl
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __I386_BIOSCALL_H__
#define __I386_BIOSCALL_H__
/*
* virtual & physical address of the trampoline
* that we use: page 1.
*/
#define BIOSTRAMP_BASE NBPG
#ifndef _LOCORE
struct bioscallregs {
u_short ax;
u_short bx;
u_short cx;
u_short dx;
u_short si;
u_short di;
u_short flags;
};
#endif
#endif /* __I386_BIOSCALL_H__ */