diff options
Diffstat (limited to 'sys/arch')
48 files changed, 1621 insertions, 529 deletions
diff --git a/sys/arch/sun3/conf/DISKLESS b/sys/arch/sun3/conf/DISKLESS index 4a8592cb886..48e021de254 100644 --- a/sys/arch/sun3/conf/DISKLESS +++ b/sys/arch/sun3/conf/DISKLESS @@ -1,4 +1,4 @@ -# $NetBSD: DISKLESS,v 1.12 1996/03/26 15:15:46 gwr Exp $ +# $NetBSD: DISKLESS,v 1.12.4.1 1996/08/19 23:35:03 gwr Exp $ # # DISKLESS Sun3 (3/50, 3/60, 3/110, 3/160, 3/260) @@ -16,33 +16,37 @@ options HAVECACHE # Sun3/260 VAC maxusers 4 # Standard system options -options SWAPPAGER, DEVPAGER # paging -options KTRACE # system call tracing support -#makeoptions DEBUG="-g" # symbols for kgdb + nm +options SWAPPAGER, VNODEPAGER, DEVPAGER # paging +options KTRACE # system call tracing support + +# 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 +options NFSCLIENT # nfs client support # options FDESC # /dev/fd/* -options FIFO # FIFOs; RECOMMENDED -options KERNFS # /kern -options NULLFS # loopback file system -#options PROCFS # /proc -#options UNION # union file system +options FIFO # FIFOs; RECOMMENDED +options KERNFS # /kern +options NULLFS # loopback file system +options PROCFS # /proc # Networking options -options INET # IP prototol stack support +options INET # IP prototol stack support +#options GATEWAY # IP packet forwarding +options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD # XXX - Work-around for root on slow SunOS/Sun3 servers (sigh...) options NFS_BOOT_RWSIZE=1024 # Compatability options options COMPAT_SUNOS # can run SunOS 4.1.1 executables -#options COMPAT_09 # NetBSD 0.9, -options COMPAT_10 # NetBSD 1.0, -options COMPAT_11 # NetBSD 1.1, -options COMPAT_43 # and 4.3BSD -#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD +options COMPAT_43 # and 4.3BSD and ... +options COMPAT_10 # NetBSD 1.0 +options COMPAT_11 # NetBSD 1.1 +options COMPAT_12 # NetBSD 1.2 options UCONSOLE # Allow non-root TIOCCONS # Sun3-specific debugging options @@ -52,7 +56,7 @@ options UCONSOLE # Allow non-root TIOCCONS #options EXEC_DEBUG #options DIAGNOSTIC -config bsd root on nfs swap on nfs +config netbsd root on nfs swap on nfs # # Serial ports @@ -106,10 +110,5 @@ cgtwo0 at vmes0 addr 0xff400000 level 4 vect 0xA8 # Misc. pseudo-device loop 1 # network loopback -#pseudo-device bpfilter 8 # packet filter -#pseudo-device sl 2 # CSLIP -#pseudo-device ppp 2 # PPP -#pseudo-device tun 2 # network tunneling over tty pseudo-device pty 32 # pseudo-terminals -#pseudo-device vnd 4 # paging to files diff --git a/sys/arch/sun3/conf/FOUR_TTYS b/sys/arch/sun3/conf/FOUR_TTYS index bb5ea510136..456110d4862 100644 --- a/sys/arch/sun3/conf/FOUR_TTYS +++ b/sys/arch/sun3/conf/FOUR_TTYS @@ -1,4 +1,4 @@ -# $NetBSD: FOUR_TTYS,v 1.1 1996/03/26 15:14:27 gwr Exp $ +# $NetBSD: FOUR_TTYS,v 1.1.4.1 1996/08/19 23:35:05 gwr Exp $ # # FOUR_TTYS Sun3 (3/50, 3/60, 3/110, 3/160, 3/260) @@ -16,15 +16,19 @@ options HAVECACHE # Sun3/260 VAC maxusers 4 # Standard system options -options SWAPPAGER, DEVPAGER # paging +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 NFSSERVER # nfs server support -options NFSCLIENT # nfs client support -options FFS # ufs file system +options NFSSERVER # nfs server support +options NFSCLIENT # nfs client support +options FFS # ufs file system # options CD9660 # ISO 9660 + Rock Ridge file system options FDESC # /dev/fd/* @@ -33,19 +37,21 @@ options KERNFS # /kern options NULLFS # loopback file system options PROCFS # /proc options UNION # union file system +options MFS # memory-based filesystem # Networking options -options INET # IP prototol stack support +options INET # IP prototol stack support +#options GATEWAY # IP packet forwarding +options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD # XXX - Work-around for root on slow SunOS/Sun3 servers (sigh...) options NFS_BOOT_RWSIZE=1024 # Compatability options options COMPAT_SUNOS # can run SunOS 4.1.1 executables -#options COMPAT_09 # NetBSD 0.9, -options COMPAT_10 # NetBSD 1.0, -options COMPAT_11 # NetBSD 1.1, -options COMPAT_43 # and 4.3BSD -#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD +options COMPAT_43 # and 4.3BSD and ... +options COMPAT_10 # NetBSD 1.0 +options COMPAT_11 # NetBSD 1.1 +options COMPAT_12 # NetBSD 1.2 options UCONSOLE # Allow non-root TIOCCONS # Sun3-specific debugging options @@ -56,7 +62,7 @@ options PMAP_DEBUG options DIAGNOSTIC #options SCSIDEBUG -config bsd swap generic +config netbsd swap generic # # Serial ports diff --git a/sys/arch/sun3/conf/GENERIC b/sys/arch/sun3/conf/GENERIC index c74494aaa6e..e14fe023624 100644 --- a/sys/arch/sun3/conf/GENERIC +++ b/sys/arch/sun3/conf/GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.27 1996/03/26 15:15:50 gwr Exp $ +# $NetBSD: GENERIC,v 1.27.4.1 1996/08/19 23:35:06 gwr Exp $ # # GENERIC Sun3 (3/50, 3/60, 3/110, 3/160, 3/260) @@ -8,7 +8,7 @@ include "std.sun3" # Machines to be supported by this kernel -options GENERIC +options GENERIC options FPU_EMULATE options HAVECACHE # Sun3/260 VAC @@ -16,36 +16,42 @@ options HAVECACHE # Sun3/260 VAC maxusers 4 # Standard system options -options SWAPPAGER, DEVPAGER # paging -options KTRACE # system call tracing support -#makeoptions DEBUG="-g" # symbols for kgdb + nm +options SWAPPAGER, VNODEPAGER, DEVPAGER # paging +options KTRACE # system call tracing support + +# 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 NFSSERVER # nfs server support -options NFSCLIENT # nfs client support -options FFS # ufs file system +options NFSSERVER # nfs server support +options NFSCLIENT # nfs client support +options FFS # ufs file system # -options CD9660 # ISO 9660 + Rock Ridge file system +options CD9660 # ISO 9660 + Rock Ridge file system options FDESC # /dev/fd/* -options FIFO # FIFOs; RECOMMENDED -options KERNFS # /kern -options NULLFS # loopback file system +options FIFO # FIFOs; RECOMMENDED +options KERNFS # /kern +options NULLFS # loopback file system options PROCFS # /proc options UNION # union file system +options MFS # memory-based filesystem # Networking options -options INET # IP prototol stack support +options INET # IP prototol stack support +#options GATEWAY # IP packet forwarding +options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD # XXX - Work-around for root on slow SunOS/Sun3 servers (sigh...) options NFS_BOOT_RWSIZE=1024 # Compatability options options COMPAT_SUNOS # can run SunOS 4.1.1 executables -#options COMPAT_09 # NetBSD 0.9, -options COMPAT_10 # NetBSD 1.0, -options COMPAT_11 # NetBSD 1.1, -options COMPAT_43 # and 4.3BSD -#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD +options COMPAT_43 # and 4.3BSD and ... +options COMPAT_10 # NetBSD 1.0 +options COMPAT_11 # NetBSD 1.1 +options COMPAT_12 # NetBSD 1.2 options UCONSOLE # Allow non-root TIOCCONS # Sun3-specific debugging options @@ -56,7 +62,7 @@ options PMAP_DEBUG options DIAGNOSTIC #options SCSIDEBUG -config bsd swap generic +config netbsd swap generic # # Serial ports @@ -148,9 +154,7 @@ st* at scsibus? target ? lun ? cd0 at scsibus? target 6 lun 0 cd* at scsibus? target ? lun ? -ch* at scsibus? target ? lun ? -ss* at scsibus? target ? lun ? -uk* at scsibus? target ? lun ? +#ch* at scsibus? target ? lun ? # RAM-disk drivers pseudo-device rd 2 diff --git a/sys/arch/sun3/conf/GENERIC_KGDB b/sys/arch/sun3/conf/GENERIC_KGDB new file mode 100644 index 00000000000..e083844dc4a --- /dev/null +++ b/sys/arch/sun3/conf/GENERIC_KGDB @@ -0,0 +1,171 @@ +# $NetBSD: GENERIC_KGDB,v 1.1.2.1 1996/08/19 23:35:07 gwr Exp $ + +# +# GENERIC_KGDB Sun3 (3/50, 3/60, 3/110, 3/160, 3/260) +# like GENERIC but supports KGDB (gdb -k on other machine) +# + +include "std.sun3" + +# Machines to be supported by this kernel +options GENERIC +options FPU_EMULATE +options HAVECACHE # Sun3/260 VAC + +# Needs to be set per system. i.e change these as you see fit +maxusers 4 + +# Standard system options +options SWAPPAGER, VNODEPAGER, DEVPAGER # paging +options KTRACE # system call tracing support + +# 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 NFSSERVER # nfs server support +options NFSCLIENT # nfs client support +options FFS # ufs file system +# +options CD9660 # ISO 9660 + Rock Ridge file system +options FDESC # /dev/fd/* +options FIFO # FIFOs; RECOMMENDED +options KERNFS # /kern +options NULLFS # loopback file system +options PROCFS # /proc +options UNION # union file system +options MFS # memory-based filesystem + +# Networking options +options INET # IP prototol stack support +#options GATEWAY # IP packet forwarding +options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD +# XXX - Work-around for root on slow SunOS/Sun3 servers (sigh...) +options NFS_BOOT_RWSIZE=1024 + +# Compatability options +options COMPAT_SUNOS # can run SunOS 4.1.1 executables +options COMPAT_43 # and 4.3BSD and ... +options COMPAT_10 # NetBSD 1.0 +options COMPAT_11 # NetBSD 1.1 +options COMPAT_12 # NetBSD 1.2 +options UCONSOLE # Allow non-root TIOCCONS + +# Sun3-specific debugging options +options PMAP_DEBUG +#options VMFAULT_TRACE +#options SYSCALL_DEBUG +#options EXEC_DEBUG +options DIAGNOSTIC +#options SCSIDEBUG +options NCR5380_DEBUG + +config netbsd swap generic + +# +# Serial ports +# +zstty0 at zsc1 channel 0 # ttya +zstty1 at zsc1 channel 1 # ttyb + +kbd0 at zsc0 channel 0 # keyboard +ms0 at zsc0 channel 1 # mouse + +# +# Network devices +# + +# Intel Ethernet (onboard, or VME) +ie0 at obio0 addr ? level ? +ie1 at vmes0 addr 0xffe88000 level 3 vect 0x75 + +# Lance Ethernet (only onboard) +le0 at obio0 addr ? level ? + +# +# Disk and tape devices +# + +# Sun3 "si" SCSI controller (NCR 5380) +si0 at obio0 addr ? level ? +si0 at vmes0 addr 0xff200000 level 2 vect 0x40 +si1 at vmes0 addr 0xff204000 level 2 vect 0x41 + +# Xylogics 7053 controllers +# xdc0 at vmel0 addr 0xffffee80 level 2 vect 0x44 +# xdc1 at vmel0 addr 0xffffee90 level 2 vect 0x45 +# xd* at xdc? drive ? + +# Xylogics 450/451 controllers +# xyc0 at vmes0 addr 0xffffee40 level 2 vect 0x48 +# xyc1 at vmes0 addr 0xffffee48 level 2 vect 0x49 +# xy* at xyc? drive ? + +# Xylogics 472 tape controllers? + +# +# Frame buffer devices +# + +# The default cgfour address depends on the machine: +# 3/60: obmem 0xFF200000 .. 0xFF9fffff +# 3/110: different? (not tested) +cgfour0 at obmem0 addr ? + +# 3/60 P4 accelerated 8-bit color frame buffer +# cgsix0 at obmem0 addr ? + +# 3/60 P4 24-bit color frame buffer +# cgeight0 at obmem0 addr ? + +# The default bwtwo address depends on the machine: +# 3/50: obmem 0x100000 +# else: obmem 0xff000000 +bwtwo0 at obmem0 addr ? +# 3/60 P4 color frame buffer overlay plane, or P4 monochrome frame buffer +#bwtwo1 at obmem0 addr 0xff300000 +# 3/60 plug-in color frame buffer overlay plane +#bwtwo1 at obmem0 addr 0xff400000 + +# Sun-3 color board, or CG5 8-bit VME frame buffer. +cgtwo0 at vmes0 addr 0xff400000 level 4 vect 0xA8 + +# Support for the CG9 24-bit VME frame buffer. +# cgnine0 at vmel0 addr 0x08000000 + +# +# SCSI infrastructure +# +scsibus* at scsi? + +# Sun compatible scsi device mappings +sd0 at scsibus? target 0 lun 0 +sd1 at scsibus? target 0 lun 1 +sd2 at scsibus? target 1 lun 0 +sd3 at scsibus? target 1 lun 1 +sd* at scsibus? target ? lun ? + +st0 at scsibus? target 4 lun 0 +st1 at scsibus? target 5 lun 0 +st* at scsibus? target ? lun ? + +cd0 at scsibus? target 6 lun 0 +cd* at scsibus? target ? lun ? + +#ch* at scsibus? target ? lun ? + +# RAM-disk drivers +pseudo-device rd 2 + +# Misc. +pseudo-device loop 1 # network loopback +pseudo-device bpfilter 8 # packet filter +pseudo-device sl 2 # CSLIP +pseudo-device ppp 2 # PPP +pseudo-device tun 2 # network tunneling over tty + +pseudo-device pty 64 # pseudo-terminals +#pseudo-device vnd 4 # paging to files diff --git a/sys/arch/sun3/conf/Makefile.sun3 b/sys/arch/sun3/conf/Makefile.sun3 index 1406711ba2d..eecbcb42fdf 100644 --- a/sys/arch/sun3/conf/Makefile.sun3 +++ b/sys/arch/sun3/conf/Makefile.sun3 @@ -146,7 +146,7 @@ links: SRCS= ${SUN3}/sun3/locore.s \ param.c ioconf.c ${CFILES} ${SFILES} -depend: .depend +depend:: .depend .depend: ${SRCS} assym.h param.c mkdep ${AFLAGS} ${CPPFLAGS} ${SUN3}/sun3/locore.s mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} diff --git a/sys/arch/sun3/conf/RAMDISK b/sys/arch/sun3/conf/RAMDISK index 39f5858ef16..435ec57f078 100644 --- a/sys/arch/sun3/conf/RAMDISK +++ b/sys/arch/sun3/conf/RAMDISK @@ -1,4 +1,4 @@ -# $NetBSD: RAMDISK,v 1.3 1996/03/26 15:15:53 gwr Exp $ +# $NetBSD: RAMDISK,v 1.3.4.1 1996/08/19 23:35:10 gwr Exp $ # # RAMDISK: Root/swap on ramdisk @@ -11,15 +11,20 @@ include "std.sun3" # Machines to be supported by this kernel +options FPU_EMULATE # XXX - Should not be needed! 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 # paging -#makeoptions DEBUG="-g" # symbols for kgdb + nm +options SWAPPAGER, VNODEPAGER, DEVPAGER # paging + +# Debugging options. Uncomment either this: #options DDB +# ... or these two: (for KGDB on another machine) +makeoptions DEBUG="-g" # symbols for kgdb + nm +options KGDB # Enable the hooks used for initializing the ram-disk. options RAMDISK_HOOKS @@ -27,31 +32,31 @@ options MINIROOTSIZE=512 # 256K # Filesystem options # May need NFSCLIENT to get miniroot image -options NFSCLIENT # nfs client support +options NFSCLIENT # nfs client support # Need FFS for the ramdisk image -options FFS # ufs file system -options FIFO # FIFOs; RECOMMENDED +options FFS # ufs file system +options FIFO # FIFOs; RECOMMENDED # Networking options -options INET # IP prototol stack support +options INET # IP prototol stack support +options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD # XXX - Work-around for root on slow SunOS/Sun3 servers (sigh...) options NFS_BOOT_RWSIZE=1024 # Compatability options #options COMPAT_SUNOS # can run SunOS 4.1.1 executables -#options COMPAT_09 # NetBSD 0.9, -options COMPAT_10 # NetBSD 1.0, -options COMPAT_11 # NetBSD 1.1, -options COMPAT_43 # and 4.3BSD -#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD -#options UCONSOLE # Allow non-root TIOCCONS +#options COMPAT_43 # and 4.3BSD and ... +#options COMPAT_10 # NetBSD 1.0 +options COMPAT_11 # NetBSD 1.1 +options COMPAT_12 # NetBSD 1.2 +options UCONSOLE # Allow non-root TIOCCONS # Sun3-specific debugging options options DIAGNOSTIC # The config program assumes all devices have partions... # Is it OK to put swap on a non-existent partition? -config bsd root on rd0a swap on rd0b +config netbsd root on rd0a swap on rd0b # # Serial ports diff --git a/sys/arch/sun3/conf/SMD_TEST b/sys/arch/sun3/conf/SMD_TEST index 0c0eefc4fa1..404e60e938d 100644 --- a/sys/arch/sun3/conf/SMD_TEST +++ b/sys/arch/sun3/conf/SMD_TEST @@ -1,4 +1,4 @@ -# $NetBSD: SMD_TEST,v 1.2 1996/03/26 15:15:57 gwr Exp $ +# $NetBSD: SMD_TEST,v 1.2.4.1 1996/08/19 23:35:11 gwr Exp $ # # SMD_TEST - for Sun3 (3/50, 3/60, 3/110, 3/160, 3/260) @@ -8,7 +8,7 @@ include "std.sun3" # Machines to be supported by this kernel -options GENERIC +options GENERIC options FPU_EMULATE options HAVECACHE # Sun3/260 VAC @@ -16,36 +16,42 @@ options HAVECACHE # Sun3/260 VAC maxusers 4 # Standard system options -options SWAPPAGER # paging -options KTRACE # system call tracing support -#makeoptions DEBUG="-g" # symbols for kgdb + nm -options DDB +options SWAPPAGER, VNODEPAGER, DEVPAGER # paging +options KTRACE # system call tracing support + +# 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 NFSSERVER # nfs server support -options NFSCLIENT # nfs client support -options FFS # ufs file system +options NFSSERVER # nfs server support +options NFSCLIENT # nfs client support +options FFS # ufs file system # -options CD9660 # ISO 9660 + Rock Ridge file system +options CD9660 # ISO 9660 + Rock Ridge file system options FDESC # /dev/fd/* -options FIFO # FIFOs; RECOMMENDED -options KERNFS # /kern -options NULLFS # loopback file system +options FIFO # FIFOs; RECOMMENDED +options KERNFS # /kern +options NULLFS # loopback file system options PROCFS # /proc options UNION # union file system +options MFS # memory-based filesystem # Networking options -options INET # IP prototol stack support +options INET # IP prototol stack support +#options GATEWAY # IP packet forwarding +options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD # XXX - Work-around for root on slow SunOS/Sun3 servers (sigh...) options NFS_BOOT_RWSIZE=1024 # Compatability options options COMPAT_SUNOS # can run SunOS 4.1.1 executables -#options COMPAT_09 # NetBSD 0.9, -options COMPAT_10 # NetBSD 1.0, -options COMPAT_11 # NetBSD 1.1, -options COMPAT_43 # and 4.3BSD -#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD +options COMPAT_43 # and 4.3BSD and ... +options COMPAT_10 # NetBSD 1.0 +options COMPAT_11 # NetBSD 1.1 +options COMPAT_12 # NetBSD 1.2 options UCONSOLE # Allow non-root TIOCCONS # Sun3-specific debugging options @@ -56,7 +62,7 @@ options UCONSOLE # Allow non-root TIOCCONS options DIAGNOSTIC #options SCSIDEBUG -config bsd swap generic +config netbsd swap generic # # Serial ports diff --git a/sys/arch/sun3/conf/files.sun3 b/sys/arch/sun3/conf/files.sun3 index ca1e4d39201..d8e9006bd90 100644 --- a/sys/arch/sun3/conf/files.sun3 +++ b/sys/arch/sun3/conf/files.sun3 @@ -1,4 +1,4 @@ -# $NetBSD: files.sun3,v 1.23 1996/03/26 15:15:59 gwr Exp $ +# $NetBSD: files.sun3,v 1.24 1996/05/07 01:30:18 thorpej Exp $ # # sun3-specific configuration info @@ -105,7 +105,7 @@ file arch/sun3/dev/if_ie_obio.c ie_obio file arch/sun3/dev/if_ie_vmes.c ie_vmes file arch/sun3/dev/if_ie.c ie -device le: ifnet, ether +# device defined in sys/conf/files attach le at obio file arch/sun3/dev/if_le.c le diff --git a/sys/arch/sun3/conf/std.sun3 b/sys/arch/sun3/conf/std.sun3 index 245382232bf..2274f33b012 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 1996/03/26 15:16:02 gwr Exp $ +# $NetBSD: std.sun3,v 1.15.4.1 1996/08/19 23:35:12 gwr Exp $ # Standard information for sun3's. machine sun3 m68k @@ -31,8 +31,7 @@ intreg0 at obio? addr ? options NEWCONFIG options MACHINE_NONCONTIG -# These are used ONLY when reading the hardware time/date clock. -# All Sun machines keep the hardware time/date clock on GMT. -options TIMEZONE=0 # minutes west of GMT (for param.c) -options DST=0 # daylight savings rules (for param.c) +# All Sun3 machines with an "le" (3/50, 3/60) should be +# presumed to have the old, buggy LANCE chip. (Rev. C) +options LANCE_REVC_BUG diff --git a/sys/arch/sun3/dev/cg4.c b/sys/arch/sun3/dev/cg4.c index 99f4ed80872..7c3be6c1e63 100644 --- a/sys/arch/sun3/dev/cg4.c +++ b/sys/arch/sun3/dev/cg4.c @@ -1,4 +1,4 @@ -/* $NetBSD: cg4.c,v 1.7 1996/03/17 02:03:45 thorpej Exp $ */ +/* $NetBSD: cg4.c,v 1.7.4.1 1996/08/08 23:14:47 gwr Exp $ */ /* * Copyright (c) 1992, 1993 @@ -162,7 +162,7 @@ cg4attach(parent, self, args) struct confargs *ca = args; struct fbtype *fbt; volatile struct bt_regs *bt; - int i, ramsize, pa; + int i; fb->fb_driver = &cg4fbdriver; fb->fb_private = sc; @@ -178,7 +178,7 @@ cg4attach(parent, self, args) fbt->fb_size = CG4_MMAP_SIZE; sc->sc_phys = ca->ca_paddr; - sc->sc_bt = (struct bt_regs *) + sc->sc_bt = bt = (volatile struct bt_regs *) bus_mapin(ca->ca_bustype, ca->ca_paddr, sizeof(struct bt_regs *)); diff --git a/sys/arch/sun3/dev/if_ie.c b/sys/arch/sun3/dev/if_ie.c index 3309c3d3a33..2ab99bc4a20 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.10 1996/03/26 22:04:14 gwr Exp $ */ +/* $NetBSD: if_ie.c,v 1.12 1996/05/09 21:15:47 thorpej Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles Hannum. @@ -128,6 +128,11 @@ #include <netinet/if_ether.h> #endif +#ifdef NS +#include <netns/ns.h> +#include <netns/ns_if.h> +#endif + #include <vm/vm.h> /* @@ -162,7 +167,7 @@ static struct mbuf *last_not_for_us; #define ETHER_MAX_LEN 1518 #define ETHER_ADDR_LEN 6 -void iewatchdog __P(( /* short */ )); +void iewatchdog __P((struct ifnet *)); int ieinit __P((struct ie_softc *)); int ieioctl __P((struct ifnet *, u_long, caddr_t)); void iestart __P((struct ifnet *)); @@ -293,8 +298,8 @@ ie_attach(sc) /* * Initialize and attach S/W interface */ - ifp->if_unit = sc->sc_dev.dv_unit; - ifp->if_name = ie_cd.cd_name; + bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); + ifp->if_softc = sc; ifp->if_start = iestart; ifp->if_ioctl = ieioctl; ifp->if_watchdog = iewatchdog; @@ -314,10 +319,10 @@ ie_attach(sc) * generate an interrupt after a transmit has been started on it. */ void -iewatchdog(unit) - short unit; +iewatchdog(ifp) + struct ifnet *ifp; { - struct ie_softc *sc = ie_cd.cd_devs[unit]; + struct ie_softc *sc = ifp->if_softc; log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); ++sc->sc_arpcom.ac_if.if_oerrors; @@ -1037,7 +1042,7 @@ void iestart(ifp) struct ifnet *ifp; { - struct ie_softc *sc = ie_cd.cd_devs[ifp->if_unit]; + struct ie_softc *sc = ifp->if_softc; struct mbuf *m0, *m; u_char *buffer; u_short len; @@ -1556,18 +1561,13 @@ ieioctl(ifp, cmd, data) u_long cmd; caddr_t data; { - struct ie_softc *sc = ie_cd.cd_devs[ifp->if_unit]; + struct ie_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; s = splnet(); - if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) { - splx(s); - return error; - } - switch (cmd) { case SIOCSIFADDR: @@ -1580,6 +1580,24 @@ ieioctl(ifp, cmd, data) arp_ifinit(&sc->sc_arpcom, ifa); break; #endif +#ifdef NS + /* XXX - This code is probably wrong. */ + case AF_NS: + { + struct ns_addr *ina = &IA_SNS(ifa)->sns_addr; + + if (ns_nullhost(*ina)) + ina->x_host = + *(union ns_host *)(sc->sc_arpcom.ac_enaddr); + else + bcopy(ina->x_host.c_host, + sc->sc_arpcom.ac_enaddr, + sizeof(sc->sc_arpcom.ac_enaddr)); + /* Set new address. */ + ieinit(sc); + break; + } +#endif /* NS */ default: ieinit(sc); break; diff --git a/sys/arch/sun3/dev/if_le.c b/sys/arch/sun3/dev/if_le.c index 10d21fcc04e..63d008828e7 100644 --- a/sys/arch/sun3/dev/if_le.c +++ b/sys/arch/sun3/dev/if_le.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le.c,v 1.28 1996/04/22 02:25:54 christos Exp $ */ +/* $NetBSD: if_le.c,v 1.29 1996/05/07 01:32:31 thorpej Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -62,50 +62,39 @@ #include <machine/obio.h> #include <machine/idprom.h> -#include <sun3/dev/if_lereg.h> -#include <sun3/dev/if_levar.h> #include <dev/ic/am7990reg.h> -#define LE_NEED_BUF_CONTIG #include <dev/ic/am7990var.h> -#define LE_SOFTC(unit) le_cd.cd_devs[unit] -#define LE_DELAY(x) DELAY(x) +#include <sun3/dev/if_lereg.h> +#include <sun3/dev/if_levar.h> static int le_match __P((struct device *, void *, void *)); static void le_attach __P((struct device *, struct device *, void *)); -int leintr __P((void *)); struct cfattach le_ca = { sizeof(struct le_softc), le_match, le_attach }; -struct cfdriver le_cd = { - NULL, "le", DV_IFNET -}; +hide void lewrcsr __P((struct am7990_softc *, u_int16_t, u_int16_t)); +hide u_int16_t lerdcsr __P((struct am7990_softc *, u_int16_t)); -integrate void -lehwinit(sc) - struct le_softc *sc; -{ -} - -integrate void +hide void lewrcsr(sc, port, val) - struct le_softc *sc; + struct am7990_softc *sc; u_int16_t port, val; { - register struct lereg1 *ler1 = sc->sc_r1; + register struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1; ler1->ler1_rap = port; ler1->ler1_rdp = val; } -integrate u_int16_t +hide u_int16_t lerdcsr(sc, port) - struct le_softc *sc; + struct am7990_softc *sc; u_int16_t port; { - register struct lereg1 *ler1 = sc->sc_r1; + register struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1; u_int16_t val; ler1->ler1_rap = port; @@ -143,7 +132,8 @@ le_attach(parent, self, aux) struct device *parent, *self; void *aux; { - struct le_softc *sc = (void *)self; + struct le_softc *lesc = (struct le_softc *)self; + struct am7990_softc *sc = &lesc->sc_am7990; struct cfdata *cf = self->dv_cfdata; struct confargs *ca = aux; int intpri; @@ -153,7 +143,7 @@ le_attach(parent, self, aux) intpri = 3; printf(" level %d", intpri); - sc->sc_r1 = (struct lereg1 *) + lesc->sc_r1 = (struct lereg1 *) obio_alloc(ca->ca_paddr, OBIO_AMD_ETHER_SIZE); sc->sc_memsize = 0x4000; /* 16K */ @@ -169,36 +159,12 @@ le_attach(parent, self, aux) sc->sc_copyfrombuf = am7990_copyfrombuf_contig; sc->sc_zerobuf = am7990_zerobuf_contig; - sc->sc_arpcom.ac_if.if_name = le_cd.cd_name; - leconfig(sc); + sc->sc_rdcsr = lerdcsr; + sc->sc_wrcsr = lewrcsr; + sc->sc_hwinit = NULL; - /* Install interrupt handler. */ - isr_add_autovect(leintr, (void *)sc, intpri); -} - -/* - * Compare two Ether/802 addresses for equality, inlined and - * unrolled for speed. I'd love to have an inline assembler - * version of this... XXX: Who wanted that? mycroft? - * I wrote one, but the following is just as efficient. - * This expands to 10 short m68k instructions! -gwr - * Note: use this like bcmp() - */ -static inline u_short -ether_cmp(one, two) - u_char *one, *two; -{ - register u_short *a = (u_short *) one; - register u_short *b = (u_short *) two; - register u_short diff; + am7990_config(sc); - diff = *a++ - *b++; - diff |= *a++ - *b++; - diff |= *a++ - *b++; - - return (diff); + /* Install interrupt handler. */ + isr_add_autovect(am7990_intr, (void *)sc, intpri); } - -#define ETHER_CMP ether_cmp - -#include <dev/ic/am7990.c> diff --git a/sys/arch/sun3/dev/if_levar.h b/sys/arch/sun3/dev/if_levar.h index 17fea04312e..1d753e6d10d 100644 --- a/sys/arch/sun3/dev/if_levar.h +++ b/sys/arch/sun3/dev/if_levar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_levar.h,v 1.1 1995/12/10 08:46:08 mycroft Exp $ */ +/* $NetBSD: if_levar.h,v 1.2 1996/05/07 01:32:37 thorpej Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -47,36 +47,7 @@ * This structure contains the output queue for the interface, its address, ... */ struct le_softc { - struct device sc_dev; /* base structure */ - struct arpcom sc_arpcom; /* Ethernet common part */ - - void (*sc_copytodesc)(); /* Copy to descriptor */ - void (*sc_copyfromdesc)(); /* Copy from descriptor */ - - void (*sc_copytobuf)(); /* Copy to buffer */ - void (*sc_copyfrombuf)(); /* Copy from buffer */ - void (*sc_zerobuf)(); /* and Zero bytes in buffer */ - - u_int16_t sc_conf3; /* CSR3 value */ - - void *sc_mem; /* base address of RAM -- CPU's view */ - u_long sc_addr; /* base address of RAM -- LANCE's view */ - u_long sc_memsize; /* size of RAM */ - - int sc_nrbuf; /* number of receive buffers */ - int sc_ntbuf; /* number of transmit buffers */ - int sc_last_rd; - int sc_first_td, sc_last_td, sc_no_td; - - int sc_initaddr; - int sc_rmdaddr; - int sc_tmdaddr; - int sc_rbufaddr; - int sc_tbufaddr; - -#ifdef LEDEBUG - int sc_debug; -#endif + struct am7990_softc sc_am7990; /* glue to MI code */ struct lereg1 *sc_r1; /* LANCE registers */ }; diff --git a/sys/arch/sun3/dev/kd.c b/sys/arch/sun3/dev/kd.c index 862b831ae1f..6f7c9664570 100644 --- a/sys/arch/sun3/dev/kd.c +++ b/sys/arch/sun3/dev/kd.c @@ -1,4 +1,4 @@ -/* $NetBSD: kd.c,v 1.16 1996/04/26 18:36:54 gwr Exp $ */ +/* $NetBSD: kd.c,v 1.17 1996/06/15 14:58:02 gwr Exp $ */ /* * Copyright (c) 1994, 1995 Gordon W. Ross @@ -90,12 +90,14 @@ kd_init(unit) if (unit != 0) return; kd = &kd_softc; /* XXX */ - tp = ttymalloc(); - kd->kd_tty = tp; + tp = ttymalloc(); tp->t_oproc = kdstart; tp->t_param = kdparam; tp->t_dev = makedev(KDMAJOR, unit); + tty_attach(tp); + + kd->kd_tty = tp; return; } @@ -329,7 +331,7 @@ kd_later(tpaddr) s = spltty(); tp->t_state &= ~TS_BUSY; - (*linesw[tp->t_line].l_start)(tp); + (*linesw[tp->t_line].l_start)(tp); splx(s); } diff --git a/sys/arch/sun3/dev/si.c b/sys/arch/sun3/dev/si.c index 893c5368c3a..0bf52d046bc 100644 --- a/sys/arch/sun3/dev/si.c +++ b/sys/arch/sun3/dev/si.c @@ -1,4 +1,4 @@ -/* $NetBSD: si.c,v 1.24 1996/03/26 15:01:10 gwr Exp $ */ +/* $NetBSD: si.c,v 1.25 1996/06/17 23:21:29 gwr Exp $ */ /* * Copyright (c) 1995 David Jones, Gordon W. Ross @@ -425,6 +425,10 @@ si_dma_free(ncr_sc) } +#define CSR_MASK (SI_CSR_SBC_IP | SI_CSR_DMA_IP | \ + SI_CSR_DMA_CONFLICT | SI_CSR_DMA_BUS_ERR) +#define POLL_TIMO 50000 /* X100 = 5 sec. */ + /* * Poll (spin-wait) for DMA completion. * Called right after xx_dma_start(), and @@ -439,30 +443,36 @@ si_dma_poll(ncr_sc) struct sci_req *sr = ncr_sc->sc_current; struct si_dma_handle *dh = sr->sr_dma_hand; volatile struct si_regs *si = sc->sc_regs; - int tmo, csr_mask; + int tmo; /* Make sure DMA started successfully. */ if (ncr_sc->sc_state & NCR_ABORTING) return; - csr_mask = SI_CSR_SBC_IP | SI_CSR_DMA_IP | - SI_CSR_DMA_CONFLICT | SI_CSR_DMA_BUS_ERR; + /* + * XXX: The Sun driver waits for ~SI_CSR_DMA_ACTIVE here + * XXX: (on obio) or even worse (on vme) a 10mS. delay! + * XXX: I really doubt that is necessary... + */ - tmo = 50000; /* X100 = 5 sec. */ + /* Wait for any "dma complete" or error bits. */ + tmo = POLL_TIMO; for (;;) { - if (si->si_csr & csr_mask) + if (si->si_csr & CSR_MASK) break; if (--tmo <= 0) { printf("si: DMA timeout (while polling)\n"); /* Indicate timeout as MI code would. */ sr->sr_flags |= SR_OVERDUE; - break; - } + break; + } delay(100); } + NCR_TRACE("si_dma_poll: waited %d\n", + POLL_TIMO - tmo); #ifdef DEBUG - if (si_debug) { + if (si_debug & 2) { printf("si_dma_poll: done, csr=0x%x\n", si->si_csr); } #endif diff --git a/sys/arch/sun3/dev/si_obio.c b/sys/arch/sun3/dev/si_obio.c index b808b030874..61c073f81a6 100644 --- a/sys/arch/sun3/dev/si_obio.c +++ b/sys/arch/sun3/dev/si_obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: si_obio.c,v 1.1 1996/03/26 15:01:12 gwr Exp $ */ +/* $NetBSD: si_obio.c,v 1.2 1996/06/17 23:21:35 gwr Exp $ */ /* * Copyright (c) 1995 David Jones, Gordon W. Ross @@ -126,7 +126,8 @@ struct cfattach si_obio_ca = { }; /* Options. Interesting values are: 1,3,7 */ -int si_obio_options = 3; +/* 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 */ @@ -207,14 +208,12 @@ si_obio_attach(parent, self, args) */ 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_poll = si_dma_poll; - ncr_sc->sc_dma_setup = si_obio_dma_setup; ncr_sc->sc_dma_start = si_obio_dma_start; - ncr_sc->sc_dma_eop = si_obio_dma_stop; + ncr_sc->sc_dma_poll = si_dma_poll; + ncr_sc->sc_dma_eop = si_obio_dma_eop; ncr_sc->sc_dma_stop = si_obio_dma_stop; ncr_sc->sc_intr_on = NULL; ncr_sc->sc_intr_off = NULL; @@ -281,24 +280,28 @@ si_obio_dma_setup(ncr_sc) struct ncr5380_softc *ncr_sc; { struct si_softc *sc = (struct si_softc *)ncr_sc; + struct sci_req *sr = ncr_sc->sc_current; + struct si_dma_handle *dh = sr->sr_dma_hand; volatile struct si_regs *si = sc->sc_regs; - struct sci_req *sr; - struct si_dma_handle *dh; - int send = 0; - int xlen = 0; - - /* Let this work even without a dma hand, for testing... */ - if ((sr = ncr_sc->sc_current) != NULL) { - if ((dh = sr->sr_dma_hand) != NULL) { - send = dh->dh_flags & SIDH_OUT; - xlen = ncr_sc->sc_datalen; - xlen &= ~1; - } - } + struct udc_table *cmd; + long data_pa, cmd_pa; + int xlen; + + /* + * Get the DVMA mapping for this segment. + * XXX - Should separate allocation and mapin. + */ + data_pa = dvma_kvtopa(dh->dh_dvma, sc->sc_adapter_type); + data_pa += (ncr_sc->sc_dataptr - dh->dh_addr); + if (data_pa & 1) + panic("si_dma_start: bad pa=0x%x", data_pa); + xlen = ncr_sc->sc_datalen; + sc->sc_reqlen = xlen; /* XXX: or less? */ #ifdef DEBUG - if (si_debug) { - printf("si_dma_setup: send=%d xlen=%d\n", send, xlen); + if (si_debug & 2) { + printf("si_dma_setup: dh=0x%x, pa=0x%x, xlen=%d\n", + dh, data_pa, xlen); } #endif @@ -310,7 +313,7 @@ si_obio_dma_setup(ncr_sc) si->si_csr |= SI_CSR_FIFO_RES; /* Set direction (send/recv) */ - if (send) { + if (dh->dh_flags & SIDH_OUT) { si->si_csr |= SI_CSR_SEND; } else { si->si_csr &= ~SI_CSR_SEND; @@ -319,77 +322,29 @@ si_obio_dma_setup(ncr_sc) /* Set the FIFO counter. */ si->fifo_count = xlen; + /* Reset the UDC. */ + si_obio_udc_write(si, UDC_ADR_COMMAND, UDC_CMD_RESET); + /* - * XXX: Reset DMA engine again! Comment from Sprite: + * XXX: Reset the FIFO again! Comment from Sprite: * Go through reset again becuase of the bug on the 3/50 * where bytes occasionally linger in the DMA fifo. */ - - /* Reset the UDC. */ - si_obio_udc_write(si, UDC_ADR_COMMAND, UDC_CMD_RESET); - - /* Reset the FIFO */ si->si_csr &= ~SI_CSR_FIFO_RES; /* active low */ si->si_csr |= SI_CSR_FIFO_RES; #ifdef DEBUG - if ((si->fifo_count > xlen) || (si->fifo_count < (xlen - 1))) { + /* Make sure the extra FIFO reset did not hit the count. */ + if (si->fifo_count != xlen) { printf("si_dma_setup: fifo_count=0x%x, xlen=0x%x\n", si->fifo_count, xlen); Debugger(); } #endif -} - - -void -si_obio_dma_start(ncr_sc) - struct ncr5380_softc *ncr_sc; -{ - struct si_softc *sc = (struct si_softc *)ncr_sc; - struct sci_req *sr = ncr_sc->sc_current; - struct si_dma_handle *dh = sr->sr_dma_hand; - volatile struct si_regs *si = sc->sc_regs; - struct udc_table *cmd; - long data_pa, cmd_pa; - int xlen; /* - * Get the DVMA mapping for this segment. - * XXX - Should separate allocation and mapin. - */ - data_pa = dvma_kvtopa(dh->dh_dvma, sc->sc_adapter_type); - data_pa += (ncr_sc->sc_dataptr - dh->dh_addr); - if (data_pa & 1) - panic("si_dma_start: bad pa=0x%x", data_pa); - xlen = ncr_sc->sc_datalen; - xlen &= ~1; - sc->sc_reqlen = xlen; /* XXX: or less... */ - -#ifdef DEBUG - if (si_debug & 2) { - printf("si_dma_start: dh=0x%x, pa=0x%x, xlen=%d\n", - dh, data_pa, xlen); - } -#endif - - /* - * Set up the DMA controller. - * Already set FIFO count in dma_setup. - */ - -#ifdef DEBUG - if ((si->fifo_count > xlen) || - (si->fifo_count < (xlen - 1))) - { - printf("si_dma_start: fifo_count=0x%x, xlen=0x%x\n", - si->fifo_count, xlen); - Debugger(); - } -#endif - - /* - * The OBIO controller needs a command block. + * Set up the DMA controller. The DMA controller on + * OBIO needs a command block in DVMA space. */ cmd = sc->sc_dmacmd; cmd->addrh = ((data_pa & 0xFF0000) >> 8) | UDC_ADDR_INFO; @@ -397,6 +352,8 @@ si_obio_dma_start(ncr_sc) cmd->count = xlen / 2; /* bytes -> words */ cmd->cmrh = UDC_CMR_HIGH; if (dh->dh_flags & SIDH_OUT) { + if (xlen & 1) + cmd->count++; cmd->cmrl = UDC_CMR_LSEND; cmd->rsel = UDC_RSEL_SEND; } else { @@ -417,7 +374,28 @@ si_obio_dma_start(ncr_sc) /* Tell the chip to interrupt on error. */ si_obio_udc_write(si, UDC_ADR_COMMAND, UDC_CMD_CIE); - /* XXX: Move all of the above to _setup? */ + /* Will do "start chain" command in _dma_start. */ +} + + +void +si_obio_dma_start(ncr_sc) + struct ncr5380_softc *ncr_sc; +{ + struct si_softc *sc = (struct si_softc *)ncr_sc; + struct sci_req *sr = ncr_sc->sc_current; + struct si_dma_handle *dh = sr->sr_dma_hand; + volatile struct si_regs *si = sc->sc_regs; + int s; + +#ifdef DEBUG + if (si_debug & 2) { + printf("si_dma_start: sr=0x%x\n", sr); + } +#endif + + /* This MAY be time critical (not sure). */ + s = splhigh(); /* Finally, give the UDC a "start chain" command. */ si_obio_udc_write(si, UDC_ADR_COMMAND, UDC_CMD_STRT_CHN); @@ -440,6 +418,7 @@ si_obio_dma_start(ncr_sc) *ncr_sc->sci_irecv = 0; /* start it */ } + splx(s); ncr_sc->sc_state |= NCR_DOINGDMA; #ifdef DEBUG @@ -478,11 +457,19 @@ si_obio_dma_stop(ncr_sc) } ncr_sc->sc_state &= ~NCR_DOINGDMA; + NCR_TRACE("si_dma_stop: top, csr=0x%x\n", si->si_csr); + + /* OK, have either phase mis-match or end of DMA. */ + /* Set an impossible phase to prevent data movement? */ + *ncr_sc->sci_tcmd = PHASE_INVALID; + + /* Check for DMA errors. */ if (si->si_csr & (SI_CSR_DMA_CONFLICT | SI_CSR_DMA_BUS_ERR)) { printf("si: DMA error, csr=0x%x, reset\n", si->si_csr); sr->sr_xs->error = XS_DRIVER_STUFFUP; ncr_sc->sc_state |= NCR_ABORTING; si_reset_adapter(ncr_sc); + goto out; } /* Note that timeout may have set the error flag. */ @@ -510,11 +497,9 @@ si_obio_dma_stop(ncr_sc) /* * Now try to figure out how much actually transferred - * * The fifo_count might not reflect how many bytes were - * actually transferred for VME. + * actually transferred. */ - resid = si->fifo_count & 0xFFFF; ntrans = sc->sc_reqlen - resid; @@ -569,11 +554,12 @@ out: si->fifo_count = 0; si->si_csr &= ~SI_CSR_SEND; - /* Reset the FIFO */ - si->si_csr &= ~SI_CSR_FIFO_RES; /* active low */ - si->si_csr |= SI_CSR_FIFO_RES; + /* Reset the FIFO */ + si->si_csr &= ~SI_CSR_FIFO_RES; /* active low */ + si->si_csr |= SI_CSR_FIFO_RES; /* Put SBIC back in PIO mode. */ + /* XXX: set tcmd to PHASE_INVALID? */ *ncr_sc->sci_mode &= ~(SCI_MODE_DMA | SCI_MODE_DMA_IE); *ncr_sc->sci_icmd = 0; } diff --git a/sys/arch/sun3/dev/si_vme.c b/sys/arch/sun3/dev/si_vme.c index 637f8932bcd..d29bc905ee3 100644 --- a/sys/arch/sun3/dev/si_vme.c +++ b/sys/arch/sun3/dev/si_vme.c @@ -1,4 +1,4 @@ -/* $NetBSD: si_vme.c,v 1.1 1996/03/26 15:01:13 gwr Exp $ */ +/* $NetBSD: si_vme.c,v 1.2 1996/06/17 23:21:39 gwr Exp $ */ /* * Copyright (c) 1995 David Jones, Gordon W. Ross @@ -230,11 +230,10 @@ si_vmes_attach(parent, self, args) ncr_sc->sc_dma_alloc = si_dma_alloc; ncr_sc->sc_dma_free = si_dma_free; - ncr_sc->sc_dma_poll = si_dma_poll; - ncr_sc->sc_dma_setup = si_vme_dma_setup; ncr_sc->sc_dma_start = si_vme_dma_start; - ncr_sc->sc_dma_eop = si_vme_dma_stop; + ncr_sc->sc_dma_poll = si_dma_poll; + ncr_sc->sc_dma_eop = si_vme_dma_eop; ncr_sc->sc_dma_stop = si_vme_dma_stop; ncr_sc->sc_intr_on = si_vme_intr_on; ncr_sc->sc_intr_off = si_vme_intr_off; @@ -272,7 +271,18 @@ si_vme_intr_on(ncr_sc) struct si_softc *sc = (struct si_softc *)ncr_sc; volatile struct si_regs *si = sc->sc_regs; - si_vme_dma_setup(ncr_sc); + /* receive mode should be safer */ + si->si_csr &= ~SI_CSR_SEND; + + /* Clear the count so nothing happens. */ + si->dma_counth = 0; + si->dma_countl = 0; + + /* Clear the start address too. (paranoid?) */ + si->dma_addrh = 0; + si->dma_addrl = 0; + + /* Finally, enable the DMA engine. */ si->si_csr |= SI_CSR_DMA_EN; } @@ -298,43 +308,14 @@ si_vme_intr_off(ncr_sc) * XXX: The VME adapter appears to suppress SBC interrupts * when the FIFO is not empty or the FIFO count is non-zero! * - * On the VME version we just clear the DMA count and address - * here (to make sure it stays idle) and do the real setup - * later, in dma_start. + * On the VME version, setup the start addres, but clear the + * count (to make sure it stays idle) and set that later. */ void si_vme_dma_setup(ncr_sc) struct ncr5380_softc *ncr_sc; { struct si_softc *sc = (struct si_softc *)ncr_sc; - volatile struct si_regs *si = sc->sc_regs; - - /* Reset the FIFO */ - si->si_csr &= ~SI_CSR_FIFO_RES; /* active low */ - si->si_csr |= SI_CSR_FIFO_RES; - - /* Set direction (assume recv here) */ - si->si_csr &= ~SI_CSR_SEND; - /* Assume worst alignment */ - si->si_csr |= SI_CSR_BPCON; - - si->dma_addrh = 0; - si->dma_addrl = 0; - - si->dma_counth = 0; - si->dma_countl = 0; - - /* Clear FIFO counter. (also hits dma_count) */ - si->fifo_cnt_hi = 0; - si->fifo_count = 0; -} - - -void -si_vme_dma_start(ncr_sc) - struct ncr5380_softc *ncr_sc; -{ - struct si_softc *sc = (struct si_softc *)ncr_sc; struct sci_req *sr = ncr_sc->sc_current; struct si_dma_handle *dh = sr->sr_dma_hand; volatile struct si_regs *si = sc->sc_regs; @@ -350,22 +331,16 @@ si_vme_dma_start(ncr_sc) if (data_pa & 1) panic("si_dma_start: bad pa=0x%x", data_pa); xlen = ncr_sc->sc_datalen; - xlen &= ~1; - sc->sc_reqlen = xlen; /* XXX: or less... */ + xlen &= ~1; /* XXX: necessary? */ + sc->sc_reqlen = xlen; /* XXX: or less? */ #ifdef DEBUG if (si_debug & 2) { - printf("si_dma_start: dh=0x%x, pa=0x%x, xlen=%d\n", + printf("si_dma_setup: dh=0x%x, pa=0x%x, xlen=%d\n", dh, data_pa, xlen); } #endif - /* - * Set up the DMA controller. - */ - si->si_csr &= ~SI_CSR_FIFO_RES; /* active low */ - si->si_csr |= SI_CSR_FIFO_RES; - /* Set direction (send/recv) */ if (dh->dh_flags & SIDH_OUT) { si->si_csr |= SI_CSR_SEND; @@ -373,31 +348,56 @@ si_vme_dma_start(ncr_sc) si->si_csr &= ~SI_CSR_SEND; } + /* Reset the FIFO. */ + si->si_csr &= ~SI_CSR_FIFO_RES; /* active low */ + si->si_csr |= SI_CSR_FIFO_RES; + if (data_pa & 2) { si->si_csr |= SI_CSR_BPCON; } else { si->si_csr &= ~SI_CSR_BPCON; } + /* Load the start address. */ si->dma_addrh = (ushort)(data_pa >> 16); si->dma_addrl = (ushort)(data_pa & 0xFFFF); + /* + * Keep the count zero or it may start early! + */ + si->dma_counth = 0; + si->dma_countl = 0; + +#if 0 + /* Clear FIFO counter. (also hits dma_count) */ + si->fifo_cnt_hi = 0; + si->fifo_count = 0; +#endif +} + + +void +si_vme_dma_start(ncr_sc) + struct ncr5380_softc *ncr_sc; +{ + struct si_softc *sc = (struct si_softc *)ncr_sc; + struct sci_req *sr = ncr_sc->sc_current; + struct si_dma_handle *dh = sr->sr_dma_hand; + volatile struct si_regs *si = sc->sc_regs; + long data_pa; + int s, xlen; + + xlen = sc->sc_reqlen; + + /* This MAY be time critical (not sure). */ + s = splhigh(); + si->dma_counth = (ushort)(xlen >> 16); si->dma_countl = (ushort)(xlen & 0xFFFF); -#if 1 - /* Set it anyway, even though dma_count hits it? */ + /* Set it anyway, even though dma_count hits it. */ si->fifo_cnt_hi = (ushort)(xlen >> 16); si->fifo_count = (ushort)(xlen & 0xFFFF); -#endif - -#ifdef DEBUG - if (si->fifo_count != xlen) { - printf("si_dma_start: fifo_count=0x%x, xlen=0x%x\n", - si->fifo_count, xlen); - Debugger(); - } -#endif /* * Acknowledge the phase change. (After DMA setup!) @@ -420,6 +420,7 @@ si_vme_dma_start(ncr_sc) /* Let'er rip! */ si->si_csr |= SI_CSR_DMA_EN; + splx(s); ncr_sc->sc_state |= NCR_DOINGDMA; #ifdef DEBUG @@ -461,17 +462,23 @@ si_vme_dma_stop(ncr_sc) /* First, halt the DMA engine. */ si->si_csr &= ~SI_CSR_DMA_EN; /* VME only */ + /* Set an impossible phase to prevent data movement? */ + *ncr_sc->sci_tcmd = PHASE_INVALID; + if (si->si_csr & (SI_CSR_DMA_CONFLICT | SI_CSR_DMA_BUS_ERR)) { printf("si: DMA error, csr=0x%x, reset\n", si->si_csr); sr->sr_xs->error = XS_DRIVER_STUFFUP; ncr_sc->sc_state |= NCR_ABORTING; si_reset_adapter(ncr_sc); + goto out; } /* Note that timeout may have set the error flag. */ if (ncr_sc->sc_state & NCR_ABORTING) goto out; + /* XXX: Wait for DMA to actually finish? */ + /* * Now try to figure out how much actually transferred * diff --git a/sys/arch/sun3/dev/xd.c b/sys/arch/sun3/dev/xd.c index d3a8f835ecb..d5b8508dd81 100644 --- a/sys/arch/sun3/dev/xd.c +++ b/sys/arch/sun3/dev/xd.c @@ -101,8 +101,7 @@ * XDC_HWAIT: add iorq "N" to head of SC's wait queue */ #define XDC_HWAIT(SC, N) { \ - (SC)->waithead = ((SC)->waithead == 0) ? \ - (XDC_MAXIOPB - 1) : ((SC)->waithead - 1); \ + (SC)->waithead = ((SC)->waithead - 1) % XDC_MAXIOPB; \ (SC)->waitq[(SC)->waithead] = (N); \ (SC)->nwait++; \ } @@ -1434,9 +1433,6 @@ xdc_startbuf(xdcsc, xdsc, bp) /* Instrumentation. */ disk_busy(&xdsc->sc_dk); - /* Instrumentation. */ - disk_busy(&xdsc->sc_dk); - /* now submit [note that xdc_submit_iorq can never fail on NORM reqs] */ xdc_submit_iorq(xdcsc, rqno, XD_SUB_NORM); diff --git a/sys/arch/sun3/dev/xy.c b/sys/arch/sun3/dev/xy.c index 8bea7ab3e06..b359bd5f6c1 100644 --- a/sys/arch/sun3/dev/xy.c +++ b/sys/arch/sun3/dev/xy.c @@ -36,7 +36,7 @@ * x y . c x y l o g i c s 4 5 0 / 4 5 1 s m d d r i v e r * * author: Chuck Cranor <chuck@ccrc.wustl.edu> - * id: $NetBSD: xy.c,v 1.5 1996/03/04 20:35:29 chuck Exp $ + * id: $NetBSD: xy.c,v 1.9 1996/03/17 02:04:10 thorpej Exp $ * started: 14-Sep-95 * references: [1] Xylogics Model 753 User's Manual * part number: 166-753-001, Revision B, May 21, 1988. @@ -361,8 +361,8 @@ xycattach(parent, self, aux) return; } } + bzero(tmp, pbsz); xyc->iopbase = tmp; - bzero(xyc->iopbase, pbsz); xyc->dvmaiopb = (struct xy_iopb *) dvma_kvtopa((long) xyc->iopbase, BUS_VME16); xyc->reqs = (struct xy_iorq *) @@ -1292,9 +1292,6 @@ xyc_startbuf(xycsc, xysc, bp) /* Instrumentation. */ disk_busy(&xysc->sc_dk); - /* Instrumentation. */ - disk_busy(&xysc->sc_dk); - return (XY_ERR_AOK); } @@ -1632,7 +1629,7 @@ xyc_reset(xycsc, quiet, blastmode, error, xysc) dvma_mapout(iorq->dbufbase, iorq->buf->b_bcount); iorq->xy->xyq.b_actf = - iorq->buf->b_actf; + iorq->buf->b_actf; disk_unbusy(&iorq->xy->sc_dk, (iorq->buf->b_bcount - iorq->buf->b_resid)); diff --git a/sys/arch/sun3/dev/zs.c b/sys/arch/sun3/dev/zs.c index e70f967a50b..c1f66193975 100644 --- a/sys/arch/sun3/dev/zs.c +++ b/sys/arch/sun3/dev/zs.c @@ -1,4 +1,4 @@ -/* $NetBSD: zs.c,v 1.36 1996/04/04 06:26:15 cgd Exp $ */ +/* $NetBSD: zs.c,v 1.38 1996/06/17 15:17:06 gwr Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross @@ -56,7 +56,6 @@ #include <machine/autoconf.h> #include <machine/cpu.h> -#include <machine/eeprom.h> #include <machine/isr.h> #include <machine/obio.h> #include <machine/mon.h> @@ -273,7 +272,7 @@ zsc_attach(parent, self, aux) cs->cs_ops = &zsops_null; /* Define BAUD rate clock for the MI code. */ - cs->cs_pclk_div16 = PCLK / 16; + cs->cs_brg_clk = PCLK / 16; /* XXX: get defspeed from EEPROM instead? */ cs->cs_defspeed = zs_defspeed[zsc_unit][channel]; @@ -536,33 +535,49 @@ void *zs_conschan; /* * This function replaces sys/dev/cninit.c * Determine which device is the console using - * the "console" byte from the EEPROM. + * the PROM "input source" and "output sink". */ void cninit() { + MachMonRomVector *v; struct zschan *zc; struct consdev *cn; int zsc_unit, channel; + char inSource; - switch (ee_console) { + v = romVectorPtr; + inSource = *(v->inSource); - case EE_CONS_TTYA: - case EE_CONS_TTYB: + if (inSource != *(v->outSink)) { + mon_printf("cninit: mismatched PROM output selector\n"); + } + + switch (inSource) { + + case 1: /* ttya */ + case 2: /* ttyb */ zsc_unit = 1; - channel = (ee_console & 1); + channel = inSource - 1; cn = &consdev_tty; cn->cn_dev = makedev(ZSTTY_MAJOR, channel); cn->cn_pri = CN_REMOTE; break; + case 3: /* ttyc (rewired keyboard connector) */ + case 4: /* ttyd (rewired mouse connector) */ + zsc_unit = 0; + channel = inSource - 3; + cn = &consdev_tty; + cn->cn_dev = makedev(ZSTTY_MAJOR, (channel+2)); + cn->cn_pri = CN_REMOTE; + break; + default: - mon_printf("cninit: unknown eeprom console setting\n"); + mon_printf("cninit: invalid PROM console selector\n"); /* assume keyboard/display */ /* fallthrough */ - case EE_CONS_BW: - case EE_CONS_COLOR: - case EE_CONS_P4OPT: + case 0: /* keyboard/display */ zsc_unit = 0; channel = 0; cn = &consdev_kd; diff --git a/sys/arch/sun3/dev/zs_kgdb.c b/sys/arch/sun3/dev/zs_kgdb.c index 3ba576927cf..e6596e28cc3 100644 --- a/sys/arch/sun3/dev/zs_kgdb.c +++ b/sys/arch/sun3/dev/zs_kgdb.c @@ -1,3 +1,4 @@ +/* $NetBSD: zs_kgdb.c,v 1.6 1996/06/17 15:40:36 gwr Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross @@ -71,9 +72,18 @@ /* The Sun3 provides a 4.9152 MHz clock to the ZS chips. */ #define PCLK (9600 * 512) /* PCLK pin input clock rate */ +#define ZSHARD_PRI 6 /* Wired on the CPU board... */ #define ZS_DELAY() delay(2) +/* The layout of this is hardware-dependent (padding, order). */ +struct zschan { + volatile u_char zc_csr; /* ctrl,status, and indirect access */ + u_char zc_xxx0; + volatile u_char zc_data; /* data */ + u_char zc_xxx1; +}; + extern int kgdb_dev; extern int kgdb_rate; @@ -103,6 +113,9 @@ static u_char zs_kgdb_regs[16] = { ZSWR15_BREAK_IE | ZSWR15_DCD_IE, }; +/* + * This replaces "zs_reset()" in the sparc driver. + */ static void zs_setparam(cs, iena, rate) struct zs_chanstate *cs; @@ -118,7 +131,7 @@ zs_setparam(cs, iena, rate) } /* Initialize the speed, etc. */ - tconst = BPS_TO_TCONST(cs->cs_pclk_div16, rate); + tconst = BPS_TO_TCONST(cs->cs_brg_clk, rate); cs->cs_preg[5] |= ZSWR5_DTR | ZSWR5_RTS; cs->cs_preg[12] = tconst; cs->cs_preg[13] = tconst >> 8; @@ -126,7 +139,7 @@ zs_setparam(cs, iena, rate) s = splhigh(); zs_loadchannelregs(cs); splx(s); - +} /* * Set up for kgdb; called at boot time before configuration. @@ -139,11 +152,12 @@ zs_kgdb_init() volatile struct zschan *zc; int channel, zsc_unit; - if (major(kgdb_dev) != ZSMAJOR) + if (major(kgdb_dev) != ZSTTY_MAJOR) return; - zsc_unit = 1; /* XXX */ - channel = minor(kgdb_dev) & 1; + /* Note: (ttya,ttyb) on zsc1, and (ttyc,ttyd) on zsc0 */ + zsc_unit = 2 - (kgdb_dev & 2); + channel = kgdb_dev & 1; printf("zs_kgdb_init: attaching zstty%d at %d baud\n", channel, kgdb_rate); @@ -153,7 +167,7 @@ zs_kgdb_init() cs.cs_reg_csr = &zc->zc_csr; cs.cs_reg_data = &zc->zc_data; cs.cs_channel = channel; - cs.cs_pclk_div16 = PCLK / 16; + cs.cs_brg_clk = PCLK / 16; /* Now set parameters. (interrupts disabled) */ zs_setparam(&cs, 0, kgdb_rate); @@ -200,7 +214,7 @@ zs_check_kgdb(cs, dev) */ zskgdb() { - unit = minor(kgdb_dev); + int unit = minor(kgdb_dev); printf("zstty%d: kgdb interrupt\n", unit); /* This will trap into the debugger. */ @@ -214,7 +228,7 @@ zskgdb() int kgdb_input_lost; -static int +static void zs_kgdb_rxint(cs) register struct zs_chanstate *cs; { @@ -236,11 +250,9 @@ zs_kgdb_rxint(cs) } else { kgdb_input_lost++; } - - return(0); } -static int +static void zs_kgdb_txint(cs) register struct zs_chanstate *cs; { @@ -248,10 +260,9 @@ zs_kgdb_txint(cs) rr0 = zs_read_csr(cs); zs_write_csr(cs, ZSWR0_RESET_TXINT); - return (0); } -static int +static void zs_kgdb_stint(cs) register struct zs_chanstate *cs; { @@ -259,16 +270,13 @@ zs_kgdb_stint(cs) rr0 = zs_read_csr(cs); zs_write_csr(cs, ZSWR0_RESET_STATUS); - - return (0); } -static int +static void zs_kgdb_softint(cs) struct zs_chanstate *cs; { printf("zs_kgdb_softint?\n"); - return (0); } struct zsops zsops_kgdb = { diff --git a/sys/arch/sun3/include/autoconf.h b/sys/arch/sun3/include/autoconf.h index 9b90ac4c081..88b546db3c6 100644 --- a/sys/arch/sun3/include/autoconf.h +++ b/sys/arch/sun3/include/autoconf.h @@ -58,7 +58,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_peek __P((int, int, int)); +int bus_print __P((void *, char *)); +int bus_peek __P((int, int, int)); char * bus_mapin __P((int, int, int)); diff --git a/sys/arch/sun3/include/exec.h b/sys/arch/sun3/include/exec.h index 53310fea489..b28a4ea597d 100644 --- a/sys/arch/sun3/include/exec.h +++ b/sys/arch/sun3/include/exec.h @@ -44,11 +44,4 @@ struct relocation_info_m68k { }; #define relocation_info relocation_info_m68k -#define ELF_TARG_CLASS ELFCLASS32 -#define ELF_TARG_DATA ELFDATA2MSB -#define ELF_TARG_MACH EM_68K - -#define DO_AOUT /* support a.out */ -#define DO_ELF /* support ELF */ - #endif /* _LDPGSZ */ diff --git a/sys/arch/sun3/include/kcore.h b/sys/arch/sun3/include/kcore.h new file mode 100644 index 00000000000..77e95ce93bc --- /dev/null +++ b/sys/arch/sun3/include/kcore.h @@ -0,0 +1,47 @@ +/* $NetBSD: kcore.h,v 1.1 1996/05/05 04:19:31 gwr Exp $ */ + +/* + * Copyright (c) 1996 Leo Weppelman. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Leo Weppelman. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MACHINE_KCORE_H_ +#define _MACHINE_KCORE_H_ + +/* + * In the dump device, there is a kcore_seg_t + * followed by one of these. The size will be + * padded out appropriately by the kernel. + */ + +typedef struct cpu_kcore_hdr { + phys_ram_seg_t ram_segs[4]; + u_char ksegmap[256]; +} cpu_kcore_hdr_t; + +#endif /* _MACHINE_KCORE_H_ */ diff --git a/sys/arch/sun3/include/param.h b/sys/arch/sun3/include/param.h index 561a62fd55e..befd54ed918 100644 --- a/sys/arch/sun3/include/param.h +++ b/sys/arch/sun3/include/param.h @@ -48,11 +48,11 @@ /* * Machine dependent constants for the Sun3 series. */ -#define _MACHINE sun3 -#define MACHINE "sun3" +#define _MACHINE sun3 +#define MACHINE "sun3" #define _MACHINE_ARCH m68k #define MACHINE_ARCH "m68k" -#define MID_MACHINE MID_M68K +#define MID_MACHINE MID_M68K /* * Round p (pointer or byte index) up to a correctly-aligned value diff --git a/sys/arch/sun3/include/pcb.h b/sys/arch/sun3/include/pcb.h index e94da41a646..f2797c5f5e4 100644 --- a/sys/arch/sun3/include/pcb.h +++ b/sys/arch/sun3/include/pcb.h @@ -1,4 +1,4 @@ -/* $NetBSD: pcb.h,v 1.8 1994/11/21 21:34:02 gwr Exp $ */ +/* $NetBSD: pcb.h,v 1.9 1996/06/18 16:03:45 gwr Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross @@ -48,10 +48,10 @@ /* * Sun3 process control block */ -struct pcb -{ +struct pcb { short pcb_flags; /* misc. process flags */ short pcb_ps; /* processor status word */ + int pcb_mmuctx; /* MMU context number */ int pcb_usp; /* user stack pointer */ int pcb_regs[12]; /* D2-D7, A2-A7 */ caddr_t pcb_onfault; /* for copyin/out faults */ diff --git a/sys/arch/sun3/include/pte.h b/sys/arch/sun3/include/pte.h index f0bee459629..adc91551c75 100644 --- a/sys/arch/sun3/include/pte.h +++ b/sys/arch/sun3/include/pte.h @@ -1,4 +1,4 @@ -/* $NetBSD: pte.h,v 1.9 1995/03/10 02:28:01 gwr Exp $ */ +/* $NetBSD: pte.h,v 1.10 1996/05/05 04:18:28 gwr Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross @@ -74,6 +74,8 @@ #define PGT_VME_D16 MAKE_PGTYPE(VME_D16) /* VMEbus 16-bit data */ #define PGT_VME_D32 MAKE_PGTYPE(VME_D32) /* VMEbus 32-bit data */ +#define VA_SEGNUM(x) ((u_int)(x) >> SEGSHIFT) + #define VA_PTE_NUM_SHIFT 13 #define VA_PTE_NUM_MASK (0xF << VA_PTE_NUM_SHIFT) #define VA_PTE_NUM(va) ((va & VA_PTE_NUM_MASK) >> VA_PTE_NUM_SHIFT) diff --git a/sys/arch/sun3/include/remote-sl.h b/sys/arch/sun3/include/remote-sl.h new file mode 100644 index 00000000000..4ae37abc504 --- /dev/null +++ b/sys/arch/sun3/include/remote-sl.h @@ -0,0 +1,68 @@ +/* $NetBSD: remote-sl.h,v 1.1 1996/06/15 14:34:35 gwr Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the 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 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. + * + * @(#)remote-sl.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * These definitions are factored out into an include file so + * the kernel stub has access to them. + */ +#define FRAME_START 0xc1 /* Frame End */ +#define FRAME_END 0xc0 /* Frame End */ +#define FRAME_ESCAPE 0xdb /* Frame Esc */ +#define TRANS_FRAME_START 0xde /* transposed frame start */ +#define TRANS_FRAME_END 0xdc /* transposed frame esc */ +#define TRANS_FRAME_ESCAPE 0xdd /* transposed frame esc */ + +/* + * Message limits. SL_MAXDATA is the maximum number of bytes that can + * be read or written. SL_BUFSIZE is the maximum amount of data that + * can be passed across the serial link. The actual MTU is two times + * the max message (since each byte might be escaped), plus the two + * framing bytes. We add two to the message length to account for the + * type byte and checksum. + */ +#define SL_MAXDATA 62 /* max data that can be read */ +#define SL_RPCSIZE (1 + SL_MAXDATA) /* errno byte + data */ +#define SL_MTU ((2 * (SL_RPCSIZE + 2) + 2)) diff --git a/sys/arch/sun3/stand/installboot/installboot.8 b/sys/arch/sun3/stand/installboot/installboot.8 index d859114b7e8..21cea51f995 100644 --- a/sys/arch/sun3/stand/installboot/installboot.8 +++ b/sys/arch/sun3/stand/installboot/installboot.8 @@ -1,4 +1,4 @@ -.\" $Id: installboot.8,v 1.3 1995/12/14 05:26:56 deraadt Exp $ +.\" $Id: installboot.8,v 1.4 1996/10/11 23:06:41 deraadt Exp $ .\" .Dd 31 May 1995 .Dt INSTALLBOOT 8 diff --git a/sys/arch/sun3/stand/libsa/Makefile b/sys/arch/sun3/stand/libsa/Makefile index 88f8d933115..2147f070661 100644 --- a/sys/arch/sun3/stand/libsa/Makefile +++ b/sys/arch/sun3/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.9 1995/11/17 23:23:52 gwr Exp $ +# $NetBSD: Makefile,v 1.9.4.1 1996/06/26 20:16:58 jtc Exp $ LIB=sa @@ -13,7 +13,7 @@ DIR_KERN=$S/lib/libkern SRC_net= nfs.c rpc.c net.c ether.c arp.c in_cksum.c \ bootparam.c rarp.c -SRC_sa = alloc.c bcopy.c close.c getfile.c open.c \ +SRC_sa = alloc.c bcopy.c close.c getfile.c memcpy.c open.c \ printf.c read.c strerror.c ufs.c SRC_kern= ashrdi3.c bcmp.c bzero.c strcmp.c strlen.c diff --git a/sys/arch/sun3/stand/libsa/dev_disk.c b/sys/arch/sun3/stand/libsa/dev_disk.c index 2d967f4d0ce..5fd83a61003 100644 --- a/sys/arch/sun3/stand/libsa/dev_disk.c +++ b/sys/arch/sun3/stand/libsa/dev_disk.c @@ -48,11 +48,11 @@ #include "dvma.h" #include "promdev.h" - -#define RETRY_COUNT 5 + +#define RETRY_COUNT 5 extern int debug; -int disk_opencount; +int disk_opencount; struct saioreq disk_ioreq; int @@ -66,22 +66,22 @@ disk_open(f, devname) #ifdef DEBUG_PROM if (debug) - printf("disk_open: %s\n", devname); + printf("disk_open: %s\n", devname); #endif si = &disk_ioreq; if (disk_opencount == 0) { - /* - * Setup our part of the saioreq. - * (determines what gets opened) - */ - bp = *romp->bootParam; - si->si_boottab = bp->bootDevice; - si->si_ctlr = bp->ctlrNum; - si->si_unit = bp->unitNum; - si->si_boff = bp->partNum; - if ((error = prom_iopen(si)) != 0) - return (error); + /* + * Setup our part of the saioreq. + * (determines what gets opened) + */ + bp = *romp->bootParam; + si->si_boottab = bp->bootDevice; + si->si_ctlr = bp->ctlrNum; + si->si_unit = bp->unitNum; + si->si_boff = bp->partNum; + if ((error = prom_iopen(si)) != 0) + return (error); } disk_opencount++; @@ -128,7 +128,7 @@ disk_strategy(devdata, flag, dblk, size, buf, rsize) #ifdef DEBUG_PROM if (debug > 1) - printf("disk_strategy: size=%d dblk=%d\n", size, dblk); + printf("disk_strategy: size=%d dblk=%d\n", size, dblk); #endif dmabuf = dvma_mapin(buf, size); @@ -140,10 +140,10 @@ disk_strategy(devdata, flag, dblk, size, buf, rsize) */ retry = RETRY_COUNT; do { - si->si_bn = dblk; - si->si_ma = dmabuf; - si->si_cc = size; - xcnt = (*ops->b_strategy)(si, si_flag); + si->si_bn = dblk; + si->si_ma = dmabuf; + si->si_cc = size; + xcnt = (*ops->b_strategy)(si, si_flag); } while ((xcnt <= 0) && (--retry > 0)); dvma_mapout(dmabuf, size); diff --git a/sys/arch/sun3/stand/libsa/exec_sun.c b/sys/arch/sun3/stand/libsa/exec_sun.c index c22e9db71a9..d14ac4000ae 100644 --- a/sys/arch/sun3/stand/libsa/exec_sun.c +++ b/sys/arch/sun3/stand/libsa/exec_sun.c @@ -1,4 +1,4 @@ -/* $NetBSD: exec_sun.c,v 1.5 1996/01/29 23:41:06 gwr Exp $ */ +/* $NetBSD: exec_sun.c,v 1.6 1996/06/20 03:59:41 gwr Exp $ */ /*- * Copyright (c) 1982, 1986, 1990, 1993 @@ -89,12 +89,16 @@ exec_sun(file, loadaddr) bcopy(&x, cp - sizeof(x), sizeof(x)); /* - * Read in the text segment. + * Read in the text segment. Note: + * a.out header part of text in zmagic */ printf("%d", x.a_text); - if (read(io, cp, x.a_text) != x.a_text) + cc = x.a_text; + if (magic == ZMAGIC) + cc -= sizeof(x); + if (read(io, cp, cc) != cc) goto shread; - cp += x.a_text; + cp += cc; /* * NMAGIC may have a gap between text and data. diff --git a/sys/arch/sun3/stand/libsa/netif_sun.c b/sys/arch/sun3/stand/libsa/netif_sun.c index f1d7753628a..a72d55e9428 100644 --- a/sys/arch/sun3/stand/libsa/netif_sun.c +++ b/sys/arch/sun3/stand/libsa/netif_sun.c @@ -404,7 +404,7 @@ netif_get(desc, pkt, maxlen, timo) /* Have to receive into our own buffer and copy. */ do { - tick0 = getticks(); + tick0 = getticks(); do { rlen = (*sif->sif_poll)(si->si_devdata, dd->rbuf); if (rlen != 0) diff --git a/sys/arch/sun3/stand/libsa/panic.c b/sys/arch/sun3/stand/libsa/panic.c index 97fddd3e5ff..b8841ad1ad3 100644 --- a/sys/arch/sun3/stand/libsa/panic.c +++ b/sys/arch/sun3/stand/libsa/panic.c @@ -7,11 +7,11 @@ extern __dead void abort(); __dead void panic(const char *fmt, ...) { - va_list ap; + va_list ap; - va_start(ap, fmt); + va_start(ap, fmt); vprintf(fmt, ap); - printf("\n"); - va_end(ap); + printf("\n"); + va_end(ap); abort(); } diff --git a/sys/arch/sun3/stand/libsa/promdev.c b/sys/arch/sun3/stand/libsa/promdev.c index 130e4d8cb28..35fe364c1c5 100644 --- a/sys/arch/sun3/stand/libsa/promdev.c +++ b/sys/arch/sun3/stand/libsa/promdev.c @@ -77,7 +77,7 @@ prom_iopen(si) printf("d_localbytes=%d\n", dip->d_localbytes); printf("d_stdcount=%d\n", dip->d_stdcount); printf("d_stdaddrs[%d]=%x\n", si->si_ctlr, - dip->d_stdaddrs[si->si_ctlr]); + dip->d_stdaddrs[si->si_ctlr]); printf("d_devtype=%d\n", dip->d_devtype); printf("d_maxiobytes=%d\n", dip->d_maxiobytes); } @@ -96,7 +96,7 @@ prom_iopen(si) #ifdef DEBUG_PROM if (debug) printf("prom_iopen: devaddr=0x%x pte=0x%x\n", - si->si_devaddr, get_pte(si->si_devaddr)); + si->si_devaddr, get_pte(si->si_devaddr)); #endif } @@ -109,7 +109,7 @@ prom_iopen(si) si->si_dmaaddr = (char*) addr; #ifdef DEBUG_PROM if (debug) - printf("prom_iopen: dmaaddr=0x%x\n", si->si_dmaaddr); + printf("prom_iopen: dmaaddr=0x%x\n", si->si_dmaaddr); #endif } @@ -122,6 +122,10 @@ prom_iopen(si) } /* OK, call the PROM device open routine. */ +#ifdef DEBUG_PROM + if (debug) + printf("prom_iopen: calling prom open...\n"); +#endif error = (*ops->b_open)(si); if (error != 0) { printf("prom_iopen: \"%s\" error=%d\n", diff --git a/sys/arch/sun3/stand/netboot/dev_net.c b/sys/arch/sun3/stand/netboot/dev_net.c index 069b58ab519..e159174c267 100644 --- a/sys/arch/sun3/stand/netboot/dev_net.c +++ b/sys/arch/sun3/stand/netboot/dev_net.c @@ -139,8 +139,8 @@ net_open(struct open_file *f, ...) fail: netif_close(netdev_sock); netdev_sock = -1; - return (error); - } + return (error); + } if (debug) printf("net_open: NFS mount succeeded\n"); } diff --git a/sys/arch/sun3/stand/netboot/version.c b/sys/arch/sun3/stand/netboot/version.c index aa92d773181..d98db932634 100644 --- a/sys/arch/sun3/stand/netboot/version.c +++ b/sys/arch/sun3/stand/netboot/version.c @@ -4,4 +4,4 @@ * NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. */ -char *version = "$Revision: 1.3 $"; +char *version = "$Revision: 1.4 $"; diff --git a/sys/arch/sun3/stand/ufsboot/version.c b/sys/arch/sun3/stand/ufsboot/version.c index 24bd2f33d1e..1f8b884dcd6 100644 --- a/sys/arch/sun3/stand/ufsboot/version.c +++ b/sys/arch/sun3/stand/ufsboot/version.c @@ -4,4 +4,4 @@ * NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. */ -char *version = "$Revision: 1.1 $"; +char *version = "$Revision: 1.2 $"; diff --git a/sys/arch/sun3/sun3/conf.c b/sys/arch/sun3/sun3/conf.c index 7197e571f31..f7e6e088c3d 100644 --- a/sys/arch/sun3/sun3/conf.c +++ b/sys/arch/sun3/sun3/conf.c @@ -164,9 +164,6 @@ cdev_decl(bpf); #include "tun.h" cdev_decl(tun); -#include "random.h" -cdev_decl(random); - dev_decl(filedesc,open); @@ -244,7 +241,6 @@ struct cdevsw cdevsw[] = cdev_notdef(), /* 69: /dev/audio */ cdev_notdef(), /* 70: open prom */ cdev_notdef(), /* 71: (sg?) */ - cdev_random_init(NRANDOM,random), /* 72: random data source */ }; int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); diff --git a/sys/arch/sun3/sun3/db_memrw.c b/sys/arch/sun3/sun3/db_memrw.c index 59db0e08a79..459ce4c5252 100644 --- a/sys/arch/sun3/sun3/db_memrw.c +++ b/sys/arch/sun3/sun3/db_memrw.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_memrw.c,v 1.11 1996/02/20 02:42:55 gwr Exp $ */ +/* $NetBSD: db_memrw.c,v 1.12 1996/06/17 15:40:48 gwr Exp $ */ /* * Copyright (c) 1996 Gordon W. Ross @@ -29,6 +29,8 @@ /* * Interface to the debugger for virtual memory read/write. + * This file is shared by DDB and KGDB, and must work even + * when only KGDB is included (thus no db_printf calls). * * To write in the text segment, we have to first make * the page writable, do the write, then restore the PTE. @@ -130,7 +132,7 @@ db_write_text(addr, size, data) #endif oldpte = get_pte(pgva); if ((oldpte & PG_VALID) == 0) { - db_printf(" address 0x%x not a valid page\n", dst); + printf(" address 0x%x not a valid page\n", dst); return; } tmppte = oldpte | PG_WRITE | PG_NC; diff --git a/sys/arch/sun3/sun3/disksubr.c b/sys/arch/sun3/sun3/disksubr.c index fb78c2014e9..42864e70294 100644 --- a/sys/arch/sun3/sun3/disksubr.c +++ b/sys/arch/sun3/sun3/disksubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: disksubr.c,v 1.12 1996/04/26 18:37:58 gwr Exp $ */ +/* $NetBSD: disksubr.c,v 1.13 1996/05/05 06:00:31 gwr Exp $ */ /* * Copyright (c) 1994, 1995 Gordon W. Ross @@ -279,15 +279,12 @@ bad: * additional "device registration" types of work. (?) * For example, the sparc port uses this to record the * device node for the PROM-specified boot device. - * - * XXX: return value not documented (ignored everywhere) */ void dk_establish(dk, dev) struct disk *dk; struct device *dev; { - return; } /************************************************************************ diff --git a/sys/arch/sun3/sun3/kgdb_proto.h b/sys/arch/sun3/sun3/kgdb_proto.h new file mode 100644 index 00000000000..c1bd32be99c --- /dev/null +++ b/sys/arch/sun3/sun3/kgdb_proto.h @@ -0,0 +1,74 @@ +/* $NetBSD: kgdb_proto.h,v 1.1 1996/06/15 14:34:37 gwr Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * Copyright (c) 1995 + * The President and Fellows of Harvard College. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgements: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratory. + * + * This product includes software developed by Harvard University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the 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 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. + * + * @(#)kgdb_proto.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * Message types. + */ +#define KGDB_MEM_R 0x01 +#define KGDB_MEM_W 0x02 +#define KGDB_REG_R 0x03 +#define KGDB_REG_W 0x04 +#define KGDB_CONT 0x05 +#define KGDB_STEP 0x06 +#define KGDB_KILL 0x07 +#define KGDB_SIGNAL 0x08 +#define KGDB_EXEC 0x09 +#define KGDB_HALT 0x0a +#define KGDB_BOOT 0x0b + +#define KGDB_CMD(x) ((x) & 0x0f) + +/* + * Message flags. + */ +#define KGDB_ACK 0x80 +#define KGDB_DELTA 0x40 +#define KGDB_MORE 0x20 +#define KGDB_SEQ 0x10 diff --git a/sys/arch/sun3/sun3/kgdb_stub.c b/sys/arch/sun3/sun3/kgdb_stub.c new file mode 100644 index 00000000000..875bdeea18b --- /dev/null +++ b/sys/arch/sun3/sun3/kgdb_stub.c @@ -0,0 +1,623 @@ +/* $NetBSD: kgdb_stub.c,v 1.2 1996/06/15 14:47:49 gwr Exp $ */ + +/* + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratories. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the 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 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. + * + * @(#)kgdb_stub.c 8.4 (Berkeley) 1/12/94 + */ + +/* + * "Stub" to allow remote cpu to debug over a serial line using gdb. + */ + +#include <sys/param.h> +#include <sys/systm.h> + +#include <vm/vm.h> +#include <vm/vm_extern.h> + +#include <machine/control.h> +#include <machine/cpu.h> +#include <machine/frame.h> +#include <machine/psl.h> +#include <machine/pte.h> +#include <machine/reg.h> +#include <machine/trap.h> + +#include <sun3/sun3/kgdb_proto.h> +#include <machine/remote-sl.h> + +/* These are in db_memrw.c */ +extern void db_read_bytes __P((vm_offset_t addr, size_t size, char *data)); +extern void db_write_bytes __P((vm_offset_t addr, size_t size, char *data)); + +#ifndef KGDBDEV +#define KGDBDEV -1 +#endif +#ifndef KGDBRATE +#define KGDBRATE 19200 +#endif + +int kgdb_dev = KGDBDEV; /* remote debugging device (-1 if none) */ +int kgdb_rate = KGDBRATE; /* remote debugging baud rate */ +int kgdb_active = 0; /* remote debugging active if != 0 */ +int kgdb_debug_init = 0; /* != 0 waits for remote at system init */ +int kgdb_debug_panic = 0; /* != 0 waits for remote on panic */ + +static void kgdb_send __P((u_int, u_char *, int)); +static int kgdb_recv __P((u_char *, int *)); +static int computeSignal __P((int)); +int kgdb_trap __P((int, struct trapframe *)); +int kgdb_acc __P((caddr_t, int)); + +static int (*kgdb_getc) __P((void *)); +static void (*kgdb_putc) __P((void *, int)); +static void *kgdb_ioarg; + +#define GETC() ((*kgdb_getc)(kgdb_ioarg)) +#define PUTC(c) ((*kgdb_putc)(kgdb_ioarg, c)) +#define PUTESC(c) do { \ + if (c == FRAME_END) { \ + PUTC(FRAME_ESCAPE); \ + c = TRANS_FRAME_END; \ + } else if (c == FRAME_ESCAPE) { \ + PUTC(FRAME_ESCAPE); \ + c = TRANS_FRAME_ESCAPE; \ + } else if (c == FRAME_START) { \ + PUTC(FRAME_ESCAPE); \ + c = TRANS_FRAME_START; \ + } \ + PUTC(c); \ +} while (0) + +/* + * This is called by the approprite tty driver. + * In our case, by dev/zs_kgdb.c:zs_kgdb_init() + */ +void +kgdb_attach(getfn, putfn, ioarg) + int (*getfn) __P((void *)); + void (*putfn) __P((void *, int)); + void *ioarg; +{ + + kgdb_getc = getfn; + kgdb_putc = putfn; + kgdb_ioarg = ioarg; +} + +/* + * Send a message. The host gets one chance to read it. + */ +static void +kgdb_send(type, bp, len) + register u_int type; + register u_char *bp; + register int len; +{ + register u_char csum; + register u_char *ep = bp + len; + + PUTC(FRAME_START); + PUTESC(type); + + csum = type; + while (bp < ep) { + type = *bp++; + csum += type; + PUTESC(type); + } + csum = -csum; + PUTESC(csum); + PUTC(FRAME_END); +} + +static int +kgdb_recv(bp, lenp) + u_char *bp; + int *lenp; +{ + register u_char c, csum; + register int escape, len; + register int type; + +restart: + csum = len = escape = 0; + type = -1; + while (1) { + c = GETC(); + switch (c) { + + case FRAME_ESCAPE: + escape = 1; + continue; + + case TRANS_FRAME_ESCAPE: + if (escape) + c = FRAME_ESCAPE; + break; + + case TRANS_FRAME_END: + if (escape) + c = FRAME_END; + break; + + case TRANS_FRAME_START: + if (escape) + c = FRAME_START; + break; + + case FRAME_START: + goto restart; + + case FRAME_END: + if (type < 0 || --len < 0) { + csum = len = escape = 0; + type = -1; + continue; + } + if (csum != 0) + return (0); + *lenp = len; + return (type); + } + csum += c; + if (type < 0) { + type = c; + escape = 0; + continue; + } + if (++len > SL_RPCSIZE) { + while (GETC() != FRAME_END) + continue; + return (0); + } + *bp++ = c; + escape = 0; + } +} + +/* + * Translate a trap number into a unix compatible signal value. + * (gdb only understands unix signal numbers). + */ +static int +computeSignal(type) + int type; +{ + int sigval; + + switch (type) { + case T_BUSERR: + sigval = SIGBUS; + break; + case T_ADDRERR: + sigval = SIGBUS; + break; + case T_ILLINST: + sigval = SIGILL; + break; + case T_ZERODIV: + sigval = SIGFPE; + break; + case T_CHKINST: + sigval = SIGFPE; + break; + case T_TRAPVINST: + sigval = SIGFPE; + break; + case T_PRIVINST: + sigval = SIGILL; + break; + case T_TRACE: + sigval = SIGTRAP; + break; + case T_MMUFLT: + sigval = SIGSEGV; + break; + case T_SSIR: + sigval = SIGSEGV; + break; + case T_FMTERR: + sigval = SIGILL; + break; + case T_FPERR: + sigval = SIGFPE; + break; + case T_COPERR: + sigval = SIGFPE; + break; + case T_ASTFLT: + sigval = SIGINT; + break; + case T_TRAP15: + sigval = SIGTRAP; + break; + default: + sigval = SIGEMT; + break; + } + return (sigval); +} + +/* + * Trap into kgdb to wait for debugger to connect, + * noting on the console why nothing else is going on. + */ +void +kgdb_connect(verbose) + int verbose; +{ + + if (kgdb_dev < 0 || kgdb_getc == NULL) + return; + fb_unblank(); + if (verbose) + printf("kgdb waiting..."); + Debugger(); /* XXX: trap into kgdb */ + if (verbose) + printf("connected.\n"); +} + +/* + * Decide what to do on panic. + * (This is called by panic, like Debugger()) + */ +void +kgdb_panic() +{ + + if (kgdb_dev >= 0 && kgdb_getc != NULL && + kgdb_active == 0 && kgdb_debug_panic) + { + /* XXX: Just call Debugger() instead? */ + kgdb_connect(1); + } +} + +/* + * Definitions exported from gdb. + */ +#define NUM_REGS 18 +#define REGISTER_BYTES (NUM_REGS * 4) +#define REGISTER_BYTE(n) ((n) * 4) + +#define GDB_SR 16 +#define GDB_PC 17 + +/* + * This little routine exists simply so that bcopy() can be debugged. + */ +static void +kgdb_copy(vsrc, vdst, len) + void *vsrc, *vdst; + register int len; +{ + register char *src = vsrc; + register char *dst = vdst; + + while (--len >= 0) + *dst++ = *src++; +} + +/* ditto for bzero */ +static void +kgdb_zero(vptr, len) + void *vptr; + register int len; +{ + register char *ptr = vptr; + + while (--len >= 0) + *ptr++ = (char) 0; +} + +/* + * Translate the values stored in the kernel regs struct to the format + * understood by gdb. + * + * There is a short pad word between SP (A7) and SR which keeps the + * kernel stack long word aligned (note that this is in addition to + * the stack adjust short that we treat as the upper half of a longword + * SR). We must skip this when copying into and out of gdb. + */ +static void +regs_to_gdb(tf, gdb_regs) + struct trapframe *tf; + u_long *gdb_regs; +{ + kgdb_copy(tf->tf_regs, gdb_regs, 16*4); + gdb_regs[GDB_SR] = tf->tf_sr; + gdb_regs[GDB_PC] = tf->tf_pc; +} + +/* + * Reverse the above. + */ +static void +gdb_to_regs(tf, gdb_regs) + struct trapframe *tf; + u_long *gdb_regs; +{ + kgdb_copy(gdb_regs, tf->tf_regs, 16*4); + tf->tf_sr = gdb_regs[GDB_SR]; + tf->tf_pc = gdb_regs[GDB_PC]; +} + +static u_long reg_cache[NUM_REGS]; +static u_char inbuffer[SL_RPCSIZE]; +static u_char outbuffer[SL_RPCSIZE]; + +/* + * This function does all command procesing for interfacing to + * a remote gdb. + */ +int +kgdb_trap(type, tf) + int type; + struct trapframe *tf; +{ + register u_long len; + caddr_t addr; + register u_char *cp; + register u_char out, in; + register int outlen; + int inlen; + u_long gdb_regs[NUM_REGS]; + + if (kgdb_dev < 0 || kgdb_getc == NULL) { + /* not debugging */ + return (0); + } + if (kgdb_active == 0) { + if (type != T_BREAKPOINT) { + /* No debugger active -- let trap handle this. */ + return (0); + } + + /* + * If the packet that woke us up isn't an exec packet, + * ignore it since there is no active debugger. Also, + * we check that it's not an ack to be sure that the + * remote side doesn't send back a response after the + * local gdb has exited. Otherwise, the local host + * could trap into gdb if it's running a gdb kernel too. + */ + in = GETC(); + /* + * If we came in asynchronously through the serial line, + * the framing character is eaten by the receive interrupt, + * but if we come in through a synchronous trap (i.e., via + * kgdb_connect()), we will see the extra character. + */ + if (in == FRAME_START) + in = GETC(); + + /* + * Check that this is a debugger exec message. If so, + * slurp up the entire message then ack it, and fall + * through to the recv loop. + */ + if (KGDB_CMD(in) != KGDB_EXEC || (in & KGDB_ACK) != 0) + return (0); + while (GETC() != FRAME_END) + continue; + /* + * Do the printf *before* we ack the message. This way + * we won't drop any inbound characters while we're + * doing the polling printf. + */ + printf("kgdb started from device %x\n", kgdb_dev); + kgdb_send(in | KGDB_ACK, (u_char *)0, 0); + kgdb_active = 1; + } + /* + * Stick frame regs into our reg cache then tell remote host + * that an exception has occured. + */ + regs_to_gdb(tf, gdb_regs); + if (type != T_BREAKPOINT) { + /* + * XXX - Which is right? The code or the comment? -gwr + * Only send an asynchronous SIGNAL message when we hit + * a breakpoint. Otherwise, we will drop the incoming + * packet while we output this one (and on entry the other + * side isn't interested in the SIGNAL type -- if it is, + * it will have used a signal packet.) + */ + outbuffer[0] = computeSignal(type); + kgdb_send(KGDB_SIGNAL, outbuffer, 1); + } + + for (;;) { + in = kgdb_recv(inbuffer, &inlen); + if (in == 0 || (in & KGDB_ACK)) + /* Ignore inbound acks and error conditions. */ + continue; + + out = in | KGDB_ACK; + switch (KGDB_CMD(in)) { + + case KGDB_SIGNAL: + /* + * if this command came from a running gdb, + * answer it -- the other guy has no way of + * knowing if we're in or out of this loop + * when he issues a "remote-signal". (Note + * that without the length check, we could + * loop here forever if the output line is + * looped back or the remote host is echoing.) + */ + if (inlen == 0) { + outbuffer[0] = computeSignal(type); + kgdb_send(KGDB_SIGNAL, outbuffer, 1); + } + continue; + + case KGDB_REG_R: + case KGDB_REG_R | KGDB_DELTA: + cp = outbuffer; + outlen = 0; + for (len = inbuffer[0]; len < NUM_REGS; ++len) { + if (reg_cache[len] != gdb_regs[len] || + (in & KGDB_DELTA) == 0) { + if (outlen + 5 > SL_MAXDATA) { + out |= KGDB_MORE; + break; + } + cp[outlen] = len; + kgdb_copy(&gdb_regs[len], + &cp[outlen + 1], 4); + reg_cache[len] = gdb_regs[len]; + outlen += 5; + } + } + break; + + case KGDB_REG_W: + case KGDB_REG_W | KGDB_DELTA: + cp = inbuffer; + for (len = 0; len < inlen; len += 5) { + register int j = cp[len]; + + kgdb_copy(&cp[len + 1], + &gdb_regs[j], 4); + reg_cache[j] = gdb_regs[j]; + } + gdb_to_regs(tf, gdb_regs); + outlen = 0; + break; + + case KGDB_MEM_R: + len = inbuffer[0]; + kgdb_copy(&inbuffer[1], &addr, 4); + if (len > SL_MAXDATA) { + outlen = 1; + outbuffer[0] = E2BIG; + } else if (!kgdb_acc(addr, len)) { + outlen = 1; + outbuffer[0] = EFAULT; + } else { + outlen = len + 1; + outbuffer[0] = 0; + db_read_bytes((vm_offset_t)addr, (size_t)len, + (char *)&outbuffer[1]); + } + break; + + case KGDB_MEM_W: + len = inlen - 4; + kgdb_copy(inbuffer, &addr, 4); + outlen = 1; + if (!kgdb_acc(addr, len)) + outbuffer[0] = EFAULT; + else { + outbuffer[0] = 0; + db_write_bytes((vm_offset_t)addr, (size_t)len, + (char *)&inbuffer[4]); + } + break; + + case KGDB_KILL: + kgdb_active = 0; + printf("kgdb detached\n"); + /* FALLTHROUGH */ + + case KGDB_CONT: + kgdb_send(out, 0, 0); + tf->tf_sr &=~ PSL_T; + goto out; + + case KGDB_STEP: + kgdb_send(out, 0, 0); + tf->tf_sr |= PSL_T; + goto out; + + case KGDB_HALT: + kgdb_send(out, 0, 0); + sun3_mon_halt(); + /* NOTREACHED */ + + case KGDB_BOOT: + kgdb_send(out, 0, 0); + sun3_mon_reboot(""); + /* NOTREACHED */ + + case KGDB_EXEC: + default: + /* Unknown command. Ack with a null message. */ + outlen = 0; + break; + } + /* Send the reply */ + kgdb_send(out, outbuffer, outlen); + } +out: + return (1); +} + +/* + * XXX: Determine if the memory at addr..(addr+len) is valid. + * XXX: Should we just use the PTE bits? Why not? + * XXX: Better yet, setup a fault handler? + */ +kgdb_acc(addr, len) + caddr_t addr; + int len; +{ + vm_offset_t va; + int pte, pgoff; + + va = (vm_offset_t) addr; + pgoff = va & PGOFSET; + va -= pgoff; + len += pgoff; + + do { + pte = get_pte(va); + if ((pte & PG_VALID) == 0) + return (0); + va += NBPG; + len -= NBPG; + } while (len > 0); + + return (1); +} diff --git a/sys/arch/sun3/sun3/locore.s b/sys/arch/sun3/sun3/locore.s index b7f384f7d59..c677314e0dd 100644 --- a/sys/arch/sun3/sun3/locore.s +++ b/sys/arch/sun3/sun3/locore.s @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.38 1996/04/07 05:42:17 gwr Exp $ */ +/* $NetBSD: locore.s,v 1.39 1996/06/17 15:40:52 gwr Exp $ */ /* * Copyright (c) 1994, 1995 Gordon W. Ross @@ -530,13 +530,14 @@ _trap15: jne kbrkpt | yes, kernel breakpoint jra fault | no, user-mode fault -kbrkpt: | Kernel-mode breakpoint or trace trap. - | Save system sp rather than user sp. +kbrkpt: | Kernel-mode breakpoint or trace trap. (d0=trap_type) + | Save the system sp rather than the user sp. + movw #PSL_HIGHIPL,sr | lock out interrupts lea sp@(FR_SIZE),a6 | Save stack pointer movl a6,sp@(FR_SP) | from before trap | If we are not on tmpstk switch to it. - | (allows debugger to frob the stack) + | (so debugger can change the stack pointer) movl a6,d1 cmpl #tmpstk,d1 jls Lbrkpt2 | already on tmpstk @@ -551,13 +552,39 @@ Lbrkpt1: bgt Lbrkpt1 Lbrkpt2: - | Now call the trap handler as usual. - clrl sp@- | no VA arg - clrl sp@- | or code arg - movl d0,sp@- | push trap type - jbsr _trap | handle trap - lea sp@(12),sp | pop value args - + | Call the trap handler for the kernel debugger. + | Do not call trap() to do it, so that we can + | set breakpoints in trap() if we want. We know + | the trap type is either T_TRACE or T_BREAKPOINT. + | If we have both DDB and KGDB, let KGDB see it first, + | because KGDB will just return 0 if not connected. + | Save args in d2, a2 + movl d0,d2 | trap type + movl sp,a2 | frame ptr +#ifdef KGDB + | Let KGDB handle it (if connected) + movl a2,sp@- | push frame ptr + movl d2,sp@- | push trap type + jbsr _kgdb_trap | handle the trap + addql #8,sp | pop args + cmpl #0,d0 | did kgdb handle it + jne Lbrkpt3 | yes, done +#endif +#ifdef DDB + | Let DDB handle it. + movl a2,sp@- | push frame ptr + movl d2,sp@- | push trap type + jbsr _kdb_trap | handle the trap + addql #8,sp | pop args + cmpl #0,d0 | did ddb handle it + jne Lbrkpt3 | yes, done +#endif + | Drop into the PROM temporarily... + movl a2,sp@- | push frame ptr + movl d2,sp@- | push trap type + jbsr _nodb_trap | handle the trap + addql #8,sp | pop args +Lbrkpt3: | The stack pointer may have been modified, or | data below it modified (by kgdb push call), | so push the hardware frame at the current sp diff --git a/sys/arch/sun3/sun3/pmap.c b/sys/arch/sun3/sun3/pmap.c index 8395d0e08cc..c6dcd50f671 100644 --- a/sys/arch/sun3/sun3/pmap.c +++ b/sys/arch/sun3/sun3/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.60 1996/02/28 22:51:05 gwr Exp $ */ +/* $NetBSD: pmap.c,v 1.61 1996/05/05 06:02:31 gwr Exp $ */ /* * Copyright (c) 1994, 1995 Gordon W. Ross @@ -3218,6 +3218,55 @@ pmap_prefer(fo, va) } /* + * Copy the kernel segmap into the passed buffer (256 bytes). + */ +void +pmap_get_ksegmap(vaddr) + vm_offset_t vaddr; +{ + vm_offset_t va; + u_char *cp = (u_char*)vaddr; + + va = KERNBASE; + do { + *cp = get_segmap(va); + cp++; + va += NBSG; + } while (va < 0x10000000); +} + +/* + * Copy the pagemap RAM into the passed buffer (one page) + * starting at OFF in the pagemap RAM. + */ +void +pmap_get_pagemap(vaddr, off) + vm_offset_t vaddr; + int off; +{ + vm_offset_t va, va_end; + int sme, sme_end; /* SegMap Entry numbers */ + int *pt; + + pt = (int*)vaddr; /* destination */ + sme = (off >> 6); /* PMEG to start on */ + sme_end = sme + 128; /* where to stop */ + va_end = temp_seg_va + NBSG; + + do { + set_segmap(temp_seg_va, sme); + va = temp_seg_va; + do { + *pt++ = get_pte(va); + va += NBPG; + } while (va < va_end); + sme++; + } while (sme < sme_end); + set_segmap(temp_seg_va, SEGINV); +} + + +/* * Helper functions for changing unloaded PMEGs */ static int temp_seg_inuse; diff --git a/sys/arch/sun3/sun3/stub.c b/sys/arch/sun3/sun3/stub.c index fda67bc9b24..aed10463c2b 100644 --- a/sys/arch/sun3/sun3/stub.c +++ b/sys/arch/sun3/sun3/stub.c @@ -1,4 +1,4 @@ -/* $NetBSD: stub.c,v 1.11 1996/03/26 15:16:55 gwr Exp $ */ +/* $NetBSD: stub.c,v 1.12 1996/06/17 15:41:02 gwr Exp $ */ /* * Copyright (c) 1996 Gordon W. Ross @@ -44,18 +44,15 @@ void swapgeneric() {} * XXX: isr.c:netintr() - move to conf.c? */ -/* sun3_startup.c */ -#if !defined(DDB) && !defined(KGDB) /* * When DDB is included, Debugger() comes from db_interface.c - * otherwise provide this function. This will just stop in - * the Sun PROM monitor. (You can look around, or continue.) + * otherwise we get the one compiled here. */ -void Debugger() +#ifndef DDB +void +Debugger() { - sun3_mon_abort(); + __asm ("trap #15"); } -#endif /* !DDB && !KGDB */ - -/* sys_machdep.c */ -/* trap.c */ +#endif /* !DDB */ + diff --git a/sys/arch/sun3/sun3/sun3_startup.c b/sys/arch/sun3/sun3/sun3_startup.c index d0ce50b7dc0..fc96feb35ad 100644 --- a/sys/arch/sun3/sun3/sun3_startup.c +++ b/sys/arch/sun3/sun3/sun3_startup.c @@ -1,4 +1,4 @@ -/* $NetBSD: sun3_startup.c,v 1.51 1996/03/26 15:16:59 gwr Exp $ */ +/* $NetBSD: sun3_startup.c,v 1.52 1996/05/05 06:02:37 gwr Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross @@ -93,6 +93,9 @@ vm_offset_t proc0_user_pa; struct user *proc0paddr; /* proc[0] pcb address (u-area VA) */ extern struct pcb *curpcb; +extern vm_offset_t dumppage_pa; +extern vm_offset_t dumppage_va; + /* * Switch to our own interrupt vector table. */ @@ -396,14 +399,16 @@ void sun3_vm_init(kehp) /* * Virtual and physical pages for proc[0] u-area (already mapped) - * XXX - Make these non-cached at their full-time mapping address. - * XXX - Still need to do that? -gwr */ proc0paddr = (struct user *) virtual_avail; proc0_user_pa = avail_start; virtual_avail += UPAGES*NBPG; - avail_start += UPAGES*NBPG; - /* Make them non-cached. */ + avail_start += UPAGES*NBPG; +#if 0 + /* Make them non-cached. + * XXX - Make these non-cached at their full-time mapping address. + * XXX - Still need to do that? -gwr + */ va = (vm_offset_t) proc0paddr; while (va < virtual_avail) { pte = get_pte(va); @@ -411,6 +416,15 @@ void sun3_vm_init(kehp) set_pte(va, pte); va += NBPG; } +#endif + + /* + * Virtual and physical page used by dumpsys() + */ + dumppage_va = virtual_avail; + dumppage_pa = avail_start; + virtual_avail += NBPG; + avail_start += NBPG; /* * XXX - Make sure avail_start is within the low 1M range @@ -749,34 +763,39 @@ char *str; /* * Set the PROM vector handler (for g0, g4, etc.) * and set boothowto from the PROM arg strings. + * + * Note, args are always: + * argv[0] = boot_device (i.e. "sd(0,0,0)") + * argv[1] = options (i.e. "-ds" or NULL) + * argv[2] = NULL */ void sun3_monitor_hooks() { MachMonBootParam *bpp; + char **argp; char *p; - int i; if (romp->romvecVersion >= 2) *romp->vector_cmd = v_handler; /* Set boothowto flags from PROM args. */ bpp = *romp->bootParam; - for (i = 0; i < 8; i++) { - p = bpp->argPtr[i]; + argp = bpp->argPtr; - /* Null arg? We're done. */ - if (p == NULL || *p == '\0') - break; + /* Skip argp[0] (the device string) */ + argp++; + + /* Have options? */ + if (*argp == NULL) + return; + p = *argp; + if (*p == '-') { + /* yes, parse options */ #ifdef DEBUG - mon_printf("arg[%d]=\"%s\"\n", i, p); + mon_printf("boot option: %s\n", p); #endif - - /* Not switches? Skip it. */ - if (*p++ != '-') - continue; - - while (*p) { - switch (*p++) { + for (++p; *p; p++) { + switch (*p) { case 'a': boothowto |= RB_ASKNAME; break; @@ -788,24 +807,18 @@ void sun3_monitor_hooks() break; } } + argp++; } + #ifdef DEBUG - mon_printf("boothowto=0x%x\n", boothowto); + /* Have init name? */ + if (*argp == NULL) + return; + p = *argp; + mon_printf("boot initpath: %s\n", p); #endif } -void set_interrupt_reg(value) - unsigned int value; -{ - *interrupt_reg = (unsigned char) value; -} - -unsigned int get_interrupt_reg() -{ - vm_offset_t pte; - return (unsigned int) *interrupt_reg; -} - /* * Find mappings for devices that are needed before autoconfiguration. * First the obio module finds and records useful PROM mappings, then diff --git a/sys/arch/sun3/sun3/trap.c b/sys/arch/sun3/sun3/trap.c index 6c5cbd12cc1..5ea98fda4d4 100644 --- a/sys/arch/sun3/sun3/trap.c +++ b/sys/arch/sun3/sun3/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.56 1996/03/21 23:03:49 gwr Exp $ */ +/* $NetBSD: trap.c,v 1.57 1996/06/17 15:41:05 gwr Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross @@ -224,22 +224,26 @@ trap(type, code, v, frame) p->p_md.md_regs = frame.f_regs; } -#ifdef DDB - if (type == T_TRACE || type == T_BREAKPOINT) { - (void)splhigh(); /* XXX - return will restore it */ - if (kdb_trap(type, &frame)) - return; - } -#endif - switch (type) { default: dopanic: printf("trap type=0x%x, code=0x%x, v=0x%x\n", type, code, v); + /* + * Let the kernel debugger see the trap frame that + * caused us to panic. This is a convenience so + * one can see registers at the point of failure. + */ + sig = splhigh(); +#ifdef KGDB + /* If connected, step or cont returns 1 */ + if (kgdb_trap(type, &frame)) + goto kgdb_cont; +#endif #ifdef DDB - if (kdb_trap(type, &frame)) - return; + (void) kdb_trap(type, &frame); #endif + kgdb_cont: + splx(sig); if (panicstr) { printf("trap during panic!\n"); sun3_mon_abort(); @@ -354,12 +358,14 @@ trap(type, code, v, frame) * HPBSD and HP-UX traps both get mapped by locore.s into T_TRACE. * SUN 3.x traps get passed through as T_TRAP15 and are not really * supported yet. + * + * XXX: We should never get kernel-mode T_TRACE or T_TRAP15 + * XXX: because locore.s now gives them special treatment. */ case T_TRACE: /* kernel trace trap */ - case T_TRAP15: /* SUN trace trap */ + case T_TRAP15: /* kernel breakpoint */ frame.f_sr &= ~PSL_T; - sig = SIGTRAP; - break; + return; case T_TRACE|T_USER: /* user trace trap */ case T_TRAP15|T_USER: /* SUN user trace trap */ @@ -452,6 +458,7 @@ trap(type, code, v, frame) /* Do not allow faults outside the "managed" space. */ if (va < virtual_avail) { if (p->p_addr->u_pcb.pcb_onfault) { + /* XXX - Can this happen? -gwr */ #ifdef DEBUG if (mmudebug & MDB_CPFAULT) { printf("trap: copyfault kernel_map va < avail\n"); @@ -716,3 +723,26 @@ child_return(p) ktrsysret(p->p_tracep, SYS_fork, 0, 0); #endif } + +/* + * This is used if we hit a kernel breakpoint or trace trap + * when there is no debugger installed (or not attached). + * Drop into the PROM temporarily... + */ +int +nodb_trap(type, fp) + int type; + struct frame *fp; +{ + + if ((0 <= type) && (type < trap_types)) + printf("\r\nKernel %s,", trap_type[type]); + else + printf("\r\nKernel trap 0x%x,", type); + printf(" frame=0x%x\r\n", fp); + printf("\r\n*No debugger. Doing PROM abort...\r\n"); + sun3_mon_abort(); + /* OK then, just resume... */ + fp->f_sr &= ~PSL_T; + return(1); +} |