xref: /netbsd-src/sys/arch/sh3/include/mmu_sh3.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin /*	$NetBSD: mmu_sh3.h,v 1.7 2008/04/28 20:23:35 martin Exp $	*/
2780de330Such 
3780de330Such /*-
4780de330Such  * Copyright (c) 2002 The NetBSD Foundation, Inc.
5780de330Such  * All rights reserved.
6780de330Such  *
7780de330Such  * This code is derived from software contributed to The NetBSD Foundation
8780de330Such  * by UCHIYAMA Yasushi.
9780de330Such  *
10780de330Such  * Redistribution and use in source and binary forms, with or without
11780de330Such  * modification, are permitted provided that the following conditions
12780de330Such  * are met:
13780de330Such  * 1. Redistributions of source code must retain the above copyright
14780de330Such  *    notice, this list of conditions and the following disclaimer.
15780de330Such  * 2. Redistributions in binary form must reproduce the above copyright
16780de330Such  *    notice, this list of conditions and the following disclaimer in the
17780de330Such  *    documentation and/or other materials provided with the distribution.
18780de330Such  *
19780de330Such  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20780de330Such  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21780de330Such  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22780de330Such  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23780de330Such  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24780de330Such  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25780de330Such  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26780de330Such  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27780de330Such  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28780de330Such  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29780de330Such  * POSSIBILITY OF SUCH DAMAGE.
30780de330Such  */
31780de330Such 
32780de330Such #ifndef _SH3_MMU_SH3_H_
33780de330Such #define	_SH3_MMU_SH3_H_
34bbc655c4Such #include <sh3/devreg.h>
35780de330Such 
36780de330Such /* 128-entry 4-way set-associative */
37780de330Such #define	SH3_MMU_WAY			4
38780de330Such #define	SH3_MMU_ENTRY			32
39780de330Such 
40780de330Such #define	SH3_PTEH			0xfffffff0
41fa6d5570Such #define	  SH3_PTEH_ASID_MASK		  0x000000ff
42780de330Such #define	  SH3_PTEH_VPN_MASK		  0xfffffc00
43780de330Such #define	SH3_PTEL			0xfffffff4
44780de330Such #define	  SH3_PTEL_HWBITS		  0x1ffff17e /* [28:12][8][6:1] */
45780de330Such #define	SH3_TTB				0xfffffff8
46780de330Such #define	SH3_TEA				0xfffffffc
47780de330Such #define	SH3_MMUCR			0xffffffe0
48780de330Such #define	  SH3_MMUCR_AT			  0x00000001
49780de330Such #define	  SH3_MMUCR_IX			  0x00000002
50780de330Such #define	  SH3_MMUCR_TF			  0x00000004
51780de330Such #define	  SH3_MMUCR_RC			  0x00000030
52780de330Such #define	  SH3_MMUCR_SV			  0x00000100
53780de330Such 
54780de330Such /*
55780de330Such  * memory-mapped TLB
56780de330Such  */
57780de330Such /* Address array */
58780de330Such #define	SH3_MMUAA			0xf2000000
59780de330Such /* address specification */
60780de330Such #define	  SH3_MMU_VPN_SHIFT		  12
61780de330Such #define	  SH3_MMU_VPN_MASK		  0x0001f000	/* [16:12] */
62780de330Such #define	  SH3_MMU_WAY_SHIFT		  8
63780de330Such #define	  SH3_MMU_WAY_MASK		  0x00000300	/* [9:8] */
64780de330Such /* data specification */
65780de330Such #define	  SH3_MMU_D_VALID		  0x00000100
66780de330Such #define	  SH3_MMUAA_D_VPN_MASK_1K	  0xfffe0c00	/* [31:17][11:10] */
67780de330Such #define	  SH3_MMUAA_D_VPN_MASK_4K	  0xfffe0000	/* [31:17] */
68fa6d5570Such #define	  SH3_MMUAA_D_ASID_MASK		  0x000000ff
69780de330Such 
70780de330Such /* Data array */
71780de330Such #define	SH3_MMUDA			0xf3000000
72780de330Such #define	  SH3_MMUDA_D_PPN_MASK		  0xfffffc00
73780de330Such #define	  SH3_MMUDA_D_V			  0x00000100
74780de330Such #define	  SH3_MMUDA_D_PR_SHIFT		  5
75780de330Such #define	  SH3_MMUDA_D_PR_MASK		  0x00000060	/* [6:5] */
76780de330Such #define	  SH3_MMUDA_D_SZ		  0x00000010
77780de330Such #define	  SH3_MMUDA_D_C			  0x00000008
78780de330Such #define	  SH3_MMUDA_D_D			  0x00000004
79780de330Such #define	  SH3_MMUDA_D_SH		  0x00000002
80780de330Such 
81970e24eeSuwe #define	SH3_TLB_DISABLE	*(volatile uint32_t *)SH3_MMUCR = SH3_MMUCR_TF
82780de330Such #endif /* !_SH3_MMU_SH3_H_ */
83