pte.h revision 1bd453f385f392a0415fad0b14efc9f5a545320f
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_PTE_H
#define _SYS_PTE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifndef _ASM
#endif /* _ASM */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASM
/*
* The tte struct is a 64 bit data type. Since we currently plan to
* use a V8 compiler all manipulations in C will be done using the bit fields
* or as 2 integers. In assembly code we will deal with it as a double (using
* ldx and stx). The structure is defined to force a double alignment.
* Note that USIIi uses bits <47:40> for diag, and <49:48> are reserved.
*/
typedef union {
struct tte {
} tte_bit;
struct {
} tte_int;
} tte_t;
#endif /* !_ASM */
/*
* Defines for valid, sz, sz2 fields in tte.
* The TTE_CSZ macro combines the sz and sz2 fields.
*/
#define TTE8K 0x0
#define TTE64K 0x1
#define TTE512K 0x2
#define TTE4M 0x3
#define TTE32M 0x4
#define TTE256M 0x5
#define TTESZ_VALID 0x4
#define TTE_SZ_SHFT_INT 29
#define TTE_SZ_BITS 0x3
#define TTE_SZ2_SHFT_INT 14
#define TTE_SZ2_BITS 0x4
#define TTE_CSZ_BITS 0x7
/*
* the tte lock cnt now lives in the hme blk and is 16 bits long. See
* comments in hme_blk declaration.
*/
#ifndef _ASM
/* PFN is defined as bits [40-13] of the physical address */
#define TTE_TO_TTEPFN(ttep) \
/*
* This define adds the vaddr page offset to obtain a correct pfn
*/
}
#endif /* !_ASM */
/*
* The tte defines are separated into integers because the compiler doesn't
* support 64bit defines.
*/
/* Defines for tte using inthi */
#define TTE_VALID_INT 0x80000000
#define TTE_NFO_INT 0x10000000
#define TTE_IE_INT 0x08000000
/* Defines for tte using intlo */
#define TTE_SUSPEND_SHIFT 0
#define TTE_NOSYNC_INT 0x00001000
#define TTE_SUSPEND 0x00000800
#define TTE_REF_INT 0x00000400
#define TTE_WRPRM_INT 0x00000200
#define TTE_E_SYNTH_INT 0x00000100
#define TTE_EXECPRM_INT 0x00000080
#define TTE_LCK_INT 0x00000040
#define TTE_CP_INT 0x00000020
#define TTE_CV_INT 0x00000010
#define TTE_SIDEFF_INT 0x00000008
#define TTE_PRIV_INT 0x00000004
#define TTE_HWWR_INT 0x00000002
#define TTE_GLB_INT 0x00000001
/*
* Define to clear the high-order 2 bits of the 43-bit PA in a tte. The
* Spitfire tte has PFN in [40-13] and uses [42-41] as part of Diag bits.
*/
#define TTE_SPITFIRE_PFNHI_CLEAR 0x3
#ifndef ASM
/* Defines to help build ttes using inthi */
#define TTE_SZ_INT(sz) \
/* XXX PFN is defined as bits [40-13] of the physical address */
#define TTE_VALID_CHECK(attr) \
#define TTE_IE_CHECK(attr) \
#define TTE_NFO_CHECK(attr) \
/* Defines to help build ttes using intlo */
#define TTE_WRPRM_CHECK(attr) \
#define TTE_EXECPRM_CHECK(attr) \
#define TTE_NOSYNC_CHECK(attr) \
#define TTE_CP_CHECK(attr) \
#define TTE_CV_CHECK(attr) \
#define TTE_SE_CHECK(attr) \
#define TTE_PRIV_CHECK(attr) \
#define MAKE_TTEATTR_INTHI(attr) \
#define MAKE_TTEATTR_INTLO(attr) \
#define TTEINTLO_ATTR \
#define MAKE_TTE_MASK(ttep) \
{ \
}
/*
*/
#define TTE_SET_RM(ttep) \
#define TTE_CLR_RM(ttep) \
~(TTE_HWWR_INT | TTE_REF_INT))
/*
* This define provides a generic method to set and clear multiple tte flags.
* A bitmask of all flags to be affected is passed in "flags" and a bitmask
* of the new values is passed in "newflags".
*/
#endif /* !_ASM */
#ifdef __cplusplus
}
#endif
#endif /* !_SYS_PTE_H */