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