Home | History | Annotate | Line # | Download | only in include
mmu_sh4.h revision 1.4
      1  1.4  uch /*	$NetBSD: mmu_sh4.h,v 1.4 2002/05/09 12:26:16 uch Exp $	*/
      2  1.1  uch 
      3  1.1  uch /*-
      4  1.1  uch  * Copyright (c) 2002 The NetBSD Foundation, Inc.
      5  1.1  uch  * All rights reserved.
      6  1.1  uch  *
      7  1.1  uch  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  uch  * by UCHIYAMA Yasushi.
      9  1.1  uch  *
     10  1.1  uch  * Redistribution and use in source and binary forms, with or without
     11  1.1  uch  * modification, are permitted provided that the following conditions
     12  1.1  uch  * are met:
     13  1.1  uch  * 1. Redistributions of source code must retain the above copyright
     14  1.1  uch  *    notice, this list of conditions and the following disclaimer.
     15  1.1  uch  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  uch  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  uch  *    documentation and/or other materials provided with the distribution.
     18  1.1  uch  * 3. All advertising materials mentioning features or use of this software
     19  1.1  uch  *    must display the following acknowledgement:
     20  1.1  uch  *        This product includes software developed by the NetBSD
     21  1.1  uch  *        Foundation, Inc. and its contributors.
     22  1.1  uch  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1  uch  *    contributors may be used to endorse or promote products derived
     24  1.1  uch  *    from this software without specific prior written permission.
     25  1.1  uch  *
     26  1.1  uch  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1  uch  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1  uch  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1  uch  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1  uch  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1  uch  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1  uch  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1  uch  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1  uch  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1  uch  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1  uch  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1  uch  */
     38  1.1  uch 
     39  1.1  uch #ifndef _SH3_MMU_SH4_H_
     40  1.3  uch #define	_SH3_MMU_SH4_H_
     41  1.2  uch #include <sh3/devreg.h>
     42  1.1  uch 
     43  1.1  uch /* ITLB 4-entry full-associative UTLB 64-entry full-associative */
     44  1.3  uch #define	SH4_PTEH			0xff000000
     45  1.3  uch #define	  SH4_PTEH_VPN_MASK		  0xfffffc00
     46  1.4  uch #define	  SH4_PTEH_ASID_MASK		  0x000000ff
     47  1.3  uch #define	SH4_PTEL			0xff000004
     48  1.3  uch #define	  SH4_PTEL_WT			  0x00000001
     49  1.3  uch #define	  SH4_PTEL_SH			  0x00000002
     50  1.3  uch #define	  SH4_PTEL_D			  0x00000004
     51  1.3  uch #define	  SH4_PTEL_C			  0x00000008
     52  1.3  uch #define	  SH4_PTEL_PR_SHIFT		  5
     53  1.3  uch #define	  SH4_PTEL_PR_MASK		  0x00000060	/* [5:6] */
     54  1.3  uch #define	  SH4_PTEL_SZ_MASK		  0x00000090	/* [4][7] */
     55  1.3  uch #define	    SH4_PTEL_SZ_1K		  0x00000000
     56  1.3  uch #define	    SH4_PTEL_SZ_4K		  0x00000010
     57  1.3  uch #define	    SH4_PTEL_SZ_64K		  0x00000080
     58  1.3  uch #define	    SH4_PTEL_SZ_1M		  0x00000090
     59  1.3  uch #define	  SH4_PTEL_V			  0x00000100
     60  1.3  uch #define	  SH4_PTEL_HWBITS		  0x1ffff1ff /* [28:12]PFN [8:0]attr. */
     61  1.3  uch 
     62  1.3  uch #define	SH4_PTEA			0xff000034
     63  1.3  uch #define	  SH4_PTEA_SA_MASK		  0x00000007
     64  1.3  uch #define	  SH4_PTEA_SA_TC		  0x00000008
     65  1.3  uch #define	SH4_TTB				0xff000008
     66  1.3  uch #define	SH4_TEA				0xff00000c
     67  1.3  uch #define	SH4_MMUCR			0xff000010
     68  1.3  uch #define	  SH4_MMUCR_AT			  0x00000001
     69  1.3  uch #define	  SH4_MMUCR_TI			  0x00000004
     70  1.3  uch #define	  SH4_MMUCR_SV			  0x00000100
     71  1.3  uch #define	  SH4_MMUCR_SQMD		  0x00000200
     72  1.3  uch #define	  SH4_MMUCR_URC_SHIFT		  10
     73  1.3  uch #define	  SH4_MMUCR_URC_MASK		  0x0000fc00	/* [10:15] */
     74  1.3  uch #define	  SH4_MMUCR_URB_SHIFT		  18
     75  1.3  uch #define	  SH4_MMUCR_URB_MASK		  0x00fc0000	/* [18:23] */
     76  1.3  uch #define	  SH4_MMUCR_LRUI_SHIFT		  26
     77  1.3  uch #define	  SH4_MMUCR_LRUT_MASK		  0xfc000000	/* [26:31] */
     78  1.1  uch 
     79  1.3  uch #define	  SH4_MMUCR_MASK	(SH4_MMUCR_LRUT_MASK | SH4_MMUCR_URB_MASK | \
     80  1.1  uch     SH4_MMUCR_URC_MASK | SH4_MMUCR_SQMD | SH4_MMUCR_SV | SH4_MMUCR_AT)
     81  1.3  uch /*
     82  1.3  uch  * memory-mapped TLB
     83  1.1  uch  *	must be access from P2-area program.
     84  1.1  uch  *	branch to the other area must be maed at least 8 instruction
     85  1.1  uch  *	after access.
     86  1.1  uch  */
     87  1.3  uch #define	SH4_ITLB_ENTRY		4
     88  1.3  uch #define	SH4_UTLB_ENTRY		64
     89  1.1  uch 
     90  1.1  uch /* ITLB */
     91  1.3  uch #define	SH4_ITLB_AA			0xf2000000
     92  1.1  uch /* address specification (common for address and data array(0,1)) */
     93  1.3  uch #define	  SH4_ITLB_E_SHIFT		  8
     94  1.3  uch #define	  SH4_ITLB_E_MASK		  0x00000300	/* [9:8] */
     95  1.1  uch /* data specification */
     96  1.1  uch /* address-array */
     97  1.3  uch #define	  SH4_ITLB_AA_ASID_MASK		  0x000000ff	/* [7:0] */
     98  1.3  uch #define	  SH4_ITLB_AA_V			  0x00000100
     99  1.3  uch #define	  SH4_ITLB_AA_VPN_SHIFT		  10
    100  1.3  uch #define	  SH4_ITLB_AA_VPN_MASK		  0xfffffc00	/* [31:10] */
    101  1.1  uch /* data-array 1 */
    102  1.3  uch #define	SH4_ITLB_DA1			0xf3000000
    103  1.3  uch #define	  SH4_ITLB_DA1_SH		  0x00000002
    104  1.3  uch #define	  SH4_ITLB_DA1_C		  0x00000008
    105  1.3  uch #define	  SH4_ITLB_DA1_SZ_MASK		  0x00000090	/* [7][4] */
    106  1.3  uch #define	    SH4_ITLB_DA1_SZ_1K		  0x00000000
    107  1.3  uch #define	    SH4_ITLB_DA1_SZ_4K		  0x00000010
    108  1.3  uch #define	    SH4_ITLB_DA1_SZ_64K		  0x00000080
    109  1.3  uch #define	    SH4_ITLB_DA1_SZ_1M		  0x00000090
    110  1.3  uch #define	  SH4_ITLB_DA1_PR		  0x00000040
    111  1.3  uch #define	  SH4_ITLB_DA1_V		  0x00000100
    112  1.3  uch #define	  SH4_ITLB_DA1_PPN_SHIFT	  11
    113  1.3  uch #define	  SH4_ITLB_DA1_PPN_MASK		  0x1ffffc00	/* [28:10] */
    114  1.1  uch /* data-array 2 */
    115  1.3  uch #define	SH4_ITLB_DA2			0xf3800000
    116  1.3  uch #define	  SH4_ITLB_DA2_SA_MASK		  0x00000003
    117  1.3  uch #define	  SH4_ITLB_DA2_TC		  0x00000004
    118  1.1  uch 
    119  1.1  uch /* UTLB */
    120  1.3  uch #define	SH4_UTLB_AA			0xf6000000
    121  1.1  uch /* address specification (common for address and data array(0,1)) */
    122  1.3  uch #define	  SH4_UTLB_E_SHIFT		  8
    123  1.3  uch #define	  SH4_UTLB_E_MASK		  0x00003f00
    124  1.3  uch #define	  SH4_UTLB_A			  0x00000080
    125  1.1  uch /* data specification */
    126  1.1  uch /* address-array */
    127  1.3  uch #define	  SH4_UTLB_AA_VPN_MASK		  0xfffffc00	/* [31:10] */
    128  1.3  uch #define	  SH4_UTLB_AA_D			  0x00000200
    129  1.3  uch #define	  SH4_UTLB_AA_V			  0x00000100
    130  1.3  uch #define	  SH4_UTLB_AA_ASID_MASK		  0x000000ff	/* [7:0] */
    131  1.1  uch /* data-array 1 */
    132  1.3  uch #define	SH4_UTLB_DA1			0xf7000000
    133  1.3  uch #define	  SH4_UTLB_DA1_WT		  0x00000001
    134  1.3  uch #define	  SH4_UTLB_DA1_SH		  0x00000002
    135  1.3  uch #define	  SH4_UTLB_DA1_D		  0x00000004
    136  1.3  uch #define	  SH4_UTLB_DA1_C		  0x00000008
    137  1.3  uch #define	  SH4_UTLB_DA1_SZ_MASK		  0x00000090	/* [7][4] */
    138  1.3  uch #define	    SH4_UTLB_DA1_SZ_1K		  0x00000000
    139  1.3  uch #define	    SH4_UTLB_DA1_SZ_4K		  0x00000010
    140  1.3  uch #define	    SH4_UTLB_DA1_SZ_64K		  0x00000080
    141  1.3  uch #define	    SH4_UTLB_DA1_SZ_1M		  0x00000090
    142  1.3  uch #define	  SH4_UTLB_DA1_PR_SHIFT		  5
    143  1.3  uch #define	  SH4_UTLB_DA1_PR_MASK		  0x00000060
    144  1.3  uch #define	  SH4_UTLB_DA1_V		  0x00000100
    145  1.3  uch #define	  SH4_UTLB_DA1_PPN_SHIFT	  11
    146  1.3  uch #define	  SH4_UTLB_DA1_PPN_MASK		  0x1ffffc00	/* [28:10] */
    147  1.1  uch /* data-array 2 */
    148  1.3  uch #define	SH4_UTLB_DA2			0xf7800000
    149  1.3  uch #define	  SH4_UTLB_DA2_SA_MASK		  0x00000003
    150  1.3  uch #define	  SH4_UTLB_DA2_TC		  0x00000004
    151  1.1  uch 
    152  1.3  uch #define	SH4_TLB_DISABLE	*(__volatile__ u_int32_t *)SH4_MMUCR = SH4_MMUCR_TI
    153  1.2  uch #endif /* !_SH3_MMU_SH4_H_ */
    154