summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1997-10-22 23:37:14 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1997-10-22 23:37:14 +0000
commit3e53b8008383416ea23a2792b87f2831dc401568 (patch)
tree557e1a20539f7d8a72028b3cea8f86ce23bc12c1 /sys/arch
parent75ff2b524f49004c6afee07d65b8dfa530bf747d (diff)
support new libsa
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/apm.c42
-rw-r--r--sys/arch/i386/i386/bios.c229
-rw-r--r--sys/arch/i386/i386/locore.s28
-rw-r--r--sys/arch/i386/i386/machdep.c4
-rw-r--r--sys/arch/i386/include/biosvar.h126
5 files changed, 210 insertions, 219 deletions
diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c
index 42699189850..18ff03a27e0 100644
--- a/sys/arch/i386/i386/apm.c
+++ b/sys/arch/i386/i386/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.12 1997/10/13 00:09:20 mickey Exp $ */
+/* $OpenBSD: apm.c,v 1.13 1997/10/22 23:37:10 mickey Exp $ */
/*-
* Copyright (c) 1995 John T. Kohl. All rights reserved.
@@ -601,9 +601,9 @@ apmprobe(parent, match, aux)
if (apminited)
return 0;
- if (!(ba->apm_detail & APM_BIOS_PM_DISABLED) &&
- !(ba->apm_detail & APM_BIOS_PM_DISENGAGED) &&
- (ba->apm_detail & APM_32BIT_SUPPORTED) &&
+ if (!(ba->bios_apmp->apm_detail & APM_BIOS_PM_DISABLED) &&
+ !(ba->bios_apmp->apm_detail & APM_BIOS_PM_DISENGAGED) &&
+ (ba->bios_apmp->apm_detail & APM_32BIT_SUPPORTED) &&
strcmp(ba->bios_dev, "apm") == 0) {
return 1;
}
@@ -616,36 +616,36 @@ apmattach(parent, self, aux)
void *aux;
{
extern union descriptor *dynamic_gdt;
- register struct bios_attach_args *ba = aux;
+ bios_apminfo_t *ap = ((struct bios_attach_args *)aux)->bios_apmp;
struct apm_softc *sc = (void *)self;
struct apmregs regs;
/*
* set up GDT descriptors for APM
*/
- if (ba->apm_detail & APM_32BIT_SUPPORTED) {
- apm_flags = ba->apm_detail;
+ if (ap->apm_detail & APM_32BIT_SUPPORTED) {
+ apm_flags = ap->apm_detail;
apm_ep.seg = GSEL(GAPM32CODE_SEL,SEL_KPL);
- apm_ep.entry = ba->apm_entry;
+ apm_ep.entry = ap->apm_entry;
setsegment(&dynamic_gdt[GAPM32CODE_SEL].sd,
- (void *)ISA_HOLE_VADDR(ba->apm_code32_base),
- ba->apm_code_len-1, SDT_MEMERA, SEL_KPL, 1, 0);
+ (void *)ISA_HOLE_VADDR(ap->apm_code32_base),
+ ap->apm_code_len-1, SDT_MEMERA, SEL_KPL, 1, 0);
setsegment(&dynamic_gdt[GAPM16CODE_SEL].sd,
- (void *)ISA_HOLE_VADDR(ba->apm_code16_base),
- ba->apm_code_len-1, SDT_MEMERA, SEL_KPL, 0, 0);
+ (void *)ISA_HOLE_VADDR(ap->apm_code16_base),
+ ap->apm_code_len-1, SDT_MEMERA, SEL_KPL, 0, 0);
setsegment(&dynamic_gdt[GAPMDATA_SEL].sd,
- (void *)ISA_HOLE_VADDR(ba->apm_data_base),
- ba->apm_data_len-1, SDT_MEMRWA, SEL_KPL, 1, 0);
+ (void *)ISA_HOLE_VADDR(ap->apm_data_base),
+ ap->apm_data_len-1, SDT_MEMRWA, SEL_KPL, 1, 0);
#if defined(DEBUG) || defined(APMDEBUG)
printf(": flags %x code 32:%x/%x 16:%x/%x %x "
"data %x/%x/%x ep %x (%x:%x)\n%s", apm_flags,
- ba->apm_code32_base, ISA_HOLE_VADDR(ba->apm_code32_base),
- ba->apm_code16_base, ISA_HOLE_VADDR(ba->apm_code16_base),
- ba->apm_code_len,
- ba->apm_data_base, ISA_HOLE_VADDR(ba->apm_data_base),
- ba->apm_data_len,
- ba->apm_entry, apm_ep.seg,
- ba->apm_entry+ISA_HOLE_VADDR(ba->apm_code32_base),
+ ap->apm_code32_base, ISA_HOLE_VADDR(ap->apm_code32_base),
+ ap->apm_code16_base, ISA_HOLE_VADDR(ap->apm_code16_base),
+ ap->apm_code_len,
+ ap->apm_data_base, ISA_HOLE_VADDR(ap->apm_data_base),
+ ap->apm_data_len,
+ ap->apm_entry, apm_ep.seg,
+ ap->apm_entry+ISA_HOLE_VADDR(ap->apm_code32_base),
sc->sc_dev.dv_xname);
#endif
apm_set_ver(sc);
diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c
index c54f332a49d..3d3bc4ac556 100644
--- a/sys/arch/i386/i386/bios.c
+++ b/sys/arch/i386/i386/bios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bios.c,v 1.10 1997/10/19 06:34:21 mickey Exp $ */
+/* $OpenBSD: bios.c,v 1.11 1997/10/22 23:37:11 mickey Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -32,17 +32,22 @@
*
*/
+/* #define BIOS_DEBUG */
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <sys/errno.h>
#include <sys/proc.h>
+#include <sys/malloc.h>
+#include <sys/reboot.h>
#include <vm/vm.h>
#include <sys/sysctl.h>
#include <dev/cons.h>
+#include <stand/boot/bootarg.h>
#include <machine/cpu.h>
#include <machine/pio.h>
@@ -58,22 +63,13 @@
#include "apm.h"
-#define LMVAS (1024*1024-NBPG)
-#define LMVOF NBPG
-
-int gdt_get_slot __P((void));
-
struct bios_softc {
struct device sc_dev;
-
- bus_space_handle_t bt;
};
int biosprobe __P((struct device *, void *, void *));
void biosattach __P((struct device *, struct device *, void *));
-void bios_init __P((bus_space_handle_t));
int bios_print __P((void *, const char *));
-static __inline int bios_call __P((u_int cmd, u_int arg));
struct cfattach bios_ca = {
sizeof(struct bios_softc), biosprobe, biosattach
@@ -83,57 +79,14 @@ struct cfdriver bios_cd = {
NULL, "bios", DV_DULL
};
-int bios_initted = 0;
-int bios_ds, bios_cs16;
-bus_space_handle_t bios_lmva;
-struct {
- u_int32_t ip;
- u_int16_t cs;
-} bios_kentry;
-struct BIOS_vars BIOS_vars;
-
-static __inline int
-bios_call(cmd, arg)
- u_int cmd;
- u_int arg;
-{
- int rv;
- __asm volatile ("pushl %1\n\t"
- "pushl %2\n\t"
- "pushl %%ds\n\t"
- "movl %4, %%ds\n\t"
- "movl %4, %%es\n\t"
- "movl %4, %%gs\n\t"
- "movl %4, %%fs\n\t"
- "lcall %%cs:(%3)\n\t"
- "popl %%ds\n\t"
- "addl $8, %%esp"
- : "=a" (rv)
- : "id" (cmd), "r" (arg),
- "r" (&bios_kentry), "r" (bios_ds));
- return rv;
-}
-
-void
-bios_init(bt)
- bus_space_handle_t bt;
-{
- if (bios_initted)
- return;
-
- if (bus_space_map(bt, LMVOF, LMVAS, 0, &bios_lmva) == 0) {
- extern union descriptor *dynamic_gdt;
+extern bus_addr_t bootargv;
+extern int bootargc;
+extern u_int bootapiver; /* locore.s */
+extern dev_t bootdev;
- setsegment(&dynamic_gdt[bios_kentry.cs = gdt_get_slot()].sd,
- (void*)bios_lmva, LMVAS, SDT_MEMERA, SEL_KPL, 1, 0);
- setsegment(&dynamic_gdt[bios_ds = gdt_get_slot()].sd,
- (void*)bios_lmva, LMVAS, SDT_MEMRWA, SEL_KPL, 1, 0);
- setsegment(&dynamic_gdt[bios_cs16 = gdt_get_slot()].sd,
- (void*)bios_lmva, LMVAS, SDT_MEMERA, SEL_KPL, 0, 0);
+bios_diskinfo_t *bios_diskinfo;
- bios_initted++;
- }
-}
+bios_diskinfo_t *bios_getdiskinfo __P((dev_t));
int
biosprobe(parent, match, aux)
@@ -141,21 +94,31 @@ biosprobe(parent, match, aux)
void *match, *aux;
{
struct bios_attach_args *bia = aux;
- extern u_int bootapiver; /* locore.s */
+ bus_space_handle_t hsp;
+ int error;
- if (bootapiver == 0)
+#ifdef BIOS_DEBUG
+ printf("%s%d: boot API ver %x, %x; args %p[%d]\n",
+ bia->bios_dev, bios_cd.cd_ndevs,
+ bootapiver, BOOT_APIVER, bootargv, bootargc);
+#endif
+ /* there could be only one */
+ if (bios_cd.cd_ndevs || strcmp(bia->bios_dev, bios_cd.cd_name))
return 0;
-#if 0
- if (!bios_initted) {
- bus_space_handle_t hsp;
+ if (bootapiver < BOOT_APIVER || bootargv == NULL)
+ return 0;
- if (bus_space_map(bia->bios_memt, LMVOF, LMVAS, 0, &hsp) != 0)
- return 0;
- bus_space_unmap(bia->bios_memt, hsp, LMVAS);
- }
+ if ((error = bus_space_map(bia->bios_memt,
+ bootargv, bootargc, 1, &hsp)) != 0) {
+#ifdef DEBUG
+ printf("bios0: bus_space_map() == %d\n", error);
#endif
- return !bios_cd.cd_ndevs && !strcmp(bia->bios_dev, "bios");
+ return 0;
+ }
+ bus_space_unmap(bia->bios_memt, hsp, bootargc);
+
+ return 1;
}
void
@@ -165,44 +128,69 @@ biosattach(parent, self, aux)
{
struct bios_softc *sc = (void *) self;
struct bios_attach_args *bia = aux;
-
+#if NAPM > 0 || defined(DEBUG)
+ bios_apminfo_t *apm;
+#endif
u_int8_t *va = ISA_HOLE_VADDR(0xffff0);
- char *p;
+ char *str;
+ bus_space_handle_t hsp;
+ bootarg_t *p, *q;
+
+ if (bus_space_map(bia->bios_memt, bootargv, bootargc, 1, &hsp) != 0) {
+#ifdef DEBUG
+ panic("getbootargs: can't map low memory");
+#endif
+ return;
+ }
- sc->bt = bia->bios_memt;
- /* bios_init(sc->bt); */
switch (va[14]) {
default:
- case 0xff: p = "PC"; break;
- case 0xfe: p = "PC/XT"; break;
- case 0xfd: p = "PCjr"; break;
- case 0xfc: p = "AT/286+"; break;
- case 0xfb: p = "PC/XT+"; break;
- case 0xfa: p = "PS/2 25/30"; break;
- case 0xf9: p = "PC Convertible";break;
- case 0xf8: p = "PS/2 386+"; break;
+ case 0xff: str = "PC"; break;
+ case 0xfe: str = "PC/XT"; break;
+ case 0xfd: str = "PCjr"; break;
+ case 0xfc: str = "AT/286+"; break;
+ case 0xfb: str = "PC/XT+"; break;
+ case 0xfa: str = "PS/2 25/30"; break;
+ case 0xf9: str = "PC Convertible";break;
+ case 0xf8: str = "PS/2 386+"; break;
}
printf(": %s(%02x) BIOS, date %c%c/%c%c/%c%c\n",
- p, va[15], va[5], va[6], va[8], va[9], va[11], va[12]);
+ str, va[15], va[5], va[6], va[8], va[9], va[11], va[12]);
+
+ printf("%s:", sc->sc_dev.dv_xname);
+ p = (bootarg_t *)hsp;
+ for(q = p; q->ba_type != BOOTARG_END; q = q->ba_next) {
+ q->ba_next = (bootarg_t *)((caddr_t)q + q->ba_size);
+ switch (q->ba_type) {
+ case BOOTARG_MEMMAP:
+ printf(" memmap");
+ break;
+ case BOOTARG_DISKINFO:
+ printf(" diskinfo");
+ bios_diskinfo = (bios_diskinfo_t *)q->ba_arg;
+ break;
+ case BOOTARG_APMINFO:
+ printf(" apminfo");
+ apm = (bios_apminfo_t *)q->ba_arg;
+ break;
+ default:
+ }
+ }
+ printf("\n");
+
#ifdef DEBUG
printf("apminfo: %x, code %x/%x[%x], data %x[%x], entry %x\n",
- BIOS_vars.bios_apm_detail, BIOS_vars.bios_apm_code32_base,
- BIOS_vars.bios_apm_code16_base, BIOS_vars.bios_apm_code_len,
- BIOS_vars.bios_apm_data_base, BIOS_vars.bios_apm_data_len,
- BIOS_vars.bios_apm_entry);
+ apm->apm_detail, apm->apm_code32_base,
+ apm->apm_code16_base, apm->apm_code_len,
+ apm->apm_data_base, apm->apm_data_len, apm->apm_entry);
#endif
#if NAPM > 0
{
struct bios_attach_args ba;
- ba.apm_detail = BIOS_vars.bios_apm_detail;
- ba.apm_code32_base = BIOS_vars.bios_apm_code32_base;
- ba.apm_code16_base = BIOS_vars.bios_apm_code16_base;
- ba.apm_code_len = BIOS_vars.bios_apm_code_len;
- ba.apm_data_base = BIOS_vars.bios_apm_data_base;
- ba.apm_data_len = BIOS_vars.bios_apm_data_len;
- ba.apm_entry = BIOS_vars.bios_apm_entry;
+ ba.bios_apmp = apm;
ba.bios_dev = "apm";
+ ba.bios_func = 0x15;
config_found(self, &ba, bios_print);
}
#endif
@@ -216,7 +204,8 @@ bios_print(aux, pnp)
struct bios_attach_args *ba = aux;
if (pnp)
- printf("%s at %s", ba->bios_dev, pnp);
+ printf("%s at %s function 0x%x",
+ ba->bios_dev, pnp, ba->bios_func);
return (UNCONF);
}
@@ -281,7 +270,7 @@ bioscnprobe(cn)
{
#if 0
bios_init(I386_BUS_SPACE_MEM); /* XXX */
- if (!bios_initted)
+ if (!bios_cd.cd_ndevs)
return;
if (0 && bios_call(BOOTC_CHECK, NULL))
@@ -331,20 +320,31 @@ bios_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
size_t newlen;
struct proc *p;
{
- extern u_int cnvmem, extmem, bootapiver; /* locore.s */
+ extern u_int cnvmem, extmem; /* locore.s */
+ bios_diskinfo_t *pdi;
+ int biosdev;
/* all sysctl names at this level are terminal */
- if (namelen != 1)
+ if (namelen != 1 && name[0] != BIOS_DISKINFO)
return (ENOTDIR); /* overloaded */
- if (bootapiver == 0)
- return EOPNOTSUPP;
-
switch (name[0]) {
case BIOS_DEV:
- return sysctl_rdint(oldp, oldlenp, newp, BIOS_vars.bios_dev);
- case BIOS_GEOMETRY:
- return sysctl_rdint(oldp, oldlenp, newp, BIOS_vars.bios_geometry);
+ if (bootapiver < BOOT_APIVER)
+ return EOPNOTSUPP;
+ if ((pdi = bios_getdiskinfo(bootdev)) == NULL)
+ return ENXIO;
+ biosdev = pdi->bios_number;
+ return sysctl_rdint(oldp, oldlenp, newp, biosdev);
+ case BIOS_DISKINFO:
+ if (namelen != 2)
+ return ENOTDIR;
+ if (bootapiver < BOOT_APIVER)
+ return EOPNOTSUPP;
+ if ((pdi = bios_getdiskinfo(name[1])) == NULL)
+ return ENXIO;
+ return sysctl_rdstruct(oldp, oldlenp, newp,
+ pdi, sizeof(*bios_diskinfo));
case BIOS_CNVMEM:
return sysctl_rdint(oldp, oldlenp, newp, cnvmem);
case BIOS_EXTMEM:
@@ -354,3 +354,26 @@ bios_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
}
/* NOTREACHED */
}
+
+bios_diskinfo_t *
+bios_getdiskinfo(dev)
+ dev_t dev;
+{
+ bios_diskinfo_t *pdi;
+
+ for (pdi = bios_diskinfo; pdi->bios_number != -1; pdi++) {
+ if ((dev & B_MAGICMASK) == B_DEVMAGIC) { /* search by bootdev */
+ if (pdi->bsd_dev == dev)
+ break;
+ } else {
+ if (pdi->bios_number == dev)
+ break;
+ }
+ }
+
+ if (pdi->bios_number == -1)
+ return NULL;
+ else
+ return pdi;
+}
+
diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s
index 46e2a9e2fb4..fda7798ef74 100644
--- a/sys/arch/i386/i386/locore.s
+++ b/sys/arch/i386/i386/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.35 1997/10/19 06:34:22 mickey Exp $ */
+/* $OpenBSD: locore.s,v 1.36 1997/10/22 23:37:12 mickey Exp $ */
/* $NetBSD: locore.s,v 1.145 1996/05/03 19:41:19 christos Exp $ */
/*-
@@ -43,7 +43,6 @@
#include "npx.h"
#include "assym.h"
#include "apm.h"
-#include "bios.h"
#include "pctr.h"
#include <sys/errno.h>
@@ -154,10 +153,9 @@
.globl _cpu,_cpu_vendor,_cold,_cnvmem,_extmem,_esym
.globl _boothowto,_bootdev,_atdevbase
- .globl _bootapiver,_proc0paddr,_curpcb,_PTDpaddr,_dynamic_gdt
-#if NBIOS > 0
- .globl _BIOS_vars
-#endif
+ .globl _proc0paddr,_curpcb,_PTDpaddr,_dynamic_gdt
+ .globl _bootapiver, _bootargc, _bootargv
+
_cpu: .long 0 # are we 386, 386sx, 486, 586 or 686
_cpu_vendor: .space 16 # vendor string returned by `cpuid' instruction
_cold: .long 1 # cold till we are not
@@ -165,7 +163,9 @@ _esym: .long 0 # ptr to end of syms
_cnvmem: .long 0 # conventional memory size
_extmem: .long 0 # extended memory size
_atdevbase: .long 0 # location of start of iomem in virtual
-_bootapiver: .long 0
+_bootapiver: .long 0 # /boot API version
+_bootargc: .long 0 # /boot argc
+_bootargv: .long 0 # /boot argv
_proc0paddr: .long 0
_PTDpaddr: .long 0 # paddr of PTD, for libkvm
@@ -203,16 +203,10 @@ start: movw $0x1234,0x472 # warm boot
movl 12(%esp),%eax
movl %eax,RELOC(_bootapiver)
-#if NBIOS > 0
- orl %eax, %eax
- jz 1f /* old boots */
- movl 28(%esp), %esi
- movl $RELOC(_BIOS_vars), %edi
- movl 32(%esp), %ecx
- cld
- rep; movsb
-1:
-#endif /* NBIOS */
+ movl 28(%esp), %eax
+ movl %eax, RELOC(_bootargc)
+ movl 32(%esp), %eax
+ movl %eax, RELOC(_bootargv)
/* First, reset the PSL. */
pushl $PSL_MBO
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 96b4fd6e49e..bd014daa3f0 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.55 1997/10/02 14:30:04 downsj Exp $ */
+/* $OpenBSD: machdep.c,v 1.56 1997/10/22 23:37:12 mickey Exp $ */
/* $NetBSD: machdep.c,v 1.202 1996/05/18 15:54:59 christos Exp $ */
/*-
@@ -1239,10 +1239,12 @@ init386(first_avail)
* extent map. This is done before the addresses are
* page rounded just to make sure we get them all.
*/
+#if 0
if (extent_alloc_region(iomem_ex, 0, IOM_BEGIN, EX_NOWAIT)) {
/* XXX What should we do? */
printf("WARNING: CAN'T ALLOCATE BASE RAM FROM IOMEM EXTENT MAP!\n");
}
+#endif
avail_end = biosextmem ? IOM_END + biosextmem * 1024
: biosbasemem * 1024; /* just temporary use */
diff --git a/sys/arch/i386/include/biosvar.h b/sys/arch/i386/include/biosvar.h
index d4ea9e94c01..b125b18c165 100644
--- a/sys/arch/i386/include/biosvar.h
+++ b/sys/arch/i386/include/biosvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: biosvar.h,v 1.20 1997/10/20 14:47:41 mickey Exp $ */
+/* $OpenBSD: biosvar.h,v 1.21 1997/10/22 23:37:13 mickey Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -35,12 +35,7 @@
#ifndef _I386_BIOSVAR_H_
#define _I386_BIOSVAR_H_
-#define BOOT_APIVER 0x00000001
-
-#define BIOSNHEADS(d) (((d)>>24)+1)
-#define BIOSNSECTS(d) ((d)&0x3f) /* sectors are 1-based */
-#define BIOSNDRIVES(d) ((((d)>>16)&0x0f)+1)
-#define BIOSNTRACKS(d) (( (((d)>>8)&0xff) | (((d)&0xc0)<<2) ) +1)
+#define BOOT_APIVER 0x00000002
/* BIOS media ID */
#define BIOSM_F320K 0xff /* floppy ds/sd 8 spt */
@@ -59,7 +54,7 @@
*/
#define BIOS_MAP_END 0x00 /* End of array XXX - special */
#define BIOS_MAP_FREE 0x01 /* Usable memory */
-#define BIOS_MAP_RES 0x02 /* Reseved memory */
+#define BIOS_MAP_RES 0x02 /* Reserved memory */
#define BIOS_MAP_ACPI 0x03 /* ACPI Reclaim memory */
#define BIOS_MAP_NVS 0x04 /* ACPI NVS memory */
@@ -67,7 +62,7 @@
* CTL_BIOS definitions.
*/
#define BIOS_DEV 1 /* int: BIOS boot device */
-#define BIOS_GEOMETRY 2 /* int: BIOS boot device geometry */
+#define BIOS_DISKINFO 2 /* struct: BIOS boot device info */
#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 */
@@ -75,55 +70,12 @@
#define CTL_BIOS_NAMES { \
{ 0, 0 }, \
{ "biosdev", CTLTYPE_INT }, \
- { "biosgeo", CTLTYPE_INT }, \
+ { "diskinfo", CTLTYPE_STRUCT }, \
{ "cnvmem", CTLTYPE_INT }, \
{ "extmem", CTLTYPE_INT }, \
}
-#if defined(_KERNEL) || defined (_STANDALONE)
-
-#ifdef _LOCORE
-#define DOINT(n) int $0x20+(n)
-#else
-#define DOINT(n) "int $0x20+(" #n ")"
-
-extern struct BIOS_vars {
- /* XXX filled in assumption that last file opened is kernel */
- int bios_dev;
- u_int bios_geometry;
-
- /* APM_CONNECT returned values */
- u_int bios_apm_detail;
- u_int bios_apm_code32_base;
- u_int bios_apm_code16_base;
- u_int bios_apm_code_len;
- u_int bios_apm_data_base;
- u_int bios_apm_data_len;
- u_int bios_apm_entry;
-
- void *boot_data;
-} BIOS_vars;
-
-extern struct BIOS_regs {
- u_int32_t biosr_ax;
- u_int32_t biosr_cx;
- u_int32_t biosr_dx;
- u_int32_t biosr_bx;
- u_int32_t biosr_bp;
- u_int32_t biosr_si;
- u_int32_t biosr_di;
- u_int32_t biosr_ds;
- u_int32_t biosr_es;
-} BIOS_regs;
-
-struct EDD_CB {
- u_int8_t edd_len; /* size of packet */
- u_int8_t edd_res; /* reserved */
- u_int16_t edd_nblk; /* # of blocks to transfer */
- u_int32_t edd_buf; /* address of buffer */
- u_int64_t edd_daddr; /* starting block */
-};
-
+#define BOOTARG_MEMMAP 0
typedef struct _bios_memmap {
u_int64_t addr; /* Beginning of block */
u_int64_t size; /* Size of block */
@@ -138,53 +90,73 @@ typedef struct _bios_memmap {
* of a dependance on BIOSN*() macros having to be the same
* across /boot, /bsd, and userland.
*/
+#define BOOTARG_DISKINFO 1
typedef struct _bios_diskinfo {
/* BIOS section */
- signed int bios_number; /* BIOS number of drive (or -1) */
- unsigned int bios_cylinders; /* BIOS cylinders */
- unsigned int bios_heads; /* BIOS heads */
- unsigned int bios_sectors; /* BIOS sectors */
+ int bios_number; /* BIOS number of drive (or -1) */
+ u_int bios_cylinders; /* BIOS cylinders */
+ u_int bios_heads; /* BIOS heads */
+ u_int bios_sectors; /* BIOS sectors */
+ int bios_edd; /* EDD support */
/* BSD section */
- dev_t bsd_dev; /* BSD device */
+ dev_t bsd_dev; /* BSD device */
/* Checksum section */
- u_int32_t checksum; /* Checksum for drive */
- unsigned int checklen; /* Number of sectors done */
+ u_int32_t checksum; /* Checksum for drive */
+ u_int checklen; /* Number of sectors done */
+
} bios_diskinfo_t;
+#define BOOTARG_APMINFO 2
+typedef struct _bios_apminfo {
+ /* APM_CONNECT returned values */
+ u_int apm_detail;
+ u_int apm_code32_base;
+ u_int apm_code16_base;
+ u_int apm_code_len;
+ u_int apm_data_base;
+ u_int apm_data_len;
+ u_int apm_entry;
+} bios_apminfo_t;
+
+#if defined(_KERNEL) || defined (_STANDALONE)
+
+#ifdef _LOCORE
+#define DOINT(n) int $0x20+(n)
+#else
+#define DOINT(n) "int $0x20+(" #n ")"
+
+extern struct BIOS_regs {
+ u_int32_t biosr_ax;
+ u_int32_t biosr_cx;
+ u_int32_t biosr_dx;
+ u_int32_t biosr_bx;
+ u_int32_t biosr_bp;
+ u_int32_t biosr_si;
+ u_int32_t biosr_di;
+ u_int32_t biosr_ds;
+ u_int32_t biosr_es;
+} BIOS_regs;
#ifdef _KERNEL
#include <machine/bus.h>
struct bios_attach_args {
char *bios_dev;
+ u_int bios_func;
union {
struct {
bus_space_tag_t _bios_iot;
bus_space_tag_t _bios_memt;
} bios;
- struct {
- u_int _apm_detail;
- u_int _apm_code32_base;
- u_int _apm_code16_base;
- u_int _apm_code_len;
- u_int _apm_data_base;
- u_int _apm_data_len;
- u_int _apm_entry;
- } apm;
+ bios_apminfo_t *_bios_apmp;
} _;
};
#define bios_iot _.bios._bios_iot
#define bios_memt _.bios._bios_memt
-#define apm_detail _.apm._apm_detail
-#define apm_code32_base _.apm._apm_code32_base
-#define apm_code16_base _.apm._apm_code16_base
-#define apm_code_len _.apm._apm_code_len
-#define apm_data_base _.apm._apm_data_base
-#define apm_data_len _.apm._apm_data_len
-#define apm_entry _.apm._apm_entry
+#define bios_apmp _._bios_apmp
struct consdev;
struct proc;