xref: /netbsd-src/sys/arch/hpc/stand/hpcboot/mips/mips_tx39.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin /* -*-C++-*-	$NetBSD: mips_tx39.h,v 1.4 2008/04/28 20:23:20 martin Exp $	*/
29173eae7Such 
39173eae7Such /*-
49173eae7Such  * Copyright (c) 2001 The NetBSD Foundation, Inc.
59173eae7Such  * All rights reserved.
69173eae7Such  *
79173eae7Such  * This code is derived from software contributed to The NetBSD Foundation
89173eae7Such  * by UCHIYAMA Yasushi.
99173eae7Such  *
109173eae7Such  * Redistribution and use in source and binary forms, with or without
119173eae7Such  * modification, are permitted provided that the following conditions
129173eae7Such  * are met:
139173eae7Such  * 1. Redistributions of source code must retain the above copyright
149173eae7Such  *    notice, this list of conditions and the following disclaimer.
159173eae7Such  * 2. Redistributions in binary form must reproduce the above copyright
169173eae7Such  *    notice, this list of conditions and the following disclaimer in the
179173eae7Such  *    documentation and/or other materials provided with the distribution.
189173eae7Such  *
199173eae7Such  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
209173eae7Such  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
219173eae7Such  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
229173eae7Such  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
239173eae7Such  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
249173eae7Such  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
259173eae7Such  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
269173eae7Such  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
279173eae7Such  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
289173eae7Such  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
299173eae7Such  * POSSIBILITY OF SUCH DAMAGE.
309173eae7Such  */
319173eae7Such 
329173eae7Such #include <hpcboot.h>
339173eae7Such #include <mips/mips_arch.h>
349173eae7Such 
359173eae7Such class TX39XX : public MIPSArchitecture {
369173eae7Such private:
379173eae7Such 
389173eae7Such public:
399173eae7Such 	TX39XX(Console *&, MemoryManager *&, enum ArchitectureOps);
409173eae7Such 	~TX39XX(void);
419173eae7Such 
429173eae7Such 	virtual BOOL init(void);
439173eae7Such 	virtual void systemInfo(void);
449173eae7Such 	virtual void cacheFlush(void);
459173eae7Such 	static void boot_func(struct BootArgs *, struct PageTag *);
469173eae7Such };
479173eae7Such 
489173eae7Such #define	MIPS_TX39XX_CACHE_FLUSH()					\
499173eae7Such __asm(									\
509173eae7Such 	".set	noreorder;"						\
519173eae7Such 	"li	t1, 16384;"						\
529173eae7Such 	"li	t2, 8192;"						\
539173eae7Such 									\
549173eae7Such 	/* Disable I-cache */						\
559173eae7Such 	"li	t5, ~0x00000020;"					\
569173eae7Such 	"mfc0	t6, $3;"						\
579173eae7Such 	"and	t5, t5, t6;"						\
589173eae7Such 	"nop;"								\
599173eae7Such 	"mtc0	t5, $3;"						\
609173eae7Such 									\
619173eae7Such 	/* Stop streaming */						\
629173eae7Such 	"beq	zero, zero, 1f;"					\
639173eae7Such 	"nop;"								\
649173eae7Such "1:"									\
659173eae7Such 	/* Flush I-cache */						\
669173eae7Such 	"li	t0, 0x80000000;"					\
679173eae7Such 	"addu	t1, t0, t1;"						\
689173eae7Such 	"subu	t1, t1, 128;"						\
699173eae7Such "2:"									\
709173eae7Such 	"cache	0x0, 0($0);"						\
719173eae7Such 	"cache	0x0, 16(t0);"						\
729173eae7Such 	"cache	0x0, 32(t0);"						\
739173eae7Such 	"cache	0x0, 48(t0);"						\
749173eae7Such 	"cache	0x0, 64(t0);"						\
759173eae7Such 	"cache	0x0, 80(t0);"						\
769173eae7Such 	"cache	0x0, 96(t0);"						\
779173eae7Such 	"cache	0x0, 112(t0);"						\
789173eae7Such 	"bne	t0, t1, 2b;"						\
799173eae7Such 	"addu	t0, t0, 128;"						\
809173eae7Such 									\
819173eae7Such 	/* Flush D-cache */						\
829173eae7Such 	"li	t0, 0x80000000;"					\
839173eae7Such 	"addu	t1, t0, t2;"						\
849173eae7Such 									\
859173eae7Such "3:"									\
869173eae7Such 	"lw	t2, 0(t0);"						\
879173eae7Such 	"bne	t1, t0, 3b;"						\
889173eae7Such 	"addiu	t0, t0, 4;"						\
899173eae7Such 									\
909173eae7Such 	/* Enable I-cache */						\
919173eae7Such 	"nop;"								\
929173eae7Such 	"mtc0	t6, $3;"						\
939173eae7Such 	"nop;"								\
949173eae7Such 	".set reorder;"							\
959173eae7Such )
96