160727d8bSWarner Losh /*- 2f9bac91bSBenno Rice * Copyright (C) 1995, 1996 Wolfgang Solfrank. 3f9bac91bSBenno Rice * Copyright (C) 1995, 1996 TooLs GmbH. 4f9bac91bSBenno Rice * All rights reserved. 5f9bac91bSBenno Rice * 6f9bac91bSBenno Rice * Redistribution and use in source and binary forms, with or without 7f9bac91bSBenno Rice * modification, are permitted provided that the following conditions 8f9bac91bSBenno Rice * are met: 9f9bac91bSBenno Rice * 1. Redistributions of source code must retain the above copyright 10f9bac91bSBenno Rice * notice, this list of conditions and the following disclaimer. 11f9bac91bSBenno Rice * 2. Redistributions in binary form must reproduce the above copyright 12f9bac91bSBenno Rice * notice, this list of conditions and the following disclaimer in the 13f9bac91bSBenno Rice * documentation and/or other materials provided with the distribution. 14f9bac91bSBenno Rice * 3. All advertising materials mentioning features or use of this software 15f9bac91bSBenno Rice * must display the following acknowledgement: 16f9bac91bSBenno Rice * This product includes software developed by TooLs GmbH. 17f9bac91bSBenno Rice * 4. The name of TooLs GmbH may not be used to endorse or promote products 18f9bac91bSBenno Rice * derived from this software without specific prior written permission. 19f9bac91bSBenno Rice * 20f9bac91bSBenno Rice * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 21f9bac91bSBenno Rice * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22f9bac91bSBenno Rice * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23f9bac91bSBenno Rice * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24f9bac91bSBenno Rice * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25f9bac91bSBenno Rice * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 26f9bac91bSBenno Rice * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27f9bac91bSBenno Rice * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28f9bac91bSBenno Rice * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 29f9bac91bSBenno Rice * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30f9bac91bSBenno Rice * 314ca98df6SBenno Rice * $NetBSD: psl.h,v 1.5 2000/11/19 19:52:37 matt Exp $ 32f9bac91bSBenno Rice * $FreeBSD$ 33f9bac91bSBenno Rice */ 34f9bac91bSBenno Rice 35f9bac91bSBenno Rice #ifndef _MACHINE_PSL_H_ 36f9bac91bSBenno Rice #define _MACHINE_PSL_H_ 37f9bac91bSBenno Rice 38ffb56695SRafal Jaworowski /* 39d4602c72SNathan Whitehorn * Machine State Register (MSR) - All cores 40ffb56695SRafal Jaworowski */ 41d4602c72SNathan Whitehorn #define PSL_VEC 0x02000000UL /* AltiVec/SPE vector unit available */ 4235f612b8SNathan Whitehorn #define PSL_VSX 0x00800000UL /* Vector-Scalar unit available */ 43c3e289e1SNathan Whitehorn #define PSL_EE 0x00008000UL /* external interrupt enable */ 44c3e289e1SNathan Whitehorn #define PSL_PR 0x00004000UL /* privilege mode (1 == user) */ 45c3e289e1SNathan Whitehorn #define PSL_FP 0x00002000UL /* floating point enable */ 46c3e289e1SNathan Whitehorn #define PSL_ME 0x00001000UL /* machine check enable */ 47c3e289e1SNathan Whitehorn #define PSL_FE0 0x00000800UL /* floating point interrupt mode 0 */ 48c3e289e1SNathan Whitehorn #define PSL_BE 0x00000200UL /* branch trace enable */ 49c3e289e1SNathan Whitehorn #define PSL_FE1 0x00000100UL /* floating point interrupt mode 1 */ 50d4602c72SNathan Whitehorn #define PSL_PMM 0x00000004UL /* performance monitor mark */ 51d4602c72SNathan Whitehorn 52d4602c72SNathan Whitehorn /* Machine State Register - Book-E cores */ 53*e683c328SJustin Hibbits #ifdef __powerpc64__ 54*e683c328SJustin Hibbits #define PSL_CM 0x80000000UL /* Computation Mode (64-bit) */ 55*e683c328SJustin Hibbits #endif 56*e683c328SJustin Hibbits 57d4602c72SNathan Whitehorn #define PSL_UCLE 0x04000000UL /* User mode cache lock enable */ 58d4602c72SNathan Whitehorn #define PSL_WE 0x00040000UL /* Wait state enable */ 59d4602c72SNathan Whitehorn #define PSL_CE 0x00020000UL /* Critical interrupt enable */ 60d4602c72SNathan Whitehorn #define PSL_UBLE 0x00000400UL /* BTB lock enable - e500 only */ 61d4602c72SNathan Whitehorn #define PSL_DWE 0x00000400UL /* Debug Wait Enable - 440 only*/ 62d4602c72SNathan Whitehorn #define PSL_DE 0x00000200UL /* Debug interrupt enable */ 63d4602c72SNathan Whitehorn #define PSL_IS 0x00000020UL /* Instruction address space */ 64d4602c72SNathan Whitehorn #define PSL_DS 0x00000010UL /* Data address space */ 65d4602c72SNathan Whitehorn 66d4602c72SNathan Whitehorn /* Machine State Register (MSR) - AIM cores */ 67d4602c72SNathan Whitehorn #ifdef __powerpc64__ 68d4602c72SNathan Whitehorn #define PSL_SF 0x8000000000000000UL /* 64-bit addressing */ 69d4602c72SNathan Whitehorn #define PSL_HV 0x1000000000000000UL /* hyper-privileged mode */ 70d4602c72SNathan Whitehorn #endif 71d4602c72SNathan Whitehorn 72d4602c72SNathan Whitehorn #define PSL_POW 0x00040000UL /* power management */ 73d4602c72SNathan Whitehorn #define PSL_ILE 0x00010000UL /* interrupt endian mode (1 == le) */ 74d4602c72SNathan Whitehorn #define PSL_SE 0x00000400UL /* single-step trace enable */ 75d4602c72SNathan Whitehorn #define PSL_IP 0x00000040UL /* interrupt prefix - 601 only */ 76c3e289e1SNathan Whitehorn #define PSL_IR 0x00000020UL /* instruction address relocation */ 77c3e289e1SNathan Whitehorn #define PSL_DR 0x00000010UL /* data address relocation */ 78c3e289e1SNathan Whitehorn #define PSL_RI 0x00000002UL /* recoverable interrupt */ 79c3e289e1SNathan Whitehorn #define PSL_LE 0x00000001UL /* endian mode (1 == le) */ 80f9bac91bSBenno Rice 81f9bac91bSBenno Rice /* 82f9bac91bSBenno Rice * Floating-point exception modes: 83f9bac91bSBenno Rice */ 84f9bac91bSBenno Rice #define PSL_FE_DIS 0 /* none */ 85f9bac91bSBenno Rice #define PSL_FE_NONREC PSL_FE1 /* imprecise non-recoverable */ 86f9bac91bSBenno Rice #define PSL_FE_REC PSL_FE0 /* imprecise recoverable */ 87f9bac91bSBenno Rice #define PSL_FE_PREC (PSL_FE0 | PSL_FE1) /* precise */ 88f9bac91bSBenno Rice #define PSL_FE_DFLT PSL_FE_DIS /* default == none */ 89f9bac91bSBenno Rice 90d4602c72SNathan Whitehorn #if defined(BOOKE_E500) 91d4602c72SNathan Whitehorn /* Initial kernel MSR, use IS=1 ad DS=1. */ 92d4602c72SNathan Whitehorn #define PSL_KERNSET_INIT (PSL_IS | PSL_DS) 93*e683c328SJustin Hibbits #ifdef __powerpc64__ 94*e683c328SJustin Hibbits #define PSL_KERNSET (PSL_CM | PSL_CE | PSL_ME | PSL_EE) 95*e683c328SJustin Hibbits #else 96d4602c72SNathan Whitehorn #define PSL_KERNSET (PSL_CE | PSL_ME | PSL_EE) 97*e683c328SJustin Hibbits #endif 98ef53f64dSWarner Losh #define PSL_SRR1_MASK 0x00000000UL /* No mask on Book-E */ 99d4602c72SNathan Whitehorn #elif defined(BOOKE_PPC4XX) 100d4602c72SNathan Whitehorn #define PSL_KERNSET (PSL_CE | PSL_ME | PSL_EE | PSL_FP) 101196321d6SJustin Hibbits #define PSL_SRR1_MASK 0x00000000UL /* No mask on Book-E */ 102d4602c72SNathan Whitehorn #elif defined(AIM) 103c3e289e1SNathan Whitehorn #ifdef __powerpc64__ 104c3e289e1SNathan Whitehorn #define PSL_KERNSET (PSL_SF | PSL_EE | PSL_ME | PSL_IR | PSL_DR | PSL_RI) 105c3e289e1SNathan Whitehorn #else 1060cff3937SPeter Grehan #define PSL_KERNSET (PSL_EE | PSL_ME | PSL_IR | PSL_DR | PSL_RI) 107c3e289e1SNathan Whitehorn #endif 108a1e7448eSJustin Hibbits #define PSL_SRR1_MASK 0x783f0000UL /* Bits 1-4, 10-15 (ppc32), 33-36, 42-47 (ppc64) */ 109d4602c72SNathan Whitehorn #endif 110d4602c72SNathan Whitehorn 1110cff3937SPeter Grehan #define PSL_USERSET (PSL_KERNSET | PSL_PR) 112196321d6SJustin Hibbits #define PSL_USERSTATIC (~(PSL_VEC | PSL_FP | PSL_FE0 | PSL_FE1) & ~PSL_SRR1_MASK) 113f9bac91bSBenno Rice 114f9bac91bSBenno Rice #endif /* _MACHINE_PSL_H_ */ 115