NetBSD Problem Report #6112

Received: (qmail 1385 invoked from network); 6 Sep 1998 15:33:51 -0000
Message-Id: <199809061536.AAA00473@pppp.ap.so-net.ne.jp>
Date: Mon, 7 Sep 1998 00:36:11 +0900 (JST)
From: <kei_sun@ba2.so-net.ne.jp>
Reply-To: kei@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: Adding external cache support of DayStar PowerCache accelerator
X-Send-Pr-Version: 3.95

>Number:         6112
>Category:       port-mac68k
>Synopsis:       Adding external cache support of DayStar PowerCache accelerator
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-mac68k-maintainer
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 06 08:35:00 +0000 1998
>Closed-Date:    
>Last-Modified:  Sun May 23 09:45:01 +0000 2021
>Originator:     SUNAGAWA Keiki
>Release:        as of 1998-07-26
>Organization:
	None
>Environment:
System: NetBSD p84ce0b 1.3F NetBSD 1.3F (MINT) #111: Sun Sep 6 12:52:28 JST 1998 kei@localhost:/var/src/sys/arch/mac68k/compile/MINT mac68k
Macintosh IIci, DayStar PowerCache 68030/68882 50MHz, 32KB ext. writeback cache

>Description:
	This patch adds ext. cache support of DayStar PowerCache accelerator.
>How-To-Repeat:
	Turn external cache on within MacOS, boot NetBSD and see it hangs.
>Fix:
	This patch adds external writeback cache support of DayStar PowerCache
	accelerator.  I've been using this for months without any trouble.

* DayStar PowerCache support.  Original work was done by Kevin Radke, merged
  into 1.2(E?) source by David Condon.  Applying them to 1.3F and adding
  support to handle shutdown properly by me.

Index: locore.s
===================================================================
RCS file: /var/cvsroot/src/sys/arch/mac68k/mac68k/locore.s,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -u -r1.1.1.1 -r1.3
--- locore.s	1998/07/26 17:28:48	1.1.1.1
+++ locore.s	1998/09/06 15:00:34	1.3
@@ -118,6 +118,9 @@
 GLOBAL(bletch)
 	.long	0

+	.globl	_disable_daystar	| in pmap.c /* kmr */
+
+
 BSS(esym,4)

 ASENTRY_NOPROFILE(start)
@@ -150,6 +153,7 @@
 	movc	cacr,d0			| read it back
 	tstl	d0			| zero?
 	jeq	Lnot68030		| yes, we have 68020/68040
+	jbsr    _disable_daystar | Disable daystar external cache /* kmr */

 	movl	#CACHE_OFF,d0		| disable and clear both caches
 	movc	d0,cacr
@@ -314,10 +318,13 @@

 /* flush TLB and turn on caches */
 	jbsr	_C_LABEL(TBIA)		| invalidate TLB
+        .globl  _flush_daystar /* kmr */
 	cmpl	#MMU_68040,_C_LABEL(mmutype) | 68040?
 	jeq	Lnocache0		| yes, cache already on
 	movl	#CACHE_ON,d0
 	movc	d0,cacr			| clear cache(s)
+        jbsr    _flush_daystar          | flush daystar external cache /* kmr */
+
 #ifdef __notyet__
 	tstl	_C_LABEL(ectype)
 	jeq	Lnocache0
@@ -1319,12 +1326,15 @@
 	movl	#DC_CLEAR,d0
 	movc	d0,cacr			| invalidate on-chip d-cache
 Ltbia851:
+        jbsr    _flush_daystar		| flush daystar external cache /* kmr */
 	rts

 /*
  * Invalidate any TLB entry for given VA (TB Invalidate Single)
  */
 ENTRY(TBIS)
+        .globl  _flush_daystar /* kmr */
+
 #ifdef DEBUG
 	tstl	_ASM_LABEL(fulltflush)	| being conservative?
 	jne	_C_LABEL(_TBIA)		| yes, flush entire TLB
@@ -1354,12 +1364,15 @@
 	pflush	#0,#0,a0@		| flush address from both sides
 	movl	#DC_CLEAR,d0
 	movc	d0,cacr			| invalidate on-chip data cache
+        jbsr    _flush_daystar		| flush daystar external cache /* kmr */
 	rts

 /*
  * Invalidate supervisor side of TLB
  */
 ENTRY(TBIAS)
