-/* $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.
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],
-/* $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.
/* 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
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"
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 */
-/* $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
-/* $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.
#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.
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)
/* 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) {
lp->d_secpercyl =
lp->d_ntracks * lp->d_nsectors;
}
+ }
+ lp->d_npartitions = RAW_PART + 1 + i;
}
-
}
/* next, dig out disk label */
-/* $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 $ */
/*-
#include <machine/gdt.h>
-#define GDTSTART 64
+#define MINGDTSIZ 512
#define MAXGDTSIZ 8192
union descriptor *dynamic_gdt = gdt;
* 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);
}
/*
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++;
}
* 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;
-/* $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 $ */
/*
-/* $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.
#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;
#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;
#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;
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();
/*
*/
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(;;) ;
int error = 0;
int c;
+ /* Save registers. */
+ savectx(&dumppcb);
+
msgbufmapped = 0; /* don't record dump msgs in msgbuf */
if (dumpdev == NODEV)
return;
/*
* 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);
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);
+}
--- /dev/null
+/* $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);
+}
-/* $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 $ */
/*-
#include "cd.h"
#include "mcd.h"
+void gets __P((char *));
+
/*
* Generic configuration; all in one
*/
-/* $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 $ */
/*-
-/* $OpenBSD: ansi.h,v 1.2 1996/04/17 05:19:01 mickey Exp $ */
+/* $OpenBSD: ansi.h,v 1.3 1996/04/18 19:21:31 niklas Exp $ */
/* $NetBSD: ansi.h,v 1.6 1996/03/16 01:31:50 jtc Exp $ */
/*-
--- /dev/null
+/* $OpenBSD: bus.h,v 1.1 1996/04/18 19:21:33 niklas Exp $ */
+/* $NetBSD: bus.h,v 1.1 1996/03/08 20:11:23 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.
+ */
+
+#ifndef _I386_BUS_H_
+#define _I386_BUS_H_
+
+#include <machine/pio.h>
+
+/*
+ * I/O addresses (in bus space)
+ */
+typedef u_long bus_io_addr_t;
+typedef u_long bus_io_size_t;
+
+/*
+ * Memory addresses (in bus space)
+ */
+typedef u_long bus_mem_addr_t;
+typedef u_long bus_mem_size_t;
+
+/*
+ * Access methods for bus resources, I/O space, and memory space.
+ */
+typedef void *bus_chipset_tag_t;
+typedef u_long bus_io_handle_t;
+typedef caddr_t bus_mem_handle_t;
+
+#define bus_io_map(t, port, size, iohp) \
+ (*iohp = port, 0)
+#define bus_io_unmap(t, ioh, size)
+
+#define bus_io_read_1(t, h, o) inb((h) + (o))
+#define bus_io_read_2(t, h, o) inw((h) + (o))
+#define bus_io_read_4(t, h, o) inl((h) + (o))
+#if 0 /* Cause a link error for bus_io_read_8 */
+#define bus_io_read_8(t, h, o) !!! bus_io_read_8 unimplemented !!!
+#endif
+
+#define bus_io_write_1(t, h, o, v) outb((h) + (o), (v))
+#define bus_io_write_2(t, h, o, v) outw((h) + (o), (v))
+#define bus_io_write_4(t, h, o, v) outl((h) + (o), (v))
+#if 0 /* Cause a link error for bus_io_write_8 */
+#define bus_io_write_8(t, h, o, v) !!! bus_io_write_8 unimplemented !!!
+#endif
+
+int bus_mem_map __P((bus_chipset_tag_t t, bus_mem_addr_t bpa,
+ bus_mem_size_t size, int cacheable, bus_mem_handle_t *mhp));
+void bus_mem_unmap __P((bus_chipset_tag_t t, bus_mem_handle_t memh,
+ bus_mem_size_t size));
+
+#define bus_mem_read_1(t, h, o) (*(volatile u_int8_t *)((h) + (o)))
+#define bus_mem_read_2(t, h, o) (*(volatile u_int16_t *)((h) + (o)))
+#define bus_mem_read_4(t, h, o) (*(volatile u_int32_t *)((h) + (o)))
+#define bus_mem_read_8(t, h, o) (*(volatile u_int64_t *)((h) + (o)))
+
+#define bus_mem_write_1(t, h, o, v) \
+ ((void)(*(volatile u_int8_t *)((h) + (o)) = (v)))
+#define bus_mem_write_2(t, h, o, v) \
+ ((void)(*(volatile u_int16_t *)((h) + (o)) = (v)))
+#define bus_mem_write_4(t, h, o, v) \
+ ((void)(*(volatile u_int32_t *)((h) + (o)) = (v)))
+#define bus_mem_write_8(t, h, o, v) \
+ ((void)(*(volatile u_int64_t *)((h) + (o)) = (v)))
+
+#endif /* _I386_BUS_H_ */
-/* $NetBSD: disklabel.h,v 1.2 1995/03/28 18:16:51 jtc Exp $ */
+/* $OpenBSD: disklabel.h,v 1.2 1996/04/18 19:21:36 niklas Exp $ */
+/* $NetBSD: disklabel.h,v 1.3 1996/03/09 20:52:54 ghudson Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
/* Known DOS partition types. */
#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */
#define DOSPTYP_NETBSD DOSPTYP_386BSD /* NetBSD partition type (XXX) */
+#define DOSPTYP_FAT12 0x1 /* 12-bit FAT */
+#define DOSPTYP_FAT16S 0x4 /* 16-bit FAT, less than 32M */
+#define DOSPTYP_FAT16B 0x6 /* 16-bit FAT, more than 32M */
+#define DOSPTYP_FAT16C 0xe /* 16-bit FAT, CHS-mapped */
#include <sys/dkbad.h>
struct cpu_disklabel {
+/* $OpenBSD: gdt.h,v 1.2 1996/04/18 19:21:37 niklas Exp $ */
+/* $NetBSD: gdt.h,v 1.3 1996/02/27 22:32:11 jtc Exp $ */
+
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by John T. Kohl and Charles M. Hannum.
+ *
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
void tss_alloc __P((struct pcb *));
void tss_free __P((struct pcb *));
void ldt_alloc __P((struct pcb *, union descriptor *, size_t));
-/* $NetBSD: param.h,v 1.27 1996/02/01 22:30:47 mycroft Exp $ */
+/* $OpenBSD: param.h,v 1.3 1996/04/18 19:21:38 niklas Exp $ */
+/* $NetBSD: param.h,v 1.29 1996/03/04 05:04:26 cgd Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
#endif
#endif
-#define MACHINE "i386"
-#define MACHINE_ARCH "i386"
-#define MID_MACHINE MID_I386
+#define _MACHINE i386
+#define MACHINE "i386"
+#define _MACHINE_ARCH i386
+#define MACHINE_ARCH "i386"
+#define MID_MACHINE MID_I386
/*
* Round p (pointer or byte index) up to a correctly-aligned value
-/* $OpenBSD: pio.h,v 1.3 1996/04/17 05:19:03 mickey Exp $ */
+/* $OpenBSD: pio.h,v 1.4 1996/04/18 19:21:40 niklas Exp $ */
/* $NetBSD: pio.h,v 1.13 1996/03/08 20:15:23 cgd Exp $ */
/*
-/* $OpenBSD: vm86.h,v 1.2 1996/04/17 05:19:04 mickey Exp $ */
+/* $OpenBSD: vm86.h,v 1.3 1996/04/18 19:21:42 niklas Exp $ */
/* $NetBSD: vm86.h,v 1.4 1996/04/11 10:07:25 mycroft Exp $ */
#define VM86_USE_VIF
-/* $NetBSD: pci_machdep.c,v 1.18 1995/12/24 02:30:34 mycroft Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.20 1996/03/04 19:39:31 cgd Exp $ */
/*
* Copyright (c) 1994 Charles Hannum. All rights reserved.
int pci_mode = -1;
-int pcimatch __P((struct device *, void *, void *));
-void pciattach __P((struct device *, struct device *, void *));
-
-struct cfdriver pcicd = {
- NULL, "pci", pcimatch, pciattach, DV_DULL, sizeof(struct device)
-};
-
-int
-pcimatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
-
- if (pci_mode_detect() == 0)
- return 0;
- return 1;
-}
-
-void
-pciattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- int bus, device;
-
- printf(": configuration mode %d\n", pci_mode);
-
-#if 0
- for (bus = 0; bus <= 255; bus++)
-#else
- /*
- * XXX
- * Some current chipsets do wacky things with bus numbers > 0.
- * This seems like a violation of protocol, but the PCI BIOS does
- * allow one to query the maximum bus number, and eventually we
- * should do so.
- */
- for (bus = 0; bus <= 0; bus++)
-#endif
- for (device = 0; device <= (pci_mode == 2 ? 15 : 31); device++)
- pci_attach_subdev(self, bus, device);
-}
-
#define PCI_MODE1_ENABLE 0x80000000UL
#define PCI_MODE1_ADDRESS_REG 0x0cf8
#define PCI_MODE1_DATA_REG 0x0cfc
pcireg_t address;
int iobase;
- if (reg < PCI_MAP_REG_START || reg >= PCI_MAP_REG_END || (reg & 3))
+ if (reg < PCI_MAPREG_START || reg >= PCI_MAPREG_END || (reg & 3))
panic("pci_map_io: bad request");
address = pci_conf_read(tag, reg);
- if ((address & PCI_MAP_IO) == 0)
- panic("pci_map_io: attempt to I/O map a memory region");
+ if (PCI_MAPREG_TYPE(address) != PCI_MAPREG_TYPE_IO)
+ panic("pci_map_io: not an I/O mapping register");
- iobase = address & PCI_MAP_IO_ADDRESS_MASK;
+ iobase = PCI_MAPREG_IO_ADDR(address);
*iobasep = iobase;
return 0;
vm_size_t size;
vm_offset_t va, pa;
- if (reg < PCI_MAP_REG_START || reg >= PCI_MAP_REG_END || (reg & 3))
+ if (reg < PCI_MAPREG_START || reg >= PCI_MAPREG_END || (reg & 3))
panic("pci_map_mem: bad request");
/*
mask = pci_conf_read(tag, reg);
pci_conf_write(tag, reg, address);
- if ((address & PCI_MAP_IO) != 0)
- panic("pci_map_mem: attempt to memory map an I/O region");
+ if (PCI_MAPREG_TYPE(address) == PCI_MAPREG_TYPE_IO)
+ panic("pci_map_mem: I/O mapping register");
- switch (address & PCI_MAP_MEMORY_TYPE_MASK) {
- case PCI_MAP_MEMORY_TYPE_32BIT:
- case PCI_MAP_MEMORY_TYPE_32BIT_1M:
+ switch (address & PCI_MAPREG_MEM_TYPE_MASK) {
+ case PCI_MAPREG_MEM_TYPE_32BIT:
+ case PCI_MAPREG_MEM_TYPE_32BIT_1M:
break;
- case PCI_MAP_MEMORY_TYPE_64BIT:
- printf("pci_map_mem: attempt to map 64-bit region\n");
+ case PCI_MAPREG_MEM_TYPE_64BIT:
+ printf("pci_map_mem: 64-bit memory mapping register\n");
return EOPNOTSUPP;
default:
- printf("pci_map_mem: reserved mapping type\n");
+ printf("pci_map_mem: reserved mapping register type\n");
return EINVAL;
}
- pa = address & PCI_MAP_MEMORY_ADDRESS_MASK;
- size = -(mask & PCI_MAP_MEMORY_ADDRESS_MASK);
+ pa = PCI_MAPREG_MEM_ADDR(address);
+ size = ~PCI_MAPREG_MEM_ADDR(mask) + 1;
if (size < NBPG)
size = NBPG;
#endif
/* Map the space into the kernel page table. */
- cachable = !!(address & PCI_MAP_MEMORY_CACHABLE);
+ cachable = PCI_MAPREG_MEM_CACHEABLE(address);
pa &= ~PGOFSET;
while (size) {
pmap_enter(pmap_kernel(), va, pa, VM_PROT_READ | VM_PROT_WRITE,
-/* $NetBSD: pci_machdep.h,v 1.3 1995/04/17 12:08:00 cgd Exp $ */
+/* $OpenBSD: pci_machdep.h,v 1.2 1996/04/18 19:22:23 niklas Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.4 1996/03/14 02:37:59 cgd Exp $ */
/*
* Copyright (c) 1994 Charles Hannum. All rights reserved.
*/
typedef u_int32_t pcireg_t;
+/*
+ * PCs which use Configuration Mechanism #2 are limited to 16
+ * devices per bus.
+ */
+#define PCI_MAX_DEVICE_NUMBER (pci_mode == 2 ? 16 : 32)
+
+/*
+ * Hook for PCI bus attach function to do any necessary machine-specific
+ * operations.
+ */
+
+#define pci_md_attach_hook(parent, sc, pba) \
+ do { \
+ if (pba->pba_bus == 0) \
+ printf(": configuration mode %d", pci_mode); \
+ } while (0);
+
+/*
+ * Miscellaneous variables and functions.
+ */
extern int pci_mode;
extern int pci_mode_detect __P((void));