1*befa8bb5Stsutsui /* $NetBSD: pte3.h,v 1.18 2009/01/12 06:53:39 tsutsui Exp $ */ 220af809cScgd 303325025Sgwr /*- 403325025Sgwr * Copyright (c) 1996 The NetBSD Foundation, Inc. 5a2133ea2Sglass * All rights reserved. 6a2133ea2Sglass * 703325025Sgwr * This code is derived from software contributed to The NetBSD Foundation 803325025Sgwr * by Adam Glass and Gordon W. Ross. 903325025Sgwr * 10a2133ea2Sglass * Redistribution and use in source and binary forms, with or without 11a2133ea2Sglass * modification, are permitted provided that the following conditions 12a2133ea2Sglass * are met: 13a2133ea2Sglass * 1. Redistributions of source code must retain the above copyright 14a2133ea2Sglass * notice, this list of conditions and the following disclaimer. 15a2133ea2Sglass * 2. Redistributions in binary form must reproduce the above copyright 16a2133ea2Sglass * notice, this list of conditions and the following disclaimer in the 17a2133ea2Sglass * documentation and/or other materials provided with the distribution. 18a2133ea2Sglass * 1903325025Sgwr * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2003325025Sgwr * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2103325025Sgwr * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22340699a2Sgwr * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23340699a2Sgwr * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2403325025Sgwr * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2503325025Sgwr * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2603325025Sgwr * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2703325025Sgwr * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2803325025Sgwr * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2903325025Sgwr * POSSIBILITY OF SUCH DAMAGE. 30a2133ea2Sglass */ 3142255b64Sglass 32eff2e270Sgwr #ifndef _MACHINE_PTE3_H 33eff2e270Sgwr #define _MACHINE_PTE3_H 3442255b64Sglass 35d3b41623Sglass #define NCONTEXT 8 36eff2e270Sgwr #define NPMEG 256 37eff2e270Sgwr #define SEGINV (NPMEG-1) 38d3b41623Sglass #define NPAGSEG 16 39d3b41623Sglass #define NSEGMAP 2048 40d3b41623Sglass 41d3b41623Sglass #define PG_VALID 0x80000000 42d3b41623Sglass #define PG_WRITE 0x40000000 43d3b41623Sglass #define PG_SYSTEM 0x20000000 44d3b41623Sglass #define PG_NC 0x10000000 45d3b41623Sglass #define PG_TYPE 0x0C000000 4659bf96aaSgwr #define PG_REF 0x02000000 47d3b41623Sglass #define PG_MOD 0x01000000 4842255b64Sglass 4959bf96aaSgwr #define PG_SPECIAL (PG_VALID|PG_WRITE|PG_SYSTEM|PG_NC|PG_REF|PG_MOD) 5042255b64Sglass #define PG_PERM (PG_VALID|PG_WRITE|PG_SYSTEM|PG_NC) 5159bf96aaSgwr #define PG_MODREF (PG_REF|PG_MOD) 52d3b41623Sglass #define PG_FRAME 0x0007FFFF 53d3b41623Sglass 5442255b64Sglass #define PG_MOD_SHIFT 24 5542255b64Sglass #define PG_PERM_SHIFT 28 56d3b41623Sglass 5759bf96aaSgwr #define OBMEM 0 5859bf96aaSgwr #define OBIO 1 5959bf96aaSgwr #define VME_D16 2 6059bf96aaSgwr #define VME_D32 3 61d3b41623Sglass #define PG_TYPE_SHIFT 26 62d3b41623Sglass 6342255b64Sglass #define PG_INVAL 0x0 6442255b64Sglass 65d3b41623Sglass #define MAKE_PGTYPE(x) ((x) << PG_TYPE_SHIFT) 66eff2e270Sgwr #define PG_PFNUM(pte) (pte & PG_FRAME) 67eff2e270Sgwr #define PG_PA(pte) (PG_PFNUM(pte) << PGSHIFT) 6842255b64Sglass 6959bf96aaSgwr #define PGT_MASK MAKE_PGTYPE(3) 7059bf96aaSgwr #define PGT_OBMEM MAKE_PGTYPE(OBMEM) /* onboard memory */ 7159bf96aaSgwr #define PGT_OBIO MAKE_PGTYPE(OBIO) /* onboard I/O */ 7259bf96aaSgwr #define PGT_VME_D16 MAKE_PGTYPE(VME_D16) /* VMEbus 16-bit data */ 7359bf96aaSgwr #define PGT_VME_D32 MAKE_PGTYPE(VME_D32) /* VMEbus 32-bit data */ 7459bf96aaSgwr 7549d7518eSgwr #define VA_SEGNUM(x) ((u_int)(x) >> SEGSHIFT) 7649d7518eSgwr 7742255b64Sglass #define VA_PTE_NUM_SHIFT 13 7842255b64Sglass #define VA_PTE_NUM_MASK (0xF << VA_PTE_NUM_SHIFT) 79*befa8bb5Stsutsui #define VA_PTE_NUM(va) (((va) & VA_PTE_NUM_MASK) >> VA_PTE_NUM_SHIFT) 8042255b64Sglass 81*befa8bb5Stsutsui #define PA_PGNUM(pa) ((unsigned)(pa) >> PGSHIFT) 8242255b64Sglass 83eff2e270Sgwr #endif /* _MACHINE_PTE3_H */ 84