Home | History | Annotate | Line # | Download | only in include
pte.h revision 1.26.6.2
      1  1.26.6.2     skrll /*	$NetBSD: pte.h,v 1.26.6.2 2016/12/05 10:54:58 skrll Exp $ */
      2       1.1       eeh 
      3       1.1       eeh /*
      4       1.5       eeh  * Copyright (c) 1996-1999 Eduardo Horvath
      5       1.1       eeh  *
      6       1.1       eeh  * Redistribution and use in source and binary forms, with or without
      7       1.1       eeh  * modification, are permitted provided that the following conditions
      8       1.1       eeh  * are met:
      9       1.1       eeh  * 1. Redistributions of source code must retain the above copyright
     10       1.1       eeh  *    notice, this list of conditions and the following disclaimer.
     11       1.5       eeh  *
     12       1.5       eeh  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR  ``AS IS'' AND
     13       1.1       eeh  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     14       1.1       eeh  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     15       1.5       eeh  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR  BE LIABLE
     16       1.1       eeh  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     17       1.1       eeh  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     18       1.1       eeh  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     19       1.1       eeh  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     20       1.1       eeh  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     21       1.1       eeh  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     22       1.1       eeh  * SUCH DAMAGE.
     23       1.1       eeh  *
     24       1.1       eeh  */
     25       1.9   darrenr 
     26      1.18       mrg #ifndef _MACHINE_PTE_H_
     27      1.18       mrg #define _MACHINE_PTE_H_
     28      1.18       mrg 
     29       1.9   darrenr #if defined(_KERNEL_OPT)
     30       1.9   darrenr #include "opt_sparc_arch.h"
     31       1.9   darrenr #endif
     32       1.1       eeh 
     33       1.1       eeh /*
     34       1.1       eeh  * Address translation works as follows:
     35       1.1       eeh  *
     36       1.1       eeh  **
     37       1.1       eeh  * For sun4u:
     38       1.1       eeh  *
     39       1.1       eeh  *	Take your pick; it's all S/W anyway.  We'll start by emulating a sun4.
     40       1.1       eeh  *	Oh, here's the sun4u TTE for reference:
     41       1.1       eeh  *
     42       1.1       eeh  *	struct sun4u_tte {
     43      1.16       cdi  *		uint64	tag_g:1,	(global flag)
     44      1.21       mrg  *			tag_reserved:2,	(reserved for future use)
     45      1.21       mrg  *			tag_ctxt:13,	(context for mapping)
     46       1.1       eeh  *			tag_unassigned:6,
     47       1.1       eeh  *			tag_va:42;	(virtual address bits<64:22>)
     48      1.16       cdi  *		uint64	data_v:1,	(valid bit)
     49       1.1       eeh  *			data_size:2,	(page size [8K*8**<SIZE>])
     50       1.1       eeh  *			data_nfo:1,	(no-fault only)
     51       1.1       eeh  *			data_ie:1,	(invert endianness [inefficient])
     52      1.22  nakayama  *			data_soft2:9,	(reserved for S/W)
     53      1.21       mrg  *			data_reserved:7,(reserved for future use)
     54      1.21       mrg  *			data_pa:30,	(physical address)
     55       1.1       eeh  *			data_soft:6,	(reserved for S/W)
     56       1.1       eeh  *			data_lock:1,	(lock into TLB)
     57       1.1       eeh  *			data_cacheable:2,	(cacheability control)
     58       1.1       eeh  *			data_e:1,	(explicit accesses only)
     59       1.1       eeh  *			data_priv:1,	(privileged page)
     60      1.12       wiz  *			data_w:1,	(writable)
     61       1.1       eeh  *			data_g:1;	(same as tag_g)
     62       1.1       eeh  *	};
     63       1.1       eeh  */
     64       1.1       eeh 
     65       1.1       eeh /* virtual address to virtual page number */
     66       1.8       mrg #define	VA_SUN4_VPG(va)		(((int)(va) >> 13) & 31)
     67       1.8       mrg #define	VA_SUN4C_VPG(va)	(((int)(va) >> 12) & 63)
     68       1.1       eeh #define	VA_SUN4U_VPG(va)	(((int)(va) >> 13) & 31)
     69       1.1       eeh 
     70       1.1       eeh /* virtual address to offset within page */
     71       1.8       mrg #define VA_SUN4_OFF(va)       	(((int)(va)) & 0x1FFF)
     72       1.8       mrg #define VA_SUN4C_OFF(va)     	(((int)(va)) & 0xFFF)
     73       1.1       eeh #define VA_SUN4U_OFF(va)       	(((int)(va)) & 0x1FFF)
     74       1.1       eeh 
     75       1.1       eeh /* When we go to 64-bit VAs we need to handle the hole */
     76       1.1       eeh #define VA_VPG(va)	VA_SUN4U_VPG(va)
     77       1.1       eeh #define VA_OFF(va)	VA_SUN4U_OFF(va)
     78       1.1       eeh 
     79       1.1       eeh #define PG_SHIFT4U	13
     80       1.1       eeh #define MMU_PAGE_ALIGN	8192
     81       1.1       eeh 
     82       1.1       eeh /* If you know where a tte is in the tsb, how do you find its va? */
     83       1.1       eeh #define TSBVA(i)	((tsb[(i)].tag.f.tag_va<<22)|(((i)<<13)&0x3ff000))
     84       1.1       eeh 
     85       1.1       eeh #ifndef _LOCORE
     86       1.1       eeh /*
     87       1.1       eeh  *  This is the spitfire TTE.
     88       1.1       eeh  *
     89       1.1       eeh  *  We could use bitmasks and shifts to construct this if
     90       1.1       eeh  *  we had a 64-bit compiler w/64-bit longs.  Otherwise it's
     91       1.1       eeh  *  a real pain to do this in C.
     92       1.1       eeh  */
     93       1.7       eeh #if 0
     94       1.7       eeh /* We don't use bitfeilds anyway. */
     95       1.1       eeh struct sun4u_tag_fields {
     96      1.21       mrg 	uint64_t tag_g:1,	/* global flag */
     97      1.21       mrg 		tag_reserved:2,	/* reserved for future use */
     98      1.21       mrg 		tag_ctxt:13,	/* context for mapping */
     99       1.1       eeh 		tag_unassigned:6,
    100       1.1       eeh 		tag_va:42;	/* virtual address bits<64:22> */
    101       1.1       eeh };
    102       1.1       eeh union sun4u_tag { struct sun4u_tag_fields f; int64_t tag; };
    103       1.1       eeh struct sun4u_data_fields {
    104      1.21       mrg 	uint64_t data_v:1,	/* valid bit */
    105       1.1       eeh 		data_size:2,	/* page size [8K*8**<SIZE>] */
    106       1.1       eeh 		data_nfo:1,	/* no-fault only */
    107       1.1       eeh 		data_ie:1,	/* invert endianness [inefficient] */
    108      1.21       mrg 		data_soft2:9,	/* reserved for S/W */
    109      1.21       mrg 		data_reserved:7,/* reserved for future use */
    110      1.21       mrg 		data_pa:30,	/* physical address */
    111      1.21       mrg 		data_tsblock:1,	/* S/W TSB locked entry */
    112       1.1       eeh 		data_modified:1,/* S/W modified bit */
    113       1.1       eeh 		data_realw:1,	/* S/W real writable bit (to manage modified) */
    114      1.21       mrg 		data_accessed:1,/* S/W accessed bit */
    115       1.1       eeh 		data_exec:1,	/* S/W Executable */
    116       1.1       eeh 		data_onlyexec:1,/* S/W Executable only */
    117       1.1       eeh 		data_lock:1,	/* lock into TLB */
    118       1.1       eeh 		data_cacheable:2,	/* cacheability control */
    119       1.1       eeh 		data_e:1,	/* explicit accesses only */
    120       1.1       eeh 		data_priv:1,	/* privileged page */
    121      1.12       wiz 		data_w:1,	/* writable */
    122       1.1       eeh 		data_g:1;	/* same as tag_g */
    123       1.1       eeh };
    124       1.1       eeh union sun4u_data { struct sun4u_data_fields f; int64_t data; };
    125       1.1       eeh struct sun4u_tte {
    126       1.1       eeh 	union sun4u_tag tag;
    127       1.1       eeh 	union sun4u_data data;
    128       1.1       eeh };
    129       1.7       eeh #else
    130       1.7       eeh struct sun4u_tte {
    131       1.7       eeh 	int64_t tag;
    132       1.7       eeh 	int64_t data;
    133       1.7       eeh };
    134       1.7       eeh #endif
    135       1.1       eeh typedef struct sun4u_tte pte_t;
    136       1.1       eeh 
    137       1.1       eeh #endif /* _LOCORE */
    138       1.1       eeh 
    139       1.1       eeh /* TSB tag masks */
    140       1.1       eeh #define CTX_MASK		((1<<13)-1)
    141       1.1       eeh #define TSB_TAG_CTX_SHIFT	48
    142       1.1       eeh #define TSB_TAG_VA_SHIFT	22
    143       1.1       eeh #define TSB_TAG_G		0x8000000000000000LL
    144       1.1       eeh 
    145       1.1       eeh #define TSB_TAG_CTX(t)		((((int64_t)(t))>>TSB_TAG_CTX_SHIFT)&CTX_MASK)
    146       1.1       eeh #define TSB_TAG_VA(t)		((((int64_t)(t))<<TSB_TAG_VA_SHIFT))
    147      1.16       cdi #define TSB_TAG(g,ctx,va)	((((uint64_t)((g)!=0))<<63)|(((uint64_t)(ctx)&CTX_MASK)<<TSB_TAG_CTX_SHIFT)|(((uint64_t)va)>>TSB_TAG_VA_SHIFT))
    148       1.1       eeh 
    149       1.6       eeh /* Page sizes */
    150       1.6       eeh #define	PGSZ_8K			0
    151       1.6       eeh #define	PGSZ_64K		1
    152       1.6       eeh #define	PGSZ_512K		2
    153       1.6       eeh #define	PGSZ_4M			3
    154       1.6       eeh 
    155      1.25     palle #define	SUN4U_PGSZ_SHIFT	61
    156      1.25     palle #define	SUN4U_TLB_SZ(s)		(((uint64_t)(s))<<SUN4U_PGSZ_SHIFT)
    157       1.6       eeh 
    158       1.1       eeh /* TLB data masks */
    159      1.25     palle #define SUN4U_TLB_V		0x8000000000000000LL
    160      1.25     palle #define SUN4U_TLB_8K		SUN4U_TLB_SZ(PGSZ_8K)
    161      1.25     palle #define SUN4U_TLB_64K		SUN4U_TLB_SZ(PGSZ_64K)
    162      1.25     palle #define SUN4U_TLB_512K		SUN4U_TLB_SZ(PGSZ_512K)
    163      1.25     palle #define SUN4U_TLB_4M		SUN4U_TLB_SZ(PGSZ_4M)
    164      1.25     palle #define SUN4U_TLB_SZ_MASK	0x6000000000000000LL
    165      1.25     palle #define SUN4U_TLB_NFO		0x1000000000000000LL
    166      1.25     palle #define SUN4U_TLB_IE		0x0800000000000000LL
    167      1.25     palle #define SUN4U_TLB_SOFT2_MASK	0x07fc000000000000LL
    168      1.25     palle #define SUN4U_TLB_RESERVED_MASK	0x0003f80000000000LL
    169      1.25     palle #define SUN4U_TLB_PA_MASK	0x000007ffffffe000LL
    170      1.25     palle #define SUN4U_TLB_SOFT_MASK	0x0000000000001f80LL
    171       1.1       eeh /* S/W bits */
    172       1.1       eeh /* Access & TSB locked bits are swapped so I can set access w/one insn */
    173      1.25     palle /* #define SUN4U_TLB_ACCESS	0x0000000000001000LL */
    174      1.25     palle #define SUN4U_TLB_ACCESS	0x0000000000000200LL
    175      1.25     palle #define SUN4U_TLB_MODIFY	0x0000000000000800LL
    176      1.25     palle #define SUN4U_TLB_REAL_W	0x0000000000000400LL
    177      1.25     palle /* #define SUN4U_TLB_TSB_LOCK	0x0000000000000200LL */
    178      1.25     palle #define SUN4U_TLB_TSB_LOCK	0x0000000000001000LL
    179      1.24     palle #define SUN4U_TLB_EXEC		0x0000000000000100LL
    180      1.25     palle #define SUN4U_TLB_EXEC_ONLY	0x0000000000000080LL
    181       1.1       eeh /* H/W bits */
    182      1.25     palle #define SUN4U_TLB_L		0x0000000000000040LL
    183      1.25     palle #define SUN4U_TLB_CACHE_MASK	0x0000000000000030LL
    184      1.25     palle #define SUN4U_TLB_CP		0x0000000000000020LL
    185      1.25     palle #define SUN4U_TLB_CV		0x0000000000000010LL
    186      1.25     palle #define SUN4U_TLB_E		0x0000000000000008LL
    187      1.25     palle #define SUN4U_TLB_P		0x0000000000000004LL
    188      1.25     palle #define SUN4U_TLB_W		0x0000000000000002LL
    189      1.25     palle #define SUN4U_TLB_G		0x0000000000000001LL
    190      1.10       eeh 
    191      1.10       eeh /* Use a bit in the SOFT2 area to indicate a locked mapping. */
    192      1.10       eeh #define	TLB_WIRED		0x0010000000000000LL
    193       1.1       eeh 
    194       1.1       eeh /*
    195       1.1       eeh  * The following bits are used by locore so they should
    196       1.1       eeh  * be duplicates of the above w/o the "long long"
    197       1.1       eeh  */
    198       1.1       eeh /* S/W bits */
    199      1.25     palle /* #define SUN4U_TTE_ACCESS	0x0000000000001000 */
    200      1.25     palle #define SUN4U_TTE_ACCESS	0x0000000000000200
    201      1.25     palle #define SUN4U_TTE_MODIFY	0x0000000000000800
    202      1.25     palle #define SUN4U_TTE_REAL_W	0x0000000000000400
    203      1.25     palle /* #define SUN4U_TTE_TSB_LOCK	0x0000000000000200 */
    204      1.25     palle #define SUN4U_TTE_TSB_LOCK	0x0000000000001000
    205      1.25     palle #define SUN4U_TTE_EXEC		0x0000000000000100
    206      1.25     palle #define SUN4U_TTE_EXEC_ONLY	0x0000000000000080
    207       1.1       eeh /* H/W bits */
    208      1.25     palle #define SUN4U_TTE_L		0x0000000000000040
    209      1.25     palle #define SUN4U_TTE_CACHE_MASK	0x0000000000000030
    210      1.25     palle #define SUN4U_TTE_CP		0x0000000000000020
    211      1.25     palle #define SUN4U_TTE_CV		0x0000000000000010
    212      1.25     palle #define SUN4U_TTE_E		0x0000000000000008
    213      1.25     palle #define SUN4U_TTE_P		0x0000000000000004
    214      1.25     palle #define SUN4U_TTE_W		0x0000000000000002
    215      1.25     palle #define SUN4U_TTE_G		0x0000000000000001
    216       1.3       eeh 
    217       1.3       eeh #define TTE_DATA_BITS	"\177\20" \
    218       1.3       eeh         "b\77V\0" "f\75\2SIZE\0" "b\77V\0" "f\75\2SIZE\0" \
    219       1.3       eeh         "=\0008K\0" "=\00164K\0" "=\002512K\0" "=\0034M\0" \
    220       1.3       eeh         "b\74NFO\0"     "b\73IE\0"      "f\62\10SOFT2\0" \
    221       1.3       eeh         "f\51\10DIAG\0" "f\15\33PA<40:13>\0" "f\7\5SOFT\0" \
    222       1.3       eeh         "b\6L\0"        "b\5CP\0"       "b\4CV\0" \
    223       1.3       eeh         "b\3E\0"        "b\2P\0"        "b\1W\0"        "b\0G\0"
    224       1.1       eeh 
    225      1.23     palle #define SUN4V_PGSZ_SHIFT	0
    226      1.23     palle #define	SUN4V_TLB_SZ(s)		(((uint64_t)(s))<<SUN4V_PGSZ_SHIFT)
    227      1.23     palle 
    228      1.23     palle /* TLB data masks */
    229      1.23     palle #define SUN4V_TLB_V		0x8000000000000000LL
    230      1.23     palle #define SUN4V_TLB_8K		SUN4V_TLB_SZ(PGSZ_8K)
    231      1.23     palle #define SUN4V_TLB_64K		SUN4V_TLB_SZ(PGSZ_64K)
    232      1.23     palle #define SUN4V_TLB_512K		SUN4V_TLB_SZ(PGSZ_512K)
    233      1.23     palle #define SUN4V_TLB_4M		SUN4V_TLB_SZ(PGSZ_4M)
    234      1.23     palle #define SUN4V_TLB_SZ_MASK	0x000000000000000fLL
    235      1.23     palle #define SUN4V_TLB_NFO		0x4000000000000000LL
    236      1.23     palle #define SUN4V_TLB_IE		0x0000000000001000LL
    237      1.23     palle #define SUN4V_TLB_SOFT2_MASK	0x3f00000000000000LL
    238      1.23     palle #define SUN4V_TLB_PA_MASK	0x00ffffffffffe000LL
    239      1.23     palle #define SUN4V_TLB_SOFT_MASK	0x0000000000000030LL
    240      1.23     palle /* S/W bits */
    241      1.23     palle #define SUN4V_TLB_ACCESS	0x0000000000000010LL
    242      1.23     palle #define SUN4V_TLB_MODIFY	0x0000000000000020LL
    243      1.23     palle #define SUN4V_TLB_REAL_W	0x2000000000000000LL
    244      1.26     palle #define SUN4V_TLB_TSB_LOCK	0x1000000000000000LL
    245      1.23     palle #define SUN4V_TLB_EXEC		SUN4V_TLB_X
    246      1.23     palle #define SUN4V_TLB_EXEC_ONLY	0x0200000000000000LL
    247      1.23     palle /* H/W bits */
    248      1.23     palle #define SUN4V_TLB_CACHE_MASK	0x0000000000000600LL
    249      1.23     palle #define SUN4V_TLB_CP		0x0000000000000400LL
    250      1.23     palle #define SUN4V_TLB_CV		0x0000000000000200LL
    251      1.23     palle #define SUN4V_TLB_E		0x0000000000000800LL
    252      1.23     palle #define SUN4V_TLB_P		0x0000000000000100LL
    253      1.23     palle #define SUN4V_TLB_X		0x0000000000000080LL
    254      1.23     palle #define SUN4V_TLB_W		0x0000000000000040LL
    255      1.23     palle #define SUN4V_TLB_G		0x0000000000000000LL
    256      1.23     palle 
    257  1.26.6.2     skrll #define SUN4U_TSB_DATA(g,sz,pa,priv,write,cache,aliased,valid,ie,wc) \
    258      1.25     palle (((valid)?SUN4U_TLB_V:0LL)|SUN4U_TLB_SZ(sz)|(((uint64_t)(pa))&SUN4U_TLB_PA_MASK)|\
    259  1.26.6.2     skrll ((cache)?((aliased)?SUN4U_TLB_CP:SUN4U_TLB_CACHE_MASK):((wc)?0LL:SUN4U_TLB_E))|\
    260      1.25     palle ((priv)?SUN4U_TLB_P:0LL)|((write)?SUN4U_TLB_W:0LL)|((g)?SUN4U_TLB_G:0LL)|((ie)?SUN4U_TLB_IE:0LL))
    261       1.1       eeh 
    262  1.26.6.2     skrll #define SUN4V_TSB_DATA(g,sz,pa,priv,write,cache,aliased,valid,ie,wc) \
    263      1.23     palle (((valid)?SUN4V_TLB_V:0LL)|SUN4V_TLB_SZ(sz)|\
    264      1.23     palle (((u_int64_t)(pa))&SUN4V_TLB_PA_MASK)|\
    265  1.26.6.2     skrll ((cache)?((aliased)?SUN4V_TLB_CP:SUN4V_TLB_CACHE_MASK):((wc)?0LL:SUN4V_TLB_E))|\
    266      1.23     palle ((priv)?SUN4V_TLB_P:0LL)|((write)?SUN4V_TLB_W:0LL)|((g)?SUN4V_TLB_G:0LL)|\
    267      1.23     palle ((ie)?SUN4V_TLB_IE:0LL))
    268      1.23     palle 
    269  1.26.6.2     skrll #define TSB_DATA(g,sz,pa,priv,write,cache,aliased,valid,ie,wc) \
    270  1.26.6.2     skrll (CPU_ISSUN4V ? SUN4V_TSB_DATA(g,sz,pa,priv,write,cache,aliased,valid,ie,wc) : \
    271  1.26.6.2     skrll                SUN4U_TSB_DATA(g,sz,pa,priv,write,cache,aliased,valid,ie,wc))
    272      1.23     palle 
    273      1.25     palle #define TLB_EXEC      (CPU_ISSUN4V ? SUN4V_TLB_EXEC      : SUN4U_TLB_EXEC)
    274      1.25     palle #define TLB_V         (CPU_ISSUN4V ? SUN4V_TLB_V         : SUN4U_TLB_V)
    275      1.25     palle #define TLB_PA_MASK   (CPU_ISSUN4V ? SUN4V_TLB_PA_MASK   : SUN4U_TLB_PA_MASK)
    276      1.25     palle #define TLB_CP        (CPU_ISSUN4V ? SUN4V_TLB_CP        : SUN4U_TLB_CP)
    277      1.25     palle #define TLB_P         (CPU_ISSUN4V ? SUN4V_TLB_P         : SUN4U_TLB_P)
    278      1.25     palle #define TLB_W         (CPU_ISSUN4V ? SUN4V_TLB_W         : SUN4U_TLB_W)
    279      1.25     palle #define TLB_ACCESS    (CPU_ISSUN4V ? SUN4V_TLB_ACCESS    : SUN4U_TLB_ACCESS)
    280      1.25     palle #define TLB_MODIFY    (CPU_ISSUN4V ? SUN4V_TLB_MODIFY    : SUN4U_TLB_MODIFY)
    281      1.25     palle #define TLB_REAL_W    (CPU_ISSUN4V ? SUN4V_TLB_REAL_W    : SUN4U_TLB_REAL_W)
    282      1.25     palle #define TLB_TSB_LOCK  (CPU_ISSUN4V ? SUN4V_TLB_TSB_LOCK  : SUN4U_TLB_TSB_LOCK)
    283      1.25     palle #define TLB_EXEC_ONLY (CPU_ISSUN4V ? SUN4V_TLB_EXEC_ONLY : SUN4U_TLB_EXEC_ONLY)
    284  1.26.6.1     skrll #define TLB_L         (CPU_ISSUN4V ? 0                   : SUN4U_TLB_L)
    285      1.25     palle #define TLB_CV        (CPU_ISSUN4V ? SUN4V_TLB_CV        : SUN4U_TLB_CV)
    286  1.26.6.2     skrll #define TLB_IE        (CPU_ISSUN4V ? SUN4V_TLB_IE        : SUN4U_TLB_IE)
    287      1.24     palle 
    288       1.1       eeh #define MMU_CACHE_VIRT	0x3
    289       1.1       eeh #define MMU_CACHE_PHYS	0x2
    290       1.1       eeh #define MMU_CACHE_NONE	0x0
    291       1.1       eeh 
    292       1.1       eeh /* This needs to be updated for sun4u IOMMUs */
    293       1.1       eeh /*
    294       1.1       eeh  * IOMMU PTE bits.
    295       1.1       eeh  */
    296       1.1       eeh #define IOPTE_PPN_MASK  0x07ffff00
    297       1.1       eeh #define IOPTE_PPN_SHIFT 8
    298       1.1       eeh #define IOPTE_RSVD      0x000000f1
    299       1.1       eeh #define IOPTE_WRITE     0x00000004
    300       1.1       eeh #define IOPTE_VALID     0x00000002
    301       1.8       mrg 
    302       1.8       mrg /*
    303       1.8       mrg  * This is purely for compatibility with the old SPARC machines.
    304       1.8       mrg  */
    305       1.8       mrg #define	NBPRG	(1 << 24)	/* bytes per region */
    306       1.8       mrg #define	RGSHIFT	24		/* log2(NBPRG) */
    307       1.8       mrg #define NSEGRG	(NBPRG / NBPSG)	/* segments per region */
    308       1.8       mrg 
    309       1.8       mrg #define	NBPSG	(1 << 18)	/* bytes per segment */
    310       1.8       mrg #define	SGSHIFT	18		/* log2(NBPSG) */
    311       1.8       mrg 
    312       1.8       mrg /* there is no `struct pte'; we just use `int'; this is for non-4M only */
    313       1.8       mrg #define	PG_V		0x80000000
    314       1.8       mrg #define	PG_PFNUM	0x0007ffff	/* n.b.: only 16 bits on sun4c */
    315       1.8       mrg 
    316       1.8       mrg /* virtual address to virtual region number */
    317       1.8       mrg #define	VA_VREG(va)	(((unsigned int)(va) >> RGSHIFT) & 255)
    318       1.8       mrg 
    319       1.8       mrg /* virtual address to virtual segment number */
    320       1.8       mrg #define	VA_VSEG(va)	(((unsigned int)(va) >> SGSHIFT) & 63)
    321       1.8       mrg 
    322       1.8       mrg #ifndef _LOCORE
    323       1.8       mrg typedef u_short pmeg_t;		/* 10 bits needed per Sun-4 segmap entry */
    324       1.8       mrg #endif
    325       1.8       mrg 
    326       1.8       mrg /*
    327       1.8       mrg  * Here are the bit definitions for 4M/SRMMU pte's
    328       1.8       mrg  */
    329       1.8       mrg 		/* MMU TABLE ENTRIES */
    330       1.8       mrg #define SRMMU_TETYPE	0x3		/* mask for table entry type */
    331       1.8       mrg #define SRMMU_TEPTE	0x2		/* Page Table Entry */
    332       1.8       mrg 		/* PTE FIELDS */
    333       1.8       mrg #define SRMMU_PPNMASK	0xFFFFFF00
    334       1.8       mrg #define SRMMU_PPNPASHIFT 0x4 		/* shift to put ppn into PAddr */
    335      1.18       mrg 
    336      1.18       mrg #endif /* _MACHINE_PTE_H_ */
    337