Module Name: src
Committed By: jklos
Date: Tue Jul 16 07:31:40 UTC 2013
Modified Files:
src/sys/arch/mac68k/conf: GENERIC
src/sys/arch/mac68k/mac68k: genassym.cf locore.s machdep.c
pmap_bootstrap.c
Log Message:
Added DJMEMCMAX option for recognizing 128 meg SIMMs in Centris and Quadra
610, 650 and 800 systems. From Rob Braun,
http://synack.net/~bbraun/netbsdmac2.html
To generate a diff of this commit:
cvs rdiff -u -r1.214 -r1.215 src/sys/arch/mac68k/conf/GENERIC
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/mac68k/mac68k/genassym.cf
cvs rdiff -u -r1.166 -r1.167 src/sys/arch/mac68k/mac68k/locore.s
cvs rdiff -u -r1.345 -r1.346 src/sys/arch/mac68k/mac68k/machdep.c
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/mac68k/mac68k/pmap_bootstrap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/mac68k/conf/GENERIC
diff -u src/sys/arch/mac68k/conf/GENERIC:1.214 src/sys/arch/mac68k/conf/GENERIC:1.215
--- src/sys/arch/mac68k/conf/GENERIC:1.214 Sun Jun 30 21:38:57 2013
+++ src/sys/arch/mac68k/conf/GENERIC Tue Jul 16 07:31:40 2013
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.214 2013/06/30 21:38:57 rmind Exp $
+# $NetBSD: GENERIC,v 1.215 2013/07/16 07:31:40 jklos Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@ include "arch/mac68k/conf/std.mac68k"
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.214 $"
+#ident "GENERIC-$Revision: 1.215 $"
maxusers 16 # estimated number of users
@@ -35,6 +35,10 @@ options M68020 # Note: must have 6885
options FPSP
options FPU_EMULATE
+# Support for 128 meg SIMMs in Centris / Quadra 610, 650 and 800 machines.
+# You need to set the total memory in the MacOS Booter.
+#options DJMEMCMAX
+
# Standard system options
options INSECURE # disable kernel security levels
Index: src/sys/arch/mac68k/mac68k/genassym.cf
diff -u src/sys/arch/mac68k/mac68k/genassym.cf:1.36 src/sys/arch/mac68k/mac68k/genassym.cf:1.37
--- src/sys/arch/mac68k/mac68k/genassym.cf:1.36 Fri Jan 14 02:06:28 2011
+++ src/sys/arch/mac68k/mac68k/genassym.cf Tue Jul 16 07:31:40 2013
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.36 2011/01/14 02:06:28 rmind Exp $
+# $NetBSD: genassym.cf,v 1.37 2013/07/16 07:31:40 jklos Exp $
#
# Copyright (c) 1990 The Regents of the University of California.
@@ -169,6 +169,13 @@ define ENOENT ENOENT
define EFAULT EFAULT
define ENAMETOOLONG ENAMETOOLONG
+# machine ids
+define MACH_MACC610 MACH_MACC610
+define MACH_MACQ610 MACH_MACQ610
+define MACH_MACC650 MACH_MACC650
+define MACH_MACQ650 MACH_MACQ650
+define MACH_MACQ800 MACH_MACQ800
+
# SVR4 binary compatibility
ifdef COMPAT_SVR4
define SVR4_SIGF_HANDLER offsetof(struct svr4_sigframe, sf_handler)
Index: src/sys/arch/mac68k/mac68k/locore.s
diff -u src/sys/arch/mac68k/mac68k/locore.s:1.166 src/sys/arch/mac68k/mac68k/locore.s:1.167
--- src/sys/arch/mac68k/mac68k/locore.s:1.166 Thu Dec 22 15:33:29 2011
+++ src/sys/arch/mac68k/mac68k/locore.s Tue Jul 16 07:31:40 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.166 2011/12/22 15:33:29 tsutsui Exp $ */
+/* $NetBSD: locore.s,v 1.167 2013/07/16 07:31:40 jklos Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -273,6 +273,117 @@ Lstart3:
movl %a1,%d1
.word 0xf518 | pflusha
.long 0x4e7b1807 | movc %d1,%srp
+
+#if defined(DJMEMCMAX)
+ movl %a3,%sp@-
+ cmp #MACH_MACC610,_C_LABEL(machineid)
+ jra Ldjmemc610
+ cmp #MACH_MACQ610,_C_LABEL(machineid)
+ jra Ldjmemc610
+ cmp #MACH_MACC650,_C_LABEL(machineid)
+ jra Ldjmemccfg
+ cmp #MACH_MACQ650,_C_LABEL(machineid)
+ jra Ldjmemccfg
+ cmp #MACH_MACQ800,_C_LABEL(machineid)
+ jra Ldjmemccfg
+
+ jra Lnodjmemc
+
+Ldjmemccfg:
+ movl #0x50f0e00c,%a0
+ movl %a0@,%d0 | determine where RAM SIMMs start
+ andl #0x000000FF,%d0
+ addl #0x10,%d0 | bank 3 start
+ addl #0x10,%d0 | bank 4 start
+
+ movl #0x50f0e014,%a0
+ movl %d0,%a0@+ | bank 4
+ addl #0x10,%d0
+ movl %d0,%a0@+ | bank 5
+ addl #0x10,%d0
+
+ movl %d0,%a0@+ | bank 6
+ addl #0x10,%d0
+ movl %d0,%a0@+ | bank 7
+ addl #0x10,%d0
+ movl %d0,%a0@+ | bank 8
+ addl #0x10,%d0
+ movl %d0,%a0@+ | bank 9
+ addl #0x10,%d0
+ jra Ldjmemctop
+
+Ldjmemc610:
+ movl #0x50f0e00c,%a0
+ movl %a0@,%d0 | determine where RAM SIMMs start
+ andl #0x000000FF,%d0
+ addl #0x10,%d0 | bank 3 start
+
+ movl #0x50f0e014,%a0
+ movl %d0,%a0@+ | bank 4
+ addl #0x10,%d0
+ movl %d0,%a0@+ | bank 5
+ movl %d0,%a0@+ | bank 6
+ addl #0x10,%d0
+ movl %d0,%a0@+ | bank 7
+ movl %d0,%a0@+ | bank 8
+ addl #0x10,%d0
+ movl %d0,%a0@+ | bank 9
+
+Ldjmemctop:
+ movl #0x50F0E02C,%a0
+ movl %d0,%a0@ | memtop
+
+ | preserve ~512KB beyond 4MB just in case
+ movl #0x400000,%a0
+ movl #0x9000000,%a2
+ movl #0xFFFF,%d0
+L1stbankcopy1:
+ movl %a0@+,%a2@+
+ dbra %d0,L1stbankcopy1
+ movl #0xFFFF,%d0
+L1stbankcopy2:
+ movl %a0@+,%a2@+
+ dbra %d0,L1stbankcopy2
+
+ lea _ASM_LABEL(Lsetup1stbank),%a0
+ movl #0x8800000,%a2 | Pick a location that should be in bank 4
+ movl #0x64,%d0
+Ldjcopy:
+ movl %a0@+,%a2@+
+ dbra %d0,Ldjcopy
+
+ movl #0x8800000,%a0
+ lea _ASM_LABEL(Ldjmemcdone),%a2
+ jmp %a0@
+
+Lsetup1stbank:
+ | now configure banks 2 & 3
+ movl #0x50f0e00c,%a0
+ movl %a0@,%d0 | determine where RAM SIMMs start
+ andl #0x000000FF,%d0
+ movl %d0,%a0@+
+ addl #0x10,%d0 | bank 3 start
+ movl %d0,%a0@
+
+ | and return to where we came from.
+ jmp %a2@
+
+Ldjmemcdone:
+ movl #0x400000,%a2
+ movl #0x9000000,%a0
+ movl #0xFFFF,%d0
+Lcopyback1:
+ movl %a0@+,%a2@+
+ dbra %d0,Lcopyback1
+ movl #0xFFFF,%d0
+Lcopyback2:
+ movl %a0@+,%a2@+
+ dbra %d0,Lcopyback2
+
+Lnodjmemc:
+ movl %sp@+,%a3
+#endif
+
#if PGSHIFT == 13
movl #0xc000,%d0
#else
Index: src/sys/arch/mac68k/mac68k/machdep.c
diff -u src/sys/arch/mac68k/mac68k/machdep.c:1.345 src/sys/arch/mac68k/mac68k/machdep.c:1.346
--- src/sys/arch/mac68k/mac68k/machdep.c:1.345 Sat Aug 4 17:18:38 2012
+++ src/sys/arch/mac68k/mac68k/machdep.c Tue Jul 16 07:31:40 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.345 2012/08/04 17:18:38 martin Exp $ */
+/* $NetBSD: machdep.c,v 1.346 2013/07/16 07:31:40 jklos Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.345 2012/08/04 17:18:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.346 2013/07/16 07:31:40 jklos Exp $");
#include "opt_adb.h"
#include "opt_ddb.h"
@@ -172,6 +172,7 @@ vaddr_t SCSIBase;
extern int numranges;
extern u_long low[8];
extern u_long high[8];
+extern int machineid;
/* These are used to map NuBus space: */
#define NBMAXRANGES 16
@@ -899,7 +900,7 @@ getenvvars(u_long flag, char *buf)
/*
* More misc stuff from booter.
*/
- mac68k_machine.machineid = getenv("MACHINEID");
+ mac68k_machine.machineid = machineid = getenv("MACHINEID");
mac68k_machine.mach_processor = getenv("PROCESSOR");
mac68k_machine.mach_memsize = getenv("MEMSIZE");
mac68k_machine.do_graybars = getenv("GRAYBARS");
Index: src/sys/arch/mac68k/mac68k/pmap_bootstrap.c
diff -u src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.93 src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.94
--- src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.93 Fri Feb 10 04:49:45 2012
+++ src/sys/arch/mac68k/mac68k/pmap_bootstrap.c Tue Jul 16 07:31:40 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_bootstrap.c,v 1.93 2012/02/10 04:49:45 mhitch Exp $ */
+/* $NetBSD: pmap_bootstrap.c,v 1.94 2013/07/16 07:31:40 jklos Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.93 2012/02/10 04:49:45 mhitch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.94 2013/07/16 07:31:40 jklos Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -166,6 +166,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f
for (i = 0; i < numranges; i++)
mem_size += high[i] - low[i];
nptpages += howmany(m68k_btop(mem_size), NPTEPG);
+ nptpages++;
nextpa += nptpages * PAGE_SIZE;
for (i = 0; i < numranges; i++)
@@ -534,6 +535,17 @@ bootstrap_mac68k(int tc)
extern int *esym;
paddr_t nextpa;
void *oldROMBase;
+ char use_bootmem = 0;
+
+#ifdef DJMEMCMAX
+ if(mac68k_machine.machineid == MACH_MACC650 ||
+ mac68k_machine.machineid == MACH_MACQ650 ||
+ mac68k_machine.machineid == MACH_MACQ610 ||
+ mac68k_machine.machineid == MACH_MACC610 ||
+ mac68k_machine.machineid == MACH_MACQ800) {
+ use_bootmem = 1;
+ }
+#endif
if (mac68k_machine.do_graybars)
printf("Bootstrapping NetBSD/mac68k.\n");
@@ -541,8 +553,8 @@ bootstrap_mac68k(int tc)
oldROMBase = ROMBase;
mac68k_video.mv_phys = mac68k_video.mv_kvaddr;
- if (((tc & 0x80000000) && (mmutype == MMU_68030)) ||
- ((tc & 0x8000) && (mmutype == MMU_68040))) {
+ if ((!use_bootmem) && (((tc & 0x80000000) && (mmutype == MMU_68030)) ||
+ ((tc & 0x8000) && (mmutype == MMU_68040)))) {
if (mac68k_machine.do_graybars)
printf("Getting mapping from MMU.\n");
(void) get_mapping();