diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-01-13 19:36:48 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-01-13 19:36:48 +0000 |
commit | 0528b1a2b8abd8de0f88c225d327ba2d5884c90b (patch) | |
tree | 9c4a2f5a2930fe18c477736e4684dfdfa73cb7e1 /sys/arch/mac68k | |
parent | 3936daf17c6123de11a564c6c457f1d88eb1407d (diff) |
Remove the Mac Rom Glue code completely. With the ADB ``direct'' code being
used by default, and since all PRAM accesses are either directly fiddling
with VIA registers or through ADB commands, the MRG code has no reason to
stay. This means the kernel is now not running unknown PROM code anymore.
Diffstat (limited to 'sys/arch/mac68k')
26 files changed, 136 insertions, 3575 deletions
diff --git a/sys/arch/mac68k/conf/GENERIC b/sys/arch/mac68k/conf/GENERIC index 2e494e02636..e3be16927c1 100644 --- a/sys/arch/mac68k/conf/GENERIC +++ b/sys/arch/mac68k/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.44 2006/01/09 20:51:45 miod Exp $ +# $OpenBSD: GENERIC,v 1.45 2006/01/13 19:36:41 miod Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -22,7 +22,6 @@ option FPSP option FPU_EMULATE option COMPAT_SUNOS # SunOS m68k binary compatibility option ADBVERBOSE -#option MRG_ADB # Use ROM-based ADB driver option WSDISPLAY_COMPAT_RAWKBD config bsd swap generic diff --git a/sys/arch/mac68k/conf/RAMDISK b/sys/arch/mac68k/conf/RAMDISK index ed5d282a06a..baf08b67f5e 100644 --- a/sys/arch/mac68k/conf/RAMDISK +++ b/sys/arch/mac68k/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.20 2006/01/09 20:51:45 miod Exp $ +# $OpenBSD: RAMDISK,v 1.21 2006/01/13 19:36:41 miod Exp $ # # RAMDISK - bsd.rd configuration file (non-SBC version) @@ -33,7 +33,6 @@ option M68030 option M68020 # Must have 68851 PMMU option FPSP option FPU_EMULATE -#option MRG_ADB # Use ROM-based ADB driver config bsd root on rd0a maxusers 32 diff --git a/sys/arch/mac68k/conf/files.mac68k b/sys/arch/mac68k/conf/files.mac68k index 43798857dff..319d2c4d597 100644 --- a/sys/arch/mac68k/conf/files.mac68k +++ b/sys/arch/mac68k/conf/files.mac68k @@ -1,4 +1,4 @@ -# $OpenBSD: files.mac68k,v 1.38 2006/01/09 20:51:45 miod Exp $ +# $OpenBSD: files.mac68k,v 1.39 2006/01/13 19:36:41 miod Exp $ # $NetBSD: files.mac68k,v 1.61 1997/03/01 20:22:16 scottr Exp $ # mac68k-specific configuration info @@ -22,7 +22,6 @@ file arch/mac68k/dev/nubus.c nubus device adb {} attach adb at obio file arch/mac68k/dev/adb.c adb -file arch/mac68k/dev/adbsysasm.s adb & mrg_adb file arch/mac68k/dev/adb_direct.c adb file arch/mac68k/dev/pm_direct.c @@ -107,8 +106,6 @@ file arch/mac68k/mac68k/conf.c file arch/mac68k/mac68k/disksubr.c disk file arch/mac68k/mac68k/intr.c file arch/mac68k/mac68k/machdep.c -file arch/mac68k/mac68k/macrom.c -file arch/mac68k/mac68k/macromasm.s file arch/mac68k/mac68k/mainbus.c file arch/mac68k/mac68k/mem.c file arch/m68k/m68k/pmap_motorola.c diff --git a/sys/arch/mac68k/dev/adb.c b/sys/arch/mac68k/dev/adb.c index be72a3f6522..aa8918ba0e7 100644 --- a/sys/arch/mac68k/dev/adb.c +++ b/sys/arch/mac68k/dev/adb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adb.c,v 1.17 2006/01/08 17:45:29 miod Exp $ */ +/* $OpenBSD: adb.c,v 1.18 2006/01/13 19:36:43 miod Exp $ */ /* $NetBSD: adb.c,v 1.47 2005/06/16 22:43:36 jmc Exp $ */ /* @@ -109,35 +109,6 @@ adb_attach_deferred(void *v) printf("%s", self->dv_xname); adb_polling = 1; -#ifdef MRG_ADB - if (!mrg_romready()) { - printf(": no ROM ADB driver in this kernel for this machine\n"); - return; - } - -#ifdef ADB_DEBUG - if (adb_debug) - printf("adb: call mrg_initadbintr\n"); -#endif - - mrg_initadbintr(); /* Mac ROM Glue okay to do ROM intr */ -#ifdef ADB_DEBUG - if (adb_debug) - printf("adb: returned from mrg_initadbintr\n"); -#endif - - /* ADBReInit pre/post-processing */ - JADBProc = adb_jadbproc; - - /* Initialize ADB */ -#ifdef ADB_DEBUG - if (adb_debug) - printf("adb: calling ADBAlternateInit.\n"); -#endif - - printf(": mrg"); - ADBAlternateInit(); -#else ADBReInit(); printf(": %s", adbHardwareDescr[adbHardware]); @@ -146,8 +117,6 @@ adb_attach_deferred(void *v) printf("adb: done with ADBReInit\n"); #endif -#endif /* MRG_ADB */ - totaladbs = CountADBs(); printf(", %d target%s\n", totaladbs, (totaladbs == 1) ? "" : "s"); @@ -292,16 +261,8 @@ adb_op_sync(Ptr buffer, Ptr compRout, Ptr data, short command) * This function is used by the adb_op_sync routine so it knows when the * function is done. */ -#ifdef MRG_ADB -void -adb_op_comprout(void) -{ - asm("movw #1,a2@ | update flag value"); -} -#else void adb_op_comprout(caddr_t buffer, caddr_t data_area, int adb_command) { *(u_short *)data_area = 0x01; /* update flag value */ } -#endif diff --git a/sys/arch/mac68k/dev/adb_direct.c b/sys/arch/mac68k/dev/adb_direct.c index 4a5bd17fe6f..e0c7d6459cf 100644 --- a/sys/arch/mac68k/dev/adb_direct.c +++ b/sys/arch/mac68k/dev/adb_direct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adb_direct.c,v 1.17 2006/01/08 17:45:29 miod Exp $ */ +/* $OpenBSD: adb_direct.c,v 1.18 2006/01/13 19:36:43 miod Exp $ */ /* $NetBSD: adb_direct.c,v 1.51 2005/06/16 22:43:36 jmc Exp $ */ /* From: adb_direct.c 2.02 4/18/97 jpw */ @@ -255,7 +255,6 @@ extern struct mac68k_machine_S mac68k_machine; void pm_setup_adb(void); void pm_hw_setup(void); void pm_check_adb_devices(int); -void pm_intr(void *); int pm_adb_op(u_char *, void *, void *, int); void pm_init_adb_device(void); @@ -1688,23 +1687,8 @@ adb_soft_intr(void) /* call default completion routine if it's valid */ if (comprout) { -#ifdef MRG_ADB - __asm __volatile ( - " movml #0xffff,sp@- \n" /* save all regs */ - " movl %0,a2 \n" /* compdata */ - " movl %1,a1 \n" /* comprout */ - " movl %2,a0 \n" /* buffer */ - " movl %3,d0 \n" /* cmd */ - " jbsr a1@ \n" /* go call routine */ - " movml sp@+,#0xffff" /* restore all regs */ - : - : "g"(compdata), "g"(comprout), - "g"(buffer), "g"(cmd) - : "d0", "a0", "a1", "a2"); -#else (void)((int (*)(u_char *, u_char *, int))comprout) (buffer, compdata, cmd); -#endif } s = splhigh(); @@ -2194,10 +2178,8 @@ adb_reinit(void) } #endif -#ifndef MRG_ADB /* enable the programmer's switch, if we have one */ adb_prog_switch_enable(); -#endif #ifdef ADB_DEBUG if (adb_debug) { @@ -2512,21 +2494,6 @@ set_adb_info(ADBSetInfoBlock *info, int adbAddr) } -#ifndef MRG_ADB -int -mrg_adbintr(void) -{ - adb_intr(NULL); - return 1; /* mimic mrg_adbintr in macrom.h just in case */ -} - -int -mrg_pmintr(void) -{ - pm_intr(NULL); - return 1; /* mimic mrg_pmintr in macrom.h just in case */ -} - /* caller should really use machine-independant version: getPramTime */ /* this version does pseudo-adb access only */ int @@ -2789,5 +2756,3 @@ ADBOp(Ptr buffer, Ptr compRout, Ptr data, short commandNum) { return (adb_op(buffer, compRout, data, commandNum)); } - -#endif diff --git a/sys/arch/mac68k/dev/adbsysasm.s b/sys/arch/mac68k/dev/adbsysasm.s deleted file mode 100644 index 157f063f5fc..00000000000 --- a/sys/arch/mac68k/dev/adbsysasm.s +++ /dev/null @@ -1,88 +0,0 @@ -/* $OpenBSD: adbsysasm.s,v 1.4 2006/01/08 17:45:29 miod Exp $ */ -/* $NetBSD: adbsysasm.s,v 1.11 2001/11/20 03:19:42 chs Exp $ */ - -/*- - * Copyright (C) 1994 Bradley A. Grantham - * 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 Bradley A. Grantham. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "akbd.h" -#include "ams.h" -#include <machine/asm.h> - -/* - * ADB subsystem routines in assembly - */ - -#if NAKBD > 0 -/* This routine is called when a keyboard has sent us some data. */ -/* (provided it has been set up with SetADBInfo) */ -GLOBAL(adb_kbd_asmcomplete) - moveml #0x80e0,sp@- | save scratch regs - movl d0,sp@- /* ADB command byte */ - movl a2,sp@- /* data area pointer */ - /* a1 is the pointer to this routine itself. */ - movl a0,sp@- /* device data buffer */ - jbsr _C_LABEL(kbd_adbcomplete) - addl #12,sp /* pop params */ - moveml sp@+,#0x0701 | restore scratch regs - rts -#endif - -#if NAMS > 0 -/* This routine is called when a mouse has sent us some data. */ -/* (provided it has been set up with SetADBInfo) */ -GLOBAL(adb_ms_asmcomplete) - moveml #0x80e0,sp@- | save scratch regs - movl d0,sp@- /* ADB command byte */ - movl a2,sp@- /* data area pointer */ - /* a1 is the pointer to this routine itself. */ - movl a0,sp@- /* device data buffer */ - jbsr _C_LABEL(ms_adbcomplete) - addl #12,sp /* pop params */ - moveml sp@+,#0x0701 | restore scratch regs - rts -#endif - -#if defined(ADB_DEBUG) && 0 -GLOBAL(adb_jadbprochello) - .asciz "adb: hello from adbproc\n" - .even -#endif - - -GLOBAL(adb_jadbproc) -#if defined(ADB_DEBUG) && 0 - moveml #0xc0c0,sp@- | save scratch regs - movl _C_LABEL(adb_jadbprochello),sp@- - jbsr _C_LABEL(printf) - addl #4,sp /* pop params */ - moveml sp@+,#0x0303 | restore scratch regs -#endif - /* Don't do anything; adbattach fixes dev info for us. */ - rts diff --git a/sys/arch/mac68k/dev/adbvar.h b/sys/arch/mac68k/dev/adbvar.h index d23e7fc0358..60a681be10a 100644 --- a/sys/arch/mac68k/dev/adbvar.h +++ b/sys/arch/mac68k/dev/adbvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: adbvar.h,v 1.10 2006/01/08 17:45:29 miod Exp $ */ +/* $OpenBSD: adbvar.h,v 1.11 2006/01/13 19:36:43 miod Exp $ */ /* $NetBSD: adbvar.h,v 1.22 2005/01/15 16:00:59 chs Exp $ */ /* @@ -31,7 +31,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <mac68k/mac68k/macrom.h> #include <machine/adbsys.h> /* @@ -55,19 +54,13 @@ extern int adb_polling; extern int adb_debug; #endif +typedef caddr_t Ptr; + /* adb.c */ int adb_op_sync(Ptr, Ptr, Ptr, short); -#ifdef MRG_ADB -void adb_op_comprout(void); -#else void adb_op_comprout(caddr_t, caddr_t, int); -#endif - -/* adbsysasm.s */ -void adb_kbd_asmcomplete(void); -void adb_ms_asmcomplete(void); -/* types of adb hardware that we (will eventually) support */ +/* types of adb hardware that we support */ #define ADB_HW_UNKNOWN 0x0 /* don't know */ #define ADB_HW_II 0x1 /* Mac II series */ #define ADB_HW_IISI 0x2 /* Mac IIsi series */ @@ -80,7 +73,19 @@ void adb_ms_asmcomplete(void); #define ADBLISTEN(dev, reg) ((((u_int8_t)dev & 0x0f) << 4) | 0x08 | reg) #define ADBTALK(dev, reg) ((((u_int8_t)dev & 0x0f) << 4) | 0x0c | reg) -#ifndef MRG_ADB +/* ADB Manager */ +typedef struct { + Ptr siServiceRtPtr; + Ptr siDataAreaAddr; +} ADBSetInfoBlock; + +typedef struct { + unsigned char devType; + unsigned char origADBAddr; + Ptr dbServiceRtPtr; + Ptr dbDataAreaAddr; +} ADBDataBlock; + /* adb_direct.c */ int adb_poweroff(void); int CountADBs(void); @@ -91,4 +96,3 @@ int SetADBInfo(ADBSetInfoBlock *, int); int ADBOp(Ptr, Ptr, Ptr, short); int adb_read_date_time(unsigned long *); int adb_set_date_time(unsigned long); -#endif /* !MRG_ADB */ diff --git a/sys/arch/mac68k/dev/akbd.c b/sys/arch/mac68k/dev/akbd.c index 372252e15ba..aa778e2fd06 100644 --- a/sys/arch/mac68k/dev/akbd.c +++ b/sys/arch/mac68k/dev/akbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: akbd.c,v 1.5 2006/01/09 19:13:40 miod Exp $ */ +/* $OpenBSD: akbd.c,v 1.6 2006/01/13 19:36:43 miod Exp $ */ /* $NetBSD: akbd.c,v 1.17 2005/01/15 16:00:59 chs Exp $ */ /* @@ -133,11 +133,7 @@ akbdattach(struct device *parent, struct device *self, void *aux) sc->sc_leds = (u_int8_t)0x00; /* initially off */ -#ifdef MRG_ADB - adbinfo.siServiceRtPtr = (Ptr)adb_kbd_asmcomplete; -#else adbinfo.siServiceRtPtr = (Ptr)kbd_adbcomplete; -#endif adbinfo.siDataAreaAddr = (caddr_t)sc; printf(": "); @@ -510,6 +506,8 @@ akbd_cngetc(void *v, u_int *type, int *data) int intbits, key, press, val; int s; extern int adb_polledkey; + extern int adb_intr(void *); + extern void pm_intr(void *); s = splhigh(); @@ -520,11 +518,11 @@ akbd_cngetc(void *v, u_int *type, int *data) intbits = via_reg(VIA1, vIFR); if (intbits & V1IF_ADBRDY) { - mrg_adbintr(); + adb_intr(NULL); via_reg(VIA1, vIFR) = V1IF_ADBRDY; } if (intbits & 0x10) { - mrg_pmintr(); + pm_intr(NULL); via_reg(VIA1, vIFR) = 0x10; } } diff --git a/sys/arch/mac68k/dev/ams.c b/sys/arch/mac68k/dev/ams.c index 800677a710d..a5f5e43bb0c 100644 --- a/sys/arch/mac68k/dev/ams.c +++ b/sys/arch/mac68k/dev/ams.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ams.c,v 1.3 2006/01/08 17:45:29 miod Exp $ */ +/* $OpenBSD: ams.c,v 1.4 2006/01/13 19:36:44 miod Exp $ */ /* $NetBSD: ams.c,v 1.11 2000/12/19 03:13:40 tsubai Exp $ */ /* @@ -106,11 +106,7 @@ amsattach(struct device *parent, struct device *self, void *aux) sc->sc_devid[0] = 0; sc->sc_devid[4] = 0; -#ifdef MRG_ADB - adbinfo.siServiceRtPtr = (Ptr)adb_ms_asmcomplete; -#else adbinfo.siServiceRtPtr = (Ptr)ms_adbcomplete; -#endif adbinfo.siDataAreaAddr = (caddr_t)sc; ems_init(sc); diff --git a/sys/arch/mac68k/dev/pm_direct.c b/sys/arch/mac68k/dev/pm_direct.c index d35df8189b4..752200cf96a 100644 --- a/sys/arch/mac68k/dev/pm_direct.c +++ b/sys/arch/mac68k/dev/pm_direct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pm_direct.c,v 1.9 2006/01/04 20:39:05 miod Exp $ */ +/* $OpenBSD: pm_direct.c,v 1.10 2006/01/13 19:36:44 miod Exp $ */ /* $NetBSD: pm_direct.c,v 1.25 2005/10/28 21:54:52 christos Exp $ */ /* @@ -50,10 +50,8 @@ #include <mac68k/dev/pm_direct.h> /* hardware dependent values */ -extern u_short ADBDelay; -extern u_int32_t HwCfgFlags3; -extern struct mac68k_machine_S mac68k_machine; - +u_int32_t HwCfgFlags3; +u_short ADBDelay = 0xcea; /* define the types of the Power Manager */ #define PM_HW_UNKNOWN 0x00 /* don't know */ @@ -176,13 +174,10 @@ int pm_send_pm2(u_char); int pm_pmgrop_pm2(PMData *); int pm_intr_pm2(void *); -/* this function is MRG-Based (for testing) */ -int pm_pmgrop_mrg(PMData *); - /* these functions are called from adb_direct.c */ void pm_setup_adb(void); void pm_check_adb_devices(int); -void pm_intr(void *); +int pm_intr(void *); int pm_adb_op(u_char *, void *, void *, int); void pm_hw_setup(void); @@ -878,26 +873,6 @@ pm_intr_pm2(void *arg) /* - * MRG-based PMgrOp routine - */ -int -pm_pmgrop_mrg(PMData *pmdata) -{ - u_int32_t rval=0; - - __asm __volatile( - " movl %1,a0 \n" - " .word 0xa085 \n" - " movl d0,%0" - : "=g" (rval) - : "g" (pmdata) - : "a0","d0"); - - return rval; -} - - -/* * My PMgrOp routine */ int @@ -911,7 +886,6 @@ pmgrop(PMData *pmdata) return (pm_pmgrop_pm2(pmdata)); break; default: - /* return (pmgrop_mrg(pmdata)); */ return 1; } } @@ -920,19 +894,21 @@ pmgrop(PMData *pmdata) /* * My PM interrupt routine */ -void +int pm_intr(void *arg) { switch (pmHardware) { - case PM_HW_PB1XX: - pm_intr_pm1(arg); - break; - case PM_HW_PB5XX: - pm_intr_pm2(arg); - break; - default: - break; + case PM_HW_PB1XX: + return (pm_intr_pm1(arg)); + + case PM_HW_PB5XX: + return (pm_intr_pm2(arg)); + + default: + break; } + + return (-1); } diff --git a/sys/arch/mac68k/include/autoconf.h b/sys/arch/mac68k/include/autoconf.h index b9ee1bcd266..f507f701145 100644 --- a/sys/arch/mac68k/include/autoconf.h +++ b/sys/arch/mac68k/include/autoconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.h,v 1.10 2006/01/02 18:10:05 miod Exp $ */ +/* $OpenBSD: autoconf.h,v 1.11 2006/01/13 19:36:44 miod Exp $ */ /* $NetBSD: autoconf.h,v 1.5 1996/12/17 06:47:40 scottr Exp $ */ /* @@ -62,8 +62,6 @@ void resettodr(void); void mac68k_calibrate_delay(void); void startrtclock(void); -/* macrom.c */ -void mrg_init(void); #endif /* _KERNEL */ #endif /* _MAC68K_AUTOCONF_H_ */ diff --git a/sys/arch/mac68k/include/cpu.h b/sys/arch/mac68k/include/cpu.h index aeabbaaafd7..a68d0f43416 100644 --- a/sys/arch/mac68k/include/cpu.h +++ b/sys/arch/mac68k/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.35 2006/01/01 13:16:01 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.36 2006/01/13 19:36:44 miod Exp $ */ /* $NetBSD: cpu.h,v 1.45 1997/02/10 22:13:40 scottr Exp $ */ /* @@ -252,12 +252,9 @@ struct mac68k_machine_S { /* What kind of model is this */ struct cpu_model_info { - int machineid; /* MacOS Gestalt value. */ - char *model_major; /* Make this distinction to save a few */ - char *model_minor; /* bytes--might be useful, too. */ - int class; /* Rough class of machine. */ - /* forwarded romvec_s is defined in mac68k/macrom.h */ - struct romvec_s *rom_vectors; /* Pointer to our known rom vectors */ + int machineid; /* MacOS Gestalt value. */ + const char *model; /* Model description */ + int class; /* Rough class of machine. */ }; extern struct cpu_model_info *current_mac_model; @@ -268,11 +265,6 @@ extern struct mac68k_machine_S mac68k_machine; extern unsigned long load_addr; #endif /* _KERNEL */ -/* physical memory sections */ -#define ROMBASE (0x40800000) -#define ROMLEN (0x00200000) /* 2MB will work for all 68k */ -#define ROMMAPSIZE btoc(ROMLEN) /* 32k of page tables. */ - #define IIOMAPSIZE btoc(0x00100000) /* 1MB should be enough */ /* XXX -- Need to do something about superspace. diff --git a/sys/arch/mac68k/include/intr.h b/sys/arch/mac68k/include/intr.h index d7a835dd596..2f5b821acfe 100644 --- a/sys/arch/mac68k/include/intr.h +++ b/sys/arch/mac68k/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.12 2005/05/01 09:55:49 miod Exp $ */ +/* $OpenBSD: intr.h,v 1.13 2006/01/13 19:36:44 miod Exp $ */ /* $NetBSD: intr.h,v 1.9 1998/08/12 06:58:42 scottr Exp $ */ /* @@ -134,8 +134,7 @@ extern volatile u_int8_t ssir; #define SIR_NET 0x01 #define SIR_CLOCK 0x02 #define SIR_SERIAL 0x04 -#define SIR_DTMGR 0x08 -#define SIR_ADB 0x10 +#define SIR_ADB 0x08 #define siron(mask) \ __asm __volatile ( "orb %0,_ssir" : : "i" (mask)) @@ -145,7 +144,6 @@ extern volatile u_int8_t ssir; #define setsoftnet() siron(SIR_NET) #define setsoftclock() siron(SIR_CLOCK) #define setsoftserial() siron(SIR_SERIAL) -#define setsoftdtmgr() siron(SIR_DTMGR) #define setsoftadb() siron(SIR_ADB) /* intr.c */ diff --git a/sys/arch/mac68k/mac68k/autoconf.c b/sys/arch/mac68k/mac68k/autoconf.c index 0d71b1a2f0c..b37052af328 100644 --- a/sys/arch/mac68k/mac68k/autoconf.c +++ b/sys/arch/mac68k/mac68k/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.23 2006/01/04 20:39:05 miod Exp $ */ +/* $OpenBSD: autoconf.c,v 1.24 2006/01/13 19:36:45 miod Exp $ */ /* $NetBSD: autoconf.c,v 1.38 1996/12/18 05:46:09 scottr Exp $ */ /* @@ -92,7 +92,6 @@ static struct device fakerdrootdev = { DV_DISK, {}, NULL, 0, "rd0", NULL }; void cpu_configure() { - mrg_init(); /* Init Mac ROM Glue */ startrtclock(); /* start before adb_init() */ if (config_rootfound("mainbus", "mainbus") == NULL) diff --git a/sys/arch/mac68k/mac68k/locore.s b/sys/arch/mac68k/mac68k/locore.s index 4f2fd335199..c6cf02cfd28 100644 --- a/sys/arch/mac68k/mac68k/locore.s +++ b/sys/arch/mac68k/mac68k/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.49 2006/01/04 20:39:05 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.50 2006/01/13 19:36:45 miod Exp $ */ /* $NetBSD: locore.s,v 1.103 1998/07/09 06:02:50 scottr Exp $ */ /* @@ -86,16 +86,6 @@ GLOBAL(kernel_text) /* - * Mac OS global variable space; storage for global variables used by - * Mac ROM traps and glue routines (see macrom.c, macrom.h macromasm.s) - * - * Some routine running before ADBReInit chooses to write to 0x1fb8. - * With the trap table from 0x0 to 0x3ff, this additional space of - * 0x2a00 should be sufficient. - */ - .space 0x2a00 - -/* * Initialization */ @@ -787,12 +777,7 @@ Lbrkpt2: movl d2,sp@- | push trap type jbsr _C_LABEL(kdb_trap) | handle the trap addql #8,sp | pop args -#if 0 /* not needed on mac68k */ - cmpl #0,d0 | did ddb handle it? - jne Lbrkpt3 | yes, done -#endif #endif - /* Sun 3 drops into PROM here. */ Lbrkpt3: | The stack pointer may have been modified, or | data below it modified (by kgdb push call), @@ -892,7 +877,6 @@ ENTRY_NOPROFILE(rtclock_intr) movl sp,sp@- | push pointer to ps, pc jbsr _C_LABEL(hardclock) | call generic clock int routine lea sp@(12),sp | pop params - jbsr _C_LABEL(mrg_VBLQueue) | give programs in the VBLqueue a chance movw d2,sr | restore SPL movl sp@+,d2 | restore d2 movl #1,d0 | clock taken care of diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c index 5f6cb1c863a..a5284a74720 100644 --- a/sys/arch/mac68k/mac68k/machdep.c +++ b/sys/arch/mac68k/mac68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.124 2006/01/04 20:39:05 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.125 2006/01/13 19:36:46 miod Exp $ */ /* $NetBSD: machdep.c,v 1.207 1998/07/08 04:39:34 thorpej Exp $ */ /* @@ -656,16 +656,11 @@ haltsys: if (howto & RB_POWERDOWN) { printf("\nAttempting to power down...\n"); via_powerdown(); -#ifndef MRG_ADB /* - * adb_poweroff() is available only when - * the MRG_ADB method isn't used. - * * Shut down machines whose power functions * are accessed via modified ADB calls. */ adb_poweroff(); -#endif } printf("\nThe operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); @@ -1125,9 +1120,13 @@ getenvvars(flag, buf) #if defined(DDB) || NKSYMS > 0 extern u_long end, esym; #endif - extern u_long macos_boottime, MacOSROMBase; + extern u_long macos_boottime; + extern vaddr_t MacOSROMBase; extern long macos_gmtbias; + extern u_short ADBDelay; + extern u_int32_t HwCfgFlags3; int root_scsi_id; + vaddr_t ROMBase; /* * If flag & 0x80000000 == 0, then we're booting with the old booter @@ -1209,18 +1208,11 @@ getenvvars(flag, buf) * 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"); + ROMBase = (vaddr_t)getenv("ROMBASE"); + if (ROMBase != 0) + MacOSROMBase = ROMBase; 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"); } char toupper(char); @@ -1296,732 +1288,77 @@ getenv(str) } } -/* - * ROM Vector information for calling drivers in ROMs - * - * According to information published on the Web by Apple, there have - * been 9 different ROM families used in the Mac since the introduction - * of the Lisa/XL through the latest PowerMacs (May 96). Each family - * has zero or more version variants and in some cases a version variant - * may exist in one than one length format. Generally any one specific - * Mac will use a common set of routines within the ROM and a model-specific - * set also in the ROM. Luckily most of the routines used by BSD fall - * into the common set and can therefore be defined in the ROM Family. - * The offset addresses (address minus the ROM Base) of these common routines - * is the same for all machines which use that ROM. The offset addresses of - * the machine-specific routines is generally different for each machine. - * The machine-specific routines currently used by BSD/mac68k include: - * ADB_interrupt, PM_interrpt, ADBBase+130_interrupt, - * PMgrOp, jClkNoMem, Egret, InitEgret, and ADBReInit_JTBL - * - * It is possible that the routine at "jClkNoMem" is a common routine, but - * some variation in addresses has been seen. Also, execept for the very - * earliest machines which used Egret, the machine-specific value of the - * Egret routine may be unimportant as the machine-specific InitEgret code - * seems to always set the OS Trap vector for Egret. - * - * Only three of the nine different ROMs are important to BSD/mac68k. - * All other ROMs are used in early model Macs which are unable to run - * BSD due to other hardware limitations such as 68000 CPU, no MMU - * capability, or used only in PowerMacs. The three that we are interested - * in are: - * - * ROM Family $0178 - used in the II, IIx, IIcx, and SE/30 - * All machines which use this ROM are now supported by BSD. - * There are no machine-dependent routines in these ROMs used by - * BSD/mac68k. This ROM is always 256K in length. - * - * ROM Family $067c - used in Classic, Color Classic, Color Classic II, - * IIci, IIsi, IIvi, IIvx, IIfx, LC, LC II, LC III, - * LC III+, LC475, LC520, LC550, LC575, LC580, LC630, - * MacTV, P200, P250, P275, P400/405/410/430, P450, - * P460/466/467, P475/476, P520, P550/560, P575/577/578, - * P580/588, P600, P630/631/635/636/637/638/640, Q605, - * Q610, C610, Q630, C650, Q650, Q700, Q800, Q900, Q950, - * PB140, PB145/145B, PB150, PB160, PB165, PB165c, PB170, - * PB180, PB180c, Duo 210, Duo 230, Duo 250, Duo 270c, - * Duo280, Duo 280c, PB 520/520c/540/540c/550 - * This is the so-called "Universal" ROM used in almost all 68K - * machines. There are machine-dependent and machine-independent - * routines used by BSD/mac68k in this ROM, and except for the - * PowerBooks and the Duos, this ROM seems to be fairly well - * known by BSD/mac68k. Desktop machines listed here that are - * not yet running BSD probably only lack the necessary - * addresses for the machine-dependent routines, or are waiting - * for IDE disk support. This ROM is generally 1Meg in length, - * however when used in the IIci, IIfx, IIsi, LC, Classic II, and - * P400/405/410/430 it is 512K in length, and when used in the - * PB 520/520c/540/540c/550 it is 2Meg in length. - * - * ROM Family - $077d - used in C660AV/Q660AV, Q840AV - * The "Universal" ROM used on the PowerMacs and used in the - * 68K line for the AV Macs only. When used in the 68K AV - * machines the ROM is 2Meg in length; all uses in the PowerMac - * use a length of 4Meg. - * - * Bob Nestor - <rnestor@metronet.com> - */ -romvec_t romvecs[] = -{ - /* Vectors verified for II, IIx, IIcx, SE/30 */ - { /* 0 */ - "Mac II class ROMs", - (caddr_t)0x40807002, /* where does ADB interrupt */ - (caddr_t)0x0, /* PM interrupt (?) */ - (caddr_t)0x4080a4d8, /* ADBBase + 130 interrupt; whatzit? */ - (caddr_t)0x40807778, /* CountADBs */ - (caddr_t)0x40807792, /* GetIndADB */ - (caddr_t)0x408077be, /* GetADBInfo */ - (caddr_t)0x408077c4, /* SetADBInfo */ - (caddr_t)0x40807704, /* ADBReInit */ - (caddr_t)0x408072fa, /* ADBOp */ - (caddr_t)0x0, /* PMgrOp */ - (caddr_t)0x4080d6d0, /* WriteParam */ - (caddr_t)0x4080d6fa, /* SetDateTime */ - (caddr_t)0x4080dbe8, /* InitUtil */ - (caddr_t)0x4080dd78, /* ReadXPRam */ - (caddr_t)0x4080dd82, /* WriteXPRam */ - (caddr_t)0x4080ddd6, /* jClkNoMem */ - (caddr_t)0x0, /* ADBAlternateInit */ - (caddr_t)0x0, /* Egret */ - (caddr_t)0x0, /* InitEgret */ - (caddr_t)0x0, /* ADBReInit_JTBL */ - (caddr_t)0x0, /* ROMResourceMap List Head */ - (caddr_t)0x40814c58, /* FixDiv */ - (caddr_t)0x40814b64, /* FixMul */ - }, - /* - * Vectors verified for PB 140, PB 145, PB 170 - * (PB 100?) - */ - { /* 1 */ - "Powerbook class ROMs", - (caddr_t)0x4088ae5e, /* ADB interrupt */ - (caddr_t)0x408885ec, /* PB ADB interrupt */ - (caddr_t)0x4088ae0e, /* ADBBase + 130 interrupt; whatzit? */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x408888ec, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x4080b1e4, /* jClkNoMem */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x40814800, /* Egret */ - (caddr_t)0x408147c4, /* InitEgret */ - (caddr_t)0x0, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv */ - (caddr_t)0x4081c312, /* FixMul */ - }, - /* - * Vectors verified for IIsi, IIvx, IIvi - */ - { /* 2 */ - "Mac IIsi class ROMs", - (caddr_t)0x40814912, /* ADB interrupt */ - (caddr_t)0x0, /* PM ADB interrupt */ - (caddr_t)0x408150f0, /* ADBBase + 130 interrupt; whatzit? */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x0, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x4080b1e4, /* jClkNoMem */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x40814800, /* Egret */ - (caddr_t)0x408147c4, /* InitEgret */ - (caddr_t)0x0, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv */ - (caddr_t)0x4081c312, /* FixMul */ - }, - /* - * Vectors verified for Mac Classic II and LC II - * (Other LC's? 680x0 Performas?) - */ - { /* 3 */ - "Mac Classic II ROMs", - (caddr_t)0x40a14912, /* ADB interrupt */ - (caddr_t)0x0, /* PM ADB interrupt */ - (caddr_t)0x40a150f0, /* ADBBase + 130 interrupt; whatzit? */ - (caddr_t)0x40a0a360, /* CountADBs */ - (caddr_t)0x40a0a37a, /* GetIndADB */ - (caddr_t)0x40a0a3a6, /* GetADBInfo */ - (caddr_t)0x40a0a3ac, /* SetADBInfo */ - (caddr_t)0x40a0a752, /* ADBReInit */ - (caddr_t)0x40a0a3dc, /* ADBOp */ - (caddr_t)0x0, /* PMgrOp */ - (caddr_t)0x40a0c05c, /* WriteParam */ - (caddr_t)0x40a0c086, /* SetDateTime */ - (caddr_t)0x40a0c5cc, /* InitUtil */ - (caddr_t)0x40a0b186, /* ReadXPRam */ - (caddr_t)0x40a0b190, /* WriteXPRam */ - (caddr_t)0x40a0b1e4, /* jClkNoMem */ - (caddr_t)0x40a0a818, /* ADBAlternateInit */ - (caddr_t)0x40a14800, /* Egret */ - (caddr_t)0x40a147c4, /* InitEgret */ - (caddr_t)0x40a03ba6, /* ADBReInit_JTBL */ - (caddr_t)0x40a7eb90, /* ROMResourceMap List Head */ - (caddr_t)0x40a1c406, /* FixDiv, wild guess */ - (caddr_t)0x40a1c312, /* FixMul, wild guess */ - }, - /* - * Vectors verified for IIci, Q700 - */ - { /* 4 */ - "Mac IIci/Q700 ROMs", - (caddr_t)0x4080a700, /* ADB interrupt */ - (caddr_t)0x0, /* PM ADB interrupt */ - (caddr_t)0x4080a5aa, /* ADBBase + 130 interrupt; whatzit? */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x0, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x4080b1e4, /* jClkNoMem */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x0, /* Egret */ - (caddr_t)0x408147c4, /* InitEgret */ - (caddr_t)0x0, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv */ - (caddr_t)0x4081c312, /* FixMul */ - }, - /* - * Vectors verified for Duo 230, PB 180, PB 160, PB 165/165C - * (Duo 210? Duo 250? Duo 270?) - */ - { /* 5 */ - "2nd Powerbook class ROMs", - (caddr_t)0x408b2eec, /* ADB interrupt */ - (caddr_t)0x408885ec, /* PB ADB interrupt */ - (caddr_t)0x408b2e76, /* ADBBase + 130 interrupt; whatzit? */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x408888ec, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x408b39b2, /* jClkNoMem */ /* From PB180 */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x40814800, /* Egret */ - (caddr_t)0x40888400, /* InitPwrMgr */ /* From PB180 */ - (caddr_t)0x408cce28, /* ADBReInit_JTBL -- from PB160*/ - (caddr_t)0x4087eb90, /* ROMRsrcMap List Head -- from PB160*/ - (caddr_t)0x4081c406, /* FixDiv, wild guess */ - (caddr_t)0x4081c312, /* FixMul, wild guess */ - }, - /* - * Vectors verified for the Quadra, Centris 650 - * (610, Q800?) - */ - { /* 6 */ - "Quadra/Centris ROMs", - (caddr_t)0x408b2dea, /* ADB int */ - (caddr_t)0x0, /* PM intr */ - (caddr_t)0x408b2c72, /* ADBBase + 130 */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x40809ae6, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x408b39b6, /* jClkNoMem */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x40814800, /* Egret */ - (caddr_t)0x408147c4, /* InitEgret */ - (caddr_t)0x408d2b64, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv, wild guess */ - (caddr_t)0x4081c312, /* FixMul, wild guess */ - }, - /* - * Vectors verified for the Quadra 660AV - * (Quadra 840AV?) - */ - { /* 7 */ - "Quadra AV ROMs", - (caddr_t)0x4080cac6, /* ADB int */ - (caddr_t)0x0, /* PM int */ - (caddr_t)0x40805cd4, /* ADBBase + 130 */ - (caddr_t)0x40839600, /* CountADBs */ - (caddr_t)0x4083961a, /* GetIndADB */ - (caddr_t)0x40839646, /* GetADBInfo */ - (caddr_t)0x4083964c, /* SetADBInfo */ - (caddr_t)0x408397b8, /* ADBReInit */ - (caddr_t)0x4083967c, /* ADBOp */ - (caddr_t)0x0, /* PMgrOp */ - (caddr_t)0x4081141c, /* WriteParam */ - (caddr_t)0x4081144e, /* SetDateTime */ - (caddr_t)0x40811930, /* InitUtil */ - (caddr_t)0x4080b624, /* ReadXPRam */ - (caddr_t)0x4080b62e, /* WriteXPRam */ - (caddr_t)0x40806884, /* jClkNoMem */ - (caddr_t)0x408398c2, /* ADBAlternateInit */ - (caddr_t)0x4080cada, /* Egret */ - (caddr_t)0x4080de14, /* InitEgret */ - (caddr_t)0x408143b8, /* ADBReInit_JTBL */ - (caddr_t)0x409bdb60, /* ROMResourceMap List Head */ - (caddr_t)0x4083b3d8, /* FixDiv */ - (caddr_t)0x4083b2e4, /* FixMul */ - }, - /* - * PB 540, PB 550 - * (PB 520? Duo 280?) - */ - { /* 8 */ - "68040 PowerBook ROMs", - (caddr_t)0x400b2efc, /* ADB int */ - (caddr_t)0x400d8e66, /* PM int */ - (caddr_t)0x400b2e86, /* ADBBase + 130 */ - (caddr_t)0x4000a360, /* CountADBs */ - (caddr_t)0x4000a37a, /* GetIndADB */ - (caddr_t)0x4000a3a6, /* GetADBInfo */ - (caddr_t)0x4000a3ac, /* SetADBInfo */ - (caddr_t)0x4000a752, /* ADBReInit */ - (caddr_t)0x4000a3dc, /* ADBOp */ - (caddr_t)0x400d9302, /* PmgrOp */ - (caddr_t)0x4000c05c, /* WriteParam */ - (caddr_t)0x4000c086, /* SetDateTime */ - (caddr_t)0x4000c5cc, /* InitUtil */ - (caddr_t)0x4000b186, /* ReadXPRam */ - (caddr_t)0x4000b190, /* WriteXPRam */ - (caddr_t)0x400b3c08, /* jClkNoMem */ - (caddr_t)0x4000a818, /* ADBAlternateInit */ - (caddr_t)0x40009ae6, /* Egret */ /* From PB520 */ - (caddr_t)0x400147c4, /* InitEgret */ - (caddr_t)0x400a7a5c, /* ADBReInit_JTBL */ - (caddr_t)0x4007eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4001c406, /* FixDiv, wild guess */ - (caddr_t)0x4001c312, /* FixMul, wild guess */ - }, - /* - * Verified for the Q605 - */ - { /* 9 */ - "Quadra/Centris 605 ROMs", - (caddr_t)0x408a9b56, /* ADB int */ - (caddr_t)0x0, /* PM int */ - (caddr_t)0x408b2f94, /* ADBBase + 130 */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x0, /* PmgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x408b3bf8, /* jClkNoMem */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x408a99c0, /* Egret */ - (caddr_t)0x408147c4, /* InitEgret */ - (caddr_t)0x408a82c0, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv */ - (caddr_t)0x4081c312, /* FixMul */ - }, - /* - * Vectors verified for Duo 270c, PB150 - */ - { /* 10 */ - "Duo 270C ROMs", - (caddr_t)0x408b2efc, /* ADB interrupt */ - (caddr_t)0x408885ec, /* PB ADB interrupt */ - (caddr_t)0x408b2e86, /* ADBBase + 130 interrupt; whatzit? */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x408888ec, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x408b3bf8, /* jClkNoMem */ /* from PB 150 */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x40814800, /* Egret */ - (caddr_t)0x408147c4, /* InitEgret */ - (caddr_t)0x0, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv, wild guess */ - (caddr_t)0x4081c312, /* FixMul, wild guess */ - }, - /* - * Vectors verified for Performa/LC 550 - */ - { /* 11 */ - "P/LC 550 ROMs", - (caddr_t)0x408d16d6, /* ADB interrupt */ - (caddr_t)0x0, /* PB ADB interrupt */ - (caddr_t)0x408b2f84, /* ADBBase + 130 interrupt; whatzit? */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x0, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x408b3c04, /* jClkNoMem */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x408d1450, /* Egret */ - (caddr_t)0x408147c4, /* InitEgret */ - (caddr_t)0x408d24a4, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv for P550 */ - (caddr_t)0x4081c312, /* FixMul for P550 */ - }, - /* - * Vectors verified for the MacTV - */ - { /* 12 */ - "MacTV ROMs", - (caddr_t)0x40acfed6, /* ADB interrupt */ - (caddr_t)0x0, /* PB ADB interrupt */ - (caddr_t)0x40ab2f84, /* ADBBase + 130 interrupt; whatzit? */ - (caddr_t)0x40a0a360, /* CountADBs */ - (caddr_t)0x40a0a37a, /* GetIndADB */ - (caddr_t)0x40a0a3a6, /* GetADBInfo */ - (caddr_t)0x40a0a3ac, /* SetADBInfo */ - (caddr_t)0x40a0a752, /* ADBReInit */ - (caddr_t)0x40a0a3dc, /* ADBOp */ - (caddr_t)0x0, /* PMgrOp */ - (caddr_t)0x40a0c05c, /* WriteParam */ - (caddr_t)0x40a0c086, /* SetDateTime */ - (caddr_t)0x40a0c5cc, /* InitUtil */ - (caddr_t)0x40a0b186, /* ReadXPRam */ - (caddr_t)0x40a0b190, /* WriteXPRam */ - (caddr_t)0x40ab3bf4, /* jClkNoMem */ - (caddr_t)0x40a0a818, /* ADBAlternateInit */ - (caddr_t)0x40acfd40, /* Egret */ - (caddr_t)0x40a147c4, /* InitEgret */ - (caddr_t)0x40a038a0, /* ADBReInit_JTBL */ - (caddr_t)0x40a7eb90, /* ROMResourceMap List Head */ - (caddr_t)0x40a1c406, /* FixDiv */ - (caddr_t)0x40a1c312, /* FixMul */ - }, - /* - * Vectors verified for the Quadra630 - */ - { /* 13 */ - "Quadra630 ROMs", - (caddr_t)0x408a9bd2, /* ADB int */ - (caddr_t)0x0, /* PM intr */ - (caddr_t)0x408b2f94, /* ADBBase + 130 */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* Wild guess at ReadXPRam */ - (caddr_t)0x4080b190, /* Wild guess at WriteXPRam */ - (caddr_t)0x408b39f4, /* jClkNoMem */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x408a99c0, /* Egret */ - (caddr_t)0x408147c8, /* InitEgret */ - (caddr_t)0x408a7ef8, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv */ - (caddr_t)0x4081c312, /* FixMul */ - }, - /* - * Vectors verified for LC III - */ - { /* 14 */ - "LC III ROMs", - (caddr_t)0x40814912, /* ADB interrupt */ - (caddr_t)0x0, /* PM ADB interrupt */ - (caddr_t)0x408b2f94, /* ADBBase + 130 interupt */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x0, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x408b39b6, /* jClkNoMem */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x40814800, /* Egret */ - (caddr_t)0x408147c4, /* InitEgret */ - (caddr_t)0x408d2918, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv */ - (caddr_t)0x4081c312, /* FixMul */ - }, - /* - * Vectors verified for the LC520 - */ - { /* 15 */ - "MacLC520 ROMs", - (caddr_t)0x408d16d6, /* ADB interrupt */ - (caddr_t)0x0, /* PB ADB interrupt */ - (caddr_t)0x408b2f84, /* ADBBase + 130 interrupt; whatzit? */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x0, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x408b3c04, /* jClkNoMem */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x408d1450, /* Egret */ - (caddr_t)0x408147c4, /* InitEgret */ - (caddr_t)0x408d2460, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv for P520 */ - (caddr_t)0x4081c312, /* FixMul for P520 */ - }, - /* - * Vectors verified for the LC 575/577/578 - */ - { /* 16 */ - "MacLC575 ROMs", - (caddr_t)0x408a9b56, /* ADB interrupt */ - (caddr_t)0x0, /* PB ADB interrupt */ - (caddr_t)0x408b2f94, /* ADBBase + 130 interrupt; whatzit? */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x0, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x408b3bf8, /* jClkNoMem */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x408a99c0, /* Egret */ - (caddr_t)0x408147c4, /* InitEgret */ - (caddr_t)0x408a81a0, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv for P520 */ - (caddr_t)0x4081c312, /* FixMul for P520 */ - }, - /* - * Vectors verified for the Quadra 950 - */ - { /* 17 */ - "Quadra950 class ROMs", - (caddr_t)0x40814912, /* ADB interrupt */ - (caddr_t)0x0, /* PM ADB interrupt */ - (caddr_t)0x4080a4d8, /* ADBBase + 130 interrupt; whatzit? */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x0, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x4080b1e4, /* jClkNoMem */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x40814800, /* Egret */ - (caddr_t)0x408147c4, /* InitEgret */ - (caddr_t)0x408038bc, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv */ - (caddr_t)0x4081c312, /* FixMul */ - }, - /* - * Vectors verified for the Mac IIfx - */ - { /* 18 */ - "Mac IIfx ROMs", - (caddr_t)0x40809f4a, /* ADB interrupt */ - (caddr_t)0x0, /* PM ADB interrupt */ - (caddr_t)0x4080a4d8, /* ADBBase + 130 interupt */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x0, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x4080b1e4, /* jClkNoMem */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x0, /* Egret */ - (caddr_t)0x0, /* InitEgret */ - (caddr_t)0x408037c0, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv */ - (caddr_t)0x4081c312, /* FixMul */ - }, - /* - * Vectors verified for the Performa 588 (and 580?) - */ - { /* 19 */ - "Performa 580 ROMs", - (caddr_t)0x4089a8be, /* ADB interrupt */ - (caddr_t)0x0, /* PM ADB interrupt */ - (caddr_t)0x408b2f94, /* ADBBase + 130 interupt */ - (caddr_t)0x4080a360, /* CountADBs */ - (caddr_t)0x4080a37a, /* GetIndADB */ - (caddr_t)0x4080a3a6, /* GetADBInfo */ - (caddr_t)0x4080a3ac, /* SetADBInfo */ - (caddr_t)0x4080a752, /* ADBReInit */ - (caddr_t)0x4080a3dc, /* ADBOp */ - (caddr_t)0x0, /* PMgrOp */ - (caddr_t)0x4080c05c, /* WriteParam */ - (caddr_t)0x4080c086, /* SetDateTime */ - (caddr_t)0x4080c5cc, /* InitUtil */ - (caddr_t)0x4080b186, /* ReadXPRam */ - (caddr_t)0x4080b190, /* WriteXPRam */ - (caddr_t)0x408b3bf4, /* jClkNoMem */ - (caddr_t)0x4080a818, /* ADBAlternateInit */ - (caddr_t)0x408a99c0, /* Egret */ - (caddr_t)0x408147c8, /* InitEgret */ - (caddr_t)0x408a7f74, /* ADBReInit_JTBL */ - (caddr_t)0x4087eb90, /* ROMResourceMap List Head */ - (caddr_t)0x4081c406, /* FixDiv */ - (caddr_t)0x4081c312, /* FixMul */ - }, - /* Please fill these in! -BG */ -}; - struct cpu_model_info cpu_models[] = { /* The first four. */ - {MACH_MACII, "II", "", MACH_CLASSII, &romvecs[0]}, - {MACH_MACIIX, "IIx", "", MACH_CLASSII, &romvecs[0]}, - {MACH_MACIICX, "IIcx", "", MACH_CLASSII, &romvecs[0]}, - {MACH_MACSE30, "SE/30", "", MACH_CLASSII, &romvecs[0]}, + { MACH_MACII, "II", MACH_CLASSII }, + { MACH_MACIIX, "IIx", MACH_CLASSII }, + { MACH_MACIICX, "IIcx", MACH_CLASSII }, + { MACH_MACSE30, "SE/30", MACH_CLASSII }, /* The rest of the II series... */ - {MACH_MACIICI, "IIci", "", MACH_CLASSIIci, &romvecs[4]}, - {MACH_MACIISI, "IIsi", "", MACH_CLASSIIsi, &romvecs[2]}, - {MACH_MACIIVI, "IIvi", "", MACH_CLASSIIvx, &romvecs[2]}, - {MACH_MACIIVX, "IIvx", "", MACH_CLASSIIvx, &romvecs[2]}, - {MACH_MACIIFX, "IIfx", "", MACH_CLASSIIfx, &romvecs[18]}, + { MACH_MACIICI, "IIci", MACH_CLASSIIci }, + { MACH_MACIISI, "IIsi", MACH_CLASSIIsi }, + { MACH_MACIIVI, "IIvi", MACH_CLASSIIvx }, + { MACH_MACIIVX, "IIvx", MACH_CLASSIIvx }, + { MACH_MACIIFX, "IIfx", MACH_CLASSIIfx }, /* The Centris/Quadra series. */ - {MACH_MACQ700, "Quadra", " 700", MACH_CLASSQ, &romvecs[4]}, - {MACH_MACQ900, "Quadra", " 900", MACH_CLASSQ, &romvecs[6]}, - {MACH_MACQ950, "Quadra", " 950", MACH_CLASSQ, &romvecs[17]}, - {MACH_MACQ800, "Quadra", " 800", MACH_CLASSQ, &romvecs[6]}, - {MACH_MACQ650, "Quadra", " 650", MACH_CLASSQ, &romvecs[6]}, - {MACH_MACC650, "Centris", " 650", MACH_CLASSQ, &romvecs[6]}, - {MACH_MACQ605, "Quadra", " 605", MACH_CLASSQ, &romvecs[9]}, - {MACH_MACC610, "Centris", " 610", MACH_CLASSQ, &romvecs[6]}, - {MACH_MACQ610, "Quadra", " 610", MACH_CLASSQ, &romvecs[6]}, - {MACH_MACQ630, "Quadra", " 630", MACH_CLASSQ2, &romvecs[13]}, - {MACH_MACC660AV, "Centris", " 660AV", MACH_CLASSAV, &romvecs[7]}, - {MACH_MACQ840AV, "Quadra", " 840AV", MACH_CLASSAV, &romvecs[7]}, + { MACH_MACQ700, "Quadra 700", MACH_CLASSQ }, + { MACH_MACQ900, "Quadra 900", MACH_CLASSQ }, + { MACH_MACQ950, "Quadra 950", MACH_CLASSQ }, + { MACH_MACQ800, "Quadra 800", MACH_CLASSQ }, + { MACH_MACQ650, "Quadra 650", MACH_CLASSQ }, + { MACH_MACC650, "Centris 650", MACH_CLASSQ }, + { MACH_MACQ605, "Quadra 605", MACH_CLASSQ }, + { MACH_MACC610, "Centris 610", MACH_CLASSQ }, + { MACH_MACQ610, "Quadra 610", MACH_CLASSQ }, + { MACH_MACQ630, "Quadra 630", MACH_CLASSQ2 }, + { MACH_MACC660AV, "Centris 660AV", MACH_CLASSAV }, + { MACH_MACQ840AV, "Quadra 840AV", MACH_CLASSAV }, /* The Powerbooks/Duos... */ - {MACH_MACPB100, "PowerBook", " 100", MACH_CLASSPB, &romvecs[1]}, + { MACH_MACPB100, "PowerBook 100", MACH_CLASSPB }, /* PB 100 has no MMU! */ - {MACH_MACPB140, "PowerBook", " 140", MACH_CLASSPB, &romvecs[1]}, - {MACH_MACPB145, "PowerBook", " 145", MACH_CLASSPB, &romvecs[1]}, - {MACH_MACPB150, "PowerBook", " 150", MACH_CLASSDUO, &romvecs[10]}, - {MACH_MACPB160, "PowerBook", " 160", MACH_CLASSPB, &romvecs[5]}, - {MACH_MACPB165, "PowerBook", " 165", MACH_CLASSPB, &romvecs[5]}, - {MACH_MACPB165C, "PowerBook", " 165c", MACH_CLASSPB, &romvecs[5]}, - {MACH_MACPB170, "PowerBook", " 170", MACH_CLASSPB, &romvecs[1]}, - {MACH_MACPB180, "PowerBook", " 180", MACH_CLASSPB, &romvecs[5]}, - {MACH_MACPB180C, "PowerBook", " 180c", MACH_CLASSPB, &romvecs[5]}, - {MACH_MACPB500, "PowerBook", " 500", MACH_CLASSPB, &romvecs[8]}, + { MACH_MACPB140, "PowerBook 140", MACH_CLASSPB }, + { MACH_MACPB145, "PowerBook 145", MACH_CLASSPB }, + { MACH_MACPB150, "PowerBook 150", MACH_CLASSDUO }, + { MACH_MACPB160, "PowerBook 160", MACH_CLASSPB }, + { MACH_MACPB165, "PowerBook 165", MACH_CLASSPB }, + { MACH_MACPB165C, "PowerBook 165c", MACH_CLASSPB }, + { MACH_MACPB170, "PowerBook 170", MACH_CLASSPB }, + { MACH_MACPB180, "PowerBook 180", MACH_CLASSPB }, + { MACH_MACPB180C, "PowerBook 180c", MACH_CLASSPB }, + { MACH_MACPB500, "PowerBook 500", MACH_CLASSPB }, /* The Duos */ - {MACH_MACPB210, "PowerBook Duo", " 210", MACH_CLASSDUO, &romvecs[5]}, - {MACH_MACPB230, "PowerBook Duo", " 230", MACH_CLASSDUO, &romvecs[5]}, - {MACH_MACPB250, "PowerBook Duo", " 250", MACH_CLASSDUO, &romvecs[5]}, - {MACH_MACPB270, "PowerBook Duo", " 270C", MACH_CLASSDUO, &romvecs[5]}, - {MACH_MACPB280, "PowerBook Duo", " 280", MACH_CLASSDUO, &romvecs[5]}, - {MACH_MACPB280C, "PowerBook Duo", " 280C", MACH_CLASSDUO, &romvecs[5]}, + { MACH_MACPB210, "PowerBook Duo 210", MACH_CLASSDUO }, + { MACH_MACPB230, "PowerBook Duo 230", MACH_CLASSDUO }, + { MACH_MACPB250, "PowerBook Duo 250", MACH_CLASSDUO }, + { MACH_MACPB270, "PowerBook Duo 270C", MACH_CLASSDUO }, + { MACH_MACPB280, "PowerBook Duo 280", MACH_CLASSDUO }, + { MACH_MACPB280C, "PowerBook Duo 280C", MACH_CLASSDUO }, /* The Performas... */ - {MACH_MACP600, "Performa", " 600", MACH_CLASSIIvx, &romvecs[2]}, - {MACH_MACP460, "Performa", " 460", MACH_CLASSLC, &romvecs[14]}, - {MACH_MACP550, "Performa", " 550", MACH_CLASSLC, &romvecs[11]}, - {MACH_MACP580, "Performa", " 580", MACH_CLASSQ2, &romvecs[19]}, - {MACH_MACTV, "TV", "", MACH_CLASSLC, &romvecs[12]}, + { MACH_MACP600, "Performa 600", MACH_CLASSIIvx }, + { MACH_MACP460, "Performa 460", MACH_CLASSLC }, + { MACH_MACP550, "Performa 550", MACH_CLASSLC }, + { MACH_MACP580, "Performa 580", MACH_CLASSQ2 }, + { MACH_MACTV, "TV", MACH_CLASSLC }, /* The LCs... */ - {MACH_MACLCII, "LC", " II", MACH_CLASSLC, &romvecs[3]}, - {MACH_MACLCIII, "LC", " III", MACH_CLASSLC, &romvecs[14]}, - {MACH_MACLC475, "LC", " 475", MACH_CLASSQ, &romvecs[9]}, - {MACH_MACLC520, "LC", " 520", MACH_CLASSLC, &romvecs[15]}, - {MACH_MACLC575, "LC", " 575", MACH_CLASSQ2, &romvecs[16]}, - {MACH_MACCCLASSIC, "Color Classic", "", MACH_CLASSLC, &romvecs[3]}, - {MACH_MACCCLASSICII, "Color Classic"," II", MACH_CLASSLC, &romvecs[3]}, + { MACH_MACLCII, "LC II", MACH_CLASSLC }, + { MACH_MACLCIII, "LC III", MACH_CLASSLC }, + { MACH_MACLC475, "LC 475", MACH_CLASSQ }, + { MACH_MACLC520, "LC 520", MACH_CLASSLC }, + { MACH_MACLC575, "LC 575", MACH_CLASSQ2 }, + { MACH_MACCCLASSIC, "Color Classic", MACH_CLASSLC }, + { MACH_MACCCLASSICII, "Color ClassicII", MACH_CLASSLC }, /* Does this belong here? */ - {MACH_MACCLASSICII, "Classic", " II", MACH_CLASSLC, &romvecs[3]}, + { MACH_MACCLASSICII, "Classic II", MACH_CLASSLC }, /* The unknown one and the end... */ - {0, "Unknown", "", MACH_CLASSII, NULL}, - {0, NULL, NULL, 0, NULL}, + { 0, "Unknown", MACH_CLASSII } }; /* End of cpu_models[] initialization. */ struct { @@ -2079,14 +1416,6 @@ struct { char cpu_model[120]; /* for sysctl() */ -int mach_cputype(void); - -int -mach_cputype() -{ - return (mac68k_machine.mach_processor); -} - int fpu_probe() { @@ -2161,9 +1490,8 @@ identifycpu() /* * Print the machine type... */ - snprintf(cpu_model, sizeof cpu_model, "Apple Macintosh %s%s", - cpu_models[mac68k_machine.cpu_model_index].model_major, - cpu_models[mac68k_machine.cpu_model_index].model_minor); + snprintf(cpu_model, sizeof cpu_model, "Apple Macintosh %s", + cpu_models[mac68k_machine.cpu_model_index].model); /* * ... and the CPU type... @@ -2242,18 +1570,14 @@ get_machine_info() { int i; - for (i = 0; cpu_models[i].model_major; i++) + for (i = 0; cpu_models[i].machineid != 0; i++) if (mac68k_machine.machineid == cpu_models[i].machineid) break; - if (cpu_models[i].model_major == NULL) - i--; - mac68k_machine.cpu_model_index = i; } struct cpu_model_info *current_mac_model; -romvec_t *mrg_MacOSROMVectors = 0; /* * Sets a bunch of machine-specific variables @@ -2400,14 +1724,6 @@ setmachdep() case MACH_CLASSH: break; } - - /* - * Set up current ROM Glue vectors. Actually now all we do - * is save the address of the ROM Glue Vector table. This gets - * used later when we re-map the vectors from MacOS Address - * Space to BSD Address Space. - */ - mrg_MacOSROMVectors = cpui->rom_vectors; } /* diff --git a/sys/arch/mac68k/mac68k/macrom.c b/sys/arch/mac68k/mac68k/macrom.c deleted file mode 100644 index 7e7adca2b1a..00000000000 --- a/sys/arch/mac68k/mac68k/macrom.c +++ /dev/null @@ -1,1303 +0,0 @@ -/* $OpenBSD: macrom.c,v 1.30 2006/01/04 20:39:05 miod Exp $ */ -/* $NetBSD: macrom.c,v 1.47 2000/11/15 07:15:36 scottr Exp $ */ - -/*- - * Copyright (C) 1994 Bradley A. Grantham - * 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 Bradley A. Grantham. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Mac ROM Glue - * - * This allows MacBSD to access (in a limited fashion) routines included - * in the Mac ROMs, like ADBReInit. - * - * As a (fascinating) side effect, this glue allows ROM code (or any other - * MacOS code) to call MacBSD kernel routines, like NewPtr. - * - * Uncleaned-up weirdness, - * This doesn't work on a lot of machines. Perhaps the IIsi stuff - * can be generalized somewhat for others. It looks like most machines - * are similar to the IIsi ("Universal ROMs"?). - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/queue.h> - -#include <uvm/uvm_extern.h> - -#include <machine/cpu.h> -#include <machine/frame.h> -#include <machine/viareg.h> - -#include <mac68k/dev/adbvar.h> - - /* trap modifiers (put it macrom.h) */ -#define TRAP_TOOLBOX(a) ((a) & 0x800) -#define TRAP_PASSA0(a) ((a) & 0x100) -#define TRAP_NUM(a) (TRAP_TOOLBOX(a) ? (a) & 0x3ff : (a) & 0xff) -#define TRAP_SYS(a) ((a) & 0x400) -#define TRAP_CLEAR(a) ((a) & 0x200) - - - /* Mac Rom Glue global variables */ -/* - * ADB Storage. Is 512 bytes enough? Too much? - */ -u_char mrg_adbstore[512]; -u_char mrg_adbstore2[512]; -u_char mrg_adbstore3[512]; -u_char mrg_ExpandMem[512]; /* 0x1ea Bytes minimum */ -u_char mrg_adbstore4[32]; /* 0x16 bytes was the largest I found yet */ -u_char mrg_adbstore5[80]; /* 0x46 bytes minimum */ - -/* - * InitEgret in the AV ROMs requires a low memory global at 0x2010 to be - * pointed at this jump table, which can be found at 0x40803280. It's - * included here so we can do mrg_fixupROMBase on it. - */ - -u_int32_t mrg_AVInitEgretJT[] = { - 0x408055D0, 0x4083985A, 0x40839AB6, 0x4080F180, - 0x4080C0B6, 0x4080C30A, 0x4080C380, 0x4080C482, - 0x4080C496, 0x4080C82E, 0x4080C9FE, 0x4080CA16, - 0x4081D1D6, 0x4085CDDE, 0x4080DF28, 0x4080DFC6, - 0x4080E292, 0x4080E2C0, 0x4080E348, 0x4080E600, - 0x4080E632, 0x4080E6B8, 0x4080E6E4, 0x4080E750, - 0x4080E776, 0x4080E7B4, 0x408B90E0, 0x40852490, - 0x40852280, 0x40852410, 0x4080E8F0, 0x4080E940, - 0x4080E960, 0x4080E9B0, 0x4080E9E0, 0x4080EA50, - 0x4080EA70, 0x4080EB14, 0x4080EBC0, 0x4081D1D6, - 0x40810AB0, 0x40810BDA, 0x40810CCA, 0x40810FF2, - 0x4080FF8C, 0x40810292, 0x40812CE2, 0x40813AAE, - 0x40813AE0, 0x408113DE, 0x40811EB0, 0x40811FA0, - 0x40811DD0, 0x4083B720, 0x408412E0, 0x40841300, - 0x40841380, 0x4083A390, 0x408411F0 -}; - -caddr_t mrg_romadbintr = (caddr_t)0; /* ROM ADB interrupt */ -caddr_t mrg_rompmintr = 0; /* ROM PM (?) interrupt */ -const char *mrg_romident = NULL; /* ident string for ROMs */ -caddr_t mrg_ADBAlternateInit = 0; -caddr_t mrg_InitEgret = 0; -caddr_t mrg_ADBIntrPtr = (caddr_t)0x0; /* ADB interrupt taken from MacOS vector table*/ -caddr_t ROMResourceMap = 0; -extern romvec_t *mrg_MacOSROMVectors; -#if defined(MRG_TEST) || defined(MRG_DEBUG) -caddr_t ResHndls[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 -}; -#else -caddr_t ResHndls[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 -}; -#endif - -/* - * Last straw functions; we didn't set them up, so freak out! - * When someone sees these called, we can finally go back and - * bother to implement them. - */ - -int -mrg_Delay() -{ -#define TICK_DURATION 16625 - u_int32_t ticks; - - __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); -#endif - delay(ticks * TICK_DURATION); - - /* - * The number of ticks since startup should be - * returned here. Until someone finds a need for - * this, we just return the requested number - * of ticks - */ - return (ticks); -} - -/* - * Handle the Deferred Task manager here - * - */ -static caddr_t mrg_DTList = NULL; - -void -mrg_DTInstall() -{ - caddr_t ptr, prev; - - __asm __volatile ("movl a0, %0" : "=g" (ptr)); - - (caddr_t *)prev = &mrg_DTList; - while (*prev != NULL) - prev = *(caddr_t *)prev; - *(caddr_t *)ptr = NULL; - *(caddr_t *)prev = ptr; - setsoftdtmgr(); - - __asm __volatile ("clrl d0" : : : "d0"); -} - -void -mrg_execute_deferred() -{ - caddr_t ptr; - int s; - - while (mrg_DTList != NULL) { - s = splhigh(); - ptr = *(caddr_t *)mrg_DTList; - mrg_DTList = *(caddr_t *)ptr; - splx(s); - - __asm __volatile (" - moveml a0-a6/d1-d7,sp@- - movl %0, a0 - movl a0@(8), a2 - movl a0@(12), a1 - jsr a2@ - moveml sp@+,a0-a6/d1-d7" : : "g" (ptr)); - } -} - -void -mrg_VBLQueue() -{ -#define qLink 0 -#define qType 4 -#define vblAddr 6 -#define vblCount 10 -#define vblPhase 12 - caddr_t vbltask; - caddr_t last_vbltask; - - last_vbltask = (caddr_t)&VBLQueue_head; - vbltask = VBLQueue_head; - while (0 != vbltask) { - if (0 != *((u_int16_t *)(vbltask + vblPhase))) - *((u_int16_t *)(vbltask + vblPhase)) -= 1; - else if (0 != *((u_int16_t *)(vbltask + vblCount))) - *((u_int16_t *)(vbltask + vblCount)) -= 1; - else { -#if defined(MRG_DEBUG) - printf("mrg: mrg_VBLQueue: calling VBL task at 0x%x with VBLTask block at %p\n", - *((u_int32_t *)(vbltask + vblAddr)), vbltask); -#endif - __asm __volatile(" - movml #0xfffe, sp@- - movl %0, a0 - movl %1, a1 - jbsr a1@ - movml sp@+, #0x7fff" - : : "g" (vbltask), - "g" (*((caddr_t)(vbltask + vblAddr))) - : "a0", "a1"); -#if defined(MRG_DEBUG) - printf("mrg: mrg_VBLQueue: back from VBL task\n"); -#endif - if (0 == *((u_int16_t *)(vbltask + vblCount))) { -#if defined(MRG_DEBUG) - printf("mrg: mrg_VBLQueue: removing VBLTask block at %p\n", - vbltask); -#endif - *((u_int32_t *)(last_vbltask + qLink)) = - *((u_int32_t *)(vbltask + qLink)); - /* - * can't free memory from VBLTask block as - * we don't know where it came from - */ - if (vbltask == VBLQueue_tail) - VBLQueue_tail = last_vbltask; - } - } - last_vbltask = vbltask; - vbltask = (caddr_t) *((u_int32_t *)(vbltask + qLink)); - } -} - -void -mrg_init_stub_1() -{ - __asm __volatile ("movml #0xffff, sp@-"); - printf("mrg: hit mrg_init_stub_1\n"); - __asm __volatile ("movml sp@+, #0xffff"); -} - -void -mrg_init_stub_2() -{ - panic("mrg: hit mrg_init_stub_2"); -} - -short -Count_Resources(u_int32_t rsrc_type) -{ - rsrc_t *rsrc = (rsrc_t *)ROMResourceMap; - short count = 0; - -#if defined(MRG_DEBUG) - printf("Count_Resources looking for 0x%08lx at 0x%08lx\n", - (long)rsrc_type, (long)rsrc); -#endif - /* - * Return a Count of all the ROM Resouces of the requested type. - */ - if (ROMResourceMap == 0) - panic("Oops! Need ROM Resource Map ListHead address!"); - - while (rsrc != 0) { -#if defined(MRG_DEBUG) - if (rsrc_type == 0) - printf("0x%08lx: %04x %04x %04x %04x %08x %08x %08x %04x\n", - (long)rsrc, rsrc->unknown[0], rsrc->unknown[1], - rsrc->unknown[2], rsrc->unknown[3], rsrc->next, - rsrc->body, rsrc->name, rsrc->index); -#endif - if (rsrc_type == 0 || (rsrc_type == rsrc->name)) - count++; - rsrc = rsrc->next == 0 ? 0 : (rsrc_t *)(rsrc->next + ROMBase); - } - -#if defined(MRG_DEBUG) - printf("Count_Resources found %d\n", count); -#endif - return count; -} - -caddr_t * -Get_Ind_Resource(u_int32_t rsrc_type, u_int16_t rsrc_ind) -{ - rsrc_t *rsrc = (rsrc_t *)ROMResourceMap; - short i = 0; - - /* - * This routine return the "Handle" to a ROM Resource. Since few - * ROM Resources are called for in OpenBSD we keep a small table - * for the Handles we return. (Can't reuse the Handle without - * defeating the purpose for a Handle in the first place!) If - * we get more requests than we have space for, we panic. - */ - if (ROMResourceMap == 0) - panic("Oops! Need ROM Resource Map ListHead address!"); - - while (rsrc != 0) { - if (rsrc_type == rsrc->name) { - rsrc_ind--; - if (rsrc_ind == 0) { - for (i = 0; - i < sizeof(ResHndls) / sizeof(caddr_t); i++) - if ((ResHndls[i] == 0) || - (ResHndls[i] == (caddr_t)(rsrc->next + ROMBase))) { - ResHndls[i] = (caddr_t)(rsrc->body + ROMBase); - return (caddr_t *)&ResHndls[i]; - } - panic("ResHndls table too small!"); - } - } - rsrc = rsrc->next == 0 ? 0 : (rsrc_t *)(rsrc->next + ROMBase); - } - return (caddr_t *)0; -} - -void -mrg_FixDiv() -{ - panic("Oops! Need ROM address of _FixDiv for this system!"); -} - -void -mrg_FixMul() -{ - panic("Oops! Need ROM address of _FixMul for this system!"); -} - -void -mrg_1sec_timer_tick() -{ - /* The timer tick from the Egret chip triggers this routine via - * Lvl1DT[0] (addr 0x192) once every second. - */ -} - -void -mrg_lvl1dtpanic() /* Lvl1DT stopper */ -{ - printf("Agh! I was called from Lvl1DT!!!\n"); -#ifdef DDB - Debugger(); -#endif -} - -void -mrg_lvl2dtpanic() /* Lvl2DT stopper */ -{ - panic("Agh! I was called from Lvl2DT!!!"); -} - -void -mrg_jadbprocpanic() /* JADBProc stopper */ -{ - panic("Agh! Called JADBProc!"); -} - -void -mrg_jswapmmupanic() /* jSwapMMU stopper */ -{ - panic("Agh! Called jSwapMMU!"); -} - -void -mrg_jkybdtaskpanic() /* JKybdTask stopper */ -{ - panic("Agh! Called JKybdTask!"); -} - -#ifdef MRG_ADB -/* - * mrg_adbintr() and mrg_pmintr() are defined in adb_direct.c if we - * not using the MRG method of accessing the ADB/PRAM/RTC. - */ - -int -mrg_adbintr() /* Call ROM ADB Interrupt */ -{ - if (mrg_romadbintr != NULL) { -#if defined(MRG_TRACE) - tron(); -#endif - - /* Gotta load a1 with VIA address. */ - /* ADB int expects it from Mac intr routine. */ - __asm __volatile (" - movml #0xffff, sp@- - movl %0, a0 - movl _VIA, a1 - jbsr a0@ - movml sp@+, #0xffff" - : - : "g" (mrg_romadbintr) - : "a0", "a1"); - -#if defined(MRG_TRACE) - troff(); -#endif - - } - return (1); -} - -int -mrg_pmintr() /* Call ROM PM Interrupt */ -{ - if (mrg_rompmintr != NULL) { -#if defined(MRG_TRACE) - tron(); -#endif - - /* Gotta load a1 with VIA address. */ - /* ADB int expects it from Mac intr routine. */ - __asm __volatile (" - movml #0xffff, sp@- - movl %0, a0 - movl _VIA, a1 - jbsr a0@ - movml sp@+, #0xffff" - : - : "g" (mrg_rompmintr) - : "a0", "a1"); - -#if defined(MRG_TRACE) - troff(); -#endif - } - return (1); -} -#endif /* MRG_ADB */ - - -void -mrg_notrap() -{ - printf("Aigh!\n"); - panic("mrg_notrap: We're doomed!"); -} - -int -myowntrap() -{ - printf("Oooo! My Own Trap Routine!\n"); - return (50); -} - -int -mrg_NewPtr() -{ - int result = noErr; - u_int numbytes; -/* u_int32_t trapword; */ - caddr_t ptr; - - __asm __volatile ("movl d0, %0" : "=g" (numbytes) : : "d0"); - -#if defined(MRG_SHOWTRAPS) - printf("mrg: NewPtr(%d bytes, ? clear, ? sys)", numbytes); -#endif - - /* plus 4 for size */ - ptr = malloc(numbytes + 4 , M_DEVBUF, M_NOWAIT); /* ?? */ - /* We ignore "Sys;" where else would it come from? */ - /* plus, (I think), malloc clears block for us */ - - if (ptr == NULL) { - result = memFullErr; -#if defined(MRG_SHOWTRAPS) - printf(" failed.\n"); -#endif - }else{ -#if defined(MRG_SHOWTRAPS) - printf(" succeded = %p.\n", ptr); -#endif - *(u_int32_t *)ptr = numbytes; - ptr += 4; - bzero(ptr, numbytes); /* NewPtr, Clear ! */ - } - - __asm __volatile("movl %0, a0" : : "g" (ptr) : "a0"); - return (result); -} - -int -mrg_DisposPtr() -{ - int result = noErr; - caddr_t ptr; - - __asm __volatile("movl a0, %0" : "=g" (ptr) : : "a0"); - -#if defined(MRG_SHOWTRAPS) - printf("mrg: DisposPtr(%p)\n", ptr); -#endif - - if (ptr == 0) - result = memWZErr; - else - free(ptr - 4, M_DEVBUF); - - return (result); -} - -int -mrg_GetPtrSize() -{ - caddr_t ptr; - - __asm __volatile("movl a0, %0" : "=g" (ptr) : : "a0"); - -#if defined(MRG_SHOWTRAPS) - printf("mrg: GetPtrSize(%p)\n", ptr); -#endif - - if (ptr == 0) - return (memWZErr); - else - return (*(int *)(ptr - 4)); -} - -int -mrg_SetPtrSize() -{ - caddr_t ptr; - int newbytes; - - __asm __volatile(" - movl a0, %0 - movl d0, %1" - : "=g" (ptr), "=g" (newbytes) : : "d0", "a0"); - -#if defined(MRG_SHOWTRAPS) - printf("mrg: SetPtrSize(%p, %d) failed\n", ptr, newbytes); -#endif - - return (memFullErr); /* How would I handle this, anyway? */ -} - -int -mrg_PostEvent() -{ - return 0; -} - -void -mrg_StripAddress() -{ -} - -int -mrg_SetTrapAddress() -{ - extern caddr_t mrg_OStraps[]; - caddr_t ptr; - int trap_num; - - __asm __volatile(" - movl a0, %0 - movl d0, %1" - : "=g" (ptr), "=g" (trap_num) : : "d0", "a0"); - -#if defined(MRG_DEBUG) - printf("mrg: trap 0x%x set to 0x%lx\n", trap_num, (long)ptr); -#endif - mrg_OStraps[trap_num] = ptr; -/* - * If the Trap for Egret was changed, we'd better remember it! - */ - if (trap_num == 0x92) { -#if defined(MRG_DEBUG) - printf("mrg: reconfigured Egret address from 0x%lx to 0x%lx\n", - (long)jEgret, (long)ptr); -#endif - jEgret = (void (*))ptr; - } - return 0; -} - -/* - * trap jump address tables (different per machine?) - * Can I just use the tables stored in the ROMs? - * *Is* there a table stored in the ROMs? - * We only initialize the A-Traps for the routines we have - * provided ourselves. The routines we will be trying to - * use out of the MacROMs will be initialized at run-time. - * I did this to make the code easier to follow and to keep - * from taking an unexpected side trip into the MacROMs on - * those systems we don't have fully decoded. - */ -caddr_t mrg_OStraps[256] = { -#ifdef __GNUC__ - /* God, I love gcc. see GCC2 manual, section 2.17, */ - /* "labeled elements in initializers." */ - [0x1e] (caddr_t)mrg_NewPtr, - (caddr_t)mrg_DisposPtr, - (caddr_t)mrg_SetPtrSize, - (caddr_t)mrg_GetPtrSize, - [0x2f] (caddr_t)mrg_PostEvent, - [0x3b] (caddr_t)mrg_Delay, - [0x47] (caddr_t)mrg_SetTrapAddress, - [0x55] (caddr_t)mrg_StripAddress, - [0x82] (caddr_t)mrg_DTInstall, -#else -#error "Using a GNU C extension." -#endif -}; - -caddr_t mrg_ToolBoxtraps[1024] = { - [0x19c] (caddr_t)mrg_CountResources, - [0x19d] (caddr_t)mrg_GetIndResource, - [0x1a0] (caddr_t)mrg_GetResource, - [0x1af] (caddr_t)mrg_ResError, -}; - -/* - * Handle a supervisor mode A-line trap. - */ -void -mrg_aline_super(struct frame *frame) -{ - caddr_t trapaddr; - u_short trapword; - int isOStrap; - int trapnum; - int a0passback; - u_int32_t a0bucket, d0bucket; - int danprint=0; /* This shouldn't be necessary, but seems to be. */ - -#if defined(MRG_DEBUG) - printf("mrg: a super"); -#endif - - trapword = *(u_short *)frame->f_pc; - - if (trapword == 0xa71e) - danprint = 1; - -#if defined(MRG_DEBUG) - printf(" wd 0x%lx", (long)trapword); -#endif - isOStrap = ! TRAP_TOOLBOX(trapword); - trapnum = TRAP_NUM(trapword); - - if (danprint) { - /* - * Without these print statements, ADBReInit fails on IIsi - * It is unclear why--perhaps a compiler bug? delay()s do not - * work, nor does some assembly similar to the printf calls. - * A printf(""); is sufficient, but gcc -Wall is noisy about - * it, so I figured backspace is harmless enough... - */ - printf(" "); printf("\010"); - } - -#if defined(MRG_DEBUG) - printf(" %s # 0x%x", isOStrap? "OS" : - "ToolBox", trapnum); -#endif - - /* - * Only OS Traps come to us; _alinetrap takes care of ToolBox - * traps, which are a horrible Frankenstein-esque abomination. - */ - - trapaddr = mrg_OStraps[trapnum]; -#if defined(MRG_DEBUG) - printf(" addr 0x%lx\n", (long)trapaddr); - printf(" got: d0 = 0x%8x, a0 = 0x%8x, called from: 0x%8x\n", - frame->f_regs[0], frame->f_regs[8], frame->f_pc ); -#endif - if (trapaddr == NULL) { - printf("unknown %s trap 0x%x, no trap address available\n", - isOStrap ? "OS" : "ToolBox", trapword); - panic("mrg_aline_super()"); - } - a0passback = TRAP_PASSA0(trapword); - -#if defined(MRG_TRACE) - tron(); -#endif - -/* put a0 in a0 */ -/* put a1 in a1 */ -/* put d0 in d0 */ -/* put d1 in d1 */ -/* put trapaddr in a2 */ -/* save a6 */ -/* call the damn routine */ -/* restore a6 */ -/* store d0 in d0bucket */ -/* store a0 in d0bucket */ -/* This will change a2,a1,d1,d0,a0 and possibly a6 */ - - __asm __volatile (" - movl %2@, d0 - movl %2@(4), d1 - movl %2@(32), a0 - movl %2@(36), a1 - movl %3, a2 - jbsr a2@ - movl a0, %0 - movl d0, %1" - - : "=g" (a0bucket), "=g" (d0bucket) - - : "a" (&frame->f_regs), "g" (trapaddr) - - : "d0", "d1", "a0", "a1", "a2", "a6"); - -#if defined(MRG_TRACE) - troff(); -#endif -#if defined(MRG_DEBUG) - printf(" result: d0 = 0x%8x, a0 = 0x%8x\n", - d0bucket, a0bucket ); - printf(" bk"); -#endif - - frame->f_regs[0] = d0bucket; - if (a0passback) - frame->f_regs[8] = a0bucket; - - frame->f_pc += 2; /* skip offending instruction */ - -#if defined(MRG_DEBUG) - printf(" exit\n"); -#endif -} - -extern u_int32_t traceloopstart[]; -extern u_int32_t traceloopend; -extern u_int32_t *traceloopptr; - -void -dumptrace() -{ -#if defined(MRG_TRACE) - u_int32_t *traceindex; - - printf("instruction trace:\n"); - traceindex = traceloopptr + 1; - while (traceindex != traceloopptr) { - printf(" %08x\n", *traceindex++); - if (traceindex == &traceloopend) - traceindex = &traceloopstart[0]; - } -#else - printf("mrg: no trace functionality enabled\n"); -#endif -} - - /* To find out if we're okay calling ROM vectors */ -int -mrg_romready() -{ - return (mrg_romident != NULL); -} - -extern unsigned long IOBase; -extern volatile u_char *sccA; - - /* initialize Mac ROM Glue */ -void -mrg_init() -{ - char *findername = "MacBSD FakeFinder"; - vaddr_t va; - int i; -#if defined(MRG_TEST) - caddr_t ptr; - short rcnt; - int sizeptr; - extern short mrg_ResErr; - caddr_t *handle; -#endif - - /* - * Clear the VBLQueue. - */ - VBLQueue = (u_int16_t) 0; - VBLQueue_head = (caddr_t) 0; - VBLQueue_tail = (caddr_t) 0; - -#if defined(MRG_TEST) - if (ROMResourceMap) { - printf("mrg: testing CountResources\n"); - __asm __volatile (" - clrl sp@- - clrl sp@- - .word 0xa99c - movw sp@+, %0" - : "=g" (rcnt)); - printf("mrg: found %d resources in ROM\n", rcnt); - __asm __volatile (" - clrl sp@- - movl #0x44525652, sp@- - .word 0xa99c - movw sp@+, %0" - : "=g" (rcnt)); - printf("mrg: %d are DRVR resources\n", rcnt); - if (rcnt == 0) - panic("Oops! No DRVR Resources found in ROM"); - } -#endif -#if defined(MRG_TEST) - if (ROMResourceMap) { - printf("mrg: testing GetIndResource\n"); - __asm __volatile (" - clrl sp@- - movl #0x44525652, sp@- - movw #0x01, sp@- - .word 0xa99d - movl sp@+, %0" - : "=g" (handle)); - printf("Handle to first DRVR resource is %p\n", handle); - printf("DRVR: 0x%08lx -> 0x%08lx -> 0x%08lx\n", - (long)Get_Ind_Resource(0x44525652, 1), - (long)*Get_Ind_Resource(0x44525652, 1), - (long)*((u_int32_t *)*Get_Ind_Resource(0x44525652, 1))); - __asm __volatile (" - clrl sp@- - movl #0x44525652, sp@- - movw #0x02, sp@- - .word 0xa99d - movl sp@+, %0" - : "=g" (handle)); - printf("Handle to second DRVR resource is %p\n", handle); - printf("DRVR: 0x%08lx -> 0x%08lx -> 0x%08lx\n", - (long)Get_Ind_Resource(0x44525652, 2), - (long)*Get_Ind_Resource(0x44525652, 2), - (long)*((u_int32_t *)*Get_Ind_Resource(0x44525652, 2))); - } -#endif - if (mrg_romready()) { - printf("mrg: '%s' ROM glue", mrg_romident); - -#if defined(MRG_TRACE) -#if defined(MRG_FOLLOW) - printf(", tracing on (verbose)"); -#else /* ! defined (MRG_FOLLOW) */ - printf(", tracing on (silent)"); -#endif /* defined(MRG_FOLLOW) */ -#else /* !defined(MRG_TRACE) */ - printf(", tracing off"); -#endif /* defined(MRG_TRACE) */ - -#if defined(MRG_DEBUG) - printf(", debug on"); -#else /* !defined(MRG_DEBUG) */ - printf(", debug off"); -#endif /* defined(MRG_DEBUG) */ - -#if defined(MRG_SHOWTRAPS) - printf(", verbose traps"); -#else /* !defined(MRG_SHOWTRAPS) */ - printf(", silent traps"); -#endif /* defined(MRG_SHOWTRAPS) */ - }else{ - printf("mrg: kernel has no ROM vectors for this machine!\n"); - return; - } - - printf("\n"); - -#if defined(MRG_DEBUG) - printf("mrg: start init\n"); -#endif - /* expected globals */ - ExpandMem = &mrg_ExpandMem[0]; - *((u_int16_t *)(mrg_ExpandMem + 0x00) ) = 0x0123; /* magic (word) */ - *((u_int32_t *)(mrg_ExpandMem + 0x02) ) = 0x000001ea; /* Length of table (long) */ - *((u_int32_t *)(mrg_ExpandMem + 0x1e0)) = (u_int32_t) &mrg_adbstore4[0]; - - *((u_int32_t *)(mrg_adbstore4 + 0x8)) = (u_int32_t) mrg_init_stub_1; - *((u_int32_t *)(mrg_adbstore4 + 0xc)) = (u_int32_t) mrg_init_stub_2; - *((u_int32_t *)(mrg_adbstore4 + 0x4)) = (u_int32_t) &mrg_adbstore5[0]; - - *((u_int32_t *)(mrg_adbstore5 + 0x08)) = (u_int32_t) 0x00100000; - *((u_int32_t *)(mrg_adbstore5 + 0x0c)) = (u_int32_t) 0x00100000; - *((u_int32_t *)(mrg_adbstore5 + 0x16)) = (u_int32_t) 0x00480000; - - ADBBase = &mrg_adbstore[0]; - ADBState = &mrg_adbstore2[0]; - ADBYMM = &mrg_adbstore3[0]; - MinusOne = 0xffffffff; - Lo3Bytes = 0x00ffffff; - VIA = (caddr_t)Via1Base; - MMU32Bit = 1; /* ?means MMU is in 32 bit mode? */ - if (TimeDBRA == 0) - TimeDBRA = 0xa3b; /* BARF default is Mac II */ - if (ROMBase == 0) - panic("ROMBase not set in mrg_init()!"); - - strlcpy(FinderName + 1, findername, sizeof FinderName - 1); - FinderName[0] = (u_char) strlen(findername); -#if defined(MRG_DEBUG) - printf("After setting globals\n"); -#endif - - /* Fake jump points */ - for (i = 0; i < 8; i++) /* Set up fake Lvl1DT */ - Lvl1DT[i] = mrg_lvl1dtpanic; - for (i = 0; i < 8; i++) /* Set up fake Lvl2DT */ - Lvl2DT[i] = mrg_lvl2dtpanic; - Lvl1DT[0] = (void (*)(void))mrg_1sec_timer_tick; - Lvl1DT[2] = (void (*)(void))mrg_romadbintr; - Lvl1DT[4] = (void (*)(void))mrg_rompmintr; - JADBProc = mrg_jadbprocpanic; /* Fake JADBProc for the time being */ - jSwapMMU = mrg_jswapmmupanic; /* Fake jSwapMMU for the time being */ - JKybdTask = mrg_jkybdtaskpanic; /* Fake JKybdTask for the time being */ - - /* probably very dangerous */ - jADBOp = (void (*)(void))mrg_OStraps[0x7c]; - - mrg_VIA2 = (caddr_t)(Via1Base + VIA2 * 0x2000); /* see via.h */ - SCCRd = (caddr_t)sccA; /* ser.c ; we run before serinit */ - - jDTInstall = (caddr_t)mrg_DTInstall; - - /* AV ROMs want this low memory vector to point to a jump table */ - InitEgretJTVec = (u_int32_t **)&mrg_AVInitEgretJT; - - switch (mach_cputype()) { - case MACH_68020: CPUFlag = 2; break; - case MACH_68030: CPUFlag = 3; break; - case MACH_68040: CPUFlag = 4; break; - default: - printf("mrg: unknown CPU type; cannot set CPUFlag\n"); - break; - } - -#if defined(MRG_TEST) - printf("Allocating a pointer...\n"); - ptr = (caddr_t)NewPtr(1024); - printf("Result is 0x%lx.\n", (long)ptr); - sizeptr = GetPtrSize((Ptr)ptr); - printf("Pointer size is %d\n", sizeptr); - printf("Freeing the pointer...\n"); - DisposPtr((Ptr)ptr); - printf("Free'd.\n"); - - for (i = 0; i < 500000; i++) - if ((i % 100000) == 0)printf("."); - printf("\n"); - - mrg_ResErr = 0xdead; /* set an error we know */ - printf("Getting error code...\n"); - i = ResError(); - printf("Result code (0xdeadbaaf): %x\n", i); - printf("Getting an ADBS Resource...\n"); - handle = GetResource(0x41244253, 2); - printf("Handle result from GetResource: 0x%lx\n", (long)handle); - printf("Getting error code...\n"); - i = ResError(); - printf("Result code (-192?) : %d\n", i); - - for (i = 0; i < 500000; i++) - if ((i % 100000) == 0)printf("."); - printf("\n"); - -#if defined(MRG_TRACE) - printf("Turning on a trace\n"); - tron(); - printf("We are now tracing\n"); - troff(); - printf("Turning off trace\n"); - dumptrace(); -#endif /* MRG_TRACE */ - - for (i = 0; i < 500000; i++) - if ((i % 100000) == 0) - printf("."); - printf("\n"); -#endif /* MRG_TEST */ - -#if defined(MRG_DEBUG) - printf("after setting jump points\n"); - printf("mrg: end init\n"); -#endif - - if (1) { - /* - * For the bloody Mac II ROMs, we have to map this space - * so that the PRam functions will work. - * Gee, Apple, is that a hard-coded hardware address in - * your code? I think so! (_ReadXPRam + 0x0062 on the - * II) We map the VIAs in here. The C610 apparently - * needs it, too, which means that a bunch of 040s do, too. - * Once again, I regret the mapping changes I made... -akb - */ -#ifdef DIAGNOSTIC - printf("mrg: I/O map kludge for ROMs that use hardware %s", - "addresses directly.\n"); -#endif - for (va = 0x50f00000; va < 0x50f04000; va += PAGE_SIZE) - pmap_kenter_pa(va, (paddr_t)va, UVM_PROT_RW); - pmap_update(pmap_kernel()); - } -} - -#ifdef MRG_ADB -static void setup_egret(void); - -static void -setup_egret(void) -{ - if (0 != mrg_InitEgret) { - - /* This initializes ADBState (mrg_ADBStore2) and - enables interrupts */ - __asm __volatile (" - movml a0-a2, sp@- - movl %1, a0 /* ADBState, mrg_adbstore2 */ - movl %0, a1 - jbsr a1@ - movml sp@+, a0-a2 " - : - : "g" (mrg_InitEgret), "g" (ADBState) - : "a0", "a1"); - jEgret = (void (*)) mrg_OStraps[0x92]; /* may have been set in asm() */ - } - else printf("Help ... No vector for InitEgret!!\n"); - -#if defined(MRG_DEBUG) - printf("mrg: ADBIntrVector: 0x%8lx, mrg_ADBIntrVector: 0x%8lx\n", - (long) mrg_romadbintr, - *((long *) 0x19a)); - printf("mrg: EgretOSTrap: 0x%8lx\n", - (long) mrg_OStraps[0x92]); -#endif -} -#endif - -void -mrg_initadbintr() -{ - if (mac68k_machine.do_graybars) - printf("Got following HwCfgFlags: 0x%4x, 0x%8x, 0x%8x, 0x%8x\n", - HwCfgFlags, HwCfgFlags2, HwCfgFlags3, ADBReInit_JTBL); - - if ((HwCfgFlags == 0) && (HwCfgFlags2 == 0) && (HwCfgFlags3 == 0)) { - printf("Caution: No HwCfgFlags from Booter, please " - "use at least booter version 1.8.\n"); - - if (current_mac_model->class == MACH_CLASSIIsi) { - printf(" ... Using defaults for IIsi.\n"); - - /* Egret and ADBReInit look into these HwCfgFlags */ - HwCfgFlags = 0xfc00; - HwCfgFlags2 = 0x0000773F; - HwCfgFlags3 = 0x000001a6; - } - - printf("Using HwCfgFlags: 0x%4x, 0x%8x, 0x%8x\n", - HwCfgFlags, HwCfgFlags2, HwCfgFlags3); - } - -#ifdef MRG_ADB - /* - * If we think there is an Egret in the machine, attempt to - * set it up. If not, just enable the interrupts (only on - * some machines, others are already on from ADBReInit?). - */ - if ( ((HwCfgFlags3 & 0x0e) == 0x06 ) - || ((HwCfgFlags3 & 0x70) == 0x20 )) { - if (mac68k_machine.do_graybars) - printf("mrg: setup_egret:\n"); - - setup_egret(); - - if (mac68k_machine.do_graybars) - printf("mrg: setup_egret: done.\n"); - - } else { - - if (mac68k_machine.do_graybars) - printf("mrg: Not setting up egret.\n"); - - via_reg(VIA1, vIFR) = 0x4; - via_reg(VIA1, vIER) = 0x84; - - if (mac68k_machine.do_graybars) - printf("mrg: ADB interrupts enabled.\n"); - } -#else - /* Extra Egret setup required only for MRG ADB functions. */ - printf("mrg: skipping egret setup\n"); -#endif /* MRG_ADB */ -} - -/* - * NOTE: By eliminating the setvectors routine and moving it's function - * to here we only have to deal with re-locating MacOS Addresses - * once and all in one place. - */ -void -mrg_fixupROMBase(obase, nbase) - caddr_t obase; - caddr_t nbase; -{ - u_int32_t oldbase, newbase; - romvec_t *rom; - int i; - - oldbase = (u_int32_t) obase; - newbase = (u_int32_t) nbase; - - /* - * Grab the pointer to the Mac ROM Glue Vector table - */ - rom = mrg_MacOSROMVectors; - - if (rom == NULL) - return; /* whoops! ROM vectors not defined! */ - - mrg_romident = rom->romident; - - if (0 != mrg_ADBIntrPtr) { - mrg_romadbintr = mrg_ADBIntrPtr; - printf("mrg_fixup: using ADBIntrPtr from booter: 0x%08lx\n", - (long)mrg_ADBIntrPtr); - } else - mrg_romadbintr = rom->adbintr == 0 ? - 0 : rom->adbintr - oldbase + newbase; - - mrg_rompmintr = rom->pmintr == 0 ? - 0 : rom->pmintr - oldbase + newbase; - mrg_ADBAlternateInit = rom->ADBAlternateInit == 0 ? - 0 : rom->ADBAlternateInit - oldbase + newbase; - - /* - * mrg_adbstore becomes ADBBase - */ - *((u_int32_t *)(mrg_adbstore + 0x130)) = rom->adb130intr == 0 ? - 0 : (u_int32_t) rom->adb130intr - oldbase + newbase; - - mrg_OStraps[0x77] = rom->CountADBs == 0 ? - 0 : rom->CountADBs - oldbase + newbase; - mrg_OStraps[0x78] = rom->GetIndADB == 0 ? - 0 : rom->GetIndADB - oldbase + newbase; - mrg_OStraps[0x79] = rom-> GetADBInfo == 0 ? - 0 : rom->GetADBInfo - oldbase + newbase; - mrg_OStraps[0x7a] = rom->SetADBInfo == 0 ? - 0 : rom->SetADBInfo - oldbase + newbase; - mrg_OStraps[0x7b] = rom->ADBReInit == 0 ? - 0 : rom->ADBReInit - oldbase + newbase; - mrg_OStraps[0x7c] = rom->ADBOp == 0 ? - 0 : rom->ADBOp - oldbase + newbase; - mrg_OStraps[0x85] = rom->PMgrOp == 0 ? - 0 : rom->PMgrOp - oldbase + newbase; - mrg_OStraps[0x51] = rom->ReadXPRam == 0 ? - 0 : rom->ReadXPRam - oldbase + newbase; - mrg_OStraps[0x38] = rom->WriteParam == 0 ? - 0 : rom->WriteParam - oldbase + newbase;/* WriteParam*/ - mrg_OStraps[0x3a] = rom->SetDateTime == 0 ? - 0 : rom->SetDateTime - oldbase + newbase;/*SetDateTime*/ - mrg_OStraps[0x3f] = rom->InitUtil == 0 ? - 0 : rom->InitUtil - oldbase + newbase; /* InitUtil */ - mrg_OStraps[0x51] = rom->ReadXPRam == 0 ? - 0 : rom->ReadXPRam - oldbase + newbase; /* ReadXPRam */ - mrg_OStraps[0x52] = rom->WriteXPRam == 0 ? - 0 : rom->WriteXPRam - oldbase + newbase;/* WriteXPRam */ - - if (rom->Egret == 0) { - jEgret = 0; - mrg_OStraps[0x92] = 0; - } else { - jEgret = (void (*))(rom->Egret - oldbase + newbase); - mrg_OStraps[0x92] = rom->Egret - oldbase + newbase; - } - mrg_InitEgret = rom->InitEgret == 0 ? - 0 : rom->InitEgret - oldbase + newbase; - - if (rom->jClkNoMem == 0) { - printf("WARNING: don't have a value for jClkNoMem, "); - printf("please contact: walter@ghpc8.ihf.rwth-aachen.de\n"); - printf("Can't read RTC without it. Using MacOS boot time.\n"); - jClkNoMem = 0; - } else - jClkNoMem = (void (*))(rom->jClkNoMem - oldbase + newbase); - /* - * Get the ToolBox Routines we may need. These are - * used in the ADB Initialization of some systems. - * If we don't have the ROM addresses for these routines - * we'll setup to catch the calls in our own dummy - * routines. That way we can politely tell the user - * what we'll need to complete initialization on the system. - */ - mrg_ToolBoxtraps[0x04d] = rom->FixDiv == 0 ? - (caddr_t)mrg_FixDiv : rom->FixDiv - oldbase + newbase; - mrg_ToolBoxtraps[0x068] = rom->FixMul == 0 ? - (caddr_t)mrg_FixMul : rom->FixMul - oldbase + newbase; - - /* - * Some systems also require this to be setup for use in - * ADB Initialization. Use whatever address was provided - * to us in the romvec table for this system. This may - * cause a problem on some systems, and may need a better - * Trap handler in the future. - */ - ADBReInit_JTBL = rom->ADBReInit_JTBL == 0 ? - 0 : (u_int32_t)rom->ADBReInit_JTBL - oldbase + newbase; - - /* - * Setup to trap unexpected access to ADBProc which is used in - * ADB Initialization on some systems. If the correct entry - * point in the ADBInit code is selected, this address is - * re-configured by the ROM during initialization. This feature - * is not currently used by OpenBSD. - */ - JADBProc = mrg_jadbprocpanic; - - /* - * Get the address of the first (top) Resource in the ROM. - * This will be the head of a linked list of all Resources - * in the ROM which will be mapped in mrg_InitResources. - */ - ROMResourceMap = rom->ROMResourceMap == 0 ? - 0 : (void (*))(rom->ROMResourceMap - oldbase + newbase); - - for (i = 0; i < sizeof(mrg_AVInitEgretJT) / sizeof(mrg_AVInitEgretJT[0]); i++) - mrg_AVInitEgretJT[i] = mrg_AVInitEgretJT[i] == 0 ? - 0 : mrg_AVInitEgretJT[i] - oldbase + newbase; - -#if defined(MRG_DEBUG) - printf("mrg: ROM adbintr 0x%08lx -> 0x%08lx\n", - (long)rom->adbintr, (long)mrg_romadbintr); - printf("mrg: ROM pmintr 0x%08lx -> 0x%08lx\n", - (long)rom->pmintr, (long)mrg_rompmintr); - printf("mrg: OS trap 0x77 (CountADBs) = 0x%08lx -> 0x%08lx\n", - (long)rom->CountADBs, (long)mrg_OStraps[0x77]); - printf("mrg: OS trap 0x78 (GetIndADB) = 0x%08lx -> 0x%08lx\n", - (long)rom->GetIndADB, (long)mrg_OStraps[0x78]); - printf("mrg: OS trap 0x79 (GetADBInfo) = 0x%08lx -> 0x%08lx\n", - (long)rom->GetADBInfo, (long)mrg_OStraps[0x79]); - printf("mrg: OS trap 0x7a (SetADBInfo) = 0x%08lx -> 0x%08lx\n", - (long)rom->SetADBInfo, (long)mrg_OStraps[0x7a]); - printf("mrg: OS trap 0x7b (ADBReInit) = 0x%08lx -> 0x%08lx\n", - (long)rom->ADBReInit, (long)mrg_OStraps[0x7b]); - printf("mrg: OS trap 0x7c (ADBOp) = 0x%08lx -> 0x%08lx\n", - (long)rom->ADBOp, (long)mrg_OStraps[0x7c]); - printf("mrg: OS trap 0x85 (PMgrOp) = 0x%08lx -> 0x%08lx\n", - (long)rom->PMgrOp, (long)mrg_OStraps[0x85]); - printf("mrg: OS trap 0x92 (Egret) = 0x%08lx -> 0x%08lx\n", - (long)rom->Egret, (long)mrg_OStraps[0x92]); - printf("mrg: ROM ADBAltInit 0x%08lx -> 0x%08lx\n", - (long)rom->ADBAlternateInit, (long)mrg_ADBAlternateInit); - printf("mrg: ROM ADBReInit_JTBL 0x%08lx -> 0x%08lx\n", - (long)rom->ADBReInit_JTBL, (long)ADBReInit_JTBL); - printf("mrg: ROM InitEgret 0x%08lx -> 0x%08lx\n", - (long)rom->InitEgret, (long)mrg_InitEgret); - printf("mrg: ROM Resource list-head 0x%08lx -> 0x%08lx\n", - (long)rom->ROMResourceMap, (long)ROMResourceMap); -#endif -} - -#ifdef MRG_ADB -void -ADBAlternateInit(void) -{ - if (0 == mrg_ADBAlternateInit) { - ADBReInit(); - } else { - __asm __volatile (" - movml a0-a6/d0-d7, sp@- - movl %0, a1 - movl %1, a3 - jbsr a1@ - movml sp@+, a0-a6/d0-d7" - : - : "g" (mrg_ADBAlternateInit), "g" (ADBBase) - : "a1", "a3"); - } -} -#endif /* MRG_ADB */ diff --git a/sys/arch/mac68k/mac68k/macrom.h b/sys/arch/mac68k/mac68k/macrom.h deleted file mode 100644 index 9d89ed2b9e8..00000000000 --- a/sys/arch/mac68k/mac68k/macrom.h +++ /dev/null @@ -1,245 +0,0 @@ -/* $OpenBSD: macrom.h,v 1.13 2006/01/04 20:39:05 miod Exp $ */ -/* $NetBSD: macrom.h,v 1.12 2000/11/15 07:15:36 scottr Exp $ */ - -/*- - * Copyright (C) 1994 Bradley A. Grantham - * 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 Bradley A. Grantham. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#include <sys/types.h> -#include <machine/frame.h> - - -/* Low-memory Globals */ -extern caddr_t ROMBase; /* Base address of ROM space */ -extern caddr_t ADBBase; /* Base address of ADB scratch */ -extern caddr_t ADBYMM; /* Base address of yet more ADB mem */ -extern caddr_t ADBState; /* Base address of ADB scratch ? */ -extern void (*JADBProc)(void); /* ADBReInit pre/post processing */ -extern void (*Lvl1DT[8])(void); /* VIA1 interrupt table by bit */ -extern void (*Lvl2DT[8])(void); /* VIA2 interrupt table by bit */ -extern void (*jADBOp)(void); /* low memory pointer to ADBOp */ -extern void (*jUnimplTrap)(void); /* Unimplemented trap */ - /* loglob(KbdLast, 0x218) * addr of last kbd to send */ - /* loglob(KbdType, 0x21E) * type of last kbd to send */ -extern void (*JKybdTask)(void); /* Keyboard task ptr? */ -extern u_char CPUFlag; /* Type of CPU in this machine */ -extern void (*MacJmp)(void); /* ??? */ -extern u_long Lo3Bytes; /* 0x00ffffff */ -extern u_long MinusOne; /* 0xffffffff */ -extern u_short MMU32Bit; /* MMU mode; short? */ -extern u_char Scratch8[8]; /* 8-byte scratch */ -extern u_char Scratch20[20]; /* 20-byte scratch */ -extern u_long Ticks; /* ticks since startup */ -extern u_long Time; /* ticks since startup */ -extern u_short TimeDBRA; /* DBRA's per milli */ -extern u_short ADBDelay; /* DBRAs per ADB loop, / 8 */ -extern u_char ToolScratch[8]; /* Yet another 8-byte scratch area */ -extern caddr_t VIA; /* VIA1 base address */ -extern caddr_t mrg_VIA2; /* VIA2 base address */ -extern caddr_t SCCRd; /* SCC read base address */ -extern u_char FinderName[20]; /* FinderName - Pascal string */ -extern void (*jSwapMMU)(void); /* Pointer to MMU Swap routine */ -extern void (*jEgret)(void); /* Pointer to MMU Swap routine */ -extern u_int16_t HwCfgFlags; /* Hardware config flags */ -extern u_int32_t HwCfgFlags2; /* more hardware config flags */ -extern u_int32_t HwCfgFlags3; /* more hardware config flags */ -extern u_int32_t ADBReInit_JTBL; /* pointer to patch table */ -extern void (*jClkNoMem)(void); /* pointer to ClkNoMem */ -extern u_char SysParam[20]; /* Place where PRam data gets stored */ -extern caddr_t ExpandMem; /* pointer to Expanded Memory used by */ - /* newer ADB routines (since LCIII) */ -extern u_int16_t VBLQueue; /* Vertical blanking Queue, unused ? */ -extern caddr_t VBLQueue_head; /* Vertical blanking Queue, head */ -extern caddr_t VBLQueue_tail; /* Vertical blanking Queue, tail */ -extern caddr_t jDTInstall; /* Deferred task mgr trap handler */ - -extern u_int32_t **InitEgretJTVec; /* pointer to a jump table for */ - /* InitEgret on AV machines */ - - /* Types */ - -typedef caddr_t Ptr; -typedef caddr_t *Handle; - -/* ADB Manager */ -typedef struct { - Ptr siServiceRtPtr; - Ptr siDataAreaAddr; -} ADBSetInfoBlock; -typedef struct { - unsigned char devType; - unsigned char origADBAddr; - Ptr dbServiceRtPtr; - Ptr dbDataAreaAddr; -} ADBDataBlock; - - - /* Trap Flesh; these functions are C, not Pascal */ - -/* trap tests */ -int MyOwnTrap(void); -void KnownRTS(void); - -#ifdef MRG_ADB -/* - * These functions are defined in adb_direct.c if we are not using - * the MRG method of accessing the ADB/PRAM/RTC. - */ -/* ADB Manager */ -int SetADBInfo(ADBSetInfoBlock *info, int adbAddr); -int CountADBs(void); -int GetIndADB(ADBDataBlock *info, int index); -int GetADBInfo(ADBDataBlock *info, int adbAddr); -void ADBReInit(void); - /* note different order of parameters */ -int ADBOp(Ptr buffer, Ptr compRout, Ptr data, short commandNum); -void ADBAlternateInit(void); -#endif - -/* Memory Manager */ -Ptr NewPtr(int size); -int DisposPtr(Ptr ptr); -int GetPtrSize(Ptr ptr); -int SetPtrSize(Ptr ptr, int newbytes); - -/* Resource Manager */ -Handle GetResource(u_int theType, short theID); -short ResError(void); -short mrg_CountResources(u_int32_t type); -short Count_Resources(u_int32_t rsrc_type); -caddr_t *mrg_GetIndResource(u_int16_t index, u_int32_t type); - - - /* Mac ROM Glue globals for BSD kernel */ -extern caddr_t mrg_romadbintr; -extern caddr_t mrg_ADBIntrPtr; -extern u_char mrg_GetResource[]; /* type is almost a lie; - call it an array of bytes of code */ -extern u_char mrg_ResError[]; - - - /* MacOS Error Codes */ -#define noErr 0 -#define memFullErr -108 -#define memWZErr -111 -#define resNotFound -192 - - - /* Dump instruction trace */ -void dumptrace(void); - - - /* Stuff for configuring ROM Glue */ -typedef struct rsrc_s { - u_int16_t unknown[4]; /* ???? */ - u_int32_t next; /* pointer to next resoure in list */ - u_int32_t body; /* pointer to resource body? */ - u_int32_t name; /* resource name */ - u_int16_t index; /* ???? */ -} rsrc_t; - -typedef struct romvec_s { - const char *romident; /* just to print it out */ - caddr_t adbintr; /* where is ADB interrupt */ - caddr_t pmintr; /* where is ADB/PM interrupt, on machines */ - /* that have it */ - caddr_t adb130intr; /* ADBBase[0x130] interrupt; don't know */ - /* what it is, but it's important. Don't */ - /* you love reverse engineering? */ - caddr_t CountADBs; - caddr_t GetIndADB; - caddr_t GetADBInfo; - caddr_t SetADBInfo; - caddr_t ADBReInit; - caddr_t ADBOp; - caddr_t PMgrOp; /* On machines that have it */ - caddr_t WriteParam; - caddr_t SetDateTime; - caddr_t InitUtil; - caddr_t ReadXPRam; - caddr_t WriteXPRam; - caddr_t jClkNoMem; - caddr_t ADBAlternateInit; /* more fundamental than ABDReInit */ - caddr_t Egret; - caddr_t InitEgret; /* Set up Buffer for Egret routines */ - caddr_t ADBReInit_JTBL; - caddr_t ROMResourceMap; /* Address of first Resource in linked list */ - caddr_t FixDiv; - caddr_t FixMul; -} romvec_t; - -/* - * Function prototypes. - */ - -/* macrom.c */ -void mrg_setvectors(romvec_t *rom_vectors); -int mrg_romready(void); -caddr_t *Get_Ind_Resource(u_int32_t, u_int16_t); -void mrg_initadbintr(void); -int mrg_adbintr(void); -int mrg_pmintr(void); -void mrg_fixupROMBase(caddr_t, caddr_t); -int mrg_Delay(void); -void mrg_DTInstall(void); -void mrg_execute_deferred(void); -void mrg_VBLQueue(void); -void mrg_init_stub_1(void); -void mrg_init_stub_2(void); -void mrg_1sec_timer_tick(void); -void mrg_lvl1dtpanic(void); -void mrg_lvl2dtpanic(void); -void mrg_jadbprocpanic(void); -void mrg_jswapmmupanic(void); -void mrg_jkybdtaskpanic(void); -void mrg_notrap(void); -int myowntrap(void); -int mrg_NewPtr(void); -int mrg_DisposPtr(void); -int mrg_GetPtrSize(void); -int mrg_SetPtrSize(void); -int mrg_PostEvent(void); -int mrg_SetTrapAddress(void); -void mrg_StripAddress(void); -void mrg_aline_super(struct frame *); -void mrg_init(void); -void mrg_FixDiv(void); -void mrg_FixMul(void); - -/* machdep.c */ -int mach_cputype(void); - -/* Tracing aids */ - -/* trace all instructions, not just flow changes. */ -#define tron() \ - asm("movw sr, d0 ; orw #0x8000, d0 ; movw d0, sr" : : : "d0") -#define troff() \ - asm("movw sr, d0 ; andw #0x3fff, d0 ; movw d0, sr" : : : "d0") diff --git a/sys/arch/mac68k/mac68k/macromasm.s b/sys/arch/mac68k/mac68k/macromasm.s deleted file mode 100644 index fe996f8561d..00000000000 --- a/sys/arch/mac68k/mac68k/macromasm.s +++ /dev/null @@ -1,610 +0,0 @@ -/* $OpenBSD: macromasm.s,v 1.9 2005/02/20 18:08:08 martin Exp $ */ -/* $NetBSD: macromasm.s,v 1.18 2000/11/15 07:15:36 scottr Exp $ */ - -/*- - * Copyright (C) 1994 Bradley A. Grantham - * 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 Bradley A. Grantham. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Mac ROM Glue assembly - */ - - -#include "assym.h" -#include <machine/asm.h> -#include <machine/trap.h> - - - /* Define this symbol as global with (v) value */ -#define loglob(g, v) \ - .global _/**/g ;\ - .set _/**/g, v - - /* Define this as an externally available function */ -#define function(f) \ - .global _/**/f ;\ - _/**/f: - - /* Return from a pascal function; pop (pbytes) number of bytes */ - /* passed as parameters. Should have picked up "pascal" extension */ - /* to GCC... */ -#define pascalret(pbytes) \ - movl sp@+, a0 /* get PC (I hate Pascal) */ ; \ - addl # pbytes , sp /* pop params (I hate Pascal) */ ; \ - jra a0@ /* return (I hate Pascal) */ ; \ - - -/* - * MacOS low-memory global variables. - */ - loglob(ADBBase, 0xcf8) /* ptr to ADB driver variables */ - loglob(ADBYMM, 0xd18) /* Yet more memory used by ADB/PM */ - loglob(ADBDelay, 0xcea) /* 8s of dbras per ADB delay */ - loglob(ROMBase, 0x2ae) /* ptr to ROM Base */ - loglob(Lvl1DT, 0x192) /* VIA 1 interrupt table */ - loglob(Lvl2DT, 0x1b2) /* VIA 2 interrupt table? */ - loglob(JADBProc, 0x6b8) /* ADBReinit pre/post-processing */ - loglob(jADBOp, 0x5f0) /* pointer to ADBOp */ - loglob(DeviceList, 0x8a8) /* ptr to first device entry */ - loglob(KbdLast, 0x218) /* ptr to first device entry */ - loglob(KbdType, 0x21E) /* ptr to first device entry */ - loglob(JKybdTask, 0x21A) /* keyboard task jump ptr? */ - loglob(Lo3Bytes, 0x31a) /* contains 0x00ffffff */ - loglob(MinusOne, 0xa06) /* contains 0xffffffff */ - loglob(MMU32Bit, 0xcb2) /* MMU mode (uh-oh) 1 = 32 bit? */ - loglob(CPUFlag, 0x12f) /* CPU type */ - loglob(MacJmp, 0x120) /* ?? */ - loglob(Scratch8, 0x9fa) /* 8-byte scratch area */ - loglob(Scratch20, 0x1e4) /* 20-byte scratch area */ - loglob(Ticks, 0x16a) /* ticks since system startup */ - loglob(Time, 0x20c) /* Sec since midnight, 1-1-1904 */ - loglob(TimeDBRA, 0xd00) /* dbra's per millisecond (short) */ - loglob(ToolScratch, 0x9ce) /* another 8-byte scratch area */ - loglob(VIA, 0x1d4) /* VIA1 base address */ - loglob(mrg_VIA2, 0xcec) /* VIA2 base address */ - loglob(SCCRd, 0x1d8) /* SCC read base address */ - loglob(FinderName, 0x2e0) /* Name of finder */ - loglob(jSwapMMU, 0xdbc) /* ptr to MMU swap routine */ - loglob(ADBState, 0xde0) /* ptr to ADB state information? */ - loglob(jUnimplTrap, 0x61c) /* ptr to UnimplTrap routine */ - loglob(jEgret, 0x648) /* ptr to Egret trap routine */ - loglob(HwCfgFlags , 0xb22) /* 2 bytes, h/w config flags */ - loglob(HwCfgFlags2, 0xdd0) /* 4 bytes, more h/w config flags */ - loglob(HwCfgFlags3, 0xdd4) /* 4 bytes, more h/w config flags */ - loglob(ADBReInit_JTBL, 0xdd8) /* 4 bytes, pointer to patch table */ - loglob(jClkNoMem, 0x54c) /* Pointer to ClkNoMem function */ - loglob(PramTransfer, 0x1e4) /* Transfer buffer used with PRam */ - loglob(SysParam, 0x1f8) /* Place where PRam data gets stored */ - loglob(ExpandMem, 0x2b6) /* pointer to Expanded Memory used by */ - /* newer ADB routines */ - loglob(VBLQueue, 0x160) /* Vertical blanking Queue, unused ? */ - loglob(VBLQueue_head, 0x162) /* Vertical blanking Queue, head */ - loglob(VBLQueue_tail, 0x166) /* Vertical blanking Queue, tail */ - loglob(jDTInstall, 0xd9c) /* Deferred task mgr trap handler */ - - loglob(InitEgretJTVec, 0x2010) /* pointer to a jump table for */ - /* InitEgret on AV machines */ - loglob(jCacheFlush, 0x6f4) /* setup_pm() needs this */ - -#if 0 - /* I wish I knew what these things were */ - loglob(MMUFlags, 0xcb0) - loglob(MMUFluff, 0xcb3) - loglob(MMUTbl, 0xcb4) - loglob(MMUTblSize, 0xcb8) - loglob(MMUType, 0xcb1) -#endif - - .text - .even - .global _panic - .global _printf - -#ifdef MRG_ADB /* These functions are defined here if using the - * MRG_ADB method of accessing the ADB/PRAM/RTC. - * They are in adb_direct.c. */ -/* - * Most of the following glue just takes C function calls, converts - * the parameters to the MacOS Trap parameters, and then tries to - * return the result correctly. About the only thing our C functions - * and MacOS' traps have in common is returning numerical results in - * d0. - * - * If some code actually pulls down the a-trap line, we jump right - * to the ROMs; none of this is called. - */ - -/* Initialize Utils, mainly XPRam */ - .global _InitUtil - /* - * void - */ -_InitUtil: - .word 0xa03f - rts - - -/* Initialize the ADB ------------------------------------------------------*/ - .global _ADBReInit - /* - * void - */ -_ADBReInit: - .word 0xa07b - clrl d0 - rts - - -/* Set the ADB device info for a device; routine handler and so on ---------*/ - .global _SetADBInfo - /* - * sp@(4) ADBSetInfoBlock *info - * sp@(8) int adbAddr - */ -_SetADBInfo: - movl sp@(4), a0 - movl sp@(8), d0 - .word 0xa07a - rts - - -/* Find the number of ADB devices in the device table ----------------------*/ - .global _CountADBs - /* - * void - */ -_CountADBs: - .word 0xa077 - rts - - -/* Get ADB entry from index in table ---------------------------------------*/ - .global _GetIndADB - /* - * sp@(4) ADBDataBlock *info - * sp@(8) u_short devTableIndex - */ -_GetIndADB: - movl sp@(4), a0 - movl sp@(8), d0 - .word 0xa078 - rts - - -/* Get ADB device information ----------------------------------------------*/ - .global _GetADBInfo /* - /* - * sp@(4) ADBSetInfoBlock *info - * sp@(8) int adbAddr - */ -_GetADBInfo: - movl sp@(4), a0 - movl sp@(8), d0 - .word 0xa079 - rts - - -/* Perform an ADB transaction ----------------------------------------------*/ - .global _ADBOp - /* - * sp@(4) Ptr buffer - * sp@(8) Ptr compRout - * sp@(12) Ptr data - * sp@(16) short commandNum - */ -_ADBOp: - lea sp@(4), a0 - movl sp@(16), d0 - .word 0xa07c - rts -#endif /* ifdef MRG_ADB */ - - -#if 0 -/* My Own Trap (for testing. returns 50.) ---------------------------------*/ - .global _MyOwnTrap -_MyOwnTrap: - .word 0xa000 - rts - - -/* Known RTS (for testing) -------------------------------------------------*/ - .global _KnownRTS -_KnownRTS: - .word 0xa001 - rts -#endif - - -/* Allocate memory ---------------------------------------------------------*/ - function(NewPtr) - /* - * int size - */ - movl sp@(4), d0 - .word 0xa71e /* clear and sys */ - movl a0, d0 - rts - - -/* Free memory -------------------------------------------------------------*/ - function(DisposPtr) - /* - * Ptr ptr - */ - movl sp@(4), a0 - .word 0xa01f - rts - - -/* Get size of allocated memory --------------------------------------------*/ - function(GetPtrSize) - /* - * Ptr ptr - */ - movl sp@(4), a0 - .word 0xa021 - rts - - -/* Extend allocated memory -------------------------------------------------*/ - function(SetPtrSize) - /* - * Ptr ptr - * int bytesdiff - */ - movl sp@(4), a0 - movl sp@(8), d0 - .word 0xa020 - rts - - -/* Resource manager */ - .data - .global _mrg_ResErr -_mrg_ResErr: - .word 0 - - .text -/* Return the current Resource Manager Error -------------------------------*/ - function(ResError) - /* - * void - */ - movl d2, sp@- | Toolbox trap may alter d0-d2, a0, a1 - | but C caller would save d1,a0,a1 - clrw sp@- | space for return arg (ugh) - .word 0xa9af | ResError - movw sp@+, d0 - movl sp@+, d2 | restore d2 - rts - - /* pascal */ function(mrg_ResError) - /* - * sp@(4) :short - */ -#if defined(MRG_SHOWTRAPS) - movml #0xc0c0, sp@- - pea LRE_enter - jbsr _printf - addql #4, sp - movml sp@+, #0x0303 -#endif - movw _mrg_ResErr, sp@(4) - | movw d0, sp@(4) - pascalret(0) - -LRE_enter: - .asciz "mrg: ResError()\n" - .even - -/* Find a resource in open resource files ----------------------------------*/ - function(GetResource) - /* - * sp@(4) u_int theType - * sp@(8) short theID - */ - movl sp@(8), a1 - movl sp@(4), a0 - movl d2, sp@- | Toolbox trap may alter d0-d2, a0, a1 - | but C caller would save d1,a0,a1 - clrl sp@- | space for :Handle - movl a0, sp@- - movw a1, sp@- | pascal parameters upside down - .word 0xa9a0 | GetResource - movl sp@+, d0 | return Handle - movl sp@+, d2 | restore registers - rts - - /* pascal */ function(mrg_GetResource) - /* - * sp@(10) :Handle - * sp@(6) u_int theType - * sp@(4) short theID - */ - /* For now, we return NIL, because, well, we have no resources. */ -#if defined(MRG_SHOWTRAPS) - movml #0xc0c0, sp@- - movw sp@(20), d0 - movl sp@(22), d1 - movl d0, sp@- - movl d1, sp@- - pea LGR_enter - jbsr _printf - addl #12, sp - movml sp@+, #0x0303 -#endif - clrl d0 | okay to change d0 ? - movl d0, sp@(10) | return value is NIL - movl #-192, d0 | resNotFound; that's pretty accurate. - movw d0, _mrg_ResErr | set current ResMan error - pascalret(6) | I hate Pascal. - - - -function(mrg_CountResources) -/* Original from WRU: 960120 - * sp@(4) u_int32_t rsrc_type - * sp@(8) u_int16_t nr_of_rsrcs - */ - movl sp@(4), d0 - movl d0, sp@- - jbsr _Count_Resources - addl #4, sp | pop C params - movw d0, sp@(8) | store result - pascalret(4) - -function(mrg_GetIndResource) -/* Original from WRU: 960120 - * sp@(4) u_int16_t rsrc_index - * sp@(6) u_int32_t rsrc_type - * sp@(10) caddr_t *rsrc_handle - */ - movl sp@(6), a0 - clrl d0 - movw sp@(4), d0 - movl d0, sp@- - movl a0, sp@- - jbsr _Get_Ind_Resource - addl #8, sp | pop C params - movl d0, sp@(10) | store result - pascalret(6) - -/* - * I'd like to take a moment here to talk about the calling convention - * for ToolBox routines. Inside Mac "Operating System Utilities," - * page 8-16, "About the Trap Manager," states that ToolBox routines - * may alter D0-D2 and A0-A1. However, a crucial bit of code in - * ADBReInit on the Mac II, 0x40807834, does not save its own D1 or A1 - * before calling GetResource. Therefore, it is imperative that our - * MacBSD ToolBox trap handler save at least D1, D2, A0, and A1. I - * believe that the system uses D0 in most places to hold the function's - * return value, as in "movl sp@+, d0", and so I don't think it's - * that necessary to save d0 unless we find a specific case of ugliness. - * - * It surprises me during every moment that I deal with the Macintosh - * architecture how wonderful and ugly it really is. I continue to find - * pieces of beautiful, elegant code, reduced to crap by another following - * piece of code which uses global offsets, doesn't save registers, and - * makes assumptions. If only it was consistent, Mac ROMs would be a - * true example to programmers everywhere. As it stands, it is an example - * of a different kind. -Brad Grantham, September 5th, 1994 - */ - -LGR_enter: - .asciz "GetResource('0x%x', %d)\n" - .even - - -/* - * 1010 line emulator; A-line trap - * (we fake MacOS traps from here) - */ - .global _mrg_aline_super - .global _mrg_ToolBoxtraps - .global _alinetrap -_alinetrap: - clrl sp@- | pad SR to longword (I still don't know - | why we do this.) - moveml #0xffff,sp@- | save registers - movl sp, sp@- | save pointer to frame - movw sp@(FR_HW + 4), d0 | retrieve status register - andw #PSL_S, d0 | supervisor state? - bne Lalnosup | branch if supervisor - addql #4, sp | pop frame ptr - movql #T_ILLINST, d0 | user-mode fault - jra _ASM_LABEL(fault) -Lalnosup: -#define FR_PC (FR_HW+2) - movl sp@(FR_PC + 4), a0 | retrieve PC - movw a0@, d0 | retrieve trap word - btst #11, d0 | ToolBox trap? - bne Laltoolbox | branch if ToolBox - jbsr _mrg_aline_super | supervisor a-line trap -Lalrts: - addql #4, sp | pop frame ptr - movw sp@(FR_HW), sr | restore status register (I hate MacOS traps) - movl sp@(FR_PC), a0 | move PC to correct location - movl a0, sp@(FR_PC+2) - moveml sp@+, #0xffff | restore registers (some of which may have - | been magically changed) - addql #8, sp | pop alignment long, make stack look like - | ordinary jbsr - tstw d0 | Gotta do this because call might depend on it - rts | Go home (God, this is ugly.) -Laltoolbox: - addql #4, sp | pop frame ptr -#if defined(MRG_DEBUG) - movml #0xC0C0, sp@- | better save - pea LalP1 - jbsr _printf - | printf ("Toolbox trap\n"); - lea sp@(4), sp | pop - movml sp@+, #0x0303 | restore -#endif - movl a0, a1 | save PC - movw sp@(FR_HW), sr | restore status register -#if defined(MRG_DEBUG) - movml #0xC0C0, sp@- | better save - movw sr, sp@- - clrw sp@- | coerce to int - pea LalP2 - jbsr _printf - | printf ("Status register 0x%x\n", sr); - lea sp@(8), sp | pop - movml sp@+, #0x0303 | restore -#endif - btst #10, d0 | auto-pop the jump address? - beq Lalnoauto | branch if no auto-pop - pea Lalautopanic | I really don't know how to handle this - jbsr _panic -Lalnoauto: - addl #2, a1 | add 2 to PC -#if defined(MRG_DEBUG) - movml #0xC0C0, sp@- | better save - movl a1, sp@- - pea LalP4 - jbsr _printf - | printf ("return address is 0x%x\n", new pc); - lea sp@(8), sp | pop - movml sp@+, #0x0303 | restore -#endif - movl a1, sp@(FR_PC+2) | push new return address - movl d0, d1 | just in case of panic - andl #0x3ff, d0 | d0 = trap number -#if defined(MRG_DEBUG) - movml #0xC0C0, sp@- | better save - movl d0, sp@- - pea LalP5 - jbsr _printf - | printf ("trap number is 0x%x\n", trapnum); - lea sp@(8), sp | pop - movml sp@+, #0x0303 | restore -#endif - lsll #2, d0 | ptr = 4 bytes - lea _mrg_ToolBoxtraps, a0 - addl d0, a0 | get trap address - movl a0@, a0 - bne Laltbok | branch on trap addr non-zero - movl d1, sp@+ | trap word - pea Laltbnotrap - jbsr _printf - pea Laltbnogo - jbsr _panic -Laltbok: -#if defined(MRG_DEBUG) - movml #0xC0C0, sp@- | better save - movl a0, sp@- - pea LalP6 - jbsr _printf - | printf ("trap address is 0x%x\n", trapaddr); - lea sp@(8), sp | pop - movml sp@+, #0x0303 | restore -#endif - movl a0, sp@(FR_HW) | we will RTS to trap routine (ick) - moveml sp@+, #0xffff | restore registers - addql #4, sp | pop alignment long - rts | go for it - -Lalautopanic: - .asciz "mrg: A-line ToolBox trap wanted auto-pop; I don't know how" -Laltbnotrap: - .asciz "mrg: Don't know how to handle this trap: 0x%x\n" -Laltbnogo: - .asciz "mrg: can't go on" -LalP1: - .asciz "mrg: TB!" -LalP2: - .asciz " sr 0x%x" -LalP4: - .asciz " ret 0x%x" -LalP5: - .asciz " #%d" -LalP6: - .asciz " addr 0x%x\n" - .even - - - .data - .global _traceloopptr - .global _traceloopstart - .global _traceloopend - -_traceloopstart: - .space 20 * 4 | save last 20 program counters on trace trap -_traceloopend: -_traceloopptr: - .long _traceloopstart - - .text - .global _mrg_tracetrap -_mrg_tracetrap: - movl d0, sp@- | save d0 - movl a0, sp@- | save a0 - movl sp@(0x10), d0 | address of instruction - | sp@ old a0 - |sp@(4) old d0 - |sp@(8) old sr - |sp@(10) old PC - |sp@(14) exception vector - |sp@(16) address of instruction -#if defined(MRG_FOLLOW) - movml #0xc0c0, sp@- - movl d0, sp@- - pea Ltraceprint - jbsr _printf | printf("PC is %x\n", pc); - addql #8, sp - movml sp@+,#0x0303 - tstl d0 -#endif - beq LPCiszero | if PC goes to zero, freak! - movl _traceloopptr, a0 | ptr = traceloopptr; - movl d0, a0@+ | *ptr++ = PC; - cmpl #_traceloopend, a0 | if(ptr == traceloopend) - bne Lnotpast | { - movl #_traceloopstart, a0 | ptr = traceloopstart; -Lnotpast: | } - movl a0, _traceloopptr | traceloopptr = ptr; - movl sp@+, a0 | restore a0 - movl sp@+, d0 | restore d0 - rte | everything cool, return. -LPCiszero: - movl sp@+, a0 | restore a0 - movl sp@+, d0 | restore d0 - movml #0xc0c0, sp@- - pea LtracePCzero - jbsr _panic | printf("PC is zero!", pc); - addql #4, sp - movml sp@+,#0x0303 - -Ltraceprint: - .asciz "tracing, pc at 0x%08x\n" -LtracePCzero: - .asciz "PC went to zero!\n" - .even diff --git a/sys/arch/mac68k/mac68k/pmap_bootstrap.c b/sys/arch/mac68k/mac68k/pmap_bootstrap.c index 24f9ea18c96..877853d80a4 100644 --- a/sys/arch/mac68k/mac68k/pmap_bootstrap.c +++ b/sys/arch/mac68k/mac68k/pmap_bootstrap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap_bootstrap.c,v 1.36 2006/01/09 22:59:36 miod Exp $ */ +/* $OpenBSD: pmap_bootstrap.c,v 1.37 2006/01/13 19:36:46 miod Exp $ */ /* $NetBSD: pmap_bootstrap.c,v 1.50 1999/04/07 06:14:33 scottr Exp $ */ /* @@ -53,8 +53,6 @@ #include <ufs/mfs/mfs_extern.h> -#include <mac68k/mac68k/macrom.h> - #include "zsc.h" #if NZSC > 0 @@ -76,8 +74,6 @@ extern u_int32_t videorowbytes; extern u_int32_t videosize; static u_int32_t newvideoaddr; -extern caddr_t ROMBase; - void bootstrap_mac68k(int); /* @@ -98,26 +94,23 @@ extern caddr_t kernel_start; /* * Present a totally tricky view of the world here... - * - count rom and video mappings in the internal IO space (which will + * - count video mappings in the internal IO space (which will * require some contortion later on) * - no external IO space */ -#define MACHINE_IIOMAPSIZE (IIOMAPSIZE + ROMMAPSIZE + VIDMAPSIZE) +#define MACHINE_IIOMAPSIZE (IIOMAPSIZE + VIDMAPSIZE) #define MACHINE_INTIOBASE IOBase #define MACHINE_EIOMAPSIZE 0 /* vidpa internal video space for some machines * PT pages VIDMAPSIZE pages * - * rompa ROM space - * PT pages ROMMAPSIZE pages - * * XXX note that VIDMAPSIZE, hence vidlen, is needed very early * in pmap_bootstrap(), so slightly abuse the purpose of * PMAP_MD_LOCALS here... */ #define PMAP_MD_LOCALS \ - paddr_t vidpa, rompa; \ + paddr_t vidpa; \ paddr_t avail_next; \ int avail_remaining; \ int avail_range; \ @@ -129,7 +122,6 @@ extern caddr_t kernel_start; #define PMAP_MD_RELOC1() \ do { \ vidpa = eiopa - VIDMAPSIZE * sizeof(pt_entry_t); \ - rompa = vidpa - ROMMAPSIZE * sizeof(pt_entry_t); \ } while (0) /* @@ -142,13 +134,6 @@ do { \ */ #define PMAP_MD_MAPIOSPACE() \ do { \ - pte = PA2VA(rompa, u_int *); \ - epte = pte + ROMMAPSIZE; \ - protopte = ((u_int)ROMBase) | PG_RO | PG_V; \ - while (pte < epte) { \ - *pte++ = protopte; \ - protopte += NBPG; \ - } \ if (vidlen != 0) { \ pte = PA2VA(vidpa, u_int *); \ epte = pte + VIDMAPSIZE; \ @@ -164,9 +149,8 @@ do { \ #define PMAP_MD_RELOC2() \ do { \ IOBase = iiobase; \ - ROMBase = (char *)(iiobase + ptoa(IIOMAPSIZE)); \ if (vidlen != 0) { \ - newvideoaddr = iiobase + ptoa(IIOMAPSIZE + ROMMAPSIZE) \ + newvideoaddr = iiobase + ptoa(IIOMAPSIZE) \ + m68k_page_offset(mac68k_vidphys); \ } \ } while (0) @@ -209,12 +193,10 @@ bootstrap_mac68k(tc) #endif extern caddr_t esym; paddr_t nextpa; - caddr_t oldROMBase; if (mac68k_machine.do_graybars) printf("Bootstrapping OpenBSD/mac68k.\n"); - oldROMBase = ROMBase; mac68k_vidphys = videoaddr; if (((tc & 0x80000000) && (mmutype == MMU_68030)) || @@ -247,11 +229,6 @@ bootstrap_mac68k(tc) panic("Don't know how to relocate video!"); if (mac68k_machine.do_graybars) - printf("Moving ROMBase from %p to %p.\n", oldROMBase, ROMBase); - - mrg_fixupROMBase(oldROMBase, ROMBase); - - if (mac68k_machine.do_graybars) printf("Video address 0x%lx -> 0x%lx.\n", (unsigned long)videoaddr, (unsigned long)newvideoaddr); diff --git a/sys/arch/mac68k/mac68k/pram.c b/sys/arch/mac68k/mac68k/pram.c index 2ef1405c752..2dfb047ad07 100644 --- a/sys/arch/mac68k/mac68k/pram.c +++ b/sys/arch/mac68k/mac68k/pram.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pram.c,v 1.8 2006/01/04 20:39:05 miod Exp $ */ +/* $OpenBSD: pram.c,v 1.9 2006/01/13 19:36:47 miod Exp $ */ /* $NetBSD: pram.c,v 1.11 1996/10/21 05:42:29 scottr Exp $ */ /*- @@ -37,129 +37,26 @@ /* #include "stand.h" */ #include <sys/types.h> -#ifdef DEBUG -#include <sys/systm.h> -#endif #include <sys/param.h> #include <machine/viareg.h> #include <mac68k/mac68k/pram.h> -#ifdef MRG_ADB -#include <mac68k/mac68k/macrom.h> -#else #include <mac68k/dev/adbvar.h> -#endif - -#if DEBUG -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", - "July","August","September","October","November","December" }; - static char s[200]; - long year,month,day,hour,minute,seconds,i,dayperyear; - - year=1904; - month=0; /* Jan */ - day=1; - hour=0; - minute=0; - seconds=0; - - if(t == 0xffffffff) - return("<time value is -1>"); - - while (t > 0) - { - if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) - { - dayperyear=366; - daypmon[1]=29; - } - else - { - dayperyear=365; - daypmon[1]=28; - } - i=dayperyear*60*60*24; - if (t >= i) - { - t-=i; - year++; - continue; - } - i=daypmon[month]*60*60*24; - if (t >= i) - { - t-=i; - month++; - continue; - } - i=60*60*24; - if (t >= i) - { - t-=i; - day++; - continue; - } - i=60*60; - if (t >= i) - { - t-=i; - hour++; - continue; - } - i=60; - if (t >= i) - { - t-=i; - minute++; - continue; - } - seconds=t; - t=0; - } - - snprintf(s, sizeof s, "%s %ld, %ld %ld:%ld:%ld", - monstr[month],day,year,hour,minute,seconds); - - return s; -} -#endif unsigned long pram_readtime(void) { - unsigned long timedata; - - if (0 == jClkNoMem) - timedata = 0; /* cause comparision of MacOS boottime */ - /* and PRAM time to fail */ - else - timedata = getPramTime(); -#if DEBUG - printf("time read from PRAM: 0x%lx\n", timedata); - printf("Date and time: %s\n",convtime(timedata)); -#endif - - return(timedata); + return (getPramTime()); } void pram_settime(unsigned long time) { - if (0 == jClkNoMem) - return; - else return setPramTime(time); } -#ifndef MRG_ADB /* These routines are defined here only - * when the MRG_ADB method for accessing - * the ADB/PRAM/RTC isn't enabled. */ - -extern int adbHardware; /* from newadb.c */ +extern int adbHardware; /* from adb.c */ /* * getPramTime @@ -220,7 +117,4 @@ setPramTime(unsigned long time) case ADB_HW_UNKNOWN: return; } - } - -#endif /* ifndef MRG_ADB */ diff --git a/sys/arch/mac68k/mac68k/pram.h b/sys/arch/mac68k/mac68k/pram.h index c348f51f8d8..85fcd93d4ab 100644 --- a/sys/arch/mac68k/mac68k/pram.h +++ b/sys/arch/mac68k/mac68k/pram.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pram.h,v 1.6 2002/03/14 01:26:36 millert Exp $ */ +/* $OpenBSD: pram.h,v 1.7 2006/01/13 19:36:47 miod Exp $ */ /* $NetBSD: pram.h,v 1.3 1996/05/05 06:18:53 briggs Exp $ */ /* @@ -73,11 +73,5 @@ void setPramTime(unsigned long time); unsigned long pram_readtime(void); void pram_settime(unsigned long); -#ifndef MRG_ADB /* These functions exist only when ADB/PRAM/RTC - * access isn't done via the MRG_ADB method. */ - unsigned long getPramTimeII(void); void setPramTimeII(unsigned long); - -#endif - diff --git a/sys/arch/mac68k/mac68k/pramasm.s b/sys/arch/mac68k/mac68k/pramasm.s index 059c2e05586..08ebd6ce87c 100644 --- a/sys/arch/mac68k/mac68k/pramasm.s +++ b/sys/arch/mac68k/mac68k/pramasm.s @@ -1,4 +1,4 @@ -/* $OpenBSD: pramasm.s,v 1.5 2002/07/10 20:30:14 jsyn Exp $ */ +/* $OpenBSD: pramasm.s,v 1.6 2006/01/13 19:36:47 miod Exp $ */ /* $NetBSD: pramasm.s,v 1.4 1995/09/28 03:15:54 briggs Exp $ */ /* @@ -47,108 +47,9 @@ * that are defined later in this file. */ -#ifdef MRG_ADB /* These routines are defined at all - * if using the MRG_ADB method for accessing - * the ADB/PRAM/RTC. */ - - .text - - .even -.globl _readPram -_readPram: - link a6,#-4 | create a little home for ourselves - .word 0xa03f | _InitUtil to read PRam - moveml d1/a1,sp@- - moveq #0,d0 | zero out length register - moveb a6@(19),d0 | move the length byte in - moveq #0,d1 | zero out location - moveb a6@(15),d1 | now get out PRam location - lea _SysParam,a1 | start of PRam data - movel a6@(8),a0 | get our data address -_readPramAgain: - subql #1,d0 - bcs _readPramDone | see if we are through - moveb a1@(d1),a0@+ | transfer byte - addql #1,d1 | next byte - jmp _readPramAgain | do it again -_readPramDone: - clrw d0 - moveml sp@+,d1/a1 - unlk a6 | clean up after ourselves - rts | and return to caller - - -.globl _writePram -_writePram: - link a6,#-4 | create a little home for ourselves - .word 0xa03f | _InitUtil to read PRam in the case it hasn't been read yet - moveml d1/a1,sp@- - moveq #0,d0 | zero out length register - moveb a6@(19),d0 | move the length byte in - moveq #0,d1 | zero out location - moveb a6@(15),d1 | now get out PRam location - lea _SysParam,a1 | start of PRam data - movel a6@(8),a0 | get our data address -_writePramAgain: - subql #1,d0 - bcs _writePramDone | see if we are through - cmpil #0x14,d1 | check for end of _SysParam - bcc _writePramDone | do not write if beyond end - moveb a0@+,a1@(d1) | transfer byte - addql #1,d1 | next byte - jmp _writePramAgain | do it again -_writePramDone: - .word 0xa038 | writeParam - moveml sp@+,d1/a1 - unlk a6 | clean up after ourselves - rts | and return to caller - - -.globl _readExtPram -_readExtPram: - link a6,#-4 | create a little home for ourselves - moveq #0,d0 | zero out our future command register - moveb a6@(19),d0 | move the length byte in - swap d0 | and make that the MSW - moveb a6@(15),d0 | now get out PRAM location - movel a6@(8),a0 | get our data address - .word 0xa051 | and go read the data - unlk a6 | clean up after ourselves - rts | and return to caller - -.globl _writeExtPram -_writeExtPram: - link a6,#-4 | create a little home for ourselves - moveq #0,d0 | zero out our future command register - moveb a6@(19),d0 | move the length byte in - swap d0 | and make that the MSW - moveb a6@(15),d0 | now get out PRAM location - movel a6@(8),a0 | get our data address - .word 0xa052 | and go write the data - unlk a6 | clean up after ourselves - rts | and return to caller - -.globl _getPramTime -_getPramTime: - link a6,#-4 | create a little home for ourselves - .word 0xa03f | call the routine to read the time (_InitUtil) - movel _Time,d0 - unlk a6 | clean up after ourselves - rts | and return to caller - -.globl _setPramTime -_setPramTime: - link a6,#-4 | create a little home for ourselves - movel a6@(8),d0 | get the passed in long (seconds since 1904) - .word 0xa03a | call the routine to write the time - unlk a6 | clean up after ourselves - rts | and return to caller - -#else /* The following routines are the hardware + /* The following routines are the hardware * specific routines for the machines that - * use the II-like method to access the PRAM, - * and are only defined when the MRG_ADB method - * isn't used to access the PRAM. */ + * use the II-like method to access the PRAM. */ /* * The following are the C interface functions to RTC access functions @@ -158,57 +59,6 @@ _setPramTime: .text .even -.globl _readPramII -_readPramII: - link a6,#-4 | create a little home for ourselves - moveq #0,d0 | zero out our future command register - moveb a6@(19),d0 | move the length byte in - swap d0 | and make that the MSW - moveb a6@(15),d0 | now get out PRAM location - oriw #0x0100,d0 | and set up for non-extended read - movel a6@(8),a0 | get our data address - jbsr _PRAMacc | and go read the data - unlk a6 | clean up after ourselves - rts | and return to caller - -.globl _writePramII -_writePramII: - link a6,#-4 | create a little home for ourselves - moveq #0,d0 | zero out our future command register - moveb a6@(19),d0 | move the length byte in - swap d0 | and make that the MSW - moveb a6@(15),d0 | now get out PRAM location - nop | and set up for non-extended write - movel a6@(8),a0 | get our data address - jbsr _PRAMacc | and go write the data - unlk a6 | clean up after ourselves - rts | and return to caller - -.globl _readExtPramII -_readExtPramII: - link a6,#-4 | create a little home for ourselves - moveq #0,d0 | zero out our future command register - moveb a6@(19),d0 | move the length byte in - swap d0 | and make that the MSW - moveb a6@(15),d0 | now get out PRAM location - oriw #0x0300,d0 | and set up for extended read - movel a6@(8),a0 | get our data address - jbsr _PRAMacc | and go read the data - unlk a6 | clean up after ourselves - rts | and return to caller - -.globl _writeExtPramII -_writeExtPramII: - link a6,#-4 | create a little home for ourselves - moveq #0,d0 | zero out our future command register - moveb a6@(19),d0 | move the length byte in - swap d0 | and make that the MSW - moveb a6@(15),d0 | now get out PRAM location - oriw #0x0200,d0 | and set up for extended write - movel a6@(8),a0 | get our data address - jbsr _PRAMacc | and go write the data - unlk a6 | clean up after ourselves - rts | and return to caller .globl _getPramTimeII _getPramTimeII: @@ -278,83 +128,6 @@ putSecb: moveml sp@+, #0x031e | restore our regs rts | and return to caller -_PRAMacc: - moveml #0xf8c0, sp@- | store off the regs we'll use - moveq #00,d3 | zero out our command reg - moveq #00,d4 | zero out our count reg too - swap d0 | we want the length byte - movew d0,d4 | copy length byte to our counter reg - swap d0 | and return command reg to prior state - subqb #1,d4 | predecrement counter for use w/ DBF - movew d0,d2 | copy command to d2 - rorw #8,d2 | rotate copy to examine flags - roxrw #1,d2 | read/write bit out of param. - roxlb #1,d3 | and into command reg - tstb d3 | was it read (1) or write (0) ? - bne NoWrit | go around de-write protect logic - movel #0x00550035,d1 | clear write protect bit of PRAM - | (we really only need to zero the high - | bit, but other patterns don't work! ) - moveml #0x3000, sp@- | store off the regs that'll change - bsr _Transfer | and go de-write protect RTC - moveml sp@+, #0x000c | reclaim our reg values -NoWrit: - andib #1,d2 | isolate the extended command bit - beq oldPRAM | it's zero, so do old PRAM style access -NuPRAM: - moveb d0,d2 | reget our PRAM location - lslw #4,d3 | insert our template blanks - moveq #2,d1 | set bit counter for 3 cycles -threebit: - roxlb #1,d2 | rotate address bit from d2 - roxlw #1,d3 | and into command in d3 - dbf d1,threebit | until we've done bits 7-5 - lslw #1,d3 | and add a bit spacer - moveq #4,d1 | ok, 5 bits to go... -fivebit: - roxlb #1,d2 | another addr bit out of d2 - roxlw #1,d3 | and into command template in d3 - dbf d1,fivebit | til we've done bit 4-0 - lslw #2,d3 | more bit magic - oriw #0x3880,d3 | set extended command bits - bra Loaddata | go load the rest of command for xfer rtn -oldPRAM: - moveb d0,d2 | reget our PRAM location - lslb #1,d3 | add a template blank (bit) - rolb #4,d2 | get low nibble of PRAM loc ready - moveq #3,d1 | set our bit counter for 4 cycles -fourbit: - roxlb #1,d2 | bit out of PRAM loc - roxlb #1,d3 | and bit into PRAM command - dbf d1,fourbit | until we've done the low nibble - lslb #2,d3 | bump bits to type of command byte - orib #0x41,d3 | set command bits (for access to $0-F!) - btst #4,d2 | change to access $10-13 ? - beq Loaddata | nope, should stay the way it is - andib #0x8F,d3 | clear bits 4-6 of current command - orib #0x20,d3 | and set bit 5 (now accesses $10-13) -Loaddata: - moveb a0@,d1 | get our (data/dummy) byte into d1 - swap d1 | move (data/dummy) byte to MSW - movew d3,d1 | now move command into d1 -tagain: - bsr _Transfer | now execute that command - swap d1 | we want access to (data/dummy) byte - moveb d1,a0@+ | move (data/dummy) byte back to a0, - moveb a0@,d1 | NEXT VICTIM!! - swap d1 | now we want to tweak the command - addqw #4,d1 | increment our memory addr by 1 (this even - | works if we want to dump across 32 byte - | boundries for an extended command!!! - | thanks to the oriw #$3880 above !!!) - dbf d4,tagain | repeat until we've got all we want - movel #0x00d50035,d1 | remember that command to write the wp byte ? - | set the high bit in the wp reg (Apple says - | this way the battery won't wear down !! ) - bsr _Transfer | so we'll play by the rules - moveml sp@+, #0x031f | restore all our registers - rts | and return to our gracious caller - _Transfer: movew sr,sp@- | store the SR (we'll change it!) oriw #0x0700,sr | disable all interrupts @@ -419,6 +192,3 @@ ragain: dbf d3,ragain | do this until we've received a whole byte bset #0,a1@(0x0400) | and return RTC data line to output rts | return to caller - -#endif /* ifndef MRG_ADB */ - diff --git a/sys/arch/mac68k/mac68k/trap.c b/sys/arch/mac68k/mac68k/trap.c index eb4b5ac53fa..a4f7c0aed80 100644 --- a/sys/arch/mac68k/mac68k/trap.c +++ b/sys/arch/mac68k/mac68k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.46 2006/01/04 20:39:05 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.47 2006/01/13 19:36:47 miod Exp $ */ /* $NetBSD: trap.c,v 1.68 1998/12/22 08:47:07 scottr Exp $ */ /* @@ -523,12 +523,6 @@ copyfault: uvmexp.softs++; softclock(); } - if (ssir & SIR_DTMGR) { - void mrg_execute_deferred(void); - siroff(SIR_DTMGR); - uvmexp.softs++; - mrg_execute_deferred(); - } if (ssir & SIR_ADB) { void adb_soft_intr(void); siroff(SIR_ADB); diff --git a/sys/arch/mac68k/mac68k/vectors.s b/sys/arch/mac68k/mac68k/vectors.s index 8f282772233..c2d7e85ce88 100644 --- a/sys/arch/mac68k/mac68k/vectors.s +++ b/sys/arch/mac68k/mac68k/vectors.s @@ -1,4 +1,4 @@ -/* $OpenBSD: vectors.s,v 1.8 2006/01/01 13:16:01 miod Exp $ */ +/* $OpenBSD: vectors.s,v 1.9 2006/01/13 19:36:47 miod Exp $ */ | $NetBSD: vectors.s,v 1.10 1998/08/12 06:58:42 scottr Exp $ | Copyright (c) 1988 University of Utah @@ -53,12 +53,8 @@ GLOBAL(vectab) VECTOR(chkinst) /* 6: CHK instruction */ VECTOR(trapvinst) /* 7: TRAPV instruction */ VECTOR(privinst) /* 8: privilege violation */ -#if defined(MRG_TRACE) - VECTOR(mrg_tracetrap) /* 9: trace */ -#else /* MRG_TRACE */ VECTOR(trace) /* 9: trace */ -#endif /* MRG_TRACE */ - VECTOR(alinetrap) /* 10: line 1010 emulator ; see macromasm.s */ + VECTOR(illinst) /* 10: line 1010 emulator */ VECTOR(fpfline) /* 11: line 1111 emulator */ VECTOR(badtrap) /* 12: unassigned, reserved */ VECTOR(coperr) /* 13: coprocessor protocol violation */ diff --git a/sys/arch/mac68k/mac68k/via.c b/sys/arch/mac68k/mac68k/via.c index dd619d0ae67..7cb8044a93d 100644 --- a/sys/arch/mac68k/mac68k/via.c +++ b/sys/arch/mac68k/mac68k/via.c @@ -1,4 +1,4 @@ -/* $OpenBSD: via.c,v 1.24 2006/01/04 20:39:05 miod Exp $ */ +/* $OpenBSD: via.c,v 1.25 2006/01/13 19:36:47 miod Exp $ */ /* $NetBSD: via.c,v 1.62 1997/09/10 04:38:48 scottr Exp $ */ /*- @@ -50,8 +50,8 @@ #include <machine/intr.h> #include <machine/viareg.h> -int mrg_adbintr(void *); -int mrg_pmintr(void *); +int adb_intr(void *); +int pm_intr(void *); int rtclock_intr(void *); void profclock(void *); @@ -99,8 +99,8 @@ via_init() intr_establish(via1_intr, NULL, mac68k_machine.via1_ipl, "via1"); /* register default VIA1 interrupts */ - via1_register_irq(2, mrg_adbintr, NULL, "adb"); - via1_register_irq(4, mrg_pmintr, NULL, "pm"); + via1_register_irq(2, adb_intr, NULL, "adb"); + via1_register_irq(4, pm_intr, NULL, "pm"); via1_register_irq(VIA1_T1, rtclock_intr, NULL, "clock"); for (i = 0; i < 7; i++) |