-# $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
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
# 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 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
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
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
-# $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
#
LD?= ld
MKDEP?= mkdep
STRIP?= strip -d
+COPTS?= -O2
TOUCH?= touch -f -c
# source tree is located via $S relative to the compilation directory
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
-# $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
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
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
-# $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
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
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
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
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}
-# $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.
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
-/* $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
/*
* 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 *));
/*
};
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;
}
-/* $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
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)
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++)
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);
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
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++) {
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
}
-/* $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
/* 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));
-/* $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,
#include <sys/systm.h>
#include <sys/param.h>
#include <sys/device.h>
+
+#include <machine/autoconf.h>
#include <machine/cpu.h>
#include "ascvar.h"
/* 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 = {
};
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;
}
void *aux;
{
printf(" Apple sound chip.\n");
+ asc_configured = 1;
}
int
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. */
int *length;
int *volume;
{
+ if (!asc_configured) return (ENODEV);
+
*freq = bell_freq;
*length = bell_length;
*volume = bell_volume;
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) {
int i;
unsigned long freq;
+ if (!asc_configured) return (ENODEV);
+
if (bell_ringing == 0) {
for (i = 0; i < 0x800; i++)
ASCBase[i] = 0;
-/* $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.
#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 = {
#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;
-/* $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.
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));
sizeof(struct grfbus_softc), grfiv_match, grfiv_attach
};
+/* XXX -- kludge */
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_map.h>
+
static void
grfiv_q700intr(client_data, slot)
void *client_data;
}
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;
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:
-/* $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.
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 = {
}
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;
/*
* proceed like it is.
*/
- sc->card_id = slottype.drhw;
-
- sc->sc_slot = *slot;
-
- /* Need to load display info (and driver?), etc... */
-
return 1;
}
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) {
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;
-/* $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
*
* Adapted for MacBSD by Brad Parker <brad@fcr.com>.
*
- * Currently supports:
- * Apples NB Ethernet card
- * Interlan A310 Nubus Ethernet card
- * Cayman Systems GatorCard
- * Asante MacCon II/E
*/
#include "bpfilter.h"
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));
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 = {
}
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
}
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 */
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 */
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:
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;
}
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);
/* 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));
-/* $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 $ */
/*
#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 */
-/* $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.
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
static int polledkey;
extern int adb_polling;
-extern u_long conspa;
+extern u_int32_t mac68k_vidphys;
struct tty *ite_tty; /* Our tty */
len = y;
break;
case 2: /* Whole screen */
+ default:
len = scrrows;
break;
}
};
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;
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
-/* $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
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));
}
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;
-/* $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.
* 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
};
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
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
-/* $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
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
+#include <sys/buf.h>
+#include <sys/conf.h>
+#include <sys/dmap.h>
+
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_map.h>
#include <machine/autoconf.h>
+#include <machine/vmparam.h>
+#include <machine/param.h>
#include <machine/cpu.h>
-
-#include <vm/vm.h>
+#include <machine/pte.h>
#include "nubus.h"
#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));
#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
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;
* 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);
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);
+}
-/* $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.
#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;
};
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;
-/* $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:
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Adam Glass and Gordon Ross.
- * 4. The name of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <machine/autoconf.h>
-#include <machine/pte.h>
+#include <mac68k/dev/obiovar.h>
-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
};
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
{
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);
}
--- /dev/null
+/* $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 */
+};
-/* $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
* 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
#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));
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
{
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. */
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);
}
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 */
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.
dh->dh_addr += count;
dh->dh_len -= count;
- }
+ } else
+ count = 0;
#ifdef SBC_DEBUG
if (sbc_debug & SBC_DB_INTR)
}
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
drq = (volatile u_int8_t *) sc->sc_drq_addr;
}
tmp = *drq;
+#endif
} else { /* Data In */
/*
* Get the dest address aligned.
-/* $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
/* 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 = {
* 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. */
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.
-/* $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
****************************************************************/
/* 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));
* 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;
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;
*/
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;
-/* $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
* 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 */
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));
-/* $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.
/*
* 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
-/* $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_
-/* $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,
-/* $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.
#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 */
-/* $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
#include <ufs/ffs/ffs_extern.h>
+#include "ether.h"
struct device *booted_device;
int booted_partition;
bootdv = booted_device;
bootpartition = booted_partition;
+ rootdv = swapdv = NULL; /* XXX work around gcc warning */
#ifdef DEBUG
printf("boot device: %s\n",
#if defined(NFSCLIENT)
case DV_IFNET:
mountroot = nfs_mountroot;
+#if NETHER > 0
nfsbootdevname = rootdv->dv_xname;
+#endif
return;
#endif
#if defined(FFS)
-/* $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.
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
}
/*
- * 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
-/* $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 $ */
/*
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);
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);
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 */
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]);
-/* $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:
* 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.
*/
/*
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));
};
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;
}
-/* $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.
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);
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);
}
-/* $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.
.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
/*
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
/*
* 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.
*/
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
_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)
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().
.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
* 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.
*/
.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
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
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
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
| 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:
.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
-/* $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.
volatile u_char *Via1Base, *Via2Base;
u_long NuBusBase = NBBASE;
u_long IOBase;
-u_long conspa;
vm_offset_t SCSIBase;
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
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));
}
}
-static long getenv __P((char *));
-
static long
getenv(str)
char *str;
{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
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);
}
{
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--;
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;
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
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
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
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) {
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));
/*
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);
*/
mask = (1 << (32 - numbits)) - 1;
}
- *phys = (ph & ~mask) | (addr & mask);
+ *phys = ph + (addr & mask);
return 1;
}
*/
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);
* 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");
}
-/* $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
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);
-/* $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
* 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 <sys/param.h>
#include <sys/device.h>
#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/dmap.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_map.h>
-
-#include <machine/autoconf.h>
-#include <machine/vmparam.h>
-#include <machine/param.h>
-#include <machine/cpu.h>
-#include <machine/pte.h>
-
-/*
- * 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;
+}
-/* $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
#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
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
#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
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)
#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) {
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_create(%x)\n", size);
+ printf("pmap_create(%lx)\n", size);
#endif
/*
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_pinit(%x)\n", pmap);
+ printf("pmap_pinit(%p)\n", pmap);
#endif
/*
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_destroy(%x)\n", pmap);
+ printf("pmap_destroy(%p)\n", pmap);
#endif
simple_lock(&pmap->pm_lock);
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_release(%x)\n", pmap);
+ printf("pmap_release(%p)\n", pmap);
#endif
#ifdef notdef /* DIAGNOSTIC */
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_reference(%x)\n", pmap);
+ printf("pmap_reference(%p)\n", pmap);
#endif
simple_lock(&pmap->pm_lock);
#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);
#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)
#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;
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
}
#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)
#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)
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
/*
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
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
/*
#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;
*/
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;
}
/*
*/
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
/*
#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))
pa = (pa & PG_FRAME) | (va & ~PG_FRAME);
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("%x\n", pa);
+ printf("%lx\n", pa);
#endif
return(pa);
}
{
#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
}
#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);
#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;
{
#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
/*
#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))
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;
}
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);
{
#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);
}
{
#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);
}
#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
#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
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
*/
#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;
#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)
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))
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,
#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))
#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++;
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
}
*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);
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
}
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
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) {
#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
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
/*
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
}
{
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");
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;
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
-/* $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
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");
-/* $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,
/* #include "stand.h" */
#include <sys/types.h>
+#ifdef DEBUG
+#include <sys/systm.h>
+#endif
#include <machine/viareg.h>
#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",
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;
}
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
-/* $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.
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
extern int psratio;
addupc_task(p, fp->f_pc,
- (int)(p->p_sticks - oticks) * psratio);
+ (int)(p->p_sticks - oticks) * psratio);
}
#if defined(M68040)
/*
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) {
* 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;
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
/*
break;
}
}
- if (i) trapsignal(p, i, ucode);
+ if (i)
+ trapsignal(p, i, ucode);
if ((type & T_USER) == 0)
return;
out:
}
#ifdef DEBUG
-static int
+static void
dumpssw(ssw)
register u_short ssw;
{
f7tm[ssw & SSW4_TMMASK]);
}
-int
+static
+void
dumpwb(num, s, a, d)
int num;
u_short s;
if (pa == 0)
printf("<invalid address>");
else
- printf("%x, current value %x", pa, fuword((caddr_t)a));
+ printf("%lx, current value %lx", pa, fuword((caddr_t)a));
printf("\n");
}
#endif
-/* $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,
}
/*
- * 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) {
/*