Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: pte3.h,v 1.18 2009/01/12 06:53:39 tsutsui Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1996 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Adam Glass and Gordon W. Ross.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  * POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 #ifndef _MACHINE_PTE3_H
     33 #define _MACHINE_PTE3_H
     34 
     35 #define NCONTEXT 8
     36 #define NPMEG	256
     37 #define SEGINV	(NPMEG-1)
     38 #define NPAGSEG 16
     39 #define NSEGMAP 2048
     40 
     41 #define PG_VALID   0x80000000
     42 #define PG_WRITE   0x40000000
     43 #define PG_SYSTEM  0x20000000
     44 #define PG_NC      0x10000000
     45 #define PG_TYPE    0x0C000000
     46 #define PG_REF     0x02000000
     47 #define PG_MOD     0x01000000
     48 
     49 #define PG_SPECIAL (PG_VALID|PG_WRITE|PG_SYSTEM|PG_NC|PG_REF|PG_MOD)
     50 #define PG_PERM    (PG_VALID|PG_WRITE|PG_SYSTEM|PG_NC)
     51 #define	PG_MODREF  (PG_REF|PG_MOD)
     52 #define PG_FRAME   0x0007FFFF
     53 
     54 #define PG_MOD_SHIFT 24
     55 #define PG_PERM_SHIFT 28
     56 
     57 #define OBMEM	0
     58 #define OBIO 	1
     59 #define VME_D16	2
     60 #define VME_D32	3
     61 #define PG_TYPE_SHIFT 26
     62 
     63 #define PG_INVAL   0x0
     64 
     65 #define MAKE_PGTYPE(x) ((x) << PG_TYPE_SHIFT)
     66 #define PG_PFNUM(pte) (pte & PG_FRAME)
     67 #define PG_PA(pte) (PG_PFNUM(pte) << PGSHIFT)
     68 
     69 #define	PGT_MASK	MAKE_PGTYPE(3)
     70 #define	PGT_OBMEM	MAKE_PGTYPE(OBMEM)		/* onboard memory */
     71 #define	PGT_OBIO	MAKE_PGTYPE(OBIO)		/* onboard I/O */
     72 #define	PGT_VME_D16	MAKE_PGTYPE(VME_D16)	/* VMEbus 16-bit data */
     73 #define	PGT_VME_D32	MAKE_PGTYPE(VME_D32)	/* VMEbus 32-bit data */
     74 
     75 #define VA_SEGNUM(x)	((u_int)(x) >> SEGSHIFT)
     76 
     77 #define VA_PTE_NUM_SHIFT  13
     78 #define VA_PTE_NUM_MASK (0xF << VA_PTE_NUM_SHIFT)
     79 #define VA_PTE_NUM(va) (((va) & VA_PTE_NUM_MASK) >> VA_PTE_NUM_SHIFT)
     80 
     81 #define PA_PGNUM(pa) ((unsigned)(pa) >> PGSHIFT)
     82 
     83 #endif /* _MACHINE_PTE3_H */
     84