+        .globl  _flush_daystar /* kmr */
+
 #ifdef DEBUG
 	tstl	_ASM_LABEL(fulltflush)	| being conservative?
 	jne	_C_LABEL(_TBIA)		| yes, flush everything
@@ -1381,12 +1394,14 @@
 	pflush	#4,#4			| flush supervisor TLB entries
 	movl	#DC_CLEAR,d0
 	movc	d0,cacr			| invalidate on-chip d-cache
+        jbsr    _flush_daystar		| flush daystar external cache /* kmr */
 	rts

 /*
  * Invalidate user side of TLB
  */
 ENTRY(TBIAU)
+        .globl  _flush_daystar /* kmr */
 #ifdef DEBUG
 	tstl	_ASM_LABEL(fulltflush)	| being conservative?
 	jne	_C_LABEL(_TBIA)		| yes, flush everything
@@ -1407,6 +1422,7 @@
 	pflush	#0,#4			| flush user TLB entries
 	movl	#DC_CLEAR,d0
 	movc	d0,cacr			| invalidate on-chip d-cache
+        jbsr    _flush_daystar		| flush daystar external cache /* kmr */
 	rts

 /*
@@ -1493,6 +1509,7 @@
 #endif /* M68040 */

 ENTRY(PCIA)
+        .globl  _flush_daystar /* kmr */
 #if defined(M68040)
 ENTRY(DCFA)
 	cmpl	#MMU_68040,_C_LABEL(mmutype) | 68040?
@@ -1503,6 +1520,7 @@
 #endif
 	movl	#DC_CLEAR,d0
 	movc	d0,cacr			| invalidate on-chip d-cache
+        jbsr    _flush_daystar		| flush daystar external cache /* kmr */
 	rts

 ENTRY(ecacheon)
Index: machdep.c
===================================================================
RCS file: /var/cvsroot/src/sys/arch/mac68k/mac68k/machdep.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -u -r1.1.1.1 -r1.2
--- machdep.c	1998/07/26 17:28:48	1.1.1.1
+++ machdep.c	1998/09/04 00:46:08	1.2
@@ -268,6 +268,10 @@
  */
 cpu_kcore_hdr_t cpu_kcore_hdr;

+#ifdef POWERCACHE_SUPPORT
+extern inline void disable_daystar __P((void));	/* in pmap.c */
+#endif
+
 /*
  * Early initialization, before main() is called.
  */
@@ -725,6 +729,9 @@
 #if __GNUC__	/* XXX work around lame compiler problem (gcc 2.7.2) */
 	(void)&howto;
 #endif
+#ifdef POWERCACHE_SUPPORT
+	disable_daystar();	/* disable daystar external cache */
+#endif /* POWERCACHE_SUPPORT */
 	/* take a snap shot before clobbering any registers */
 	if (curproc && curproc->p_addr)
 		savectx(&curproc->p_addr->u_pcb);
Index: pmap.c
===================================================================
RCS file: /var/cvsroot/src/sys/arch/mac68k/mac68k/pmap.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -u -r1.1.1.1 -r1.2
--- pmap.c	1998/07/26 17:28:49	1.1.1.1
+++ pmap.c	1998/09/04 00:46:10	1.2
@@ -282,6 +282,9 @@
 int		page_cnt;	/* number of pages managed by VM system */

 boolean_t	pmap_initialized = FALSE;	/* Has pmap_init completed? */
+#ifdef POWERCACHE_SUPPORT
+boolean_t	daystar_initialized = FALSE; /* Has map_daystar completed? */
+#endif /* POWERCACHE_SUPPORT */
 struct pv_entry	*pv_table;
 char		*pmap_attributes;	/* reference and modify bits */
 TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist;
@@ -328,6 +331,12 @@
 void	pmap_changebit	__P((vm_offset_t, int, boolean_t));
 void	pmap_enter_ptpage	__P((pmap_t, vm_offset_t));
 void	pmap_collect1	__P((pmap_t, vm_offset_t, vm_offset_t));
+#ifdef POWERCACHE_SUPPORT
+inline void	flush_daystar	__P((void));
+inline void	disable_daystar	__P((void));
+inline void	enable_daystar	__P((void));
+inline void	map_daystar	__P((void));
+#endif /* POWERCACHE_SUPPORT */

 #ifdef DEBUG
 void	pmap_pvdump          __P((vm_offset_t));
@@ -541,6 +550,13 @@
 		       atop(s), addr, addr + s);
 #endif

