xref: /openbsd/sys/arch/powerpc/include/pte.h (revision d485f761)
1 /*	$OpenBSD: pte.h,v 1.3 2001/09/01 15:49:05 drahn Exp $	*/
2 /*	$NetBSD: pte.h,v 1.1 1996/09/30 16:34:32 ws Exp $	*/
3 
4 /*-
5  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
6  * Copyright (C) 1995, 1996 TooLs GmbH.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *	This product includes software developed by TooLs GmbH.
20  * 4. The name of TooLs GmbH may not be used to endorse or promote products
21  *    derived from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
29  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
32  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef	_POWERPC_PTE_H_
36 #define	_POWERPC_PTE_H_
37 
38 #include <sys/queue.h>
39 
40 /*
41  * Page Table Entries
42  */
43 #ifndef	_LOCORE
44 struct pte {
45 	u_int pte_hi;
46 	u_int pte_lo;
47 };
48 #endif	/* _LOCORE */
49 /* High word: */
50 #define	PTE_VALID	0x80000000
51 #define	PTE_VSID_SHFT	7
52 #define	PTE_HID		0x00000040
53 #define	PTE_API		0x0000003f
54 /* Low word: */
55 #define	PTE_RPGN	0xfffff000
56 #define	PTE_REF		0x00000100
57 #define	PTE_CHG		0x00000080
58 #define	PTE_WIMG	0x00000078
59 #define	PTE_W		0x00000040
60 #define	PTE_I		0x00000020
61 #define	PTE_M		0x00000010
62 #define	PTE_G		0x00000008
63 #define	PTE_PP		0x00000003
64 #define	PTE_RO		0x00000003
65 #define	PTE_RW		0x00000002
66 
67 #ifndef	_LOCORE
68 typedef	struct pte pte_t;
69 #endif	/* _LOCORE */
70 
71 /*
72  * Extract bits from address
73  */
74 #define	ADDR_SR_SHFT	28
75 #define	ADDR_PIDX	0x0ffff000
76 #define	ADDR_PIDX_SHFT	12
77 #define	ADDR_API_SHFT	22
78 #define	ADDR_POFF	0x00000fff
79 
80 #ifndef	_LOCORE
81 #ifdef	_KERNEL
82 extern pte_t *ptable;
83 extern int ptab_cnt;
84 #endif	/* _KERNEL */
85 #endif	/* _LOCORE */
86 
87 /*
88  * Bits in DSISR:
89  */
90 #define	DSISR_DIRECT	0x80000000
91 #define	DSISR_NOTFOUND	0x40000000
92 #define	DSISR_PROTECT	0x08000000
93 #define	DSISR_INVRX	0x04000000
94 #define	DSISR_STORE	0x02000000
95 #define	DSISR_DABR	0x00400000
96 #define	DSISR_SEGMENT	0x00200000
97 #define	DSISR_EAR	0x00100000
98 
99 /*
100  * Bits in SRR1 on ISI:
101  */
102 #define	ISSRR1_NOTFOUND	0x40000000
103 #define	ISSRR1_DIRECT	0x10000000
104 #define	ISSRR1_PROTECT	0x08000000
105 #define	ISSRR1_SEGMENT	0x00200000
106 
107 #ifdef	_KERNEL
108 #ifndef	_LOCORE
109 extern u_int dsisr __P((void));
110 extern vm_offset_t dar __P((void));
111 #endif	/* _KERNEL */
112 #endif	/* _LOCORE */
113 #endif	/* _POWERPC_PTE_H_ */
114