diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-04-18 19:18:14 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-04-18 19:18:14 +0000 |
commit | b66a90f056a003d62a99e7d226a0dc078f155cd7 (patch) | |
tree | 743f96905d525d7b247472ccf3a348f5f30c2263 | |
parent | 4104c84a022b28c96373b5f6844b39e0d092672b (diff) |
Merge of NetBSD 960317
-rw-r--r-- | sys/arch/i386/i386/autoconf.c | 9 | ||||
-rw-r--r-- | sys/arch/i386/i386/conf.c | 10 | ||||
-rw-r--r-- | sys/arch/i386/i386/db_interface.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/disksubr.c | 23 | ||||
-rw-r--r-- | sys/arch/i386/i386/gdt.c | 69 | ||||
-rw-r--r-- | sys/arch/i386/i386/linux_machdep.c | 2 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 82 | ||||
-rw-r--r-- | sys/arch/i386/i386/mainbus.c | 132 | ||||
-rw-r--r-- | sys/arch/i386/i386/swapgeneric.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/vm86.c | 2 |
10 files changed, 283 insertions, 54 deletions
diff --git a/sys/arch/i386/i386/autoconf.c b/sys/arch/i386/i386/autoconf.c index 7b124bdbf72..75af163fe99 100644 --- a/sys/arch/i386/i386/autoconf.c +++ b/sys/arch/i386/i386/autoconf.c @@ -1,5 +1,5 @@ -/* $OpenBSD: autoconf.c,v 1.6 1996/04/18 03:57:59 mickey Exp $ */ -/* $NetBSD: autoconf.c,v 1.14 1995/12/28 19:16:48 thorpej Exp $ */ +/* $OpenBSD: autoconf.c,v 1.7 1996/04/18 19:18:05 niklas Exp $ */ +/* $NetBSD: autoconf.c,v 1.18 1996/03/04 03:26:18 cgd Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -78,9 +78,8 @@ configure() startrtclock(); - config_rootfound("isa", NULL); - config_rootfound("eisa", NULL); - config_rootfound("pci", NULL); + if (config_rootfound("mainbus", NULL) == NULL) + panic("configure: mainbus not configured"); printf("biomask %x netmask %x ttymask %x\n", (u_short)imask[IPL_BIO], (u_short)imask[IPL_NET], diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c index 179a571219d..6ddda4d7f19 100644 --- a/sys/arch/i386/i386/conf.c +++ b/sys/arch/i386/i386/conf.c @@ -1,4 +1,5 @@ -/* $NetBSD: conf.c,v 1.68 1995/12/09 05:53:00 mycroft Exp $ */ +/* $OpenBSD: conf.c,v 1.11 1996/04/18 19:18:06 niklas Exp $ */ +/* $NetBSD: conf.c,v 1.71 1996/03/14 21:27:33 christos Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -126,12 +127,11 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]); /* open, close, read, ioctl */ #define cdev_ss_init(c,n) { \ - dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ + dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ (dev_type_stop((*))) enodev, 0, seltrue, \ (dev_type_mmap((*))) enodev } - cdev_decl(cn); cdev_decl(ctty); #define mmread mmrw @@ -166,7 +166,7 @@ cdev_decl(cd); cdev_decl(lpt); #include "ch.h" cdev_decl(ch); -dev_decl(fd,open); +dev_decl(filedesc,open); #include "bpfilter.h" cdev_decl(bpf); #include "pcmciabus.h" @@ -233,7 +233,7 @@ struct cdevsw cdevsw[] = cdev_ss_init(NSS,ss), /* 19: SCSI scanner */ cdev_notdef(), /* 20 */ cdev_notdef(), /* 21 */ - cdev_fd_init(1,fd), /* 22: file descriptor pseudo-device */ + cdev_fd_init(1,filedesc), /* 22: file descriptor pseudo-device */ cdev_bpftun_init(NBPFILTER,bpf),/* 23: Berkeley packet filter */ cdev_notdef(), /* 24 */ cdev_joy_init(NJOY,joy), /* 25: Game adapter */ diff --git a/sys/arch/i386/i386/db_interface.c b/sys/arch/i386/i386/db_interface.c index 60e3e293f3a..237fcbceaec 100644 --- a/sys/arch/i386/i386/db_interface.c +++ b/sys/arch/i386/i386/db_interface.c @@ -1,5 +1,5 @@ -/* $OpenBSD: db_interface.c,v 1.3 1996/04/17 05:18:50 mickey Exp $ */ -/* $NetBSD: db_interface.c,v 1.18 1995/10/10 04:45:03 mycroft Exp $ */ +/* $OpenBSD: db_interface.c,v 1.4 1996/04/18 19:18:06 niklas Exp $ */ +/* $NetBSD: db_interface.c,v 1.20 1996/03/15 00:07:18 chuck Exp $ */ /* * Mach Operating System diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index 7eca5476878..93330cccc01 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,5 @@ -/* $NetBSD: disksubr.c,v 1.18 1995/01/13 10:30:08 mycroft Exp $ */ +/* $OpenBSD: disksubr.c,v 1.2 1996/04/18 19:18:07 niklas Exp $ */ +/* $NetBSD: disksubr.c,v 1.19 1996/03/09 20:52:59 ghudson Exp $ */ /* * Copyright (c) 1982, 1986, 1988 Regents of the University of California. @@ -43,6 +44,9 @@ #define b_cylin b_resid +int fat_types[] = { DOSPTYP_FAT12, DOSPTYP_FAT16S, + DOSPTYP_FAT16B, DOSPTYP_FAT16C, -1 }; + /* * Attempt to read a disk label from a device * using the indicated stategy routine. @@ -66,11 +70,12 @@ readdisklabel(dev, strat, lp, osdep) struct cpu_disklabel *osdep; { struct dos_partition *dp = osdep->dosparts; + struct partition *pp; struct dkbad *bdp = &osdep->bad; struct buf *bp; struct disklabel *dlp; char *msg = NULL; - int dospartoff, cyl, i; + int dospartoff, cyl, i, *ip; /* minimal requirements for archtypal disk label */ if (lp->d_secsize == 0) @@ -109,7 +114,16 @@ readdisklabel(dev, strat, lp, osdep) /* XXX how do we check veracity/bounds of this? */ bcopy(bp->b_data + DOSPARTOFF, dp, NDOSPART * sizeof(*dp)); - for (i = 0; i < NDOSPART; i++, dp++) + for (i = 0; i < NDOSPART; i++, dp++) { + /* Install in partition e, f, g, or h. */ + pp = &lp->d_partitions[RAW_PART + 1 + i]; + pp->p_offset = dp->dp_start; + pp->p_size = dp->dp_size; + for (ip = fat_types; *ip != -1; ip++) { + if (dp->dp_typ == *ip) + pp->p_fstype = FS_MSDOS; + } + /* is this ours? */ if (dp->dp_size && dp->dp_typ == DOSPTYP_386BSD && dospartoff == 0) { @@ -128,8 +142,9 @@ readdisklabel(dev, strat, lp, osdep) lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors; } + } + lp->d_npartitions = RAW_PART + 1 + i; } - } /* next, dig out disk label */ diff --git a/sys/arch/i386/i386/gdt.c b/sys/arch/i386/i386/gdt.c index f856603c5f5..a511ab550b7 100644 --- a/sys/arch/i386/i386/gdt.c +++ b/sys/arch/i386/i386/gdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gdt.c,v 1.6 1996/04/17 05:18:52 mickey Exp $ */ +/* $OpenBSD: gdt.c,v 1.7 1996/04/18 19:18:08 niklas Exp $ */ /* $NetBSD: gdt.c,v 1.7 1996/02/27 22:45:01 jtc Exp $ */ /*- @@ -47,7 +47,7 @@ #include <machine/gdt.h> -#define GDTSTART 64 +#define MINGDTSIZ 512 #define MAXGDTSIZ 8192 union descriptor *dynamic_gdt = gdt; @@ -147,30 +147,49 @@ gdt_compact() * Grow or shrink the GDT. */ void -gdt_resize(newsize) - int newsize; +gdt_init() { - size_t old_len, new_len; - union descriptor *old_gdt, *new_gdt; + size_t max_len, min_len; struct region_descriptor region; - old_len = gdt_size * sizeof(union descriptor); - old_gdt = dynamic_gdt; - gdt_size = newsize; - new_len = gdt_size * sizeof(union descriptor); - new_gdt = (union descriptor *)kmem_alloc(kernel_map, new_len); - if (new_len > old_len) { - bcopy(old_gdt, new_gdt, old_len); - bzero((caddr_t)new_gdt + old_len, new_len - old_len); - } else - bcopy(old_gdt, new_gdt, new_len); - dynamic_gdt = new_gdt; - - setregion(®ion, new_gdt, new_len - 1); + max_len = MAXGDTSIZ * sizeof(union descriptor); + min_len = MINGDTSIZ * sizeof(union descriptor); + gdt_size = MINGDTSIZ; + + dynamic_gdt = (union descriptor *)kmem_alloc_pageable(kernel_map, + max_len); + vm_map_pageable(kernel_map, (vm_offset_t)dynamic_gdt, + (vm_offset_t)dynamic_gdt + min_len, FALSE); + bcopy(gdt, dynamic_gdt, NGDT * sizeof(union descriptor)); + + setregion(®ion, dynamic_gdt, max_len - 1); lgdt(®ion); +} + +void +gdt_grow() +{ + size_t old_len, new_len; + + old_len = gdt_size * sizeof(union descriptor); + gdt_size <<= 1; + new_len = old_len << 1; + + vm_map_pageable(kernel_map, (vm_offset_t)dynamic_gdt + old_len, + (vm_offset_t)dynamic_gdt + new_len, FALSE); +} + +void +gdt_shrink() +{ + size_t old_len, new_len; + + old_len = gdt_size * sizeof(union descriptor); + gdt_size >>= 1; + new_len = old_len >> 1; - if (old_gdt != gdt) - kmem_free(kernel_map, (vm_offset_t)old_gdt, old_len); + vm_map_pageable(kernel_map, (vm_offset_t)dynamic_gdt + new_len, + (vm_offset_t)dynamic_gdt + old_len, TRUE); } /* @@ -198,9 +217,9 @@ gdt_get_slot() if (gdt_size >= MAXGDTSIZ) panic("gdt_get_slot botch 2"); if (dynamic_gdt == gdt) - gdt_resize(GDTSTART); + gdt_init(); else - gdt_resize(gdt_size * 2); + gdt_grow(); } slot = gdt_next++; } @@ -228,9 +247,9 @@ gdt_put_slot(slot) * almost 2x as many processes as are now running without * having to grow the GDT. */ - if (gdt_size > GDTSTART && gdt_count < gdt_size / 4) { + if (gdt_size > MINGDTSIZ && gdt_count <= gdt_size / 4) { gdt_compact(); - gdt_resize(gdt_size / 2); + gdt_shrink(); } else { dynamic_gdt[slot].gd.gd_selector = gdt_free; gdt_free = slot; diff --git a/sys/arch/i386/i386/linux_machdep.c b/sys/arch/i386/i386/linux_machdep.c index b01926463ab..77614ab9b46 100644 --- a/sys/arch/i386/i386/linux_machdep.c +++ b/sys/arch/i386/i386/linux_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_machdep.c,v 1.4 1996/04/17 05:18:53 mickey Exp $ */ +/* $OpenBSD: linux_machdep.c,v 1.5 1996/04/18 19:18:09 niklas Exp $ */ /* $NetBSD: linux_machdep.c,v 1.26 1996/04/11 07:47:45 mycroft Exp $ */ /* diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 0013f07539b..f0afbdc07e3 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,5 +1,5 @@ -/* $OpenBSD: machdep.c,v 1.11 1996/04/18 04:19:49 mickey Exp $ */ -/* $NetBSD: machdep.c,v 1.191 1996/03/01 21:49:49 scottr Exp $ */ +/* $OpenBSD: machdep.c,v 1.12 1996/04/18 19:18:11 niklas Exp $ */ +/* $NetBSD: machdep.c,v 1.194 1996/03/08 20:19:48 cgd Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -413,6 +413,7 @@ identifycpu() #endif #ifndef I586_CPU case CPUCLASS_586: + printf("NOTICE: this kernel does not support Pentium CPU class\n"); #ifdef I486_CPU printf("NOTICE: lowering CPU class to i486\n"); cpu_class = CPUCLASS_486; @@ -421,6 +422,7 @@ identifycpu() #endif #ifndef I486_CPU case CPUCLASS_486: + printf("NOTICE: this kernel does not support i486 CPU class\n"); #ifdef I386_CPU printf("NOTICE: lowering CPU class to i386\n"); cpu_class = CPUCLASS_386; @@ -429,7 +431,8 @@ identifycpu() #endif #ifndef I386_CPU case CPUCLASS_386: - panic("CPU class not configured"); + printf("NOTICE: this kernel does not support i386 CPU class\n"); + panic("no appropriate CPU class available"); #endif default: break; @@ -703,8 +706,9 @@ boot(howto) howto |= RB_HALT; goto haltsys; } + boothowto = howto; - if ((howto&RB_NOSYNC) == 0 && waittime < 0) { + if ((howto & RB_NOSYNC) == 0 && waittime < 0) { waittime = 0; vfs_shutdown(); /* @@ -713,21 +717,24 @@ boot(howto) */ resettodr(); } + + /* Disable interrupts. */ splhigh(); + + /* Do a dump if requested. */ + if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) + dumpsys(); + haltsys: doshutdownhooks(); + if (howto & RB_HALT) { printf("\n"); printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cngetc(); - } else { - if (howto & RB_DUMP) { - savectx(&dumppcb, 0); - dumppcb.pcb_cr3 = rcr3(); - dumpsys(); - } } + printf("rebooting...\n"); cpu_reset(); for(;;) ; @@ -805,6 +812,9 @@ dumpsys() int error = 0; int c; + /* Save registers. */ + savectx(&dumppcb); + msgbufmapped = 0; /* don't record dump msgs in msgbuf */ if (dumpdev == NODEV) return; @@ -1106,11 +1116,19 @@ init386(first_avail) /* * Use BIOS values stored in RTC CMOS RAM, since probing * breaks certain 386 AT relics. + * + * XXX Not only does probing break certain 386 AT relics, but + * not all BIOSes (Dell, Compaq, others) report the correct + * amount of extended memory. */ biosbasemem = (mc146818_read(NULL, NVRAM_BASEHI) << 8) | mc146818_read(NULL, NVRAM_BASELO); +#ifdef EXTMEM_SIZE + biosextmem = EXTMEM_SIZE; +#else biosextmem = (mc146818_read(NULL, NVRAM_EXTHI) << 8) | mc146818_read(NULL, NVRAM_EXTLO); +#endif /* EXTMEM_SIZE */ /* Round down to whole pages. */ biosbasemem &= -(NBPG / 1024); @@ -1409,3 +1427,47 @@ cpu_reset() for (;;); } + +int +bus_mem_map(t, bpa, size, cacheable, mhp) + bus_chipset_tag_t t; + bus_mem_addr_t bpa; + bus_mem_size_t size; + int cacheable; + bus_mem_handle_t *mhp; +{ + u_long pa, endpa; + vm_offset_t va; + + pa = i386_trunc_page(bpa); + endpa = i386_round_page(bpa + size); + + va = kmem_alloc_pageable(kernel_map, endpa - pa); + if (va == 0) + return (1); + *mhp = (caddr_t)(va + (bpa & PGOFSET)); + + for (; pa < endpa; pa += NBPG, va += NBPG) { + pmap_enter(pmap_kernel(), va, pa, VM_PROT_READ | VM_PROT_WRITE, + TRUE); + if (!cacheable) + pmap_changebit(pa, PG_N, ~0); + else + pmap_changebit(pa, 0, ~PG_N); + } + + return 0; +} + +void +bus_mem_unmap(t, memh, size) + bus_chipset_tag_t t; + bus_mem_handle_t memh; + bus_mem_size_t size; +{ + vm_offset_t va, endva; + + va = i386_trunc_page(memh); + endva = i386_round_page(memh); + kmem_free(kmem_map, va, endva - va); +} diff --git a/sys/arch/i386/i386/mainbus.c b/sys/arch/i386/i386/mainbus.c new file mode 100644 index 00000000000..e1a844230f4 --- /dev/null +++ b/sys/arch/i386/i386/mainbus.c @@ -0,0 +1,132 @@ +/* $OpenBSD: mainbus.c,v 1.1 1996/04/18 19:18:11 niklas Exp $ */ +/* $NetBSD: mainbus.c,v 1.4 1996/03/14 02:37:28 cgd Exp $ */ + +/* + * Copyright (c) 1996 Christopher G. Demetriou. 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou + * for the NetBSD Project. + * 4. 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. + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/device.h> + +#include <machine/bus.h> + +#if 0 /* XXX eisavar.h includes isavar.h, which is not idempotent */ +#include <dev/isa/isavar.h> +#endif +#include <dev/eisa/eisavar.h> +#include <dev/pci/pcivar.h> + +#include <dev/isa/isareg.h> +#include <i386/isa/isa_machdep.h> +#include <i386/eisa/eisa_machdep.h> + +#include "pci.h" + +int mainbus_match __P((struct device *, void *, void *)); +void mainbus_attach __P((struct device *, struct device *, void *)); + +struct cfdriver mainbuscd = + { NULL, "mainbus", mainbus_match, mainbus_attach, + DV_DULL, sizeof(struct device) }; + +int mainbus_print __P((void *, char *)); + +union mainbus_attach_args { + const char *mba_busname; /* first elem of all */ + struct pcibus_attach_args mba_pba; + struct eisabus_attach_args mba_eba; + struct isabus_attach_args mba_iba; +}; + +/* + * Probe for the mainbus; always succeeds. + */ +int +mainbus_match(parent, match, aux) + struct device *parent; + void *match, *aux; +{ + + return 1; +} + +/* + * Attach the mainbus. + */ +void +mainbus_attach(parent, self, aux) + struct device *parent, *self; + void *aux; +{ + union mainbus_attach_args mba; + + printf("\n"); + + /* + * XXX Note also that the presence of a PCI bus should + * XXX _always_ be checked, and if present the bus should be + * XXX 'found'. However, because of the structure of the code, + * XXX that's not currently possible. + */ +#if NPCI > 0 + if (pci_mode_detect() != 0) { + mba.mba_pba.pba_busname = "pci"; + mba.mba_pba.pba_bc = NULL; + mba.mba_pba.pba_bus = 0; + config_found(self, &mba.mba_pba, mainbus_print); + } +#endif + + if (!bcmp(ISA_HOLE_VADDR(EISA_ID_PADDR), EISA_ID, EISA_ID_LEN)) { + mba.mba_eba.eba_busname = "eisa"; + mba.mba_eba.eba_bc = NULL; + config_found(self, &mba.mba_eba, mainbus_print); + } + + if (1 /* XXX ISA NOT YET SEEN */) { + mba.mba_iba.iba_busname = "isa"; + mba.mba_iba.iba_bc = NULL; + config_found(self, &mba.mba_iba, mainbus_print); + } +} + +int +mainbus_print(aux, pnp) + void *aux; + char *pnp; +{ + union mainbus_attach_args *mba = aux; + + if (pnp) + printf("%s at %s", mba->mba_busname, pnp); + if (!strcmp(mba->mba_busname, "pci")) + printf(" bus %d", mba->mba_pba.pba_bus); + return (UNCONF); +} diff --git a/sys/arch/i386/i386/swapgeneric.c b/sys/arch/i386/i386/swapgeneric.c index 67bd58e2c2a..b67fcd7742a 100644 --- a/sys/arch/i386/i386/swapgeneric.c +++ b/sys/arch/i386/i386/swapgeneric.c @@ -1,4 +1,4 @@ -/* $OpenBSD: swapgeneric.c,v 1.2 1996/04/17 05:18:58 mickey Exp $ */ +/* $OpenBSD: swapgeneric.c,v 1.3 1996/04/18 19:18:12 niklas Exp $ */ /* $NetBSD: swapgeneric.c,v 1.9 1994/11/04 09:57:52 mycroft Exp $ */ /*- @@ -55,6 +55,8 @@ #include "cd.h" #include "mcd.h" +void gets __P((char *)); + /* * Generic configuration; all in one */ diff --git a/sys/arch/i386/i386/vm86.c b/sys/arch/i386/i386/vm86.c index a6c558ceff0..5e254490af6 100644 --- a/sys/arch/i386/i386/vm86.c +++ b/sys/arch/i386/i386/vm86.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm86.c,v 1.2 1996/04/17 05:18:59 mickey Exp $ */ +/* $OpenBSD: vm86.c,v 1.3 1996/04/18 19:18:13 niklas Exp $ */ /* $NetBSD: vm86.c,v 1.8 1996/04/11 10:07:17 mycroft Exp $ */ /*- |