add pre-probe step so that autoconfiguration does not print 'apm0 at
mainbus0 not configured' message if configured but not present in the BIOS
This commit is contained in:
parent
ae805c5cbf
commit
73b960a308
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: apm.c,v 1.17 1996/11/14 12:39:55 jtk Exp $ */
|
||||
/* $NetBSD: apm.c,v 1.18 1996/11/22 00:19:07 jtk Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
|
@ -399,7 +399,7 @@ struct apmregs *regs;
|
|||
DPRINTF(("power status change\n"));
|
||||
error = apm_get_powstat(&nregs);
|
||||
/* only print if nobody is catching events. */
|
||||
if (error == 0 && (sc->sc_flags & SCFLAG_OREAD) == 0)
|
||||
if (error == 0 && (sc->sc_flags & (SCFLAG_OREAD|SCFLAG_OWRITE)) == 0)
|
||||
apm_power_print(sc, &nregs);
|
||||
apm_record_event(sc, regs->bx);
|
||||
break;
|
||||
|
@ -636,6 +636,39 @@ int apm_bogus_bios = 0;
|
|||
|
||||
#define I386_FLAGBITS "\020\017NT\014OVFL\0130UP\012IEN\011TF\010NF\007ZF\005AF\003PF\001CY"
|
||||
|
||||
int
|
||||
apm_busprobe()
|
||||
{
|
||||
struct apmregs regs;
|
||||
/* XXX the DPRINTF() conditional */
|
||||
#if defined(DEBUG) || defined(APMDEBUG)
|
||||
char bits[128];
|
||||
#endif
|
||||
|
||||
regs.ax = APM_BIOS_FN(APM_INSTALLATION_CHECK);
|
||||
regs.bx = APM_DEV_APM_BIOS;
|
||||
regs.cx = regs.dx = regs.si = regs.di = regs.flags = 0;
|
||||
bioscall(APM_SYSTEM_BIOS, ®s);
|
||||
DPRINTF(("apm: bioscall return: %x %x %x %x %s %x %x\n",
|
||||
regs.ax, regs.bx, regs.cx, regs.dx,
|
||||
bitmask_snprintf(regs.flags, I386_FLAGBITS,
|
||||
bits, sizeof(bits)), regs.si, regs.di));
|
||||
|
||||
if (regs.flags & PSL_C) {
|
||||
DPRINTF(("apm: carry set means no APM bios\n"));
|
||||
return 0; /* no carry -> not installed */
|
||||
}
|
||||
if (regs.bx != APM_INSTALL_SIGNATURE) {
|
||||
DPRINTF(("apm: PM signature not found\n"));
|
||||
return 0;
|
||||
}
|
||||
if ((regs.cx & APM_32BIT_SUPPORT) == 0) {
|
||||
DPRINTF(("apm: no 32bit support\n"));
|
||||
return 0;
|
||||
}
|
||||
return 1; /* OK to continue probe & complain if something fails */
|
||||
}
|
||||
|
||||
int
|
||||
apmprobe(parent, match, aux)
|
||||
struct device *parent;
|
||||
|
@ -664,20 +697,6 @@ apmprobe(parent, match, aux)
|
|||
bitmask_snprintf(regs.flags, I386_FLAGBITS,
|
||||
bits, sizeof(bits)), regs.si, regs.di));
|
||||
|
||||
if (regs.flags & PSL_C) {
|
||||
DPRINTF(("apm: carry set means no APM bios\n"));
|
||||
return 0; /* no carry -> not installed */
|
||||
}
|
||||
|
||||
if (regs.bx != APM_INSTALL_SIGNATURE) {
|
||||
DPRINTF(("apm: PM signature not found\n"));
|
||||
return 0;
|
||||
}
|
||||
if ((regs.cx & APM_32BIT_SUPPORT) == 0) {
|
||||
DPRINTF(("apm: no 32bit support\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
apminfo.apm_detail = (u_int)regs.ax | ((u_int)regs.cx << 16);
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mainbus.c,v 1.14 1996/10/21 22:24:40 thorpej Exp $ */
|
||||
/* $NetBSD: mainbus.c,v 1.15 1996/11/22 00:19:08 jtk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -127,7 +127,7 @@ mainbus_attach(parent, self, aux)
|
|||
config_found(self, &mba.mba_iba, mainbus_print);
|
||||
}
|
||||
#if NAPM > 0
|
||||
{
|
||||
if (apm_busprobe()) {
|
||||
mba.mba_aaa.aaa_busname = "apm";
|
||||
config_found(self, &mba.mba_aaa, mainbus_print);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: apmvar.h,v 1.4 1996/09/10 11:22:35 jtk Exp $ */
|
||||
/* $NetBSD: apmvar.h,v 1.5 1996/11/22 00:19:09 jtk Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 John T. Kohl
|
||||
* All rights reserved.
|
||||
|
@ -246,6 +246,7 @@ extern void apm_cpu_busy __P((void));
|
|||
extern void apm_cpu_idle __P((void));
|
||||
extern void apminit __P((void));
|
||||
int apm_set_powstate __P((u_int devid, u_int powstate));
|
||||
extern int apm_busprobe __P((void));
|
||||
#endif /* _KERNEL */
|
||||
#endif /* _LOCORE */
|
||||
#endif /* __i386_apm_h__ */
|
||||
|
|
Loading…
Reference in New Issue