diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1999-10-26 18:16:49 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1999-10-26 18:16:49 +0000 |
commit | c8d20d07ed395d9276b87ddb1ab57d931cb582a1 (patch) | |
tree | 1aff1a65414789b6ba40ec60f9d43437c82634e8 | |
parent | e352ea149e63509c593d024f5363a979a6807fe5 (diff) |
modify bootapiver chekups to use bitwise operations.
factor out /boot options parser from biosattach().
add logic to warn about ancient /boots.
cleanup vanishing cruft.
@niklas ok
-rw-r--r-- | sys/arch/i386/i386/bios.c | 100 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 7 | ||||
-rw-r--r-- | sys/arch/i386/include/biosvar.h | 6 |
3 files changed, 69 insertions, 44 deletions
diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c index e530b419064..370ec5685c7 100644 --- a/sys/arch/i386/i386/bios.c +++ b/sys/arch/i386/i386/bios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bios.c,v 1.24 1999/08/25 00:54:18 mickey Exp $ */ +/* $OpenBSD: bios.c,v 1.25 1999/10/26 18:16:48 mickey Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -81,10 +81,14 @@ struct cfdriver bios_cd = { extern dev_t bootdev; +#if NAPM > 0 +bios_apminfo_t *apm; +#endif #if NPCI > 0 -bios_pciinfo_t *bios_pciinfo = NULL; +bios_pciinfo_t *bios_pciinfo; #endif -bios_diskinfo_t *bios_diskinfo = NULL; +bios_diskinfo_t *bios_diskinfo; +bios_memmap_t *bios_memmap; u_int32_t bios_cksumlen; bios_diskinfo_t *bios_getdiskinfo __P((dev_t)); @@ -105,7 +109,7 @@ biosprobe(parent, match, aux) if (bios_cd.cd_ndevs || strcmp(bia->bios_dev, bios_cd.cd_name)) return 0; - if (bootapiver < BOOTARG_APIVER || bootargp == NULL ) + if (!(bootapiver & BAPIV_VECTOR) || bootargp == NULL ) return 0; return 1; @@ -116,16 +120,12 @@ biosattach(parent, self, aux) struct device *parent, *self; void *aux; { - struct bios_softc *sc = (void *) self; + /* struct bios_softc *sc = (void *) self; */ #if NAPM > 0 struct bios_attach_args *bia = aux; #endif -#if NAPM > 0 || defined(DEBUG) - bios_apminfo_t *apm = NULL; -#endif u_int8_t *va = ISA_HOLE_VADDR(0xffff0); char *str; - bootarg_t *q; switch (va[14]) { default: @@ -141,24 +141,65 @@ biosattach(parent, self, aux) printf(": %s(%02x) BIOS, date %c%c/%c%c/%c%c\n", str, va[15], va[5], va[6], va[8], va[9], va[11], va[12]); - printf("%s:", sc->sc_dev.dv_xname); +#if NAPM > 0 + if (apm) { + struct bios_attach_args ba; +#if defined(DEBUG) || defined(APMDEBUG) + printf("apminfo: %x, code %x[%x]/%x[%x], data %x[%x], ept %x\n", + apm->apm_detail, + apm->apm_code32_base, apm->apm_code_len, + apm->apm_code16_base, apm->apm_code16_len, + apm->apm_data_base, apm->apm_data_len, apm->apm_entry); +#endif + ba.bios_dev = "apm"; + ba.bios_func = 0x15; + ba.bios_memt = bia->bios_memt; + ba.bios_iot = bia->bios_iot; + ba.bios_apmp = apm; + config_found(self, &ba, bios_print); + } +#endif +} + +void +bios_getopt() +{ + bootarg_t *q; + + printf("bootargv:"); for(q = bootargp; 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 %p", q->ba_arg); + bios_memmap = (bios_memmap_t *)q->ba_arg; + if (bootapiver & BAPIV_BMEMMAP) + printf(" memmap %p", bios_memmap); + else { + register bios_memmap_t *p; + printf(" omemmap %p", bios_memmap); + /* + * older /boots passed memmap in Kbytes, + * which is very inconvinient from the + * point of view of memory management + */ + for (p = bios_memmap; + p->type != BIOS_MAP_END; p++) { + p->addr /= 1024; + p->size *= 1024; + } + } break; case BOOTARG_DISKINFO: bios_diskinfo = (bios_diskinfo_t *)q->ba_arg; printf(" diskinfo %p", bios_diskinfo); break; +#if NAPM > 0 || defined(DEBUG) case BOOTARG_APMINFO: printf(" apminfo %p", q->ba_arg); -#if NAPM > 0 || defined(DEBUG) apm = (bios_apminfo_t *)q->ba_arg; -#endif break; +#endif case BOOTARG_CKSUMLEN: bios_cksumlen = *(u_int32_t *)q->ba_arg; printf(" cksumlen %d", bios_cksumlen); @@ -169,6 +210,10 @@ biosattach(parent, self, aux) printf(" pciinfo %p", bios_pciinfo); break; #endif + case BOOTARG_CONSDEV: + cnset(*(dev_t *)q->ba_arg); + break; + default: printf(" unsupported arg (%d) %p", q->ba_type, q->ba_arg); @@ -176,23 +221,6 @@ biosattach(parent, self, aux) } printf("\n"); -#if NAPM > 0 - if (apm) { - struct bios_attach_args ba; -#if defined(DEBUG) || defined(APMDEBUG) - printf("apminfo: %x, code %x/%x[%x], data %x[%x], entry %x\n", - 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 - ba.bios_dev = "apm"; - ba.bios_func = 0x15; - ba.bios_memt = bia->bios_memt; - ba.bios_iot = bia->bios_iot; - ba.bios_apmp = apm; - config_found(self, &ba, bios_print); - } -#endif } int @@ -319,7 +347,6 @@ bios_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) size_t newlen; struct proc *p; { - extern u_int cnvmem, extmem; /* locore.s */ bios_diskinfo_t *pdi; int biosdev; @@ -327,10 +354,11 @@ bios_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) if (namelen != 1 && name[0] != BIOS_DISKINFO) return (ENOTDIR); /* overloaded */ + if (!(bootapiver & BAPIV_VECTOR)) + return EOPNOTSUPP; + switch (name[0]) { case BIOS_DEV: - if (bootapiver < BOOTARG_APIVER) - return EOPNOTSUPP; if ((pdi = bios_getdiskinfo(bootdev)) == NULL) return ENXIO; biosdev = pdi->bios_number; @@ -338,15 +366,9 @@ bios_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) case BIOS_DISKINFO: if (namelen != 2) return ENOTDIR; - if (bootapiver < BOOTARG_APIVER) - return EOPNOTSUPP; if ((pdi = bios_getdiskinfo(name[1])) == NULL) return ENXIO; return sysctl_rdstruct(oldp, oldlenp, newp, pdi, sizeof(*pdi)); - case BIOS_CNVMEM: - return sysctl_rdint(oldp, oldlenp, newp, cnvmem); - case BIOS_EXTMEM: - return sysctl_rdint(oldp, oldlenp, newp, extmem); case BIOS_CKSUMLEN: return sysctl_rdint(oldp, oldlenp, newp, bios_cksumlen); default: diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index bf70b0e2b18..d559be47fd1 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.115 1999/10/14 20:09:09 niklas Exp $ */ +/* $OpenBSD: machdep.c,v 1.116 1999/10/26 18:16:48 mickey Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -315,15 +315,16 @@ cpu_startup() msgbufmapped = 1; /* Boot arguments are in page 1 */ - if (bootapiver >= 2) { + if (bootapiver & BAPIV_VECTOR) { pa = (vm_offset_t)bootargv; for (i = 0; i < btoc(bootargc); i++, pa += NBPG) pmap_enter(pmap_kernel(), (vm_offset_t)((caddr_t)bootargp + i * NBPG), pa, VM_PROT_READ|VM_PROT_WRITE, TRUE, VM_PROT_READ|VM_PROT_WRITE); + bios_getopt(); } else - bootargp = NULL; + panic("/boot is too old: upgrade"); printf(version); startrtclock(); diff --git a/sys/arch/i386/include/biosvar.h b/sys/arch/i386/include/biosvar.h index 1779fe843f9..3e5ad2aa693 100644 --- a/sys/arch/i386/include/biosvar.h +++ b/sys/arch/i386/include/biosvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: biosvar.h,v 1.30 1999/08/25 00:54:18 mickey Exp $ */ +/* $OpenBSD: biosvar.h,v 1.31 1999/10/26 18:16:47 mickey Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -190,8 +190,10 @@ void bioscninit __P((struct consdev *)); void bioscnputc __P((dev_t, int)); int bioscngetc __P((dev_t)); void bioscnpollc __P((dev_t, int)); +void bios_getopt __P((void)); -extern u_int bootapiver; +extern u_int bootapiver; +extern bios_memmap_t *bios_memmap; #endif /* _KERNEL */ #endif /* _LOCORE */ |