xref: /freebsd/sys/powerpc/include/psl.h (revision 2ff63af9b88c7413b7d71715b5532625752a248e)
160727d8bSWarner Losh /*-
251369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-4-Clause
351369649SPedro F. Giffuni  *
4f9bac91bSBenno Rice  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5f9bac91bSBenno Rice  * Copyright (C) 1995, 1996 TooLs GmbH.
6f9bac91bSBenno Rice  * All rights reserved.
7f9bac91bSBenno Rice  *
8f9bac91bSBenno Rice  * Redistribution and use in source and binary forms, with or without
9f9bac91bSBenno Rice  * modification, are permitted provided that the following conditions
10f9bac91bSBenno Rice  * are met:
11f9bac91bSBenno Rice  * 1. Redistributions of source code must retain the above copyright
12f9bac91bSBenno Rice  *    notice, this list of conditions and the following disclaimer.
13f9bac91bSBenno Rice  * 2. Redistributions in binary form must reproduce the above copyright
14f9bac91bSBenno Rice  *    notice, this list of conditions and the following disclaimer in the
15f9bac91bSBenno Rice  *    documentation and/or other materials provided with the distribution.
16f9bac91bSBenno Rice  * 3. All advertising materials mentioning features or use of this software
17f9bac91bSBenno Rice  *    must display the following acknowledgement:
18f9bac91bSBenno Rice  *	This product includes software developed by TooLs GmbH.
19f9bac91bSBenno Rice  * 4. The name of TooLs GmbH may not be used to endorse or promote products
20f9bac91bSBenno Rice  *    derived from this software without specific prior written permission.
21f9bac91bSBenno Rice  *
22f9bac91bSBenno Rice  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23f9bac91bSBenno Rice  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24f9bac91bSBenno Rice  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25f9bac91bSBenno Rice  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26f9bac91bSBenno Rice  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27f9bac91bSBenno Rice  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28f9bac91bSBenno Rice  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29f9bac91bSBenno Rice  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30f9bac91bSBenno Rice  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31f9bac91bSBenno Rice  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32f9bac91bSBenno Rice  *
334ca98df6SBenno Rice  *	$NetBSD: psl.h,v 1.5 2000/11/19 19:52:37 matt Exp $
34f9bac91bSBenno Rice  */
35f9bac91bSBenno Rice 
36f9bac91bSBenno Rice #ifndef	_MACHINE_PSL_H_
37f9bac91bSBenno Rice #define	_MACHINE_PSL_H_
38f9bac91bSBenno Rice 
39ffb56695SRafal Jaworowski /*
40d4602c72SNathan Whitehorn  * Machine State Register (MSR) - All cores
41ffb56695SRafal Jaworowski  */
42d4602c72SNathan Whitehorn #define	PSL_VEC		0x02000000UL	/* AltiVec/SPE vector unit available */
4335f612b8SNathan Whitehorn #define	PSL_VSX		0x00800000UL	/* Vector-Scalar unit available */
44c3e289e1SNathan Whitehorn #define	PSL_EE		0x00008000UL	/* external interrupt enable */
45c3e289e1SNathan Whitehorn #define	PSL_PR		0x00004000UL	/* privilege mode (1 == user) */
46c3e289e1SNathan Whitehorn #define	PSL_FP		0x00002000UL	/* floating point enable */
47c3e289e1SNathan Whitehorn #define	PSL_ME		0x00001000UL	/* machine check enable */
48c3e289e1SNathan Whitehorn #define	PSL_FE0		0x00000800UL	/* floating point interrupt mode 0 */
49c3e289e1SNathan Whitehorn #define	PSL_FE1		0x00000100UL	/* floating point interrupt mode 1 */
50d4602c72SNathan Whitehorn #define	PSL_PMM		0x00000004UL	/* performance monitor mark */
518ccebb44SJustin Hibbits #define	PSL_RI		0x00000002UL	/* recoverable interrupt */
52d4602c72SNathan Whitehorn 
53d4602c72SNathan Whitehorn /* Machine State Register - Book-E cores */
54e683c328SJustin Hibbits #ifdef __powerpc64__
55e683c328SJustin Hibbits #define	PSL_CM		0x80000000UL	/* Computation Mode (64-bit) */
56e683c328SJustin Hibbits #endif
57e683c328SJustin Hibbits 
588ccebb44SJustin Hibbits #define PSL_GS		0x10000000UL	/* Guest state */
59d4602c72SNathan Whitehorn #define PSL_UCLE	0x04000000UL	/* User mode cache lock enable */
60d4602c72SNathan Whitehorn #define PSL_WE		0x00040000UL	/* Wait state enable */
61d4602c72SNathan Whitehorn #define PSL_CE		0x00020000UL	/* Critical interrupt enable */
62d4602c72SNathan Whitehorn #define PSL_UBLE	0x00000400UL	/* BTB lock enable - e500 only */
63d4602c72SNathan Whitehorn #define PSL_DWE		0x00000400UL	/* Debug Wait Enable - 440 only*/
64d4602c72SNathan Whitehorn #define PSL_DE		0x00000200UL	/* Debug interrupt enable */
65d4602c72SNathan Whitehorn #define PSL_IS		0x00000020UL	/* Instruction address space */
66d4602c72SNathan Whitehorn #define PSL_DS		0x00000010UL	/* Data address space */
67d4602c72SNathan Whitehorn 
68d4602c72SNathan Whitehorn /* Machine State Register (MSR) - AIM cores */
69d4602c72SNathan Whitehorn #ifdef __powerpc64__
70d4602c72SNathan Whitehorn #define PSL_SF		0x8000000000000000UL	/* 64-bit addressing */
71d4602c72SNathan Whitehorn #define PSL_HV		0x1000000000000000UL	/* hyper-privileged mode */
72d4602c72SNathan Whitehorn #endif
73d4602c72SNathan Whitehorn 
74d4602c72SNathan Whitehorn #define	PSL_POW		0x00040000UL	/* power management */
75d4602c72SNathan Whitehorn #define	PSL_ILE		0x00010000UL	/* interrupt endian mode (1 == le) */
76d4602c72SNathan Whitehorn #define	PSL_SE		0x00000400UL	/* single-step trace enable */
778ccebb44SJustin Hibbits #define	PSL_BE		0x00000200UL	/* branch trace enable */
78d4602c72SNathan Whitehorn #define	PSL_IP		0x00000040UL	/* interrupt prefix - 601 only */
79c3e289e1SNathan Whitehorn #define	PSL_IR		0x00000020UL	/* instruction address relocation */
80c3e289e1SNathan Whitehorn #define	PSL_DR		0x00000010UL	/* data address relocation */
81c3e289e1SNathan Whitehorn #define	PSL_LE		0x00000001UL	/* endian mode (1 == le) */
82f9bac91bSBenno Rice 
83f9bac91bSBenno Rice /*
84f9bac91bSBenno Rice  * Floating-point exception modes:
85f9bac91bSBenno Rice  */
86f9bac91bSBenno Rice #define	PSL_FE_DIS	0		/* none */
87f9bac91bSBenno Rice #define	PSL_FE_NONREC	PSL_FE1		/* imprecise non-recoverable */
88f9bac91bSBenno Rice #define	PSL_FE_REC	PSL_FE0		/* imprecise recoverable */
89f9bac91bSBenno Rice #define	PSL_FE_PREC	(PSL_FE0 | PSL_FE1) /* precise */
90*5d0e8619SAlfredo Dal'Ava Junior #define	PSL_FE_DFLT	PSL_FE_PREC	/* default == precise */
91f9bac91bSBenno Rice 
9261928298SNathan Whitehorn #ifndef LOCORE
9361928298SNathan Whitehorn extern register_t psl_kernset;		/* Default MSR values for kernel */
9461928298SNathan Whitehorn extern register_t psl_userset;		/* Default MSR values for userland */
95e683c328SJustin Hibbits #ifdef __powerpc64__
9661928298SNathan Whitehorn extern register_t psl_userset32;	/* Default user MSR values for 32-bit */
97e683c328SJustin Hibbits #endif
9861928298SNathan Whitehorn extern register_t psl_userstatic;	/* Bits of SRR1 userland may not set */
99c3e289e1SNathan Whitehorn #endif
100f9bac91bSBenno Rice 
101f9bac91bSBenno Rice #endif	/* _MACHINE_PSL_H_ */
102