+#ifdef POWERCACHE_SUPPORT
+        /*
+         * Map physical memory addresses used by daystar accelerator
+         */
+        map_daystar();
+#endif /* POWERCACHE_SUPPORT */
+
 	/*
 	 * Allocate the segment table map
 	 */
@@ -2630,3 +2646,83 @@

 	return -1;
 }
+
+#ifdef POWERCACHE_SUPPORT
+/*
+ * DayStar PowerCache support routines
+ *
+ *   This routines are originally written by Kevin Radke for NetBSD-XXX and
+ *   modified to fit NetBSD-XXX by David Condon <david@apk.net>.
+ */
+
+/*
+ * flush_daystar()
+ *
+ *   Flush external cache of DayStar PowerCache
+ */
+
+inline void
+flush_daystar(void)
+{
+	if (daystar_initialized) {
+/*		printf("."); */
+		asm("tstb	0x520f0000 | flush daystar external cache");
+	}
+/*	else
+		printf ("***** Flush called before map!\n"); */
+}
+
+/*
+ * disable_daystar()
+ *
+ *   Disable external writeback cache of DayStar PowerCache
+ */
+
+inline void
+disable_daystar(void)
+{
+	asm("tstb	0x52040000 | disable writeback cache");
+	asm("tstb	0x52060000 | disable daystar external cache");
+	asm("tstb	0x520f0000 | flush daystar external cache");
+}
+
+/* 
+ * enable_daystar()
+ *
+ *   Enable external writeback cache of DayStar PowerCache
+ */
+
+inline void
+enable_daystar(void)
+{
+	disable_daystar();
+	printf("Enabling DayStar External Cache...\n");
+	asm("tstb	0x52070000 | enable daystar external cache");
+	asm("tstb	0x52050000 | enable writeback cache");
+	flush_daystar();
+}
+
+/*
+ * map_daystar()
+ *
+ *   Map DayStar PowerCache control registers in pmap
+ */
+
+inline void
+map_daystar(void)
+{
+	printf("Mapping DayStar PowerCache Hardware Addresses...\n");
+	pmap_enter (pmap_kernel(), 0x52040000, 0x52040000,
+		    VM_PROT_READ | VM_PROT_WRITE, TRUE);
+	pmap_enter (pmap_kernel(), 0x52050000, 0x52050000,
+		    VM_PROT_READ | VM_PROT_WRITE, TRUE);
+	pmap_enter (pmap_kernel(), 0x52060000, 0x52060000,
+		    VM_PROT_READ | VM_PROT_WRITE, TRUE);
+	pmap_enter (pmap_kernel(), 0x52070000, 0x52070000,
+		    VM_PROT_READ | VM_PROT_WRITE, TRUE);
+	pmap_enter (pmap_kernel(), 0x520f0000, 0x520f0000,
+		    VM_PROT_READ | VM_PROT_WRITE, TRUE);
+	daystar_initialized = TRUE;
+	enable_daystar();
+}
+#endif /* POWERCACHE_SUPPORT */
Index: sys_machdep.c
===================================================================
RCS file: /var/cvsroot/src/sys/arch/mac68k/mac68k/sys_machdep.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -u -r1.1.1.1 -r1.2
--- sys_machdep.c	1998/07/26 17:28:50	1.1.1.1
+++ sys_machdep.c	1998/09/04 00:46:13	1.2
@@ -152,6 +152,7 @@
 int	cachectl __P((int, caddr_t, int));
 void	DCIU __P((void));
 void	ICIA __P((void));
+void	PCIA __P((void));

 /*ARGSUSED1*/
 int
