From: briggs Date: Fri, 24 Jan 1997 01:35:24 +0000 (+0000) Subject: Sync w/ NETBSD_CURRENT_971122. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6b2954698a3581dd8268a83c502d0b716e2c71ea;p=openbsd Sync w/ NETBSD_CURRENT_971122. --- diff --git a/sys/arch/mac68k/conf/GENERIC b/sys/arch/mac68k/conf/GENERIC index fd8bf207489..c4273760cd9 100644 --- a/sys/arch/mac68k/conf/GENERIC +++ b/sys/arch/mac68k/conf/GENERIC @@ -1,5 +1,5 @@ -# $OpenBSD: GENERIC,v 1.13 1997/01/01 04:04:48 briggs Exp $ -# $NetBSD: GENERIC,v 1.43 1996/09/22 06:49:09 scottr Exp $ +# $OpenBSD: GENERIC,v 1.14 1997/01/24 01:35:24 briggs Exp $ +# $NetBSD: GENERIC,v 1.52 1997/01/13 23:34:07 scottr Exp $ # # GENERIC @@ -7,10 +7,7 @@ include "arch/mac68k/conf/std.mac68k" maxusers 16 -options MAXFDESCS=2048 - # Standard system options -options SWAPPAGER, DEVPAGER # paging options DIAGNOSTIC # DEBUG for extra kernel debugging options KTRACE # system call tracing support #options KGDB # support for kernel gdb @@ -39,7 +36,7 @@ options SCSI # Networking options options INET -#options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP +options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP options GATEWAY # IP packet forwarding #options ISO # OSI networking #options TPIP @@ -59,6 +56,7 @@ options FPU_EMULATE options COMPAT_NOMID options COMPAT_SUNOS options ZS_CONSOLE_ABORT +options DISABLE_EXT_CACHE # Don't use IIci external cache config bsd swap generic options GENERIC @@ -66,20 +64,25 @@ options GENERIC sn0 at obio? # SONIC ethernet (68040) intvid0 at obio? # Internal video hardware -grf* at intvid? nubus0 at mainbus? ae* at nubus? macvid* at nubus? + +# Attach grf semantics to all video hardware as it is found +grf* at intvid? grf* at macvid? # Attach ite semantics to the appropriate grf device ite0 at grf? +# Use only one of ncrscsi or sbc ncrscsi0 at obio? # SCSI NCR 5380 -esp0 at obio? # SCSI NCR 53C96 -esp1 at obio? # SCSI NCR 53C96 +#sbc0 at obio? flags 0x1 # MI NCR 5380 SCSI Bus Controller + +esp0 at obio? # SCSI NCR 53C9x +esp1 at obio? # SCSI NCR 53C9x scsibus* at scsi? sd* at scsibus? target ? lun ? # SCSI disk drives @@ -92,6 +95,8 @@ uk* at scsibus? target ? lun ? # SCSI unknown pseudo-device pty 16 pseudo-device bpfilter 12 pseudo-device vnd 2 +pseudo-device ccd 2 pseudo-device ppp 2 pseudo-device loop pseudo-device sl +#pseudo-device ipfilter diff --git a/sys/arch/mac68k/conf/Makefile.mac68k b/sys/arch/mac68k/conf/Makefile.mac68k index a1e4c0d6201..c24ef36b5b4 100644 --- a/sys/arch/mac68k/conf/Makefile.mac68k +++ b/sys/arch/mac68k/conf/Makefile.mac68k @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile.mac68k,v 1.11 1996/08/30 22:41:40 briggs Exp $ -# $NetBSD: Makefile.mac68k,v 1.40 1996/08/10 06:09:07 mycroft Exp $ +# $OpenBSD: Makefile.mac68k,v 1.12 1997/01/24 01:35:25 briggs Exp $ +# $NetBSD: Makefile.mac68k,v 1.47 1997/01/13 07:06:51 scottr Exp $ # Makefile for NetBSD # @@ -26,6 +26,7 @@ CC?= cc LD?= ld MKDEP?= mkdep STRIP?= strip -d +COPTS?= -O2 TOUCH?= touch -f -c # source tree is located via $S relative to the compilation directory @@ -35,7 +36,7 @@ MAC68K= $S/arch/mac68k INCLUDES= -I. -I$S/arch -I$S -nostdinc CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dmac68k CWARNFLAGS= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized -CFLAGS= ${DEBUG} ${CWARNFLAGS} -O -msoft-float +CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -n -Ttext 0 -e start diff --git a/sys/arch/mac68k/conf/SPOT b/sys/arch/mac68k/conf/SPOT index 80f841d9b12..86767c7baeb 100644 --- a/sys/arch/mac68k/conf/SPOT +++ b/sys/arch/mac68k/conf/SPOT @@ -1,5 +1,5 @@ -# $OpenBSD: SPOT,v 1.9 1997/01/01 04:04:49 briggs Exp $ -# $NetBSD: SPOT,v 1.11 1996/08/05 01:52:17 scottr Exp $ +# $OpenBSD: SPOT,v 1.10 1997/01/24 01:35:25 briggs Exp $ +# $NetBSD: SPOT,v 1.22 1997/01/20 00:31:42 scottr Exp $ # # SPOT @@ -7,11 +7,9 @@ include "arch/mac68k/conf/std.mac68k" maxusers 16 -makeoptions CC="cc -m68030" -options MAXFDESCS=2048 +makeoptions COPTS="-O2 -m68030" # Standard system options -options SWAPPAGER, DEVPAGER # paging options DIAGNOSTIC # DEBUG for extra kernel debugging options KTRACE # system call tracing support #options KGDB # support for kernel gdb @@ -27,69 +25,50 @@ options QUOTA # fast filesystem with user and group quotas options MFS # memory-based filesystem options NFSSERVER # Sun NFS-compatible filesystem options NFSCLIENT # Sun NFS-compatible filesystem -options NULLFS # Null (formerly loop-back) filesystem options CD9660 # ISO-9660 w/ RockRidge options KERNFS # kernel data-structure filesystem options FDESC # user file descriptor filesystem -options UNION # union filesystem -#options UMAPFS # uid/gid remapping filesystem -#options LFS # Log-based filesystem (still experimental) -#options PORTAL # portal filesystem (still experimental) options PROCFS # Process filesystem options SCSI -#options SCSIDEBUG -#options NCR5380_DEBUG -#options SBC_DEBUG # Networking options options INET -#options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP +options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP options GATEWAY # IP packet forwarding -#options ISO # OSI networking -#options TPIP -#options EON options PPP_BSDCOMP options PPP_DEFLATE +options COMPAT_42 options COMPAT_43 -#options NS options MAPMEM options SYSVSHM,SYSVSEM,SYSVMSG # Mac-specific options options M68030 -options COMPAT_SUNOS + +# SPOT-specific options +options RTC_OFFSET=360 # hardware clock is this many mins. west of GMT config bsd swap generic options GENERIC -intvid0 at obio? # Internal video hardware - nubus0 at mainbus? ae* at nubus? -macvid* at nubus? -# Attach grf semantics to all video hardware as it is found -grf* at intvid? +macvid* at nubus? grf* at macvid? - -# Attach ite semantics to the appropriate grf device ite0 at grf? -#ncrscsi0 at obio? # SCSI NCR 5380 -#esp at obio? # SCSI NCR 53C96 sbc0 at obio? flags 0x1 # MI NCR 5380 SCSI Bus Controller scsibus* at scsi? -sd* at scsibus? target ? lun ? -st* at scsibus? target ? lun ? -cd* at scsibus? target ? lun ? -ch* at scsibus? target ? lun ? +sd* at scsibus? target ? lun ? +st* at scsibus? target ? lun ? +cd* at scsibus? target ? lun ? pseudo-device pty 32 pseudo-device bpfilter 16 pseudo-device vnd 2 pseudo-device ppp 2 pseudo-device loop -#pseudo-device sl diff --git a/sys/arch/mac68k/conf/files.mac68k b/sys/arch/mac68k/conf/files.mac68k index 22a5ae63b73..9c9b488a036 100644 --- a/sys/arch/mac68k/conf/files.mac68k +++ b/sys/arch/mac68k/conf/files.mac68k @@ -1,5 +1,5 @@ -# $OpenBSD: files.mac68k,v 1.9 1997/01/01 04:04:49 briggs Exp $ -# $NetBSD: files.mac68k,v 1.50 1996/08/05 01:00:15 scottr Exp $ +# $OpenBSD: files.mac68k,v 1.10 1997/01/24 01:35:26 briggs Exp $ +# $NetBSD: files.mac68k,v 1.55 1997/01/21 09:43:45 thorpej Exp $ # mac68k-specific configuration info @@ -11,11 +11,11 @@ maxusers 2 8 64 device mainbus { } # no locators (yet?) attach mainbus at root -device obio {} +device obio { } attach obio at mainbus file arch/mac68k/dev/obio.c obio -device nubus {} +device nubus { } attach nubus at mainbus file arch/mac68k/dev/nubus.c nubus @@ -29,7 +29,7 @@ device asc attach asc at obio file arch/mac68k/dev/asc.c asc -define grfbus {} +define grfbus { } file arch/mac68k/dev/grf_subr.c grfbus device intvid: grfbus @@ -40,7 +40,7 @@ device macvid: grfbus attach macvid at nubus file arch/mac68k/dev/grf_mv.c macvid -device grf {} # eventually, we'll attach ITEs here +device grf { } attach grf at grfbus file arch/mac68k/dev/grf.c grf needs-flag @@ -113,11 +113,10 @@ file arch/mac68k/mac68k/vm_machdep.c file dev/cons.c file dev/cninit.c -# RAM Disk for installs -# These files are out of order -pseudo-device rd -file dev/ramdisk.c rd needs-flag -file arch/mac68k/dev/rd_root.c ramdisk_hooks +# RAM Disk for boot tape +pseudo-device rd +file dev/ramdisk.c rd needs-flag +file arch/sun3/dev/rd_root.c ramdisk_hooks major {sd = 4} major {st = 5} diff --git a/sys/arch/mac68k/conf/std.mac68k b/sys/arch/mac68k/conf/std.mac68k index 1e954f03344..92484d90370 100644 --- a/sys/arch/mac68k/conf/std.mac68k +++ b/sys/arch/mac68k/conf/std.mac68k @@ -1,5 +1,5 @@ -# $OpenBSD: std.mac68k,v 1.7 1996/10/14 02:43:53 briggs Exp $ -# $NetBSD: std.mac68k,v 1.13 1996/08/05 01:00:12 scottr Exp $ +# $OpenBSD: std.mac68k,v 1.8 1997/01/24 01:35:26 briggs Exp $ +# $NetBSD: std.mac68k,v 1.16 1996/11/19 00:38:07 scottr Exp $ # # standard Macintosh information. # roughly copied from std.sparc 14 Oct 1993. @@ -17,7 +17,15 @@ fpu0 at obio? zsc0 at obio? zstty* at zsc? channel ? -options TIMEZONE=0 # minutes west of GMT--read from booter -options DST=0 # daylight savings time/summer time -options HZ=60 # clock runs at 60hz on this port -options MACHINE_NONCONTIG # Allow 'holes' in physical memory +options TIMEZONE=0 # minutes west of GMT--read from booter +options DST=0 # daylight savings time/summer time + +option HZ=60 # mac clock runs at 60hz + +# Executable support +option EXEC_AOUT # a.out binary support +option EXEC_SCRIPT # shell script support + +# VM pager support +option SWAPPAGER # paging; REQUIRED +option DEVPAGER # mmap() of devices; REQUIRED diff --git a/sys/arch/mac68k/dev/adb.c b/sys/arch/mac68k/dev/adb.c index d8822e94e6b..29a5d960688 100644 --- a/sys/arch/mac68k/dev/adb.c +++ b/sys/arch/mac68k/dev/adb.c @@ -1,5 +1,5 @@ -/* $OpenBSD: adb.c,v 1.5 1996/05/26 18:35:14 briggs Exp $ */ -/* $NetBSD: adb.c,v 1.9 1996/05/05 16:21:20 briggs Exp $ */ +/* $OpenBSD: adb.c,v 1.6 1997/01/24 01:35:27 briggs Exp $ */ +/* $NetBSD: adb.c,v 1.13 1996/12/16 16:17:02 scottr Exp $ */ /*- * Copyright (C) 1994 Bradley A. Grantham @@ -50,7 +50,7 @@ e* notice, this list of conditions and the following disclaimer in the /* * Function declarations. */ -static int adbmatch __P((struct device *, void *, void *)); +static int adbmatch __P((struct device *, struct cfdata *, void *)); static void adbattach __P((struct device *, struct device *, void *)); /* @@ -95,9 +95,10 @@ struct cfdriver adb_cd = { }; static int -adbmatch(pdp, match, auxp) - struct device *pdp; - void *match, *auxp; +adbmatch(parent, cf, aux) + struct device *parent; + struct cfdata *cf; + void *aux; { return 1; } diff --git a/sys/arch/mac68k/dev/adbsys.c b/sys/arch/mac68k/dev/adbsys.c index 6b0dbb26d5a..c4e3fe5a664 100644 --- a/sys/arch/mac68k/dev/adbsys.c +++ b/sys/arch/mac68k/dev/adbsys.c @@ -1,5 +1,5 @@ -/* $OpenBSD: adbsys.c,v 1.5 1996/10/28 14:46:24 briggs Exp $ */ -/* $NetBSD: adbsys.c,v 1.21 1996/06/21 06:10:56 scottr Exp $ */ +/* $OpenBSD: adbsys.c,v 1.6 1997/01/24 01:35:28 briggs Exp $ */ +/* $NetBSD: adbsys.c,v 1.24 1997/01/13 07:01:23 scottr Exp $ */ /*- * Copyright (C) 1994 Bradley A. Grantham @@ -45,9 +45,9 @@ extern struct mac68k_machine_S mac68k_machine; /* from adb.c */ -void adb_processevent(adb_event_t * event); +void adb_processevent __P((adb_event_t * event)); -extern void adb_jadbproc(void); +extern void adb_jadbproc __P((void)); void adb_complete(buffer, data_area, adb_command) @@ -55,27 +55,29 @@ adb_complete(buffer, data_area, adb_command) caddr_t data_area; int adb_command; { - register int i; - register char *sbuf, *dbuf; adb_event_t event; ADBDataBlock adbdata; int adbaddr; int error; +#ifdef MRG_DEBUG + register int i; -#if defined(MRG_DEBUG) printf("adb: transaction completion\n"); #endif adbaddr = (adb_command & 0xf0) >> 4; error = GetADBInfo(&adbdata, adbaddr); -#if defined(MRG_DEBUG) +#ifdef MRG_DEBUG printf("adb: GetADBInfo returned %d\n", error); #endif event.addr = adbaddr; event.hand_id = adbdata.devType; event.def_addr = adbdata.origADBAddr; -#if defined(MRG_DEBUG) + event.byte_count = buffer[0]; + memcpy(event.bytes, buffer + 1, event.byte_count); + +#ifdef MRG_DEBUG printf("adb: from %d at %d (org %d) %d:", event.addr, event.hand_id, event.def_addr, buffer[0]); for (i = 1; i <= buffer[0]; i++) @@ -83,33 +85,26 @@ adb_complete(buffer, data_area, adb_command) printf("\n"); #endif - i = event.byte_count = buffer[0]; - sbuf = &buffer[1]; - dbuf = &event.bytes[0]; - while (i--) - *dbuf++ = *sbuf++; - microtime(&event.timestamp); adb_processevent(&event); } -static int extdms_done; +static volatile int extdms_done; /* * initialize extended mouse - probes devices as * described in _Inside Macintosh, Devices_. */ void -extdms_init() +extdms_init(totaladbs) + int totaladbs; { ADBDataBlock adbdata; - int totaladbs; int adbindex, adbaddr; short cmd; char buffer[9]; - totaladbs = CountADBs(); for (adbindex = 1; adbindex <= totaladbs; adbindex++) { /* Get the ADB information */ adbaddr = GetIndADB(&adbdata, adbindex); @@ -192,12 +187,12 @@ adb_init() return; } printf("adb: bus subsystem\n"); -#if defined(MRG_DEBUG) +#ifdef MRG_DEBUG printf("adb: call mrg_initadbintr\n"); #endif mrg_initadbintr(); /* Mac ROM Glue okay to do ROM intr */ -#if defined(MRG_DEBUG) +#ifdef MRG_DEBUG printf("adb: returned from mrg_initadbintr\n"); #endif @@ -205,19 +200,18 @@ adb_init() JADBProc = adb_jadbproc; /* Initialize ADB */ -#if defined(MRG_DEBUG) +#ifdef MRG_DEBUG printf("adb: calling ADBAlternateInit.\n"); #endif ADBAlternateInit(); -#if defined(MRG_DEBUG) +#ifdef MRG_DEBUG printf("adb: done with ADBReInit\n"); #endif - extdms_init(); - totaladbs = CountADBs(); + extdms_init(totaladbs); /* for each ADB device */ for (adbindex = 1; adbindex <= totaladbs; adbindex++) { @@ -301,7 +295,7 @@ adb_init() adbinfo.siServiceRtPtr = (Ptr) adb_asmcomplete; adbinfo.siDataAreaAddr = NULL; error = SetADBInfo(&adbinfo, adbaddr); -#if defined(MRG_DEBUG) +#ifdef MRG_DEBUG printf("returned %d from SetADBInfo\n", error); #endif } diff --git a/sys/arch/mac68k/dev/adbvar.h b/sys/arch/mac68k/dev/adbvar.h index 5ae5d0bb0d7..97e38867a5b 100644 --- a/sys/arch/mac68k/dev/adbvar.h +++ b/sys/arch/mac68k/dev/adbvar.h @@ -1,5 +1,5 @@ -/* $OpenBSD: adbvar.h,v 1.3 1996/05/26 18:35:17 briggs Exp $ */ -/* $NetBSD: adbvar.h,v 1.3 1996/05/05 06:16:24 briggs Exp $ */ +/* $OpenBSD: adbvar.h,v 1.4 1997/01/24 01:35:28 briggs Exp $ */ +/* $NetBSD: adbvar.h,v 1.5 1997/01/13 07:01:24 scottr Exp $ */ /*- * Copyright (C) 1994 Bradley A. Grantham @@ -63,4 +63,4 @@ void extdms_complete __P((void)); /* adbsys.c */ void adb_complete __P((caddr_t buffer, caddr_t data_area, int adb_command)); -void extdms_init __P((void)); +void extdms_init __P((int)); diff --git a/sys/arch/mac68k/dev/asc.c b/sys/arch/mac68k/dev/asc.c index 81c3c1574d6..42c0d3f0d7a 100644 --- a/sys/arch/mac68k/dev/asc.c +++ b/sys/arch/mac68k/dev/asc.c @@ -1,5 +1,5 @@ -/* $OpenBSD: asc.c,v 1.4 1996/05/26 18:35:18 briggs Exp $ */ -/* $NetBSD: asc.c,v 1.11 1996/05/05 06:16:26 briggs Exp $ */ +/* $OpenBSD: asc.c,v 1.5 1997/01/24 01:35:29 briggs Exp $ */ +/* $NetBSD: asc.c,v 1.15 1996/12/16 16:17:02 scottr Exp $ */ /*- * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, @@ -45,6 +45,8 @@ #include #include #include + +#include #include #include "ascvar.h" @@ -54,12 +56,13 @@ volatile unsigned char *ASCBase = (unsigned char *) 0x14000; /* bell support data */ +static int asc_configured = 0; static int bell_freq = 1880; static int bell_length = 10; static int bell_volume = 100; static int bell_ringing = 0; -static int ascmatch __P((struct device *, void *, void *)); +static int ascmatch __P((struct device *, struct cfdata *, void *)); static void ascattach __P((struct device *, struct device *, void *)); struct cfattach asc_ca = { @@ -71,10 +74,13 @@ struct cfdriver asc_cd = { }; static int -ascmatch(pdp, match, auxp) - struct device *pdp; - void *match, *auxp; +ascmatch(parent, cf, aux) + struct device *parent; + struct cfdata *cf; + void *aux; { + if (badbaddr((unsigned char *) ASCBase)) + return 0; return 1; } @@ -84,6 +90,7 @@ ascattach(parent, dev, aux) void *aux; { printf(" Apple sound chip.\n"); + asc_configured = 1; } int @@ -92,6 +99,8 @@ asc_setbellparams(freq, length, volume) int length; int volume; { + if (!asc_configured) return (ENODEV); + /* I only perform these checks for sanity. */ /* I suppose someone might want a bell that rings */ /* all day, but then the can make kernel mods themselves. */ @@ -117,6 +126,8 @@ asc_getbellparams(freq, length, volume) int *length; int *volume; { + if (!asc_configured) return (ENODEV); + *freq = bell_freq; *length = bell_length; *volume = bell_volume; @@ -129,6 +140,8 @@ void asc_bellstop(param) int param; { + if (!asc_configured) return; + if (bell_ringing > 1000 || bell_ringing < 0) panic("bell got out of synch?????"); if (--bell_ringing == 0) { @@ -144,6 +157,8 @@ asc_ringbell() int i; unsigned long freq; + if (!asc_configured) return (ENODEV); + if (bell_ringing == 0) { for (i = 0; i < 0x800; i++) ASCBase[i] = 0; diff --git a/sys/arch/mac68k/dev/grf.c b/sys/arch/mac68k/dev/grf.c index cd782fe1412..162fad5c60a 100644 --- a/sys/arch/mac68k/dev/grf.c +++ b/sys/arch/mac68k/dev/grf.c @@ -1,5 +1,5 @@ -/* $OpenBSD: grf.c,v 1.4 1996/08/10 21:37:43 briggs Exp $ */ -/* $NetBSD: grf.c,v 1.35 1996/08/05 01:26:31 scottr Exp $ */ +/* $OpenBSD: grf.c,v 1.5 1997/01/24 01:35:29 briggs Exp $ */ +/* $NetBSD: grf.c,v 1.39 1996/12/16 16:17:05 scottr Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -82,7 +82,7 @@ #define iteoff(u,f) #endif -int grfmatch __P((struct device *, void *, void *)); +int grfmatch __P((struct device *, struct cfdata *, void *)); void grfattach __P((struct device *, struct device *, void *)); struct cfdriver grf_cd = { @@ -102,9 +102,10 @@ static int grfdebug = (GDB_DEVNO|GDB_MMAP|GDB_IOMAP|GDB_LOCK); #endif int -grfmatch(parent, match, aux) +grfmatch(parent, cf, aux) struct device *parent; - void *match, *aux; + struct cfdata *cf; + void *aux; { struct grfbus_attach_args *ga = aux; diff --git a/sys/arch/mac68k/dev/grf_iv.c b/sys/arch/mac68k/dev/grf_iv.c index 13e099c382d..2ce58680ab9 100644 --- a/sys/arch/mac68k/dev/grf_iv.c +++ b/sys/arch/mac68k/dev/grf_iv.c @@ -1,5 +1,5 @@ -/* $OpenBSD: grf_iv.c,v 1.6 1996/10/28 14:46:24 briggs Exp $ */ -/* $NetBSD: grf_iv.c,v 1.13 1996/08/04 06:03:52 scottr Exp $ */ +/* $OpenBSD: grf_iv.c,v 1.7 1997/01/24 01:35:30 briggs Exp $ */ +/* $NetBSD: grf_iv.c,v 1.16 1996/12/16 16:17:06 scottr Exp $ */ /* * Copyright (c) 1995 Allen Briggs. All rights reserved. @@ -61,7 +61,7 @@ extern unsigned long videosize; static int grfiv_mode __P((struct grf_softc *gp, int cmd, void *arg)); static caddr_t grfiv_phys __P((struct grf_softc *gp, vm_offset_t addr)); -static int grfiv_match __P((struct device *, void *, void *)); +static int grfiv_match __P((struct device *, struct cfdata *, void *)); static void grfiv_attach __P((struct device *, struct device *, void *)); static void grfiv_q700intr __P((void *client_data, int slot)); @@ -74,6 +74,11 @@ struct cfattach intvid_ca = { sizeof(struct grfbus_softc), grfiv_match, grfiv_attach }; +/* XXX -- kludge */ +#include +#include +#include + static void grfiv_q700intr(client_data, slot) void *client_data; @@ -86,9 +91,10 @@ grfiv_q700intr(client_data, slot) } static int -grfiv_match(pdp, match, auxp) - struct device *pdp; - void *match, *auxp; +grfiv_match(parent, cf, aux) + struct device *parent; + struct cfdata *cf; + void *aux; { char *addr = NULL; static int internal_video_found = 0; @@ -99,7 +105,7 @@ grfiv_match(pdp, match, auxp) switch (mac68k_machine.machineid) { case MACH_MACQ700: - addr = bus_mapin(BUS_NUBUS, 0xf9800000, 0x1000); + addr = nubus_mapin(0xf9800000, 0x1000); add_nubus_intr(15, grfiv_q700intr, addr); break; default: diff --git a/sys/arch/mac68k/dev/grf_mv.c b/sys/arch/mac68k/dev/grf_mv.c index 3f9e8db3602..0645c3482a2 100644 --- a/sys/arch/mac68k/dev/grf_mv.c +++ b/sys/arch/mac68k/dev/grf_mv.c @@ -1,5 +1,5 @@ -/* $OpenBSD: grf_mv.c,v 1.5 1996/09/21 03:55:47 briggs Exp $ */ -/* $NetBSD: grf_mv.c,v 1.12 1996/08/04 06:03:54 scottr Exp $ */ +/* $OpenBSD: grf_mv.c,v 1.6 1997/01/24 01:35:31 briggs Exp $ */ +/* $NetBSD: grf_mv.c,v 1.15 1996/12/16 16:17:06 scottr Exp $ */ /* * Copyright (c) 1995 Allen Briggs. All rights reserved. @@ -52,13 +52,12 @@ static void load_image_data __P((caddr_t data, struct image_data *image)); static void grfmv_intr __P((void *vsc, int slot)); -static int get_vrsrcid __P((nubus_slot *slot)); static char zero = 0; static int grfmv_mode __P((struct grf_softc *gp, int cmd, void *arg)); static caddr_t grfmv_phys __P((struct grf_softc *gp, vm_offset_t addr)); -static int grfmv_match __P((struct device *, void *, void *)); +static int grfmv_match __P((struct device *, struct cfdata *, void *)); static void grfmv_attach __P((struct device *, struct device *, void *)); struct cfdriver macvid_cd = { @@ -115,61 +114,20 @@ grfmv_intr(vsc, slot) } static int -get_vrsrcid(slot) - nubus_slot *slot; -{ -extern u_short mac68k_vrsrc_vec[]; - int i; - - for (i = 0 ; i < 6 ; i++) - if ((mac68k_vrsrc_vec[i] & 0xff) == slot->slot) - return ((mac68k_vrsrc_vec[i] >> 8) & 0xff); - return 0x80; -} - -static int -grfmv_match(parent, self, aux) +grfmv_match(parent, cf, aux) struct device *parent; - void *self, *aux; + struct cfdata *cf; + void *aux; { - struct grfbus_softc *sc; - nubus_slot *slot = (nubus_slot *) aux; - nubus_dir dir, *dirp, *dirp2; - nubus_dirent dirent, *direntp; - nubus_type slottype; - int vrsrc; - - sc = (struct grfbus_softc *) self; /* XXX: indirect brokenness */ - dirp = &dir; - direntp = &dirent; - nubus_get_main_dir(slot, dirp); - - vrsrc = get_vrsrcid(slot); - if (nubus_find_rsrc(slot, dirp, vrsrc, direntp) <= 0) { - if ( (vrsrc != 128) - || (nubus_find_rsrc(slot, dirp, 129, direntp) <= 0)) { - return 0; - } - } - - dirp2 = (nubus_dir *) &sc->board_dir; - nubus_get_dir_from_rsrc(slot, direntp, dirp2); - - if (nubus_find_rsrc(slot, dirp2, NUBUS_RSRC_TYPE, direntp) <= 0) - /* Type is a required entry... This should never happen. */ - return 0; - - if (nubus_get_ind_data(slot, direntp, - (caddr_t) &slottype, sizeof(nubus_type)) <= 0) - return 0; + struct nubus_attach_args *na = (struct nubus_attach_args *) aux; - if (slottype.category != NUBUS_CATEGORY_DISPLAY) + if (na->category != NUBUS_CATEGORY_DISPLAY) return 0; - if (slottype.type != NUBUS_TYPE_VIDEO) + if (na->type != NUBUS_TYPE_VIDEO) return 0; - if (slottype.drsw != NUBUS_DRSW_APPLE) + if (na->drsw != NUBUS_DRSW_APPLE) return 0; /* @@ -179,12 +137,6 @@ grfmv_match(parent, self, aux) * proceed like it is. */ - sc->card_id = slottype.drhw; - - sc->sc_slot = *slot; - - /* Need to load display info (and driver?), etc... */ - return 1; } @@ -193,16 +145,31 @@ grfmv_attach(parent, self, aux) struct device *parent, *self; void *aux; { - struct grfbus_softc *sc; + struct grfbus_softc *sc = (struct grfbus_softc *) self; + struct nubus_attach_args *na = (struct nubus_attach_args *) aux; struct image_data image_store, image; - struct grfmode *gm; - char cardname[CARD_NAME_LEN]; - nubus_dirent dirent; - nubus_dir mode_dir; - int mode; + struct grfmode *gm; + char cardname[CARD_NAME_LEN]; + nubus_dirent dirent; + nubus_dir dir, mode_dir; + int mode; - sc = (struct grfbus_softc *) self; - gm = &sc->curr_mode; + sc->card_id = na->drhw; + + bcopy(na->fmt, &sc->sc_slot, sizeof(nubus_slot)); + + nubus_get_main_dir(&sc->sc_slot, &dir); + + if (nubus_find_rsrc(&sc->sc_slot, &dir, na->rsrcid, &dirent) <= 0) + return; + + nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &sc->board_dir); + + if (nubus_find_rsrc(&sc->sc_slot, &sc->board_dir, + NUBUS_RSRC_TYPE, &dirent) <= 0) + if ((na->rsrcid != 128) || + (nubus_find_rsrc(&sc->sc_slot, &dir, 129, &dirent) <= 0)) + return; mode = NUBUS_RSRC_FIRSTMODE; if (nubus_find_rsrc(&sc->sc_slot, &sc->board_dir, mode, &dirent) <= 0) { @@ -227,8 +194,11 @@ grfmv_attach(parent, self, aux) return; } + /* Need to load display info (and driver?), etc... (?) */ + load_image_data((caddr_t) &image_store, &image); + gm = &sc->curr_mode; gm->mode_id = mode; gm->fbbase = (caddr_t) (sc->sc_slot.virtual_base + image.offset); gm->fboff = image.offset; diff --git a/sys/arch/mac68k/dev/if_ae.c b/sys/arch/mac68k/dev/if_ae.c index 0e0ff8245d4..4047cd2e179 100644 --- a/sys/arch/mac68k/dev/if_ae.c +++ b/sys/arch/mac68k/dev/if_ae.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_ae.c,v 1.8 1996/05/26 18:35:23 briggs Exp $ */ -/* $NetBSD: if_ae.c,v 1.46 1996/05/15 03:20:22 briggs Exp $ */ +/* $OpenBSD: if_ae.c,v 1.9 1997/01/24 01:35:31 briggs Exp $ */ +/* $NetBSD: if_ae.c,v 1.50 1996/12/18 02:54:43 scottr Exp $ */ /* * Device driver for National Semiconductor DS8390/WD83C690 based ethernet @@ -15,11 +15,6 @@ * * Adapted for MacBSD by Brad Parker . * - * Currently supports: - * Apples NB Ethernet card - * Interlan A310 Nubus Ethernet card - * Cayman Systems GatorCard - * Asante MacCon II/E */ #include "bpfilter.h" @@ -99,10 +94,10 @@ struct ae_softc { u_char next_packet; /* pointer to next unread RX packet */ }; -static int ae_id_card __P((nubus_slot *slot, struct ae_softc *sc)); -static int ae_size_card_memory __P((struct ae_softc *sc)); +static int ae_card_vendor __P((struct nubus_attach_args *na)); +static int ae_size_card_memory __P((caddr_t addr)); -int aeprobe __P((struct device *, void *, void *)); +int aematch __P((struct device *, struct cfdata *, void *)); void aeattach __P((struct device *, struct device *, void *)); void aeintr __P((void *, int)); int aeioctl __P((struct ifnet *, u_long, caddr_t)); @@ -126,7 +121,7 @@ static inline caddr_t ae_ring_copy __P(( struct ae_softc *, caddr_t, caddr_t, int)); struct cfattach ae_ca = { - sizeof(struct ae_softc), aeprobe, aeattach + sizeof(struct ae_softc), aematch, aeattach }; struct cfdriver ae_cd = { @@ -184,81 +179,54 @@ byte_copy(a, b, len) } static int -ae_id_card(slot, sc) - nubus_slot *slot; - struct ae_softc *sc; +ae_card_vendor(na) + struct nubus_attach_args *na; { - nubus_dir dir; - nubus_dirent dirent; - nubus_type slottype; - - nubus_get_main_dir(slot, &dir); - - if (nubus_find_rsrc(slot, &dir, 0x80, &dirent) <= 0) - return 0; - - nubus_get_dir_from_rsrc(slot, &dirent, &dir); - - if (nubus_find_rsrc(slot, &dir, NUBUS_RSRC_TYPE, &dirent) <= 0) - return 0; - - if (nubus_get_ind_data(slot, &dirent, - (caddr_t) &slottype, sizeof(nubus_type)) <= 0) - return 0; + int vendor; - if (slottype.category != NUBUS_CATEGORY_NETWORK) - return 0; - - if (slottype.type != NUBUS_TYPE_ETHERNET) - return 0; - - switch (slottype.drsw) { + switch (na->drsw) { case NUBUS_DRSW_3COM: case NUBUS_DRSW_APPLE: case NUBUS_DRSW_TECHWORKS: - sc->vendor = AE_VENDOR_APPLE; + vendor = AE_VENDOR_APPLE; break; case NUBUS_DRSW_ASANTE: - sc->vendor = AE_VENDOR_ASANTE; + vendor = AE_VENDOR_ASANTE; break; case NUBUS_DRSW_FARALLON: - sc->vendor = AE_VENDOR_FARALLON; + vendor = AE_VENDOR_FARALLON; break; case NUBUS_DRSW_FOCUS: - sc->vendor = AE_VENDOR_FOCUS; + vendor = AE_VENDOR_FOCUS; break; case NUBUS_DRSW_GATOR: - switch (slottype.drhw) { + switch (na->drhw) { default: case NUBUS_DRHW_INTERLAN: - sc->vendor = AE_VENDOR_INTERLAN; + vendor = AE_VENDOR_INTERLAN; break; case NUBUS_DRHW_KINETICS: - sc->vendor = AE_VENDOR_DAYNA; + vendor = AE_VENDOR_DAYNA; break; } break; default: - printf("Unknown ethernet drsw: %x\n", slottype.drsw); - sc->vendor = AE_VENDOR_UNKNOWN; - return 0; +#ifdef AE_DEBUG + printf("Unknown ethernet drsw: %x\n", na->drsw); +#endif + vendor = AE_VENDOR_UNKNOWN; } - - strncpy(sc->type_str, nubus_get_card_name(slot), INTERFACE_NAME_LEN); - - sc->type_str[INTERFACE_NAME_LEN-1] = '\0'; - - return 1; + return vendor; } static int -ae_size_card_memory(sc) - struct ae_softc *sc; +ae_size_card_memory(addr) + caddr_t addr; { u_short *p; u_short i1, i2, i3, i4; - p = (u_short *) sc->mem_start; + p = (u_short *) addr; /* * very simple size memory, assuming it's installed in 8k @@ -290,31 +258,66 @@ ae_size_card_memory(sc) } int -aeprobe(parent, match, aux) +aematch(parent, cf, aux) struct device *parent; - void *match, *aux; + struct cfdata *cf; + void *aux; { - struct ae_softc *sc = match; - nubus_slot *nu = (nubus_slot *) aux; - caddr_t addr; - int i, memsize; - int flags = 0; + struct nubus_attach_args *na = (struct nubus_attach_args *) aux; + + if (na->category != NUBUS_CATEGORY_NETWORK) + return 0; + + if (na->type != NUBUS_TYPE_ETHERNET) + return 0; + + switch (ae_card_vendor(na)) { + case AE_VENDOR_APPLE: + case AE_VENDOR_ASANTE: + case AE_VENDOR_FARALLON: + case AE_VENDOR_INTERLAN: + break; - if (ae_id_card(nu, sc) <= 0) + case AE_VENDOR_DAYNA: + case AE_VENDOR_FOCUS: + default: return 0; + } + return 1; +} + +/* + * Install interface into kernel networking data structures + */ +void +aeattach(parent, self, aux) + struct device *parent, *self; + void *aux; +{ + struct ae_softc *sc = (struct ae_softc *) self; + struct nubus_attach_args *na = (struct nubus_attach_args *) aux; + struct ifnet *ifp = &sc->sc_arpcom.ac_if; + caddr_t addr; + int i, memsize; + int flags = 0; sc->regs_rev = 0; + sc->vendor = ae_card_vendor(na); + strncpy(sc->type_str, nubus_get_card_name(na->fmt), + INTERFACE_NAME_LEN); + sc->type_str[INTERFACE_NAME_LEN-1] = '\0'; - addr = (caddr_t) nu->virtual_base; + addr = (caddr_t) na->fmt->virtual_base; + memsize = 0; switch (sc->vendor) { case AE_VENDOR_INTERLAN: sc->nic_addr = addr + GC_NIC_OFFSET; sc->rom_addr = addr + GC_ROM_OFFSET; sc->mem_start = addr + GC_DATA_OFFSET; - if ((memsize = ae_size_card_memory(sc)) == 0) { - printf("Failed to determine size of RAM.\n"); - return 0; + if ((memsize = ae_size_card_memory(sc->mem_start)) == 0) { + printf(": failed to determine size of RAM.\n"); + return; } /* reset the NIC chip */ @@ -332,9 +335,9 @@ aeprobe(parent, match, aux) sc->nic_addr = addr + AE_NIC_OFFSET; sc->rom_addr = addr + AE_ROM_OFFSET; sc->mem_start = addr + AE_DATA_OFFSET; - if ((memsize = ae_size_card_memory(sc)) == 0) { - printf("Failed to determine size of RAM.\n"); - return (0); + if ((memsize = ae_size_card_memory(sc->mem_start)) == 0) { + printf(": failed to determine size of RAM.\n"); + return; } /* Get station address from on-board ROM */ @@ -343,17 +346,18 @@ aeprobe(parent, match, aux) break; case AE_VENDOR_DAYNA: - printf("We think we are a Dayna card, but "); sc->nic_addr = addr + DP_NIC_OFFSET; sc->rom_addr = addr + DP_ROM_OFFSET; sc->mem_start = addr + DP_DATA_OFFSET; - memsize = 8192; + if ((memsize = ae_size_card_memory(sc->mem_start)) == 0) { + printf(": failed to determine size of RAM.\n"); + return; + } /* Get station address from on-board ROM */ for (i = 0; i < ETHER_ADDR_LEN; ++i) - sc->sc_arpcom.ac_enaddr[i] = *(sc->rom_addr + i * 2); - printf("it is dangerous to continue.\n"); - return (0); /* Since we don't work yet... */ + sc->sc_arpcom.ac_enaddr[i] = *(sc->rom_addr + i * 4); + break; case AE_VENDOR_FARALLON: @@ -361,20 +365,20 @@ aeprobe(parent, match, aux) sc->rom_addr = addr + FE_ROM_OFFSET; sc->nic_addr = addr + AE_NIC_OFFSET; sc->mem_start = addr + AE_DATA_OFFSET; - if ((memsize = ae_size_card_memory(sc)) == 0) { - printf("Failed to determine size of RAM.\n"); - return (0); + if ((memsize = ae_size_card_memory(sc->mem_start)) == 0) { + printf(": failed to determine size of RAM.\n"); + return; } /* Get station address from on-board ROM */ for (i = 0; i < ETHER_ADDR_LEN; ++i) sc->sc_arpcom.ac_enaddr[i] = *(sc->rom_addr + i); break; - case AE_VENDOR_FOCUS: - printf("Focus EtherLAN card detected, but not supported.\n"); + printf(": unsupported Focus hardware\n"); + return; default: - return (0); + return; break; } @@ -397,28 +401,13 @@ aeprobe(parent, match, aux) bszero((u_short *) sc->mem_start, memsize / 2); for (i = 0; i < memsize; ++i) - if (sc->mem_start[i]) { + if (sc->mem_start[i]) printf("%s: failed to clear shared memory at %p - check configuration\n", sc->sc_dev.dv_xname, sc->mem_start + i); - return (0); - } - bcopy(nu, &sc->sc_slot, sizeof(nubus_slot)); - - return (1); -} + bcopy(na->fmt, &sc->sc_slot, sizeof(nubus_slot)); -/* - * Install interface into kernel networking data structures - */ -void -aeattach(parent, self, aux) - struct device *parent, *self; - void *aux; -{ - struct ae_softc *sc = (void *) self; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; /* Set interface to stopped condition (reset). */ aestop(sc); @@ -439,7 +428,7 @@ aeattach(parent, self, aux) /* Print additional info when attached. */ printf(": address %s, ", ether_sprintf(sc->sc_arpcom.ac_enaddr)); - printf("type %s, %ldk mem.\n", sc->type_str, sc->mem_size / 1024); + printf("type %s, %ldKB memory\n", sc->type_str, sc->mem_size / 1024); #if NBPFILTER > 0 bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); diff --git a/sys/arch/mac68k/dev/if_aereg.h b/sys/arch/mac68k/dev/if_aereg.h index 91e7ed1fdeb..b549041e4ca 100644 --- a/sys/arch/mac68k/dev/if_aereg.h +++ b/sys/arch/mac68k/dev/if_aereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_aereg.h,v 1.3 1996/05/26 18:35:24 briggs Exp $ */ +/* $OpenBSD: if_aereg.h,v 1.4 1997/01/24 01:35:32 briggs Exp $ */ /* $NetBSD: if_aereg.h,v 1.12 1996/01/12 04:53:05 briggs Exp $ */ /* @@ -53,9 +53,9 @@ struct ae_ring { #define GC_DATA_OFFSET 0x000d0000 /* Offset to NIC memory */ #define GC_NIC_OFFSET 0x000e0000 /* Offset to NIC registers */ -#define DP_ROM_OFFSET 0x000f0000 -#define DP_DATA_OFFSET 0x000d0000 /* Offset to SONIC memory */ -#define DP_NIC_OFFSET 0x000e0000 /* Offset to SONIC registers */ +#define DP_ROM_OFFSET 0x000f0007 /* Offset to MAC address */ +#define DP_DATA_OFFSET 0x00000000 /* Offset to NIC memory */ +#define DP_NIC_OFFSET 0x00080000 /* Offset to NIC registers */ #define AE_ROM_OFFSET 0x000f0000 #define AE_DATA_OFFSET 0x000d0000 /* Offset to NIC memory */ diff --git a/sys/arch/mac68k/dev/ite.c b/sys/arch/mac68k/dev/ite.c index a1c5bf343c5..c28c588e50c 100644 --- a/sys/arch/mac68k/dev/ite.c +++ b/sys/arch/mac68k/dev/ite.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ite.c,v 1.8 1997/01/19 03:18:02 briggs Exp $ */ -/* $NetBSD: ite.c,v 1.27 1996/11/10 09:35:04 scottr Exp $ */ +/* $OpenBSD: ite.c,v 1.9 1997/01/24 01:35:33 briggs Exp $ */ +/* $NetBSD: ite.c,v 1.30 1996/12/18 03:06:06 scottr Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -112,7 +112,7 @@ static void putc_getpars __P((char)); static void putc_square __P((char)); static void ite_putchar __P((char)); static int ite_pollforchar __P((void)); -static int itematch __P((struct device *, void *, void *)); +static int itematch __P((struct device *, struct cfdata *, void *)); static void iteattach __P((struct device *, struct device *, void *)); #define dprintf if (0) printf @@ -162,7 +162,7 @@ static int scrreg_bottom; static int polledkey; extern int adb_polling; -extern u_long conspa; +extern u_int32_t mac68k_vidphys; struct tty *ite_tty; /* Our tty */ @@ -437,6 +437,7 @@ clear_screen(which) len = y; break; case 2: /* Whole screen */ + default: len = scrrows; break; } @@ -849,9 +850,10 @@ struct cfdriver ite_cd = { }; static int -itematch(parent, match, aux) +itematch(parent, cf, aux) struct device *parent; - void *match, *aux; + struct cfdata *cf; + void *aux; { struct grfbus_attach_args *ga = aux; struct grfmode *gm = ga->ga_grfmode; @@ -861,7 +863,7 @@ itematch(parent, match, aux) return 0; pa = pmap_extract(pmap_kernel(), (vm_offset_t) gm->fbbase); - return (pa == (vm_offset_t) conspa); + return (pa == (vm_offset_t) mac68k_vidphys); } static void diff --git a/sys/arch/mac68k/dev/mac68k5380.c b/sys/arch/mac68k/dev/mac68k5380.c index 836e7b0be30..f01b8c90fd9 100644 --- a/sys/arch/mac68k/dev/mac68k5380.c +++ b/sys/arch/mac68k/dev/mac68k5380.c @@ -1,5 +1,5 @@ -/* $OpenBSD: mac68k5380.c,v 1.7 1996/10/28 14:46:23 briggs Exp $ */ -/* $NetBSD: mac68k5380.c,v 1.25 1996/06/07 01:45:43 briggs Exp $ */ +/* $OpenBSD: mac68k5380.c,v 1.8 1997/01/24 01:35:33 briggs Exp $ */ +/* $NetBSD: mac68k5380.c,v 1.28 1996/12/19 21:48:17 scottr Exp $ */ /* * Copyright (c) 1995 Allen Briggs @@ -135,8 +135,9 @@ static void do_ncr5380_drq_intr __P((void *)); static __inline__ void scsi_clr_ipend __P((void)); static void scsi_mach_init __P((struct ncr_softc *sc)); -static int machine_match __P((struct device *pdp, void *match, - void *auxp, struct cfdriver *cd)); +static int machine_match __P((struct device *parent, + struct cfdata *cf, void *aux, + struct cfdriver *cd)); static __inline__ int pdma_ready __P((void)); static int transfer_pdma __P((u_char *phasep, u_char *data, u_long *count)); @@ -179,10 +180,11 @@ scsi_mach_init(sc) } static int -machine_match(pdp, match, auxp, cd) - struct device *pdp; - void *match, *auxp; - struct cfdriver *cd; +machine_match(parent, cf, aux, cd) + struct device *parent; + struct cfdata *cf; + void *aux; + struct cfdriver *cd; { if (!mac68k_machine.scsi80) return 0; diff --git a/sys/arch/mac68k/dev/ncr5380.c b/sys/arch/mac68k/dev/ncr5380.c index 25a854a6578..102a8dceb83 100644 --- a/sys/arch/mac68k/dev/ncr5380.c +++ b/sys/arch/mac68k/dev/ncr5380.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ncr5380.c,v 1.11 1997/01/18 17:58:38 briggs Exp $ */ -/* $NetBSD: ncr5380.c,v 1.31 1996/06/23 15:02:58 briggs Exp $ */ +/* $OpenBSD: ncr5380.c,v 1.12 1997/01/24 01:35:34 briggs Exp $ */ +/* $NetBSD: ncr5380.c,v 1.38 1996/12/19 21:48:18 scottr Exp $ */ /* * Copyright (c) 1995 Leo Weppelman. @@ -198,7 +198,7 @@ extern __inline__ void finish_req(SC_REQ *reqp) * Auto config stuff.... */ void ncr_attach __P((struct device *, struct device *, void *)); -int ncr_match __P((struct device *, void *, void *)); +int ncr_match __P((struct device *, struct cfdata *, void *)); /* * Tricks to make driver-name configurable @@ -216,11 +216,12 @@ struct cfdriver CFNAME(DRNAME) = { }; int -ncr_match(pdp, match, auxp) -struct device *pdp; -void *match, *auxp; +ncr_match(parent, cf, aux) + struct device *parent; + struct cfdata *cf; + void *aux; { - return (machine_match(pdp, match, auxp, &CFNAME(DRNAME))); + return (machine_match(parent, cf, aux, &CFNAME(DRNAME))); } void @@ -238,6 +239,7 @@ void *auxp; sc->sc_link.adapter = &ncr5380_switch; sc->sc_link.device = &ncr5380_dev; sc->sc_link.openings = NREQ - 1; + sc->sc_link.max_target = 7; /* * bitmasks diff --git a/sys/arch/mac68k/dev/nubus.c b/sys/arch/mac68k/dev/nubus.c index 70f28253fbb..84e88fd0df8 100644 --- a/sys/arch/mac68k/dev/nubus.c +++ b/sys/arch/mac68k/dev/nubus.c @@ -1,8 +1,8 @@ -/* $OpenBSD: nubus.c,v 1.6 1996/11/23 21:45:54 kstailey Exp $ */ -/* $NetBSD: nubus.c,v 1.23 1996/05/08 15:14:53 scottr Exp $ */ +/* $OpenBSD: nubus.c,v 1.7 1997/01/24 01:35:35 briggs Exp $ */ +/* $NetBSD: nubus.c,v 1.29 1996/12/17 06:47:39 scottr Exp $ */ /* - * Copyright (c) 1995 Allen Briggs. All rights reserved. + * Copyright (c) 1995, 1996 Allen Briggs. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,11 +33,19 @@ #include #include #include +#include +#include +#include + +#include +#include +#include #include +#include +#include #include - -#include +#include #include "nubus.h" @@ -48,9 +56,10 @@ static int nubus_debug = 0x01; #define NDB_ARITH 0x4 #endif -static int nubusprint __P((void *, const char *)); -static int nubusmatch __P((struct device *, void *, void *)); -static void nubusattach __P((struct device *, struct device *, void *)); +static int nubus_print __P((void *, const char *)); +static int nubus_match __P((struct device *, struct cfdata *, void *)); +static void nubus_attach __P((struct device *, struct device *, void *)); +int nubus_video_resource __P((int)); static int probe_slot __P((int slot, nubus_slot *fmt)); static u_long IncPtr __P((nubus_slot *fmt, u_long base, long amt)); @@ -61,63 +70,111 @@ static u_char GetByte __P((nubus_slot *fmt, u_long ptr)); #endif static u_long GetLong __P((nubus_slot *fmt, u_long ptr)); +static int nubus_peek __P((vm_offset_t, int)); + struct cfattach nubus_ca = { - sizeof(struct nubus_softc), nubusmatch, nubusattach + sizeof(struct nubus_softc), nubus_match, nubus_attach }; struct cfdriver nubus_cd = { - NULL, "nubus", DV_DULL, 1 + NULL, "nubus", DV_DULL, }; static int -nubusmatch(parent, vcf, aux) +nubus_match(parent, cf, aux) struct device *parent; - void *vcf, *aux; + struct cfdata *cf; + void *aux; { - struct confargs *ca = aux; + static int nubus_matched = 0; - if (ca->ca_bustype != BUS_NUBUS) + /* Allow only one instance. */ + if (nubus_matched) return (0); - return(1); + + nubus_matched = 1; + return (1); } static void -nubusattach(parent, self, aux) - struct device *parent, *self; - void *aux; +nubus_attach(parent, self, aux) + struct device *parent, *self; + void *aux; { - nubus_slot fmtblock; - int i; + struct nubus_attach_args na_args; + nubus_slot fmtblock; + nubus_dir dir; + nubus_dirent dirent; + nubus_type slottype; + int i, rsrcid; + + printf("\n"); + + for (i = NUBUS_MIN_SLOT; i <= NUBUS_MAX_SLOT; i++) { + if (probe_slot(i, &fmtblock) <= 0) + continue; - printf("\n"); + if ((rsrcid = nubus_video_resource(i)) == (-1)) + rsrcid = 0x80; - for (i = NUBUS_MIN_SLOT; i <= NUBUS_MAX_SLOT; i++) { - if (probe_slot(i, &fmtblock)) { - /*config_search(bus_scan, &fmtblock, nubusprint);*/ - config_found(self, &fmtblock, nubusprint); - } - } + nubus_get_main_dir(&fmtblock, &dir); + + if (nubus_find_rsrc(&fmtblock, &dir, rsrcid, &dirent) <= 0) + continue; + + nubus_get_dir_from_rsrc(&fmtblock, &dirent, &dir); + + if (nubus_find_rsrc(&fmtblock, &dir, NUBUS_RSRC_TYPE, + &dirent) <= 0) + continue; + + if (nubus_get_ind_data(&fmtblock, &dirent, + (caddr_t) &slottype, sizeof(nubus_type)) <= 0) + continue; + + na_args.slot = i; + na_args.rsrcid = rsrcid; + na_args.category = slottype.category; + na_args.type = slottype.type; + na_args.drsw = slottype.drsw; + na_args.drhw = slottype.drhw; + na_args.fmt = &fmtblock; + + config_found(self, &na_args, nubus_print); + } } static int -nubusprint(aux, name) - void *aux; +nubus_print(aux, name) + void *aux; const char *name; { - nubus_slot *fmt; + struct nubus_attach_args *na = (struct nubus_attach_args *) aux; - fmt = (nubus_slot *) aux; if (name) { - printf("%s: slot %x: %s ", name, fmt->slot, - nubus_get_card_name(fmt)); + printf("%s: slot %x: %s ", name, na->fmt->slot, + nubus_get_card_name(na->fmt)); printf("(Vendor: %s, ", - nubus_get_vendor(fmt, NUBUS_RSRC_VEND_ID)); - printf("Part: %s) ", - nubus_get_vendor(fmt, NUBUS_RSRC_VEND_PART)); + nubus_get_vendor(na->fmt, NUBUS_RSRC_VEND_ID)); + printf("Part: %s)", + nubus_get_vendor(na->fmt, NUBUS_RSRC_VEND_PART)); } return (UNCONF); } +int +nubus_video_resource(slot) + int slot; +{ + extern u_int16_t mac68k_vrsrc_vec[]; + int i; + + for (i = 0 ; i < 6 ; i++) + if ((mac68k_vrsrc_vec[i] & 0xff) == slot) + return ((mac68k_vrsrc_vec[i] >> 8) & 0xff); + return (-1); +} + /* * Probe a given nubus slot. If a card is there and we can get the * format block from it's clutching decl. ROMs, fill the format block @@ -176,7 +233,7 @@ probe_slot(slot, fmt) rom_probe--; - data = bus_peek(BUS_NUBUS, (vm_offset_t) rom_probe, 1); + data = nubus_peek((vm_offset_t) rom_probe, 1); if (data == -1) continue; @@ -213,7 +270,7 @@ probe_slot(slot, fmt) * to work. */ hdr = (vm_offset_t) - bus_mapin(BUS_NUBUS,NUBUS_SLOT_TO_PADDR(fmt->slot),NBMEMSIZE); + nubus_mapin(NUBUS_SLOT_TO_PADDR(fmt->slot), NBMEMSIZE); if (hdr == NULL) { printf("Failed to map %d bytes for NuBUS slot %d probe. ", NBMEMSIZE, fmt->slot); @@ -598,3 +655,99 @@ static char name_ret[64]; return name_ret; } + +/* + * bus_*() functions adapted from sun3 generic "bus" support + * by Allen Briggs. + */ + +vm_offset_t tmp_vpages[1]; + +/* + * Read addr with size len (1,2,4) into val. + * If this generates a bus error, return -1 + * + * Create a temporary mapping, + * Try the access using peek_* + * Clean up temp. mapping + */ +static int +nubus_peek(paddr, sz) + vm_offset_t paddr; + int sz; +{ + int off, pte, rv; + vm_offset_t pgva; + caddr_t va; + + off = paddr & PGOFSET; + paddr -= off; + pte = (paddr & PG_FRAME) | (PG_V | PG_W | PG_CI); + + pgva = tmp_vpages[0]; + va = (caddr_t)pgva + off; + + mac68k_set_pte(pgva, pte); + TBIS(pgva); + + /* + * OK, try the access using one of the assembly routines + * that will set pcb_onfault and catch any bus errors. + */ + rv = -1; + switch (sz) { + case 1: + if (!badbaddr(va)) + rv = *((u_char *) va); + break; + case 2: + if (!badwaddr(va)) + rv = *((u_int16_t *) va); + break; + case 4: + if (!badladdr(va)) + rv = *((u_int32_t *) va); + break; + default: + printf("bus_peek: invalid size=%d\n", sz); + rv = -1; + } + + mac68k_set_pte(pgva, PG_NV); + TBIS(pgva); + + return rv; +} + +char * +nubus_mapin(paddr, sz) + int paddr, sz; +{ + int off, pa, pmt=0; + vm_offset_t va, retval; + + off = paddr & PGOFSET; + pa = paddr - off; + sz += off; + sz = mac68k_round_page(sz); + + /* Get some kernel virtual address space. */ + va = kmem_alloc_wait(kernel_map, sz); + if (va == 0) + panic("bus_mapin"); + retval = va + off; + + /* Map it to the specified bus. */ +#if 0 /* XXX */ + /* This has a problem with wrap-around... */ + pmap_map((int)va, pa | pmt, pa + sz, VM_PROT_ALL); +#else + do { + pmap_enter(pmap_kernel(), va, pa | pmt, VM_PROT_ALL, FALSE); + va += NBPG; + pa += NBPG; + } while ((sz -= NBPG) > 0); +#endif + + return ((char*)retval); +} diff --git a/sys/arch/mac68k/dev/nubus.h b/sys/arch/mac68k/dev/nubus.h index 8547bba126b..1e61e6f9ae9 100644 --- a/sys/arch/mac68k/dev/nubus.h +++ b/sys/arch/mac68k/dev/nubus.h @@ -1,5 +1,5 @@ -/* $OpenBSD: nubus.h,v 1.5 1996/09/21 03:39:56 briggs Exp $ */ -/* $NetBSD: nubus.h,v 1.14 1996/05/07 03:13:40 briggs Exp $ */ +/* $OpenBSD: nubus.h,v 1.6 1997/01/24 01:35:36 briggs Exp $ */ +/* $NetBSD: nubus.h,v 1.15 1996/12/17 03:56:11 scottr Exp $ */ /* * Copyright (c) 1995 Allen Briggs. All rights reserved. @@ -228,6 +228,16 @@ typedef struct _NUBUS_EXEC_BLOCK { #define NUBUS_SLOT_TO_PADDR(x) ( 0xF9000000 + \ ((((x)-NUBUS_MIN_SLOT) & 0xF) << 24)) +struct nubus_attach_args { + int slot; + int rsrcid; + u_int16_t category; + u_int16_t type; + u_int16_t drsw; + u_int16_t drhw; + nubus_slot *fmt; +}; + struct nubus_softc { struct device sc_dev; }; @@ -243,4 +253,6 @@ int nubus_get_c_string __P((nubus_slot *slot, nubus_dirent *dirent, caddr_t data_return, int max_bytes)); char *nubus_get_vendor __P((nubus_slot *slot, int rsrc)); char *nubus_get_card_name __P((nubus_slot *slot)); +char *nubus_mapin __P((int paddr, int sz)); + int paddr, sz; diff --git a/sys/arch/mac68k/dev/obio.c b/sys/arch/mac68k/dev/obio.c index 5603bae9537..e4def800b1c 100644 --- a/sys/arch/mac68k/dev/obio.c +++ b/sys/arch/mac68k/dev/obio.c @@ -1,11 +1,13 @@ -/* $OpenBSD: obio.c,v 1.1 1996/05/26 19:02:08 briggs Exp $ */ -/* $NetBSD: obio.c,v 1.1 1996/05/05 06:17:07 briggs Exp $ */ +/* $OpenBSD: obio.c,v 1.2 1997/01/24 01:35:36 briggs Exp $ */ +/* $NetBSD: obio.c,v 1.5 1996/12/17 06:47:37 scottr Exp $ */ /* - * Copyright (c) 1994 Gordon W. Ross - * Copyright (c) 1993 Adam Glass + * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * + * This code is derived from software contributed to the NetBSD Foundation + * by Jason R. Thorpe. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,31 +18,35 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Adam Glass and Gordon Ross. - * 4. The name of the authors may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include #include #include -#include -#include +#include -static int obio_match __P((struct device *, void *, void *)); -static void obio_attach __P((struct device *, struct device *, void *)); +static int obio_match __P((struct device *, struct cfdata *, void *)); +static void obio_attach __P((struct device *, struct device *, void *)); +static int obio_print __P((void *, const char *)); +static int obio_search __P((struct device *, struct cfdata *, void *)); struct cfattach obio_ca = { sizeof(struct device), obio_match, obio_attach @@ -51,15 +57,19 @@ struct cfdriver obio_cd = { }; static int -obio_match(parent, vcf, aux) +obio_match(parent, cf, aux) struct device *parent; - void *vcf, *aux; + struct cfdata *cf; + void *aux; { - struct confargs *ca = aux; + static int obio_matched = 0; - if (ca->ca_bustype != BUS_OBIO) + /* Allow only one instance. */ + if (obio_matched) return (0); - return(1); + + obio_matched = 1; + return (1); } static void @@ -70,5 +80,33 @@ obio_attach(parent, self, aux) { printf("\n"); - (void) config_search(bus_scan, self, aux); + /* Search for and attach children. */ + (void) config_search(obio_search, self, aux); +} + +int +obio_print(args, name) + void *args; + const char *name; +{ + struct obio_attach_args *oa = (struct obio_attach_args *) args; + + if (oa->oa_addr) + printf(" addr %p", oa->oa_addr); + + return (UNCONF); +} + +int +obio_search(parent, cf, aux) + struct device *parent; + struct cfdata *cf; + void *aux; +{ + struct obio_attach_args oa; + + bzero(&oa, sizeof(oa)); + if ((*cf->cf_attach->ca_match)(parent, cf, &oa) > 0) + config_attach(parent, cf, &oa, obio_print); + return (0); } diff --git a/sys/arch/mac68k/dev/obiovar.h b/sys/arch/mac68k/dev/obiovar.h new file mode 100644 index 00000000000..243e33c512e --- /dev/null +++ b/sys/arch/mac68k/dev/obiovar.h @@ -0,0 +1,50 @@ +/* $OpenBSD: obiovar.h,v 1.1 1997/01/24 01:35:37 briggs Exp $ */ +/* $NetBSD: obiovar.h,v 1.1 1996/12/17 06:47:38 scottr Exp $ */ + +/* + * Copyright (c) 1996 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Autoconfiguration definitions and prototypes for the mac68k + * on-board i/o space. + */ + +/* + * Arguments used to attach a device to the internal i/o space. + */ +struct obio_attach_args { + caddr_t oa_addr; /* physical address */ +}; diff --git a/sys/arch/mac68k/dev/sbc.c b/sys/arch/mac68k/dev/sbc.c index b9110fe22bb..219a295b1f9 100644 --- a/sys/arch/mac68k/dev/sbc.c +++ b/sys/arch/mac68k/dev/sbc.c @@ -1,5 +1,5 @@ -/* $OpenBSD: sbc.c,v 1.6 1997/01/18 17:58:37 briggs Exp $ */ -/* $NetBSD: sbc.c,v 1.9 1996/06/19 01:47:28 scottr Exp $ */ +/* $OpenBSD: sbc.c,v 1.7 1997/01/24 01:35:37 briggs Exp $ */ +/* $NetBSD: sbc.c,v 1.18 1997/01/20 04:27:49 scottr Exp $ */ /* * Copyright (c) 1996 Scott Reynolds @@ -89,14 +89,18 @@ * These are offsets from SCSIBase (see pmap_bootstrap.c) */ #define SBC_REG_OFS 0x10000 -#define SBC_HSK_OFS 0x06000 #define SBC_DMA_OFS 0x12000 +#define SBC_HSK_OFS 0x06000 #define SBC_DMA_OFS_PB500 0x06000 #define SBC_REG_OFS_IIFX 0x08000 /* Just guessing... */ -#define SBC_HSK_OFS_IIFX 0x0e000 #define SBC_DMA_OFS_IIFX 0x0c000 +#define SBC_HSK_OFS_IIFX 0x0e000 + +#define SBC_REG_OFS_DUO2 0x00000 +#define SBC_DMA_OFS_DUO2 0x02000 +#define SBC_HSK_OFS_DUO2 0x04000 #ifdef SBC_DEBUG # define SBC_DB_INTR 0x01 @@ -162,7 +166,7 @@ struct sbc_softc { #define SBC_OPTIONS_BITS "\10\3RESELECT\2INTR\1PDMA" int sbc_options = SBC_PDMA; -static int sbc_match __P((struct device *, void *, void *)); +static int sbc_match __P((struct device *, struct cfdata *, void *)); static void sbc_attach __P((struct device *, struct device *, void *)); static int sbc_print __P((void *, const char *)); static void sbc_minphys __P((struct buf *bp)); @@ -214,13 +218,28 @@ struct cfdriver sbc_cd = { static int -sbc_match(parent, match, args) +sbc_match(parent, cf, args) struct device *parent; - void *match, *args; + struct cfdata *cf; + void *args; { - if (!mac68k_machine.scsi80) - return 0; - return 1; + switch (current_mac_model->machineid) { + case MACH_MACIIFX: /* Note: the IIfx isn't (yet) supported. */ + break; + case MACH_MACPB210: + case MACH_MACPB230: + case MACH_MACPB250: + case MACH_MACPB270: + case MACH_MACPB280: + case MACH_MACPB280C: + if (cf->cf_unit == 1) + return 1; + /*FALLTHROUGH*/ + default: + if (cf->cf_unit == 0 && mac68k_machine.scsi80) + return 1; + } + return 0; } static void @@ -230,6 +249,7 @@ sbc_attach(parent, self, args) { struct sbc_softc *sc = (struct sbc_softc *) self; struct ncr5380_softc *ncr_sc = (struct ncr5380_softc *) sc; + char bits[64]; extern vm_offset_t SCSIBase; /* Pull in the options flags. */ @@ -253,6 +273,19 @@ sbc_attach(parent, self, args) sc->sc_nodrq_addr = (vm_offset_t)(SCSIBase + SBC_DMA_OFS_PB500); sc->sc_options &= ~(SBC_INTR | SBC_RESELECT); break; + case MACH_MACPB210: + case MACH_MACPB230: + case MACH_MACPB250: + case MACH_MACPB270: + case MACH_MACPB280: + case MACH_MACPB280C: + if (ncr_sc->sc_dev.dv_unit == 1) { + sc->sc_regs = (struct sbc_regs *)(0xfee00000 + SBC_REG_OFS_DUO2); + sc->sc_drq_addr = (vm_offset_t)(0xfee00000 + SBC_HSK_OFS_DUO2); + sc->sc_nodrq_addr = (vm_offset_t)(0xfee00000 + SBC_DMA_OFS_DUO2); + break; + } + /*FALLTHROUGH*/ default: sc->sc_regs = (struct sbc_regs *)(SCSIBase + SBC_REG_OFS); sc->sc_drq_addr = (vm_offset_t)(SCSIBase + SBC_HSK_OFS); @@ -329,7 +362,8 @@ sbc_attach(parent, self, args) } if (sc->sc_options) - printf(": options=%b", sc->sc_options, SBC_OPTIONS_BITS); + printf(": options=%s", bitmask_snprintf(sc->sc_options, + SBC_OPTIONS_BITS, bits, sizeof(bits))); printf("\n"); /* Now enable SCSI interrupts through VIA2, if appropriate */ @@ -747,7 +781,9 @@ sbc_drq_intr(p) u_int8_t *data; register int count; int dcount, resid; +#ifdef SBC_WRITE_HACK u_int8_t tmp; +#endif /* * If we're not ready to xfer data, or have no more, just return. @@ -782,7 +818,8 @@ sbc_drq_intr(p) dh->dh_addr += count; dh->dh_len -= count; - } + } else + count = 0; #ifdef SBC_DEBUG if (sbc_debug & SBC_DB_INTR) @@ -854,6 +891,7 @@ sbc_drq_intr(p) } dh->dh_flags |= SBC_DH_DONE; +#ifdef SBC_WRITE_HACK /* * XXX -- Read a byte from the SBC to trigger a /BERR. * This seems to be necessary for us to notice that @@ -867,6 +905,7 @@ sbc_drq_intr(p) drq = (volatile u_int8_t *) sc->sc_drq_addr; } tmp = *drq; +#endif } else { /* Data In */ /* * Get the dest address aligned. diff --git a/sys/arch/mac68k/dev/z8530tty.c b/sys/arch/mac68k/dev/z8530tty.c index 3a9e5806cd3..99e293fcf93 100644 --- a/sys/arch/mac68k/dev/z8530tty.c +++ b/sys/arch/mac68k/dev/z8530tty.c @@ -1,5 +1,5 @@ -/* $OpenBSD: z8530tty.c,v 1.5 1996/10/14 02:49:14 briggs Exp $ */ -/* $NetBSD: z8530tty.c,v 1.7 1996/10/13 03:21:30 christos Exp $ */ +/* $OpenBSD: z8530tty.c,v 1.6 1997/01/24 01:35:38 briggs Exp $ */ +/* $NetBSD: z8530tty.c,v 1.10 1996/12/18 05:17:44 scottr Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross @@ -87,7 +87,7 @@ struct zstty_stats z8530tty_stats; /* Definition of the driver for autoconfig. */ -static int zstty_match(struct device *, void *, void *); +static int zstty_match(struct device *, struct cfdata *, void *); static void zstty_attach(struct device *, struct device *, void *); struct cfattach zstty_ca = { @@ -117,11 +117,11 @@ static int zsgetbaud __P((register struct zs_chanstate *, * zstty_match: how is this zs channel configured? */ int -zstty_match(parent, match, aux) +zstty_match(parent, cf, aux) struct device *parent; - void *match, *aux; + struct cfdata *cf; + void *aux; { - struct cfdata *cf = match; struct zsc_attach_args *args = aux; /* Exact match is better than wildcard. */ @@ -699,6 +699,8 @@ zsgetbaud(cs, rate, tc, rr4, rr11, rr14, source, sourceflag) s = -1; /* no valid source yet */ tol = ZS_TOLERANCE; + sf = 0; tc0 = 0; rate0 = 0; /* XXX Kill gcc warning */ + /* * Step through all the sources and see which one matches * the best. A source has to match BETTER than tol to be chosen. diff --git a/sys/arch/mac68k/dev/zs.c b/sys/arch/mac68k/dev/zs.c index 281d31a0aa0..38351e14111 100644 --- a/sys/arch/mac68k/dev/zs.c +++ b/sys/arch/mac68k/dev/zs.c @@ -1,5 +1,5 @@ -/* $OpenBSD: zs.c,v 1.6 1996/10/28 14:46:26 briggs Exp $ */ -/* $NetBSD: zs.c,v 1.10 1996/10/13 03:21:31 christos Exp $ */ +/* $OpenBSD: zs.c,v 1.7 1997/01/24 01:35:39 briggs Exp $ */ +/* $NetBSD: zs.c,v 1.12 1996/12/18 05:04:22 scottr Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross @@ -184,7 +184,7 @@ static u_char zs_init_reg[16] = { ****************************************************************/ /* Definition of the driver for autoconfig. */ -static int zsc_match __P((struct device *, void *, void *)); +static int zsc_match __P((struct device *, struct cfdata *, void *)); static void zsc_attach __P((struct device *, struct device *, void *)); static int zsc_print __P((void *aux, const char *name)); @@ -204,9 +204,9 @@ int zssoft __P((void *)); * Is the zs chip present? */ static int -zsc_match(parent, vcf, aux) +zsc_match(parent, cf, aux) struct device *parent; - void *vcf; + struct cfdata *cf; void *aux; { return 1; @@ -245,7 +245,8 @@ zsc_attach(parent, self, aux) volatile struct zschan *zc; struct zs_chanstate *cs; int zsc_unit, channel; - int reset, s, chip; + int reset, s; + int chip = 0; /* XXX quiet bogus gcc warning */ if (!zsinited) zs_init(); zsinited = 2; @@ -356,7 +357,8 @@ zstty_mdattach(zsc, zst, cs, tp) */ cs->cs_clocks[1].clk = mac68k_machine.print_dcd_clk; cs->cs_clocks[2].clk = mac68k_machine.print_cts_clk; - } + } else + theflags = 0; if (cs->cs_clocks[1].clk) zst->zst_hwflags |= ZS_HWFLAG_IGDCD; diff --git a/sys/arch/mac68k/include/autoconf.h b/sys/arch/mac68k/include/autoconf.h index 20e971e25c6..c44a5259ed0 100644 --- a/sys/arch/mac68k/include/autoconf.h +++ b/sys/arch/mac68k/include/autoconf.h @@ -1,5 +1,5 @@ -/* $OpenBSD: autoconf.h,v 1.3 1996/11/23 21:45:56 kstailey Exp $ */ -/* $NetBSD: autoconf.h,v 1.2 1996/05/18 18:52:48 briggs Exp $ */ +/* $OpenBSD: autoconf.h,v 1.4 1997/01/24 01:35:40 briggs Exp $ */ +/* $NetBSD: autoconf.h,v 1.5 1996/12/17 06:47:40 scottr Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross @@ -40,24 +40,8 @@ * From sun3 port--adapted for mac68k platform by Allen Briggs. */ -/* These are the "bus" types: */ -#define BUS_OBIO 0 /* On-board I/O */ -#define BUS_NUBUS 1 /* "nubus" */ - -/* - * This is the "args" parameter to the bus match/attach functions. - */ -struct confargs { - int ca_bustype; /* BUS_INTERNAL0, ... */ - int slot; -}; - /* autoconf.c */ void setconf __P((void)); -int bus_scan __P((struct device *, void *, void *)); -int bus_print __P((void *, const char *)); -int bus_peek __P((int, vm_offset_t, int)); -char *bus_mapin __P((int, int, int)); void configure __P((void)); /* machdep.c */ @@ -67,8 +51,6 @@ int badbaddr __P((register caddr_t addr)); int badwaddr __P((register caddr_t addr)); int badladdr __P((register caddr_t addr)); -int mac68k_name_match __P((struct device *, void *, void *)); - /* clock.h */ void enablertclock __P((void)); diff --git a/sys/arch/mac68k/include/cpu.h b/sys/arch/mac68k/include/cpu.h index d29efa99efa..bf16662a8f3 100644 --- a/sys/arch/mac68k/include/cpu.h +++ b/sys/arch/mac68k/include/cpu.h @@ -1,5 +1,5 @@ -/* $OpenBSD: cpu.h,v 1.12 1996/10/28 14:34:06 briggs Exp $ */ -/* $NetBSD: cpu.h,v 1.43 1996/10/15 14:42:49 scottr Exp $ */ +/* $OpenBSD: cpu.h,v 1.13 1997/01/24 01:35:40 briggs Exp $ */ +/* $NetBSD: cpu.h,v 1.44 1997/01/20 05:08:00 scottr Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -135,16 +135,20 @@ int want_resched; /* resched() was called */ /* * simulated software interrupt register */ -extern unsigned char ssir; - -#define SIR_NET 0x1 -#define SIR_CLOCK 0x2 -#define SIR_SERIAL 0x4 - -#define siroff(x) ssir &= ~(x) -#define setsoftnet() ssir |= SIR_NET -#define setsoftclock() ssir |= SIR_CLOCK -#define setsoftserial() ssir |= SIR_SERIAL +extern volatile u_int8_t ssir; + +#define SIR_NET 0x01 +#define SIR_CLOCK 0x02 +#define SIR_SERIAL 0x04 + +#define siroff(mask) \ + __asm __volatile ( "andb %0,_ssir" : : "ir" (~(mask))); +#define setsoftnet() \ + __asm __volatile ( "orb %0,_ssir" : : "i" (SIR_NET)) +#define setsoftclock() \ + __asm __volatile ( "orb %0,_ssir" : : "i" (SIR_CLOCK)) +#define setsoftserial() \ + __asm __volatile ( "orb %0,_ssir" : : "i" (SIR_SERIAL)) #define CPU_CONSDEV 1 #define CPU_MAXID 2 diff --git a/sys/arch/mac68k/include/types.h b/sys/arch/mac68k/include/types.h index f6573615d51..21442c0b967 100644 --- a/sys/arch/mac68k/include/types.h +++ b/sys/arch/mac68k/include/types.h @@ -1,5 +1,5 @@ -/* $OpenBSD: types.h,v 1.3 1996/05/26 18:36:08 briggs Exp $ */ -/* $NetBSD: types.h,v 1.8 1996/05/05 06:18:05 briggs Exp $ */ +/* $OpenBSD: types.h,v 1.4 1997/01/24 01:35:41 briggs Exp $ */ +/* $NetBSD: types.h,v 1.10 1996/12/17 07:00:12 scottr Exp $ */ #ifndef _TYPES_MACHINE_ #define _TYPES_MACHINE_ diff --git a/sys/arch/mac68k/include/viareg.h b/sys/arch/mac68k/include/viareg.h index 6179e3e8f7e..0883aa36d26 100644 --- a/sys/arch/mac68k/include/viareg.h +++ b/sys/arch/mac68k/include/viareg.h @@ -1,5 +1,5 @@ -/* $OpenBSD: viareg.h,v 1.4 1996/10/28 14:49:08 briggs Exp $ */ -/* $NetBSD: viareg.h,v 1.4 1996/06/07 10:41:37 briggs Exp $ */ +/* $OpenBSD: viareg.h,v 1.5 1997/01/24 01:35:41 briggs Exp $ */ +/* $NetBSD: viareg.h,v 1.5 1996/10/29 05:42:16 briggs Exp $ */ /*- * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, diff --git a/sys/arch/mac68k/include/vmparam.h b/sys/arch/mac68k/include/vmparam.h index 90787f96124..7975e2e9001 100644 --- a/sys/arch/mac68k/include/vmparam.h +++ b/sys/arch/mac68k/include/vmparam.h @@ -1,5 +1,5 @@ -/* $OpenBSD: vmparam.h,v 1.2 1996/05/26 18:36:11 briggs Exp $ */ -/* $NetBSD: vmparam.h,v 1.7 1995/06/21 03:17:06 briggs Exp $ */ +/* $OpenBSD: vmparam.h,v 1.3 1997/01/24 01:35:42 briggs Exp $ */ +/* $NetBSD: vmparam.h,v 1.8 1996/11/15 14:21:00 briggs Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -267,6 +267,8 @@ #define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) #define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) +#define MACHINE_NONCONTIG /* VM <=> pmap interface modifier */ + /* # of kernel PT pages (initial only, can grow dynamically) */ #define VM_KERNEL_PT_PAGES ((vm_size_t)2) /* XXX: SYSPTSIZE */ diff --git a/sys/arch/mac68k/mac68k/autoconf.c b/sys/arch/mac68k/mac68k/autoconf.c index 9e8bbee3791..06b796d1399 100644 --- a/sys/arch/mac68k/mac68k/autoconf.c +++ b/sys/arch/mac68k/mac68k/autoconf.c @@ -1,5 +1,5 @@ -/* $OpenBSD: autoconf.c,v 1.9 1997/01/01 14:59:46 briggs Exp $ */ -/* $NetBSD: autoconf.c,v 1.31 1996/06/19 03:21:03 scottr Exp $ */ +/* $OpenBSD: autoconf.c,v 1.10 1997/01/24 01:35:43 briggs Exp $ */ +/* $NetBSD: autoconf.c,v 1.38 1996/12/18 05:46:09 scottr Exp $ */ /* * Copyright (c) 1992, 1993 @@ -73,6 +73,7 @@ #include +#include "ether.h" struct device *booted_device; int booted_partition; @@ -247,6 +248,7 @@ setroot(void) bootdv = booted_device; bootpartition = booted_partition; + rootdv = swapdv = NULL; /* XXX work around gcc warning */ #ifdef DEBUG printf("boot device: %s\n", @@ -377,7 +379,9 @@ gotswap: #if defined(NFSCLIENT) case DV_IFNET: mountroot = nfs_mountroot; +#if NETHER > 0 nfsbootdevname = rootdv->dv_xname; +#endif return; #endif #if defined(FFS) diff --git a/sys/arch/mac68k/mac68k/clock.c b/sys/arch/mac68k/mac68k/clock.c index 09b54ad0efd..ae3ce5a78a2 100644 --- a/sys/arch/mac68k/mac68k/clock.c +++ b/sys/arch/mac68k/mac68k/clock.c @@ -1,5 +1,5 @@ -/* $OpenBSD: clock.c,v 1.7 1996/05/26 18:36:14 briggs Exp $ */ -/* $NetBSD: clock.c,v 1.29 1996/05/05 06:18:17 briggs Exp $ */ +/* $OpenBSD: clock.c,v 1.8 1997/01/24 01:35:44 briggs Exp $ */ +/* $NetBSD: clock.c,v 1.32 1997/01/15 01:28:53 perry Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -286,7 +286,7 @@ static u_long ugmt_2_pramt __P((u_long)); static u_long pramt_2_ugmt __P((u_long)); /* - * Convert GMT to Mac PRAM time, using global timezone + * Convert GMT to Mac PRAM time, using rtc_offset * GMT bias adjustment is done elsewhere. */ static u_long @@ -300,7 +300,7 @@ ugmt_2_pramt(t) } /* - * Convert a Mac PRAM time value to GMT, using compiled-in timezone + * Convert a Mac PRAM time value to GMT, using rtc_offset * GMT bias adjustment is done elsewhere. */ static u_long diff --git a/sys/arch/mac68k/mac68k/conf.c b/sys/arch/mac68k/mac68k/conf.c index ea33b3de4aa..f2317f54765 100644 --- a/sys/arch/mac68k/mac68k/conf.c +++ b/sys/arch/mac68k/mac68k/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.13 1997/01/01 15:54:21 briggs Exp $ */ +/* $OpenBSD: conf.c,v 1.14 1997/01/24 01:35:45 briggs Exp $ */ /* $NetBSD: conf.c,v 1.34 1996/06/19 02:20:54 briggs Exp $ */ /* @@ -100,7 +100,9 @@ cdev_decl(mm); cdev_decl(sw); #include "pty.h" #include "ss.h" +cdev_decl(ss); #include "uk.h" +cdev_decl(uk); cdev_decl(fd); #include "grf.h" cdev_decl(grf); @@ -110,6 +112,8 @@ cdev_decl(adb); cdev_decl(zsc); #include "zstty.h" cdev_decl(zs); +#include "ch.h" +cdev_decl(ch); #include "bpfilter.h" #include "tun.h" dev_decl(filedesc,open); @@ -141,8 +145,7 @@ struct cdevsw cdevsw[] = cdev_tape_init(NST,st), /* 14: SCSI tape */ cdev_disk_init(NCD,cd), /* 15: SCSI CD-ROM */ cdev_notdef(), /* 16 */ -/* cdev_disk_init(NCH,ch), 17: SCSI autochanger */ - cdev_notdef(), /* 17: until we find chstrategy... */ + cdev_ch_init(NCH,ch), /* 17: SCSI autochanger */ cdev_notdef(), /* 18 */ cdev_disk_init(NVND,vnd), /* 19: vnode disk driver */ cdev_disk_init(NCCD,ccd), /* 20: concatenated disk driver */ @@ -157,10 +160,10 @@ struct cdevsw cdevsw[] = cdev_lkm_dummy(), /* 29 */ cdev_lkm_dummy(), /* 30 */ cdev_lkm_dummy(), /* 31 */ - cdev_gen_ipf(NIPF,ipl), /* 32: IP filter log */ - cdev_random_init(1,random), /* 33: random data source */ - cdev_uk_init(NUK,uk), /* 34: unknown SCSI */ - cdev_ss_init(NSS,ss), /* 35: SCSI scanner */ + cdev_random_init(1,random), /* 32: random data source */ + cdev_ss_init(NSS,ss), /* 33: SCSI scanner */ + cdev_uk_init(NUK,uk), /* 34: SCSI unknown */ + cdev_gen_ipf(NIPF,ipl), /* 35: IP filter log */ }; int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); diff --git a/sys/arch/mac68k/mac68k/fpu.c b/sys/arch/mac68k/mac68k/fpu.c index 1ea27f94968..904c34deadd 100644 --- a/sys/arch/mac68k/mac68k/fpu.c +++ b/sys/arch/mac68k/mac68k/fpu.c @@ -1,10 +1,13 @@ -/* $OpenBSD: fpu.c,v 1.6 1997/01/19 03:58:05 briggs Exp $ */ -/* $NetBSD: fpu.c,v 1.16 1996/06/11 02:56:22 scottr Exp $ */ +/* $OpenBSD: fpu.c,v 1.7 1997/01/24 01:35:45 briggs Exp $ */ +/* $NetBSD: fpu.c,v 1.21 1996/12/16 16:17:16 scottr Exp $ */ -/* - * Copyright (c) 1995 Gordon W. Ross +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * + * This code is derived from software contributed to The NetBSD Foundation + * by Gordon W. Ross. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,22 +16,25 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * 4. All advertising materials mentioning features or use of this software + * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Gordon Ross + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ /* @@ -53,7 +59,7 @@ int fputype; extern int *nofault; -static int fpu_match __P((struct device *, void *, void *)); +static int fpu_match __P((struct device *, struct cfdata *, void *)); static void fpu_attach __P((struct device *, struct device *, void *)); static int fpu_probe __P((void)); @@ -66,9 +72,10 @@ struct cfdriver fpu_cd = { }; static int -fpu_match(pdp, match, auxp) - struct device *pdp; - void *match, *auxp; +fpu_match(parent, cf, aux) + struct device *parent; + struct cfdata *cf; + void *aux; { return 1; } diff --git a/sys/arch/mac68k/mac68k/genassym.c b/sys/arch/mac68k/mac68k/genassym.c index 175628e5be5..2ed8eeef26a 100644 --- a/sys/arch/mac68k/mac68k/genassym.c +++ b/sys/arch/mac68k/mac68k/genassym.c @@ -1,5 +1,5 @@ -/* $OpenBSD: genassym.c,v 1.4 1996/10/14 01:17:05 briggs Exp $ */ -/* $NetBSD: genassym.c,v 1.20 1996/09/16 18:00:27 scottr Exp $ */ +/* $OpenBSD: genassym.c,v 1.5 1997/01/24 01:35:46 briggs Exp $ */ +/* $NetBSD: genassym.c,v 1.22 1997/01/09 07:14:17 scottr Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -155,6 +155,7 @@ main(void) printf("#define\tCACHE_ON %d\n", CACHE_ON); printf("#define\tCACHE_OFF %d\n", CACHE_OFF); printf("#define\tCACHE_CLR %d\n", CACHE_CLR); + printf("#define\tCACHE40_ON %d\n", CACHE40_ON); printf("#define\tCACHE40_OFF %d\n", CACHE40_OFF); printf("#define\tIC_CLEAR %d\n", IC_CLEAR); printf("#define\tDC_CLEAR %d\n", DC_CLEAR); @@ -185,12 +186,17 @@ main(void) printf("#define\tSYS_execve %d\n", SYS_execve); printf("#define\tSYS_sigreturn %d\n", SYS_sigreturn); + printf("#define\tCPU_68020 %d\n", CPU_68020); + printf("#define\tCPU_68030 %d\n", CPU_68030); + printf("#define\tCPU_68040 %d\n", CPU_68040); + + printf("#define\tMMU_68851 %d\n", MMU_68851); + printf("#define\tMMU_68030 %d\n", MMU_68030); + printf("#define\tMMU_68040 %d\n", MMU_68040); + printf("#define\tFPU_68881 %d\n", FPU_68881); printf("#define\tFPU_68882 %d\n", FPU_68882); printf("#define\tFPU_68040 %d\n", FPU_68040); - printf("#define\tMMU_68040 %d\n", MMU_68040); - printf("#define\tMMU_68030 %d\n", MMU_68030); - printf("#define\tMMU_68851 %d\n", MMU_68851); exit(0); } diff --git a/sys/arch/mac68k/mac68k/locore.s b/sys/arch/mac68k/mac68k/locore.s index 53954710b01..94b2b1bf8ef 100644 --- a/sys/arch/mac68k/mac68k/locore.s +++ b/sys/arch/mac68k/mac68k/locore.s @@ -1,5 +1,5 @@ -/* $OpenBSD: locore.s,v 1.15 1996/11/23 23:19:38 kstailey Exp $ */ -/* $NetBSD: locore.s,v 1.70 1996/10/17 06:32:13 scottr Exp $ */ +/* $OpenBSD: locore.s,v 1.16 1997/01/24 01:35:47 briggs Exp $ */ +/* $NetBSD: locore.s,v 1.73 1997/01/09 07:28:12 scottr Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -846,81 +846,97 @@ _esym: .long 0 .globl _edata .globl _etext .globl start + .globl _getenvvars | in machdep.c + .globl _setmachdep | in machdep.c start: movw #PSL_HIGHIPL,sr | no interrupts. ever. - -| Give ourself a stack lea tmpstk,sp | give ourselves a temporary stack - movl #CACHE_OFF,d0 - movc d0, cacr - -| Some parameters provided by MacOS -| -| LAK: This section is the new way to pass information from the booter -| to the kernel. At A1 there is an environment variable which has -| a bunch of stuff in ascii format, "VAR=value\0VAR=value\0\0". - - .globl _initenv, _getenvvars | in machdep.c - .globl _setmachdep | in machdep.c + movql #0,d0 | disables caches + movc d0,cacr /* Initialize source/destination control registers for movs */ - moveq #FC_USERD,d0 | user space + movql #FC_USERD,d0 | user space movc d0,sfc | as source movc d0,dfc | and destination of transfers - movl a1, sp@- | Address of buffer - movl d4, sp@- | Some flags... (mostly not used) - jbsr _initenv - addql #8, sp - + /* Determine MMU/MPU from what we can test empirically */ + movl #0x200,d0 | data freeze bit + movc d0,cacr | only exists on 68030 + movc cacr,d0 | read it back + tstl d0 | zero? + jeq Lnot68030 | yes, we have 68020/68040 + + movl #CACHE_OFF,d0 | disable and clear both caches + movc d0,cacr + lea _mmutype,a0 | no, we have 68030 + movl #MMU_68030,a0@ | set to reflect 68030 PMMU + lea _cputype,a0 + movl #CPU_68030,a0@ | and 68030 MPU + jra Lstart1 + +Lnot68030: + bset #31,d0 | data cache enable bit + movc d0,cacr | only exists on 68040 + movc cacr,d0 | read it back + tstl d0 | zero? + beq Lis68020 | yes, we have 68020 + + movql #CACHE40_OFF,d0 | now turn it back off + movc d0,cacr | before we access any data + .word 0xf4f8 | cpusha bc ;push and invalidate caches + lea _mmutype,a0 + movl #MMU_68040,a0@ | Reflect 68040 MMU + lea _cputype,a0 + movl #CPU_68040,a0@ | and 68040 MPU + jra Lstart1 + +Lis68020: + movl #CACHE_OFF,d0 | disable and clear cache + movc d0,cacr + lea _mmutype,a0 | Must be 68020+68851 + movl #MMU_68851,a0@ | Reflect 68851 PMMU + lea _cputype,a0 + movl #CPU_68020,a0@ | and 68020 MPU + +Lstart1: + /* + * Some parameters provided by MacOS + * + * LAK: This section is the new way to pass information from the booter + * to the kernel. At A1 there is an environment variable which has + * a bunch of stuff in ascii format, "VAR=value\0VAR=value\0\0". + */ + movl a1,sp@- | Address of buffer + movl d4,sp@- | Some flags... (mostly not used) jbsr _getenvvars | Parse the environment buffer - + addql #8, sp jbsr _setmachdep | Set some machine-dep stuff jbsr _vm_set_page_size | Set the vm system page size, now. jbsr _consinit | XXX Should only be if graybar on - cmpl #MMU_68040, _mmutype | Set in _getenvvars ONLY if 040. - jne Lstartnot040 | It's not an '040 - .word 0xf4f8 | cpusha bc - push and invalidate caches - - movl #CACHE40_OFF,d0 | 68040 cache disable - movc d0, cacr - - movql #0, d0 - .long 0x4e7b0004 | movc d0,itt0 ;Disable itt0 - .long 0x4e7b0005 | movc d0,itt1 ;Disable itt1 - .long 0x4e7b0006 | movc d0,dtt0 ;Disable dtt0 - .long 0x4e7b0007 | movc d0,dtt1 ;Disable dtt1 - .long 0x4e7b0003 | movc d0,tc ;Disable MMU - - movl #0x0,sp@- | Fake unenabled MMU +/* + * Figure out MacOS mappings and bootstrap BSD + */ + lea _macos_tc,a0 | get current TC + cmpl #MMU_68040, _mmutype | check to see if 68040 + jeq Lget040TC + pmove tc,a0@ jra do_bootstrap -Lstartnot040: - -| BG - Figure out our MMU - movl #0x200, d0 | data freeze bit (??) - movc d0, cacr | only exists in 68030 - movc cacr, d0 | on an '851, it'll go away. - tstl d0 - jeq Lisa68020 - movl #MMU_68030, _mmutype | 68030 MMU - jra Lmmufigured -Lisa68020: - movl #MMU_68851, _mmutype | 68020, implies 68851, or crash. -Lmmufigured: - - lea _macos_tc,a0 - pmove tc,a0@ - movl a0@,sp@- | Save current TC for bootstrap +Lget040TC: +#ifdef __notyet__ + .long 0x4e7a0003 | movc tc,d0 +#else + movql #0,d0 + .long 0x4e7b0003 | movc d0,tc ;Disable MMU +#endif + movl d0,a0@ -/* - * Figure out MacOS mappings and bootstrap NetBSD - */ do_bootstrap: - jbsr _bootstrap_mac68k + movl a0@,sp@- | get MacOS mapping, relocate video, + jbsr _bootstrap_mac68k | bootstrap pmap, et al. addql #4,sp /* @@ -929,35 +945,39 @@ do_bootstrap: movl _Sysseg,a1 | system segment table addr addl _load_addr,a1 | Make it physical addr - cmpl #MMU_68040, _mmutype + cmpl #MMU_68040,_mmutype jne Lenablepre040MMU | if not 040, skip + + movql #0,d0 + .long 0x4e7b0003 | movc d0,tc ;Disable MMU + .long 0x4e7b0004 | movc d0,itt0 ;Disable itt0 + .long 0x4e7b0005 | movc d0,itt1 ;Disable itt1 + .long 0x4e7b0006 | movc d0,dtt0 ;Disable dtt0 + .long 0x4e7b0007 | movc d0,dtt1 ;Disable dtt1 movl a1,d1 - .long 0x4e7b1807 | movc d1,srp - .word 0xf4d8 | cinva bc .word 0xf518 | pflusha + .long 0x4e7b1807 | movc d1,srp movl #0x8000,d0 - .long 0x4e7b0003 | Enable MMU - movl #0x80008000,d0 + .long 0x4e7b0003 | movc d0,tc ;Enable MMU + movl #CACHE40_ON,d0 movc d0,cacr | turn on both caches jra Lloaddone Lenablepre040MMU: + tstl _mmutype | TTx instructions will break 68851 + jgt LnokillTT + + lea longscratch,a0 | disable TTx registers on 68030 + movl #0,a0@ + .long 0xf0100800 | movl a0@,tt0 + .long 0xf0100c00 | movl a0@,tt1 + +LnokillTT: lea _protorp,a0 movl #0x80000202,a0@ | nolimit + share global + 4 byte PTEs movl a1,a0@(4) | + segtable address pmove a0@,srp | load the supervisor root pointer movl #0x80000002,a0@ | reinit upper half for CRP loads - -| LAK: Kill the TT0 and TT1 registers so the don't screw us up later. - tstl _mmutype | ttx instructions will break 68851 - jgt LnokillTT - - lea longscratch,a0 - movl #0, a0@ - .long 0xF0100800 | movl a0@,tt0 - .long 0xF0100C00 | movl a0@,tt1 - -LnokillTT: lea longscratch,a2 movl #0x82c0aa00,a2@ | value to load TC with pmove a2@,tc | load it @@ -1146,8 +1166,8 @@ ENTRY(longjmp) /* * The following primitives manipulate the run queues. * _whichqs tells which of the 32 queues _qs have processes in them. - * Setrunqueue puts processes into queues, Remrq removes them from queues. - * The running process is on no queue, other processes are on a queue + * Setrunqueue puts processes into queues, remrunqueue removes them from + * queues. The running process is on no queue, other processes are on a queue * related to p->p_priority, divided by 4 actually to shrink the 0-127 * range of priorities into the 32 available queues. */ @@ -1520,11 +1540,11 @@ ENTRY(TBIS) cmpl #MMU_68040,_mmutype | 68040? jne Lmotommu4 | no, skip movc dfc,d1 - moveq #FC_USERD, d0 | user space - movc d0, dfc + moveq #FC_USERD,d0 | user space + movc d0,dfc .word 0xf508 | pflush a0@ moveq #FC_SUPERD,d0 | supervisor space - movc d0, dfc + movc d0,dfc .word 0xf508 | pflush a0@ movc d1,dfc rts @@ -1834,17 +1854,15 @@ Lm68881rdone: _doboot: movw #PSL_HIGHIPL,sr | no interrupts -#if defined(M68040) - cmpl #MMU_68040, _mmutype | Set in _getenvvars ONLY if 040. + cmpl #MMU_68040,_mmutype jne Ldobootnot040 | It's not an '040 - .word 0xf4f8 | cpusha bc - push and invalidate caches movl #CACHE40_OFF,d0 | 68040 cache disable movc d0, cacr + .word 0xf4f8 | cpusha bc - push and invalidate caches jra Ldoboot1 -Ldobootnot040: -#endif +Ldobootnot040: movl #CACHE_OFF,d0 movc d0,cacr | disable on-chip cache(s) @@ -1856,6 +1874,8 @@ Ldoboot1: jra a1@ | and jump to ROM to reset machine /* + * u_long ptest040(caddr_t addr, u_int fc); + * * ptest040() does an 040 PTESTR (addr) and returns the 040 MMUSR iff * translation is enabled. This allows us to find the physical address * corresponding to a MacOS logical address for get_physical(). @@ -1864,16 +1884,16 @@ Ldoboot1: .globl _ptest040 _ptest040: #if defined(M68040) - .long 0x4e7a0003 | movec tc,d0 + .long 0x4e7a0003 | movc tc,d0 andw #0x8000,d0 jeq Lget_phys1 | MMU is disabled - movc sfc,d1 - movql #1,d0 | FC for ptestr - movc d0,sfc + movc dfc,d1 | Save DFC + movl sp@(8),d0 | Set FC for ptestr + movc d0,dfc movl sp@(4),a0 | logical address to look up .word 0xf568 | ptestr (a0) - .long 0x4e7a0805 | movec mmusr,d0 - movc d1,sfc + .long 0x4e7a0805 | movc mmusr,d0 + movc d1,dfc | Restore DFC rts Lget_phys1: #endif @@ -1894,9 +1914,9 @@ Lget_phys1: * search in "psr". "pte" should be 2 longs in case it is * a long-format entry. * - * One possible problem here is that setting the tt register - * may screw something up if, say, the address returned by ptest - * in a0 has msb of 0. + * One possible problem here is that setting the TT register + * may screw something up if we access user data space in a + * called function or in an interrupt service routine. * * Returns -1 on error, 0 if pte is a short-format pte, or * 1 if pte is a long-format pte. @@ -1911,10 +1931,15 @@ Lget_phys1: */ .globl _get_pte _get_pte: - addl #-4,sp | make temporary space + subql #4,sp | make temporary space + + lea longscratch,a0 + movl #0x00ff8710,a0@ | Set up FC 1 r/w access + .long 0xf0100800 | pmove a0@,tt0 + movl sp@(8),a0 | logical address to look up movl #0,a1 | clear in case of failure - ptestr #1,a0@,#7,a1 | search for logical address + ptestr #FC_USERD,a0@,#7,a1 | search for logical address pmove psr,sp@ | store processor status register movw sp@,d1 movl sp@(16),a0 | where to store the psr @@ -1924,18 +1949,12 @@ _get_pte: tstl a1 | check address we got back jeq get_pte_fail2 | if 0, then was not set -- fail - | enable tt0 movl a1,d0 movl d0,pte_tmp | save for later - andl #0xff000000,d0 | keep msb - orl #0x00008707,d0 | enable tt for reading and writing - movl d0,longscratch - lea longscratch,a0 - .long 0xf0100800 | pmove a0@,tt0 | send first long back to user movl sp@(12),a0 | address of where to put pte - movl a1@,d0 | + movsl a1@,d0 | movl d0,a0@ | first long andl #3,d0 | dt bits of pte @@ -1972,32 +1991,32 @@ pte_level_zero: movl a0@,d0 | load high long jra pte_got_parent pte_level_one: - ptestr #1,a0@,#1,a1 | search for logical address + ptestr #FC_USERD,a0@,#1,a1 | search for logical address pmove psr,sp@ | store processor status register movw sp@,d1 jra pte_got_it pte_level_two: - ptestr #1,a0@,#2,a1 | search for logical address + ptestr #FC_USERD,a0@,#2,a1 | search for logical address pmove psr,sp@ | store processor status register movw sp@,d1 jra pte_got_it pte_level_three: - ptestr #1,a0@,#3,a1 | search for logical address + ptestr #FC_USERD,a0@,#3,a1 | search for logical address pmove psr,sp@ | store processor status register movw sp@,d1 jra pte_got_it pte_level_four: - ptestr #1,a0@,#4,a1 | search for logical address + ptestr #FC_USERD,a0@,#4,a1 | search for logical address pmove psr,sp@ | store processor status register movw sp@,d1 jra pte_got_it pte_level_five: - ptestr #1,a0@,#5,a1 | search for logical address + ptestr #FC_USERD,a0@,#5,a1 | search for logical address pmove psr,sp@ | store processor status register movw sp@,d1 jra pte_got_it pte_level_six: - ptestr #1,a0@,#6,a1 | search for logical address + ptestr #FC_USERD,a0@,#6,a1 | search for logical address pmove psr,sp@ | store processor status register movw sp@,d1 @@ -2007,15 +2026,7 @@ pte_got_it: tstl a1 | check address we got back jeq get_pte_fail6 | if 0, then was not set -- fail - | change tt0 - movl a1,d0 - andl #0xff000000,d0 | keep msb - orl #0x00008707,d0 | enable tt for reading and writing - movl d0,longscratch - lea longscratch,a0 - .long 0xF0100800 | pmove a0@,tt0 - - movl a1@,d0 | get pte of parent + movsl a1@,d0 | get pte of parent movl d0,_macos_tt0 | XXX for later analysis (kill this line) pte_got_parent: andl #3,d0 | dt bits of pte @@ -2029,36 +2040,29 @@ pte_got_parent: | is that the first long might have been the last long of RAM. movl pte_tmp,a1 | get address of our original pte - addl #4,a1 | address of ite second long + addql #4,a1 | address of ite second long - | change tt0 back - movl a1,d0 - andl #0xff000000,d0 | keep msb - orl #0x00008707,d0 | enable tt for reading and writing - movl d0,longscratch - lea longscratch,a0 - .long 0xF0100800 | pmove a0@,tt0 - - movl sp@(12),a0 | address of return pte - movl a1@,a0@(4) | write in second long + | send second long back to user + movl sp@(12),a0 | address of where to put pte + movsl a1@,d0 | + movl d0,a0@(4) | write in second long - movl #1,d0 | return long-format + movql #1,d0 | return long-format jra get_pte_success short_format: - movl #0,d0 | return short-format + movql #0,d0 | return short-format jra get_pte_success get_pte_fail: - movl #-1,d0 | return failure + movql #-1,d0 | return failure get_pte_success: - clrl d1 | disable tt - movl d1,longscratch - lea longscratch,a0 - .long 0xF0100800 | pmove a0@,tt0 + lea longscratch,a0 | disable tt + movl #0,a0@ + .long 0xf0100800 | pmove a0@,tt0 - addl #4,sp | return temporary space + addql #4,sp | return temporary space rts get_pte_fail1: @@ -2147,9 +2151,11 @@ tmpstk: .globl _machineid _machineid: .long 0 | default to 320 - .globl _mmutype,_protorp + .globl _mmutype,_cputype,_protorp _mmutype: - .long 0 | Are we running 68851, 68030, or 68040? + .long MMU_68851 | Default to 68851 PMMU +_cputype: + .long CPU_68020 | Default to 68020 _protorp: .long 0,0 | prototype root pointer .globl _cold diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c index 2aa74230a30..aa2bfa8e886 100644 --- a/sys/arch/mac68k/mac68k/machdep.c +++ b/sys/arch/mac68k/mac68k/machdep.c @@ -1,5 +1,5 @@ -/* $OpenBSD: machdep.c,v 1.26 1997/01/19 03:58:06 briggs Exp $ */ -/* $NetBSD: machdep.c,v 1.122 1996/10/15 06:40:39 scottr Exp $ */ +/* $OpenBSD: machdep.c,v 1.27 1997/01/24 01:35:48 briggs Exp $ */ +/* $NetBSD: machdep.c,v 1.129 1997/01/09 07:20:46 scottr Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -142,7 +142,6 @@ struct mac68k_machine_S mac68k_machine; volatile u_char *Via1Base, *Via2Base; u_long NuBusBase = NBBASE; u_long IOBase; -u_long conspa; vm_offset_t SCSIBase; @@ -1407,10 +1406,10 @@ cpu_exec_aout_makecmds(p, epp) struct exec_package *epp; { int error = ENOEXEC; - struct exec *execp = epp->ep_hdr; #ifdef COMPAT_NOMID - if (execp->a_midmag == ZMAGIC) /* i.e., MID == 0. */ + /* Check to see if MID == 0. */ + if (((struct exec *) epp->ep_hdr)->a_midmag == ZMAGIC) return exec_aout_prep_oldzmagic(p, epp); #endif @@ -1427,23 +1426,109 @@ cpu_exec_aout_makecmds(p, epp) static char *envbuf = NULL; -void initenv __P((u_long, char *)); +/* + * getenvvars: Grab a few useful variables + */ +void getenvvars __P((u_long, char *)); +static long getenv __P((char *)); void -initenv(flag, buf) +getenvvars(flag, buf) u_long flag; char *buf; { + extern u_long bootdev, videobitdepth, videosize; + extern u_long end, esym; + extern u_long macos_boottime, MacOSROMBase; + extern long macos_gmtbias; + int root_scsi_id; + /* * If flag & 0x80000000 == 0, then we're booting with the old booter * and we should freak out. */ - if ((flag & 0x80000000) == 0) { /* Freak out; print something if that becomes available */ - } else { + } else envbuf = buf; + + root_scsi_id = getenv("ROOT_SCSI_ID"); + /* + * For now, we assume that the boot device is off the first controller. + */ + if (bootdev == 0) { + bootdev = (root_scsi_id << 16) | 4; + } + + if (boothowto == 0) { + boothowto = getenv("SINGLE_USER"); + } + + /* These next two should give us mapped video & serial */ + /* We need these for pre-mapping graybars & echo, but probably */ + /* only on MacII or LC. -- XXX */ + /* videoaddr = getenv("MACOS_VIDEO"); */ + /* sccaddr = getenv("MACOS_SCC"); */ + + /* + * The following are not in a structure so that they can be + * accessed more quickly. + */ + videoaddr = getenv("VIDEO_ADDR"); + videorowbytes = getenv("ROW_BYTES"); + videobitdepth = getenv("SCREEN_DEPTH"); + videosize = getenv("DIMENSIONS"); + + /* + * More misc stuff from booter. + */ + mac68k_machine.machineid = getenv("MACHINEID"); + mac68k_machine.mach_processor = getenv("PROCESSOR"); + mac68k_machine.mach_memsize = getenv("MEMSIZE"); + mac68k_machine.do_graybars = getenv("GRAYBARS"); + mac68k_machine.serial_boot_echo = getenv("SERIALECHO"); + mac68k_machine.serial_console = getenv("SERIALCONSOLE"); + + mac68k_machine.modem_flags = getenv("SERIAL_MODEM_FLAGS"); + mac68k_machine.modem_cts_clk = getenv("SERIAL_MODEM_HSKICLK"); + mac68k_machine.modem_dcd_clk = getenv("SERIAL_MODEM_GPICLK"); + mac68k_machine.print_flags = getenv("SERIAL_PRINT_FLAGS"); + mac68k_machine.print_cts_clk = getenv("SERIAL_PRINT_HSKICLK"); + mac68k_machine.print_dcd_clk = getenv("SERIAL_PRINT_GPICLK"); + /* Should probably check this and fail if old */ + mac68k_machine.booter_version = getenv("BOOTERVER"); + + /* + * Get end of symbols for kernel debugging + */ + esym = getenv("END_SYM"); +#ifndef SYMTAB_SPACE + if (esym == 0) +#endif + esym = (long) &end; + + /* Get MacOS time */ + macos_boottime = getenv("BOOTTIME"); + + /* Save GMT BIAS saved in Booter parameters dialog box */ + macos_gmtbias = getenv("GMTBIAS"); + + /* + * Save globals stolen from MacOS + */ + + ROMBase = (caddr_t) getenv("ROMBASE"); + if (ROMBase == (caddr_t) 0) { + ROMBase = (caddr_t) ROMBASE; } + MacOSROMBase = (unsigned long) ROMBase; + TimeDBRA = getenv("TIMEDBRA"); + ADBDelay = (u_short) getenv("ADBDELAY"); + HwCfgFlags = getenv("HWCFGFLAGS"); + HwCfgFlags2 = getenv("HWCFGFLAG2"); + HwCfgFlags3 = getenv("HWCFGFLAG3"); + ADBReInit_JTBL = getenv("ADBREINIT_JTBL"); + mrg_ADBIntrPtr = (caddr_t) getenv("ADBINTERRUPT"); } static char toupper __P((char)); @@ -1459,8 +1544,6 @@ toupper(c) } } -static long getenv __P((char *)); - static long getenv(str) char *str; @@ -2191,6 +2274,23 @@ struct cpu_model_info cpu_models[] = { {0, NULL, NULL, 0, NULL}, }; /* End of cpu_models[] initialization. */ +struct { + int machineid; + caddr_t fbbase; + u_long fblen; +} intvid_info[] = { + {MACH_MACPB140, (caddr_t) 0xfee00000, 32 * 1024}, + {MACH_MACPB145, (caddr_t) 0xfee00000, 32 * 1024}, + {MACH_MACPB170, (caddr_t) 0xfee00000, 32 * 1024}, + {MACH_MACPB160, (caddr_t) 0x60000000, 128 * 1024}, + {MACH_MACPB165, (caddr_t) 0x60000000, 128 * 1024}, + {MACH_MACPB180, (caddr_t) 0x60000000, 128 * 1024}, + {MACH_MACPB165C, (caddr_t) 0xfc040000, 512 * 1024}, + {MACH_MACPB180C, (caddr_t) 0xfc040000, 512 * 1024}, + {MACH_MACPB500, (caddr_t) 0x60000000, 512 * 1024}, + {0, (caddr_t) 0x0, 0}, +}; /* End of intvid_info[] initialization. */ + /* * Missing Mac Models: * PowerMac 6100 @@ -2217,27 +2317,26 @@ mach_cputype() static void identifycpu() { - char *proc; + char *mpu; - switch (mac68k_machine.mach_processor) { - case MACH_68020: - proc = ("(68020)"); + switch (cputype) { + case CPU_68020: + mpu = ("(68020)"); break; - case MACH_68030: - proc = ("(68030)"); + case CPU_68030: + mpu = ("(68030)"); break; - case MACH_68040: - proc = ("(68040)"); + case CPU_68040: + mpu = ("(68040)"); break; - case MACH_PENTIUM: default: - proc = ("(unknown processor)"); + mpu = ("(unknown processor)"); break; } sprintf(cpu_model, "Apple Macintosh %s%s %s", cpu_models[mac68k_machine.cpu_model_index].model_major, cpu_models[mac68k_machine.cpu_model_index].model_minor, - proc); + mpu); printf("%s\n", cpu_model); } @@ -2248,10 +2347,9 @@ get_machine_info() { int i; - for (i = 0; cpu_models[i].model_major; i++) { + for (i = 0; cpu_models[i].model_major; i++) if (mac68k_machine.machineid == cpu_models[i].machineid) break; - } if (cpu_models[i].model_major == NULL) i--; @@ -2259,104 +2357,6 @@ get_machine_info() mac68k_machine.cpu_model_index = i; } -/* - * getenvvars: Grab a few useful variables - */ -void getenvvars __P((void)); - -void -getenvvars() -{ - extern u_long bootdev, videobitdepth, videosize; - extern u_long end, esym; - extern u_long macos_boottime, MacOSROMBase; - extern long macos_gmtbias; - int root_scsi_id; - - root_scsi_id = getenv("ROOT_SCSI_ID"); - /* - * For now, we assume that the boot device is off the first controller. - */ - if (bootdev == 0) { - bootdev = (root_scsi_id << 16) | 4; - } - - if (boothowto == 0) { - boothowto = getenv("SINGLE_USER"); - } - - /* These next two should give us mapped video & serial */ - /* We need these for pre-mapping graybars & echo, but probably */ - /* only on MacII or LC. -- XXX */ - /* videoaddr = getenv("MACOS_VIDEO"); */ - /* sccaddr = getenv("MACOS_SCC"); */ - - /* - * The following are not in a structure so that they can be - * accessed more quickly. - */ - videoaddr = getenv("VIDEO_ADDR"); - videorowbytes = getenv("ROW_BYTES"); - videobitdepth = getenv("SCREEN_DEPTH"); - videosize = getenv("DIMENSIONS"); - - /* - * More misc stuff from booter. - */ - mac68k_machine.machineid = getenv("MACHINEID"); - switch (mac68k_machine.mach_processor = getenv("PROCESSOR")) { - case MACH_68040: - mmutype = MMU_68040; - break; - default:; - } - mac68k_machine.mach_memsize = getenv("MEMSIZE"); - mac68k_machine.do_graybars = getenv("GRAYBARS"); - mac68k_machine.serial_boot_echo = getenv("SERIALECHO"); - mac68k_machine.serial_console = getenv("SERIALCONSOLE"); - - mac68k_machine.modem_flags = getenv("SERIAL_MODEM_FLAGS"); - mac68k_machine.modem_cts_clk = getenv("SERIAL_MODEM_HSKICLK"); - mac68k_machine.modem_dcd_clk = getenv("SERIAL_MODEM_GPICLK"); - mac68k_machine.print_flags = getenv("SERIAL_PRINT_FLAGS"); - mac68k_machine.print_cts_clk = getenv("SERIAL_PRINT_HSKICLK"); - mac68k_machine.print_dcd_clk = getenv("SERIAL_PRINT_GPICLK"); - /* Should probably check this and fail if old */ - mac68k_machine.booter_version = getenv("BOOTERVER"); - - /* - * Get end of symbols for kernel debugging - */ - esym = getenv("END_SYM"); -#ifndef SYMTAB_SPACE - if (esym == 0) -#endif - esym = (long) &end; - - /* Get MacOS time */ - macos_boottime = getenv("BOOTTIME"); - - /* Save GMT BIAS saved in Booter parameters dialog box */ - macos_gmtbias = getenv("GMTBIAS"); - - /* - * Save globals stolen from MacOS - */ - - ROMBase = (caddr_t) getenv("ROMBASE"); - if (ROMBase == (caddr_t) 0) { - ROMBase = (caddr_t) ROMBASE; - } - MacOSROMBase = (unsigned long) ROMBase; - TimeDBRA = getenv("TIMEDBRA"); - ADBDelay = (u_short) getenv("ADBDELAY"); - HwCfgFlags = getenv("HWCFGFLAGS"); - HwCfgFlags2 = getenv("HWCFGFLAG2"); - HwCfgFlags3 = getenv("HWCFGFLAG3"); - ADBReInit_JTBL = getenv("ADBREINIT_JTBL"); - mrg_ADBIntrPtr = (caddr_t) getenv("ADBINTERRUPT"); -} - struct cpu_model_info *current_mac_model; romvec_t *mrg_MacOSROMVectors = 0; @@ -2371,6 +2371,7 @@ setmachdep() static int firstpass = 1; int setup_mrg_vectors = 0; struct cpu_model_info *cpui; + int i; /* * First, set things that need to be set on the first pass only @@ -2388,14 +2389,6 @@ setmachdep() if (!firstpass) return; - /* - * Get the console buffer physical address. If we can't, we - * assume that videoaddr is already a physical address. - * Note that get_physical doesn't yet work on the '040. - */ - if ((mmutype == MMU_68040) || !get_physical(videoaddr, &conspa)) - conspa = videoaddr; - /* * Set up any machine specific stuff that we have to before * ANYTHING else happens @@ -2496,6 +2489,19 @@ setmachdep() break; } + /* + * Set `internal' framebuffer location and length, if we know + * what they are. + */ + for (i = 0; intvid_info[i].machineid; i++) { + if (mac68k_machine.machineid == intvid_info[i].machineid) { + mac68k_vidlog = mac68k_vidphys = + (u_int32_t) intvid_info[i].fbbase; + mac68k_vidlen = (u_int32_t) intvid_info[i].fblen; + break; + } + } + /* * Set up current ROM Glue vectors. Actually now all we do * is save the address of the ROM Glue Vector table. This gets @@ -2589,10 +2595,10 @@ gray_bar() 3) restore regs */ - __asm("movl a0, sp@-"); - __asm("movl a1, sp@-"); - __asm("movl d0, sp@-"); - __asm("movl d1, sp@-"); + __asm __volatile (" movl a0,sp@-; + movl a1,sp@-; + movl d0,sp@-; + movl d1,sp@-"); /* check to see if gray bars are turned off */ if (mac68k_machine.do_graybars) { @@ -2603,15 +2609,16 @@ gray_bar() for (i = 0; i < 2 * videorowbytes / 4; i++) ((u_long *) videoaddr)[gray_nextaddr++] = 0x00000000; } - __asm("movl sp@+, d1"); - __asm("movl sp@+, d0"); - __asm("movl sp@+, a1"); - __asm("movl sp@+, a0"); + + __asm __volatile (" movl sp@+,d1; + movl sp@+,d0; + movl sp@+,a1; + movl sp@+,a0"); } #endif /* in locore */ -extern int ptest040 __P((u_int addr)); +extern u_long ptest040 __P((caddr_t addr, u_int fc)); extern int get_pte __P((u_int addr, u_long pte[2], u_short * psr)); /* @@ -2629,12 +2636,15 @@ get_physical(u_int addr, u_long * phys) extern u_int macos_tc; if (mmutype == MMU_68040) { - ph = ptest040(addr); - if (!(ph & MMU40_RES)) - return 0; + ph = ptest040((caddr_t) addr, FC_SUPERD); + if ((ph & MMU40_RES) == 0) { + ph = ptest040((caddr_t) addr, FC_USERD); + if ((ph & MMU40_RES) == 0) + return 0; + } - *phys = ph; - mask = 0x00000fff; + mask = (macos_tc & 0x4000) ? 0x00001fff : 0x00000fff; + ph &= (~mask); } else { i = get_pte(addr, pte, &psr); @@ -2668,7 +2678,7 @@ get_physical(u_int addr, u_long * phys) */ mask = (1 << (32 - numbits)) - 1; } - *phys = (ph & ~mask) | (addr & mask); + *phys = ph + (addr & mask); return 1; } @@ -2846,6 +2856,12 @@ get_mapping(void) */ check_video("LC video (0x50f40000)", 512 * 1024, 512 * 1024); + } else if (0x50100100 <= videoaddr && videoaddr < 0x50400000) { + /* + * Kludge for AV internal video + */ + check_video("AV video (0x50100100)", 1 * 1024 * 1024, + 1 * 1024 * 1024); } else { printf( " no internal video at address 0 -- " "videoaddr is 0x%lx.\n", videoaddr); @@ -2872,15 +2888,15 @@ printstar(void) * Be careful as we assume that no registers are clobbered * when we call this from assembly. */ - __asm("movl a0, sp@-"); - __asm("movl a1, sp@-"); - __asm("movl d0, sp@-"); - __asm("movl d1, sp@-"); + __asm __volatile (" movl a0,sp@-; + movl a1,sp@-; + movl d0,sp@-; + movl d1,sp@-"); /* printf("*"); */ - __asm("movl sp@+, d1"); - __asm("movl sp@+, d0"); - __asm("movl sp@+, a1"); - __asm("movl sp@+, a0"); + __asm __volatile (" movl sp@+,d1; + movl sp@+,d0; + movl sp@+,a1; + movl sp@+,a0"); } diff --git a/sys/arch/mac68k/mac68k/macrom.c b/sys/arch/mac68k/mac68k/macrom.c index fbed6a2b7fd..dbc19c0a814 100644 --- a/sys/arch/mac68k/mac68k/macrom.c +++ b/sys/arch/mac68k/mac68k/macrom.c @@ -1,5 +1,5 @@ -/* $OpenBSD: macrom.c,v 1.7 1997/01/19 03:58:08 briggs Exp $ */ -/* $NetBSD: macrom.c,v 1.26 1996/08/05 23:20:46 briggs Exp $ */ +/* $OpenBSD: macrom.c,v 1.8 1997/01/24 01:35:49 briggs Exp $ */ +/* $NetBSD: macrom.c,v 1.30 1996/12/18 07:21:06 scottr Exp $ */ /*- * Copyright (C) 1994 Bradley A. Grantham @@ -133,10 +133,10 @@ mrg_Delay() u_int32_t ticks; - __asm(" movl a0, %0" /* get arguments */ - : - : "g" (ticks) - : "a0" ); + __asm volatile (" movl a0, %0" /* get arguments */ + : "=g" (ticks) + : + : "a0" ); #if defined(MRG_DEBUG) printf("mrg: mrg_Delay(%d) = %d ms\n", ticks, ticks * 60); diff --git a/sys/arch/mac68k/mac68k/mainbus.c b/sys/arch/mac68k/mac68k/mainbus.c index 3f5fb06d144..4960713f548 100644 --- a/sys/arch/mac68k/mac68k/mainbus.c +++ b/sys/arch/mac68k/mac68k/mainbus.c @@ -1,13 +1,12 @@ -/* $NetBSD: mainbus.c,v 1.1 1996/06/19 03:21:05 scottr Exp $ */ +/* $OpenBSD: mainbus.c,v 1.4 1997/01/24 01:35:49 briggs Exp $ */ +/* $NetBSD: mainbus.c,v 1.7 1996/12/17 06:47:41 scottr Exp $ */ /* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1982, 1990 The Regents of the University of California. + * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -19,274 +18,75 @@ * 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. - */ -/*- - * Copyright (C) 1996 Allen K. Briggs - * 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 Allen Briggs. - * 4. The names of the Alice Group or any of its members may not be used - * to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include #include #include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -/* - * Generic "bus" support functions. From NetBSD/sun3. - * - * bus_scan: - * This function is passed to config_search() by the attach function - * for each of the "bus" drivers (obio, nubus). - * The purpose of this function is to copy the "locators" into our - * confargs structure, so child drivers may use the confargs both - * as match parameters and as temporary storage for the defaulted - * locator values determined in the child_match and preserved for - * the child_attach function. If the bus attach functions just - * used config_found, then we would not have an opportunity to - * setup the confargs for each child match and attach call. - * - * bus_print: - * Just prints out the final (non-default) locators. - */ -int -bus_scan(parent, child, aux) - struct device *parent; - void *child, *aux; -{ - struct cfdata *cf = child; - struct confargs *ca = aux; - cfmatch_t mf; -#ifdef DIAGNOSTIC - if (parent->dv_cfdata->cf_driver->cd_indirect) - panic("bus_scan: indirect?"); - if (cf->cf_fstate == FSTATE_STAR) - panic("bus_scan: FSTATE_STAR"); -#endif +static int mainbus_match __P((struct device *, struct cfdata *, void *)); +static void mainbus_attach __P((struct device *, struct device *, void *)); +static int mainbus_search __P((struct device *, struct cfdata *, void *)); - /* ca->ca_bustype set by parent */ - - /* - * Note that this allows the match function to save - * defaulted locators in the confargs that will be - * preserved for the related attach call. - */ - mf = cf->cf_attach->ca_match; - if ((*mf)(parent, cf, ca) > 0) { - config_attach(parent, cf, ca, bus_print); - } - return (0); -} - -/* - * From NetBSD/sun3. - * Print out the confargs. The parent name is non-NULL - * when there was no match found by config_found(). - */ -int -bus_print(args, name) - void *args; - const char *name; -{ -/* struct confargs *ca = args; */ - - if (name) - printf("%s:", name); - - return(UNCONF); -} - -vm_offset_t tmp_vpages[1]; - -/* - * Read addr with size len (1,2,4) into val. - * If this generates a bus error, return -1 - * - * Create a temporary mapping, - * Try the access using peek_* - * Clean up temp. mapping - */ -int -bus_peek(bustype, paddr, sz) - int bustype; - vm_offset_t paddr; - int sz; -{ - int off, pte, rv; - vm_offset_t pgva; - caddr_t va; - - if (bustype != BUS_NUBUS) - return -1; - - off = paddr & PGOFSET; - paddr -= off; - pte = (paddr & PG_FRAME) | (PG_V | PG_W | PG_CI); - - pgva = tmp_vpages[0]; - va = (caddr_t)pgva + off; - - mac68k_set_pte(pgva, pte); - TBIS(pgva); - - /* - * OK, try the access using one of the assembly routines - * that will set pcb_onfault and catch any bus errors. - */ - rv = -1; - switch (sz) { - case 1: - if (!badbaddr(va)) - rv = *((u_char *) va); - break; - case 2: - if (!badwaddr(va)) - rv = *((u_int16_t *) va); - break; - case 4: - if (!badladdr(va)) - rv = *((u_int32_t *) va); - break; - default: - printf("bus_peek: invalid size=%d\n", sz); - rv = -1; - } - - mac68k_set_pte(pgva, PG_NV); - TBIS(pgva); +struct cfattach mainbus_ca = { + sizeof(struct device), mainbus_match, mainbus_attach +}; - return rv; -} +struct cfdriver mainbus_cd = { + NULL, "mainbus", DV_DULL +}; -char * -bus_mapin(bustype, paddr, sz) - int bustype, paddr, sz; +static int +mainbus_match(parent, cf, aux) + struct device *parent; + struct cfdata *cf; + void *aux; { - int off, pa, pmt = 0; - vm_offset_t va, retval; - - if (bustype != BUS_NUBUS) - return (NULL); - - off = paddr & PGOFSET; - pa = paddr - off; - sz += off; - sz = mac68k_round_page(sz); - - /* Get some kernel virtual address space. */ - va = kmem_alloc_wait(kernel_map, sz); - if (va == 0) - panic("bus_mapin"); - retval = va + off; + static int mainbus_matched = 0; - /* Map it to the specified bus. */ -#if 0 /* XXX */ - /* This has a problem with wrap-around... */ - pmap_map((int)va, pa | pmt, pa + sz, VM_PROT_ALL); -#else - do { - pmap_enter(pmap_kernel(), va, pa | pmt, VM_PROT_ALL, FALSE); - va += NBPG; - pa += NBPG; - } while ((sz -= NBPG) > 0); -#endif + /* Allow only one instance. */ + if (mainbus_matched) + return (0); - return ((char*)retval); -} - -static int mainbus_match __P((struct device *, void *, void *)); -static void mainbus_attach __P((struct device *parent, - struct device *self, void *aux)); - -static int -mainbus_match(parent, match, aux) - struct device *parent; - void *match, *aux; -{ + mainbus_matched = 1; return 1; } -static int bus_order[] = { - BUS_OBIO, /* For On-board I/O */ - BUS_NUBUS -}; -#define BUS_ORDER_SZ (sizeof(bus_order)/sizeof(bus_order[0])) - static void mainbus_attach(parent, self, aux) struct device *parent, *self; void *aux; { - struct confargs ca; - int i; - printf("\n"); - for (i = 0; i < BUS_ORDER_SZ; i++) { - ca.ca_bustype = bus_order[i]; - (void) config_found(self, &ca, NULL); - } + /* Search for and attach children. */ + config_search(mainbus_search, self, NULL); } -struct cfattach mainbus_ca = { - sizeof(struct device), mainbus_match, mainbus_attach -}; - -struct cfdriver mainbus_cd = { - NULL, "mainbus", DV_DULL -}; +static int +mainbus_search(parent, cf, aux) + struct device *parent; + struct cfdata *cf; + void *aux; +{ + if ((*cf->cf_attach->ca_match)(parent, cf, NULL) > 0) + config_attach(parent, cf, NULL, NULL); + return 0; +} diff --git a/sys/arch/mac68k/mac68k/pmap.c b/sys/arch/mac68k/mac68k/pmap.c index 9c1965f4793..20001f22c53 100644 --- a/sys/arch/mac68k/mac68k/pmap.c +++ b/sys/arch/mac68k/mac68k/pmap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pmap.c,v 1.6 1996/10/28 14:55:33 briggs Exp $ */ -/* $NetBSD: pmap.c,v 1.25 1996/05/07 01:45:22 briggs Exp $ */ +/* $OpenBSD: pmap.c,v 1.7 1997/01/24 01:35:51 briggs Exp $ */ +/* $NetBSD: pmap.c,v 1.28 1996/10/21 05:42:27 scottr Exp $ */ /* * Copyright (c) 1991, 1993 @@ -381,9 +381,9 @@ pmap_init() #ifdef DEBUG if (pmapdebug & PDB_INIT) { - printf("pmap_init: Sysseg %x, Sysmap %x, Sysptmap %x\n", + printf("pmap_init: Sysseg %p, Sysmap %p, Sysptmap %p\n", Sysseg, Sysmap, Sysptmap); - printf(" pstart %x, plast %x, vstart %x, vend %x\n", + printf(" pstart %lx, plast %x, vstart %lx, vend %lx\n", avail_start, avail_remaining, virtual_avail, virtual_end); } #endif @@ -407,7 +407,7 @@ pmap_init() pmap_attributes = (char *) addr; #ifdef DEBUG if (pmapdebug & PDB_INIT) - printf("pmap_init: %x bytes: npages %x s0 %x(%x) tbl %x atr %x\n", + printf("pmap_init: %lx bytes: npages %x s0 %p(%p) tbl %p atr %p\n", s, npages, Segtabzero, Segtabzeropa, pv_table, pmap_attributes); #endif @@ -450,7 +450,7 @@ pmap_init() #endif #ifdef DEBUG if (pmapdebug & PDB_INIT) - printf("pmap_init: KPT: %d pages from %x to %x\n", + printf("pmap_init: KPT: %ld pages from %lx to %lx\n", atop(s), addr, addr + s); #endif @@ -480,7 +480,7 @@ pmap_init() panic("pmap_init: cannot map range to pt_map"); #ifdef DEBUG if (pmapdebug & PDB_INIT) - printf("pmap_init: pt_map [%x - %x)\n", addr, addr2); + printf("pmap_init: pt_map [%lx - %lx)\n", addr, addr2); #endif #if defined(M68040) @@ -631,7 +631,7 @@ pmap_map(va, spa, epa, prot) #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_map(%x, %x, %x, %x)\n", va, spa, epa, prot); + printf("pmap_map(%lx, %lx, %lx, %x)\n", va, spa, epa, prot); #endif while (spa < epa) { @@ -662,7 +662,7 @@ pmap_create(size) #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_CREATE)) - printf("pmap_create(%x)\n", size); + printf("pmap_create(%lx)\n", size); #endif /* @@ -693,7 +693,7 @@ pmap_pinit(pmap) #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_CREATE)) - printf("pmap_pinit(%x)\n", pmap); + printf("pmap_pinit(%p)\n", pmap); #endif /* @@ -729,7 +729,7 @@ pmap_destroy(pmap) #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_destroy(%x)\n", pmap); + printf("pmap_destroy(%p)\n", pmap); #endif simple_lock(&pmap->pm_lock); @@ -753,7 +753,7 @@ pmap_release(pmap) #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_release(%x)\n", pmap); + printf("pmap_release(%p)\n", pmap); #endif #ifdef notdef /* DIAGNOSTIC */ @@ -784,7 +784,7 @@ pmap_reference(pmap) #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_reference(%x)\n", pmap); + printf("pmap_reference(%p)\n", pmap); #endif simple_lock(&pmap->pm_lock); @@ -806,7 +806,7 @@ pmap_activate(pmap, pcbp) #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_SEGTAB)) - printf("pmap_activate(%x, %x)\n", pmap, pcbp); + printf("pmap_activate(%p, %p)\n", pmap, pcbp); #endif PMAP_ACTIVATE(pmap, pcbp, pmap == curproc->p_vmspace->vm_map.pmap); @@ -839,7 +839,7 @@ pmap_remove(pmap, sva, eva) #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT)) - printf("pmap_remove(%x, %x, %x)\n", pmap, sva, eva); + printf("pmap_remove(%p, %lx, %lx)\n", pmap, sva, eva); #endif if (pmap == NULL) @@ -898,8 +898,8 @@ pmap_page_protect(pa, prot) #ifdef DEBUG if ((pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) || - prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE)) - printf("pmap_page_protect(%x, %x)\n", pa, prot); + (prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE))) + printf("pmap_page_protect(%lx, %x)\n", pa, prot); #endif if (!pmap_valid_page (pa)) return; @@ -935,7 +935,7 @@ pmap_page_protect(pa, prot) pv = pv->pv_next; #ifdef DEBUG if (pmapdebug & PDB_PARANOIA) - printf("%s wired mapping for %x not removed\n", + printf("%s wired mapping for %lx not removed\n", "pmap_page_protect:", pa); #endif } @@ -960,7 +960,7 @@ pmap_protect(pmap, sva, eva, prot) #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) - printf("pmap_protect(%x, %x, %x, %x)\n", pmap, sva, eva, prot); + printf("pmap_protect(%p, %lx, %lx, %x)\n", pmap, sva, eva, prot); #endif if (pmap == NULL) @@ -1075,7 +1075,7 @@ pmap_enter(pmap, va, pa, prot, wired) #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_ENTER)) - printf("pmap_enter(%x, %x, %x, %x, %x)\n", + printf("pmap_enter(%p, %lx, %lx, %x, %x)\n", pmap, va, pa, prot, wired); #endif if (pmap == NULL) @@ -1106,7 +1106,7 @@ pmap_enter(pmap, va, pa, prot, wired) opa = pmap_pte_pa(pte); #ifdef DEBUG if (pmapdebug & PDB_ENTER) - printf("enter: pte %x, *pte %x\n", pte, *pte); + printf("enter: pte %p, *pte %x\n", pte, *pte); #endif /* @@ -1158,7 +1158,7 @@ pmap_enter(pmap, va, pa, prot, wired) if (opa) { #ifdef DEBUG if (pmapdebug & PDB_ENTER) - printf("enter: removing old mapping %x\n", va); + printf("enter: removing old mapping %lx\n", va); #endif pmap_remove_mapping(pmap, va, pte, PRM_TFLUSH|PRM_CFLUSH); #ifdef PMAPSTATS @@ -1191,7 +1191,7 @@ pmap_enter(pmap, va, pa, prot, wired) s = splimp(); #ifdef DEBUG if (pmapdebug & PDB_ENTER) - printf("enter: pv at %x: %x/%x/%x\n", + printf("enter: pv at %p: %lx/%p/%p\n", pv, pv->pv_va, pv->pv_pmap, pv->pv_next); #endif /* @@ -1315,7 +1315,7 @@ pmap_change_wiring(pmap, va, wired) #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_change_wiring(%x, %x, %x)\n", pmap, va, wired); + printf("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired); #endif if (pmap == NULL) return; @@ -1329,7 +1329,7 @@ pmap_change_wiring(pmap, va, wired) */ if (!pmap_ste_v(pmap, va)) { if (pmapdebug & PDB_PARANOIA) - printf("pmap_change_wiring: invalid STE for %x\n", va); + printf("pmap_change_wiring: invalid STE for %lx\n", va); return; } /* @@ -1338,7 +1338,7 @@ pmap_change_wiring(pmap, va, wired) */ if (!pmap_pte_v(pte)) { if (pmapdebug & PDB_PARANOIA) - printf("pmap_change_wiring: invalid PTE for %x\n", va); + printf("pmap_change_wiring: invalid PTE for %lx\n", va); } #endif /* @@ -1371,7 +1371,7 @@ pmap_extract(pmap, va) #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_extract(%x, %x) -> ", pmap, va); + printf("pmap_extract(%p, %lx) -> ", pmap, va); #endif pa = 0; if (pmap && pmap_ste_v(pmap, va)) @@ -1380,7 +1380,7 @@ pmap_extract(pmap, va) pa = (pa & PG_FRAME) | (va & ~PG_FRAME); #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("%x\n", pa); + printf("%lx\n", pa); #endif return(pa); } @@ -1401,7 +1401,7 @@ void pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr) { #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_copy(%x, %x, %x, %x, %x)\n", + printf("pmap_copy(%p, %p, %lx, %lx, %lx)\n", dst_pmap, src_pmap, dst_addr, len, src_addr); #endif } @@ -1456,7 +1456,7 @@ pmap_zero_page(phys) #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_zero_page(%x)\n", phys); + printf("pmap_zero_page(%lx)\n", phys); #endif kva = (vm_offset_t) CADDR1; pmap_enter(pmap_kernel(), kva, phys, VM_PROT_READ|VM_PROT_WRITE, TRUE); @@ -1481,7 +1481,7 @@ void copypage __P((caddr_t, caddr_t)); #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_copy_page(%x, %x)\n", src, dst); + printf("pmap_copy_page(%lx, %lx)\n", src, dst); #endif skva = (vm_offset_t) CADDR1; dkva = (vm_offset_t) CADDR2; @@ -1515,7 +1515,7 @@ pmap_pageable(pmap, sva, eva, pageable) { #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_pageable(%x, %x, %x, %x)\n", + printf("pmap_pageable(%p, %lx, %lx, %x)\n", pmap, sva, eva, pageable); #endif /* @@ -1532,7 +1532,7 @@ pmap_pageable(pmap, sva, eva, pageable) #ifdef DEBUG if ((pmapdebug & (PDB_FOLLOW|PDB_PTPAGE)) == PDB_PTPAGE) - printf("pmap_pageable(%x, %x, %x, %x)\n", + printf("pmap_pageable(%p, %lx, %lx, %x)\n", pmap, sva, eva, pageable); #endif if (!pmap_ste_v(pmap, sva)) @@ -1545,7 +1545,7 @@ pmap_pageable(pmap, sva, eva, pageable) return; #ifdef DEBUG if (pv->pv_va != sva || pv->pv_next) { - printf("pmap_pageable: bad PT page va %x next %x\n", + printf("pmap_pageable: bad PT page va %lx next %p\n", pv->pv_va, pv->pv_next); return; } @@ -1556,12 +1556,12 @@ pmap_pageable(pmap, sva, eva, pageable) pmap_changebit(pa, PG_M, FALSE); #ifdef DEBUG if ((PHYS_TO_VM_PAGE(pa)->flags & PG_CLEAN) == 0) { - printf("pa %x: flags=%x: not clean\n", + printf("pa %lx: flags=%x: not clean\n", pa, PHYS_TO_VM_PAGE(pa)->flags); PHYS_TO_VM_PAGE(pa)->flags |= PG_CLEAN; } if (pmapdebug & PDB_PTPAGE) - printf("pmap_pageable: PT page %x(%x) unmodified\n", + printf("pmap_pageable: PT page %lx(%x) unmodified\n", sva, *pmap_pte(pmap, sva)); if (pmapdebug & PDB_WIRING) pmap_check_wiring("pageable", sva); @@ -1579,7 +1579,7 @@ pmap_clear_modify(pa) { #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_clear_modify(%x)\n", pa); + printf("pmap_clear_modify(%lx)\n", pa); #endif pmap_changebit(pa, PG_M, FALSE); } @@ -1595,7 +1595,7 @@ void pmap_clear_reference(pa) { #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_clear_reference(%x)\n", pa); + printf("pmap_clear_reference(%lx)\n", pa); #endif pmap_changebit(pa, PG_U, FALSE); } @@ -1614,7 +1614,7 @@ pmap_is_referenced(pa) #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) { boolean_t rv = pmap_testbit(pa, PG_U); - printf("pmap_is_referenced(%x) -> %c\n", pa, "FT"[rv]); + printf("pmap_is_referenced(%lx) -> %c\n", pa, "FT"[rv]); return(rv); } #endif @@ -1635,7 +1635,7 @@ pmap_is_modified(pa) #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) { boolean_t rv = pmap_testbit(pa, PG_M); - printf("pmap_is_modified(%x) -> %c\n", pa, "FT"[rv]); + printf("pmap_is_modified(%lx) -> %c\n", pa, "FT"[rv]); return(rv); } #endif @@ -1676,7 +1676,7 @@ pmap_remove_mapping(pmap, va, pte, flags) pt_entry_t opte; if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT)) - printf("pmap_remove_mapping(%x, %x, %x, %x)\n", + printf("pmap_remove_mapping(%p, %lx, %p, %x)\n", pmap, va, pte, flags); #endif @@ -1707,7 +1707,7 @@ pmap_remove_mapping(pmap, va, pte, flags) */ #ifdef DEBUG if (pmapdebug & PDB_REMOVE) - printf("remove: invalidating pte at %x\n", pte); + printf("remove: invalidating pte at %p\n", pte); #endif bits = *pte & (PG_U|PG_M); *pte = PG_NV; @@ -1788,7 +1788,7 @@ pmap_remove_mapping(pmap, va, pte, flags) #endif #ifdef DEBUG if (pmapdebug & (PDB_REMOVE|PDB_PTPAGE)) - printf("remove: ste was %x@%x pte was %x@%x\n", + printf("remove: ste was %x@%p pte was %x@%p\n", *ste, ste, opte, pmap_pte(pmap, va)); #endif #if defined(M68040) @@ -1811,7 +1811,7 @@ pmap_remove_mapping(pmap, va, pte, flags) if (ptpmap != pmap_kernel()) { #ifdef DEBUG if (pmapdebug & (PDB_REMOVE|PDB_SEGTAB)) - printf("remove: stab %x, refcnt %d\n", + printf("remove: stab %p, refcnt %d\n", ptpmap->pm_stab, ptpmap->pm_sref - 1); if ((pmapdebug & PDB_PARANOIA) && ptpmap->pm_stab != (st_entry_t *)trunc_page(ste)) @@ -1820,7 +1820,7 @@ pmap_remove_mapping(pmap, va, pte, flags) if (--(ptpmap->pm_sref) == 0) { #ifdef DEBUG if (pmapdebug&(PDB_REMOVE|PDB_SEGTAB)) - printf("remove: free stab %x\n", + printf("remove: free stab %p\n", ptpmap->pm_stab); #endif kmem_free_wakeup(st_map, @@ -1927,7 +1927,7 @@ pmap_changebit(pa, bit, setem) #ifdef DEBUG if (pmapdebug & PDB_BITS) - printf("pmap_changebit(%x, %x, %s)\n", + printf("pmap_changebit(%lx, %x, %s)\n", pa, bit, setem ? "set" : "clear"); #endif if (!pmap_valid_page (pa)) @@ -2026,7 +2026,7 @@ pmap_enter_ptpage(pmap, va) #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_ENTER|PDB_PTPAGE)) - printf("pmap_enter_ptpage: pmap %x, va %x\n", pmap, va); + printf("pmap_enter_ptpage: pmap %p, va %lx\n", pmap, va); #endif #ifdef PMAPSTATS enter_stats.ptpneeded++; @@ -2061,7 +2061,7 @@ pmap_enter_ptpage(pmap, va) PMAP_ACTIVATE(pmap, &curproc->p_addr->u_pcb, 1); #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB)) - printf("enter: pmap %x stab %x(%x)\n", + printf("enter: pmap %p stab %p(%p)\n", pmap, pmap->pm_stab, pmap->pm_stpa); #endif } @@ -2086,7 +2086,7 @@ pmap_enter_ptpage(pmap, va) *ste = (u_int)addr | SG_RW | SG_U | SG_V; #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB)) - printf("enter: alloc ste2 %d(%x)\n", ix, addr); + printf("enter: alloc ste2 %d(%p)\n", ix, addr); #endif } ste = pmap_ste2(pmap, va); @@ -2101,7 +2101,7 @@ pmap_enter_ptpage(pmap, va) ste = (st_entry_t *)((int)ste & ~(NBPG/SG4_LEV3SIZE-1)); #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB)) - printf("enter: ste2 %x (%x)\n", + printf("enter: ste2 %p (%p)\n", pmap_ste2(pmap, va), ste); #endif } @@ -2144,7 +2144,7 @@ pmap_enter_ptpage(pmap, va) if (pmapdebug & (PDB_ENTER|PDB_PTPAGE)) { int ix = pmap_ste(pmap, va) - pmap_ste(pmap, 0); - printf("enter: add &Sysptmap[%d]: %x (KPT page %x)\n", + printf("enter: add &Sysptmap[%d]: %x (KPT page %lx)\n", ix, Sysptmap[ix], kpt->kpt_va); } #endif @@ -2162,7 +2162,7 @@ pmap_enter_ptpage(pmap, va) pmap->pm_sref++; #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE)) - printf("enter: about to fault UPT pg at %x\n", va); + printf("enter: about to fault UPT pg at %lx\n", va); #endif s = vm_fault(pt_map, va, VM_PROT_READ|VM_PROT_WRITE, FALSE); if (s != KERN_SUCCESS) { @@ -2192,7 +2192,7 @@ pmap_enter_ptpage(pmap, va) #ifdef DEBUG pt_entry_t *pte = pmap_pte(pmap_kernel(), va); if ((pmapdebug & PDB_PARANOIA) && (*pte & PG_CCB) == 0) - printf("%s PT no CCB: kva=%x ptpa=%x pte@%x=%x\n", + printf("%s PT no CCB: kva=%lx ptpa=%lx pte@%p=%x\n", pmap == pmap_kernel() ? "Kernel" : "User", va, ptpa, pte, *pte); #endif @@ -2221,7 +2221,7 @@ pmap_enter_ptpage(pmap, va) pv->pv_ptpmap = pmap; #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE)) - printf("enter: new PT page at PA %x, ste at %x\n", ptpa, ste); + printf("enter: new PT page at PA %lx, ste at %p\n", ptpa, ste); #endif /* @@ -2246,7 +2246,7 @@ pmap_enter_ptpage(pmap, va) if (pmap != pmap_kernel()) { #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB)) - printf("enter: stab %x refcnt %d\n", + printf("enter: stab %p refcnt %d\n", pmap->pm_stab, pmap->pm_sref); #endif } @@ -2271,9 +2271,9 @@ pmap_pvdump(pa) { register struct pv_entry *pv; - printf("pa %x", pa); + printf("pa %lx", pa); for (pv = pa_to_pvh(pa); pv; pv = pv->pv_next) - printf(" -> pmap %x, va %x, ptste %x, ptpmap %x, flags %x", + printf(" -> pmap %p, va %lx, ptste %p, ptpmap %p, flags %x", pv->pv_pmap, pv->pv_va, pv->pv_ptste, pv->pv_ptpmap, pv->pv_flags); printf("\n"); @@ -2295,7 +2295,7 @@ pmap_check_wiring(str, va) return; if (!vm_map_lookup_entry(pt_map, va, &entry)) { - printf("wired_check: entry for %x not found\n", va); + printf("wired_check: entry for %lx not found\n", va); return; } count = 0; @@ -2303,7 +2303,7 @@ pmap_check_wiring(str, va) if (*pte) count++; if (entry->wired_count != count) - printf("*%s*: %x: w%d/a%d\n", + printf("*%s*: %lx: w%d/a%d\n", str, va, entry->wired_count, count); } #endif diff --git a/sys/arch/mac68k/mac68k/pmap_bootstrap.c b/sys/arch/mac68k/mac68k/pmap_bootstrap.c index a764a7ecd7c..6f7a21eb312 100644 --- a/sys/arch/mac68k/mac68k/pmap_bootstrap.c +++ b/sys/arch/mac68k/mac68k/pmap_bootstrap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pmap_bootstrap.c,v 1.6 1996/10/28 14:55:34 briggs Exp $ */ -/* $NetBSD: pmap_bootstrap.c,v 1.26 1996/05/18 18:54:52 briggs Exp $ */ +/* $OpenBSD: pmap_bootstrap.c,v 1.7 1997/01/24 01:35:52 briggs Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.30 1997/01/07 07:44:01 scottr Exp $ */ /* * Copyright (c) 1991, 1993 @@ -572,7 +572,8 @@ bootstrap_mac68k(tc) oldROMBase = ROMBase; mac68k_vidphys = videoaddr; - if ((tc & 0x80000000) && (mmutype == MMU_68030)) { + if (((tc & 0x80000000) && (mmutype == MMU_68030)) || + ((tc & 0x8000) && (mmutype == MMU_68040))) { if (mac68k_machine.do_graybars) printf("Getting mapping from MMU.\n"); diff --git a/sys/arch/mac68k/mac68k/pram.c b/sys/arch/mac68k/mac68k/pram.c index e191a00fc69..86c1faf4f56 100644 --- a/sys/arch/mac68k/mac68k/pram.c +++ b/sys/arch/mac68k/mac68k/pram.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pram.c,v 1.3 1996/05/26 18:36:30 briggs Exp $ */ -/* $NetBSD: pram.c,v 1.8 1996/03/31 14:21:03 scottr Exp $ */ +/* $OpenBSD: pram.c,v 1.4 1997/01/24 01:35:52 briggs Exp $ */ +/* $NetBSD: pram.c,v 1.11 1996/10/21 05:42:29 scottr Exp $ */ /*- * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, @@ -37,12 +37,15 @@ /* #include "stand.h" */ #include +#ifdef DEBUG +#include +#endif #include #include "pram.h" #include "macrom.h" #if DEBUG -char *convtime(unsigned long t) +static char *convtime(unsigned long t) { static long daypmon[] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; static char *monstr[] = {"January","February","March","April","May","June", @@ -111,7 +114,7 @@ char *convtime(unsigned long t) t=0; } - sprintf(s,"%s %d, %d %d:%d:%d",monstr[month],day,year,hour,minute,seconds); + sprintf(s,"%s %ld, %ld %ld:%ld:%ld",monstr[month],day,year,hour,minute,seconds); return s; } @@ -128,7 +131,7 @@ pram_readtime(void) else timedata = getPramTime(); #if DEBUG - printf("time read from PRAM: 0x%x\n", timedata); + printf("time read from PRAM: 0x%lx\n", timedata); printf("Date and time: %s\n",convtime(timedata)); #endif diff --git a/sys/arch/mac68k/mac68k/trap.c b/sys/arch/mac68k/mac68k/trap.c index ae8c337abf3..745c798c7e5 100644 --- a/sys/arch/mac68k/mac68k/trap.c +++ b/sys/arch/mac68k/mac68k/trap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: trap.c,v 1.6 1997/01/19 03:58:09 briggs Exp $ */ -/* $NetBSD: trap.c,v 1.41 1996/10/17 06:42:44 scottr Exp $ */ +/* $OpenBSD: trap.c,v 1.7 1997/01/24 01:35:53 briggs Exp $ */ +/* $NetBSD: trap.c,v 1.45 1997/01/20 04:30:05 scottr Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -133,14 +133,14 @@ int mmupid = -1; void trap __P((int, unsigned, register unsigned, struct frame)); void syscall __P((register_t, struct frame)); -static __inline void userret __P((register struct proc *, - register struct frame *, - u_quad_t, u_int, int)); +static inline void userret __P((struct proc *p, struct frame *fp, + u_quad_t oticks, u_int faultaddr, int fromtrap)); #if defined(M68040) static int writeback __P((struct frame *, int)); #if DEBUG -static int dumpssw __P((register u_short)); +static void dumpssw __P((register u_short)); +static void dumpwb __P((int, u_short, u_int, u_int)); #endif #endif @@ -193,7 +193,7 @@ again: extern int psratio; addupc_task(p, fp->f_pc, - (int)(p->p_sticks - oticks) * psratio); + (int)(p->p_sticks - oticks) * psratio); } #if defined(M68040) /* @@ -254,14 +254,16 @@ trap(type, code, v, frame) type |= T_USER; sticks = p->p_sticks; p->p_md.md_regs = frame.f_regs; - } + } else + sticks = 0; /* I have verified that this DOES happen! -gwr */ if (p == NULL) p = &proc0; #ifdef DIAGNOSTIC if (p->p_addr == NULL) - panic("trap: no pcb"); + panic("trap: type 0x%x, code 0x%x, v 0x%x--no pcb\n", + type, code, v); #endif switch (type) { @@ -428,10 +430,8 @@ copyfault: * fpu operations. So far, just ignore it, but * DONT trap on it.. */ - if (p->p_emul == &emul_sunos) { - userret(p, &frame, sticks, v, 1); - return; - } + if (p->p_emul == &emul_sunos) + goto out; #endif frame.f_sr &= ~PSL_T; i = SIGTRAP; @@ -538,7 +538,7 @@ copyfault: rv = vm_fault(map, va, ftype, FALSE); #ifdef DEBUG if (rv && MDB_ISPID(p->p_pid)) - printf("vm_fault(%x, %x, %x, 0) -> %x\n", + printf("vm_fault(%p, %lx, %x, 0) -> %x\n", map, va, ftype, rv); #endif /* @@ -583,7 +583,8 @@ copyfault: break; } } - if (i) trapsignal(p, i, ucode); + if (i) + trapsignal(p, i, ucode); if ((type & T_USER) == 0) return; out: @@ -843,7 +844,7 @@ writeback(fp, docachepush) } #ifdef DEBUG -static int +static void dumpssw(ssw) register u_short ssw; { @@ -870,7 +871,8 @@ dumpssw(ssw) f7tm[ssw & SSW4_TMMASK]); } -int +static +void dumpwb(num, s, a, d) int num; u_short s; @@ -887,7 +889,7 @@ dumpwb(num, s, a, d) if (pa == 0) printf(""); else - printf("%x, current value %x", pa, fuword((caddr_t)a)); + printf("%lx, current value %lx", pa, fuword((caddr_t)a)); printf("\n"); } #endif diff --git a/sys/arch/mac68k/mac68k/via.c b/sys/arch/mac68k/mac68k/via.c index a0c54d4d7b6..97b32dbf528 100644 --- a/sys/arch/mac68k/mac68k/via.c +++ b/sys/arch/mac68k/mac68k/via.c @@ -1,5 +1,5 @@ -/* $OpenBSD: via.c,v 1.11 1996/10/30 05:36:21 briggs Exp $ */ -/* $NetBSD: via.c,v 1.48 1996/06/21 06:12:45 scottr Exp $ */ +/* $OpenBSD: via.c,v 1.12 1997/01/24 01:35:54 briggs Exp $ */ +/* $NetBSD: via.c,v 1.55 1997/01/07 07:45:45 scottr Exp $ */ /*- * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, @@ -148,15 +148,28 @@ VIA_initialize() } /* - * unlock nubus and set vPCR for SCSI interrupts. + * Set vPCR for SCSI interrupts. */ via2_reg(vPCR) = 0x66; - via2_reg(vBufB) |= 0x02; - via2_reg(vDirB) |= 0x02; + switch(mac68k_machine.machineid) { + case MACH_MACPB140: + case MACH_MACPB145: + case MACH_MACPB150: + case MACH_MACPB160: + case MACH_MACPB165: + case MACH_MACPB165C: + case MACH_MACPB170: + case MACH_MACPB180: + case MACH_MACPB180C: + break; + default: + via2_reg(vBufB) |= 0x02; /* Unlock NuBus */ + via2_reg(vDirB) |= 0x02; + break; + } real_via2_intr = via2_intr; via2itab[1] = via2_nubus_intr; - } else { /* RBV */ if (current_mac_model->class == MACH_CLASSIIci) { /*