summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-04-18 19:22:24 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-04-18 19:22:24 +0000
commit88c1a45c7766cdc0921e9b16235fd3f48bcb81ac (patch)
treeb760019e8b5055218e7d290b64bc0308b182efc7
parentb66a90f056a003d62a99e7d226a0dc078f155cd7 (diff)
Merge of NetBSD 960317
-rw-r--r--sys/arch/i386/include/ansi.h2
-rw-r--r--sys/arch/i386/include/bus.h95
-rw-r--r--sys/arch/i386/include/disklabel.h7
-rw-r--r--sys/arch/i386/include/gdt.h39
-rw-r--r--sys/arch/i386/include/param.h11
-rw-r--r--sys/arch/i386/include/pio.h2
-rw-r--r--sys/arch/i386/include/vm86.h2
-rw-r--r--sys/arch/i386/pci/pci_machdep.c77
-rw-r--r--sys/arch/i386/pci/pci_machdep.h23
9 files changed, 189 insertions, 69 deletions
diff --git a/sys/arch/i386/include/ansi.h b/sys/arch/i386/include/ansi.h
index 40efacc18e9..a0998d57569 100644
--- a/sys/arch/i386/include/ansi.h
+++ b/sys/arch/i386/include/ansi.h
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
diff --git a/sys/arch/i386/include/bus.h b/sys/arch/i386/include/bus.h
new file mode 100644
index 00000000000..fcf4e90771b
--- /dev/null
+++ b/sys/arch/i386/include/bus.h
@@ -0,0 +1,95 @@
+/* $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_ */
diff --git a/sys/arch/i386/include/disklabel.h b/sys/arch/i386/include/disklabel.h
index 979cca54ce7..04ba88fe4e6 100644
--- a/sys/arch/i386/include/disklabel.h
+++ b/sys/arch/i386/include/disklabel.h
@@ -1,4 +1,5 @@
-/* $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
@@ -59,6 +60,10 @@ struct dos_partition {
/* 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 {
diff --git a/sys/arch/i386/include/gdt.h b/sys/arch/i386/include/gdt.h
index 88d6d777430..ebb8d5b0d57 100644
--- a/sys/arch/i386/include/gdt.h
+++ b/sys/arch/i386/include/gdt.h
@@ -1,3 +1,42 @@
+/* $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));
diff --git a/sys/arch/i386/include/param.h b/sys/arch/i386/include/param.h
index a18a047cb29..7fdea524187 100644
--- a/sys/arch/i386/include/param.h
+++ b/sys/arch/i386/include/param.h
@@ -1,4 +1,5 @@
-/* $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.
@@ -50,9 +51,11 @@
#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
diff --git a/sys/arch/i386/include/pio.h b/sys/arch/i386/include/pio.h
index d3614747cc9..b712e3afaeb 100644
--- a/sys/arch/i386/include/pio.h
+++ b/sys/arch/i386/include/pio.h
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
diff --git a/sys/arch/i386/include/vm86.h b/sys/arch/i386/include/vm86.h
index a996017ceba..67a584be27e 100644
--- a/sys/arch/i386/include/vm86.h
+++ b/sys/arch/i386/include/vm86.h
@@ -1,4 +1,4 @@
-/* $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
diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c
index b84cf3c2083..b05b5be8385 100644
--- a/sys/arch/i386/pci/pci_machdep.c
+++ b/sys/arch/i386/pci/pci_machdep.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -60,49 +60,6 @@
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
@@ -272,15 +229,15 @@ pci_map_io(tag, reg, iobasep)
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;
@@ -297,7 +254,7 @@ pci_map_mem(tag, reg, vap, pap)
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");
/*
@@ -315,23 +272,23 @@ pci_map_mem(tag, reg, vap, pap)
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;
@@ -355,7 +312,7 @@ pci_map_mem(tag, reg, vap, pap)
#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,
diff --git a/sys/arch/i386/pci/pci_machdep.h b/sys/arch/i386/pci/pci_machdep.h
index 56708780ab6..43adfb2dfcb 100644
--- a/sys/arch/i386/pci/pci_machdep.h
+++ b/sys/arch/i386/pci/pci_machdep.h
@@ -1,4 +1,5 @@
-/* $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.
@@ -60,5 +61,25 @@ typedef union {
*/
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));