summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/conf/DISKLESS7
-rw-r--r--sys/arch/i386/conf/GENERIC13
-rw-r--r--sys/arch/i386/conf/GENERICADP10
-rw-r--r--sys/arch/i386/conf/GENERICOTHER13
-rw-r--r--sys/arch/i386/conf/INSTADP5
-rw-r--r--sys/arch/i386/conf/INSTOTHER7
-rw-r--r--sys/arch/i386/conf/TDR7
-rw-r--r--sys/arch/i386/conf/files.i38659
-rw-r--r--sys/arch/i386/eisa/eisa_machdep.c126
-rw-r--r--sys/arch/i386/eisa/eisa_machdep.h32
-rw-r--r--sys/arch/i386/i386/autoconf.c8
-rw-r--r--sys/arch/i386/i386/conf.c31
-rw-r--r--sys/arch/i386/i386/db_interface.c39
-rw-r--r--sys/arch/i386/i386/disksubr.c6
-rw-r--r--sys/arch/i386/i386/freebsd_machdep.c6
-rw-r--r--sys/arch/i386/i386/genassym.c117
-rw-r--r--sys/arch/i386/i386/linux_machdep.c6
-rw-r--r--sys/arch/i386/i386/locore.s4
-rw-r--r--sys/arch/i386/i386/machdep.c15
-rw-r--r--sys/arch/i386/i386/mainbus.c44
-rw-r--r--sys/arch/i386/i386/pmap.c5
-rw-r--r--sys/arch/i386/i386/pmap.old.c5
-rw-r--r--sys/arch/i386/i386/process_machdep.c9
-rw-r--r--sys/arch/i386/i386/rd_root.c79
-rw-r--r--sys/arch/i386/i386/svr4_machdep.c17
-rw-r--r--sys/arch/i386/i386/swapgeneric.c28
-rw-r--r--sys/arch/i386/i386/trap.c12
-rw-r--r--sys/arch/i386/i386/vm86.c27
-rw-r--r--sys/arch/i386/i386/vm_machdep.c6
-rw-r--r--sys/arch/i386/include/bus.h26
-rw-r--r--sys/arch/i386/include/cpu.h3
-rw-r--r--sys/arch/i386/include/joystick.h23
-rw-r--r--sys/arch/i386/include/vm86.h17
-rw-r--r--sys/arch/i386/isa/clock.c8
-rw-r--r--sys/arch/i386/isa/fd.c36
-rw-r--r--sys/arch/i386/isa/isa_machdep.c19
-rw-r--r--sys/arch/i386/isa/isa_machdep.h32
-rw-r--r--sys/arch/i386/isa/joy.c265
-rw-r--r--sys/arch/i386/isa/lms.c94
-rw-r--r--sys/arch/i386/isa/mms.c26
-rw-r--r--sys/arch/i386/isa/npx.c14
-rw-r--r--sys/arch/i386/isa/pccons.c41
-rw-r--r--sys/arch/i386/isa/pcvt/Etc/ttys.pcvt.netbsd20
-rw-r--r--sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c4
-rw-r--r--sys/arch/i386/isa/pcvt/Util/kbdio/Makefile1
-rw-r--r--sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.42
-rw-r--r--sys/arch/i386/isa/pcvt/Util/vgaio/Makefile1
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_drv.c14
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_hdr.h12
-rw-r--r--sys/arch/i386/isa/pms.c29
-rw-r--r--sys/arch/i386/isa/spkr.c12
-rw-r--r--sys/arch/i386/pci/pci_compat.c128
-rw-r--r--sys/arch/i386/pci/pci_machdep.c231
-rw-r--r--sys/arch/i386/pci/pci_machdep.h70
54 files changed, 1326 insertions, 545 deletions
diff --git a/sys/arch/i386/conf/DISKLESS b/sys/arch/i386/conf/DISKLESS
index e33317a4a10..1c962680077 100644
--- a/sys/arch/i386/conf/DISKLESS
+++ b/sys/arch/i386/conf/DISKLESS
@@ -1,5 +1,5 @@
-# $OpenBSD: DISKLESS,v 1.3 1996/04/18 18:55:32 niklas Exp $
-# $NetBSD: DISKLESS,v 1.21 1996/03/16 06:09:02 thorpej Exp $
+# $OpenBSD: DISKLESS,v 1.4 1996/04/21 22:16:04 deraadt Exp $
+# $NetBSD: DISKLESS,v 1.23 1996/03/25 05:45:14 perry Exp $
#
# DISKLESS -- Generic machine setup for diskless boot.
# This kernel can be loaded from a bootable floppy (i.e. kernel-copy)
@@ -42,6 +42,7 @@ options SYSVSHM # System V-like memory sharing
options COMPAT_NOMID # compatibility with 386BSD, BSDI, NetBSD 0.8,
options COMPAT_09 # NetBSD 0.9,
options COMPAT_10 # NetBSD 1.0,
+options COMPAT_11 # NetBSD 1.1,
options COMPAT_43 # and 4.3BSD
options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
@@ -160,7 +161,7 @@ ie0 at isa? port 0x360 iomem 0xd0000 irq 7 # StarLAN & 3C507 ethernet cards
#le0 at isa? port 0x320 irq 10 drq 7 # IsoLan, NE2100, and DEPCA
sb0 at isa? port 0x220 irq 7 drq 1 # SoundBlaster
-#spkr0 at isa? port 0x61
+#spkr0 at pckbd? port 0x61
pseudo-device loop 1 # network loopback
pseudo-device bpfilter 8 # packet filter
diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC
index 1a6fcd88231..1f42d656732 100644
--- a/sys/arch/i386/conf/GENERIC
+++ b/sys/arch/i386/conf/GENERIC
@@ -1,5 +1,5 @@
-# $OpenBSD: GENERIC,v 1.7 1996/04/18 18:55:33 niklas Exp $
-# $NetBSD: GENERIC,v 1.36 1996/03/16 06:09:03 thorpej Exp $
+# $OpenBSD: GENERIC,v 1.8 1996/04/21 22:16:06 deraadt Exp $
+# $NetBSD: GENERIC,v 1.40 1996/03/30 23:57:09 perry Exp $
#
# GENERIC -- everything that's currently supported
#
@@ -42,6 +42,7 @@ options SYSVSHM # System V-like memory sharing
options COMPAT_NOMID # compatibility with 386BSD, BSDI, NetBSD 0.8,
options COMPAT_09 # NetBSD 0.9,
options COMPAT_10 # NetBSD 1.0,
+options COMPAT_11 # NetBSD 1.1,
options COMPAT_43 # and 4.3BSD
options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
@@ -142,6 +143,9 @@ uha0 at isa? port 0x330 irq ? drq ? # UltraStor [13]4f SCSI controllers
uha1 at isa? port 0x334 irq ? drq ? # UltraStor [13]4f SCSI controllers
uha2 at isa? port ? irq ? # UltraStor 24f SCSI controllers
scsibus* at uha?
+wds0 at isa? port 0x350 irq 15 drq 6 # WD7000 and TMC-7000 controllers
+wds1 at isa? port 0x358 irq 11 drq 5
+scsibus* at wds?
sd* at scsibus? target ? lun ? # SCSI disk drives
st* at scsibus? target ? lun ? # SCSI tape drives
@@ -179,7 +183,10 @@ sb0 at isa? port 0x220 irq 7 drq 1 # SoundBlaster
wss0 at isa? port 0x530 irq 10 drq 0 # Windows Sound System
pas0 at isa? port 0x220 irq 7 drq 1 # ProAudio Spectrum
gus0 at isa? port 0x220 irq 7 drq 1 flags 6 # Gravis Ultra Sound (flags is record drq for full-duplex)
-#spkr0 at isa? port 0x61
+#spkr0 at pckbd? port 0x61
+
+# Joystick driver. Probe is a little strange; add only if you have one.
+#joy0 at isa? port 0x201
pseudo-device loop 1 # network loopback
pseudo-device bpfilter 8 # packet filter
diff --git a/sys/arch/i386/conf/GENERICADP b/sys/arch/i386/conf/GENERICADP
index 2ccbebc4488..d8c61ab9ef8 100644
--- a/sys/arch/i386/conf/GENERICADP
+++ b/sys/arch/i386/conf/GENERICADP
@@ -1,5 +1,5 @@
-# $OpenBSD: GENERICADP,v 1.6 1996/04/18 18:55:34 niklas Exp $
-# $NetBSD: GENERICADP,v 1.3 1995/12/14 01:10:08 tls Exp $
+# $OpenBSD: GENERICADP,v 1.7 1996/04/21 22:16:09 deraadt Exp $
+# $NetBSD: GENERICADP,v 1.16 1996/03/30 23:57:16 perry Exp $
#
# GENERICADP -- everything that's currently supported, except non-
# Adaptec SCSI controllers.
@@ -43,6 +43,7 @@ options SYSVSHM # System V-like memory sharing
options COMPAT_NOMID # compatibility with 386BSD, BSDI, NetBSD 0.8,
options COMPAT_09 # NetBSD 0.9,
options COMPAT_10 # NetBSD 1.0,
+options COMPAT_11 # NetBSD 1.1,
options COMPAT_43 # and 4.3BSD
options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
@@ -168,7 +169,10 @@ sb0 at isa? port 0x220 irq 7 drq 1 # SoundBlaster
wss0 at isa? port 0x530 irq 10 drq 0 # Windows Sound System
pas0 at isa? port 0x220 irq 7 drq 1 # ProAudio Spectrum
gus0 at isa? port 0x220 irq 7 drq 1 flags 6 # Gravis Ultra Sound (flags is record drq for full-duplex)
-#spkr0 at isa? port 0x61
+#spkr0 at pckbd? port 0x61
+
+# Joystick driver. Probe is a little strange; add only if you have one.
+#joy0 at isa? port 0x201
pseudo-device loop 1 # network loopback
pseudo-device bpfilter 8 # packet filter
diff --git a/sys/arch/i386/conf/GENERICOTHER b/sys/arch/i386/conf/GENERICOTHER
index 23cdc09b36e..5fc6586b9d0 100644
--- a/sys/arch/i386/conf/GENERICOTHER
+++ b/sys/arch/i386/conf/GENERICOTHER
@@ -1,5 +1,5 @@
-# $OpenBSD: GENERICOTHER,v 1.5 1996/04/18 18:55:34 niklas Exp $
-# $NetBSD: GENERICOTHER,v 1.3 1995/12/14 01:10:10 tls Exp $
+# $OpenBSD: GENERICOTHER,v 1.6 1996/04/21 22:16:11 deraadt Exp $
+# $NetBSD: GENERICOTHER,v 1.16 1996/03/30 23:57:19 perry Exp $
#
# GENERICOTHER -- everything that's currently supported, except
# Adaptec SCSI controllers.
@@ -43,6 +43,7 @@ options SYSVSHM # System V-like memory sharing
options COMPAT_NOMID # compatibility with 386BSD, BSDI, NetBSD 0.8,
options COMPAT_09 # NetBSD 0.9,
options COMPAT_10 # NetBSD 1.0,
+options COMPAT_11 # NetBSD 1.1,
options COMPAT_43 # and 4.3BSD
options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
@@ -132,6 +133,9 @@ uha0 at isa? port 0x330 irq ? drq ? # UltraStor [13]4f SCSI controllers
uha1 at isa? port 0x334 irq ? drq ? # UltraStor [13]4f SCSI controllers
uha2 at isa? port ? irq ? # UltraStor 24f SCSI controllers
scsibus* at uha?
+wds0 at isa? port 0x350 irq 15 drq 6 # WD7000 and TMC-7000 controllers
+wds1 at isa? port 0x358 irq 11 drq 5
+scsibus* at wds?
sd* at scsibus? target ? lun ? # SCSI disk drives
st* at scsibus? target ? lun ? # SCSI tape drives
@@ -169,7 +173,10 @@ sb0 at isa? port 0x220 irq 7 drq 1 # SoundBlaster
wss0 at isa? port 0x530 irq 10 drq 0 # Windows Sound System
pas0 at isa? port 0x220 irq 7 drq 1 # ProAudio Spectrum
gus0 at isa? port 0x220 irq 7 drq 1 flags 6 # Gravis Ultra Sound (flags is record drq for full-duplex)
-#spkr0 at isa? port 0x61
+#spkr0 at pckbd? port 0x61
+
+# Joystick driver. Probe is a little strange; add only if you have one.
+#joy0 at isa? port 0x201
pseudo-device loop 1 # network loopback
pseudo-device bpfilter 8 # packet filter
diff --git a/sys/arch/i386/conf/INSTADP b/sys/arch/i386/conf/INSTADP
index 18c608e335d..45d7f76dc9b 100644
--- a/sys/arch/i386/conf/INSTADP
+++ b/sys/arch/i386/conf/INSTADP
@@ -1,5 +1,5 @@
-# $OpenBSD: INSTADP,v 1.5 1996/04/18 18:55:36 niklas Exp $
-# $NetBSD: INSTADP,v 1.3 1995/12/14 01:10:12 tls Exp $
+# $OpenBSD: INSTADP,v 1.6 1996/04/21 22:16:12 deraadt Exp $
+# $NetBSD: INSTADP,v 1.11 1996/03/25 05:45:28 perry Exp $
#
# INSTADP -- like GENERICADP. This supports only Adaptec SCSI
# adapters. This kernel is GENERICADP with lines
@@ -34,6 +34,7 @@ options DEVPAGER # mmap() of devices
#makeoptions DEBUG="-g" # compile full symbol table
options COMPAT_10 # NetBSD 1.0,
+options COMPAT_11 # NetBSD 1.1,
options LKM # loadable kernel modules
diff --git a/sys/arch/i386/conf/INSTOTHER b/sys/arch/i386/conf/INSTOTHER
index 8790f156fdc..48c7d44477c 100644
--- a/sys/arch/i386/conf/INSTOTHER
+++ b/sys/arch/i386/conf/INSTOTHER
@@ -1,4 +1,5 @@
-# $NetBSD: INSTOTHER,v 1.3 1995/12/14 01:10:15 tls Exp $
+# $OpenBSD: INSTOTHER,v 1.4 1996/04/21 22:16:14 deraadt Exp $
+# $NetBSD: INSTOTHER,v 1.11 1996/03/30 05:42:59 mycroft Exp $
#
# INSTOTHER -- like GENERICOTHER. This supports only non-Adaptec SCSI
# adapters. This kernel is GENERICOTHER with lines
@@ -30,6 +31,7 @@ options DIAGNOSTIC # internally consistency checks
options KTRACE # system call tracing, a la ktrace(1)
options COMPAT_10 # NetBSD 1.0,
+options COMPAT_11 # NetBSD 1.1,
options LKM # loadable kernel modules
@@ -85,6 +87,9 @@ uha0 at isa? port 0x330 irq ? drq ? # UltraStor [13]4f SCSI controllers
uha1 at isa? port 0x334 irq ? drq ? # UltraStor [13]4f SCSI controllers
uha2 at isa? port ? irq ? # UltraStor 24f SCSI controllers
scsibus* at uha?
+wds0 at isa? port 0x350 irq 15 drq 6 # WD7000 and TMC-7000 controllers
+wds1 at isa? port 0x358 irq 11 drq 5
+scsibus* at wds?
sd* at scsibus? target ? lun ? # SCSI disk drives
st* at scsibus? target ? lun ? # SCSI tape drives
diff --git a/sys/arch/i386/conf/TDR b/sys/arch/i386/conf/TDR
index 5669612bf6a..8f4d23c4243 100644
--- a/sys/arch/i386/conf/TDR
+++ b/sys/arch/i386/conf/TDR
@@ -1,5 +1,5 @@
-# $OpenBSD: TDR,v 1.5 1996/04/18 18:55:37 niklas Exp $
-# $NetBSD: TDR,v 1.62 1996/03/16 06:09:12 thorpej Exp $
+# $OpenBSD: TDR,v 1.6 1996/04/21 22:16:14 deraadt Exp $
+# $NetBSD: TDR,v 1.64 1996/03/25 05:45:49 perry Exp $
#
# TDR -- Theo Deraadt's 486
#
@@ -40,6 +40,7 @@ options KTRACE # system call tracing, a la ktrace(1)
options COMPAT_NOMID # compatibility with 386BSD, BSDI, NetBSD 0.8,
options COMPAT_09 # NetBSD 0.9,
options COMPAT_10 # NetBSD 1.0,
+options COMPAT_11 # NetBSD 1.1,
options COMPAT_43 # and 4.3BSD
options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
@@ -161,7 +162,7 @@ ep2 at isa? port ? irq ?
#le0 at isa? port 0x320 irq 10 drq 7 # IsoLan, NE2100, and DEPCA
#sb0 at isa? port 0x220 irq 7 drq 1 # SoundBlaster
-#spkr0 at isa? port 0x61
+#spkr0 at pckbd? port 0x61
pseudo-device loop 1 # network loopback
pseudo-device bpfilter 16 # packet filter
diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386
index b0403ebf9bc..fc823632bfd 100644
--- a/sys/arch/i386/conf/files.i386
+++ b/sys/arch/i386/conf/files.i386
@@ -1,5 +1,5 @@
-# $OpenBSD: files.i386,v 1.10 1996/04/19 07:33:39 mickey Exp $
-# $NetBSD: files.i386,v 1.66 1996/03/16 06:09:16 thorpej Exp $
+# $OpenBSD: files.i386,v 1.11 1996/04/21 22:16:15 deraadt Exp $
+# $NetBSD: files.i386,v 1.72 1996/04/09 22:59:03 cgd Exp $
#
# new style config file for i386 architecture
#
@@ -41,11 +41,18 @@ major {sd = 4}
major {st = 5}
major {cd = 6}
+# RAM Disk for install floppy
+pseudo-device rd
+file dev/ramdisk.c rd needs-flag
+file arch/i386/i386/rd_root.c ramdisk_hooks
+major {rd = 17}
+
#
# System bus types
#
-device mainbus at root: isabus, eisabus, pcibus
+device mainbus: isabus, eisabus, pcibus
+attach mainbus at root
file arch/i386/i386/mainbus.c mainbus
#device mca at root {...}
@@ -58,6 +65,7 @@ file arch/i386/i386/mainbus.c mainbus
include "../../../dev/pci/files.pci"
file arch/i386/pci/pci_machdep.c pci
+file arch/i386/pci/pci_compat.c pci # XXX compatibility
#
# ISA and mixed ISA+EISA or ISA+PCI or ISA+PCMCIA drivers
@@ -79,19 +87,22 @@ file arch/i386/isa/isa_machdep.c isabus
file arch/i386/isa/clock.c isabus
# Numeric Processing Extension; Math Co-processor
-device npx at isa
+device npx
+attach npx at isa
file arch/i386/isa/npx.c npx needs-flag
# attribute used to represent the "keyboard controller"
# XXX should be a real device
-define pckbd { [irq = -1], [port = -1] }
+define pckbd { [irq = -1], [port = -1] }
# PC console support a la "pccons"
-device pc at isa: tty, pckbd
+device pc: tty, pckbd
+attach pc at isa
file arch/i386/isa/pccons.c pc needs-flag
# PC console support a la "pcvt"
-device vt at isa: tty, pckbd
+device vt: tty, pckbd
+attach vt at isa
file arch/i386/isa/pcvt/pcvt_drv.c vt needs-flag
file arch/i386/isa/pcvt/pcvt_ext.c vt needs-flag
file arch/i386/isa/pcvt/pcvt_kbd.c vt needs-flag
@@ -100,44 +111,48 @@ file arch/i386/isa/pcvt/pcvt_sup.c vt needs-flag
file arch/i386/isa/pcvt/pcvt_vtf.c vt needs-flag
# PC Mice; Logitech-style, Microsoft-style, and PS/2-style
-device lms at isa
+device lms
+attach lms at isa
file arch/i386/isa/lms.c lms needs-flag
-device mms at isa
+device mms
+attach mms at isa
file arch/i386/isa/mms.c mms needs-flag
-device pms at pckbd
+device pms
+attach pms at pckbd
file arch/i386/isa/pms.c pms needs-flag
# Floppy disk controller
-device fdc at isa {drive = -1}
-device fd at fdc: disk, isadma
+device fdc {drive = -1}
+attach fdc at isa
+device fd: disk, isadma
+attach fd at fdc
file arch/i386/isa/fd.c fdc needs-flag
major {fd = 2}
# PC speaker
-device spkr at pckbd: tty
+device spkr: tty
+attach spkr at pckbd
file arch/i386/isa/spkr.c spkr needs-flag
# AMD am7990 (Lance) -based boards
# (BICC Isolan, NE2100, DEPCA)
# XXX conflicts with other ports; can't be in files.isa
-device le at isa, pci: ether, ifnet, isadma
+device le: ether, ifnet
+attach le at isa with le_isa: isadma
+attach le at pci with le_pci
file dev/isa/if_le.c le
-# National Semiconductor DS8390/WD83C690-based boards
-# (WD/SMC 80x3 family, SMC Ultra [8216], 3Com 3C503, NE[12]000, and clones)
-# XXX conflicts with other ports; can't be in files.isa
-device ed at isa: ether, ifnet
-file dev/isa/if_ed.c ed needs-flag
-
# Game adapter (joystick)
-device joy at isa
-file arch/i386/isa/joy.c joy needs-flag
+device joy
+attach joy at isa
+file arch/i386/isa/joy.c joy needs-flag
#
# EISA-only drivers
#
include "../../../dev/eisa/files.eisa"
+file arch/i386/eisa/eisa_machdep.c eisa
#
# Compatibility modules
diff --git a/sys/arch/i386/eisa/eisa_machdep.c b/sys/arch/i386/eisa/eisa_machdep.c
new file mode 100644
index 00000000000..fd1e28c11a3
--- /dev/null
+++ b/sys/arch/i386/eisa/eisa_machdep.c
@@ -0,0 +1,126 @@
+/* $NetBSD: eisa_machdep.c,v 1.2 1996/04/11 22:15:08 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.
+ */
+
+/*
+ * Machine-specific functions for EISA autoconfiguration.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/systm.h>
+#include <sys/errno.h>
+#include <sys/device.h>
+
+#include <i386/isa/icu.h>
+#include <dev/isa/isavar.h>
+#include <dev/eisa/eisavar.h>
+
+void
+eisa_attach_hook(parent, self, eba)
+ struct device *parent, *self;
+ struct eisabus_attach_args *eba;
+{
+
+ /* Nothing to do */
+}
+
+int
+eisa_maxslots(ec)
+ eisa_chipset_tag_t ec;
+{
+
+ /*
+ * Always try 16 slots.
+ */
+ return (16);
+}
+
+int
+eisa_intr_map(ec, irq, ihp)
+ eisa_chipset_tag_t ec;
+ u_int irq;
+ eisa_intr_handle_t *ihp;
+{
+
+ if (irq >= ICU_LEN) {
+ printf("eisa_intr_map: bad IRQ %d\n", irq);
+ *ihp = -1;
+ return 1;
+ }
+ if (irq == 2) {
+ printf("eisa_intr_map: changed IRQ 2 to IRQ 9\n");
+ irq = 9;
+ }
+
+ *ihp = irq;
+ return 0;
+}
+
+const char *
+eisa_intr_string(ec, ih)
+ eisa_chipset_tag_t ec;
+ eisa_intr_handle_t ih;
+{
+ static char irqstr[8]; /* 4 + 2 + NULL + sanity */
+
+ if (ih == 0 || ih >= ICU_LEN || ih == 2)
+ panic("eisa_intr_string: bogus handle 0x%x\n", ih);
+
+ sprintf(irqstr, "irq %d", ih);
+ return (irqstr);
+
+}
+
+void *
+eisa_intr_establish(ec, ih, type, level, func, arg, what)
+ eisa_chipset_tag_t ec;
+ eisa_intr_handle_t ih;
+ int type, level, (*func) __P((void *));
+ void *arg;
+ char *what;
+{
+
+ if (ih == 0 || ih >= ICU_LEN || ih == 2)
+ panic("eisa_intr_establish: bogus handle 0x%x\n", ih);
+
+ return isa_intr_establish(NULL, ih, type, level, func, arg, what);
+}
+
+void
+eisa_intr_disestablish(ec, cookie)
+ eisa_chipset_tag_t ec;
+ void *cookie;
+{
+
+ return isa_intr_disestablish(NULL, cookie);
+}
diff --git a/sys/arch/i386/eisa/eisa_machdep.h b/sys/arch/i386/eisa/eisa_machdep.h
index e7ba6579fff..2e4f1019e2f 100644
--- a/sys/arch/i386/eisa/eisa_machdep.h
+++ b/sys/arch/i386/eisa/eisa_machdep.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: eisa_machdep.h,v 1.1 1996/04/18 18:56:27 niklas Exp $ */
-/* $NetBSD: eisa_machdep.h,v 1.1 1996/03/04 03:26:14 cgd Exp $ */
+/* $OpenBSD: eisa_machdep.h,v 1.2 1996/04/21 22:16:19 deraadt Exp $ */
+/* $NetBSD: eisa_machdep.h,v 1.2 1996/04/09 23:00:27 cgd Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -32,9 +32,33 @@
*/
/*
- * The "EISA" signature is in the BIOS of EISA systems. We use it
- * to determine whether or not we have an EISA bus.
+ * Machine-specific definitions for EISA autoconfiguration.
+ */
+
+/*
+ * i386-specific EISA definitions.
+ * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
*/
#define EISA_ID "EISA"
#define EISA_ID_LEN (sizeof(EISA_ID) - 1)
#define EISA_ID_PADDR 0xfffd9
+
+/*
+ * Types provided to machine-independent EISA code.
+ */
+typedef void *eisa_chipset_tag_t;
+typedef int eisa_intr_handle_t;
+
+/*
+ * Functions provided to machine-independent EISA code.
+ */
+void eisa_attach_hook __P((struct device *, struct device *,
+ struct eisabus_attach_args *));
+int eisa_maxslots __P((eisa_chipset_tag_t));
+int eisa_intr_map __P((eisa_chipset_tag_t, u_int,
+ eisa_intr_handle_t *));
+const char *eisa_intr_string __P((eisa_chipset_tag_t, eisa_intr_handle_t));
+void *eisa_intr_establish __P((eisa_chipset_tag_t,
+ eisa_intr_handle_t, int, int, int (*)(void *), void *,
+ char *));
+void eisa_intr_disestablish __P((eisa_chipset_tag_t, void *));
diff --git a/sys/arch/i386/i386/autoconf.c b/sys/arch/i386/i386/autoconf.c
index 75af163fe99..0358a729c9f 100644
--- a/sys/arch/i386/i386/autoconf.c
+++ b/sys/arch/i386/i386/autoconf.c
@@ -1,5 +1,5 @@
-/* $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 $ */
+/* $OpenBSD: autoconf.c,v 1.8 1996/04/21 22:16:22 deraadt Exp $ */
+/* $NetBSD: autoconf.c,v 1.19 1996/03/29 01:15:04 mycroft Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -62,6 +62,10 @@
void swapconf __P((void));
void setroot __P((void));
+void setroot __P((void));
+void swapconf __P((void));
+void dumpconf __P((void));
+
/*
* The following several variables are related to
* the configuration process, and are used in initializing
diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c
index 6ddda4d7f19..c56ad7712fd 100644
--- a/sys/arch/i386/i386/conf.c
+++ b/sys/arch/i386/i386/conf.c
@@ -1,5 +1,5 @@
-/* $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 $ */
+/* $OpenBSD: conf.c,v 1.12 1996/04/21 22:16:23 deraadt Exp $ */
+/* $NetBSD: conf.c,v 1.74 1996/03/30 07:30:33 mycroft Exp $ */
/*
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
@@ -69,6 +69,9 @@ bdev_decl(vnd);
bdev_decl(scd);
#include "ccd.h"
bdev_decl(ccd);
+#include "rd.h"
+bdev_decl(rd);
+/* no cdev for rd */
struct bdevsw bdevsw[] =
{
@@ -91,6 +94,7 @@ struct bdevsw bdevsw[] =
bdev_disk_init(NVND,vnd), /* 14: vnode disk driver */
bdev_disk_init(NSCD,scd), /* 15: Sony CD-ROM */
bdev_disk_init(NCCD,ccd), /* 16: concatenated disk driver */
+ bdev_disk_init(NRD,rd), /* 17: ram disk driver */
};
int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
@@ -112,25 +116,13 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
0, seltrue, (dev_type_mmap((*))) enodev }
-/* open, close, ioctl, select -- XXX should be a generic device */
-#define cdev_ocis_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
- (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
- (dev_type_mmap((*))) enodev, 0 }
-
-/* open, close, read, ioctl */
-#define cdev_joy_init(c,n) { \
- 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 }
-
/* 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_type_write((*))) enodev, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, seltrue, \
(dev_type_mmap((*))) enodev }
+#define cdev_joy_init cdev_ss_init
cdev_decl(cn);
cdev_decl(ctty);
@@ -169,8 +161,6 @@ cdev_decl(ch);
dev_decl(filedesc,open);
#include "bpfilter.h"
cdev_decl(bpf);
-#include "pcmciabus.h"
-cdev_decl(pcmciabus);
#include "spkr.h"
cdev_decl(spkr);
#ifdef LKM
@@ -236,8 +226,8 @@ struct cdevsw cdevsw[] =
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 */
- cdev_ocis_init(NPCMCIABUS,pcmciabus), /* 26: PCMCIA Bus */
+ cdev_notdef(), /* 25 */
+ cdev_joy_init(NJOY,joy), /* 26: joystick */
cdev_spkr_init(NSPKR,spkr), /* 27: PC speaker */
cdev_lkm_init(NLKM,lkm), /* 28: loadable module driver */
cdev_lkm_dummy(), /* 29 */
@@ -280,6 +270,7 @@ dev_t swapdev = makedev(1, 0);
/*
* Returns true if dev is /dev/mem or /dev/kmem.
*/
+int
iskmemdev(dev)
dev_t dev;
{
@@ -290,6 +281,7 @@ iskmemdev(dev)
/*
* Returns true if dev is /dev/zero.
*/
+int
iszerodev(dev)
dev_t dev;
{
@@ -355,6 +347,7 @@ static int chrtoblktbl[] = {
/*
* Convert a character device number to a block device number.
*/
+dev_t
chrtoblk(dev)
dev_t dev;
{
diff --git a/sys/arch/i386/i386/db_interface.c b/sys/arch/i386/i386/db_interface.c
index 237fcbceaec..e9d0896da94 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.4 1996/04/18 19:18:06 niklas Exp $ */
-/* $NetBSD: db_interface.c,v 1.20 1996/03/15 00:07:18 chuck Exp $ */
+/* $OpenBSD: db_interface.c,v 1.5 1996/04/21 22:16:24 deraadt Exp $ */
+/* $NetBSD: db_interface.c,v 1.21 1996/03/30 07:57:16 mycroft Exp $ */
/*
* Mach Operating System
@@ -42,12 +42,30 @@
#include <machine/db_machdep.h>
extern label_t *db_recover;
+extern char *trap_type[];
+extern int trap_types;
int db_active = 0;
/*
+ * Print trap reason.
+ */
+void
+kdbprinttrap(type, code)
+ int type, code;
+{
+ db_printf("kernel: ");
+ if (type >= trap_types || type < 0)
+ db_printf("type %d", type);
+ else
+ db_printf("%s", trap_type[type]);
+ db_printf(" trap, code=%x\n", code);
+}
+
+/*
* kdb_trap - field a TRACE or BPT trap
*/
+int
kdb_trap(type, code, regs)
int type, code;
register db_regs_t *regs;
@@ -112,23 +130,6 @@ kdb_trap(type, code, regs)
return (1);
}
-extern char *trap_type[];
-extern int trap_types;
-
-/*
- * Print trap reason.
- */
-kdbprinttrap(type, code)
- int type, code;
-{
- db_printf("kernel: ");
- if (type >= trap_types || type < 0)
- db_printf("type %d", type);
- else
- db_printf("%s", trap_type[type]);
- db_printf(" trap, code=%x\n", code);
-}
-
/*
* Read bytes from kernel address space for debugger.
*/
diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c
index 93330cccc01..e8f8d1677c2 100644
--- a/sys/arch/i386/i386/disksubr.c
+++ b/sys/arch/i386/i386/disksubr.c
@@ -1,5 +1,5 @@
-/* $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 $ */
+/* $OpenBSD: disksubr.c,v 1.3 1996/04/21 22:16:25 deraadt Exp $ */
+/* $NetBSD: disksubr.c,v 1.20 1996/04/03 08:18:27 mycroft Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -223,6 +223,7 @@ done:
* Check new disk label for sensibility
* before setting it.
*/
+int
setdisklabel(olp, nlp, openmask, osdep)
register struct disklabel *olp, *nlp;
u_long openmask;
@@ -279,6 +280,7 @@ setdisklabel(olp, nlp, openmask, osdep)
/*
* Write disk label back to device after modification.
*/
+int
writedisklabel(dev, strat, lp, osdep)
dev_t dev;
void (*strat)();
diff --git a/sys/arch/i386/i386/freebsd_machdep.c b/sys/arch/i386/i386/freebsd_machdep.c
index e70fa8e94eb..8ef49795fa9 100644
--- a/sys/arch/i386/i386/freebsd_machdep.c
+++ b/sys/arch/i386/i386/freebsd_machdep.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: freebsd_machdep.c,v 1.3 1996/04/17 05:18:51 mickey Exp $ */
-/* $NetBSD: freebsd_machdep.c,v 1.7 1996/04/11 07:47:44 mycroft Exp $ */
+/* $OpenBSD: freebsd_machdep.c,v 1.4 1996/04/21 22:16:26 deraadt Exp $ */
+/* $NetBSD: freebsd_machdep.c,v 1.8 1996/04/12 08:44:35 mycroft Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996 Charles M. Hannum. All rights reserved.
@@ -123,7 +123,6 @@ freebsd_sendsig(catcher, sig, mask, code)
frame.sf_sc.sc_es = tf->tf_vm86_es;
frame.sf_sc.sc_ds = tf->tf_vm86_ds;
frame.sf_sc.sc_eflags = get_vflags(p);
- tf->tf_eflags &= ~PSL_VM;
} else
#endif
{
@@ -161,6 +160,7 @@ freebsd_sendsig(catcher, sig, mask, code)
tf->tf_eip = (int)(((char *)PS_STRINGS) -
(freebsd_esigcode - freebsd_sigcode));
tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
+ tf->tf_eflags &= ~(PSL_T|PSL_VM);
tf->tf_esp = (int)fp;
tf->tf_ss = GSEL(GUDATA_SEL, SEL_UPL);
}
diff --git a/sys/arch/i386/i386/genassym.c b/sys/arch/i386/i386/genassym.c
index b3248141382..d3e01c4094d 100644
--- a/sys/arch/i386/i386/genassym.c
+++ b/sys/arch/i386/i386/genassym.c
@@ -1,4 +1,4 @@
-/* $NetBSD: genassym.c,v 1.46 1996/02/02 19:42:43 mycroft Exp $ */
+/* $NetBSD: genassym.c,v 1.48 1996/03/28 23:44:04 mycroft Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@@ -68,32 +68,15 @@
#include <i386/isa/isa_machdep.h>
#endif
+#include <stdio.h>
+#include <stddef.h>
+
+int
main()
{
- struct proc *p = 0;
- struct vmmeter *vm = 0;
- struct pcb *pcb = 0;
- struct trapframe *tf = 0;
- struct sigframe *sigf = 0;
- struct sigcontext *sc = 0;
- struct uprof *uprof = 0;
-#if NISA > 0
- struct intrhand *ih = 0;
-#endif
-#ifdef COMPAT_SVR4
- struct svr4_sigframe *svr4_sigf = 0;
- struct svr4_ucontext *svr4_uc = 0;
-#endif
-#ifdef COMPAT_LINUX
- struct linux_sigframe *linux_sigf = 0;
- struct linux_sigcontext *linux_sc = 0;
-#endif
-#ifdef COMPAT_FREEBSD
- struct freebsd_sigframe *freebsd_sigf = 0;
- struct freebsd_sigcontext *freebsd_sc = 0;
-#endif
#define def(N,V) printf("#define\t%s %d\n", N, V)
+#define off(N,S,M) def(N, (int)offsetof(S, M))
def("SRUN", SRUN);
@@ -102,70 +85,70 @@ main()
def("NKPDE", NKPDE);
def("APTDPTDI", APTDPTDI);
- def("VM_MAXUSER_ADDRESS", VM_MAXUSER_ADDRESS);
+ def("VM_MAXUSER_ADDRESS", (int)VM_MAXUSER_ADDRESS);
- def("P_ADDR", &p->p_addr);
- def("P_BACK", &p->p_back);
- def("P_FORW", &p->p_forw);
- def("P_PRIORITY", &p->p_priority);
- def("P_STAT", &p->p_stat);
- def("P_WCHAN", &p->p_wchan);
- def("P_VMSPACE", &p->p_vmspace);
- def("P_FLAG", &p->p_flag);
+ off("P_ADDR", struct proc, p_addr);
+ off("P_BACK", struct proc, p_back);
+ off("P_FORW", struct proc, p_forw);
+ off("P_PRIORITY", struct proc, p_priority);
+ off("P_STAT", struct proc, p_stat);
+ off("P_WCHAN", struct proc, p_wchan);
+ off("P_VMSPACE", struct proc, p_vmspace);
+ off("P_FLAG", struct proc, p_flag);
def("P_SYSTEM", P_SYSTEM);
- def("V_TRAP", &vm->v_trap);
- def("V_INTR", &vm->v_intr);
+ off("V_TRAP", struct vmmeter, v_trap);
+ off("V_INTR", struct vmmeter, v_intr);
- def("PCB_CR3", &pcb->pcb_cr3);
- def("PCB_EBP", &pcb->pcb_ebp);
- def("PCB_ESP", &pcb->pcb_esp);
- def("PCB_FS", &pcb->pcb_fs);
- def("PCB_GS", &pcb->pcb_gs);
- def("PCB_CR0", &pcb->pcb_cr0);
- def("PCB_LDT_SEL", &pcb->pcb_ldt_sel);
- def("PCB_TSS_SEL", &pcb->pcb_tss_sel);
- def("PCB_ONFAULT", &pcb->pcb_onfault);
+ off("PCB_CR3", struct pcb, pcb_cr3);
+ off("PCB_EBP", struct pcb, pcb_ebp);
+ off("PCB_ESP", struct pcb, pcb_esp);
+ off("PCB_FS", struct pcb, pcb_fs);
+ off("PCB_GS", struct pcb, pcb_gs);
+ off("PCB_CR0", struct pcb, pcb_cr0);
+ off("PCB_LDT_SEL", struct pcb, pcb_ldt_sel);
+ off("PCB_TSS_SEL", struct pcb, pcb_tss_sel);
+ off("PCB_ONFAULT", struct pcb, pcb_onfault);
- def("TF_CS", &tf->tf_cs);
- def("TF_TRAPNO", &tf->tf_trapno);
- def("TF_EFLAGS", &tf->tf_eflags);
+ off("TF_CS", struct trapframe, tf_cs);
+ off("TF_TRAPNO", struct trapframe, tf_trapno);
+ off("TF_EFLAGS", struct trapframe, tf_eflags);
def("FRAMESIZE", sizeof(struct trapframe));
- def("SIGF_HANDLER", &sigf->sf_handler);
- def("SIGF_SC", &sigf->sf_sc);
- def("SC_FS", &sc->sc_fs);
- def("SC_GS", &sc->sc_gs);
- def("SC_EFLAGS", &sc->sc_eflags);
+ off("SIGF_HANDLER", struct sigframe, sf_handler);
+ off("SIGF_SC", struct sigframe, sf_sc);
+ off("SC_FS", struct sigcontext, sc_fs);
+ off("SC_GS", struct sigcontext, sc_gs);
+ off("SC_EFLAGS", struct sigcontext, sc_eflags);
#ifdef COMPAT_SVR4
- def("SVR4_SIGF_HANDLER", &svr4_sigf->sf_handler);
- def("SVR4_SIGF_UC", &svr4_sigf->sf_uc);
- def("SVR4_UC_FS", &svr4_uc->uc_mcontext.greg[SVR4_X86_FS]);
- def("SVR4_UC_GS", &svr4_uc->uc_mcontext.greg[SVR4_X86_GS]);
- def("SVR4_UC_EFLAGS", &svr4_uc->uc_mcontext.greg[SVR4_X86_EFL]);
+ off("SVR4_SIGF_HANDLER", struct svr4_sigframe, sf_handler);
+ off("SVR4_SIGF_UC", struct svr4_sigframe, sf_uc);
+ off("SVR4_UC_FS", struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_FS]);
+ off("SVR4_UC_GS", struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_GS]);
+ off("SVR4_UC_EFLAGS", struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_EFL]);
#endif
#ifdef COMPAT_LINUX
- def("LINUX_SIGF_HANDLER", &linux_sigf->sf_handler);
- def("LINUX_SIGF_SC", &linux_sigf->sf_sc);
- def("LINUX_SC_FS", &linux_sc->sc_fs);
- def("LINUX_SC_GS", &linux_sc->sc_gs);
- def("LINUX_SC_EFLAGS", &linux_sc->sc_eflags);
+ off("LINUX_SIGF_HANDLER", struct linux_sigframe, sf_handler);
+ off("LINUX_SIGF_SC", struct linux_sigframe, sf_sc);
+ off("LINUX_SC_FS", struct linux_sigcontext, sc_fs);
+ off("LINUX_SC_GS", struct linux_sigcontext, sc_gs);
+ off("LINUX_SC_EFLAGS", struct linux_sigcontext, sc_eflags);
#endif
#ifdef COMPAT_FREEBSD
- def("FREEBSD_SIGF_HANDLER", &freebsd_sigf->sf_handler);
- def("FREEBSD_SIGF_SC", &freebsd_sigf->sf_sc);
+ off("FREEBSD_SIGF_HANDLER", struct freebsd_sigframe, sf_handler);
+ off("FREEBSD_SIGF_SC", struct freebsd_sigframe, sf_sc);
#endif
#if NISA > 0
- def("IH_FUN", &ih->ih_fun);
- def("IH_ARG", &ih->ih_arg);
- def("IH_COUNT", &ih->ih_count);
- def("IH_NEXT", &ih->ih_next);
+ off("IH_FUN", struct intrhand, ih_fun);
+ off("IH_ARG", struct intrhand, ih_arg);
+ off("IH_COUNT", struct intrhand, ih_count);
+ off("IH_NEXT", struct intrhand, ih_next);
#endif
exit(0);
diff --git a/sys/arch/i386/i386/linux_machdep.c b/sys/arch/i386/i386/linux_machdep.c
index 77614ab9b46..67d22c8a819 100644
--- a/sys/arch/i386/i386/linux_machdep.c
+++ b/sys/arch/i386/i386/linux_machdep.c
@@ -1,5 +1,5 @@
-/* $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: linux_machdep.c,v 1.6 1996/04/21 22:16:28 deraadt Exp $ */
+/* $NetBSD: linux_machdep.c,v 1.27 1996/04/12 08:44:37 mycroft Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@@ -136,7 +136,6 @@ linux_sendsig(catcher, sig, mask, code)
frame.sf_sc.sc_es = tf->tf_vm86_es;
frame.sf_sc.sc_ds = tf->tf_vm86_ds;
frame.sf_sc.sc_eflags = get_vflags(p);
- tf->tf_eflags &= ~PSL_VM;
} else
#endif
{
@@ -177,6 +176,7 @@ linux_sendsig(catcher, sig, mask, code)
tf->tf_eip = (int)(((char *)PS_STRINGS) -
(linux_esigcode - linux_sigcode));
tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
+ tf->tf_eflags &= ~(PSL_T|PSL_VM);
tf->tf_esp = (int)fp;
tf->tf_ss = GSEL(GUDATA_SEL, SEL_UPL);
}
diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s
index d68944b52b9..e7af2889ce0 100644
--- a/sys/arch/i386/i386/locore.s
+++ b/sys/arch/i386/i386/locore.s
@@ -1,7 +1,5 @@
-/* $NetBSD: locore.s,v 1.143 1996/02/02 02:36:40 mycroft Exp $ */
+/* $NetBSD: locore.s,v 1.144 1996/04/03 05:48:35 mycroft Exp $ */
-#undef DIAGNOSTIC
-#define DIAGNOSTIC
/*-
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
* Copyright (c) 1990 The Regents of the University of California.
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index f0afbdc07e3..e3bdb4ad24b 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,8 +1,8 @@
-/* $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 $ */
+/* $OpenBSD: machdep.c,v 1.13 1996/04/21 22:16:31 deraadt Exp $ */
+/* $NetBSD: machdep.c,v 1.197 1996/04/12 08:44:40 mycroft Exp $ */
/*-
- * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
+ * Copyright (c) 1993, 1994, 1995, 1996 Charles M. Hannum. All rights reserved.
* Copyright (c) 1992 Terrence R. Lambert.
* Copyright (c) 1982, 1987, 1990 The Regents of the University of California.
* All rights reserved.
@@ -136,6 +136,7 @@ extern vm_offset_t avail_start, avail_end;
static vm_offset_t hole_start, hole_end;
static vm_offset_t avail_next;
+void identifycpu __P((void));
caddr_t allocsys __P((caddr_t));
void dumpsys __P((void));
void cpu_reset __P((void));
@@ -567,7 +568,6 @@ sendsig(catcher, sig, mask, code)
frame.sf_sc.sc_es = tf->tf_vm86_es;
frame.sf_sc.sc_ds = tf->tf_vm86_ds;
frame.sf_sc.sc_eflags = get_vflags(p);
- tf->tf_eflags &= ~PSL_VM;
} else
#endif
{
@@ -607,6 +607,7 @@ sendsig(catcher, sig, mask, code)
tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
tf->tf_eip = (int)(((char *)PS_STRINGS) - (esigcode - sigcode));
tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
+ tf->tf_eflags &= ~(PSL_T|PSL_VM);
tf->tf_esp = (int)fp;
tf->tf_ss = GSEL(GUDATA_SEL, SEL_UPL);
}
@@ -690,6 +691,12 @@ sys_sigreturn(p, v, retval)
p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK;
p->p_sigmask = context.sc_mask & ~sigcantmask;
+ if (context.sc_onstack & 01)
+ p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK;
+ else
+ p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK;
+ p->p_sigmask = context.sc_mask & ~sigcantmask;
+
return (EJUSTRETURN);
}
diff --git a/sys/arch/i386/i386/mainbus.c b/sys/arch/i386/i386/mainbus.c
index e1a844230f4..5de4b476180 100644
--- a/sys/arch/i386/i386/mainbus.c
+++ b/sys/arch/i386/i386/mainbus.c
@@ -1,5 +1,5 @@
-/* $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 $ */
+/* $OpenBSD: mainbus.c,v 1.2 1996/04/21 22:16:32 deraadt Exp $ */
+/* $NetBSD: mainbus.c,v 1.8 1996/04/11 22:13:37 cgd Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -37,24 +37,25 @@
#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 <dev/isa/isareg.h> /* for ISA_HOLE_VADDR */
#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) };
+struct cfattach mainbus_ca = {
+ sizeof(struct device), mainbus_match, mainbus_attach
+};
+
+struct cfdriver mainbus_cd = {
+ NULL, "mainbus", DV_DULL
+};
int mainbus_print __P((void *, char *));
@@ -89,6 +90,20 @@ mainbus_attach(parent, self, aux)
printf("\n");
+ if (1 /* XXX ISA NOT YET SEEN */) {
+ mba.mba_iba.iba_busname = "isa";
+ mba.mba_iba.iba_bc = NULL;
+ mba.mba_iba.iba_ic = NULL;
+ config_found(self, &mba.mba_iba, mainbus_print);
+ }
+
+ 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;
+ mba.mba_eba.eba_ec = NULL;
+ config_found(self, &mba.mba_eba, mainbus_print);
+ }
+
/*
* XXX Note also that the presence of a PCI bus should
* XXX _always_ be checked, and if present the bus should be
@@ -104,17 +119,6 @@ mainbus_attach(parent, self, aux)
}
#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
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c
index f86282728de..fbc1e161d44 100644
--- a/sys/arch/i386/i386/pmap.c
+++ b/sys/arch/i386/i386/pmap.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pmap.c,v 1.7 1996/04/18 04:04:54 mickey Exp $ */
-/* $NetBSD: pmap.c,v 1.34 1995/12/09 07:39:02 mycroft Exp $ */
+/* $OpenBSD: pmap.c,v 1.8 1996/04/21 22:16:33 deraadt Exp $ */
+/* $NetBSD: pmap.c,v 1.35 1996/04/03 08:21:05 mycroft Exp $ */
/*
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
@@ -183,6 +183,7 @@ int pv_nfree;
void i386_protection_init __P((void));
pt_entry_t *pmap_pte __P((pmap_t, vm_offset_t));
+void i386_protection_init __P((void));
#if BSDVM_COMPAT
#include <sys/msgbuf.h>
diff --git a/sys/arch/i386/i386/pmap.old.c b/sys/arch/i386/i386/pmap.old.c
index d80d5e0781d..f9e2ecca669 100644
--- a/sys/arch/i386/i386/pmap.old.c
+++ b/sys/arch/i386/i386/pmap.old.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pmap.old.c,v 1.7 1996/04/18 04:04:54 mickey Exp $ */
-/* $NetBSD: pmap.c,v 1.34 1995/12/09 07:39:02 mycroft Exp $ */
+/* $OpenBSD: pmap.old.c,v 1.8 1996/04/21 22:16:33 deraadt Exp $ */
+/* $NetBSD: pmap.c,v 1.35 1996/04/03 08:21:05 mycroft Exp $ */
/*
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
@@ -183,6 +183,7 @@ int pv_nfree;
void i386_protection_init __P((void));
pt_entry_t *pmap_pte __P((pmap_t, vm_offset_t));
+void i386_protection_init __P((void));
#if BSDVM_COMPAT
#include <sys/msgbuf.h>
diff --git a/sys/arch/i386/i386/process_machdep.c b/sys/arch/i386/i386/process_machdep.c
index fa5859c60e0..77f72d55bc4 100644
--- a/sys/arch/i386/i386/process_machdep.c
+++ b/sys/arch/i386/i386/process_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process_machdep.c,v 1.3 1996/04/17 05:18:56 mickey Exp $ */
+/* $OpenBSD: process_machdep.c,v 1.4 1996/04/21 22:16:34 deraadt Exp $ */
/* $NetBSD: process_machdep.c,v 1.21 1996/04/11 07:47:48 mycroft Exp $ */
/*
@@ -191,13 +191,6 @@ process_write_regs(p, regs)
#define valid_sel(sel) (ISPL(sel) == SEL_UPL && verr(sel))
#define null_sel(sel) (!ISLDT(sel) && IDXSEL(sel) == 0)
- /*
- * Check for security violations.
- */
- if (((regs->r_eflags ^ tf->tf_eflags) & PSL_USERSTATIC) != 0 ||
- !USERMODE(regs->r_cs, regs->r_eflags))
- return (EINVAL);
-
if ((regs->r_gs != pcb->pcb_gs && \
!valid_sel(regs->r_gs) && !null_sel(regs->r_gs)) ||
(regs->r_fs != pcb->pcb_fs && \
diff --git a/sys/arch/i386/i386/rd_root.c b/sys/arch/i386/i386/rd_root.c
new file mode 100644
index 00000000000..4120f4641a6
--- /dev/null
+++ b/sys/arch/i386/i386/rd_root.c
@@ -0,0 +1,79 @@
+/* $NetBSD: rd_root.c,v 1.2 1996/03/27 16:38:33 perry Exp $ */
+
+/*
+ * Copyright (c) 1995 Gordon W. Ross
+ * 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. 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/reboot.h>
+
+#include <dev/ramdisk.h>
+
+extern int boothowto;
+
+#ifndef MINIROOTSIZE
+#define MINIROOTSIZE 512
+#endif
+
+#define ROOTBYTES (MINIROOTSIZE << DEV_BSHIFT)
+
+/*
+ * This array will be patched to contain a file-system image.
+ * See the program: src/distrib/sun3/common/rdsetroot.c
+ */
+int rd_root_size = ROOTBYTES;
+char rd_root_image[ROOTBYTES] = "|This is the root ramdisk!\n";
+
+/*
+ * This is called during autoconfig.
+ */
+void
+rd_attach_hook(unit, rd)
+ int unit;
+ struct rd_conf *rd;
+{
+ if (unit == 0) {
+ /* Setup root ramdisk */
+ rd->rd_addr = (caddr_t) rd_root_image;
+ rd->rd_size = (size_t) rd_root_size;
+ rd->rd_type = RD_KMEM_FIXED;
+ printf(" fixed, %d blocks", MINIROOTSIZE);
+ }
+}
+
+/*
+ * This is called during open (i.e. mountroot)
+ */
+void
+rd_open_hook(unit, rd)
+ int unit;
+ struct rd_conf *rd;
+{
+ if (unit == 0) {
+ /* The root ramdisk only works single-user. */
+ boothowto |= RB_SINGLE;
+ }
+}
diff --git a/sys/arch/i386/i386/svr4_machdep.c b/sys/arch/i386/i386/svr4_machdep.c
index 6d5851c4e34..479bf8d0fd1 100644
--- a/sys/arch/i386/i386/svr4_machdep.c
+++ b/sys/arch/i386/i386/svr4_machdep.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: svr4_machdep.c,v 1.3 1996/04/17 05:18:57 mickey Exp $ */
-/* $NetBSD: svr4_machdep.c,v 1.21 1996/04/11 07:47:50 mycroft Exp $ */
+/* $OpenBSD: svr4_machdep.c,v 1.4 1996/04/21 22:16:38 deraadt Exp $ */
+/* $NetBSD: svr4_machdep.c,v 1.22 1996/04/12 08:44:42 mycroft Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -82,7 +82,6 @@ svr4_getcontext(p, uc, mask, oonstack)
r[SVR4_X86_ES] = tf->tf_vm86_es;
r[SVR4_X86_DS] = tf->tf_vm86_ds;
r[SVR4_X86_EFL] = get_vflags(p);
- tf->tf_eflags &= ~PSL_VM;
} else
#endif
{
@@ -376,15 +375,13 @@ svr4_sendsig(catcher, sig, mask, code)
/*
* Build context to run handler in.
*/
- tf->tf_esp = (int)fp;
+ tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL);
+ tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
tf->tf_eip = (int)(((char *)PS_STRINGS) -
- (svr4_esigcode - svr4_sigcode));
-#ifdef VM86
- tf->tf_eflags &= ~PSL_VM;
-#endif
+ (svr4_esigcode - svr4_sigcode));
tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
- tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
- tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL);
+ tf->tf_eflags &= ~(PSL_T|PSL_VM);
+ tf->tf_esp = (int)fp;
tf->tf_ss = GSEL(GUDATA_SEL, SEL_UPL);
}
diff --git a/sys/arch/i386/i386/swapgeneric.c b/sys/arch/i386/i386/swapgeneric.c
index b67fcd7742a..cdacbffb6b0 100644
--- a/sys/arch/i386/i386/swapgeneric.c
+++ b/sys/arch/i386/i386/swapgeneric.c
@@ -1,5 +1,5 @@
-/* $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 $ */
+/* $OpenBSD: swapgeneric.c,v 1.4 1996/04/21 22:16:39 deraadt Exp $ */
+/* $NetBSD: swapgeneric.c,v 1.11 1996/04/03 09:15:26 mycroft Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -55,8 +55,6 @@
#include "cd.h"
#include "mcd.h"
-void gets __P((char *));
-
/*
* Generic configuration; all in one
*/
@@ -72,19 +70,19 @@ long dumplo;
int dmmin, dmmax, dmtext;
#if NWDC > 0
-extern struct cfdriver wdcd;
+extern struct cfdriver wd_cd;
#endif
#if NFDC > 0
-extern struct cfdriver fdcd;
+extern struct cfdriver fd_cd;
#endif
#if NSD > 0
-extern struct cfdriver sdcd;
+extern struct cfdriver sd_cd;
#endif
#if NCD > 0
-extern struct cfdriver cdcd;
+extern struct cfdriver cd_cd;
#endif
#if NMCD > 0
-extern struct cfdriver mcdcd;
+extern struct cfdriver mcd_cd;
#endif
struct genericconf {
@@ -93,19 +91,19 @@ struct genericconf {
dev_t gc_major;
} genericconf[] = {
#if NWDC > 0
- { &wdcd, "wd", 0 },
+ { &wd_cd, "wd", 0 },
#endif
#if NSD > 0
- { &sdcd, "sd", 4 },
+ { &sd_cd, "sd", 4 },
#endif
#if NCD > 0
- { &cdcd, "cd", 6 },
+ { &cd_cd, "cd", 6 },
#endif
#if NMCD > 0
- { &mcdcd, "mcd", 7 },
+ { &mcd_cd, "mcd", 7 },
#endif
#if NFDC > 0
- { &fdcd, "fd", 2 },
+ { &fd_cd, "fd", 2 },
#endif
{ 0 }
};
@@ -113,6 +111,8 @@ struct genericconf {
extern int ffs_mountroot();
int (*mountroot)() = ffs_mountroot;
+void gets __P((char *));
+
void
setconf()
{
diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c
index 098d277d154..b9a43121e5d 100644
--- a/sys/arch/i386/i386/trap.c
+++ b/sys/arch/i386/i386/trap.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: trap.c,v 1.6 1996/03/19 21:09:23 mickey Exp $ */
-/* $NetBSD: trap.c,v 1.92 1996/01/08 13:51:38 mycroft Exp $ */
+/* $OpenBSD: trap.c,v 1.7 1996/04/21 22:16:40 deraadt Exp $ */
+/* $NetBSD: trap.c,v 1.93 1996/04/15 00:20:32 mycroft Exp $ */
#undef DEBUG
#define DEBUG
@@ -413,8 +413,11 @@ trap(frame)
map, va, ftype, rv);
goto we_re_toast;
}
- trapsignal(p, (rv == KERN_PROTECTION_FAILURE)
- ? SIGBUS : SIGSEGV, T_PAGEFLT);
+ trapsignal(p, (rv == KERN_PROTECTION_FAILURE
+#ifdef COMPAT_LINUX
+ && p->p_emul != &emul_linux_aout && p->p_emul != &emul_linux_elf
+#endif
+ ) ? SIGBUS : SIGSEGV, T_PAGEFLT);
break;
}
@@ -428,7 +431,6 @@ trap(frame)
case T_BPTFLT|T_USER: /* bpt instruction fault */
case T_TRCTRAP|T_USER: /* trace trap */
trace:
- frame.tf_eflags &= ~PSL_T;
trapsignal(p, SIGTRAP, type &~ T_USER);
break;
diff --git a/sys/arch/i386/i386/vm86.c b/sys/arch/i386/i386/vm86.c
index 5e254490af6..9ce1c9db6da 100644
--- a/sys/arch/i386/i386/vm86.c
+++ b/sys/arch/i386/i386/vm86.c
@@ -1,5 +1,5 @@
-/* $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: vm86.c,v 1.4 1996/04/21 22:16:42 deraadt Exp $ */
+/* $NetBSD: vm86.c,v 1.9 1996/04/12 05:57:43 mycroft Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -74,9 +74,10 @@
static void fast_intxx __P((struct proc *, int));
-#define CS(tf) (*(u_short *)&tf->tf_cs)
+#define SETDIRECT ((~(PSL_USERSTATIC|PSL_NT)) & 0xffff)
+#define GETDIRECT (SETDIRECT|0x02a) /* add in two MBZ bits */
+
#define IP(tf) (*(u_short *)&tf->tf_eip)
-#define SS(tf) (*(u_short *)&tf->tf_ss)
#define SP(tf) (*(u_short *)&tf->tf_esp)
@@ -383,10 +384,11 @@ i386_vm86(p, args, retval)
struct trapframe *tf = p->p_md.md_regs;
struct pcb *pcb = &p->p_addr->u_pcb;
struct vm86_kern vm86s;
- int err;
+ int error;
- if (err = copyin(args, &vm86s, sizeof(vm86s)))
- return err;
+ error = copyin(args, &vm86s, sizeof(vm86s));
+ if (error)
+ return (error);
pcb->vm86_userp = (void *)args;
@@ -398,18 +400,19 @@ i386_vm86(p, args, retval)
case VCPU_086:
case VCPU_186:
case VCPU_286:
- pcb->vm86_flagmask = 0;
+ pcb->vm86_flagmask = PSL_ID|PSL_AC|PSL_NT|PSL_IOPL;
break;
case VCPU_386:
- pcb->vm86_flagmask = PSL_NT|PSL_IOPL;
+ pcb->vm86_flagmask = PSL_ID|PSL_AC;
break;
case VCPU_486:
- pcb->vm86_flagmask = PSL_AC|PSL_NT|PSL_IOPL;
+ pcb->vm86_flagmask = PSL_ID;
break;
case VCPU_586:
- default:
- pcb->vm86_flagmask = PSL_ID|PSL_AC|PSL_NT|PSL_IOPL;
+ pcb->vm86_flagmask = 0;
break;
+ default:
+ return (EINVAL);
}
#define DOVREG(reg) tf->tf_vm86_##reg = (u_short) vm86s.regs.vmsc.sc_##reg
diff --git a/sys/arch/i386/i386/vm_machdep.c b/sys/arch/i386/i386/vm_machdep.c
index f333c02f46c..2a58bd72ec2 100644
--- a/sys/arch/i386/i386/vm_machdep.c
+++ b/sys/arch/i386/i386/vm_machdep.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: vm_machdep.c,v 1.8 1996/04/17 05:19:00 mickey Exp $ */
-/* $NetBSD: vm_machdep.c,v 1.58 1996/02/05 02:00:35 christos Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.9 1996/04/21 22:16:43 deraadt Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.59 1996/04/03 08:24:17 mycroft Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@@ -259,6 +259,7 @@ cpu_coredump(p, vp, cred, chdr)
return 0;
}
+#if 0
/*
* Set a red zone in the kernel stack after the u. area.
*/
@@ -276,6 +277,7 @@ setredzone(pte, vaddr)
used by sched (that has physical memory mapped 1:1 at bottom)
and take the dump while still in mapped mode */
}
+#endif
/*
* Move pages from one kernel virtual address to another.
diff --git a/sys/arch/i386/include/bus.h b/sys/arch/i386/include/bus.h
index fcf4e90771b..09947ebf54e 100644
--- a/sys/arch/i386/include/bus.h
+++ b/sys/arch/i386/include/bus.h
@@ -1,5 +1,5 @@
-/* $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 $ */
+/* $OpenBSD: bus.h,v 1.2 1996/04/21 22:16:46 deraadt Exp $ */
+/* $NetBSD: bus.h,v 1.2 1996/04/05 23:59:37 thorpej Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -66,6 +66,17 @@ typedef caddr_t bus_mem_handle_t;
#define bus_io_read_8(t, h, o) !!! bus_io_read_8 unimplemented !!!
#endif
+#define bus_io_read_multi_1(t, h, o, a, c) \
+ insb((h) + (o), (a), (c))
+#define bus_io_read_multi_2(t, h, o, a, c) \
+ insw((h) + (o), (a), (c))
+#define bus_io_read_multi_4(t, h, o, a, c) \
+ insl((h) + (o), (a), (c))
+#if 0 /* Cause a link error for bus_io_read_multi_8 */
+#define bus_io_read_multi_8(t, h, o, a, c) \
+ !!! bus_io_read_multi_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))
@@ -73,6 +84,17 @@ typedef caddr_t bus_mem_handle_t;
#define bus_io_write_8(t, h, o, v) !!! bus_io_write_8 unimplemented !!!
#endif
+#define bus_io_write_multi_1(t, h, o, a, c) \
+ outsb((h) + (o), (a), (c))
+#define bus_io_write_multi_2(t, h, o, a, c) \
+ outsw((h) + (o), (a), (c))
+#define bus_io_write_multi_4(t, h, o, a, c) \
+ outsl((h) + (o), (a), (c))
+#if 0 /* Cause a link error for bus_io_write_multi_8 */
+#define bus_io_write_multi_8(t, h, o, a, c) \
+ !!! bus_io_write_multi_8 unimplimented !!!
+#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,
diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h
index 00e3ed0de3c..373fc86995a 100644
--- a/sys/arch/i386/include/cpu.h
+++ b/sys/arch/i386/include/cpu.h
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.32 1995/12/24 01:08:02 mycroft Exp $ */
+/* $NetBSD: cpu.h,v 1.33 1996/03/29 00:23:28 mycroft Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -93,6 +93,7 @@ int want_resched; /* resched() was called */
* We need a machine-independent name for this.
*/
#define DELAY(x) delay(x)
+void delay __P((int));
#ifdef I586_CPU
/*
diff --git a/sys/arch/i386/include/joystick.h b/sys/arch/i386/include/joystick.h
index b73fa5c91d7..464777c97eb 100644
--- a/sys/arch/i386/include/joystick.h
+++ b/sys/arch/i386/include/joystick.h
@@ -1,3 +1,26 @@
+/* $NetBSD: joystick.h,v 1.1 1996/03/27 19:18:56 perry Exp $ */
+
+#ifndef _JOY_IOCTL_H_
+#define _JOY_IOCTL_H_
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+struct joystick {
+ int x;
+ int y;
+ int b1;
+ int b2;
+};
+
+#define JOY_SETTIMEOUT _IOW('J', 1, int) /* set timeout */
+#define JOY_GETTIMEOUT _IOR('J', 2, int) /* get timeout */
+#define JOY_SET_X_OFFSET _IOW('J', 3, int) /* set offset on X-axis */
+#define JOY_SET_Y_OFFSET _IOW('J', 4, int) /* set offset on X-axis */
+#define JOY_GET_X_OFFSET _IOR('J', 5, int) /* get offset on X-axis */
+#define JOY_GET_Y_OFFSET _IOR('J', 6, int) /* get offset on Y-axis */
+
+#endif /* _JOY_IOCTL_H_ */
#ifndef _JOY_IOCTL_H_
#define _JOY_IOCTL_H_
diff --git a/sys/arch/i386/include/vm86.h b/sys/arch/i386/include/vm86.h
index 67a584be27e..6adc36548a0 100644
--- a/sys/arch/i386/include/vm86.h
+++ b/sys/arch/i386/include/vm86.h
@@ -1,5 +1,5 @@
-/* $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 $ */
+/* $OpenBSD: vm86.h,v 1.4 1996/04/21 22:16:48 deraadt Exp $ */
+/* $NetBSD: vm86.h,v 1.5 1996/04/12 05:57:45 mycroft Exp $ */
#define VM86_USE_VIF
@@ -52,6 +52,9 @@
#define VM86_SETDIRECT (~PSL_USERSTATIC)
#define VM86_GETDIRECT (VM86_SETDIRECT|PSL_MBO|PSL_MBZ)
+#define VM86_SETDIRECT (~PSL_USERSTATIC)
+#define VM86_GETDIRECT (VM86_SETDIRECT|PSL_MBO|PSL_MBZ)
+
struct vm86_regs {
struct sigcontext vmsc;
};
@@ -124,7 +127,8 @@ set_vflags(p, flags)
struct trapframe *tf = p->p_md.md_regs;
struct pcb *pcb = &p->p_addr->u_pcb;
- SETFLAGS(pcb->vm86_eflags, flags, pcb->vm86_flagmask | ~VM86_GETDIRECT);
+ flags &= ~pcb->vm86_flagmask;
+ SETFLAGS(pcb->vm86_eflags, flags, ~VM86_GETDIRECT);
SETFLAGS(tf->tf_eflags, flags, VM86_SETDIRECT);
#ifndef VM86_USE_VIF
if ((pcb->vm86_eflags & (PSL_I|PSL_VIP)) == (PSL_I|PSL_VIP))
@@ -142,7 +146,7 @@ get_vflags(p)
struct pcb *pcb = &p->p_addr->u_pcb;
int flags = 0;
- SETFLAGS(flags, pcb->vm86_eflags, pcb->vm86_flagmask | ~VM86_GETDIRECT);
+ SETFLAGS(flags, pcb->vm86_eflags, ~VM86_GETDIRECT);
SETFLAGS(flags, tf->tf_eflags, VM86_GETDIRECT);
return (flags);
}
@@ -155,7 +159,8 @@ set_vflags_short(p, flags)
struct trapframe *tf = p->p_md.md_regs;
struct pcb *pcb = &p->p_addr->u_pcb;
- SETFLAGS(pcb->vm86_eflags, flags, (pcb->vm86_flagmask | ~VM86_GETDIRECT) & 0xffff);
+ flags &= ~pcb->vm86_flagmask;
+ SETFLAGS(pcb->vm86_eflags, flags, ~VM86_GETDIRECT & 0xffff);
SETFLAGS(tf->tf_eflags, flags, VM86_SETDIRECT & 0xffff);
#ifndef VM86_USE_VIF
if ((pcb->vm86_eflags & (PSL_I|PSL_VIP)) == (PSL_I|PSL_VIP))
@@ -171,7 +176,7 @@ get_vflags_short(p)
struct pcb *pcb = &p->p_addr->u_pcb;
int flags = 0;
- SETFLAGS(flags, pcb->vm86_eflags, (pcb->vm86_flagmask | ~VM86_GETDIRECT) & 0xffff);
+ SETFLAGS(flags, pcb->vm86_eflags, ~VM86_GETDIRECT & 0xffff);
SETFLAGS(flags, tf->tf_eflags, VM86_GETDIRECT & 0xffff);
return (flags);
}
diff --git a/sys/arch/i386/isa/clock.c b/sys/arch/i386/isa/clock.c
index 4c170d56137..8d099499732 100644
--- a/sys/arch/i386/isa/clock.c
+++ b/sys/arch/i386/isa/clock.c
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.35 1995/12/24 02:30:07 mycroft Exp $ */
+/* $NetBSD: clock.c,v 1.37 1996/04/11 22:15:13 cgd Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles Hannum.
@@ -106,6 +106,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <i386/isa/spkrreg.h>
void spinwait __P((int));
+void findcpuspeed __P((void));
#ifdef I586_CPU
int pentium_mhz;
@@ -287,6 +288,8 @@ sysbeep(pitch, period)
unsigned int delaycount; /* calibrated loop variable (1 millisecond) */
#define FIRST_GUESS 0x2000
+
+void
findcpuspeed()
{
int i;
@@ -328,7 +331,8 @@ cpu_initclocks()
* XXX If you're doing strange things with multiple clocks, you might
* want to keep track of clock handlers.
*/
- (void)isa_intr_establish(0, IST_PULSE, IPL_CLOCK, clockintr, 0, "clock");
+ (void)isa_intr_establish(NULL, 0, IST_PULSE, IPL_CLOCK, clockintr,
+ 0, "clock");
}
void
diff --git a/sys/arch/i386/isa/fd.c b/sys/arch/i386/isa/fd.c
index 45564bd20b9..a7b07df07c7 100644
--- a/sys/arch/i386/isa/fd.c
+++ b/sys/arch/i386/isa/fd.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: fd.c,v 1.12 1996/04/18 17:12:13 niklas Exp $ */
-/* $NetBSD: fd.c,v 1.85 1996/03/04 04:01:03 mycroft Exp $ */
+/* $OpenBSD: fd.c,v 1.13 1996/04/21 22:16:52 deraadt Exp $ */
+/* $NetBSD: fd.c,v 1.87 1996/04/11 22:15:16 cgd Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles Hannum.
@@ -112,8 +112,12 @@ void fdcforceintr __P((void *));
#endif
void fdcattach __P((struct device *, struct device *, void *));
-struct cfdriver fdccd = {
- NULL, "fdc", fdcprobe, fdcattach, DV_DULL, sizeof(struct fdc_softc)
+struct cfattach fdc_ca = {
+ sizeof(struct fdc_softc), fdcprobe, fdcattach
+};
+
+struct cfdriver fdc_cd = {
+ NULL, "fdc", DV_DULL
};
/*
@@ -179,8 +183,12 @@ struct fd_softc {
int fdprobe __P((struct device *, void *, void *));
void fdattach __P((struct device *, struct device *, void *));
-struct cfdriver fdcd = {
- NULL, "fd", fdprobe, fdattach, DV_DISK, sizeof(struct fd_softc)
+struct cfattach fd_ca = {
+ sizeof(struct fd_softc), fdprobe, fdattach
+};
+
+struct cfdriver fd_cd = {
+ NULL, "fd", DV_DISK
};
void fdgetdisklabel __P((struct fd_softc *));
@@ -308,8 +316,8 @@ fdcattach(parent, self, aux)
at_setup_dmachan(fdc->sc_drq, FDC_MAXIOSIZE);
isa_establish(&fdc->sc_id, &fdc->sc_dev);
#endif
- fdc->sc_ih = isa_intr_establish(ia->ia_irq, IST_EDGE, IPL_BIO, fdcintr,
- fdc, fdc->sc_dev.dv_xname);
+ fdc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
+ IPL_BIO, fdcintr, fdc, fdc->sc_dev.dv_xname);
/*
* The NVRAM info only tells us about the first two disks on the
@@ -477,8 +485,8 @@ fdstrategy(bp)
int s;
/* Valid unit, controller, and request? */
- if (unit >= fdcd.cd_ndevs ||
- (fd = fdcd.cd_devs[unit]) == 0 ||
+ if (unit >= fd_cd.cd_ndevs ||
+ (fd = fd_cd.cd_devs[unit]) == 0 ||
bp->b_blkno < 0 ||
(bp->b_bcount % FDC_BSIZE) != 0) {
bp->b_error = EINVAL;
@@ -705,9 +713,9 @@ Fdopen(dev, flags)
struct fd_type *type;
unit = FDUNIT(dev);
- if (unit >= fdcd.cd_ndevs)
+ if (unit >= fd_cd.cd_ndevs)
return ENXIO;
- fd = fdcd.cd_devs[unit];
+ fd = fd_cd.cd_devs[unit];
if (fd == 0)
return ENXIO;
type = fd_dev_to_type(fd, dev);
@@ -730,7 +738,7 @@ fdclose(dev, flags)
dev_t dev;
int flags;
{
- struct fd_softc *fd = fdcd.cd_devs[FDUNIT(dev)];
+ struct fd_softc *fd = fd_cd.cd_devs[FDUNIT(dev)];
fd->sc_flags &= ~FD_OPEN;
return 0;
@@ -1169,7 +1177,7 @@ fdioctl(dev, cmd, addr, flag)
caddr_t addr;
int flag;
{
- struct fd_softc *fd = fdcd.cd_devs[FDUNIT(dev)];
+ struct fd_softc *fd = fd_cd.cd_devs[FDUNIT(dev)];
struct disklabel buffer;
int error;
diff --git a/sys/arch/i386/isa/isa_machdep.c b/sys/arch/i386/isa/isa_machdep.c
index f37de38ba63..e430e4e87a6 100644
--- a/sys/arch/i386/isa/isa_machdep.c
+++ b/sys/arch/i386/isa/isa_machdep.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: isa_machdep.c,v 1.11 1996/04/19 05:41:52 mickey Exp $ */
-/* $NetBSD: isa_machdep.c,v 1.11 1996/02/28 01:49:35 cgd Exp $ */
+/* $OpenBSD: isa_machdep.c,v 1.12 1996/04/21 22:16:54 deraadt Exp $ */
+/* $NetBSD: isa_machdep.c,v 1.12 1996/04/11 22:11:32 cgd Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles Hannum.
@@ -220,7 +220,8 @@ fakeintr(arg)
* XXX PRONE TO RACE CONDITIONS, UGLY, 'INTERESTING' INSERTION ALGORITHM.
*/
void *
-isa_intr_establish(irq, type, level, ih_fun, ih_arg, ih_what)
+isa_intr_establish(ic, irq, type, level, ih_fun, ih_arg, ih_what)
+ isa_chipset_tag_t ic;
int irq;
int type;
int level;
@@ -290,7 +291,8 @@ isa_intr_establish(irq, type, level, ih_fun, ih_arg, ih_what)
* Deregister an interrupt handler.
*/
void
-isa_intr_disestablish(arg)
+isa_intr_disestablish(ic, arg)
+ isa_chipset_tag_t ic;
void *arg;
{
struct intrhand *ih = arg;
@@ -318,6 +320,15 @@ isa_intr_disestablish(arg)
intrtype[irq] = IST_NONE;
}
+void
+isa_attach_hook(parent, self, iba)
+ struct device *parent, *self;
+ struct isabus_attach_args *iba;
+{
+
+ /* Nothing to do. */
+}
+
/*
* ISA DMA and bounce buffer management
*/
diff --git a/sys/arch/i386/isa/isa_machdep.h b/sys/arch/i386/isa/isa_machdep.h
index 76d4f7770fa..756221c630b 100644
--- a/sys/arch/i386/isa/isa_machdep.h
+++ b/sys/arch/i386/isa/isa_machdep.h
@@ -1,4 +1,4 @@
-/* $NetBSD: isa_machdep.h,v 1.4 1995/05/04 19:39:46 cgd Exp $ */
+/* $NetBSD: isa_machdep.h,v 1.5 1996/04/11 22:10:11 cgd Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -39,6 +39,14 @@
*/
/*
+ * Various pieces of the i386 port want to include this file without
+ * or in spite of using isavar.h, and should be fixed.
+ */
+
+#ifndef _I386_ISA_MACHDEP_H_ /* XXX */
+#define _I386_ISA_MACHDEP_H_ /* XXX */
+
+/*
* XXX THIS FILE IS A MESS. copyright: berkeley's probably.
* contents from isavar.h and isareg.h, mostly the latter.
* perhaps charles's?
@@ -46,8 +54,28 @@
* copyright from berkeley's isa.h which is now dev/isa/isareg.h.
*/
+/*
+ * Types provided to machine-independent ISA code.
+ */
+typedef void *isa_chipset_tag_t;
+
+struct device; /* XXX */
+struct isabus_attach_args; /* XXX */
/*
+ * Functions provided to machine-independent ISA code.
+ */
+void isa_attach_hook __P((struct device *, struct device *,
+ struct isabus_attach_args *));
+void *isa_intr_establish __P((isa_chipset_tag_t ic, int irq, int type,
+ int level, int (*ih_fun)(void *), void *ih_arg, char *ih_what));
+void isa_intr_disestablish __P((isa_chipset_tag_t ic, void *handler));
+
+/*
+ * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED
+ * BY PORTABLE CODE.
+ */
+/*
* XXX Various seemingly PC-specific constants, some of which may be
* unnecessary anyway.
*/
@@ -142,3 +170,5 @@ extern u_long atdevbase; /* kernel virtual address of "hole" */
* Miscellanous functions.
*/
void sysbeep __P((int, int)); /* beep with the system speaker */
+
+#endif /* _I386_ISA_MACHDEP_H_ XXX */
diff --git a/sys/arch/i386/isa/joy.c b/sys/arch/i386/isa/joy.c
index 00d89838155..57c45480f62 100644
--- a/sys/arch/i386/isa/joy.c
+++ b/sys/arch/i386/isa/joy.c
@@ -1,3 +1,268 @@
+/* $NetBSD: joy.c,v 1.2 1996/04/01 06:39:17 scottr Exp $ */
+
+/*-
+ * Copyright (c) 1995 Jean-Marc Zucconi
+ * All rights reserved.
+ *
+ * Ported to NetBSD by Matthieu Herrb <matthieu@laas.fr>
+ *
+ * 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
+ * in this position and unchanged.
+ * 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. The name of the author may not be used to endorse or promote products
+ * derived from this software withough 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/kernel.h>
+#include <sys/device.h>
+#include <sys/errno.h>
+
+#include <machine/cpu.h>
+#include <machine/pio.h>
+#include <machine/cpufunc.h>
+#include <machine/joystick.h>
+
+#include <dev/isa/isavar.h>
+#include <dev/isa/isareg.h>
+#include <i386/isa/timerreg.h>
+
+
+/*
+ * The game port can manage 4 buttons and 4 variable resistors (usually 2
+ * joysticks, each with 2 buttons and 2 pots.) via the port at address 0x201.
+ * Getting the state of the buttons is done by reading the game port;
+ * buttons 1-4 correspond to bits 4-7 and resistors 1-4 (X1, Y1, X2, Y2)
+ * to bits 0-3. If button 1 (resp 2, 3, 4) is pressed, the bit 4 (resp 5,
+ * 6, 7) is set to 0 to get the value of a resistor, write the value 0xff
+ * at port and wait until the corresponding bit returns to 0.
+ */
+
+/*
+ * The formulae below only work if u is ``not too large''. See also
+ * the discussion in microtime.s
+ */
+#define USEC2TICKS(u) (((u) * 19549) >> 14)
+#define TICKS2USEC(u) (((u) * 3433) >> 12)
+
+
+#define JOYPART(d) minor(d) & 1
+#define JOYUNIT(d) minor(d) >> 1 & 3
+
+#ifndef JOY_TIMEOUT
+#define JOY_TIMEOUT 2000 /* 2 milliseconds */
+#endif
+
+#define JOY_NPORTS 1
+
+struct joy_softc {
+ struct device sc_dev;
+ int port;
+ int x_off[2], y_off[2];
+ int timeout[2];
+};
+
+int joyprobe __P((struct device *, void *, void *));
+void joyattach __P((struct device *, struct device *, void *));
+int joyopen __P((dev_t, int, int, struct proc *));
+int joyclose __P((dev_t, int, int, struct proc *));
+static int get_tick __P((void));
+
+struct cfattach joy_ca = {
+ sizeof(struct joy_softc), joyprobe, joyattach
+};
+
+struct cfdriver joy_cd = {
+ NULL, "joy", DV_DULL
+};
+
+
+int
+joyprobe(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct isa_attach_args *ia = aux;
+ int iobase = ia->ia_iobase;
+
+#ifdef WANT_JOYSTICK_CONNECTED
+ outb(iobase, 0xff);
+ DELAY(10000); /* 10 ms delay */
+ return (inb(iobase) & 0x0f) != 0x0f;
+#else
+ ia->ia_iosize = JOY_NPORTS;
+ ia->ia_msize = 0;
+ return 1;
+#endif
+}
+
+void
+joyattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct joy_softc *sc = (void *) self;
+ struct isa_attach_args *ia = aux;
+ int unit = sc->sc_dev.dv_unit;
+ int iobase = ia->ia_iobase;
+
+ sc->port = iobase;
+ sc->timeout[0] = sc->timeout[1] = 0;
+ outb(iobase, 0xff);
+ DELAY(10000); /* 10 ms delay */
+ printf(": joystick%sconnected\n",
+ (inb(iobase) & 0x0f) == 0x0f ? " not " : " ");
+}
+
+int
+joyopen(dev, flag, mode, p)
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
+{
+ int unit = JOYUNIT(dev);
+ int i = JOYPART(dev);
+ struct joy_softc *sc;
+
+ if (unit >= joy_cd.cd_ndevs)
+ return (ENXIO);
+
+ sc = joy_cd.cd_devs[unit];
+
+ if (sc->timeout[i])
+ return EBUSY;
+
+ sc->x_off[i] = sc->y_off[i] = 0;
+ sc->timeout[i] = JOY_TIMEOUT;
+ return 0;
+}
+
+int
+joyclose(dev, flag, mode, p)
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
+{
+ int unit = JOYUNIT(dev);
+ int i = JOYPART(dev);
+ struct joy_softc *sc = joy_cd.cd_devs[unit];
+
+ sc->timeout[i] = 0;
+ return 0;
+}
+
+int
+joyread(dev, uio, flag)
+ dev_t dev;
+ struct uio *uio;
+ int flag;
+{
+ int unit = JOYUNIT(dev);
+ struct joy_softc *sc = joy_cd.cd_devs[unit];
+ struct joystick c;
+ int port = sc->port;
+ int i, t0, t1;
+ int state = 0, x = 0, y = 0;
+
+ disable_intr();
+ outb(port, 0xff);
+ t0 = get_tick();
+ t1 = t0;
+ i = USEC2TICKS(sc->timeout[JOYPART(dev)]);
+ while (t0 - t1 < i) {
+ state = inb(port);
+ if (JOYPART(dev) == 1)
+ state >>= 2;
+ t1 = get_tick();
+ if (t1 > t0)
+ t1 -= TIMER_FREQ / hz;
+ if (!x && !(state & 0x01))
+ x = t1;
+ if (!y && !(state & 0x02))
+ y = t1;
+ if (x && y)
+ break;
+ }
+ enable_intr();
+ c.x = x ? sc->x_off[JOYPART(dev)] + TICKS2USEC(t0 - x) : 0x80000000;
+ c.y = y ? sc->y_off[JOYPART(dev)] + TICKS2USEC(t0 - y) : 0x80000000;
+ state >>= 4;
+ c.b1 = ~state & 1;
+ c.b2 = ~(state >> 1) & 1;
+ return uiomove((caddr_t) & c, sizeof(struct joystick), uio);
+}
+
+int
+joyioctl(dev, cmd, data, flag, p)
+ dev_t dev;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ int unit = JOYUNIT(dev);
+ struct joy_softc *sc = joy_cd.cd_devs[unit];
+ int i = JOYPART(dev);
+ int x;
+
+ switch (cmd) {
+ case JOY_SETTIMEOUT:
+ x = *(int *) data;
+ if (x < 1 || x > 10000) /* 10ms maximum! */
+ return EINVAL;
+ sc->timeout[i] = x;
+ break;
+ case JOY_GETTIMEOUT:
+ *(int *) data = sc->timeout[i];
+ break;
+ case JOY_SET_X_OFFSET:
+ sc->x_off[i] = *(int *) data;
+ break;
+ case JOY_SET_Y_OFFSET:
+ sc->y_off[i] = *(int *) data;
+ break;
+ case JOY_GET_X_OFFSET:
+ *(int *) data = sc->x_off[i];
+ break;
+ case JOY_GET_Y_OFFSET:
+ *(int *) data = sc->y_off[i];
+ break;
+ default:
+ return ENXIO;
+ }
+ return 0;
+}
+
+static int
+get_tick()
+{
+ int low, high;
+
+ outb(TIMER_MODE, TIMER_SEL0);
+ low = inb(TIMER_CNTR0);
+ high = inb(TIMER_CNTR0);
+
+ return (high << 8) | low;
+}
/*-
* Copyright (c) 1995 Jean-Marc Zucconi
* All rights reserved.
diff --git a/sys/arch/i386/isa/lms.c b/sys/arch/i386/isa/lms.c
index 64fade8f35b..efd24305e52 100644
--- a/sys/arch/i386/isa/lms.c
+++ b/sys/arch/i386/isa/lms.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lms.c,v 1.21 1995/12/24 02:30:17 mycroft Exp $ */
+/* $NetBSD: lms.c,v 1.24 1996/04/11 22:15:18 cgd Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles Hannum.
@@ -37,7 +37,7 @@
#include <sys/device.h>
#include <machine/cpu.h>
-#include <machine/pio.h>
+#include <machine/bus.h>
#include <machine/mouse.h>
#include <dev/isa/isavar.h>
@@ -56,9 +56,11 @@ struct lms_softc { /* driver status information */
struct device sc_dev;
void *sc_ih;
+ bus_chipset_tag_t sc_bc; /* bus chipset identifier */
+ bus_io_handle_t sc_ioh; /* bus i/o handle */
+
struct clist sc_q;
struct selinfo sc_rsel;
- int sc_iobase; /* I/O port base */
u_char sc_state; /* mouse driver state */
#define LMS_OPEN 0x01 /* device is open */
#define LMS_ASLP 0x02 /* waiting for mouse data */
@@ -70,8 +72,12 @@ int lmsprobe __P((struct device *, void *, void *));
void lmsattach __P((struct device *, struct device *, void *));
int lmsintr __P((void *));
-struct cfdriver lmscd = {
- NULL, "lms", lmsprobe, lmsattach, DV_TTY, sizeof(struct lms_softc)
+struct cfattach lms_ca = {
+ sizeof(struct lms_softc), lmsprobe, lmsattach
+};
+
+struct cfdriver lms_cd = {
+ NULL, "lms", DV_TTY
};
#define LMSUNIT(dev) (minor(dev))
@@ -82,26 +88,38 @@ lmsprobe(parent, match, aux)
void *match, *aux;
{
struct isa_attach_args *ia = aux;
- int iobase = ia->ia_iobase;
+ bus_chipset_tag_t bc = ia->ia_bc;
+ bus_io_handle_t ioh;
+ int rv;
+
+ /* Map the i/o space. */
+ if (bus_io_map(bc, ia->ia_iobase, LMS_NPORTS, &ioh))
+ return 0;
+
+ rv = 0;
/* Configure and check for port present. */
- outb(iobase + LMS_CONFIG, 0x91);
+ bus_io_write_1(bc, ioh, LMS_CONFIG, 0x91);
delay(10);
- outb(iobase + LMS_SIGN, 0x0c);
+ bus_io_write_1(bc, ioh, LMS_SIGN, 0x0c);
delay(10);
- if (inb(iobase + LMS_SIGN) != 0x0c)
- return 0;
- outb(iobase + LMS_SIGN, 0x50);
+ if (bus_io_read_1(bc, ioh, LMS_SIGN) != 0x0c)
+ goto out;
+ bus_io_write_1(bc, ioh, LMS_SIGN, 0x50);
delay(10);
- if (inb(iobase + LMS_SIGN) != 0x50)
- return 0;
+ if (bus_io_read_1(bc, ioh, LMS_SIGN) != 0x50)
+ goto out;
/* Disable interrupts. */
- outb(iobase + LMS_CNTRL, 0x10);
+ bus_io_write_1(bc, ioh, LMS_CNTRL, 0x10);
+ rv = 1;
ia->ia_iosize = LMS_NPORTS;
ia->ia_msize = 0;
- return 1;
+
+out:
+ bus_io_unmap(bc, ioh, LMS_NPORTS);
+ return rv;
}
void
@@ -116,11 +134,12 @@ lmsattach(parent, self, aux)
printf("\n");
/* Other initialization was done by lmsprobe. */
- sc->sc_iobase = iobase;
- sc->sc_state = 0;
+ sc->sc_bc = ia->ia_bc;
+ if (bus_io_map(sc->sc_bc, ia->ia_iobase, LMS_NPORTS, &sc->sc_ioh))
+ panic("lmsattach: couldn't map I/O ports");
- sc->sc_ih = isa_intr_establish(ia->ia_irq, IST_PULSE, IPL_TTY, lmsintr,
- sc, sc->sc_dev.dv_xname);
+ sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_PULSE,
+ IPL_TTY, lmsintr, sc, sc->sc_dev.dv_xname);
}
int
@@ -131,9 +150,9 @@ lmsopen(dev, flag)
int unit = LMSUNIT(dev);
struct lms_softc *sc;
- if (unit >= lmscd.cd_ndevs)
+ if (unit >= lms_cd.cd_ndevs)
return ENXIO;
- sc = lmscd.cd_devs[unit];
+ sc = lms_cd.cd_devs[unit];
if (!sc)
return ENXIO;
@@ -148,7 +167,7 @@ lmsopen(dev, flag)
sc->sc_x = sc->sc_y = 0;
/* Enable interrupts. */
- outb(sc->sc_iobase + LMS_CNTRL, 0);
+ bus_io_write_1(sc->sc_bc, sc->sc_ioh, LMS_CNTRL, 0);
return 0;
}
@@ -158,10 +177,10 @@ lmsclose(dev, flag)
dev_t dev;
int flag;
{
- struct lms_softc *sc = lmscd.cd_devs[LMSUNIT(dev)];
+ struct lms_softc *sc = lms_cd.cd_devs[LMSUNIT(dev)];
/* Disable interrupts. */
- outb(sc->sc_iobase + LMS_CNTRL, 0x10);
+ bus_io_write_1(sc->sc_bc, sc->sc_ioh, LMS_CNTRL, 0x10);
sc->sc_state &= ~LMS_OPEN;
@@ -176,7 +195,7 @@ lmsread(dev, uio, flag)
struct uio *uio;
int flag;
{
- struct lms_softc *sc = lmscd.cd_devs[LMSUNIT(dev)];
+ struct lms_softc *sc = lms_cd.cd_devs[LMSUNIT(dev)];
int s;
int error;
size_t length;
@@ -224,7 +243,7 @@ lmsioctl(dev, cmd, addr, flag)
caddr_t addr;
int flag;
{
- struct lms_softc *sc = lmscd.cd_devs[LMSUNIT(dev)];
+ struct lms_softc *sc = lms_cd.cd_devs[LMSUNIT(dev)];
struct mouseinfo info;
int s;
int error;
@@ -274,7 +293,8 @@ lmsintr(arg)
void *arg;
{
struct lms_softc *sc = arg;
- int iobase = sc->sc_iobase;
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
u_char hi, lo, buttons, changed;
char dx, dy;
u_char buffer[5];
@@ -283,22 +303,22 @@ lmsintr(arg)
/* Interrupts are not expected. */
return 0;
- outb(iobase + LMS_CNTRL, 0xab);
- hi = inb(iobase + LMS_DATA);
- outb(iobase + LMS_CNTRL, 0x90);
- lo = inb(iobase + LMS_DATA);
+ bus_io_write_1(bc, ioh, LMS_CNTRL, 0xab);
+ hi = bus_io_read_1(bc, ioh, LMS_DATA);
+ bus_io_write_1(bc, ioh, LMS_CNTRL, 0x90);
+ lo = bus_io_read_1(bc, ioh, LMS_DATA);
dx = ((hi & 0x0f) << 4) | (lo & 0x0f);
/* Bounding at -127 avoids a bug in XFree86. */
dx = (dx == -128) ? -127 : dx;
- outb(iobase + LMS_CNTRL, 0xf0);
- hi = inb(iobase + LMS_DATA);
- outb(iobase + LMS_CNTRL, 0xd0);
- lo = inb(iobase + LMS_DATA);
+ bus_io_write_1(bc, ioh, LMS_CNTRL, 0xf0);
+ hi = bus_io_read_1(bc, ioh, LMS_DATA);
+ bus_io_write_1(bc, ioh, LMS_CNTRL, 0xd0);
+ lo = bus_io_read_1(bc, ioh, LMS_DATA);
dy = ((hi & 0x0f) << 4) | (lo & 0x0f);
dy = (dy == -128) ? 127 : -dy;
- outb(iobase + LMS_CNTRL, 0);
+ bus_io_write_1(bc, ioh, LMS_CNTRL, 0);
buttons = (~hi >> 5) & 0x07;
changed = ((buttons ^ sc->sc_status) & 0x07) << 3;
@@ -332,7 +352,7 @@ lmsselect(dev, rw, p)
int rw;
struct proc *p;
{
- struct lms_softc *sc = lmscd.cd_devs[LMSUNIT(dev)];
+ struct lms_softc *sc = lms_cd.cd_devs[LMSUNIT(dev)];
int s;
int ret;
diff --git a/sys/arch/i386/isa/mms.c b/sys/arch/i386/isa/mms.c
index aa32db40e1c..6dc4a533fc8 100644
--- a/sys/arch/i386/isa/mms.c
+++ b/sys/arch/i386/isa/mms.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mms.c,v 1.20 1995/12/24 02:30:19 mycroft Exp $ */
+/* $NetBSD: mms.c,v 1.22 1996/04/11 22:15:20 cgd Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles Hannum.
@@ -68,8 +68,12 @@ int mmsprobe __P((struct device *, void *, void *));
void mmsattach __P((struct device *, struct device *, void *));
int mmsintr __P((void *));
-struct cfdriver mmscd = {
- NULL, "mms", mmsprobe, mmsattach, DV_TTY, sizeof(struct mms_softc)
+struct cfattach mms_ca = {
+ sizeof(struct mms_softc), mmsprobe, mmsattach
+};
+
+struct cfdriver mms_cd = {
+ NULL, "mms", DV_TTY
};
#define MMSUNIT(dev) (minor(dev))
@@ -109,8 +113,8 @@ mmsattach(parent, self, aux)
sc->sc_iobase = iobase;
sc->sc_state = 0;
- sc->sc_ih = isa_intr_establish(ia->ia_irq, IST_PULSE, IPL_TTY, mmsintr,
- sc, sc->sc_dev.dv_xname);
+ sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_PULSE,
+ IPL_TTY, mmsintr, sc, sc->sc_dev.dv_xname);
}
int
@@ -121,9 +125,9 @@ mmsopen(dev, flag)
int unit = MMSUNIT(dev);
struct mms_softc *sc;
- if (unit >= mmscd.cd_ndevs)
+ if (unit >= mms_cd.cd_ndevs)
return ENXIO;
- sc = mmscd.cd_devs[unit];
+ sc = mms_cd.cd_devs[unit];
if (!sc)
return ENXIO;
@@ -149,7 +153,7 @@ mmsclose(dev, flag)
dev_t dev;
int flag;
{
- struct mms_softc *sc = mmscd.cd_devs[MMSUNIT(dev)];
+ struct mms_softc *sc = mms_cd.cd_devs[MMSUNIT(dev)];
/* Disable interrupts. */
outb(sc->sc_iobase + MMS_ADDR, 0x87);
@@ -167,7 +171,7 @@ mmsread(dev, uio, flag)
struct uio *uio;
int flag;
{
- struct mms_softc *sc = mmscd.cd_devs[MMSUNIT(dev)];
+ struct mms_softc *sc = mms_cd.cd_devs[MMSUNIT(dev)];
int s;
int error;
size_t length;
@@ -215,7 +219,7 @@ mmsioctl(dev, cmd, addr, flag)
caddr_t addr;
int flag;
{
- struct mms_softc *sc = mmscd.cd_devs[MMSUNIT(dev)];
+ struct mms_softc *sc = mms_cd.cd_devs[MMSUNIT(dev)];
struct mouseinfo info;
int s;
int error;
@@ -327,7 +331,7 @@ mmsselect(dev, rw, p)
int rw;
struct proc *p;
{
- struct mms_softc *sc = mmscd.cd_devs[MMSUNIT(dev)];
+ struct mms_softc *sc = mms_cd.cd_devs[MMSUNIT(dev)];
int s;
int ret;
diff --git a/sys/arch/i386/isa/npx.c b/sys/arch/i386/isa/npx.c
index 46d7f3476f8..1eac3fca162 100644
--- a/sys/arch/i386/isa/npx.c
+++ b/sys/arch/i386/isa/npx.c
@@ -1,4 +1,4 @@
-/* $NetBSD: npx.c,v 1.53 1996/01/07 02:00:31 mycroft Exp $ */
+/* $NetBSD: npx.c,v 1.55 1996/04/11 22:15:22 cgd Exp $ */
#if 0
#define iprintf(x) printf x
@@ -115,8 +115,12 @@ struct npx_softc {
int npxprobe __P((struct device *, void *, void *));
void npxattach __P((struct device *, struct device *, void *));
-struct cfdriver npxcd = {
- NULL, "npx", npxprobe, npxattach, DV_DULL, sizeof(struct npx_softc)
+struct cfattach npx_ca = {
+ sizeof(struct npx_softc), npxprobe, npxattach
+};
+
+struct cfdriver npx_cd = {
+ NULL, "npx", DV_DULL
};
enum npx_type {
@@ -325,8 +329,8 @@ npxattach(parent, self, aux)
case NPX_INTERRUPT:
printf("\n");
lcr0(rcr0() & ~CR0_NE);
- sc->sc_ih = isa_intr_establish(ia->ia_irq, IST_EDGE, IPL_NONE,
- npxintr, 0, sc->sc_dev.dv_xname);
+ sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq,
+ IST_EDGE, IPL_NONE, npxintr, 0, sc->sc_dev.dv_xname);
break;
case NPX_EXCEPTION:
printf(": using exception 16\n");
diff --git a/sys/arch/i386/isa/pccons.c b/sys/arch/i386/isa/pccons.c
index 8ce645e44e8..82ea0e8eb70 100644
--- a/sys/arch/i386/isa/pccons.c
+++ b/sys/arch/i386/isa/pccons.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pccons.c,v 1.7 1996/04/18 17:12:18 niklas Exp $ */
-/* $NetBSD: pccons.c,v 1.92 1996/03/16 06:08:46 thorpej Exp $ */
+/* $OpenBSD: pccons.c,v 1.8 1996/04/21 22:17:01 deraadt Exp $ */
+/* $NetBSD: pccons.c,v 1.96 1996/04/11 22:15:25 cgd Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved.
@@ -124,8 +124,12 @@ int pcprobe __P((struct device *, void *, void *));
void pcattach __P((struct device *, struct device *, void *));
int pcintr __P((void *));
-struct cfdriver pccd = {
- NULL, "pc", pcprobe, pcattach, DV_TTY, sizeof(struct pc_softc)
+struct cfattach pc_ca = {
+ sizeof(struct pc_softc), pcprobe, pcattach
+};
+
+struct cfdriver pc_cd = {
+ NULL, "pc", DV_TTY
};
#define COL 80
@@ -151,6 +155,8 @@ static unsigned int addr_6845 = MONO_BASE;
char *sget __P((void));
void sput __P((u_char *, int));
+void pc_xmode_on __P((void));
+void pc_xmode_off __P((void));
void pcstart();
int pcparam();
@@ -476,15 +482,15 @@ pcattach(parent, self, aux)
printf(": %s\n", vs.color ? "color" : "mono");
do_async_update(1);
- sc->sc_ih = isa_intr_establish(ia->ia_irq, IST_EDGE, IPL_TTY, pcintr,
- sc, sc->sc_dev.dv_xname);
+ sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
+ IPL_TTY, pcintr, sc, sc->sc_dev.dv_xname);
/*
* Look for children of the keyboard controller.
* XXX Really should decouple keyboard controller
* from the console code.
*/
- while (config_found(self, NULL, NULL))
+ while (config_found(self, ia->ia_ic, NULL) != NULL) /* XXX */
/* will break when no more children */ ;
}
@@ -498,9 +504,9 @@ pcopen(dev, flag, mode, p)
int unit = PCUNIT(dev);
struct tty *tp;
- if (unit >= pccd.cd_ndevs)
+ if (unit >= pc_cd.cd_ndevs)
return ENXIO;
- sc = pccd.cd_devs[unit];
+ sc = pc_cd.cd_devs[unit];
if (sc == 0)
return ENXIO;
@@ -535,7 +541,7 @@ pcclose(dev, flag, mode, p)
int flag, mode;
struct proc *p;
{
- struct pc_softc *sc = pccd.cd_devs[PCUNIT(dev)];
+ struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)];
struct tty *tp = sc->sc_tty;
(*linesw[tp->t_line].l_close)(tp, flag);
@@ -552,7 +558,7 @@ pcread(dev, uio, flag)
struct uio *uio;
int flag;
{
- struct pc_softc *sc = pccd.cd_devs[PCUNIT(dev)];
+ struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)];
struct tty *tp = sc->sc_tty;
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
@@ -564,7 +570,7 @@ pcwrite(dev, uio, flag)
struct uio *uio;
int flag;
{
- struct pc_softc *sc = pccd.cd_devs[PCUNIT(dev)];
+ struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)];
struct tty *tp = sc->sc_tty;
return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
@@ -574,7 +580,7 @@ struct tty *
pctty(dev)
dev_t dev;
{
- struct pc_softc *sc = pccd.cd_devs[PCUNIT(dev)];
+ struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)];
struct tty *tp = sc->sc_tty;
return (tp);
@@ -617,7 +623,7 @@ pcioctl(dev, cmd, data, flag, p)
int flag;
struct proc *p;
{
- struct pc_softc *sc = pccd.cd_devs[PCUNIT(dev)];
+ struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)];
struct tty *tp = sc->sc_tty;
int error;
@@ -762,6 +768,7 @@ pccnputc(dev, c)
}
/* ARGSUSED */
+int
pccngetc(dev)
dev_t dev;
{
@@ -800,8 +807,8 @@ pccnpollc(dev, on)
* interrupts.
*/
unit = PCUNIT(dev);
- if (pccd.cd_ndevs > unit) {
- sc = pccd.cd_devs[unit];
+ if (pc_cd.cd_ndevs > unit) {
+ sc = pc_cd.cd_devs[unit];
if (sc != 0) {
s = spltty();
pcintr(sc);
@@ -1640,6 +1647,7 @@ pcmmap(dev, offset, nprot)
return i386_btop(0xa0000 + offset);
}
+void
pc_xmode_on()
{
struct trapframe *fp;
@@ -1661,6 +1669,7 @@ pc_xmode_on()
#endif
}
+void
pc_xmode_off()
{
struct trapframe *fp;
diff --git a/sys/arch/i386/isa/pcvt/Etc/ttys.pcvt.netbsd b/sys/arch/i386/isa/pcvt/Etc/ttys.pcvt.netbsd
index 12524af0ec5..114232c65b4 100644
--- a/sys/arch/i386/isa/pcvt/Etc/ttys.pcvt.netbsd
+++ b/sys/arch/i386/isa/pcvt/Etc/ttys.pcvt.netbsd
@@ -1,6 +1,6 @@
#---------------------------------------------------------------------------
#
-# sample /etc/ttys file for pcvt driver and pcvt25h terminal emulation
+# sample /etc/ttys file for pcvt driver and pcvt25 terminal emulation
#
# last edit-date: [Sun Feb 26 12:30:09 1995]
#
@@ -11,18 +11,18 @@
#
# name getty type status comments
#
-console "/usr/libexec/getty Pcvt" pcvt25h off secure
+console "/usr/libexec/getty Pcvt" pcvt25 off secure
#
# the following lines are for the pcvt driver
#
-ttyv0 "/usr/libexec/getty Pcvt" pcvt25h on secure
-ttyv1 "/usr/libexec/getty Pcvt" pcvt25h on secure
-ttyv2 "/usr/libexec/getty Pcvt" pcvt25h on secure
-ttyv3 "/usr/libexec/getty Pcvt" pcvt25h on secure
-ttyv4 "/usr/libexec/getty Pcvt" pcvt25h on secure
-ttyv5 "/usr/libexec/getty Pcvt" pcvt25h on secure
-ttyv6 "/usr/libexec/getty Pcvt" pcvt25h off secure # X11 :1
-ttyv7 "/usr/libexec/getty Pcvt" pcvt25h off secure # X11 :0
+ttyv0 "/usr/libexec/getty Pcvt" pcvt25 on secure
+ttyv1 "/usr/libexec/getty Pcvt" pcvt25 on secure
+ttyv2 "/usr/libexec/getty Pcvt" pcvt25 on secure
+ttyv3 "/usr/libexec/getty Pcvt" pcvt25 on secure
+ttyv4 "/usr/libexec/getty Pcvt" pcvt25 on secure
+ttyv5 "/usr/libexec/getty Pcvt" pcvt25 on secure
+ttyv6 "/usr/libexec/getty Pcvt" pcvt25 off secure # X11 :1
+ttyv7 "/usr/libexec/getty Pcvt" pcvt25 off secure # X11 :0
#
# Hardwired lines are marked off, by default, so getty(8)
# is quiet when they don't exist.
diff --git a/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c b/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c
index cac5b485a16..99bf4028fa5 100644
--- a/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c
+++ b/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c
@@ -189,8 +189,6 @@ char *argv[];
fprintf(stderr,"Operating System = %s\t", p);
fprintf(stderr,"OS Release Id = %u\n", pcvtinfo.opsysrel);
fprintf(stderr,"PCVT_NSCREENS = %u\t\t", pcvtinfo.nscreens);
- fprintf(stderr,"PCVT_UPDATEFAST = %u\n", pcvtinfo.updatefast);
- fprintf(stderr,"PCVT_UPDATESLOW = %u\t\t", pcvtinfo.updateslow);
fprintf(stderr,"PCVT_SYSBEEPF = %u\n", pcvtinfo.sysbeepf);
fprintf(stderr,"PCVT_PCBURST = %u\t\t", pcvtinfo.pcburst);
fprintf(stderr,"PCVT_KBD_FIFO_SZ = %u\n\n", pcvtinfo.kbd_fifo_sz);
@@ -281,8 +279,6 @@ char *argv[];
{
fprintf(stderr,"BSD Version = %u\n", pcvtinfo.opsys);
fprintf(stderr,"PCVT_NSCREENS = %u\n", pcvtinfo.nscreens);
- fprintf(stderr,"PCVT_UPDATEFAST = %u\n", pcvtinfo.updatefast);
- fprintf(stderr,"PCVT_UPDATESLOW = %u\n", pcvtinfo.updateslow);
fprintf(stderr,"PCVT_SYSBEEPF = %u\n", pcvtinfo.sysbeepf);
fprintf(stderr,"Compile options = 0x%08X\n", pcvtinfo.compile_opts);
}
diff --git a/sys/arch/i386/isa/pcvt/Util/kbdio/Makefile b/sys/arch/i386/isa/pcvt/Util/kbdio/Makefile
index daebe80d967..5138a0cceb8 100644
--- a/sys/arch/i386/isa/pcvt/Util/kbdio/Makefile
+++ b/sys/arch/i386/isa/pcvt/Util/kbdio/Makefile
@@ -8,6 +8,7 @@ YFLAGS+= -v # verbose
LFLAGS+= -I
LDADD= -lm -ly -ll
+DPADD= ${LIBM} ${LIBY} ${LIBL}
NOMAN=
NOSHARED= no shared linkage
diff --git a/sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.4 b/sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.4
index d3bef826d6c..e3ac67b7c14 100644
--- a/sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.4
+++ b/sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.4
@@ -764,8 +764,6 @@ struct pcvtinfo {
u_int opsysrel; /* Release for NetBSD/FreeBSD */
u_int nscreens; /* PCVT_NSCREENS */
u_int scanset; /* PCVT_SCANSET */
- u_int updatefast; /* PCVT_UPDATEFAST */
- u_int updateslow; /* PCVT_UPDATESLOW */
u_int sysbeepf; /* PCVT_SYSBEEPF */
/* config booleans */
diff --git a/sys/arch/i386/isa/pcvt/Util/vgaio/Makefile b/sys/arch/i386/isa/pcvt/Util/vgaio/Makefile
index 253d5ec18e1..911f2f96b32 100644
--- a/sys/arch/i386/isa/pcvt/Util/vgaio/Makefile
+++ b/sys/arch/i386/isa/pcvt/Util/vgaio/Makefile
@@ -9,6 +9,7 @@ YACC= yacc
LFLAGS+= -I
LDADD= -lm -ly -ll
+DPADD= ${LIBM} ${LIBY} ${LIBL}
CFLAGS+= -I ${.CURDIR}/obj -I ${.CURDIR} -g
diff --git a/sys/arch/i386/isa/pcvt/pcvt_drv.c b/sys/arch/i386/isa/pcvt/pcvt_drv.c
index 671749e0ed3..a7eafd4d635 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_drv.c
+++ b/sys/arch/i386/isa/pcvt/pcvt_drv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcvt_drv.c,v 1.9 1996/04/18 17:48:28 niklas Exp $ */
+/* $OpenBSD: pcvt_drv.c,v 1.10 1996/04/21 22:17:07 deraadt Exp $ */
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
@@ -341,8 +341,8 @@ pcattach(struct isa_device *dev)
#if PCVT_NETBSD > 9
#if PCVT_NETBSD > 101
- sc->sc_ih = isa_intr_establish(ia->ia_irq, IST_EDGE, IPL_TTY, pcintr,
- (void *)0, sc->sc_dev.dv_xname);
+ sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
+ IPL_TTY, pcintr, (void *)0, sc->sc_dev.dv_xname);
#if PCVT_NETBSD > 110
/*
@@ -350,9 +350,9 @@ pcattach(struct isa_device *dev)
* XXX Really should decouple keyboard controller
* from the console code.
*/
- while (config_found(self, NULL, NULL))
+ while (config_found(self, ia->ia_ic, NULL) != NULL)
/* will break when no more children */ ;
-#endif /* PVCT_NETBSD > 110 */
+#endif /* PCVT_NETBSD > 110 */
#else /* PCVT_NETBSD > 100 */
vthand.ih_fun = pcrint;
vthand.ih_arg = 0;
@@ -1235,9 +1235,13 @@ pccncheckc(Dev_t dev)
void
pccnpollc(Dev_t dev, int on)
{
+#if PCVT_NETBSD > 110
+ struct vt_softc *sc = NULL; /* XXX not used */
+#else
#if PCVT_NETBSD > 101
struct vt_softc *sc = vtcd.cd_devs[0]; /* XXX */
#endif
+#endif
kbd_polling = on;
if (!on) {
diff --git a/sys/arch/i386/isa/pcvt/pcvt_hdr.h b/sys/arch/i386/isa/pcvt/pcvt_hdr.h
index 0427ebabefd..222d09e839e 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_hdr.h
+++ b/sys/arch/i386/isa/pcvt/pcvt_hdr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcvt_hdr.h,v 1.6 1996/04/18 17:48:31 niklas Exp $ */
+/* $OpenBSD: pcvt_hdr.h,v 1.7 1996/04/21 22:17:09 deraadt Exp $ */
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
@@ -907,6 +907,15 @@ struct vt_softc {
int pcprobe ();
void pcattach ();
+#if PCVT_NETBSD > 110
+struct cfattach vt_ca = {
+ sizeof(struct vt_softc), pcprobe, pcattach
+};
+
+struct cfdriver vt_cd = {
+ NULL, "vt", DV_TTY
+};
+#else /* !PCVT_NETBSD > 110 */
#if PCVT_NETBSD > 101
struct cfdriver vtcd = {
NULL, "vt", pcprobe, pcattach, DV_TTY, sizeof(struct vt_softc)
@@ -916,6 +925,7 @@ struct cfdriver vtcd = {
NULL, "vt", pcprobe, pcattach, DV_TTY, sizeof(struct device)
};
#endif /* PCVT_NETBSD > 101 */
+#endif /* PCVT_NETBSD > 110 */
#else /* !PCVT_NETBSD > 9 */
diff --git a/sys/arch/i386/isa/pms.c b/sys/arch/i386/isa/pms.c
index 12bb0e81548..e3ba04481b0 100644
--- a/sys/arch/i386/isa/pms.c
+++ b/sys/arch/i386/isa/pms.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pms.c,v 1.6 1996/04/18 17:12:20 niklas Exp $ */
-/* $NetBSD: pms.c,v 1.25 1996/03/16 06:08:50 thorpej Exp $ */
+/* $OpenBSD: pms.c,v 1.7 1996/04/21 22:17:02 deraadt Exp $ */
+/* $NetBSD: pms.c,v 1.27 1996/04/11 22:15:27 cgd Exp $ */
/*-
* Copyright (c) 1994 Charles Hannum.
@@ -105,8 +105,12 @@ int pmsprobe __P((struct device *, void *, void *));
void pmsattach __P((struct device *, struct device *, void *));
int pmsintr __P((void *));
-struct cfdriver pmscd = {
- NULL, "pms", pmsprobe, pmsattach, DV_TTY, sizeof(struct pms_softc)
+struct cfattach pms_ca = {
+ sizeof(struct pms_softc), pmsprobe, pmsattach,
+};
+
+struct cfdriver pms_cd = {
+ NULL, "pms", DV_TTY
};
#define PMSUNIT(dev) (minor(dev))
@@ -200,14 +204,15 @@ pmsattach(parent, self, aux)
{
struct pms_softc *sc = (void *)self;
int irq = self->dv_cfdata->cf_loc[0];
+ isa_chipset_tag_t ic = aux; /* XXX */
printf(" irq %d\n", irq);
/* Other initialization was done by pmsprobe. */
sc->sc_state = 0;
- sc->sc_ih = isa_intr_establish(irq, IST_EDGE, IPL_TTY, pmsintr,
- sc, sc->sc_dev.dv_xname);
+ sc->sc_ih = isa_intr_establish(ic, irq, IST_EDGE, IPL_TTY,
+ pmsintr, sc, sc->sc_dev.dv_xname);
}
int
@@ -218,9 +223,9 @@ pmsopen(dev, flag)
int unit = PMSUNIT(dev);
struct pms_softc *sc;
- if (unit >= pmscd.cd_ndevs)
+ if (unit >= pms_cd.cd_ndevs)
return ENXIO;
- sc = pmscd.cd_devs[unit];
+ sc = pms_cd.cd_devs[unit];
if (!sc)
return ENXIO;
@@ -255,7 +260,7 @@ pmsclose(dev, flag)
dev_t dev;
int flag;
{
- struct pms_softc *sc = pmscd.cd_devs[PMSUNIT(dev)];
+ struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
/* Disable interrupts. */
pms_dev_cmd(PMS_DEV_DISABLE);
@@ -275,7 +280,7 @@ pmsread(dev, uio, flag)
struct uio *uio;
int flag;
{
- struct pms_softc *sc = pmscd.cd_devs[PMSUNIT(dev)];
+ struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
int s;
int error;
size_t length;
@@ -323,7 +328,7 @@ pmsioctl(dev, cmd, addr, flag)
caddr_t addr;
int flag;
{
- struct pms_softc *sc = pmscd.cd_devs[PMSUNIT(dev)];
+ struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
struct mouseinfo info;
int s;
int error;
@@ -446,7 +451,7 @@ pmsselect(dev, rw, p)
int rw;
struct proc *p;
{
- struct pms_softc *sc = pmscd.cd_devs[PMSUNIT(dev)];
+ struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
int s;
int ret;
diff --git a/sys/arch/i386/isa/spkr.c b/sys/arch/i386/isa/spkr.c
index 7db0a7b962c..bb427dd0f18 100644
--- a/sys/arch/i386/isa/spkr.c
+++ b/sys/arch/i386/isa/spkr.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: spkr.c,v 1.6 1996/04/21 22:17:04 deraadt Exp $ */
/* $NetBSD: spkr.c,v 1.22 1996/03/18 01:26:12 jtk Exp $ */
/*
@@ -38,8 +39,12 @@ struct spkr_softc {
struct device sc_dev;
};
-struct cfdriver spkrcd = {
- NULL, "spkr", spkrprobe, spkrattach, DV_TTY, sizeof(struct spkr_softc)
+struct cfattach spkr_ca = {
+ sizeof(struct spkr_softc), spkrprobe, spkrattach
+};
+
+struct cfdriver spkr_cd = {
+ NULL, "spkr", DV_TTY
};
/**************** MACHINE DEPENDENT PART STARTS HERE *************************
@@ -433,6 +438,7 @@ int spkrprobe (parent, match, aux)
if (cf->cf_loc[1] != PITAUX_PORT)
return (0);
+ ia->ia_iosize = 1;
return (1);
}
@@ -480,7 +486,7 @@ struct uio *uio;
dev, uio->uio_resid);
#endif /* DEBUG */
- if (minor(dev) != 0)
+ if (minor(dev) != 0 || !spkr_attached)
return(ENXIO);
else
{
diff --git a/sys/arch/i386/pci/pci_compat.c b/sys/arch/i386/pci/pci_compat.c
new file mode 100644
index 00000000000..6ef68db2637
--- /dev/null
+++ b/sys/arch/i386/pci/pci_compat.c
@@ -0,0 +1,128 @@
+/* $NetBSD: pci_compat.c,v 1.1 1996/03/27 04:01:13 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
+ * Copyright (c) 1994 Charles Hannum. 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 Charles Hannum.
+ * 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.
+ */
+
+/*
+ * Compatibility functions, for use with old NetBSD/i386 PCI code.
+ *
+ * These should go away when all drivers are converted to the new
+ * interfaces.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <vm/vm.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+
+__warn_references(pci_map_int,
+ "uses pci_map_int() compatibility interface");
+
+void *
+pci_map_int(tag, level, func, arg)
+ pcitag_t tag;
+ int level;
+ int (*func) __P((void *));
+ void *arg;
+{
+ pci_intr_handle_t ih;
+ pcireg_t data;
+ int pin, line;
+ const char *intrstr;
+ void *rv;
+
+ data = pci_conf_read(NULL, tag, PCI_INTERRUPT_REG);
+
+ pin = PCI_INTERRUPT_PIN(data);
+ line = PCI_INTERRUPT_LINE(data);
+
+ if (pci_intr_map(NULL, tag, pin, line, &ih))
+ return NULL;
+ intrstr = pci_intr_string(NULL, ih);
+ rv = pci_intr_establish(NULL, ih, level, func, arg, NULL);
+ if (rv == NULL)
+ printf("pci_map_int: failed to map interrupt\n");
+ else if (intrstr != NULL)
+ printf("pci_map_int: interrupting at %s\n", intrstr);
+ return (rv);
+}
+
+__warn_references(pci_map_io,
+ "uses pci_map_io() compatibility interface");
+
+int
+pci_map_io(tag, reg, iobasep)
+ pcitag_t tag;
+ int reg;
+ int *iobasep;
+{
+ bus_io_addr_t ioaddr;
+ bus_io_size_t iosize;
+ bus_io_handle_t ioh;
+
+ if (pci_io_find(NULL, tag, reg, &ioaddr, &iosize))
+ return (1);
+ if (bus_io_map(NULL, ioaddr, iosize, &ioh))
+ return (1);
+
+ *iobasep = ioh;
+
+ return 0;
+}
+
+__warn_references(pci_map_mem,
+ "uses pci_map_mem() compatibility interface");
+
+int
+pci_map_mem(tag, reg, vap, pap)
+ pcitag_t tag;
+ int reg;
+ vm_offset_t *vap, *pap;
+{
+ bus_mem_addr_t memaddr;
+ bus_mem_size_t memsize;
+ bus_mem_handle_t memh;
+ int cacheable;
+
+ if (pci_mem_find(NULL, tag, reg, &memaddr, &memsize, &cacheable))
+ return (1);
+ if (bus_mem_map(NULL, memaddr, memsize, cacheable, &memh))
+ return (1);
+
+ *vap = (vm_offset_t)memh;
+ *pap = memaddr;
+
+ return 0;
+}
diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c
index b05b5be8385..9f27116fbae 100644
--- a/sys/arch/i386/pci/pci_machdep.c
+++ b/sys/arch/i386/pci/pci_machdep.c
@@ -1,6 +1,7 @@
-/* $NetBSD: pci_machdep.c,v 1.20 1996/03/04 19:39:31 cgd Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.23 1996/04/11 22:15:33 cgd Exp $ */
/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
* Copyright (c) 1994 Charles Hannum. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -67,8 +68,37 @@ int pci_mode = -1;
#define PCI_MODE2_ENABLE_REG 0x0cf8
#define PCI_MODE2_FORWARD_REG 0x0cfa
+void
+pci_attach_hook(parent, self, pba)
+ struct device *parent, *self;
+ struct pcibus_attach_args *pba;
+{
+
+ if (pba->pba_bus == 0)
+ printf(": configuration mode %d", pci_mode);
+}
+
+int
+pci_bus_maxdevs(pc, busno)
+ pci_chipset_tag_t pc;
+ int busno;
+{
+
+ /*
+ * Bus number is irrelevant. If Configuration Mechanism 2 is in
+ * use, can only have devices 0-15 on any bus. If Configuration
+ * Mechanism 1 is in use, can have devices 0-32 (i.e. the `normal'
+ * range).
+ */
+ if (pci_mode == 2)
+ return (16);
+ else
+ return (32);
+}
+
pcitag_t
-pci_make_tag(bus, device, function)
+pci_make_tag(pc, bus, device, function)
+ pci_chipset_tag_t pc;
int bus, device, function;
{
pcitag_t tag;
@@ -107,7 +137,8 @@ mode2:
}
pcireg_t
-pci_conf_read(tag, reg)
+pci_conf_read(pc, tag, reg)
+ pci_chipset_tag_t pc;
pcitag_t tag;
int reg;
{
@@ -143,7 +174,8 @@ mode2:
}
void
-pci_conf_write(tag, reg, data)
+pci_conf_write(pc, tag, reg, data)
+ pci_chipset_tag_t pc;
pcitag_t tag;
int reg;
pcireg_t data;
@@ -221,138 +253,21 @@ not1:
}
int
-pci_map_io(tag, reg, iobasep)
- pcitag_t tag;
- int reg;
- int *iobasep;
-{
- pcireg_t address;
- int iobase;
-
- if (reg < PCI_MAPREG_START || reg >= PCI_MAPREG_END || (reg & 3))
- panic("pci_map_io: bad request");
-
- address = pci_conf_read(tag, reg);
-
- if (PCI_MAPREG_TYPE(address) != PCI_MAPREG_TYPE_IO)
- panic("pci_map_io: not an I/O mapping register");
-
- iobase = PCI_MAPREG_IO_ADDR(address);
- *iobasep = iobase;
-
- return 0;
-}
-
-int
-pci_map_mem(tag, reg, vap, pap)
- pcitag_t tag;
- int reg;
- vm_offset_t *vap, *pap;
-{
- pcireg_t address, mask;
- int cachable;
- vm_size_t size;
- vm_offset_t va, pa;
-
- if (reg < PCI_MAPREG_START || reg >= PCI_MAPREG_END || (reg & 3))
- panic("pci_map_mem: bad request");
-
- /*
- * Section 6.2.5.1, `Address Maps', tells us that:
- *
- * 1) The builtin software should have already mapped the device in a
- * reasonable way.
- *
- * 2) A device which wants 2^n bytes of memory will hardwire the bottom
- * n bits of the address to 0. As recommended, we write all 1s and see
- * what we get back.
- */
- address = pci_conf_read(tag, reg);
- pci_conf_write(tag, reg, 0xffffffff);
- mask = pci_conf_read(tag, reg);
- pci_conf_write(tag, reg, address);
-
- if (PCI_MAPREG_TYPE(address) == PCI_MAPREG_TYPE_IO)
- panic("pci_map_mem: I/O mapping register");
-
- switch (address & PCI_MAPREG_MEM_TYPE_MASK) {
- case PCI_MAPREG_MEM_TYPE_32BIT:
- case PCI_MAPREG_MEM_TYPE_32BIT_1M:
- break;
- 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 register type\n");
- return EINVAL;
- }
-
- pa = PCI_MAPREG_MEM_ADDR(address);
- size = ~PCI_MAPREG_MEM_ADDR(mask) + 1;
- if (size < NBPG)
- size = NBPG;
-
- va = kmem_alloc_pageable(kernel_map, size);
- if (va == 0) {
- printf("pci_map_mem: not enough memory\n");
- return ENOMEM;
- }
-
- /*
- * Tell the driver where we mapped it.
- *
- * If the region is smaller than one page, adjust the virtual address
- * to the same page offset as the physical address.
- */
- *vap = va + (pa & PGOFSET);
- *pap = pa;
-
-#if 1
- printf("pci_map_mem: mapping memory at virtual %08x, physical %08x\n", *vap, *pap);
-#endif
-
- /* Map the space into the kernel page table. */
- cachable = PCI_MAPREG_MEM_CACHEABLE(address);
- pa &= ~PGOFSET;
- while (size) {
- pmap_enter(pmap_kernel(), va, pa, VM_PROT_READ | VM_PROT_WRITE,
- TRUE);
- if (!cachable)
- pmap_changebit(pa, PG_N, ~0);
- else
- pmap_changebit(pa, 0, ~PG_N);
- va += NBPG;
- pa += NBPG;
- size -= NBPG;
- }
-
- return 0;
-}
-
-void *
-pci_map_int(tag, level, func, arg, what)
- pcitag_t tag;
- int level;
- int (*func) __P((void *));
- void *arg;
- char *what;
-{
- pcireg_t data;
+pci_intr_map(pc, intrtag, pin, line, ihp)
+ pci_chipset_tag_t pc;
+ pcitag_t intrtag;
int pin, line;
-
- data = pci_conf_read(tag, PCI_INTERRUPT_REG);
-
- pin = PCI_INTERRUPT_PIN(data);
- line = PCI_INTERRUPT_LINE(data);
+ pci_intr_handle_t *ihp;
+{
if (pin == 0) {
/* No IRQ used. */
- return 0;
+ goto bad;
}
if (pin > 4) {
- printf("pci_map_int: bad interrupt pin %d\n", pin);
- return NULL;
+ printf("pci_intr_map: bad interrupt pin %d\n", pin);
+ goto bad;
}
/*
@@ -370,22 +285,62 @@ pci_map_int(tag, level, func, arg, what)
* the BIOS has not configured the device.
*/
if (line == 0 || line == 255) {
- printf("pci_map_int: no mapping for pin %c\n", '@' + pin);
- return NULL;
+ printf("pci_intr_map: no mapping for pin %c\n", '@' + pin);
+ goto bad;
} else {
if (line >= ICU_LEN) {
- printf("pci_map_int: bad interrupt line %d\n", line);
- return NULL;
+ printf("pci_intr_map: bad interrupt line %d\n", line);
+ goto bad;
}
if (line == 2) {
- printf("pci_map_int: changed line 2 to line 9\n");
+ printf("pci_intr_map: changed line 2 to line 9\n");
line = 9;
}
}
-#if 1
- printf("pci_map_int: pin %c mapped to line %d\n", '@' + pin, line);
-#endif
+ *ihp = line;
+ return 0;
+
+bad:
+ *ihp = -1;
+ return 1;
+}
+
+const char *
+pci_intr_string(pc, ih)
+ pci_chipset_tag_t pc;
+ pci_intr_handle_t ih;
+{
+ static char irqstr[8]; /* 4 + 2 + NULL + sanity */
+
+ if (ih == 0 || ih >= ICU_LEN || ih == 2)
+ panic("pci_intr_string: bogus handle 0x%x\n", ih);
+
+ sprintf(irqstr, "irq %d", ih);
+ return (irqstr);
+
+}
+
+void *
+pci_intr_establish(pc, ih, level, func, arg, what)
+ pci_chipset_tag_t pc;
+ pci_intr_handle_t ih;
+ int level, (*func) __P((void *));
+ void *arg;
+ char *what;
+{
+
+ if (ih == 0 || ih >= ICU_LEN || ih == 2)
+ panic("pci_intr_establish: bogus handle 0x%x\n", ih);
+
+ return isa_intr_establish(NULL, ih, IST_LEVEL, level, func, arg, what);
+}
+
+void
+pci_intr_disestablish(pc, cookie)
+ pci_chipset_tag_t pc;
+ void *cookie;
+{
- return isa_intr_establish(line, IST_LEVEL, level, func, arg, what);
+ return isa_intr_disestablish(NULL, cookie);
}
diff --git a/sys/arch/i386/pci/pci_machdep.h b/sys/arch/i386/pci/pci_machdep.h
index 43adfb2dfcb..e4c21cb3399 100644
--- a/sys/arch/i386/pci/pci_machdep.h
+++ b/sys/arch/i386/pci/pci_machdep.h
@@ -1,7 +1,8 @@
-/* $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 $ */
+/* $OpenBSD: pci_machdep.h,v 1.3 1996/04/21 22:17:34 deraadt Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.5 1996/03/27 04:01:16 cgd Exp $ */
/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
* Copyright (c) 1994 Charles Hannum. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,54 +33,63 @@
/*
* Machine-specific definitions for PCI autoconfiguration.
- *
- * See the comments in pci_machdep.c for more explanation.
*/
/*
+ * i386-specific PCI structure and type definitions.
+ * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
+ *
* Configuration tag; created from a {bus,device,function} triplet by
* pci_make_tag(), and passed to pci_conf_read() and pci_conf_write().
* We could instead always pass the {bus,device,function} triplet to
* the read and write routines, but this would cause extra overhead.
*
- * Machines other than PCs are likely to use the equivalent of mode 1
- * tags always. Mode 2 is historical and deprecated by the Revision
- * 2.0 specification.
+ * Mode 2 is historical and deprecated by the Revision 2.0 specification.
*/
-typedef union {
- u_long mode1;
+union i386_pci_tag_u {
+ u_int32_t mode1;
struct {
- u_short port;
- u_char enable;
- u_char forward;
+ u_int16_t port;
+ u_int8_t enable;
+ u_int8_t forward;
} mode2;
-} pcitag_t;
+};
/*
- * Type of a value read from or written to a configuration register.
- * Always 32 bits.
+ * Types provided to machine-independent PCI code
*/
-typedef u_int32_t pcireg_t;
+typedef void *pci_chipset_tag_t;
+typedef union i386_pci_tag_u pcitag_t;
+typedef int pci_intr_handle_t;
/*
- * PCs which use Configuration Mechanism #2 are limited to 16
- * devices per bus.
+ * i386-specific PCI variables and functions.
+ * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
*/
-#define PCI_MAX_DEVICE_NUMBER (pci_mode == 2 ? 16 : 32)
+extern int pci_mode;
+int pci_mode_detect __P((void));
/*
- * Hook for PCI bus attach function to do any necessary machine-specific
- * operations.
+ * Functions provided to machine-independent PCI code.
*/
-
-#define pci_md_attach_hook(parent, sc, pba) \
- do { \
- if (pba->pba_bus == 0) \
- printf(": configuration mode %d", pci_mode); \
- } while (0);
+void pci_attach_hook __P((struct device *, struct device *,
+ struct pcibus_attach_args *));
+int pci_bus_maxdevs __P((pci_chipset_tag_t, int));
+pcitag_t pci_make_tag __P((pci_chipset_tag_t, int, int, int));
+pcireg_t pci_conf_read __P((pci_chipset_tag_t, pcitag_t, int));
+void pci_conf_write __P((pci_chipset_tag_t, pcitag_t, int,
+ pcireg_t));
+int pci_intr_map __P((pci_chipset_tag_t, pcitag_t, int, int,
+ pci_intr_handle_t *));
+const char *pci_intr_string __P((pci_chipset_tag_t, pci_intr_handle_t));
+void *pci_intr_establish __P((pci_chipset_tag_t, pci_intr_handle_t,
+ int, int (*)(void *), void *, char *));
+void pci_intr_disestablish __P((pci_chipset_tag_t, void *));
/*
- * Miscellaneous variables and functions.
+ * Compatibility functions, to map the old i386 PCI functions to the new ones.
+ * NOT TO BE USED BY NEW CODE.
*/
-extern int pci_mode;
-extern int pci_mode_detect __P((void));
+void *pci_map_int __P((pcitag_t, int, int (*)(void *), void *));
+int pci_map_io __P((pcitag_t, int, int *));
+int pci_map_mem __P((pcitag_t, int, vm_offset_t *, vm_offset_t *));