summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorkstailey <kstailey@cvs.openbsd.org>1996-11-23 07:55:10 +0000
committerkstailey <kstailey@cvs.openbsd.org>1996-11-23 07:55:10 +0000
commitdf68e5d49bd93c29dab9220debdf630c32fe8c3f (patch)
treeec1558b565ce6e208d34b2348260e818f1222ce1 /sys
parent83cf43dbb741a19e8f7e7b4d69b91d78167dc970 (diff)
sync with NetBSD
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sun3/conf/COYOTE11
-rw-r--r--sys/arch/sun3/conf/DISKLESS1
-rw-r--r--sys/arch/sun3/conf/FOUR_TTYS1
-rw-r--r--sys/arch/sun3/conf/GENERIC17
-rw-r--r--sys/arch/sun3/conf/GENERIC_KGDB1
-rw-r--r--sys/arch/sun3/conf/Makefile.sun378
-rw-r--r--sys/arch/sun3/conf/RAMDISK3
-rw-r--r--sys/arch/sun3/conf/SMD_TEST1
-rw-r--r--sys/arch/sun3/conf/files.sun36
-rw-r--r--sys/arch/sun3/conf/std.sun317
-rw-r--r--sys/arch/sun3/dev/cg4.c442
-rw-r--r--sys/arch/sun3/dev/cg4reg.h51
-rw-r--r--sys/arch/sun3/dev/fbvar.h4
-rw-r--r--sys/arch/sun3/dev/idprom.c38
-rw-r--r--sys/arch/sun3/dev/if_ie.c4
-rw-r--r--sys/arch/sun3/dev/if_ie_obio.c70
-rw-r--r--sys/arch/sun3/dev/if_le.c95
-rw-r--r--sys/arch/sun3/dev/kd.c42
-rw-r--r--sys/arch/sun3/dev/memerr.c38
-rw-r--r--sys/arch/sun3/dev/obio.c78
-rw-r--r--sys/arch/sun3/dev/si.c78
-rw-r--r--sys/arch/sun3/dev/si_obio.c108
-rw-r--r--sys/arch/sun3/dev/si_vme.c110
-rw-r--r--sys/arch/sun3/dev/sivar.h48
-rw-r--r--sys/arch/sun3/dev/xd.c7
-rw-r--r--sys/arch/sun3/dev/zs.c44
-rw-r--r--sys/arch/sun3/include/autoconf.h42
-rw-r--r--sys/arch/sun3/include/conf.h14
-rw-r--r--sys/arch/sun3/include/float.h7
-rw-r--r--sys/arch/sun3/include/ieeefp.h3
-rw-r--r--sys/arch/sun3/include/obio.h71
-rw-r--r--sys/arch/sun3/include/types.h7
-rw-r--r--sys/arch/sun3/sun3/autoconf.c41
-rw-r--r--sys/arch/sun3/sun3/clock.c27
-rw-r--r--sys/arch/sun3/sun3/conf.c14
-rw-r--r--sys/arch/sun3/sun3/disksubr.c8
-rw-r--r--sys/arch/sun3/sun3/genassym.c32
-rw-r--r--sys/arch/sun3/sun3/intreg.c50
-rw-r--r--sys/arch/sun3/sun3/locore.s8
-rw-r--r--sys/arch/sun3/sun3/machdep.c195
40 files changed, 1130 insertions, 782 deletions
diff --git a/sys/arch/sun3/conf/COYOTE b/sys/arch/sun3/conf/COYOTE
index 1532b65d83e..75e44ccb5db 100644
--- a/sys/arch/sun3/conf/COYOTE
+++ b/sys/arch/sun3/conf/COYOTE
@@ -1,5 +1,5 @@
#
-# $OpenBSD: COYOTE,v 1.1 1996/11/12 00:01:47 kstailey Exp $
+# $OpenBSD: COYOTE,v 1.2 1996/11/23 07:54:46 kstailey Exp $
#
#
@@ -17,10 +17,13 @@ include "std.sun3"
maxusers 4
# Standard system options
-options SWAPPAGER, VNODEPAGER, DEVPAGER # paging
options KTRACE # system call tracing support
-#makeoptions DEBUG="-g" # symbols for kgdb + nm
+
+# Debugging options. Uncomment either this:
options DDB
+# ... or these two: (for KGDB on another machine)
+#makeoptions DEBUG="-g" # symbols for kgdb + nm
+#options KGDB
# Filesystem options
options NFSCLIENT # nfs client support
@@ -69,7 +72,7 @@ ms0 at zsc0 channel 1 # mouse
#
# Lance Ethernet (only onboard)
-le0 at obio0 addr ? level ?
+le0 at obio0 addr 0x120000 level 3
#
# Frame buffer devices
diff --git a/sys/arch/sun3/conf/DISKLESS b/sys/arch/sun3/conf/DISKLESS
index 263d7634919..70701fa8be7 100644
--- a/sys/arch/sun3/conf/DISKLESS
+++ b/sys/arch/sun3/conf/DISKLESS
@@ -16,7 +16,6 @@ options HAVECACHE # Sun3/260 VAC
maxusers 4
# Standard system options
-options SWAPPAGER, VNODEPAGER, DEVPAGER # paging
options KTRACE # system call tracing support
# Debugging options. Uncomment either this:
diff --git a/sys/arch/sun3/conf/FOUR_TTYS b/sys/arch/sun3/conf/FOUR_TTYS
index 52025702396..272fbfa1eaf 100644
--- a/sys/arch/sun3/conf/FOUR_TTYS
+++ b/sys/arch/sun3/conf/FOUR_TTYS
@@ -16,7 +16,6 @@ options HAVECACHE # Sun3/260 VAC
maxusers 4
# Standard system options
-options SWAPPAGER, VNODEPAGER, DEVPAGER # paging
options KTRACE # system call tracing support
# Debugging options. Uncomment either this:
diff --git a/sys/arch/sun3/conf/GENERIC b/sys/arch/sun3/conf/GENERIC
index 43ddc262554..8cc69d47d87 100644
--- a/sys/arch/sun3/conf/GENERIC
+++ b/sys/arch/sun3/conf/GENERIC
@@ -16,7 +16,6 @@ options HAVECACHE # Sun3/260 VAC
maxusers 4
# Standard system options
-options SWAPPAGER, VNODEPAGER, DEVPAGER # paging
options KTRACE # system call tracing support
# Debugging options. Uncomment either this:
@@ -78,18 +77,28 @@ ms0 at zsc0 channel 1 # mouse
#
# Intel Ethernet (onboard, or VME)
-ie0 at obio0 addr ? level ?
+ie0 at obio0 addr 0x0C0000 level 3
ie1 at vmes0 addr 0xffe88000 level 3 vect 0x75
# Lance Ethernet (only onboard)
-le0 at obio0 addr ? level ?
+le0 at obio0 addr 0x120000 level 3
#
# Disk and tape devices
#
# Sun3 "si" SCSI controller (NCR 5380)
-si0 at obio0 addr ? level ?
+# This driver has several flags which may be enabled by OR'ing
+# the values and using the "flags" directive. (PR#1929)
+# Valid flags are:
+#
+# 0x01 Use DMA (may be polled)
+# 0x02 Use DMA completion interrupts
+# 0x04 Allow disconnect/reselect
+#
+# E.g. "flags 0x07" would enable DMA, interrupts, and reselect.
+# Note: these values are quite a bit paranoid...
+si0 at obio0 addr 0x140000 level 2
si0 at vmes0 addr 0xff200000 level 2 vect 0x40
si1 at vmes0 addr 0xff204000 level 2 vect 0x41
diff --git a/sys/arch/sun3/conf/GENERIC_KGDB b/sys/arch/sun3/conf/GENERIC_KGDB
index 268cbcbd0de..840f2b5b9ff 100644
--- a/sys/arch/sun3/conf/GENERIC_KGDB
+++ b/sys/arch/sun3/conf/GENERIC_KGDB
@@ -16,7 +16,6 @@ options HAVECACHE # Sun3/260 VAC
maxusers 4
# Standard system options
-options SWAPPAGER, VNODEPAGER, DEVPAGER # paging
options KTRACE # system call tracing support
# Debugging options. Uncomment either this:
diff --git a/sys/arch/sun3/conf/Makefile.sun3 b/sys/arch/sun3/conf/Makefile.sun3
index a59fd9a88d3..7c128c0a4de 100644
--- a/sys/arch/sun3/conf/Makefile.sun3
+++ b/sys/arch/sun3/conf/Makefile.sun3
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.sun3,v 1.43 1996/02/29 20:57:38 cgd Exp $
+# $NetBSD: Makefile.sun3,v 1.51 1996/09/09 21:07:08 mycroft Exp $
# Makefile for NetBSD
#
@@ -7,7 +7,7 @@
# Most changes should be made in the machine description
# /sys/arch/sun3/conf/``machineid''
# after which you should do
-# config machineid
+# config machineid
# Machine generic makefile changes should be made in
# /sys/arch/sun3/conf/Makefile.sun3
# after which config should be rerun for all machines of that type.
@@ -21,24 +21,33 @@
# DEBUG is set to -g if debugging.
# PROF is set to -pg if profiling.
-AS?= as
CC?= cc
-CPP?= cpp
LD?= ld
-STRIP?= strip -d
-TOUCH?= touch -f -c
+MKDEP?= mkdep
+STRIP?= strip
# source tree is located via $S relative to the compilation directory
-S= ../../../..
-SUN3= ../..
-
-INCLUDES= -I. -I$S/arch -I$S
-CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dsun3
-CFLAGS= ${DEBUG} -O2 -Werror -msoft-float
+.ifndef S
+S!= cd ../../../..; pwd
+.endif
+SUN3= $S/arch/sun3
+
+# Override CPP defaults entirely, so cross-compilation works.
+INCLUDES= -I. -I$S/arch -I$S -nostdinc
+XDEFS= -undef -D__NetBSD__ -Dm68k -Dmc68000
+CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
+ -Dmc68020 -Dsun3 ${XDEFS}
+CWARNFLAGS= -Werror # -Wall -Wstrict-prototypes -Wmissing-prototypes
+CFLAGS= ${DEBUG} ${CWARNFLAGS} -O2 -msoft-float
AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
LINKFLAGS= -N -Ttext 0E004000 -e start
+STRIPFLAGS= -d
-# What to use for libkern:
+HOSTED_CC= ${CC}
+HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
+HOSTED_CFLAGS= ${CFLAGS}
+
+### find out what to use for libkern
.include "$S/lib/libkern/Makefile.inc"
.ifndef PROF
LIBKERN= ${KERNLIB}
@@ -54,19 +63,13 @@ LIBCOMPAT= ${COMPATLIB}
LIBCOMPAT= ${COMPATLIB_PROF}
.endif
-# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
-# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
-# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
-# is marked as config-dependent.
+# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
+# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-
-DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-
NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
-NORMAL_S_C= ${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
+
+HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
%OBJS
@@ -92,7 +95,7 @@ DEBUG?=
LINKFLAGS+= -X
SYSTEM_LD_TAIL+=; \
echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
- echo ${STRIP} $@; ${STRIP} $@
+ echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
.else
LINKFLAGS+= -S
.endif
@@ -106,14 +109,14 @@ genassym: genassym.o
${CC} -o $@ genassym.o
genassym.o: ${SUN3}/sun3/genassym.c
- ${NORMAL_C_C}
+ ${HOSTED_C}
param.c: $S/conf/param.c
rm -f param.c
cp $S/conf/param.c .
param.o: param.c Makefile
- ${NORMAL_C_C}
+ ${NORMAL_C}
ioconf.o: ioconf.c
${NORMAL_C}
@@ -124,11 +127,11 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
clean::
- rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \
+ rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
[Ee]rrs linterrs makelinks genassym genassym.o assym.h
lint:
- @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
+ @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \
${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
ioconf.c param.c | \
grep -v 'static function .* unused'
@@ -148,15 +151,24 @@ SRCS= ${SUN3}/sun3/locore.s \
param.c ioconf.c ${CFILES} ${SFILES}
depend:: .depend
.depend: ${SRCS} assym.h param.c
- mkdep ${AFLAGS} ${CPPFLAGS} ${SUN3}/sun3/locore.s
- mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
- mkdep -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
- mkdep -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${SUN3}/sun3/genassym.c
+ ${MKDEP} ${AFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
+ ${MKDEP} -a ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} \
+ ${SUN3}/sun3/genassym.c
+
+# XXX - see below
+# ${MKDEP} -a ${APPFLAGS} ${SUN3}/sun3/locore.s
+# ${MKDEP} -a ${APPFLAGS} ${SFILES}
+#
+# For cross-compilation, the "gcc -M" mkdep script is convenient,
+# but that does not correctly make rules from *.s files. The
+# easiest compromise is to just list those dependencies here.
+locore.o: assym.h machine/trap.h m68k/trap.h
+copy.o: assym.h $S/sys/errno.h
# depend on root or device configuration
autoconf.o conf.o: Makefile
-
+
# depend on network or filesystem configuration
uipc_proto.o vfs_conf.o: Makefile
diff --git a/sys/arch/sun3/conf/RAMDISK b/sys/arch/sun3/conf/RAMDISK
index cd2cffeb47b..733c66e3601 100644
--- a/sys/arch/sun3/conf/RAMDISK
+++ b/sys/arch/sun3/conf/RAMDISK
@@ -17,9 +17,6 @@ options HAVECACHE # Sun3/260 VAC
# Needs to be set per system. i.e change these as you see fit
maxusers 2
-# Standard system options
-options SWAPPAGER, VNODEPAGER, DEVPAGER # paging
-
# Debugging options. Uncomment either this:
#options DDB
# ... or these two: (for KGDB on another machine)
diff --git a/sys/arch/sun3/conf/SMD_TEST b/sys/arch/sun3/conf/SMD_TEST
index a3587672ee1..0f6eab813e7 100644
--- a/sys/arch/sun3/conf/SMD_TEST
+++ b/sys/arch/sun3/conf/SMD_TEST
@@ -16,7 +16,6 @@ options HAVECACHE # Sun3/260 VAC
maxusers 4
# Standard system options
-options SWAPPAGER, VNODEPAGER, DEVPAGER # paging
options KTRACE # system call tracing support
# Debugging options. Uncomment either this:
diff --git a/sys/arch/sun3/conf/files.sun3 b/sys/arch/sun3/conf/files.sun3
index d8e9006bd90..6556ae46e84 100644
--- a/sys/arch/sun3/conf/files.sun3
+++ b/sys/arch/sun3/conf/files.sun3
@@ -1,4 +1,4 @@
-# $NetBSD: files.sun3,v 1.24 1996/05/07 01:30:18 thorpej Exp $
+# $NetBSD: files.sun3,v 1.26 1996/10/29 19:58:14 gwr Exp $
#
# sun3-specific configuration info
@@ -34,7 +34,7 @@ file arch/sun3/sun3/vm_machdep.c
file arch/sun3/dev/idprom.c
-include "../../m68k/fpe/files.fpe"
+include "arch/m68k/fpe/files.fpe"
file arch/m68k/m68k/copy.s
file dev/cons.c
@@ -137,8 +137,6 @@ device cgfour: sunfb
attach cgfour at obmem
file arch/sun3/dev/cg4.c cgfour needs-flag
-file arch/sun3/dev/bt_subr.c cgfour
-
#
# VME
#
diff --git a/sys/arch/sun3/conf/std.sun3 b/sys/arch/sun3/conf/std.sun3
index 2274f33b012..5f3be8d1363 100644
--- a/sys/arch/sun3/conf/std.sun3
+++ b/sys/arch/sun3/conf/std.sun3
@@ -1,4 +1,4 @@
-# $NetBSD: std.sun3,v 1.15.4.1 1996/08/19 23:35:12 gwr Exp $
+# $NetBSD: std.sun3,v 1.19 1996/11/19 21:04:50 gwr Exp $
# Standard information for sun3's.
machine sun3 m68k
@@ -18,14 +18,17 @@ vmel0 at mainbus?
# Devices that should be present in any Sun3 kernel.
# OBIO
-zsc0 at obio? addr ?
-zsc1 at obio? addr ?
-eeprom0 at obio? addr ?
-clock0 at obio? addr ?
-memerr0 at obio? addr ?
-intreg0 at obio? addr ?
+zsc0 at obio0 addr 0x000000
+zsc1 at obio0 addr 0x020000
+eeprom0 at obio0 addr 0x040000
+clock0 at obio0 addr 0x060000
+memerr0 at obio0 addr 0x080000
+intreg0 at obio0 addr 0x0A0000
# Standard defines
+options EXEC_AOUT
+options EXEC_SCRIPT
+options SWAPPAGER, VNODEPAGER, DEVPAGER
# XXX - Still needed?
options NEWCONFIG
diff --git a/sys/arch/sun3/dev/cg4.c b/sys/arch/sun3/dev/cg4.c
index 7c3be6c1e63..1116c81c998 100644
--- a/sys/arch/sun3/dev/cg4.c
+++ b/sys/arch/sun3/dev/cg4.c
@@ -47,12 +47,19 @@
/*
* color display (cg4) driver.
*
- * Does not handle interrupts, even though they can occur.
+ * Credits, history:
+ * Gordon Ross created this driver based on the cg3 driver from
+ * the sparc port as distributed in BSD 4.4 Lite, but included
+ * support for only the "type B" adapter (Brooktree DACs).
+ * Ezra Story added support for the "type A" (AMD DACs).
*
- * XXX should defer colormap updates to vertical retrace interrupts
+ * Todo:
+ * Make this driver handle video interrupts.
+ * Defer colormap updates to vertical retrace interrupts.
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/device.h>
#include <sys/ioctl.h>
#include <sys/malloc.h>
@@ -71,16 +78,30 @@
#include "btvar.h"
#include "cg4reg.h"
+#define CG4_MMAP_SIZE (CG4_OVERLAY_SIZE + CG4_ENABLE_SIZE + CG4_PIXMAP_SIZE)
+
extern unsigned char cpu_machine_id;
+#define CMAP_SIZE 256
+struct soft_cmap {
+ u_char r[CMAP_SIZE];
+ u_char g[CMAP_SIZE];
+ u_char b[CMAP_SIZE];
+};
+
/* per-display variables */
struct cg4_softc {
struct device sc_dev; /* base device */
struct fbdevice sc_fb; /* frame buffer device */
- volatile struct bt_regs *sc_bt; /* Brooktree registers */
- int sc_phys; /* display RAM (phys addr) */
+ int sc_cg4type; /* A or B */
+ void *sc_va_cmap; /* Colormap h/w (mapped KVA) */
+ int sc_pa_overlay; /* phys. addr. of overlay plane */
+ int sc_pa_enable; /* phys. addr. of enable plane */
+ int sc_pa_pixmap; /* phys. addr. of color plane */
int sc_blanked; /* true if blanked */
- union bt_cmap sc_cmap; /* Brooktree color map */
+
+ union bt_cmap *sc_btcm; /* Brooktree color map */
+ struct soft_cmap sc_cmap; /* Generic soft colormap. */
};
/* autoconfiguration driver */
@@ -98,19 +119,25 @@ struct cfdriver cgfour_cd = {
/* frame buffer generic driver */
int cg4open(), cg4close(), cg4mmap();
-static int cg4gattr __P((struct fbdevice *, struct fbgattr *));
-static int cg4gvideo __P((struct fbdevice *, int *));
-static int cg4svideo __P((struct fbdevice *, int *));
+static int cg4gattr __P((struct fbdevice *, struct fbgattr *));
+static int cg4gvideo __P((struct fbdevice *, int *));
+static int cg4svideo __P((struct fbdevice *, int *));
static int cg4getcmap __P((struct fbdevice *, struct fbcmap *));
static int cg4putcmap __P((struct fbdevice *, struct fbcmap *));
-static struct fbdriver cg4fbdriver = {
+static void cg4a_init __P((struct cg4_softc *));
+static void cg4a_svideo __P((struct cg4_softc *, int));
+static void cg4a_ldcmap __P((struct cg4_softc *));
+
+static void cg4b_init __P((struct cg4_softc *));
+static void cg4b_svideo __P((struct cg4_softc *, int));
+static void cg4b_ldcmap __P((struct cg4_softc *));
+
+static struct fbdriver cg4_fbdriver = {
cg4open, cg4close, cg4mmap, cg4gattr,
cg4gvideo, cg4svideo,
cg4getcmap, cg4putcmap };
-static void cg4loadcmap __P((struct cg4_softc *, int, int));
-
/*
* Match a cg4.
*/
@@ -120,31 +147,39 @@ cg4match(parent, vcf, args)
void *vcf, *args;
{
struct confargs *ca = args;
- int paddr, x;
+ int paddr;
- /* XXX - Huge hack due to lack of probe info... */
+ /* XXX: Huge hack due to lack of probe info... */
+ /* XXX: Machines that might have a cg4 (gag). */
+ /* XXX: Need info on the "P4" register... */
switch (cpu_machine_id) {
- /* Machines that might have a cg4 (gag). */
- case SUN3_MACH_50:
- case SUN3_MACH_60:
+
case SUN3_MACH_110:
+ /* XXX: Assume type A. */
+ if (ca->ca_paddr == -1)
+ ca->ca_paddr = CG4A_DEF_BASE;
+ if (bus_peek(ca->ca_bustype, ca->ca_paddr, 1) == -1)
+ return (0);
+ if (bus_peek(BUS_OBIO, CG4A_OBIO_CMAP, 1) == -1)
+ return (0);
break;
- default:
- return (0);
- }
-
- if (ca->ca_paddr == -1)
- ca->ca_paddr = 0xFF200000;
- paddr = ca->ca_paddr;
- x = bus_peek(ca->ca_bustype, paddr, 1);
- if (x == -1)
- return (0);
+ case SUN3_MACH_60:
+ /* XXX: Assume type A. */
+ if (ca->ca_paddr == -1)
+ ca->ca_paddr = CG4B_DEF_BASE;
+ paddr = ca->ca_paddr;
+ if (bus_peek(ca->ca_bustype, paddr, 1) == -1)
+ return (0);
+ /* Make sure we're color */
+ paddr += CG4B_OFF_PIXMAP;
+ if (bus_peek(ca->ca_bustype, paddr, 1) == -1)
+ return (0);
+ break;
- paddr += CG4REG_PIXMAP;
- x = bus_peek(ca->ca_bustype, paddr, 1);
- if (x == -1)
+ default:
return (0);
+ }
return (1);
}
@@ -161,10 +196,18 @@ cg4attach(parent, self, args)
struct fbdevice *fb = &sc->sc_fb;
struct confargs *ca = args;
struct fbtype *fbt;
- volatile struct bt_regs *bt;
- int i;
- fb->fb_driver = &cg4fbdriver;
+ /* XXX: should do better than this... */
+ switch (cpu_machine_id) {
+ case SUN3_MACH_110:
+ sc->sc_cg4type = CG4_TYPE_A;
+ break;
+ case SUN3_MACH_60:
+ default:
+ sc->sc_cg4type = CG4_TYPE_B;
+ }
+
+ fb->fb_driver = &cg4_fbdriver;
fb->fb_private = sc;
fb->fb_name = sc->sc_dev.dv_xname;
@@ -177,28 +220,29 @@ cg4attach(parent, self, args)
fbt->fb_height = 900;
fbt->fb_size = CG4_MMAP_SIZE;
- sc->sc_phys = ca->ca_paddr;
- sc->sc_bt = bt = (volatile struct bt_regs *)
- bus_mapin(ca->ca_bustype, ca->ca_paddr,
- sizeof(struct bt_regs *));
-
- /* grab initial (current) color map */
- bt->bt_addr = 0;
- for (i = 0; i < (256 * 3 / 4); i++)
- sc->sc_cmap.cm_chip[i] = bt->bt_cmap;
-
- /*
- * BT458 chip initialization as described in Brooktree's
- * 1993 Graphics and Imaging Product Databook (DB004-1/93).
- */
- bt->bt_addr = 0x04; /* select read mask register */
- bt->bt_ctrl = 0xff; /* all planes on */
- bt->bt_addr = 0x05; /* select blink mask register */
- bt->bt_ctrl = 0x00; /* all planes non-blinking */
- bt->bt_addr = 0x06; /* select command register */
- bt->bt_ctrl = 0x43; /* palette enabled, overlay planes enabled */
- bt->bt_addr = 0x07; /* select test register */
- bt->bt_ctrl = 0x00; /* set test mode */
+ switch (sc->sc_cg4type) {
+ case CG4_TYPE_A: /* Sun3/110 */
+ sc->sc_va_cmap = bus_mapin(BUS_OBIO, CG4A_OBIO_CMAP,
+ sizeof(struct amd_regs));
+ sc->sc_pa_overlay = ca->ca_paddr + CG4A_OFF_OVERLAY;
+ sc->sc_pa_enable = ca->ca_paddr + CG4A_OFF_ENABLE;
+ sc->sc_pa_pixmap = ca->ca_paddr + CG4A_OFF_PIXMAP;
+ sc->sc_btcm = NULL;
+ cg4a_init(sc);
+ break;
+
+ case CG4_TYPE_B: /* Sun3/60 */
+ default:
+ sc->sc_va_cmap = (struct bt_regs *)
+ bus_mapin(ca->ca_bustype, ca->ca_paddr,
+ sizeof(struct bt_regs *));
+ sc->sc_pa_overlay = ca->ca_paddr + CG4B_OFF_OVERLAY;
+ sc->sc_pa_enable = ca->ca_paddr + CG4B_OFF_ENABLE;
+ sc->sc_pa_pixmap = ca->ca_paddr + CG4B_OFF_PIXMAP;
+ sc->sc_btcm = malloc(sizeof(union bt_cmap), M_DEVBUF, M_WAITOK);
+ cg4b_init(sc);
+ break;
+ }
printf(" (%dx%d)\n", fbt->fb_width, fbt->fb_height);
fb_attach(fb, 4);
@@ -245,8 +289,8 @@ cg4ioctl(dev, cmd, data, flags, p)
* offset, allowing for the given protection, or return -1 for error.
*
* X11 expects its mmap'd region to look like this:
- * 128k overlay memory
- * 128k overlay-enable bitmap
+ * 128k overlay data memory
+ * 128k overlay enable bitmap
* 1024k color memory
*
* The hardware really looks like this (starting at ca_paddr)
@@ -273,20 +317,18 @@ cg4mmap(dev, off, prot)
if ((unsigned)off >= CG4_MMAP_SIZE)
return (-1);
- physbase = sc->sc_phys;
if (off < 0x40000) {
if (off < 0x20000) {
- /* overlay plane */
- physbase += CG4REG_OVERLAY;
+ physbase = sc->sc_pa_overlay;
} else {
/* enable plane */
off -= 0x20000;
- physbase += CG4REG_ENABLE;
+ physbase = sc->sc_pa_enable;
}
} else {
/* pixel map */
off -= 0x40000;
- physbase += CG4REG_PIXMAP;
+ physbase = sc->sc_pa_pixmap;
}
/*
@@ -334,85 +376,241 @@ static int cg4svideo(fb, on)
int *on;
{
struct cg4_softc *sc = fb->fb_private;
- register volatile struct bt_regs *bt = sc->sc_bt;
-
- if ((*on == 0) && (sc->sc_blanked == 0)) {
- /* Turn OFF video (blank it). */
- bt->bt_addr = 0x06; /* command reg */
- bt->bt_ctrl = 0x70; /* overlay plane */
- bt->bt_addr = 0x04; /* read mask */
- bt->bt_ctrl = 0x00; /* color planes */
- /*
- * Set color 0 to black -- note that this overwrites
- * R of color 1.
- */
- bt->bt_addr = 0;
- bt->bt_cmap = 0;
+ int state;
- sc->sc_blanked = 1;
- }
+ state = *on;
+ if (sc->sc_cg4type == CG4_TYPE_A)
+ cg4a_svideo(sc, state);
+ else
+ cg4b_svideo(sc, state);
+ return (0);
+}
- if ((*on != 0) && (sc->sc_blanked != 0)) {
- /* Turn video back ON (unblank). */
- sc->sc_blanked = 0;
+/*
+ * FBIOGETCMAP:
+ * Copy current colormap out to user space.
+ */
+static int cg4getcmap(fb, fbcm)
+ struct fbdevice *fb;
+ struct fbcmap *fbcm;
+{
+ struct cg4_softc *sc = fb->fb_private;
+ struct soft_cmap *cm = &sc->sc_cmap;
+ int error, start, count;
- /* restore color 0 (and R of color 1) */
- bt->bt_addr = 0;
- bt->bt_cmap = sc->sc_cmap.cm_chip[0];
+ start = fbcm->index;
+ count = fbcm->count;
+ if ((start < 0) || (start >= CMAP_SIZE) ||
+ (count < 0) || (start + count > CMAP_SIZE) )
+ return (EINVAL);
+
+ if ((error = copyout(&cm->r[start], fbcm->red, count)) != 0)
+ return (error);
+
+ if ((error = copyout(&cm->g[start], fbcm->green, count)) != 0)
+ return (error);
+
+ if ((error = copyout(&cm->b[start], fbcm->blue, count)) != 0)
+ return (error);
- /* restore read mask */
- bt->bt_addr = 0x06; /* command reg */
- bt->bt_ctrl = 0x73; /* overlay plane */
- bt->bt_addr = 0x04; /* read mask */
- bt->bt_ctrl = 0xff; /* color planes */
- }
return (0);
}
-/* FBIOGETCMAP: */
-static int cg4getcmap(fb, cmap)
+/*
+ * FBIOPUTCMAP:
+ * Copy new colormap from user space and load.
+ */
+static int cg4putcmap(fb, fbcm)
struct fbdevice *fb;
- struct fbcmap *cmap;
+ struct fbcmap *fbcm;
{
struct cg4_softc *sc = fb->fb_private;
+ struct soft_cmap *cm = &sc->sc_cmap;
+ int error, start, count;
+
+ start = fbcm->index;
+ count = fbcm->count;
+ if ((start < 0) || (start >= CMAP_SIZE) ||
+ (count < 0) || (start + count > CMAP_SIZE) )
+ return (EINVAL);
+
+ if ((error = copyin(fbcm->red, &cm->r[start], count)) != 0)
+ return (error);
+
+ if ((error = copyin(fbcm->green, &cm->g[start], count)) != 0)
+ return (error);
- return (bt_getcmap(cmap, &sc->sc_cmap, 256));
+ if ((error = copyin(fbcm->blue, &cm->b[start], count)) != 0)
+ return (error);
+
+ if (sc->sc_cg4type == CG4_TYPE_A)
+ cg4a_ldcmap(sc);
+ else
+ cg4b_ldcmap(sc);
+
+ return (0);
}
-/* FBIOPUTCMAP: */
-static int cg4putcmap(fb, cmap)
- struct fbdevice *fb;
- struct fbcmap *cmap;
+/****************************************************************
+ * Routines for the "Type A" hardware
+ ****************************************************************/
+
+static void
+cg4a_init(sc)
+ struct cg4_softc *sc;
{
- struct cg4_softc *sc = fb->fb_private;
- int error;
-
- /* copy to software map */
- error = bt_putcmap(cmap, &sc->sc_cmap, 256);
- if (error == 0) {
- /* now blast them into the chip */
- /* XXX should use retrace interrupt */
- cg4loadcmap(sc, cmap->index, cmap->count);
+ volatile struct amd_regs *ar = sc->sc_va_cmap;
+ struct soft_cmap *cm = &sc->sc_cmap;
+ int i;
+
+ /* grab initial (current) color map */
+ for(i = 0; i < 256; i++) {
+ cm->r[i] = ar->r[i];
+ cm->g[i] = ar->g[i];
+ cm->b[i] = ar->b[i];
+ }
+}
+
+static void
+cg4a_ldcmap(sc)
+ struct cg4_softc *sc;
+{
+ volatile struct amd_regs *ar = sc->sc_va_cmap;
+ struct soft_cmap *cm = &sc->sc_cmap;
+ int i;
+
+ /*
+ * Now blast them into the chip!
+ * XXX Should use retrace interrupt!
+ * Just set a "need load" bit and let the
+ * retrace interrupt handler do the work.
+ */
+ for(i = 0; i < 256; i++) {
+ ar->r[i] = cm->r[i];
+ ar->g[i] = cm->g[i];
+ ar->b[i] = cm->b[i];
}
- return (error);
}
-/*
- * Load a subset of the current (new) colormap into the Brooktree DAC.
- */
static void
-cg4loadcmap(sc, start, ncolors)
+cg4a_svideo(sc, on)
struct cg4_softc *sc;
- int start, ncolors;
+ int on;
{
- volatile struct bt_regs *bt;
- u_int *ip;
- int count;
-
- ip = &sc->sc_cmap.cm_chip[BT_D4M3(start)]; /* start/4 * 3 */
- count = BT_D4M3(start + ncolors - 1) - BT_D4M3(start) + 3;
- bt = sc->sc_bt;
- bt->bt_addr = BT_D4M4(start);
- while (--count >= 0)
- bt->bt_cmap = *ip++;
+ volatile struct amd_regs *ar = sc->sc_va_cmap;
+ int i;
+
+ if ((on == 0) && (sc->sc_blanked == 0)) {
+ /* Turn OFF video (make it blank). */
+ sc->sc_blanked = 1;
+ /* Load fake "all zero" colormap. */
+ for (i = 0; i < 256; i++) {
+ ar->r[i] = 0;
+ ar->g[i] = 0;
+ ar->b[i] = 0;
+ }
+ }
+
+ if ((on != 0) && (sc->sc_blanked != 0)) {
+ /* Turn video back ON (unblank). */
+ sc->sc_blanked = 0;
+ /* Restore normal colormap. */
+ cg4a_ldcmap(sc);
+ }
}
+
+
+/****************************************************************
+ * Routines for the "Type B" hardware
+ ****************************************************************/
+
+static void
+cg4b_init(sc)
+ struct cg4_softc *sc;
+{
+ volatile struct bt_regs *bt = sc->sc_va_cmap;
+ struct soft_cmap *cm = &sc->sc_cmap;
+ union bt_cmap *btcm = sc->sc_btcm;
+ int i;
+
+ /*
+ * BT458 chip initialization as described in Brooktree's
+ * 1993 Graphics and Imaging Product Databook (DB004-1/93).
+ */
+ bt->bt_addr = 0x04; /* select read mask register */
+ bt->bt_ctrl = 0xff; /* all planes on */
+ bt->bt_addr = 0x05; /* select blink mask register */
+ bt->bt_ctrl = 0x00; /* all planes non-blinking */
+ bt->bt_addr = 0x06; /* select command register */
+ bt->bt_ctrl = 0x43; /* palette enabled, overlay planes enabled */
+ bt->bt_addr = 0x07; /* select test register */
+ bt->bt_ctrl = 0x00; /* set test mode */
+
+ /* grab initial (current) color map */
+ bt->bt_addr = 0;
+ for (i = 0; i < (256 * 3 / 4); i++) {
+ btcm->cm_chip[i] = bt->bt_cmap;
+ }
+
+ /* Transpose into S/W form. */
+ for (i = 0; i < 256; i++) {
+ cm->r[i] = btcm->cm_map[i][0];
+ cm->g[i] = btcm->cm_map[i][1];
+ cm->b[i] = btcm->cm_map[i][2];
+ }
+}
+
+static void
+cg4b_ldcmap(sc)
+ struct cg4_softc *sc;
+{
+ volatile struct bt_regs *bt = sc->sc_va_cmap;
+ struct soft_cmap *cm = &sc->sc_cmap;
+ union bt_cmap *btcm = sc->sc_btcm;
+ int i;
+
+ /*
+ * Now blast them into the chip!
+ * XXX Should use retrace interrupt!
+ * Just set a "need load" bit and let the
+ * retrace interrupt handler do the work.
+ */
+
+ /* Transpose into H/W form. */
+ for (i = 0; i < 256; i++) {
+ btcm->cm_map[i][0] = cm->r[i];
+ btcm->cm_map[i][1] = cm->g[i];
+ btcm->cm_map[i][2] = cm->b[i];
+ }
+
+ bt->bt_addr = 0;
+ for (i = 0; i < (256 * 3 / 4); i++) {
+ bt->bt_cmap = btcm->cm_chip[i];
+ }
+}
+
+static void
+cg4b_svideo(sc, on)
+ struct cg4_softc *sc;
+ int on;
+{
+ volatile struct bt_regs *bt = sc->sc_va_cmap;
+ int i;
+
+ if ((on == 0) && (sc->sc_blanked == 0)) {
+ /* Turn OFF video (make it blank). */
+ sc->sc_blanked = 1;
+ /* Load fake "all zero" colormap. */
+ bt->bt_addr = 0;
+ for (i = 0; i < (256 * 3 / 4); i++)
+ bt->bt_cmap = 0;
+ }
+
+ if ((on != 0) && (sc->sc_blanked != 0)) {
+ /* Turn video back ON (unblank). */
+ sc->sc_blanked = 0;
+ /* Restore normal colormap. */
+ cg4b_ldcmap(sc);
+ }
+}
+
diff --git a/sys/arch/sun3/dev/cg4reg.h b/sys/arch/sun3/dev/cg4reg.h
index 26627597489..51ec9638bd3 100644
--- a/sys/arch/sun3/dev/cg4reg.h
+++ b/sys/arch/sun3/dev/cg4reg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: cg4reg.h,v 1.2 1995/04/07 02:47:40 gwr Exp $ */
+/* $NetBSD: cg4reg.h,v 1.3 1996/10/29 19:54:21 gwr Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -44,20 +44,51 @@
* @(#)cgthreereg.h 8.2 (Berkeley) 10/30/93
*/
-/* Size that can be mapped. */
+/*
+ * Size that can be mapped (user-level mmap).
+ */
#define CG4_OVERLAY_SIZE 0x20000 /* size of overlay plane */
#define CG4_ENABLE_SIZE 0x20000 /* size of enable plane */
#define CG4_PIXMAP_SIZE 0x100000 /* size of frame buffer */
-#define CG4_MMAP_SIZE 0x140000 /* total mapping size */
+
+/* number of colormap entries */
+#define CG4_CMAP_ENTRIES 256
+
+/*
+ * There are two kinds of cg4 hardware:
+ * "Type A" has a AMD DACs (Digital-to-Analog Converters)
+ * "Type B" has a Brooktree DACs. H/W addresses differ too.
+ */
+#define CG4_TYPE_A 0
+#define CG4_TYPE_B 1
+
+/*
+ * Memory layout of the Type A hardware (OBMEM)
+ */
+#define CG4A_DEF_BASE 0xFE400000 /* Sun3/110 */
+#define CG4A_OFF_ENABLE 0
+#define CG4A_OFF_PIXMAP 0x400000
+#define CG4A_OFF_OVERLAY 0xC00000
+#define CG4A_OBIO_CMAP 0x0E0000 /* OBIO space! */
+
+/* colormap/status register structure */
+struct amd_regs {
+ u_char r[CG4_CMAP_ENTRIES];
+ u_char g[CG4_CMAP_ENTRIES];
+ u_char b[CG4_CMAP_ENTRIES];
+ u_char status;
+#define CG4A_STATUS_FIRSTHALF 0x80
+#define CG4A_STATUS_TOOLATE 0x40
+};
/*
- * cgthree display registers. Much like bwtwo registers, except that
- * there is a Brooktree Video DAC in there (so we also use btreg.h).
+ * Memory layout of the Type B hardware (OBMEM)
+ * Appears on the Sun3/60 at base 0xFF200000
*/
+#define CG4B_DEF_BASE 0xFF200000 /* Sun3/60 */
+#define CG4B_OFF_CMAP 0
+#define CG4B_OFF_OVERLAY 0x200000
+#define CG4B_OFF_ENABLE 0x400000
+#define CG4B_OFF_PIXMAP 0x600000
-/* offsets (i.e. from 0xFF200000) */
-#define CG4REG_CMAP 0
-#define CG4REG_OVERLAY 0x200000
-#define CG4REG_ENABLE 0x400000
-#define CG4REG_PIXMAP 0x600000
diff --git a/sys/arch/sun3/dev/fbvar.h b/sys/arch/sun3/dev/fbvar.h
index 8e5b3598519..aae60c99151 100644
--- a/sys/arch/sun3/dev/fbvar.h
+++ b/sys/arch/sun3/dev/fbvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: fbvar.h,v 1.2 1995/04/07 02:51:21 gwr Exp $ */
+/* $NetBSD: fbvar.h,v 1.3 1996/10/29 19:27:37 gwr Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -78,6 +78,6 @@ struct fbdriver {
int (*fbd_putcmap) __P((struct fbdevice *, struct fbcmap *));
};
-void fbattach __P((struct fbdevice *, int));
+void fb_attach __P((struct fbdevice *, int));
int fbioctlfb __P((struct fbdevice *, u_long, caddr_t));
extern int enoioctl();
diff --git a/sys/arch/sun3/dev/idprom.c b/sys/arch/sun3/dev/idprom.c
index 7dd09171120..70c9d2f2892 100644
--- a/sys/arch/sun3/dev/idprom.c
+++ b/sys/arch/sun3/dev/idprom.c
@@ -1,9 +1,12 @@
-/* $NetBSD: idprom.c,v 1.12 1996/03/26 15:16:09 gwr Exp $ */
+/* $NetBSD: idprom.c,v 1.13 1996/11/20 18:56:50 gwr Exp $ */
-/*
- * Copyright (c) 1993 Adam Glass
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Glass and Gordon W. Ross.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -14,20 +17,23 @@
* 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 Adam Glass.
- * 4. The name of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
diff --git a/sys/arch/sun3/dev/if_ie.c b/sys/arch/sun3/dev/if_ie.c
index 2ab99bc4a20..32f52c05e8f 100644
--- a/sys/arch/sun3/dev/if_ie.c
+++ b/sys/arch/sun3/dev/if_ie.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ie.c,v 1.12 1996/05/09 21:15:47 thorpej Exp $ */
+/* $NetBSD: if_ie.c,v 1.15 1996/10/30 00:24:33 gwr Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles Hannum.
@@ -269,7 +269,7 @@ ie_attach(sc)
int off;
/* MD code has done its part before calling this. */
- printf(" hwaddr %s\n", ether_sprintf(sc->sc_addr));
+ printf(": hwaddr %s\n", ether_sprintf(sc->sc_addr));
/* Allocate from end of buffer space for ISCP, SCB */
off = sc->buf_area_sz;
diff --git a/sys/arch/sun3/dev/if_ie_obio.c b/sys/arch/sun3/dev/if_ie_obio.c
index a163ea497ab..76307fa0c92 100644
--- a/sys/arch/sun3/dev/if_ie_obio.c
+++ b/sys/arch/sun3/dev/if_ie_obio.c
@@ -1,9 +1,12 @@
-/* $NetBSD: if_ie_obio.c,v 1.2 1996/03/26 22:04:19 gwr Exp $ */
+/* $NetBSD: if_ie_obio.c,v 1.6 1996/11/20 18:56:51 gwr Exp $ */
-/*
- * Copyright (c) 1994 Gordon W. Ross
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Gordon W. Ross.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -14,20 +17,23 @@
* 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 Gordon Ross
- * 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 product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE 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.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -84,28 +90,16 @@ ie_obio_match(parent, vcf, args)
{
struct cfdata *cf = vcf;
struct confargs *ca = args;
- int pa, x;
-#ifdef DIAGNOSTIC
- if (ca->ca_bustype != BUS_OBIO) {
- printf("ie_obio_match: bustype %d?\n", ca->ca_bustype);
+ /* Make sure there is something there... */
+ if (bus_peek(ca->ca_bustype, ca->ca_paddr, 1) == -1)
return (0);
- }
-#endif
- /*
- * OBIO match functions may be called for every possible
- * physical address, so match only our physical address.
- */
- if ((pa = cf->cf_paddr) == -1) {
- /* Use our default PA. */
- pa = OBIO_INTEL_ETHER;
- }
- if (pa != ca->ca_paddr)
- return (0);
+ /* Default interrupt priority. */
+ if (ca->ca_intpri == -1)
+ ca->ca_intpri = 3;
- x = bus_peek(ca->ca_bustype, ca->ca_paddr, 1);
- return (x != -1);
+ return (1);
}
void
@@ -117,12 +111,6 @@ ie_obio_attach(parent, self, args)
struct ie_softc *sc = (void *) self;
struct cfdata *cf = self->dv_cfdata;
struct confargs *ca = args;
- int intpri;
-
- /* Default interrupt level. */
- if ((intpri = cf->cf_intpri) == -1)
- intpri = 3;
- printf(" level %d", intpri);
sc->hard_type = IE_OBIO;
sc->reset_586 = ie_obreset;
@@ -177,7 +165,7 @@ ie_obio_attach(parent, self, args)
ie_attach(sc);
/* Install interrupt handler. */
- isr_add_autovect(ie_intr, (void *)sc, intpri);
+ isr_add_autovect(ie_intr, (void *)sc, ca->ca_intpri);
}
diff --git a/sys/arch/sun3/dev/if_le.c b/sys/arch/sun3/dev/if_le.c
index 63d008828e7..c4ae12b0394 100644
--- a/sys/arch/sun3/dev/if_le.c
+++ b/sys/arch/sun3/dev/if_le.c
@@ -1,12 +1,11 @@
-/* $NetBSD: if_le.c,v 1.29 1996/05/07 01:32:31 thorpej Exp $ */
+/* $NetBSD: if_le.c,v 1.33 1996/11/20 18:56:52 gwr Exp $ */
/*-
- * Copyright (c) 1995 Charles M. Hannum. All rights reserved.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
*
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Glass and Gordon W. Ross.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -18,25 +17,23 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_le.c 8.2 (Berkeley) 11/16/93
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
#include "bpfilter.h"
@@ -65,8 +62,24 @@
#include <dev/ic/am7990reg.h>
#include <dev/ic/am7990var.h>
-#include <sun3/dev/if_lereg.h>
-#include <sun3/dev/if_levar.h>
+/*
+ * LANCE registers.
+ * The real stuff is in dev/ic/am7990reg.h
+ */
+struct lereg1 {
+ volatile u_int16_t ler1_rdp; /* data port */
+ volatile u_int16_t ler1_rap; /* register select port */
+};
+
+/*
+ * Ethernet software status per interface.
+ * The real stuff is in dev/ic/am7990var.h
+ */
+struct le_softc {
+ struct am7990_softc sc_am7990; /* glue to MI code */
+
+ struct lereg1 *sc_r1; /* LANCE registers */
+};
static int le_match __P((struct device *, void *, void *));
static void le_attach __P((struct device *, struct device *, void *));
@@ -109,22 +122,16 @@ le_match(parent, vcf, aux)
{
struct cfdata *cf = vcf;
struct confargs *ca = aux;
- int pa, x;
-
- /*
- * OBIO match functions may be called for every possible
- * physical address, so match only our physical address.
- */
- if ((pa = cf->cf_paddr) == -1) {
- /* Use our default PA. */
- pa = OBIO_AMD_ETHER;
- }
- if (pa != ca->ca_paddr)
+
+ /* Make sure there is something there... */
+ if (bus_peek(ca->ca_bustype, ca->ca_paddr, 1) == -1)
return (0);
- /* The peek returns -1 on bus error. */
- x = bus_peek(ca->ca_bustype, ca->ca_paddr, 1);
- return (x != -1);
+ /* Default interrupt priority. */
+ if (ca->ca_intpri == -1)
+ ca->ca_intpri = 3;
+
+ return (1);
}
void
@@ -136,12 +143,6 @@ le_attach(parent, self, aux)
struct am7990_softc *sc = &lesc->sc_am7990;
struct cfdata *cf = self->dv_cfdata;
struct confargs *ca = aux;
- int intpri;
-
- /* Default interrupt level. */
- if ((intpri = cf->cf_intpri) == -1)
- intpri = 3;
- printf(" level %d", intpri);
lesc->sc_r1 = (struct lereg1 *)
obio_alloc(ca->ca_paddr, OBIO_AMD_ETHER_SIZE);
@@ -166,5 +167,5 @@ le_attach(parent, self, aux)
am7990_config(sc);
/* Install interrupt handler. */
- isr_add_autovect(am7990_intr, (void *)sc, intpri);
+ isr_add_autovect(am7990_intr, (void *)sc, ca->ca_intpri);
}
diff --git a/sys/arch/sun3/dev/kd.c b/sys/arch/sun3/dev/kd.c
index 6f7c9664570..c3326cc689a 100644
--- a/sys/arch/sun3/dev/kd.c
+++ b/sys/arch/sun3/dev/kd.c
@@ -1,9 +1,12 @@
-/* $NetBSD: kd.c,v 1.17 1996/06/15 14:58:02 gwr Exp $ */
+/* $NetBSD: kd.c,v 1.21 1996/11/20 18:56:55 gwr Exp $ */
-/*
- * Copyright (c) 1994, 1995 Gordon W. Ross
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Gordon W. Ross.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -12,22 +15,25 @@
* 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.
- * 4. All advertising materials mentioning features or use of this software
+ * 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Gordon Ross
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE 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.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -259,7 +265,7 @@ kdparam(tp, t)
}
-int
+void
kdstop(tp, flag)
struct tty *tp;
int flag;
diff --git a/sys/arch/sun3/dev/memerr.c b/sys/arch/sun3/dev/memerr.c
index e71b10f4c7a..676aef73f96 100644
--- a/sys/arch/sun3/dev/memerr.c
+++ b/sys/arch/sun3/dev/memerr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: memerr.c,v 1.2 1996/04/07 05:47:28 gwr Exp $ */
+/* $NetBSD: memerr.c,v 1.6 1996/11/13 07:05:14 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -92,22 +92,20 @@ memerr_match(parent, vcf, args)
{
struct cfdata *cf = vcf;
struct confargs *ca = args;
- int pa, x;
/* This driver only supports one unit. */
if (cf->cf_unit != 0)
return (0);
- if ((pa = cf->cf_paddr) == -1) {
- /* Use our default PA. */
- pa = OBIO_MEMERR;
- }
- if (pa != ca->ca_paddr)
+ /* The peek returns -1 on bus error. */
+ if (bus_peek(ca->ca_bustype, ca->ca_paddr, 1) == -1)
return (0);
- /* The peek returns -1 on bus error. */
- x = bus_peek(ca->ca_bustype, ca->ca_paddr, 1);
- return (x != -1);
+ /* Default interrupt priority. */
+ if (ca->ca_intpri == -1)
+ ca->ca_intpri = ME_PRI;
+
+ return (1);
}
static void
@@ -120,12 +118,6 @@ memerr_attach(parent, self, args)
struct confargs *ca = args;
struct memerr *mer;
- mer = (struct memerr *)
- obio_alloc(ca->ca_paddr, sizeof(*mer));
- if (mer == NULL)
- panic(": can not map register");
- sc->sc_reg = mer;
-
/*
* Which type of memory subsystem do we have?
*/
@@ -143,11 +135,17 @@ memerr_attach(parent, self, args)
sc->sc_csrbits = ME_PAR_STR;
break;
}
+ printf(": (%s memory)\n", sc->sc_typename);
- printf(" (%s memory)\n", sc->sc_typename);
+ mer = (struct memerr *)
+ obio_alloc(ca->ca_paddr, sizeof(*mer));
+ if (mer == NULL)
+ panic("memerr: can not map register");
+ sc->sc_reg = mer;
/* Install interrupt handler. */
- isr_add_autovect(memerr_interrupt, (void *)sc, ME_PRI);
+ isr_add_autovect(memerr_interrupt,
+ (void *)sc, ca->ca_intpri);
/* Enable error interrupt (and checking). */
if (sc->sc_type == ME_PAR)
@@ -175,6 +173,7 @@ memerr_interrupt(arg)
u_char csr, ctx, err;
u_int pa, va;
int pte;
+ char bits[64];
csr = me->me_csr;
if ((csr & ME_CSR_IPEND) == 0)
@@ -190,7 +189,8 @@ memerr_interrupt(arg)
(ctx & 8) ? "DVMA" : "CPU");
printf(" ctx=%d, vaddr=0x%x, paddr=0x%x\n",
(ctx & 7), va, pa);
- printf(" csr=%b\n", csr, sc->sc_csrbits);
+ printf(" csr=%s\n", bitmask_snprintf(csr, sc->sc_csrbits,
+ bits, sizeof(bits)));
/*
* If we have parity-checked memory, there is
diff --git a/sys/arch/sun3/dev/obio.c b/sys/arch/sun3/dev/obio.c
index 8573ec2ef7a..c015d61116c 100644
--- a/sys/arch/sun3/dev/obio.c
+++ b/sys/arch/sun3/dev/obio.c
@@ -1,10 +1,12 @@
-/* $NetBSD: obio.c,v 1.18 1996/03/26 15:16:14 gwr Exp $ */
+/* $NetBSD: obio.c,v 1.23 1996/11/20 18:56:56 gwr Exp $ */
-/*
- * Copyright (c) 1994 Gordon W. Ross
- * Copyright (c) 1993 Adam Glass
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Glass and Gordon W. Ross.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -15,20 +17,23 @@
* 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 Adam Glass and Gordon Ross.
- * 4. The name of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/param.h>
@@ -43,7 +48,8 @@
static int obio_match __P((struct device *, void *, void *));
static void obio_attach __P((struct device *, struct device *, void *));
-static int obio_print __P((void *, char *parentname));
+static int obio_print __P((void *, const char *parentname));
+static int obio_submatch __P((struct device *, void *, void *));
struct cfattach obio_ca = {
sizeof(struct device), obio_match, obio_attach
@@ -87,7 +93,7 @@ obio_attach(parent, self, aux)
ca->ca_intpri = -1;
ca->ca_intvec = -1;
- (void) config_found(self, ca, obio_print);
+ (void) config_found_sm(self, ca, obio_print, obio_submatch);
}
}
@@ -98,7 +104,7 @@ obio_attach(parent, self, aux)
static int
obio_print(args, name)
void *args;
- char *name;
+ const char *name;
{
struct confargs *ca = args;
@@ -106,11 +112,41 @@ obio_print(args, name)
if (name)
return(QUIET);
- printf(" addr 0x%x", ca->ca_paddr);
+ if (ca->ca_paddr != -1)
+ printf(" addr 0x%x", ca->ca_paddr);
+ if (ca->ca_intpri != -1)
+ printf(" level %d", ca->ca_intpri);
return(UNCONF);
}
+int
+obio_submatch(parent, vcf, aux)
+ struct device *parent;
+ void *vcf, *aux;
+{
+ struct cfdata *cf = vcf;
+ struct confargs *ca = aux;
+ cfmatch_t submatch;
+
+ /*
+ * Default addresses are mostly useless for OBIO.
+ * The address assignments are fixed for all time,
+ * so our config files might as well reflect that.
+ */
+ if (cf->cf_paddr != ca->ca_paddr)
+ return 0;
+
+ /* Now call the match function of the potential child. */
+ submatch = cf->cf_attach->ca_match;
+ if (submatch == NULL)
+ panic("obio_submatch: no match function for: %s\n",
+ cf->cf_driver->cd_name);
+
+ return ((*submatch)(parent, vcf, aux));
+}
+
+
/*****************************************************************/
/*
diff --git a/sys/arch/sun3/dev/si.c b/sys/arch/sun3/dev/si.c
index 0bf52d046bc..3047596157e 100644
--- a/sys/arch/sun3/dev/si.c
+++ b/sys/arch/sun3/dev/si.c
@@ -1,10 +1,12 @@
-/* $NetBSD: si.c,v 1.25 1996/06/17 23:21:29 gwr Exp $ */
+/* $NetBSD: si.c,v 1.31 1996/11/20 18:56:59 gwr Exp $ */
-/*
- * Copyright (c) 1995 David Jones, Gordon W. Ross
- * Copyright (c) 1994 Adam Glass
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Glass, David Jones, and Gordon W. Ross.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,23 +15,25 @@
* 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 authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
+ * 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by
- * Adam Glass, David Jones, and Gordon Ross
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -99,6 +103,12 @@
#include "sireg.h"
#include "sivar.h"
+/*
+ * Transfers smaller than this are done using PIO
+ * (on assumption they're not worth DMA overhead)
+ */
+#define MIN_DMA_LEN 128
+
int si_debug = 0;
#ifdef DEBUG
static int si_link_flags = 0 /* | SDEV_DB2 */ ;
@@ -108,7 +118,6 @@ static int si_link_flags = 0 /* | SDEV_DB2 */ ;
int si_dma_intr_timo = 500; /* ticks (sec. X 100) */
static void si_minphys __P((struct buf *));
-static int si_print __P((void *, char *));
static struct scsi_adapter si_ops = {
ncr5380_scsi_cmd, /* scsi_cmd() */
@@ -145,8 +154,25 @@ si_attach(sc)
int i;
/*
+ * Support the "options" (config file flags).
+ */
+ if ((sc->sc_options & SI_DO_RESELECT) != 0)
+ ncr_sc->sc_flags |= NCR5380_PERMIT_RESELECT;
+ if ((sc->sc_options & SI_DMA_INTR) == 0)
+ ncr_sc->sc_flags |= NCR5380_FORCE_POLLING;
+#if 1 /* XXX - Temporary */
+ /* XXX - In case we think DMA is completely broken... */
+ if ((sc->sc_options & SI_ENABLE_DMA) == 0) {
+ /* Override this function pointer. */
+ ncr_sc->sc_dma_alloc = NULL;
+ }
+#endif
+ ncr_sc->sc_min_dma_len = MIN_DMA_LEN;
+
+ /*
* Fill in the prototype scsi_link.
*/
+ ncr_sc->sc_link.channel = SCSI_CHANNEL_ONLY_ONE;
ncr_sc->sc_link.adapter_softc = sc;
ncr_sc->sc_link.adapter_target = 7;
ncr_sc->sc_link.adapter = &si_ops;
@@ -187,17 +213,7 @@ si_attach(sc)
si_reset_adapter(ncr_sc);
ncr5380_init(ncr_sc);
ncr5380_reset_scsibus(ncr_sc);
- config_found(&(ncr_sc->sc_dev), &(ncr_sc->sc_link), si_print);
-}
-
-static int
-si_print(aux, name)
- void *aux;
- char *name;
-{
- if (name != NULL)
- printf("%s: scsibus ", name);
- return UNCONF;
+ config_found(&(ncr_sc->sc_dev), &(ncr_sc->sc_link), scsiprint);
}
static void
diff --git a/sys/arch/sun3/dev/si_obio.c b/sys/arch/sun3/dev/si_obio.c
index 61c073f81a6..793c0a3b26c 100644
--- a/sys/arch/sun3/dev/si_obio.c
+++ b/sys/arch/sun3/dev/si_obio.c
@@ -1,10 +1,12 @@
-/* $NetBSD: si_obio.c,v 1.2 1996/06/17 23:21:35 gwr Exp $ */
+/* $NetBSD: si_obio.c,v 1.7 1996/11/20 18:57:00 gwr Exp $ */
-/*
- * Copyright (c) 1995 David Jones, Gordon W. Ross
- * Copyright (c) 1994 Adam Glass
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Glass, David Jones, and Gordon W. Ross.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,23 +15,25 @@
* 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 authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
+ * 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by
- * Adam Glass, David Jones, and Gordon Ross
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -128,9 +132,6 @@ struct cfattach si_obio_ca = {
/* Options. Interesting values are: 1,3,7 */
/* XXX: Using 1 for now to mask a (pmap?) bug not yet found... */
int si_obio_options = 1; /* XXX */
-#define SI_ENABLE_DMA 1 /* Use DMA (maybe polled) */
-#define SI_DMA_INTR 2 /* DMA completion interrupts */
-#define SI_DO_RESELECT 4 /* Allow disconnect/reselect */
static int
@@ -140,38 +141,16 @@ si_obio_match(parent, vcf, args)
{
struct cfdata *cf = vcf;
struct confargs *ca = args;
- int pa, x;
-
-#ifdef DIAGNOSTIC
- if (ca->ca_bustype != BUS_OBIO) {
- printf("si_obio_match: bustype %d?\n", ca->ca_bustype);
- return (0);
- }
-#endif
- /*
- * OBIO match functions may be called for every possible
- * physical address, so match only our physical address.
- */
- if ((pa = cf->cf_paddr) == -1) {
- /* Use our default PA. */
- pa = OBIO_NCR_SCSI;
- }
- if (pa != ca->ca_paddr)
+ /* Make sure there is something there... */
+ if (bus_peek(ca->ca_bustype, ca->ca_paddr + 1, 1) == -1)
return (0);
-#if 0
- if ((cpu_machine_id != SUN3_MACH_50) &&
- (cpu_machine_id != SUN3_MACH_60) )
- {
- /* Only 3/50 and 3/60 have the obio si. */
- return (0);
- }
-#endif
+ /* Default interrupt priority. */
+ if (ca->ca_intpri == -1)
+ ca->ca_intpri = 2;
- /* Make sure there is something there... */
- x = bus_peek(ca->ca_bustype, ca->ca_paddr + 1, 1);
- return (x != -1);
+ return (1);
}
static void
@@ -183,21 +162,10 @@ si_obio_attach(parent, self, args)
struct ncr5380_softc *ncr_sc = &sc->ncr_sc;
struct cfdata *cf = self->dv_cfdata;
struct confargs *ca = args;
- int intpri;
-
- /* Default interrupt level. */
- if ((intpri = cf->cf_intpri) == -1)
- intpri = 2;
- printf(" level %d", intpri);
- /* XXX: Get options from flags... */
- printf(" : options=%d\n", si_obio_options);
-
- ncr_sc->sc_flags = 0;
- if (si_obio_options & SI_DO_RESELECT)
- ncr_sc->sc_flags |= NCR5380_PERMIT_RESELECT;
- if ((si_obio_options & SI_DMA_INTR) == 0)
- ncr_sc->sc_flags |= NCR5380_FORCE_POLLING;
+ /* Get options from config flags... */
+ sc->sc_options = cf->cf_flags | si_obio_options;
+ printf(": options=%d\n", sc->sc_options);
sc->sc_adapter_type = ca->ca_bustype;
sc->sc_regs = (struct si_regs *)
@@ -218,21 +186,11 @@ si_obio_attach(parent, self, args)
ncr_sc->sc_intr_on = NULL;
ncr_sc->sc_intr_off = NULL;
- ncr_sc->sc_min_dma_len = MIN_DMA_LEN;
-
-#if 1 /* XXX - Temporary */
- /* XXX - In case we think DMA is completely broken... */
- if ((si_obio_options & SI_ENABLE_DMA) == 0) {
- /* Override this function pointer. */
- ncr_sc->sc_dma_alloc = NULL;
- }
-#endif
-
/* Need DVMA-capable memory for the UDC command block. */
sc->sc_dmacmd = dvma_malloc(sizeof (struct udc_table));
/* Attach interrupt handler. */
- isr_add_autovect(si_intr, (void *)sc, intpri);
+ isr_add_autovect(si_intr, (void *)sc, ca->ca_intpri);
/* Do the common attach stuff. */
si_attach(sc);
diff --git a/sys/arch/sun3/dev/si_vme.c b/sys/arch/sun3/dev/si_vme.c
index d29bc905ee3..3b94011b255 100644
--- a/sys/arch/sun3/dev/si_vme.c
+++ b/sys/arch/sun3/dev/si_vme.c
@@ -1,10 +1,12 @@
-/* $NetBSD: si_vme.c,v 1.2 1996/06/17 23:21:39 gwr Exp $ */
+/* $NetBSD: si_vme.c,v 1.7 1996/11/20 18:57:01 gwr Exp $ */
-/*
- * Copyright (c) 1995 David Jones, Gordon W. Ross
- * Copyright (c) 1994 Adam Glass
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Glass, David Jones, and Gordon W. Ross.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,23 +15,25 @@
* 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 authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
+ * 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by
- * Adam Glass, David Jones, and Gordon Ross
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -103,12 +107,6 @@
#include "sireg.h"
#include "sivar.h"
-/*
- * Transfers smaller than this are done using PIO
- * (on assumption they're not worth DMA overhead)
- */
-#define MIN_DMA_LEN 128
-
void si_vme_dma_setup __P((struct ncr5380_softc *));
void si_vme_dma_start __P((struct ncr5380_softc *));
void si_vme_dma_eop __P((struct ncr5380_softc *));
@@ -130,9 +128,6 @@ struct cfattach si_vmes_ca = {
/* Options. Interesting values are: 1,3,7 */
int si_vme_options = 3;
-#define SI_ENABLE_DMA 1 /* Use DMA (maybe polled) */
-#define SI_DMA_INTR 2 /* DMA completion interrupts */
-#define SI_DO_RESELECT 4 /* Allow disconnect/reselect */
static int
@@ -142,7 +137,7 @@ si_vmes_match(parent, vcf, args)
{
struct cfdata *cf = vcf;
struct confargs *ca = args;
- int x, probe_addr;
+ int probe_addr;
#ifdef DIAGNOSTIC
if (ca->ca_bustype != BUS_VME16) {
@@ -151,13 +146,6 @@ si_vmes_match(parent, vcf, args)
}
#endif
- if ((cpu_machine_id == SUN3_MACH_50) ||
- (cpu_machine_id == SUN3_MACH_60) )
- {
- /* Sun3/50 or Sun3/60 do not have VME. */
- return(0);
- }
-
/*
* Other Sun3 models may have VME "si" or "sc".
* This driver has no default address.
@@ -165,13 +153,9 @@ si_vmes_match(parent, vcf, args)
if (ca->ca_paddr == -1)
return (0);
- /* Default interrupt priority always splbio==2 */
- if (ca->ca_intpri == -1)
- ca->ca_intpri = 2;
-
/* Make sure there is something there... */
- x = bus_peek(ca->ca_bustype, ca->ca_paddr + 1, 1);
- if (x == -1)
+ probe_addr = ca->ca_paddr + 1;
+ if (bus_peek(ca->ca_bustype, probe_addr, 1) == -1)
return (0);
/*
@@ -181,8 +165,8 @@ si_vmes_match(parent, vcf, args)
* 4K bytes in VME space but the "si" board occupies 2K bytes.
*/
/* Note: the "si" board should NOT respond here. */
- x = bus_peek(ca->ca_bustype, ca->ca_paddr + 0x801, 1);
- if (x != -1) {
+ probe_addr = ca->ca_paddr + 0x801;
+ if (bus_peek(ca->ca_bustype, probe_addr, 1) != -1) {
/* Something responded at 2K+1. Maybe an "sc" board? */
#ifdef DEBUG
printf("si_vmes_match: May be an `sc' board at pa=0x%x\n",
@@ -191,9 +175,12 @@ si_vmes_match(parent, vcf, args)
return(0);
}
- return (1);
-}
+ /* Default interrupt priority (always splbio==2) */
+ if (ca->ca_intpri == -1)
+ ca->ca_intpri = 2;
+ return (1);
+}
static void
si_vmes_attach(parent, self, args)
@@ -201,33 +188,26 @@ si_vmes_attach(parent, self, args)
void *args;
{
struct si_softc *sc = (struct si_softc *) self;
- struct ncr5380_softc *ncr_sc = (struct ncr5380_softc *)sc;
+ struct ncr5380_softc *ncr_sc = &sc->ncr_sc;
+ struct cfdata *cf = self->dv_cfdata;
struct confargs *ca = args;
- int s;
- /* XXX: Get options from flags... */
- printf(" : options=%d\n", si_vme_options);
-
- ncr_sc->sc_flags = 0;
- if (si_vme_options & SI_DO_RESELECT)
- ncr_sc->sc_flags |= NCR5380_PERMIT_RESELECT;
- if ((si_vme_options & SI_DMA_INTR) == 0)
- ncr_sc->sc_flags |= NCR5380_FORCE_POLLING;
+ /* Get options from config flags... */
+ sc->sc_options = cf->cf_flags | si_vme_options;
+ printf(": options=%d\n", sc->sc_options);
sc->sc_adapter_type = ca->ca_bustype;
- sc->sc_adapter_iv_am =
- VME_SUPV_DATA_24 | (ca->ca_intvec & 0xFF);
-
sc->sc_regs = (struct si_regs *)
bus_mapin(ca->ca_bustype, ca->ca_paddr,
sizeof(struct si_regs));
+ sc->sc_adapter_iv_am =
+ VME_SUPV_DATA_24 | (ca->ca_intvec & 0xFF);
/*
* MD function pointers used by the MI code.
*/
ncr_sc->sc_pio_out = ncr5380_pio_out;
ncr_sc->sc_pio_in = ncr5380_pio_in;
-
ncr_sc->sc_dma_alloc = si_dma_alloc;
ncr_sc->sc_dma_free = si_dma_free;
ncr_sc->sc_dma_setup = si_vme_dma_setup;
@@ -238,16 +218,6 @@ si_vmes_attach(parent, self, args)
ncr_sc->sc_intr_on = si_vme_intr_on;
ncr_sc->sc_intr_off = si_vme_intr_off;
- ncr_sc->sc_min_dma_len = MIN_DMA_LEN;
-
-#if 1 /* XXX - Temporary */
- /* XXX - In case we think DMA is completely broken... */
- if ((si_vme_options & SI_ENABLE_DMA) == 0) {
- /* Override this function pointer. */
- ncr_sc->sc_dma_alloc = NULL;
- }
-#endif
-
/* Attach interrupt handler. */
isr_add_vectored(si_intr, (void *)sc,
ca->ca_intpri, ca->ca_intvec);
diff --git a/sys/arch/sun3/dev/sivar.h b/sys/arch/sun3/dev/sivar.h
index 1bbaee4b7b3..fea6c6343fc 100644
--- a/sys/arch/sun3/dev/sivar.h
+++ b/sys/arch/sun3/dev/sivar.h
@@ -1,9 +1,12 @@
-/* $NetBSD: sivar.h,v 1.1 1996/03/26 15:01:15 gwr Exp $ */
+/* $NetBSD: sivar.h,v 1.3 1996/11/20 18:57:01 gwr Exp $ */
-/*
- * Copyright (c) 1995 David Jones, Gordon W. Ross
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Glass, David Jones, and Gordon W. Ross.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -12,23 +15,25 @@
* 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 authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
+ * 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by
- * David Jones and Gordon Ross
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -71,12 +76,19 @@ struct si_softc {
volatile struct si_regs *sc_regs;
int sc_adapter_type;
int sc_adapter_iv_am; /* int. vec + address modifier */
+ int sc_options; /* options for this instance */
int sc_reqlen; /* requested transfer length */
struct si_dma_handle *sc_dma;
/* DMA command block for the OBIO controller. */
void *sc_dmacmd;
};
+/* Options. Interesting values are: 1,3,7 */
+#define SI_ENABLE_DMA 1 /* Use DMA (maybe polled) */
+#define SI_DMA_INTR 2 /* DMA completion interrupts */
+#define SI_DO_RESELECT 4 /* Allow disconnect/reselect */
+/* The options are taken from the config file (PR#1929) */
+
extern int si_debug;
void si_attach __P((struct si_softc *));
diff --git a/sys/arch/sun3/dev/xd.c b/sys/arch/sun3/dev/xd.c
index d5b8508dd81..103e714239f 100644
--- a/sys/arch/sun3/dev/xd.c
+++ b/sys/arch/sun3/dev/xd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xd.c,v 1.7 1996/03/17 02:04:07 thorpej Exp $ */
+/* $NetBSD: xd.c,v 1.10 1996/10/13 03:47:39 christos Exp $ */
/*
*
@@ -36,7 +36,7 @@
* x d . c x y l o g i c s 7 5 3 / 7 0 5 3 v m e / s m d d r i v e r
*
* author: Chuck Cranor <chuck@ccrc.wustl.edu>
- * id: $NetBSD: xd.c,v 1.7 1996/03/17 02:04:07 thorpej Exp $
+ * id: $NetBSD: xd.c,v 1.10 1996/10/13 03:47:39 christos Exp $
* started: 27-Feb-95
* references: [1] Xylogics Model 753 User's Manual
* part number: 166-753-001, Revision B, May 21, 1988.
@@ -101,7 +101,8 @@
* XDC_HWAIT: add iorq "N" to head of SC's wait queue
*/
#define XDC_HWAIT(SC, N) { \
- (SC)->waithead = ((SC)->waithead - 1) % XDC_MAXIOPB; \
+ (SC)->waithead = ((SC)->waithead == 0) ? \
+ (XDC_MAXIOPB - 1) : ((SC)->waithead - 1); \
(SC)->waitq[(SC)->waithead] = (N); \
(SC)->nwait++; \
}
diff --git a/sys/arch/sun3/dev/zs.c b/sys/arch/sun3/dev/zs.c
index c1f66193975..da46ddf06b2 100644
--- a/sys/arch/sun3/dev/zs.c
+++ b/sys/arch/sun3/dev/zs.c
@@ -1,9 +1,12 @@
-/* $NetBSD: zs.c,v 1.38 1996/06/17 15:17:06 gwr Exp $ */
+/* $NetBSD: zs.c,v 1.42 1996/11/20 18:57:03 gwr Exp $ */
-/*
- * Copyright (c) 1995 Gordon W. Ross
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Gordon W. Ross.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -12,22 +15,25 @@
* 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.
- * 4. All advertising materials mentioning features or use of this software
+ * 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Gordon Ross
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE 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.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -166,7 +172,7 @@ static u_char zs_init_reg[16] = {
/* Definition of the driver for autoconfig. */
static int zsc_match __P((struct device *, void *, void *));
static void zsc_attach __P((struct device *, struct device *, void *));
-static int zsc_print __P((void *, char *name));
+static int zsc_print __P((void *, const char *name));
struct cfattach zsc_ca = {
sizeof(struct zsc_softc), zsc_match, zsc_attach
@@ -328,7 +334,7 @@ zsc_attach(parent, self, aux)
static int
zsc_print(aux, name)
void *aux;
- char *name;
+ const char *name;
{
struct zsc_attach_args *args = aux;
diff --git a/sys/arch/sun3/include/autoconf.h b/sys/arch/sun3/include/autoconf.h
index 88b546db3c6..e1322fc8f12 100644
--- a/sys/arch/sun3/include/autoconf.h
+++ b/sys/arch/sun3/include/autoconf.h
@@ -1,10 +1,12 @@
-/* $NetBSD: autoconf.h,v 1.10 1996/03/26 15:16:28 gwr Exp $ */
+/* $NetBSD: autoconf.h,v 1.12 1996/11/20 18:57:05 gwr Exp $ */
-/*
- * Copyright (c) 1994 Gordon W. Ross
- * Copyright (c) 1993 Adam Glass
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Glass and Gordon W. Ross.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -15,21 +17,23 @@
* 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 Adam Glass.
- * 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 product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -58,7 +62,7 @@ struct confargs {
#define cf_intvec cf_loc[2]
int bus_scan __P((struct device *, void *, void *));
-int bus_print __P((void *, char *));
+int bus_print __P((void *, const char *));
int bus_peek __P((int, int, int));
char * bus_mapin __P((int, int, int));
diff --git a/sys/arch/sun3/include/conf.h b/sys/arch/sun3/include/conf.h
index 0f2abafae87..62acb7fd7e9 100644
--- a/sys/arch/sun3/include/conf.h
+++ b/sys/arch/sun3/include/conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.1 1996/11/11 23:51:40 kstailey Exp $ */
+/* $OpenBSD: conf.h,v 1.2 1996/11/23 07:55:02 kstailey Exp $ */
/*-
* Copyright (c) 1996 Kenneth Stailey. All rights reserved.
@@ -37,7 +37,6 @@ bdev_decl(rd);
bdev_decl(sw);
cdev_decl(sw);
-#include "xd.h"
bdev_decl(xd);
cdev_decl(xd);
@@ -45,7 +44,6 @@ cdev_decl(xd);
bdev_decl(xt);
cdev_decl(xt);
-#include "xy.h"
bdev_decl(xy);
cdev_decl(xy);
@@ -61,18 +59,10 @@ dev_decl(filedesc,open);
#define mmwrite mmrw
cdev_decl(mm);
-#define NZS 2 /* XXX: temporary hack */
cdev_decl(zs);
-cdev_decl(kd);
cdev_decl(ms);
cdev_decl(kbd);
-
-/* XXX - Should make keyboard/mouse real children of zs. */
-#if NZS > 1
-#define NKD 1
-#else
-#define NKD 0
-#endif
+cdev_decl(kd);
/* frame-buffer devices */
cdev_decl(fb);
diff --git a/sys/arch/sun3/include/float.h b/sys/arch/sun3/include/float.h
index 2f63ec177d8..42445f4b723 100644
--- a/sys/arch/sun3/include/float.h
+++ b/sys/arch/sun3/include/float.h
@@ -1,8 +1,3 @@
-/* $NetBSD: float.h,v 1.6 1995/06/20 20:45:55 jtc Exp $ */
-
-#ifndef _MACHINE_FLOAT_H_
-#define _MACHINE_FLOAT_H_
+/* $NetBSD: float.h,v 1.7 1996/11/20 18:57:09 gwr Exp $ */
#include <m68k/float.h>
-
-#endif
diff --git a/sys/arch/sun3/include/ieeefp.h b/sys/arch/sun3/include/ieeefp.h
index f0fadb000fd..6c1243b25ab 100644
--- a/sys/arch/sun3/include/ieeefp.h
+++ b/sys/arch/sun3/include/ieeefp.h
@@ -1,4 +1,3 @@
-/* $NetBSD: ieeefp.h,v 1.2 1995/04/16 01:50:45 gwr Exp $ */
+/* $NetBSD: ieeefp.h,v 1.3 1996/11/20 18:57:11 gwr Exp $ */
-/* Just use the common m68k definition */
#include <m68k/ieeefp.h>
diff --git a/sys/arch/sun3/include/obio.h b/sys/arch/sun3/include/obio.h
index b348e2e2f7a..e687a5a4206 100644
--- a/sys/arch/sun3/include/obio.h
+++ b/sys/arch/sun3/include/obio.h
@@ -1,9 +1,12 @@
-/* $NetBSD: obio.h,v 1.14 1996/03/26 15:16:32 gwr Exp $ */
+/* $NetBSD: obio.h,v 1.16 1996/11/20 18:57:14 gwr Exp $ */
-/*
- * Copyright (c) 1993 Adam Glass
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Glass.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -14,21 +17,23 @@
* 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 Adam Glass.
- * 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 product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -39,22 +44,22 @@
*
*/
-#define OBIO_KEYBD_MS 0x00000000
-#define OBIO_ZS 0x00020000
-#define OBIO_EEPROM 0x00040000
-#define OBIO_CLOCK 0x00060000
-#define OBIO_MEMERR 0x00080000
-#define OBIO_INTERREG 0x000A0000
-#define OBIO_INTEL_ETHER 0x000C0000
-#define OBIO_COLOR_MAP 0x000E0000
-#define OBIO_EPROM 0x00100000
-#define OBIO_AMD_ETHER 0x00120000
-#define OBIO_NCR_SCSI 0x00140000
-#define OBIO_RESERVED1 0x00160000
-#define OBIO_RESERVED2 0x00180000
-#define OBIO_IOX_BUS 0x001A0000
-#define OBIO_DES 0x001C0000
-#define OBIO_ECCREG 0x001E0000
+#define OBIO_KEYBD_MS 0x000000
+#define OBIO_ZS 0x020000
+#define OBIO_EEPROM 0x040000
+#define OBIO_CLOCK 0x060000
+#define OBIO_MEMERR 0x080000
+#define OBIO_INTERREG 0x0A0000
+#define OBIO_INTEL_ETHER 0x0C0000
+#define OBIO_COLOR_MAP 0x0E0000
+#define OBIO_EPROM 0x100000
+#define OBIO_AMD_ETHER 0x120000
+#define OBIO_NCR_SCSI 0x140000
+#define OBIO_RESERVED1 0x160000
+#define OBIO_RESERVED2 0x180000
+#define OBIO_IOX_BUS 0x1A0000
+#define OBIO_DES 0x1C0000
+#define OBIO_ECCREG 0x1E0000
#define OBIO_KEYBD_MS_SIZE 0x00008
#define OBIO_ZS_SIZE 0x00008
diff --git a/sys/arch/sun3/include/types.h b/sys/arch/sun3/include/types.h
index 60b9307473d..db77cff88b8 100644
--- a/sys/arch/sun3/include/types.h
+++ b/sys/arch/sun3/include/types.h
@@ -1,8 +1,3 @@
-/* $NetBSD: types.h,v 1.7 1995/06/27 14:38:22 gwr Exp $ */
-
-#ifndef _MACHINE_TYPES_H_
-#define _MACHINE_TYPES_H_
+/* $NetBSD: types.h,v 1.8 1996/11/20 18:57:21 gwr Exp $ */
#include <m68k/types.h>
-
-#endif
diff --git a/sys/arch/sun3/sun3/autoconf.c b/sys/arch/sun3/sun3/autoconf.c
index ce19dabe640..144fa399c65 100644
--- a/sys/arch/sun3/sun3/autoconf.c
+++ b/sys/arch/sun3/sun3/autoconf.c
@@ -1,10 +1,12 @@
-/* $NetBSD: autoconf.c,v 1.33 1996/04/07 05:45:08 gwr Exp $ */
+/* $NetBSD: autoconf.c,v 1.37 1996/11/20 18:57:22 gwr Exp $ */
-/*
- * Copyright (c) 1994 Gordon W. Ross
- * Copyright (c) 1993 Adam Glass
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Glass and Gordon W. Ross.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -15,20 +17,23 @@
* 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 Adam Glass.
- * 4. The name of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -170,7 +175,7 @@ int bus_scan(parent, child, aux)
int
bus_print(args, name)
void *args;
- char *name;
+ const char *name;
{
struct confargs *ca = args;
diff --git a/sys/arch/sun3/sun3/clock.c b/sys/arch/sun3/sun3/clock.c
index eb53ac66222..6517f3bf051 100644
--- a/sys/arch/sun3/sun3/clock.c
+++ b/sys/arch/sun3/sun3/clock.c
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.28 1996/03/26 15:16:42 gwr Exp $ */
+/* $NetBSD: clock.c,v 1.31 1996/10/30 00:24:42 gwr Exp $ */
/*
* Copyright (c) 1994 Gordon W. Ross
@@ -102,17 +102,14 @@ clock_match(parent, vcf, args)
if (cf->cf_unit != 0)
return (0);
- if ((pa = cf->cf_paddr) == -1) {
- /* Use our default PA. */
- pa = OBIO_CLOCK;
- } else {
- /* Validate the given PA. */
- if (pa != OBIO_CLOCK)
- panic("clock: wrong address");
- }
- if (pa != ca->ca_paddr)
+ /* Validate the given address. */
+ if (ca->ca_paddr != OBIO_CLOCK)
return (0);
+ /* Default interrupt priority. */
+ if (ca->ca_intpri == -1)
+ ca->ca_intpri = CLOCK_PRI;
+
return (1);
}
@@ -124,16 +121,8 @@ clock_attach(parent, self, args)
{
struct cfdata *cf = self->dv_cfdata;
struct confargs *ca = args;
- int pri;
-
- if ((pri = cf->cf_intpri) == -1) {
- pri = CLOCK_PRI;
- } else {
- if (pri != CLOCK_PRI)
- panic("clock: level != %d", CLOCK_PRI);
- }
- printf(" level %d\n", pri);
+ printf("\n");
/*
* Can not hook up the ISR until cpu_initclock()
diff --git a/sys/arch/sun3/sun3/conf.c b/sys/arch/sun3/sun3/conf.c
index 759a1c5b037..5dce4bfc940 100644
--- a/sys/arch/sun3/sun3/conf.c
+++ b/sys/arch/sun3/sun3/conf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.48 1996/03/14 21:35:47 christos Exp $ */
+/* $NetBSD: conf.c,v 1.51 1996/11/04 16:16:09 gwr Exp $ */
/*-
* Copyright (c) 1994 Adam Glass, Gordon W. Ross
@@ -51,6 +51,7 @@ int ttselect __P((dev_t, int, struct proc *));
#include "bpfilter.h"
#include "ccd.h"
#include "cd.h"
+#include "kbd.h"
#include "pty.h"
#include "rd.h"
#include "sd.h"
@@ -59,6 +60,9 @@ int ttselect __P((dev_t, int, struct proc *));
#include "tun.h"
#include "uk.h"
#include "vnd.h"
+#include "xd.h"
+#include "xy.h"
+#include "zstty.h"
struct bdevsw bdevsw[] =
{
@@ -92,7 +96,7 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
- cdev_tty_init(NKD,kd), /* 1: Sun keyboard/display */
+ cdev_tty_init(NKBD,kd), /* 1: Sun keyboard/display */
cdev_ctty_init(1,ctty), /* 2: controlling terminal */
cdev_mm_init(1,mm), /* 3: /dev/{null,mem,kmem,...} */
cdev_notdef(), /* 4: was PROM console */
@@ -103,8 +107,8 @@ struct cdevsw cdevsw[] =
cdev_disk_init(NXY,xy), /* 9: SMD disk on Xylogics 450/451 */
cdev_notdef(), /* 10: systech multi-terminal board */
cdev_notdef(), /* 11: DES encryption chip */
- cdev_tty_init(NZS,zs), /* 12: Zilog 8350 serial port */
- cdev_mouse_init(NKD,ms), /* 13: Sun mouse */
+ cdev_tty_init(NZSTTY,zs), /* 12: Zilog 8350 serial port */
+ cdev_mouse_init(NMS,ms), /* 13: Sun mouse */
cdev_notdef(), /* 14: cgone */
cdev_notdef(), /* 15: /dev/winXXX */
cdev_log_init(1,log), /* 16: /dev/klog */
@@ -120,7 +124,7 @@ struct cdevsw cdevsw[] =
cdev_notdef(), /* 26: bwone */
cdev_fb_init(NBWTWO,bw2), /* 27: bwtwo */
cdev_notdef(), /* 28: Systech VPC-2200 versatec/centronics */
- cdev_mouse_init(NKD,kbd), /* 29: Sun keyboard */
+ cdev_mouse_init(NKBD,kbd), /* 29: Sun keyboard */
cdev_tape_init(NXT,xt), /* 30: Xylogics tape */
cdev_fb_init(NCGTWO,cg2), /* 31: cgtwo */
cdev_notdef(), /* 32: /dev/gpone */
diff --git a/sys/arch/sun3/sun3/disksubr.c b/sys/arch/sun3/sun3/disksubr.c
index 42864e70294..6bd75f2917f 100644
--- a/sys/arch/sun3/sun3/disksubr.c
+++ b/sys/arch/sun3/sun3/disksubr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: disksubr.c,v 1.13 1996/05/05 06:00:31 gwr Exp $ */
+/* $NetBSD: disksubr.c,v 1.14 1996/09/26 18:10:21 gwr Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@@ -235,14 +235,14 @@ int
bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
{
struct partition *p = lp->d_partitions + dkpart(bp->b_dev);
- int labelsect = lp->d_partitions[0].p_offset;
int maxsz = p->p_size;
int sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
/* overwriting disk label ? */
/* XXX should also protect bootstrap in first 8K */
- if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect &&
- (bp->b_flags & B_READ) == 0 && wlabel == 0)
+ /* XXX PR#2598: labelsect is always sector zero. */
+ if (((bp->b_blkno + p->p_offset) <= LABELSECTOR) &&
+ ((bp->b_flags & B_READ) == 0) && (wlabel == 0))
{
bp->b_error = EROFS;
goto bad;
diff --git a/sys/arch/sun3/sun3/genassym.c b/sys/arch/sun3/sun3/genassym.c
index a8f40b82db9..dcbee10994d 100644
--- a/sys/arch/sun3/sun3/genassym.c
+++ b/sys/arch/sun3/sun3/genassym.c
@@ -1,4 +1,4 @@
-/* $NetBSD: genassym.c,v 1.31 1996/02/16 23:36:52 gwr Exp $ */
+/* $NetBSD: genassym.c,v 1.32 1996/10/23 16:39:27 gwr Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@@ -60,6 +60,24 @@
#include "interreg.h"
#include "buserr.h"
+#if 1 /* XXX - Temporary hack... */
+/*
+ * Make this work correctly on a SPARC!
+ * Should be able to fix this by adding:
+ * __attribute__((packed)) where needed.
+ */
+struct mytrapframe {
+ int tf_regs[16];
+ short tf_pad;
+ short tf_stackadj;
+ u_short tf_sr;
+ u_short tf_pc[2]; /* XXX was: u_int tf_pc; */
+ u_short tf_format:4,
+ tf_vector:12;
+};
+#define trapframe mytrapframe
+#endif /* XXX */
+
#ifdef __STDC__
#define def1(name) def(#name, name)
#else
@@ -82,7 +100,7 @@ main()
struct proc *p = (struct proc *) 0;
struct vmspace *vms = (struct vmspace *) 0;
struct intersil7170 *intersil_addr = (struct intersil7170 *) 0;
- struct frame *fp = (struct frame *) 0;
+ struct trapframe *tf = (struct trapframe *) 0;
struct fpframe *fpf = (struct fpframe *) 0;
/* intersil clock internals */
@@ -163,13 +181,13 @@ main()
def("PCB_REGS", pcb->pcb_regs);
def("PCB_ONFAULT", &pcb->pcb_onfault);
def("PCB_FPCTX", &pcb->pcb_fpregs);
- def("SIZEOF_PCB", sizeof(struct pcb));
+ def("SIZEOF_PCB", sizeof(*pcb));
/* exception frame offset/sizes */
- def("FR_SP", &fp->f_regs[15]);
- def("FR_HW", &fp->f_sr);
- def("FR_ADJ", &fp->f_stackadj);
- def("FR_SIZE", sizeof(struct trapframe));
+ def("FR_SP", &tf->tf_regs[15]);
+ def("FR_ADJ", &tf->tf_stackadj);
+ def("FR_HW", &tf->tf_sr);
+ def("FR_SIZE", sizeof(*tf));
/* FP frame offsets */
def("FPF_REGS", &fpf->fpf_regs[0]);
diff --git a/sys/arch/sun3/sun3/intreg.c b/sys/arch/sun3/sun3/intreg.c
index 63e4eb1cbb6..fd10cd7ac43 100644
--- a/sys/arch/sun3/sun3/intreg.c
+++ b/sys/arch/sun3/sun3/intreg.c
@@ -1,10 +1,12 @@
-/* $NetBSD: intreg.c,v 1.1 1996/03/26 15:03:11 gwr Exp $ */
+/* $NetBSD: intreg.c,v 1.5 1996/11/20 18:57:32 gwr Exp $ */
-/*
- * Copyright (c) 1994 Gordon W. Ross
- * Copyright (c) 1993 Adam Glass
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Glass and Gordon W. Ross.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -15,20 +17,23 @@
* 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 Adam Glass.
- * 4. The name of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -93,15 +98,8 @@ intreg_match(parent, vcf, args)
if (cf->cf_unit != 0)
return (0);
- if ((pa = cf->cf_paddr) == -1) {
- /* Use our default PA. */
- pa = OBIO_INTERREG;
- } else {
- /* Validate the given PA. */
- if (pa != OBIO_INTERREG)
- panic("clock: wrong address");
- }
- if (pa != ca->ca_paddr)
+ /* Validate the given address. */
+ if (ca->ca_paddr != OBIO_INTERREG)
return (0);
return (1);
diff --git a/sys/arch/sun3/sun3/locore.s b/sys/arch/sun3/sun3/locore.s
index c677314e0dd..15794d5362f 100644
--- a/sys/arch/sun3/sun3/locore.s
+++ b/sys/arch/sun3/sun3/locore.s
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.39 1996/06/17 15:40:52 gwr Exp $ */
+/* $NetBSD: locore.s,v 1.40 1996/11/06 20:19:54 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@@ -871,11 +871,11 @@ Lset2:
#endif
/*
- * remrq(p)
+ * remrunqueue(p)
*
* Call should be made at splclock().
*/
-ENTRY(remrq)
+ENTRY(remrunqueue)
movl sp@(4),a0 | proc *p
clrl d0
movb a0@(P_PRIORITY),d0
@@ -904,7 +904,7 @@ Lrem2:
movl #Lrem3,sp@-
jbsr _panic
Lrem3:
- .asciz "remrq"
+ .asciz "remrunqueue"
| Message for Lbadsw panic
diff --git a/sys/arch/sun3/sun3/machdep.c b/sys/arch/sun3/sun3/machdep.c
index 695364e1b9e..a59f16fda38 100644
--- a/sys/arch/sun3/sun3/machdep.c
+++ b/sys/arch/sun3/sun3/machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.71 1996/03/26 15:16:53 gwr Exp $ */
+/* $NetBSD: machdep.c,v 1.77 1996/10/13 03:47:51 christos Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@@ -63,6 +63,8 @@
#include <sys/mount.h>
#include <sys/user.h>
#include <sys/exec.h>
+#include <sys/core.h>
+#include <sys/kcore.h>
#include <sys/vnode.h>
#include <sys/sysctl.h>
#include <sys/syscallargs.h>
@@ -82,6 +84,7 @@
#include <machine/pte.h>
#include <machine/mon.h>
#include <machine/isr.h>
+#include <machine/kcore.h>
#include <dev/cons.h>
@@ -102,6 +105,7 @@ extern int cold;
int physmem;
int fpu_type;
+int msgbufmapped;
/*
* safepri is a safe priority for sleep to set for a spin-wait
@@ -134,9 +138,16 @@ void identifycpu();
*/
void consinit()
{
- extern void cninit();
- cninit();
+ extern void cninit();
+ cninit();
+#ifdef KGDB
+ /* XXX - Ask on console for kgdb_dev? */
+ zs_kgdb_init(); /* XXX */
+ /* Note: kgdb_connect() will just return if kgdb_dev<0 */
+ if (boothowto & RB_KDB)
+ kgdb_connect(1);
+#endif
#ifdef DDB
/* Now that we have a console, we can stop in DDB. */
db_machine_init();
@@ -228,12 +239,12 @@ cpu_startup()
vm_size_t size;
int base, residual;
vm_offset_t minaddr, maxaddr;
-
+
/*
* The msgbuf was set up earlier (in sun3_startup.c)
* just because it was more convenient to do there.
*/
-
+
/*
* Good {morning,afternoon,evening,night}.
*/
@@ -348,13 +359,6 @@ cpu_startup()
/*
* Configure the system.
*/
- if (boothowto & RB_CONFIG) {
-#ifdef BOOT_CONFIG
- user_config();
-#else
- printf("kernel does not support -c; continuing..\n");
-#endif
- }
configure();
}
@@ -761,26 +765,21 @@ sys_sigreturn(p, v, retval)
int waittime = -1; /* XXX - Who else looks at this? -gwr */
static void reboot_sync()
{
- extern struct proc proc0;
struct buf *bp;
int iter, nbusy;
/* Check waittime here to localize its use to this function. */
if (waittime >= 0)
return;
- /* fix curproc */
- if (curproc == NULL)
- curproc = &proc0;
waittime = 0;
vfs_shutdown();
}
-struct pcb dumppcb;
-
/*
* Common part of the BSD and SunOS reboot system calls.
*/
-int reboot2(howto, user_boot_string)
+__dead void
+boot(howto, user_boot_string)
int howto;
char *user_boot_string;
{
@@ -808,10 +807,8 @@ int reboot2(howto, user_boot_string)
splhigh();
/* Write out a crash dump if asked. */
- if (howto & RB_DUMP) {
- savectx(&dumppcb);
+ if (howto & RB_DUMP)
dumpsys();
- }
/* run any shutdown hooks */
doshutdownhooks();
@@ -850,31 +847,23 @@ int reboot2(howto, user_boot_string)
}
printf("Kernel rebooting...\n");
sun3_mon_reboot(bs);
+ for (;;) ;
/*NOTREACHED*/
}
/*
- * BSD reboot system call
- * XXX - Should be named: cpu_reboot maybe? -gwr
- * XXX - It would be nice to allow a second argument
- * that specifies a machine-dependent boot string that
- * is passed to the boot program if RB_STRING is set.
- */
-void boot(howto)
- int howto;
-{
- (void) reboot2(howto, NULL);
- for(;;);
- /* NOTREACHED */
-}
-
-/*
* These variables are needed by /sbin/savecore
*/
u_long dumpmag = 0x8fca0101; /* magic number */
int dumpsize = 0; /* pages */
long dumplo = 0; /* blocks */
+/* Our private scratch page for dumping the MMU. */
+vm_offset_t dumppage_va;
+vm_offset_t dumppage_pa;
+
+#define DUMP_EXTRA 3 /* CPU-dependent extra pages */
+
/*
* This is called by cpu_startup to set dumplo, dumpsize.
* Dumps always skip the first CLBYTES of disk space
@@ -903,37 +892,147 @@ dumpconf()
return;
/* Position dump image near end of space, page aligned. */
- dumpsize = physmem; /* pages */
+ dumpsize = physmem + DUMP_EXTRA; /* pages */
dumplo = nblks - ctod(dumpsize);
dumplo &= ~(ctod(1)-1);
/* If it does not fit, truncate it by moving dumplo. */
- /* Note: Must force signed comparison (fixes PR#887) */
+ /* Note: Must force signed comparison. */
if (dumplo < ((long)ctod(1))) {
dumplo = ctod(1);
dumpsize = dtoc(nblks - dumplo);
}
}
+struct pcb dumppcb;
+extern vm_offset_t avail_start;
+
/*
- * Write a crash dump.
+ * Write a crash dump. The format while in swap is:
+ * kcore_seg_t cpu_hdr;
+ * cpu_kcore_hdr_t cpu_data;
+ * padding (NBPG-sizeof(kcore_seg_t))
+ * pagemap (2*NBPG)
+ * physical memory...
*/
dumpsys()
{
-#if 1
- printf("dumping not supported yet :)\n");
-#else
+ struct bdevsw *dsw;
+ kcore_seg_t *kseg_p;
+ cpu_kcore_hdr_t *chdr_p;
+ char *vaddr;
+ vm_offset_t paddr;
+ int psize, todo, chunk;
+ daddr_t blkno;
+ int error = 0;
+
msgbufmapped = 0;
if (dumpdev == NODEV)
return;
- if (dumpsize == 0) {
+ if (dumppage_va == 0)
+ return;
+
+ /*
+ * For dumps during autoconfiguration,
+ * if dump device has already configured...
+ */
+ if (dumpsize == 0)
dumpconf();
- if (dumpsize == 0)
- return;
+ if (dumplo <= 0)
+ return;
+ savectx(&dumppcb);
+
+ dsw = &bdevsw[major(dumpdev)];
+ psize = (*(dsw->d_psize))(dumpdev);
+ if (psize == -1) {
+ printf("dump area unavailable\n");
+ return;
}
+
printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo);
- /* XXX - todo... */
-#endif
+
+ /*
+ * Write the dump header, including MMU state.
+ */
+ blkno = dumplo;
+ todo = dumpsize - DUMP_EXTRA; /* pages */
+ vaddr = (char*)dumppage_va;
+ bzero(vaddr, NBPG);
+
+ /* kcore header */
+ kseg_p = (kcore_seg_t *)vaddr;
+ CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU);
+ kseg_p->c_size = (ctob(DUMP_EXTRA) - sizeof(kcore_seg_t));
+
+ /* MMU state */
+ chdr_p = (cpu_kcore_hdr_t *) (kseg_p + 1);
+ pmap_get_ksegmap(chdr_p->ksegmap);
+ error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
+ if (error)
+ goto fail;
+ blkno += btodb(NBPG);
+
+ /* translation RAM (page zero) */
+ pmap_get_pagemap(vaddr, 0);
+ error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
+ if (error)
+ goto fail;
+ blkno += btodb(NBPG);
+
+ /* translation RAM (page one) */
+ pmap_get_pagemap(vaddr, NBPG);
+ error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
+ if (error)
+ goto fail;
+ blkno += btodb(NBPG);
+
+ /*
+ * Now dump physical memory. Have to do it in two chunks.
+ * The first chunk is "unmanaged" (by the VM code) and its
+ * range of physical addresses is not allow in pmap_enter.
+ * However, that segment is mapped linearly, so we can just
+ * use the virtual mappings already in place. The second
+ * chunk is done the normal way, using pmap_enter.
+ *
+ * Note that vaddr==(paddr+KERNBASE) for paddr=0 through etext.
+ */
+
+ /* Do the first chunk (0 <= PA < avail_start) */
+ paddr = 0;
+ chunk = btoc(avail_start);
+ if (chunk > todo)
+ chunk = todo;
+ do {
+ if ((todo & 0xf) == 0)
+ printf("\r%4d", todo);
+ vaddr = (char*)(paddr + KERNBASE);
+ error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
+ if (error)
+ goto fail;
+ paddr += NBPG;
+ blkno += btodb(NBPG);
+ --todo;
+ } while (--chunk > 0);
+
+ /* Do the second chunk (avail_start <= PA < dumpsize) */
+ vaddr = (char*)vmmap; /* Borrow /dev/mem VA */
+ do {
+ if ((todo & 0xf) == 0)
+ printf("\r%4d", todo);
+ pmap_enter(pmap_kernel(), vmmap, paddr | PMAP_NC,
+ VM_PROT_READ, FALSE);
+ error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
+ pmap_remove(pmap_kernel(), vmmap, vmmap + NBPG);
+ if (error)
+ goto fail;
+ paddr += NBPG;
+ blkno += btodb(NBPG);
+ } while (--todo > 0);
+
+ printf("\rdump succeeded\n");
+ return;
+fail:
+ printf(" dump error=%d\n", error);
}
initcpu()