xref: /netbsd-src/sys/arch/sun3/include/pte.h (revision ae9172d6cd9432a6a1a56760d86b32c57a66c39c)
1 /*	$NetBSD: pte.h,v 1.8 1994/11/21 21:34:12 gwr Exp $	*/
2 
3 /*
4  * Copyright (c) 1994 Gordon W. Ross
5  * Copyright (c) 1993 Adam Glass
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *	This product includes software developed by Adam Glass.
19  * 4. The name of the Author may not be used to endorse or promote products
20  *    derived from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  */
34 
35 #ifndef _MACHINE_PTE_H
36 #define _MACHINE_PTE_H
37 
38 #define NCONTEXT 8
39 #define SEGINV 255
40 #define NPAGSEG 16
41 #define NSEGMAP 2048
42 
43 #define PG_VALID   0x80000000
44 #define PG_WRITE   0x40000000
45 #define PG_SYSTEM  0x20000000
46 #define PG_NC      0x10000000
47 #define PG_TYPE    0x0C000000
48 #define PG_REF     0x02000000
49 #define PG_MOD     0x01000000
50 
51 #define PG_SPECIAL (PG_VALID|PG_WRITE|PG_SYSTEM|PG_NC|PG_REF|PG_MOD)
52 #define PG_PERM    (PG_VALID|PG_WRITE|PG_SYSTEM|PG_NC)
53 #define	PG_MODREF  (PG_REF|PG_MOD)
54 #define PG_FRAME   0x0007FFFF
55 
56 #define PG_MOD_SHIFT 24
57 #define PG_PERM_SHIFT 28
58 
59 #define OBMEM	0
60 #define OBIO 	1
61 #define VME_D16	2
62 #define VME_D32	3
63 #define PG_TYPE_SHIFT 26
64 
65 #define PG_INVAL   0x0
66 
67 #define MAKE_PGTYPE(x) ((x) << PG_TYPE_SHIFT)
68 #define PG_PGNUM(pte) (pte & PG_FRAME)
69 #define PG_PA(pte) ((pte & PG_FRAME) <<PGSHIFT)
70 
71 #define	PGT_MASK	MAKE_PGTYPE(3)
72 #define	PGT_OBMEM	MAKE_PGTYPE(OBMEM)		/* onboard memory */
73 #define	PGT_OBIO	MAKE_PGTYPE(OBIO)		/* onboard I/O */
74 #define	PGT_VME_D16	MAKE_PGTYPE(VME_D16)	/* VMEbus 16-bit data */
75 #define	PGT_VME_D32	MAKE_PGTYPE(VME_D32)	/* VMEbus 32-bit data */
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) (pa >>PGSHIFT)
82 
83 #endif /* !_MACHINE_PTE_H*/
84