@@ -165,11 +166,18 @@
 	switch (req) {
 	case CC_EXTPURGE|CC_PURGE:
 	case CC_EXTPURGE|CC_FLUSH:
+#ifdef POWERCACHE_SUPPORT
+		PCIA(); /* flush daystar external cache */
+#endif /* POWERCACHE_SUPPORT */
+		/* fall into... */
 	case CC_PURGE:
 	case CC_FLUSH:
 		DCIU();
 		break;
 	case CC_EXTPURGE|CC_IPURGE:
+#ifdef POWERCACHE_SUPPORT
+		PCIA(); /* flush daystar external cache */
+#endif /* POWERCACHE_SUPPORT */
 		DCIU();
 		/* fall into... */
 	case CC_IPURGE:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->port-mac68k-maintainer 
Responsible-Changed-By: fair 
Responsible-Changed-When: Mon Dec 28 09:38:25 PST 1998 
Responsible-Changed-Why:  
This PR is the responsibility of the portmaster, 
not the GNATS database administrator. 

From: "Erik E. Fair" <fair@clock.org>
To: NetBSD GNATS Problem Report Tracking System <gnats-bugs@gnats.netbsd.org>
Cc:  
Subject: Re: port-mac68k/6112
Date: Thu, 17 Jan 2002 23:06:14 -0800

 Have these changes been comitted to the source repository?

 	curious GNATS PR database administrator,

 	Erik <fair@netbsd.org>
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-mac68k/6112: Adding external cache support of DayStar
 PowerCache accelerator
Date: Fri, 21 May 2021 21:28:23 +0000

  > Have these changes been comitted to the source repository?

 They have not. Merging looks nontrivial (not to mention the chances of
 anyone having the hw in question are not high...)

 -- 
 David A. Holland
 dholland@netbsd.org

From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
To: gnats-bugs@NetBSD.org
Cc: port-mac68k-maintainer@NetBSD.org, gnats-admin@NetBSD.org,
        netbsd-bugs@NetBSD.org, kei@NetBSD.org
Subject: Re: port-mac68k/6112: Adding external cache support of DayStar
 PowerCache accelerator
Date: Sat, 22 May 2021 18:38:56 +0200

 On Fri, 21 May 2021 21:30:03 +0000 (UTC), David Holland wrote:
 >   > Have these changes been comitted to the source repository?
 > =20
 >  They have not. Merging looks nontrivial (not to mention the chances of
 >  anyone having the hw in question are not high...)

 I am sure somebody does, somewhere.

 OTOH, searching for "DayStar PowerCache" brings up quite a variety of=20
 hardware...

 Cheerio,
 Hauke

 --=20
 Hauke Fath                        <hauke@Espresso.Rhein-Neckar.DE>
 Linn=E9weg 7
 64342 Seeheim-Jugenheim
 Germany

From: John Klos <john@ziaspace.com>
To: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
Cc: gnats-bugs@NetBSD.org, port-mac68k-maintainer@NetBSD.org,
        gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org, kei@NetBSD.org
Subject: Re: port-mac68k/6112: Adding external cache support of DayStar
 PowerCache accelerator
Date: Sat, 22 May 2021 23:20:09 +0000 (UTC)

 >>  They have not. Merging looks nontrivial (not to mention the chances of
 >>  anyone having the hw in question are not high...)
 >
 > I am sure somebody does, somewhere.
 >
 > OTOH, searching for "DayStar PowerCache" brings up quite a variety of
 > hardware...

 I think I have one. I will be able to look in about two weeks, when I'm on 
 that side of the country.

 It seems someone is making new clones of various Daystar accelerators, so 
 this would be good to have:

 https://68kmla.org/forums/topic/63106-fs-daystar-universal-powercache-p34-clones-3340mhz/

 Thanks,
 John Klos

From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
To: John Klos <john@ziaspace.com>
Cc: gnats-bugs@NetBSD.org, port-mac68k-maintainer@NetBSD.org,
        gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org, kei@NetBSD.org
Subject: Re: port-mac68k/6112: Adding external cache support of DayStar
 PowerCache accelerator
Date: Sun, 23 May 2021 11:23:25 +0200

 On Sat, 22 May 2021 23:20:09 +0000 (UTC), John Klos wrote:
 >> OTOH, searching for "DayStar PowerCache" brings up quite a variety of
 >> hardware...
 >=20
 > I think I have one. I will be able to look in about two weeks, when=20
 > I'm on that side of the country.

 Looking at the patch, it would be interesting if the PowerCache could=20
 be autoconfigured, and if the concept could be generalized - so you=20
 wouldn't need a custom kernel that won't run on any other hardware.

 > It seems someone is making new clones of various Daystar=20
 > accelerators, so this would be good to have:
 >=20
 >=20
 https://68kmla.org/forums/topic/63106-fs-daystar-universal-powercache-p34-c=
 lones-3340mhz/

 Swell. I should read 68kmla.org more often.

 As an aside, I have a DayStar 68040 cache card for the Quadra '040 PDS.=20
 I wonder whether that could be activated the same way...

 Cheerio,
 Hauke

 --=20
 Hauke Fath                        <hauke@Espresso.Rhein-Neckar.DE>
 Linn=E9weg 7
 64342 Seeheim-Jugenheim
 Germany

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.