diff options
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/i386/bios.c | 24 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 45 | ||||
-rw-r--r-- | sys/arch/i386/include/biosvar.h | 23 | ||||
-rw-r--r-- | sys/arch/i386/include/cpu.h | 12 |
4 files changed, 75 insertions, 29 deletions
diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c index d81f549dfef..a2e7f5b242c 100644 --- a/sys/arch/i386/i386/bios.c +++ b/sys/arch/i386/i386/bios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bios.c,v 1.3 1997/09/21 22:08:07 weingart Exp $ */ +/* $OpenBSD: bios.c,v 1.4 1997/09/21 23:00:41 mickey Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -302,11 +302,8 @@ bioscnpollc(dev, on) { } -/* - * machine dependent system variables. - */ int -cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) +bios_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) int *name; u_int namelen; void *oldp; @@ -316,29 +313,22 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) struct proc *p; { extern u_int cnvmem, extmem, bootapiver; /* locore.s */ - dev_t consdev; /* all sysctl names at this level are terminal */ if (namelen != 1) return (ENOTDIR); /* overloaded */ - if (bootapiver == 0 && name[0] != CPU_CONSDEV) + if (bootapiver == 0) return EOPNOTSUPP; switch (name[0]) { - case CPU_CONSDEV: - if (cn_tab != NULL) - consdev = cn_tab->cn_dev; - else - consdev = NODEV; - return sysctl_rdstruct(oldp, oldlenp, newp, &consdev, sizeof consdev); - case CPU_BIOSDEV: + case BIOS_DEV: return sysctl_rdint(oldp, oldlenp, newp, BIOS_vars.bios_dev); - case CPU_BIOSGEOMETRY: + case BIOS_GEOMETRY: return sysctl_rdint(oldp, oldlenp, newp, BIOS_vars.bios_geometry); - case CPU_CNVMEM: + case BIOS_CNVMEM: return sysctl_rdint(oldp, oldlenp, newp, cnvmem); - case CPU_EXTMEM: + case BIOS_EXTMEM: return sysctl_rdint(oldp, oldlenp, newp, extmem); default: return EOPNOTSUPP; diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index c577698ca55..cd5e1019a1b 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.48 1997/09/21 04:27:55 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.49 1997/09/21 23:00:42 mickey Exp $ */ /* $NetBSD: machdep.c,v 1.202 1996/05/18 15:54:59 christos Exp $ */ /*- @@ -97,8 +97,12 @@ #include <i386/isa/isa_machdep.h> #include <i386/isa/nvram.h> -#include "apm.h" +#include "bios.h" +#if NBIOS > 0 +#include <machine/biosvar.h> +#endif +#include "apm.h" #if NAPM > 0 #include <machine/apmvar.h> #endif @@ -1425,6 +1429,43 @@ cpu_reset() for (;;); } +/* + * machine dependent system variables. + */ +int +cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) + int *name; + u_int namelen; + void *oldp; + size_t *oldlenp; + void *newp; + size_t newlen; + struct proc *p; +{ + dev_t consdev; + + switch (name[0]) { + case CPU_CONSDEV: + if (namelen != 1) + return (ENOTDIR); /* overloaded */ + + if (cn_tab != NULL) + consdev = cn_tab->cn_dev; + else + consdev = NODEV; + return sysctl_rdstruct(oldp, oldlenp, newp, + &consdev, sizeof consdev); +#if NBIOS > 0 + case CPU_BIOS: + return bios_sysctl(name + 1, namelen - 1, oldp, oldlenp, + newp, newlen, p); +#endif + default: + return EOPNOTSUPP; + } + /* NOTREACHED */ +} + int bus_space_map(t, bpa, size, cacheable, bshp) bus_space_tag_t t; diff --git a/sys/arch/i386/include/biosvar.h b/sys/arch/i386/include/biosvar.h index c75b0d8b8cc..4e7796565d4 100644 --- a/sys/arch/i386/include/biosvar.h +++ b/sys/arch/i386/include/biosvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: biosvar.h,v 1.11 1997/09/17 17:56:09 mickey Exp $ */ +/* $OpenBSD: biosvar.h,v 1.12 1997/09/21 23:00:43 mickey Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -66,6 +66,23 @@ #define BIOSM_F144K 0xf0 /* floppy ds/hd 18 spt 3.50" */ #define BIOSM_OTHER 0xf0 /* any other */ +/* + * CTL_BIOS definitions. + */ +#define BIOS_DEV 1 /* int: BIOS boot device */ +#define BIOS_GEOMETRY 2 /* int: BIOS boot device geometry */ +#define BIOS_CNVMEM 3 /* int: amount of conventional memory */ +#define BIOS_EXTMEM 4 /* int: amount of extended memory */ +#define BIOS_MAXID 5 /* number of valid machdep ids */ + +#define CTL_BIOS_NAMES { \ + { 0, 0 }, \ + { "biosdev", CTLTYPE_INT }, \ + { "biosgeo", CTLTYPE_INT }, \ + { "cnvmem", CTLTYPE_INT }, \ + { "extmem", CTLTYPE_INT }, \ +} + /* * Advanced Power Management (APM) BIOS driver for laptop PCs. * @@ -243,6 +260,10 @@ struct bios_attach_args { }; struct consdev; +struct proc; + +int bios_sysctl + __P((int *, u_int, void *, size_t *, void *, size_t, struct proc *)); void bioscnprobe __P((struct consdev *)); void bioscninit __P((struct consdev *)); diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h index cbe03dbb86d..813609afe05 100644 --- a/sys/arch/i386/include/cpu.h +++ b/sys/arch/i386/include/cpu.h @@ -206,19 +206,13 @@ void setconf __P((void)); * CTL_MACHDEP definitions. */ #define CPU_CONSDEV 1 /* dev_t: console terminal device */ -#define CPU_BIOSDEV 2 /* int: BIOS boot device */ -#define CPU_BIOSGEOMETRY 3 /* int: BIOS boot device geometry */ -#define CPU_CNVMEM 4 /* int: amount of conventional memory */ -#define CPU_EXTMEM 5 /* int: amount of extended memory */ -#define CPU_MAXID 6 /* number of valid machdep ids */ +#define CPU_BIOS 2 /* BIOS variables */ +#define CPU_MAXID 3 /* number of valid machdep ids */ #define CTL_MACHDEP_NAMES { \ { 0, 0 }, \ { "console_device", CTLTYPE_STRUCT }, \ - { "biosdev", CTLTYPE_INT }, \ - { "biosgeo", CTLTYPE_INT }, \ - { "cnvmem", CTLTYPE_INT }, \ - { "extmem", CTLTYPE_INT }, \ + { "bios", CTLTYPE_INT }, \ } #endif /* !_I386_CPU_H_ */ |