1 /* $NetBSD: pte3.h,v 1.17 2008/04/28 20:23:38 martin Exp $ */
4 * Copyright (c) 1996 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Adam Glass and Gordon W. Ross.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
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.
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.
32 #ifndef _MACHINE_PTE3_H
33 #define _MACHINE_PTE3_H
37 #define SEGINV (NPMEG-1)
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
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
54 #define PG_MOD_SHIFT 24
55 #define PG_PERM_SHIFT 28
61 #define PG_TYPE_SHIFT 26
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)
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 */
75 #define VA_SEGNUM(x) ((u_int)(x) >> SEGSHIFT)
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)
81 #define PA_PGNUM(pa) ((unsigned)(pa) >> PGSHIFT)
83 #endif /* _MACHINE_PTE3_H */