xref: /linux/arch/parisc/include/asm/psw.h (revision 0898782247ae533d1f4e47a06bc5d4870931b284)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2deae26bfSKyle McMartin #ifndef _PARISC_PSW_H
3*b3d5f311SDenis Efremov #define _PARISC_PSW_H
4deae26bfSKyle McMartin 
5deae26bfSKyle McMartin #define	PSW_I	0x00000001
6deae26bfSKyle McMartin #define	PSW_D	0x00000002
7deae26bfSKyle McMartin #define	PSW_P	0x00000004
8deae26bfSKyle McMartin #define	PSW_Q	0x00000008
9deae26bfSKyle McMartin 
10deae26bfSKyle McMartin #define	PSW_R	0x00000010
11deae26bfSKyle McMartin #define	PSW_F	0x00000020
12deae26bfSKyle McMartin #define	PSW_G	0x00000040	/* PA1.x only */
13deae26bfSKyle McMartin #define PSW_O	0x00000080	/* PA2.0 only */
14deae26bfSKyle McMartin 
15deae26bfSKyle McMartin /* ssm/rsm instructions number PSW_W and PSW_E differently */
16deae26bfSKyle McMartin #define PSW_SM_I	PSW_I	/* Enable External Interrupts */
17deae26bfSKyle McMartin #define PSW_SM_D	PSW_D
18deae26bfSKyle McMartin #define PSW_SM_P	PSW_P
19deae26bfSKyle McMartin #define PSW_SM_Q	PSW_Q	/* Enable Interrupt State Collection */
20deae26bfSKyle McMartin #define PSW_SM_R	PSW_R	/* Enable Recover Counter Trap */
21deae26bfSKyle McMartin #define PSW_SM_W	0x200	/* PA2.0 only : Enable Wide Mode */
22deae26bfSKyle McMartin 
23deae26bfSKyle McMartin #define PSW_SM_QUIET	PSW_SM_R+PSW_SM_Q+PSW_SM_P+PSW_SM_D+PSW_SM_I
24deae26bfSKyle McMartin 
25deae26bfSKyle McMartin #define PSW_CB	0x0000ff00
26deae26bfSKyle McMartin 
27deae26bfSKyle McMartin #define	PSW_M	0x00010000
28deae26bfSKyle McMartin #define	PSW_V	0x00020000
29deae26bfSKyle McMartin #define	PSW_C	0x00040000
30deae26bfSKyle McMartin #define	PSW_B	0x00080000
31deae26bfSKyle McMartin 
32deae26bfSKyle McMartin #define	PSW_X	0x00100000
33deae26bfSKyle McMartin #define	PSW_N	0x00200000
34deae26bfSKyle McMartin #define	PSW_L	0x00400000
35deae26bfSKyle McMartin #define	PSW_H	0x00800000
36deae26bfSKyle McMartin 
37deae26bfSKyle McMartin #define	PSW_T	0x01000000
38deae26bfSKyle McMartin #define	PSW_S	0x02000000
39deae26bfSKyle McMartin #define	PSW_E	0x04000000
40deae26bfSKyle McMartin #define PSW_W	0x08000000	/* PA2.0 only */
41deae26bfSKyle McMartin #define PSW_W_BIT       36      /* PA2.0 only */
42deae26bfSKyle McMartin 
43deae26bfSKyle McMartin #define	PSW_Z	0x40000000	/* PA1.x only */
44deae26bfSKyle McMartin #define	PSW_Y	0x80000000	/* PA1.x only */
45deae26bfSKyle McMartin 
46deae26bfSKyle McMartin #ifdef CONFIG_64BIT
47deae26bfSKyle McMartin #  define PSW_HI_CB 0x000000ff    /* PA2.0 only */
48deae26bfSKyle McMartin #endif
49deae26bfSKyle McMartin 
50deae26bfSKyle McMartin #ifdef CONFIG_64BIT
51deae26bfSKyle McMartin #  define USER_PSW_HI_MASK	PSW_HI_CB
52deae26bfSKyle McMartin #  define WIDE_PSW		PSW_W
53deae26bfSKyle McMartin #else
54deae26bfSKyle McMartin #  define WIDE_PSW		0
55deae26bfSKyle McMartin #endif
56deae26bfSKyle McMartin 
57deae26bfSKyle McMartin /* Used when setting up for rfi */
58deae26bfSKyle McMartin #define KERNEL_PSW    (WIDE_PSW | PSW_C | PSW_Q | PSW_P | PSW_D)
59deae26bfSKyle McMartin #define REAL_MODE_PSW (WIDE_PSW | PSW_Q)
60deae26bfSKyle McMartin #define USER_PSW_MASK (WIDE_PSW | PSW_T | PSW_N | PSW_X | PSW_B | PSW_V | PSW_CB)
61deae26bfSKyle McMartin #define USER_PSW      (PSW_C | PSW_Q | PSW_P | PSW_D | PSW_I)
62deae26bfSKyle McMartin 
63527dcdccSDavid Howells #ifndef __ASSEMBLY__
64527dcdccSDavid Howells 
65527dcdccSDavid Howells /* The program status word as bitfields.  */
66527dcdccSDavid Howells struct pa_psw {
67527dcdccSDavid Howells 	unsigned int y:1;
68527dcdccSDavid Howells 	unsigned int z:1;
69527dcdccSDavid Howells 	unsigned int rv:2;
70527dcdccSDavid Howells 	unsigned int w:1;
71527dcdccSDavid Howells 	unsigned int e:1;
72527dcdccSDavid Howells 	unsigned int s:1;
73527dcdccSDavid Howells 	unsigned int t:1;
74527dcdccSDavid Howells 
75527dcdccSDavid Howells 	unsigned int h:1;
76527dcdccSDavid Howells 	unsigned int l:1;
77527dcdccSDavid Howells 	unsigned int n:1;
78527dcdccSDavid Howells 	unsigned int x:1;
79527dcdccSDavid Howells 	unsigned int b:1;
80527dcdccSDavid Howells 	unsigned int c:1;
81527dcdccSDavid Howells 	unsigned int v:1;
82527dcdccSDavid Howells 	unsigned int m:1;
83527dcdccSDavid Howells 
84527dcdccSDavid Howells 	unsigned int cb:8;
85527dcdccSDavid Howells 
86527dcdccSDavid Howells 	unsigned int o:1;
87527dcdccSDavid Howells 	unsigned int g:1;
88527dcdccSDavid Howells 	unsigned int f:1;
89527dcdccSDavid Howells 	unsigned int r:1;
90527dcdccSDavid Howells 	unsigned int q:1;
91527dcdccSDavid Howells 	unsigned int p:1;
92527dcdccSDavid Howells 	unsigned int d:1;
93527dcdccSDavid Howells 	unsigned int i:1;
94527dcdccSDavid Howells };
95527dcdccSDavid Howells 
96527dcdccSDavid Howells #ifdef CONFIG_64BIT
97527dcdccSDavid Howells #define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW + 4))
98527dcdccSDavid Howells #else
99527dcdccSDavid Howells #define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW))
100527dcdccSDavid Howells #endif
101527dcdccSDavid Howells 
102527dcdccSDavid Howells #endif /* !__ASSEMBLY__ */
103527dcdccSDavid Howells 
104deae26bfSKyle McMartin #endif
105