Subject: Re: DUOTEST kernel
To: Bill Studenmund <wrstuden@nas.nasa.gov>
From: Daishi Kato <daishi@axlight.com>
List: port-mac68k
Date: 11/20/1999 01:02:11
Hello,

At 5:22 PM -0700 1999.10.28, Bill Studenmund wrote:
> My only other concern is could you code them some way that one kernel
> could boot both on a duo and a non-duo machine? We already have a 2x2
> matrix of kernels (sbc vs ncr scsi, mrg vs hw-direct adb) and I think it'd
> be saner for everyone if we didn't make it 2x2x2. :-)

Now, here is the new patch.
How about this?

With -current kernel with this patch,
the problem is that you can't compile the kernel.
(maybe due to fpe code. gawk,as dump cores. I'm not sure though)

--daishi

-------8-------8-------8-------8-------8-------8-------8-------8
--- mac68k/locore.s.991112	Sun Nov  7 04:15:55 1999
+++ mac68k/locore.s	Fri Nov 19 05:48:45 1999
@@ -120,6 +120,10 @@
 GLOBAL(bletch)
 	.long	0

+/* to use tt1 instead of tt0 in get_pte() */
+GLOBAL(mac68k_use_tt1)
+	.long	0
+
 BSS(esym,4)

 ASENTRY_NOPROFILE(start)
@@ -1632,7 +1636,13 @@

 	lea	_ASM_LABEL(longscratch),a0
 	movl	#0x00ff8710,a0@	| Set up FC 1 r/w access
+	tstl	_C_LABEL(mac68k_use_tt1)
+	beq	Lusett0_1
+	.long	0xf0100c00	| pmove a0@,tt1
+	bra	Ldonett0_1
+Lusett0_1:
 	.long	0xf0100800	| pmove a0@,tt0
+Ldonett0_1:

 	movl	sp@(8),a0	| logical address to look up
 	movl	#0,a1		| clear in case of failure
@@ -1757,7 +1767,13 @@
 get_pte_success:
 	lea	_ASM_LABEL(longscratch),a0 | disable tt
 	movl	#0,a0@
+	tstl	_C_LABEL(mac68k_use_tt1)
+	beq	Lusett0_2
+	.long	0xf0100c00	| pmove a0@,tt1
+	bra	Ldonett0_2
+Lusett0_2:
 	.long	0xf0100800	| pmove a0@,tt0
+Ldonett0_2:

 	addql	#4,sp		| return temporary space
 	rts
--- mac68k/machdep.c.991112	Sat Sep 18 04:28:36 1999
+++ mac68k/machdep.c	Fri Nov 19 05:48:46 1999
@@ -203,6 +203,9 @@
 struct extent *iomem_ex;
 int iomem_malloc_safe;

+/* this value is used in locore.s */ /* by daishi */
+extern u_long mac68k_use_tt1;
+
 static void	identifycpu __P((void));
 static u_long	get_physical __P((u_int, u_long *));

@@ -2126,6 +2129,8 @@
 		via_reg(VIA1, vIER) = 0x6f;	/* disable VIA1 int */
 		/* Are we disabling something important? */
 		via_reg(VIA2, rIER) = 0x7f;	/* disable VIA2 int */
+		/* to use tt1 instead of tt0 in get_pte() */ /* by daishi */
+		mac68k_use_tt1 = 1;
 		break;
 	case MACH_CLASSQ:
 	case MACH_CLASSQ2:
@@ -2429,9 +2434,16 @@
 {
 	u_long addr, phys;

-	if (!get_physical(videoaddr, &phys))
+	if (current_mac_model->class == MACH_CLASSDUO &&
+		0x60000000 <= videoaddr && videoaddr < 0x70000000) {
+		/* get_physical(videoaddr,  &phys) always fails */
+		/* by daishi only testd with Duo230 */
+		phys = videoaddr;
+	}else if (!get_physical(videoaddr, &phys)) {
 		printf("get_mapping(): %s.  False start.\n", id);
-	else {
+		return;
+	}
+	{
 		mac68k_vidlog = videoaddr;
 		mac68k_vidphys = phys;
 		mac68k_vidlen = 32768;
--- dev/adb_direct.c.991112	Sun Nov  7 04:15:54 1999
+++ dev/adb_direct.c	Fri Nov 19 05:48:47 1999
@@ -2096,6 +2096,8 @@
 	int device;
 	int nonewtimes;		/* times thru loop w/o any new devices */

+	adb_setup_hw_type();	/* setup hardware type */
+
 	/* Make sure we are not interrupted while building the table. */
 	/* ints must be on for PB & IOP (at least, for now) */
 	if (adbHardware != ADB_HW_PB && adbHardware != ADB_HW_IOP)
@@ -2114,8 +2116,6 @@
 	 */
 	for (i = 0; i < 16; i++)
 		ADBDevTable[i].devType = 0;
-
-	adb_setup_hw_type();	/* setup hardware type */

 	adb_hw_setup();		/* init the VIA bits and hard reset ADB */

--- dev/pm_direct.c.991112	Fri Nov 19 06:31:09 1999
+++ dev/pm_direct.c	Fri Nov 19 06:47:56 1999
@@ -1066,8 +1066,20 @@
 	/* wait until the PM interrupt is occured */
 	delay = 0x80000;
 	while (adbWaiting == 1) {
+	switch (mac68k_machine.machineid) { /* by daishi only tested with
Duo230 */
+		case MACH_MACPB210:
+		case MACH_MACPB230:
+		case MACH_MACPB250:
+		case MACH_MACPB270:
+		case MACH_MACPB280:
+		case MACH_MACPB280C:
+			pm_intr((void *)0);
+			break;
+		default:
 		if ((via_reg(VIA1, vIFR) & 0x10) == 0x10)
 			pm_intr((void *)0);
+			break;
+	}
 #ifdef PM_GRAB_SI
 #if 0
 			zshard(0);		/* grab any serial
interrupts */