18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Contains register definitions common to the Book E PowerPC
48c2ecf20Sopenharmony_ci * specification.  Notice that while the IBM-40x series of CPUs
58c2ecf20Sopenharmony_ci * are not true Book E PowerPCs, they borrowed a number of features
68c2ecf20Sopenharmony_ci * before Book E was finalized, and are included here as well.  Unfortunately,
78c2ecf20Sopenharmony_ci * they sometimes used different locations than true Book E CPUs did.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * Copyright 2009-2010 Freescale Semiconductor, Inc.
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci#ifdef __KERNEL__
128c2ecf20Sopenharmony_ci#ifndef __ASM_POWERPC_REG_BOOKE_H__
138c2ecf20Sopenharmony_ci#define __ASM_POWERPC_REG_BOOKE_H__
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include <asm/ppc-opcode.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* Machine State Register (MSR) Fields */
188c2ecf20Sopenharmony_ci#define MSR_GS_LG	28	/* Guest state */
198c2ecf20Sopenharmony_ci#define MSR_UCLE_LG	26	/* User-mode cache lock enable */
208c2ecf20Sopenharmony_ci#define MSR_SPE_LG	25	/* Enable SPE */
218c2ecf20Sopenharmony_ci#define MSR_DWE_LG	10	/* Debug Wait Enable */
228c2ecf20Sopenharmony_ci#define MSR_UBLE_LG	10	/* BTB lock enable (e500) */
238c2ecf20Sopenharmony_ci#define MSR_IS_LG	MSR_IR_LG /* Instruction Space */
248c2ecf20Sopenharmony_ci#define MSR_DS_LG	MSR_DR_LG /* Data Space */
258c2ecf20Sopenharmony_ci#define MSR_PMM_LG	2	/* Performance monitor mark bit */
268c2ecf20Sopenharmony_ci#define MSR_CM_LG	31	/* Computation Mode (0=32-bit, 1=64-bit) */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define MSR_GS		__MASK(MSR_GS_LG)
298c2ecf20Sopenharmony_ci#define MSR_UCLE	__MASK(MSR_UCLE_LG)
308c2ecf20Sopenharmony_ci#define MSR_SPE		__MASK(MSR_SPE_LG)
318c2ecf20Sopenharmony_ci#define MSR_DWE		__MASK(MSR_DWE_LG)
328c2ecf20Sopenharmony_ci#define MSR_UBLE	__MASK(MSR_UBLE_LG)
338c2ecf20Sopenharmony_ci#define MSR_IS		__MASK(MSR_IS_LG)
348c2ecf20Sopenharmony_ci#define MSR_DS		__MASK(MSR_DS_LG)
358c2ecf20Sopenharmony_ci#define MSR_PMM		__MASK(MSR_PMM_LG)
368c2ecf20Sopenharmony_ci#define MSR_CM		__MASK(MSR_CM_LG)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#if defined(CONFIG_PPC_BOOK3E_64)
398c2ecf20Sopenharmony_ci#define MSR_64BIT	MSR_CM
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define MSR_		(MSR_ME | MSR_RI | MSR_CE)
428c2ecf20Sopenharmony_ci#define MSR_KERNEL	(MSR_ | MSR_64BIT)
438c2ecf20Sopenharmony_ci#define MSR_USER32	(MSR_ | MSR_PR | MSR_EE)
448c2ecf20Sopenharmony_ci#define MSR_USER64	(MSR_USER32 | MSR_64BIT)
458c2ecf20Sopenharmony_ci#elif defined (CONFIG_40x)
468c2ecf20Sopenharmony_ci#define MSR_KERNEL	(MSR_ME|MSR_RI|MSR_IR|MSR_DR|MSR_CE)
478c2ecf20Sopenharmony_ci#define MSR_USER	(MSR_KERNEL|MSR_PR|MSR_EE)
488c2ecf20Sopenharmony_ci#else
498c2ecf20Sopenharmony_ci#define MSR_KERNEL	(MSR_ME|MSR_RI|MSR_CE)
508c2ecf20Sopenharmony_ci#define MSR_USER	(MSR_KERNEL|MSR_PR|MSR_EE)
518c2ecf20Sopenharmony_ci#endif
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/* Special Purpose Registers (SPRNs)*/
548c2ecf20Sopenharmony_ci#define SPRN_DECAR	0x036	/* Decrementer Auto Reload Register */
558c2ecf20Sopenharmony_ci#define SPRN_IVPR	0x03F	/* Interrupt Vector Prefix Register */
568c2ecf20Sopenharmony_ci#define SPRN_USPRG0	0x100	/* User Special Purpose Register General 0 */
578c2ecf20Sopenharmony_ci#define SPRN_SPRG3R	0x103	/* Special Purpose Register General 3 Read */
588c2ecf20Sopenharmony_ci#define SPRN_SPRG4R	0x104	/* Special Purpose Register General 4 Read */
598c2ecf20Sopenharmony_ci#define SPRN_SPRG5R	0x105	/* Special Purpose Register General 5 Read */
608c2ecf20Sopenharmony_ci#define SPRN_SPRG6R	0x106	/* Special Purpose Register General 6 Read */
618c2ecf20Sopenharmony_ci#define SPRN_SPRG7R	0x107	/* Special Purpose Register General 7 Read */
628c2ecf20Sopenharmony_ci#define SPRN_SPRG4W	0x114	/* Special Purpose Register General 4 Write */
638c2ecf20Sopenharmony_ci#define SPRN_SPRG5W	0x115	/* Special Purpose Register General 5 Write */
648c2ecf20Sopenharmony_ci#define SPRN_SPRG6W	0x116	/* Special Purpose Register General 6 Write */
658c2ecf20Sopenharmony_ci#define SPRN_SPRG7W	0x117	/* Special Purpose Register General 7 Write */
668c2ecf20Sopenharmony_ci#define SPRN_EPCR	0x133	/* Embedded Processor Control Register */
678c2ecf20Sopenharmony_ci#define SPRN_DBCR2	0x136	/* Debug Control Register 2 */
688c2ecf20Sopenharmony_ci#define SPRN_DBCR4	0x233	/* Debug Control Register 4 */
698c2ecf20Sopenharmony_ci#define SPRN_MSRP	0x137	/* MSR Protect Register */
708c2ecf20Sopenharmony_ci#define SPRN_IAC3	0x13A	/* Instruction Address Compare 3 */
718c2ecf20Sopenharmony_ci#define SPRN_IAC4	0x13B	/* Instruction Address Compare 4 */
728c2ecf20Sopenharmony_ci#define SPRN_DVC1	0x13E	/* Data Value Compare Register 1 */
738c2ecf20Sopenharmony_ci#define SPRN_DVC2	0x13F	/* Data Value Compare Register 2 */
748c2ecf20Sopenharmony_ci#define SPRN_LPID	0x152	/* Logical Partition ID */
758c2ecf20Sopenharmony_ci#define SPRN_MAS8	0x155	/* MMU Assist Register 8 */
768c2ecf20Sopenharmony_ci#define SPRN_TLB0PS	0x158	/* TLB 0 Page Size Register */
778c2ecf20Sopenharmony_ci#define SPRN_TLB1PS	0x159	/* TLB 1 Page Size Register */
788c2ecf20Sopenharmony_ci#define SPRN_MAS5_MAS6	0x15c	/* MMU Assist Register 5 || 6 */
798c2ecf20Sopenharmony_ci#define SPRN_MAS8_MAS1	0x15d	/* MMU Assist Register 8 || 1 */
808c2ecf20Sopenharmony_ci#define SPRN_EPTCFG	0x15e	/* Embedded Page Table Config */
818c2ecf20Sopenharmony_ci#define SPRN_GSPRG0	0x170	/* Guest SPRG0 */
828c2ecf20Sopenharmony_ci#define SPRN_GSPRG1	0x171	/* Guest SPRG1 */
838c2ecf20Sopenharmony_ci#define SPRN_GSPRG2	0x172	/* Guest SPRG2 */
848c2ecf20Sopenharmony_ci#define SPRN_GSPRG3	0x173	/* Guest SPRG3 */
858c2ecf20Sopenharmony_ci#define SPRN_MAS7_MAS3	0x174	/* MMU Assist Register 7 || 3 */
868c2ecf20Sopenharmony_ci#define SPRN_MAS0_MAS1	0x175	/* MMU Assist Register 0 || 1 */
878c2ecf20Sopenharmony_ci#define SPRN_GSRR0	0x17A	/* Guest SRR0 */
888c2ecf20Sopenharmony_ci#define SPRN_GSRR1	0x17B	/* Guest SRR1 */
898c2ecf20Sopenharmony_ci#define SPRN_GEPR	0x17C	/* Guest EPR */
908c2ecf20Sopenharmony_ci#define SPRN_GDEAR	0x17D	/* Guest DEAR */
918c2ecf20Sopenharmony_ci#define SPRN_GPIR	0x17E	/* Guest PIR */
928c2ecf20Sopenharmony_ci#define SPRN_GESR	0x17F	/* Guest Exception Syndrome Register */
938c2ecf20Sopenharmony_ci#define SPRN_IVOR0	0x190	/* Interrupt Vector Offset Register 0 */
948c2ecf20Sopenharmony_ci#define SPRN_IVOR1	0x191	/* Interrupt Vector Offset Register 1 */
958c2ecf20Sopenharmony_ci#define SPRN_IVOR2	0x192	/* Interrupt Vector Offset Register 2 */
968c2ecf20Sopenharmony_ci#define SPRN_IVOR3	0x193	/* Interrupt Vector Offset Register 3 */
978c2ecf20Sopenharmony_ci#define SPRN_IVOR4	0x194	/* Interrupt Vector Offset Register 4 */
988c2ecf20Sopenharmony_ci#define SPRN_IVOR5	0x195	/* Interrupt Vector Offset Register 5 */
998c2ecf20Sopenharmony_ci#define SPRN_IVOR6	0x196	/* Interrupt Vector Offset Register 6 */
1008c2ecf20Sopenharmony_ci#define SPRN_IVOR7	0x197	/* Interrupt Vector Offset Register 7 */
1018c2ecf20Sopenharmony_ci#define SPRN_IVOR8	0x198	/* Interrupt Vector Offset Register 8 */
1028c2ecf20Sopenharmony_ci#define SPRN_IVOR9	0x199	/* Interrupt Vector Offset Register 9 */
1038c2ecf20Sopenharmony_ci#define SPRN_IVOR10	0x19A	/* Interrupt Vector Offset Register 10 */
1048c2ecf20Sopenharmony_ci#define SPRN_IVOR11	0x19B	/* Interrupt Vector Offset Register 11 */
1058c2ecf20Sopenharmony_ci#define SPRN_IVOR12	0x19C	/* Interrupt Vector Offset Register 12 */
1068c2ecf20Sopenharmony_ci#define SPRN_IVOR13	0x19D	/* Interrupt Vector Offset Register 13 */
1078c2ecf20Sopenharmony_ci#define SPRN_IVOR14	0x19E	/* Interrupt Vector Offset Register 14 */
1088c2ecf20Sopenharmony_ci#define SPRN_IVOR15	0x19F	/* Interrupt Vector Offset Register 15 */
1098c2ecf20Sopenharmony_ci#define SPRN_IVOR38	0x1B0	/* Interrupt Vector Offset Register 38 */
1108c2ecf20Sopenharmony_ci#define SPRN_IVOR39	0x1B1	/* Interrupt Vector Offset Register 39 */
1118c2ecf20Sopenharmony_ci#define SPRN_IVOR40	0x1B2	/* Interrupt Vector Offset Register 40 */
1128c2ecf20Sopenharmony_ci#define SPRN_IVOR41	0x1B3	/* Interrupt Vector Offset Register 41 */
1138c2ecf20Sopenharmony_ci#define SPRN_IVOR42	0x1B4	/* Interrupt Vector Offset Register 42 */
1148c2ecf20Sopenharmony_ci#define SPRN_GIVOR2	0x1B8	/* Guest IVOR2 */
1158c2ecf20Sopenharmony_ci#define SPRN_GIVOR3	0x1B9	/* Guest IVOR3 */
1168c2ecf20Sopenharmony_ci#define SPRN_GIVOR4	0x1BA	/* Guest IVOR4 */
1178c2ecf20Sopenharmony_ci#define SPRN_GIVOR8	0x1BB	/* Guest IVOR8 */
1188c2ecf20Sopenharmony_ci#define SPRN_GIVOR13	0x1BC	/* Guest IVOR13 */
1198c2ecf20Sopenharmony_ci#define SPRN_GIVOR14	0x1BD	/* Guest IVOR14 */
1208c2ecf20Sopenharmony_ci#define SPRN_GIVPR	0x1BF	/* Guest IVPR */
1218c2ecf20Sopenharmony_ci#define SPRN_SPEFSCR	0x200	/* SPE & Embedded FP Status & Control */
1228c2ecf20Sopenharmony_ci#define SPRN_BBEAR	0x201	/* Branch Buffer Entry Address Register */
1238c2ecf20Sopenharmony_ci#define SPRN_BBTAR	0x202	/* Branch Buffer Target Address Register */
1248c2ecf20Sopenharmony_ci#define SPRN_L1CFG0	0x203	/* L1 Cache Configure Register 0 */
1258c2ecf20Sopenharmony_ci#define SPRN_L1CFG1	0x204	/* L1 Cache Configure Register 1 */
1268c2ecf20Sopenharmony_ci#define SPRN_ATB	0x20E	/* Alternate Time Base */
1278c2ecf20Sopenharmony_ci#define SPRN_ATBL	0x20E	/* Alternate Time Base Lower */
1288c2ecf20Sopenharmony_ci#define SPRN_ATBU	0x20F	/* Alternate Time Base Upper */
1298c2ecf20Sopenharmony_ci#define SPRN_IVOR32	0x210	/* Interrupt Vector Offset Register 32 */
1308c2ecf20Sopenharmony_ci#define SPRN_IVOR33	0x211	/* Interrupt Vector Offset Register 33 */
1318c2ecf20Sopenharmony_ci#define SPRN_IVOR34	0x212	/* Interrupt Vector Offset Register 34 */
1328c2ecf20Sopenharmony_ci#define SPRN_IVOR35	0x213	/* Interrupt Vector Offset Register 35 */
1338c2ecf20Sopenharmony_ci#define SPRN_IVOR36	0x214	/* Interrupt Vector Offset Register 36 */
1348c2ecf20Sopenharmony_ci#define SPRN_IVOR37	0x215	/* Interrupt Vector Offset Register 37 */
1358c2ecf20Sopenharmony_ci#define SPRN_MCARU	0x239	/* Machine Check Address Register Upper */
1368c2ecf20Sopenharmony_ci#define SPRN_MCSRR0	0x23A	/* Machine Check Save and Restore Register 0 */
1378c2ecf20Sopenharmony_ci#define SPRN_MCSRR1	0x23B	/* Machine Check Save and Restore Register 1 */
1388c2ecf20Sopenharmony_ci#define SPRN_MCSR	0x23C	/* Machine Check Status Register */
1398c2ecf20Sopenharmony_ci#define SPRN_MCAR	0x23D	/* Machine Check Address Register */
1408c2ecf20Sopenharmony_ci#define SPRN_DSRR0	0x23E	/* Debug Save and Restore Register 0 */
1418c2ecf20Sopenharmony_ci#define SPRN_DSRR1	0x23F	/* Debug Save and Restore Register 1 */
1428c2ecf20Sopenharmony_ci#define SPRN_SPRG8	0x25C	/* Special Purpose Register General 8 */
1438c2ecf20Sopenharmony_ci#define SPRN_SPRG9	0x25D	/* Special Purpose Register General 9 */
1448c2ecf20Sopenharmony_ci#define SPRN_L1CSR2	0x25E	/* L1 Cache Control and Status Register 2 */
1458c2ecf20Sopenharmony_ci#define SPRN_MAS0	0x270	/* MMU Assist Register 0 */
1468c2ecf20Sopenharmony_ci#define SPRN_MAS1	0x271	/* MMU Assist Register 1 */
1478c2ecf20Sopenharmony_ci#define SPRN_MAS2	0x272	/* MMU Assist Register 2 */
1488c2ecf20Sopenharmony_ci#define SPRN_MAS3	0x273	/* MMU Assist Register 3 */
1498c2ecf20Sopenharmony_ci#define SPRN_MAS4	0x274	/* MMU Assist Register 4 */
1508c2ecf20Sopenharmony_ci#define SPRN_MAS5	0x153	/* MMU Assist Register 5 */
1518c2ecf20Sopenharmony_ci#define SPRN_MAS6	0x276	/* MMU Assist Register 6 */
1528c2ecf20Sopenharmony_ci#define SPRN_PID1	0x279	/* Process ID Register 1 */
1538c2ecf20Sopenharmony_ci#define SPRN_PID2	0x27A	/* Process ID Register 2 */
1548c2ecf20Sopenharmony_ci#define SPRN_TLB0CFG	0x2B0	/* TLB 0 Config Register */
1558c2ecf20Sopenharmony_ci#define SPRN_TLB1CFG	0x2B1	/* TLB 1 Config Register */
1568c2ecf20Sopenharmony_ci#define SPRN_TLB2CFG	0x2B2	/* TLB 2 Config Register */
1578c2ecf20Sopenharmony_ci#define SPRN_TLB3CFG	0x2B3	/* TLB 3 Config Register */
1588c2ecf20Sopenharmony_ci#define SPRN_EPR	0x2BE	/* External Proxy Register */
1598c2ecf20Sopenharmony_ci#define SPRN_CCR1	0x378	/* Core Configuration Register 1 */
1608c2ecf20Sopenharmony_ci#define SPRN_ZPR	0x3B0	/* Zone Protection Register (40x) */
1618c2ecf20Sopenharmony_ci#define SPRN_MAS7	0x3B0	/* MMU Assist Register 7 */
1628c2ecf20Sopenharmony_ci#define SPRN_MMUCR	0x3B2	/* MMU Control Register */
1638c2ecf20Sopenharmony_ci#define SPRN_CCR0	0x3B3	/* Core Configuration Register 0 */
1648c2ecf20Sopenharmony_ci#define SPRN_EPLC	0x3B3	/* External Process ID Load Context */
1658c2ecf20Sopenharmony_ci#define SPRN_EPSC	0x3B4	/* External Process ID Store Context */
1668c2ecf20Sopenharmony_ci#define SPRN_SGR	0x3B9	/* Storage Guarded Register */
1678c2ecf20Sopenharmony_ci#define SPRN_DCWR	0x3BA	/* Data Cache Write-thru Register */
1688c2ecf20Sopenharmony_ci#define SPRN_SLER	0x3BB	/* Little-endian real mode */
1698c2ecf20Sopenharmony_ci#define SPRN_SU0R	0x3BC	/* "User 0" real mode (40x) */
1708c2ecf20Sopenharmony_ci#define SPRN_DCMP	0x3D1	/* Data TLB Compare Register */
1718c2ecf20Sopenharmony_ci#define SPRN_ICDBDR	0x3D3	/* Instruction Cache Debug Data Register */
1728c2ecf20Sopenharmony_ci#define SPRN_EVPR	0x3D6	/* Exception Vector Prefix Register */
1738c2ecf20Sopenharmony_ci#define SPRN_L1CSR0	0x3F2	/* L1 Cache Control and Status Register 0 */
1748c2ecf20Sopenharmony_ci#define SPRN_L1CSR1	0x3F3	/* L1 Cache Control and Status Register 1 */
1758c2ecf20Sopenharmony_ci#define SPRN_MMUCSR0	0x3F4	/* MMU Control and Status Register 0 */
1768c2ecf20Sopenharmony_ci#define SPRN_MMUCFG	0x3F7	/* MMU Configuration Register */
1778c2ecf20Sopenharmony_ci#define SPRN_BUCSR	0x3F5	/* Branch Unit Control and Status */
1788c2ecf20Sopenharmony_ci#define SPRN_L2CSR0	0x3F9	/* L2 Data Cache Control and Status Register 0 */
1798c2ecf20Sopenharmony_ci#define SPRN_L2CSR1	0x3FA	/* L2 Data Cache Control and Status Register 1 */
1808c2ecf20Sopenharmony_ci#define SPRN_DCCR	0x3FA	/* Data Cache Cacheability Register */
1818c2ecf20Sopenharmony_ci#define SPRN_ICCR	0x3FB	/* Instruction Cache Cacheability Register */
1828c2ecf20Sopenharmony_ci#define SPRN_PWRMGTCR0	0x3FB	/* Power management control register 0 */
1838c2ecf20Sopenharmony_ci#define SPRN_SVR	0x3FF	/* System Version Register */
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci/*
1868c2ecf20Sopenharmony_ci * SPRs which have conflicting definitions on true Book E versus classic,
1878c2ecf20Sopenharmony_ci * or IBM 40x.
1888c2ecf20Sopenharmony_ci */
1898c2ecf20Sopenharmony_ci#ifdef CONFIG_BOOKE
1908c2ecf20Sopenharmony_ci#define SPRN_CSRR0	0x03A	/* Critical Save and Restore Register 0 */
1918c2ecf20Sopenharmony_ci#define SPRN_CSRR1	0x03B	/* Critical Save and Restore Register 1 */
1928c2ecf20Sopenharmony_ci#define SPRN_DEAR	0x03D	/* Data Error Address Register */
1938c2ecf20Sopenharmony_ci#define SPRN_ESR	0x03E	/* Exception Syndrome Register */
1948c2ecf20Sopenharmony_ci#define SPRN_PIR	0x11E	/* Processor Identification Register */
1958c2ecf20Sopenharmony_ci#define SPRN_DBSR	0x130	/* Debug Status Register */
1968c2ecf20Sopenharmony_ci#define SPRN_DBCR0	0x134	/* Debug Control Register 0 */
1978c2ecf20Sopenharmony_ci#define SPRN_DBCR1	0x135	/* Debug Control Register 1 */
1988c2ecf20Sopenharmony_ci#define SPRN_IAC1	0x138	/* Instruction Address Compare 1 */
1998c2ecf20Sopenharmony_ci#define SPRN_IAC2	0x139	/* Instruction Address Compare 2 */
2008c2ecf20Sopenharmony_ci#define SPRN_DAC1	0x13C	/* Data Address Compare 1 */
2018c2ecf20Sopenharmony_ci#define SPRN_DAC2	0x13D	/* Data Address Compare 2 */
2028c2ecf20Sopenharmony_ci#define SPRN_TSR	0x150	/* Timer Status Register */
2038c2ecf20Sopenharmony_ci#define SPRN_TCR	0x154	/* Timer Control Register */
2048c2ecf20Sopenharmony_ci#endif /* Book E */
2058c2ecf20Sopenharmony_ci#ifdef CONFIG_40x
2068c2ecf20Sopenharmony_ci#define SPRN_DBCR1	0x3BD	/* Debug Control Register 1 */
2078c2ecf20Sopenharmony_ci#define SPRN_ESR	0x3D4	/* Exception Syndrome Register */
2088c2ecf20Sopenharmony_ci#define SPRN_DEAR	0x3D5	/* Data Error Address Register */
2098c2ecf20Sopenharmony_ci#define SPRN_TSR	0x3D8	/* Timer Status Register */
2108c2ecf20Sopenharmony_ci#define SPRN_TCR	0x3DA	/* Timer Control Register */
2118c2ecf20Sopenharmony_ci#define SPRN_SRR2	0x3DE	/* Save/Restore Register 2 */
2128c2ecf20Sopenharmony_ci#define SPRN_SRR3	0x3DF	/* Save/Restore Register 3 */
2138c2ecf20Sopenharmony_ci#define SPRN_DBSR	0x3F0	/* Debug Status Register */
2148c2ecf20Sopenharmony_ci#define SPRN_DBCR0	0x3F2	/* Debug Control Register 0 */
2158c2ecf20Sopenharmony_ci#define SPRN_DAC1	0x3F6	/* Data Address Compare 1 */
2168c2ecf20Sopenharmony_ci#define SPRN_DAC2	0x3F7	/* Data Address Compare 2 */
2178c2ecf20Sopenharmony_ci#define SPRN_CSRR0	SPRN_SRR2 /* Critical Save and Restore Register 0 */
2188c2ecf20Sopenharmony_ci#define SPRN_CSRR1	SPRN_SRR3 /* Critical Save and Restore Register 1 */
2198c2ecf20Sopenharmony_ci#endif
2208c2ecf20Sopenharmony_ci#define SPRN_HACOP	0x15F	/* Hypervisor Available Coprocessor Register */
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci/* Bit definitions for CCR1. */
2238c2ecf20Sopenharmony_ci#define	CCR1_DPC	0x00000100 /* Disable L1 I-Cache/D-Cache parity checking */
2248c2ecf20Sopenharmony_ci#define	CCR1_TCS	0x00000080 /* Timer Clock Select */
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci/* Bit definitions for PWRMGTCR0. */
2278c2ecf20Sopenharmony_ci#define PWRMGTCR0_PW20_WAIT		(1 << 14) /* PW20 state enable bit */
2288c2ecf20Sopenharmony_ci#define PWRMGTCR0_PW20_ENT_SHIFT	8
2298c2ecf20Sopenharmony_ci#define PWRMGTCR0_PW20_ENT		0x3F00
2308c2ecf20Sopenharmony_ci#define PWRMGTCR0_AV_IDLE_PD_EN		(1 << 22) /* Altivec idle enable */
2318c2ecf20Sopenharmony_ci#define PWRMGTCR0_AV_IDLE_CNT_SHIFT	16
2328c2ecf20Sopenharmony_ci#define PWRMGTCR0_AV_IDLE_CNT		0x3F0000
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci/* Bit definitions for the MCSR. */
2358c2ecf20Sopenharmony_ci#define MCSR_MCS	0x80000000 /* Machine Check Summary */
2368c2ecf20Sopenharmony_ci#define MCSR_IB		0x40000000 /* Instruction PLB Error */
2378c2ecf20Sopenharmony_ci#define MCSR_DRB	0x20000000 /* Data Read PLB Error */
2388c2ecf20Sopenharmony_ci#define MCSR_DWB	0x10000000 /* Data Write PLB Error */
2398c2ecf20Sopenharmony_ci#define MCSR_TLBP	0x08000000 /* TLB Parity Error */
2408c2ecf20Sopenharmony_ci#define MCSR_ICP	0x04000000 /* I-Cache Parity Error */
2418c2ecf20Sopenharmony_ci#define MCSR_DCSP	0x02000000 /* D-Cache Search Parity Error */
2428c2ecf20Sopenharmony_ci#define MCSR_DCFP	0x01000000 /* D-Cache Flush Parity Error */
2438c2ecf20Sopenharmony_ci#define MCSR_IMPE	0x00800000 /* Imprecise Machine Check Exception */
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci#define PPC47x_MCSR_GPR	0x01000000 /* GPR parity error */
2468c2ecf20Sopenharmony_ci#define PPC47x_MCSR_FPR	0x00800000 /* FPR parity error */
2478c2ecf20Sopenharmony_ci#define PPC47x_MCSR_IPR	0x00400000 /* Imprecise Machine Check Exception */
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci#ifdef CONFIG_E500
2508c2ecf20Sopenharmony_ci/* All e500 */
2518c2ecf20Sopenharmony_ci#define MCSR_MCP 	0x80000000UL /* Machine Check Input Pin */
2528c2ecf20Sopenharmony_ci#define MCSR_ICPERR 	0x40000000UL /* I-Cache Parity Error */
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci/* e500v1/v2 */
2558c2ecf20Sopenharmony_ci#define MCSR_DCP_PERR 	0x20000000UL /* D-Cache Push Parity Error */
2568c2ecf20Sopenharmony_ci#define MCSR_DCPERR 	0x10000000UL /* D-Cache Parity Error */
2578c2ecf20Sopenharmony_ci#define MCSR_BUS_IAERR 	0x00000080UL /* Instruction Address Error */
2588c2ecf20Sopenharmony_ci#define MCSR_BUS_RAERR 	0x00000040UL /* Read Address Error */
2598c2ecf20Sopenharmony_ci#define MCSR_BUS_WAERR 	0x00000020UL /* Write Address Error */
2608c2ecf20Sopenharmony_ci#define MCSR_BUS_IBERR 	0x00000010UL /* Instruction Data Error */
2618c2ecf20Sopenharmony_ci#define MCSR_BUS_RBERR 	0x00000008UL /* Read Data Bus Error */
2628c2ecf20Sopenharmony_ci#define MCSR_BUS_WBERR 	0x00000004UL /* Write Data Bus Error */
2638c2ecf20Sopenharmony_ci#define MCSR_BUS_IPERR 	0x00000002UL /* Instruction parity Error */
2648c2ecf20Sopenharmony_ci#define MCSR_BUS_RPERR 	0x00000001UL /* Read parity Error */
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci/* e500mc */
2678c2ecf20Sopenharmony_ci#define MCSR_DCPERR_MC	0x20000000UL /* D-Cache Parity Error */
2688c2ecf20Sopenharmony_ci#define MCSR_L2MMU_MHIT	0x08000000UL /* Hit on multiple TLB entries */
2698c2ecf20Sopenharmony_ci#define MCSR_NMI	0x00100000UL /* Non-Maskable Interrupt */
2708c2ecf20Sopenharmony_ci#define MCSR_MAV	0x00080000UL /* MCAR address valid */
2718c2ecf20Sopenharmony_ci#define MCSR_MEA	0x00040000UL /* MCAR is effective address */
2728c2ecf20Sopenharmony_ci#define MCSR_IF		0x00010000UL /* Instruction Fetch */
2738c2ecf20Sopenharmony_ci#define MCSR_LD		0x00008000UL /* Load */
2748c2ecf20Sopenharmony_ci#define MCSR_ST		0x00004000UL /* Store */
2758c2ecf20Sopenharmony_ci#define MCSR_LDG	0x00002000UL /* Guarded Load */
2768c2ecf20Sopenharmony_ci#define MCSR_TLBSYNC	0x00000002UL /* Multiple tlbsyncs detected */
2778c2ecf20Sopenharmony_ci#define MCSR_BSL2_ERR	0x00000001UL /* Backside L2 cache error */
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci#define MSRP_UCLEP	0x04000000 /* Protect MSR[UCLE] */
2808c2ecf20Sopenharmony_ci#define MSRP_DEP	0x00000200 /* Protect MSR[DE] */
2818c2ecf20Sopenharmony_ci#define MSRP_PMMP	0x00000004 /* Protect MSR[PMM] */
2828c2ecf20Sopenharmony_ci#endif
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci#ifdef CONFIG_E200
2858c2ecf20Sopenharmony_ci#define MCSR_MCP 	0x80000000UL /* Machine Check Input Pin */
2868c2ecf20Sopenharmony_ci#define MCSR_CP_PERR 	0x20000000UL /* Cache Push Parity Error */
2878c2ecf20Sopenharmony_ci#define MCSR_CPERR 	0x10000000UL /* Cache Parity Error */
2888c2ecf20Sopenharmony_ci#define MCSR_EXCP_ERR 	0x08000000UL /* ISI, ITLB, or Bus Error on 1st insn
2898c2ecf20Sopenharmony_ci					fetch for an exception handler */
2908c2ecf20Sopenharmony_ci#define MCSR_BUS_IRERR 	0x00000010UL /* Read Bus Error on instruction fetch*/
2918c2ecf20Sopenharmony_ci#define MCSR_BUS_DRERR 	0x00000008UL /* Read Bus Error on data load */
2928c2ecf20Sopenharmony_ci#define MCSR_BUS_WRERR 	0x00000004UL /* Write Bus Error on buffered
2938c2ecf20Sopenharmony_ci					store or cache line push */
2948c2ecf20Sopenharmony_ci#endif
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_ci/* Bit definitions for the HID1 */
2978c2ecf20Sopenharmony_ci#ifdef CONFIG_E500
2988c2ecf20Sopenharmony_ci/* e500v1/v2 */
2998c2ecf20Sopenharmony_ci#define HID1_PLL_CFG_MASK 0xfc000000	/* PLL_CFG input pins */
3008c2ecf20Sopenharmony_ci#define HID1_RFXE	0x00020000	/* Read fault exception enable */
3018c2ecf20Sopenharmony_ci#define HID1_R1DPE	0x00008000	/* R1 data bus parity enable */
3028c2ecf20Sopenharmony_ci#define HID1_R2DPE	0x00004000	/* R2 data bus parity enable */
3038c2ecf20Sopenharmony_ci#define HID1_ASTME	0x00002000	/* Address bus streaming mode enable */
3048c2ecf20Sopenharmony_ci#define HID1_ABE	0x00001000	/* Address broadcast enable */
3058c2ecf20Sopenharmony_ci#define HID1_MPXTT	0x00000400	/* MPX re-map transfer type */
3068c2ecf20Sopenharmony_ci#define HID1_ATS	0x00000080	/* Atomic status */
3078c2ecf20Sopenharmony_ci#define HID1_MID_MASK	0x0000000f	/* MID input pins */
3088c2ecf20Sopenharmony_ci#endif
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_ci/* Bit definitions for the DBSR. */
3118c2ecf20Sopenharmony_ci/*
3128c2ecf20Sopenharmony_ci * DBSR bits which have conflicting definitions on true Book E versus IBM 40x.
3138c2ecf20Sopenharmony_ci */
3148c2ecf20Sopenharmony_ci#ifdef CONFIG_BOOKE
3158c2ecf20Sopenharmony_ci#define DBSR_IDE	0x80000000	/* Imprecise Debug Event */
3168c2ecf20Sopenharmony_ci#define DBSR_MRR	0x30000000	/* Most Recent Reset */
3178c2ecf20Sopenharmony_ci#define DBSR_IC		0x08000000	/* Instruction Completion */
3188c2ecf20Sopenharmony_ci#define DBSR_BT		0x04000000	/* Branch Taken */
3198c2ecf20Sopenharmony_ci#define DBSR_IRPT	0x02000000	/* Exception Debug Event */
3208c2ecf20Sopenharmony_ci#define DBSR_TIE	0x01000000	/* Trap Instruction Event */
3218c2ecf20Sopenharmony_ci#define DBSR_IAC1	0x00800000	/* Instr Address Compare 1 Event */
3228c2ecf20Sopenharmony_ci#define DBSR_IAC2	0x00400000	/* Instr Address Compare 2 Event */
3238c2ecf20Sopenharmony_ci#define DBSR_IAC3	0x00200000	/* Instr Address Compare 3 Event */
3248c2ecf20Sopenharmony_ci#define DBSR_IAC4	0x00100000	/* Instr Address Compare 4 Event */
3258c2ecf20Sopenharmony_ci#define DBSR_DAC1R	0x00080000	/* Data Addr Compare 1 Read Event */
3268c2ecf20Sopenharmony_ci#define DBSR_DAC1W	0x00040000	/* Data Addr Compare 1 Write Event */
3278c2ecf20Sopenharmony_ci#define DBSR_DAC2R	0x00020000	/* Data Addr Compare 2 Read Event */
3288c2ecf20Sopenharmony_ci#define DBSR_DAC2W	0x00010000	/* Data Addr Compare 2 Write Event */
3298c2ecf20Sopenharmony_ci#define DBSR_RET	0x00008000	/* Return Debug Event */
3308c2ecf20Sopenharmony_ci#define DBSR_CIRPT	0x00000040	/* Critical Interrupt Taken Event */
3318c2ecf20Sopenharmony_ci#define DBSR_CRET	0x00000020	/* Critical Return Debug Event */
3328c2ecf20Sopenharmony_ci#define DBSR_IAC12ATS	0x00000002	/* Instr Address Compare 1/2 Toggle */
3338c2ecf20Sopenharmony_ci#define DBSR_IAC34ATS	0x00000001	/* Instr Address Compare 3/4 Toggle */
3348c2ecf20Sopenharmony_ci#endif
3358c2ecf20Sopenharmony_ci#ifdef CONFIG_40x
3368c2ecf20Sopenharmony_ci#define DBSR_IC		0x80000000	/* Instruction Completion */
3378c2ecf20Sopenharmony_ci#define DBSR_BT		0x40000000	/* Branch taken */
3388c2ecf20Sopenharmony_ci#define DBSR_IRPT	0x20000000	/* Exception Debug Event */
3398c2ecf20Sopenharmony_ci#define DBSR_TIE	0x10000000	/* Trap Instruction debug Event */
3408c2ecf20Sopenharmony_ci#define DBSR_IAC1	0x04000000	/* Instruction Address Compare 1 Event */
3418c2ecf20Sopenharmony_ci#define DBSR_IAC2	0x02000000	/* Instruction Address Compare 2 Event */
3428c2ecf20Sopenharmony_ci#define DBSR_IAC3	0x00080000	/* Instruction Address Compare 3 Event */
3438c2ecf20Sopenharmony_ci#define DBSR_IAC4	0x00040000	/* Instruction Address Compare 4 Event */
3448c2ecf20Sopenharmony_ci#define DBSR_DAC1R	0x01000000	/* Data Address Compare 1 Read Event */
3458c2ecf20Sopenharmony_ci#define DBSR_DAC1W	0x00800000	/* Data Address Compare 1 Write Event */
3468c2ecf20Sopenharmony_ci#define DBSR_DAC2R	0x00400000	/* Data Address Compare 2 Read Event */
3478c2ecf20Sopenharmony_ci#define DBSR_DAC2W	0x00200000	/* Data Address Compare 2 Write Event */
3488c2ecf20Sopenharmony_ci#endif
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci/* Bit definitions related to the ESR. */
3518c2ecf20Sopenharmony_ci#define ESR_MCI		0x80000000	/* Machine Check - Instruction */
3528c2ecf20Sopenharmony_ci#define ESR_IMCP	0x80000000	/* Instr. Machine Check - Protection */
3538c2ecf20Sopenharmony_ci#define ESR_IMCN	0x40000000	/* Instr. Machine Check - Non-config */
3548c2ecf20Sopenharmony_ci#define ESR_IMCB	0x20000000	/* Instr. Machine Check - Bus error */
3558c2ecf20Sopenharmony_ci#define ESR_IMCT	0x10000000	/* Instr. Machine Check - Timeout */
3568c2ecf20Sopenharmony_ci#define ESR_PIL		0x08000000	/* Program Exception - Illegal */
3578c2ecf20Sopenharmony_ci#define ESR_PPR		0x04000000	/* Program Exception - Privileged */
3588c2ecf20Sopenharmony_ci#define ESR_PTR		0x02000000	/* Program Exception - Trap */
3598c2ecf20Sopenharmony_ci#define ESR_FP		0x01000000	/* Floating Point Operation */
3608c2ecf20Sopenharmony_ci#define ESR_DST		0x00800000	/* Storage Exception - Data miss */
3618c2ecf20Sopenharmony_ci#define ESR_DIZ		0x00400000	/* Storage Exception - Zone fault */
3628c2ecf20Sopenharmony_ci#define ESR_ST		0x00800000	/* Store Operation */
3638c2ecf20Sopenharmony_ci#define ESR_DLK		0x00200000	/* Data Cache Locking */
3648c2ecf20Sopenharmony_ci#define ESR_ILK		0x00100000	/* Instr. Cache Locking */
3658c2ecf20Sopenharmony_ci#define ESR_PUO		0x00040000	/* Unimplemented Operation exception */
3668c2ecf20Sopenharmony_ci#define ESR_BO		0x00020000	/* Byte Ordering */
3678c2ecf20Sopenharmony_ci#define ESR_SPV		0x00000080	/* Signal Processing operation */
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ci/* Bit definitions related to the DBCR0. */
3708c2ecf20Sopenharmony_ci#if defined(CONFIG_40x)
3718c2ecf20Sopenharmony_ci#define DBCR0_EDM	0x80000000	/* External Debug Mode */
3728c2ecf20Sopenharmony_ci#define DBCR0_IDM	0x40000000	/* Internal Debug Mode */
3738c2ecf20Sopenharmony_ci#define DBCR0_RST	0x30000000	/* all the bits in the RST field */
3748c2ecf20Sopenharmony_ci#define DBCR0_RST_SYSTEM 0x30000000	/* System Reset */
3758c2ecf20Sopenharmony_ci#define DBCR0_RST_CHIP	0x20000000	/* Chip Reset */
3768c2ecf20Sopenharmony_ci#define DBCR0_RST_CORE	0x10000000	/* Core Reset */
3778c2ecf20Sopenharmony_ci#define DBCR0_RST_NONE	0x00000000	/* No Reset */
3788c2ecf20Sopenharmony_ci#define DBCR0_IC	0x08000000	/* Instruction Completion */
3798c2ecf20Sopenharmony_ci#define DBCR0_ICMP	DBCR0_IC
3808c2ecf20Sopenharmony_ci#define DBCR0_BT	0x04000000	/* Branch Taken */
3818c2ecf20Sopenharmony_ci#define DBCR0_BRT	DBCR0_BT
3828c2ecf20Sopenharmony_ci#define DBCR0_EDE	0x02000000	/* Exception Debug Event */
3838c2ecf20Sopenharmony_ci#define DBCR0_IRPT	DBCR0_EDE
3848c2ecf20Sopenharmony_ci#define DBCR0_TDE	0x01000000	/* TRAP Debug Event */
3858c2ecf20Sopenharmony_ci#define DBCR0_IA1	0x00800000	/* Instr Addr compare 1 enable */
3868c2ecf20Sopenharmony_ci#define DBCR0_IAC1	DBCR0_IA1
3878c2ecf20Sopenharmony_ci#define DBCR0_IA2	0x00400000	/* Instr Addr compare 2 enable */
3888c2ecf20Sopenharmony_ci#define DBCR0_IAC2	DBCR0_IA2
3898c2ecf20Sopenharmony_ci#define DBCR0_IA12	0x00200000	/* Instr Addr 1-2 range enable */
3908c2ecf20Sopenharmony_ci#define DBCR0_IA12X	0x00100000	/* Instr Addr 1-2 range eXclusive */
3918c2ecf20Sopenharmony_ci#define DBCR0_IA3	0x00080000	/* Instr Addr compare 3 enable */
3928c2ecf20Sopenharmony_ci#define DBCR0_IAC3	DBCR0_IA3
3938c2ecf20Sopenharmony_ci#define DBCR0_IA4	0x00040000	/* Instr Addr compare 4 enable */
3948c2ecf20Sopenharmony_ci#define DBCR0_IAC4	DBCR0_IA4
3958c2ecf20Sopenharmony_ci#define DBCR0_IA34	0x00020000	/* Instr Addr 3-4 range Enable */
3968c2ecf20Sopenharmony_ci#define DBCR0_IA34X	0x00010000	/* Instr Addr 3-4 range eXclusive */
3978c2ecf20Sopenharmony_ci#define DBCR0_IA12T	0x00008000	/* Instr Addr 1-2 range Toggle */
3988c2ecf20Sopenharmony_ci#define DBCR0_IA34T	0x00004000	/* Instr Addr 3-4 range Toggle */
3998c2ecf20Sopenharmony_ci#define DBCR0_FT	0x00000001	/* Freeze Timers on debug event */
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci#define dbcr_iac_range(task)	((task)->thread.debug.dbcr0)
4028c2ecf20Sopenharmony_ci#define DBCR_IAC12I	DBCR0_IA12			/* Range Inclusive */
4038c2ecf20Sopenharmony_ci#define DBCR_IAC12X	(DBCR0_IA12 | DBCR0_IA12X)	/* Range Exclusive */
4048c2ecf20Sopenharmony_ci#define DBCR_IAC12MODE	(DBCR0_IA12 | DBCR0_IA12X)	/* IAC 1-2 Mode Bits */
4058c2ecf20Sopenharmony_ci#define DBCR_IAC34I	DBCR0_IA34			/* Range Inclusive */
4068c2ecf20Sopenharmony_ci#define DBCR_IAC34X	(DBCR0_IA34 | DBCR0_IA34X)	/* Range Exclusive */
4078c2ecf20Sopenharmony_ci#define DBCR_IAC34MODE	(DBCR0_IA34 | DBCR0_IA34X)	/* IAC 3-4 Mode Bits */
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_ci/* Bit definitions related to the DBCR1. */
4108c2ecf20Sopenharmony_ci#define DBCR1_DAC1R	0x80000000	/* DAC1 Read Debug Event */
4118c2ecf20Sopenharmony_ci#define DBCR1_DAC2R	0x40000000	/* DAC2 Read Debug Event */
4128c2ecf20Sopenharmony_ci#define DBCR1_DAC1W	0x20000000	/* DAC1 Write Debug Event */
4138c2ecf20Sopenharmony_ci#define DBCR1_DAC2W	0x10000000	/* DAC2 Write Debug Event */
4148c2ecf20Sopenharmony_ci
4158c2ecf20Sopenharmony_ci#define dbcr_dac(task)	((task)->thread.debug.dbcr1)
4168c2ecf20Sopenharmony_ci#define DBCR_DAC1R	DBCR1_DAC1R
4178c2ecf20Sopenharmony_ci#define DBCR_DAC1W	DBCR1_DAC1W
4188c2ecf20Sopenharmony_ci#define DBCR_DAC2R	DBCR1_DAC2R
4198c2ecf20Sopenharmony_ci#define DBCR_DAC2W	DBCR1_DAC2W
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_ci/*
4228c2ecf20Sopenharmony_ci * Are there any active Debug Events represented in the
4238c2ecf20Sopenharmony_ci * Debug Control Registers?
4248c2ecf20Sopenharmony_ci */
4258c2ecf20Sopenharmony_ci#define DBCR0_ACTIVE_EVENTS	(DBCR0_ICMP | DBCR0_IAC1 | DBCR0_IAC2 | \
4268c2ecf20Sopenharmony_ci				 DBCR0_IAC3 | DBCR0_IAC4)
4278c2ecf20Sopenharmony_ci#define DBCR1_ACTIVE_EVENTS	(DBCR1_DAC1R | DBCR1_DAC2R | \
4288c2ecf20Sopenharmony_ci				 DBCR1_DAC1W | DBCR1_DAC2W)
4298c2ecf20Sopenharmony_ci#define DBCR_ACTIVE_EVENTS(dbcr0, dbcr1)  (((dbcr0) & DBCR0_ACTIVE_EVENTS) || \
4308c2ecf20Sopenharmony_ci					   ((dbcr1) & DBCR1_ACTIVE_EVENTS))
4318c2ecf20Sopenharmony_ci
4328c2ecf20Sopenharmony_ci#elif defined(CONFIG_BOOKE)
4338c2ecf20Sopenharmony_ci#define DBCR0_EDM	0x80000000	/* External Debug Mode */
4348c2ecf20Sopenharmony_ci#define DBCR0_IDM	0x40000000	/* Internal Debug Mode */
4358c2ecf20Sopenharmony_ci#define DBCR0_RST	0x30000000	/* all the bits in the RST field */
4368c2ecf20Sopenharmony_ci/* DBCR0_RST_* is 44x specific and not followed in fsl booke */
4378c2ecf20Sopenharmony_ci#define DBCR0_RST_SYSTEM 0x30000000	/* System Reset */
4388c2ecf20Sopenharmony_ci#define DBCR0_RST_CHIP	0x20000000	/* Chip Reset */
4398c2ecf20Sopenharmony_ci#define DBCR0_RST_CORE	0x10000000	/* Core Reset */
4408c2ecf20Sopenharmony_ci#define DBCR0_RST_NONE	0x00000000	/* No Reset */
4418c2ecf20Sopenharmony_ci#define DBCR0_ICMP	0x08000000	/* Instruction Completion */
4428c2ecf20Sopenharmony_ci#define DBCR0_IC	DBCR0_ICMP
4438c2ecf20Sopenharmony_ci#define DBCR0_BRT	0x04000000	/* Branch Taken */
4448c2ecf20Sopenharmony_ci#define DBCR0_BT	DBCR0_BRT
4458c2ecf20Sopenharmony_ci#define DBCR0_IRPT	0x02000000	/* Exception Debug Event */
4468c2ecf20Sopenharmony_ci#define DBCR0_TDE	0x01000000	/* TRAP Debug Event */
4478c2ecf20Sopenharmony_ci#define DBCR0_TIE	DBCR0_TDE
4488c2ecf20Sopenharmony_ci#define DBCR0_IAC1	0x00800000	/* Instr Addr compare 1 enable */
4498c2ecf20Sopenharmony_ci#define DBCR0_IAC2	0x00400000	/* Instr Addr compare 2 enable */
4508c2ecf20Sopenharmony_ci#define DBCR0_IAC3	0x00200000	/* Instr Addr compare 3 enable */
4518c2ecf20Sopenharmony_ci#define DBCR0_IAC4	0x00100000	/* Instr Addr compare 4 enable */
4528c2ecf20Sopenharmony_ci#define DBCR0_DAC1R	0x00080000	/* DAC 1 Read enable */
4538c2ecf20Sopenharmony_ci#define DBCR0_DAC1W	0x00040000	/* DAC 1 Write enable */
4548c2ecf20Sopenharmony_ci#define DBCR0_DAC2R	0x00020000	/* DAC 2 Read enable */
4558c2ecf20Sopenharmony_ci#define DBCR0_DAC2W	0x00010000	/* DAC 2 Write enable */
4568c2ecf20Sopenharmony_ci#define DBCR0_RET	0x00008000	/* Return Debug Event */
4578c2ecf20Sopenharmony_ci#define DBCR0_CIRPT	0x00000040	/* Critical Interrupt Taken Event */
4588c2ecf20Sopenharmony_ci#define DBCR0_CRET	0x00000020	/* Critical Return Debug Event */
4598c2ecf20Sopenharmony_ci#define DBCR0_FT	0x00000001	/* Freeze Timers on debug event */
4608c2ecf20Sopenharmony_ci
4618c2ecf20Sopenharmony_ci#define dbcr_dac(task)	((task)->thread.debug.dbcr0)
4628c2ecf20Sopenharmony_ci#define DBCR_DAC1R	DBCR0_DAC1R
4638c2ecf20Sopenharmony_ci#define DBCR_DAC1W	DBCR0_DAC1W
4648c2ecf20Sopenharmony_ci#define DBCR_DAC2R	DBCR0_DAC2R
4658c2ecf20Sopenharmony_ci#define DBCR_DAC2W	DBCR0_DAC2W
4668c2ecf20Sopenharmony_ci
4678c2ecf20Sopenharmony_ci/* Bit definitions related to the DBCR1. */
4688c2ecf20Sopenharmony_ci#define DBCR1_IAC1US	0xC0000000	/* Instr Addr Cmp 1 Sup/User   */
4698c2ecf20Sopenharmony_ci#define DBCR1_IAC1ER	0x30000000	/* Instr Addr Cmp 1 Eff/Real */
4708c2ecf20Sopenharmony_ci#define DBCR1_IAC1ER_01	0x10000000	/* reserved */
4718c2ecf20Sopenharmony_ci#define DBCR1_IAC1ER_10	0x20000000	/* Instr Addr Cmp 1 Eff/Real MSR[IS]=0 */
4728c2ecf20Sopenharmony_ci#define DBCR1_IAC1ER_11	0x30000000	/* Instr Addr Cmp 1 Eff/Real MSR[IS]=1 */
4738c2ecf20Sopenharmony_ci#define DBCR1_IAC2US	0x0C000000	/* Instr Addr Cmp 2 Sup/User   */
4748c2ecf20Sopenharmony_ci#define DBCR1_IAC2ER	0x03000000	/* Instr Addr Cmp 2 Eff/Real */
4758c2ecf20Sopenharmony_ci#define DBCR1_IAC2ER_01	0x01000000	/* reserved */
4768c2ecf20Sopenharmony_ci#define DBCR1_IAC2ER_10	0x02000000	/* Instr Addr Cmp 2 Eff/Real MSR[IS]=0 */
4778c2ecf20Sopenharmony_ci#define DBCR1_IAC2ER_11	0x03000000	/* Instr Addr Cmp 2 Eff/Real MSR[IS]=1 */
4788c2ecf20Sopenharmony_ci#define DBCR1_IAC12M	0x00800000	/* Instr Addr 1-2 range enable */
4798c2ecf20Sopenharmony_ci#define DBCR1_IAC12MX	0x00C00000	/* Instr Addr 1-2 range eXclusive */
4808c2ecf20Sopenharmony_ci#define DBCR1_IAC12AT	0x00010000	/* Instr Addr 1-2 range Toggle */
4818c2ecf20Sopenharmony_ci#define DBCR1_IAC3US	0x0000C000	/* Instr Addr Cmp 3 Sup/User   */
4828c2ecf20Sopenharmony_ci#define DBCR1_IAC3ER	0x00003000	/* Instr Addr Cmp 3 Eff/Real */
4838c2ecf20Sopenharmony_ci#define DBCR1_IAC3ER_01	0x00001000	/* reserved */
4848c2ecf20Sopenharmony_ci#define DBCR1_IAC3ER_10	0x00002000	/* Instr Addr Cmp 3 Eff/Real MSR[IS]=0 */
4858c2ecf20Sopenharmony_ci#define DBCR1_IAC3ER_11	0x00003000	/* Instr Addr Cmp 3 Eff/Real MSR[IS]=1 */
4868c2ecf20Sopenharmony_ci#define DBCR1_IAC4US	0x00000C00	/* Instr Addr Cmp 4 Sup/User   */
4878c2ecf20Sopenharmony_ci#define DBCR1_IAC4ER	0x00000300	/* Instr Addr Cmp 4 Eff/Real */
4888c2ecf20Sopenharmony_ci#define DBCR1_IAC4ER_01	0x00000100	/* Instr Addr Cmp 4 Eff/Real MSR[IS]=0 */
4898c2ecf20Sopenharmony_ci#define DBCR1_IAC4ER_10	0x00000200	/* Instr Addr Cmp 4 Eff/Real MSR[IS]=0 */
4908c2ecf20Sopenharmony_ci#define DBCR1_IAC4ER_11	0x00000300	/* Instr Addr Cmp 4 Eff/Real MSR[IS]=1 */
4918c2ecf20Sopenharmony_ci#define DBCR1_IAC34M	0x00000080	/* Instr Addr 3-4 range enable */
4928c2ecf20Sopenharmony_ci#define DBCR1_IAC34MX	0x000000C0	/* Instr Addr 3-4 range eXclusive */
4938c2ecf20Sopenharmony_ci#define DBCR1_IAC34AT	0x00000001	/* Instr Addr 3-4 range Toggle */
4948c2ecf20Sopenharmony_ci
4958c2ecf20Sopenharmony_ci#define dbcr_iac_range(task)	((task)->thread.debug.dbcr1)
4968c2ecf20Sopenharmony_ci#define DBCR_IAC12I	DBCR1_IAC12M	/* Range Inclusive */
4978c2ecf20Sopenharmony_ci#define DBCR_IAC12X	DBCR1_IAC12MX	/* Range Exclusive */
4988c2ecf20Sopenharmony_ci#define DBCR_IAC12MODE	DBCR1_IAC12MX	/* IAC 1-2 Mode Bits */
4998c2ecf20Sopenharmony_ci#define DBCR_IAC34I	DBCR1_IAC34M	/* Range Inclusive */
5008c2ecf20Sopenharmony_ci#define DBCR_IAC34X	DBCR1_IAC34MX	/* Range Exclusive */
5018c2ecf20Sopenharmony_ci#define DBCR_IAC34MODE	DBCR1_IAC34MX	/* IAC 3-4 Mode Bits */
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci/* Bit definitions related to the DBCR2. */
5048c2ecf20Sopenharmony_ci#define DBCR2_DAC1US	0xC0000000	/* Data Addr Cmp 1 Sup/User   */
5058c2ecf20Sopenharmony_ci#define DBCR2_DAC1ER	0x30000000	/* Data Addr Cmp 1 Eff/Real */
5068c2ecf20Sopenharmony_ci#define DBCR2_DAC2US	0x0C000000	/* Data Addr Cmp 2 Sup/User   */
5078c2ecf20Sopenharmony_ci#define DBCR2_DAC2ER	0x03000000	/* Data Addr Cmp 2 Eff/Real */
5088c2ecf20Sopenharmony_ci#define DBCR2_DAC12M	0x00800000	/* DAC 1-2 range enable */
5098c2ecf20Sopenharmony_ci#define DBCR2_DAC12MM	0x00400000	/* DAC 1-2 Mask mode*/
5108c2ecf20Sopenharmony_ci#define DBCR2_DAC12MX	0x00C00000	/* DAC 1-2 range eXclusive */
5118c2ecf20Sopenharmony_ci#define DBCR2_DAC12MODE	0x00C00000	/* DAC 1-2 Mode Bits */
5128c2ecf20Sopenharmony_ci#define DBCR2_DAC12A	0x00200000	/* DAC 1-2 Asynchronous */
5138c2ecf20Sopenharmony_ci#define DBCR2_DVC1M	0x000C0000	/* Data Value Comp 1 Mode */
5148c2ecf20Sopenharmony_ci#define DBCR2_DVC1M_SHIFT	18	/* # of bits to shift DBCR2_DVC1M */
5158c2ecf20Sopenharmony_ci#define DBCR2_DVC2M	0x00030000	/* Data Value Comp 2 Mode */
5168c2ecf20Sopenharmony_ci#define DBCR2_DVC2M_SHIFT	16	/* # of bits to shift DBCR2_DVC2M */
5178c2ecf20Sopenharmony_ci#define DBCR2_DVC1BE	0x00000F00	/* Data Value Comp 1 Byte */
5188c2ecf20Sopenharmony_ci#define DBCR2_DVC1BE_SHIFT	8	/* # of bits to shift DBCR2_DVC1BE */
5198c2ecf20Sopenharmony_ci#define DBCR2_DVC2BE	0x0000000F	/* Data Value Comp 2 Byte */
5208c2ecf20Sopenharmony_ci#define DBCR2_DVC2BE_SHIFT	0	/* # of bits to shift DBCR2_DVC2BE */
5218c2ecf20Sopenharmony_ci
5228c2ecf20Sopenharmony_ci/*
5238c2ecf20Sopenharmony_ci * Are there any active Debug Events represented in the
5248c2ecf20Sopenharmony_ci * Debug Control Registers?
5258c2ecf20Sopenharmony_ci */
5268c2ecf20Sopenharmony_ci#define DBCR0_ACTIVE_EVENTS  (DBCR0_ICMP | DBCR0_IAC1 | DBCR0_IAC2 | \
5278c2ecf20Sopenharmony_ci			      DBCR0_IAC3 | DBCR0_IAC4 | DBCR0_DAC1R | \
5288c2ecf20Sopenharmony_ci			      DBCR0_DAC1W  | DBCR0_DAC2R | DBCR0_DAC2W)
5298c2ecf20Sopenharmony_ci#define DBCR1_ACTIVE_EVENTS	0
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ci#define DBCR_ACTIVE_EVENTS(dbcr0, dbcr1)  (((dbcr0) & DBCR0_ACTIVE_EVENTS) || \
5328c2ecf20Sopenharmony_ci					   ((dbcr1) & DBCR1_ACTIVE_EVENTS))
5338c2ecf20Sopenharmony_ci#endif /* #elif defined(CONFIG_BOOKE) */
5348c2ecf20Sopenharmony_ci
5358c2ecf20Sopenharmony_ci/* Bit definitions related to the TCR. */
5368c2ecf20Sopenharmony_ci#define TCR_WP(x)	(((x)&0x3)<<30)	/* WDT Period */
5378c2ecf20Sopenharmony_ci#define TCR_WP_MASK	TCR_WP(3)
5388c2ecf20Sopenharmony_ci#define WP_2_17		0		/* 2^17 clocks */
5398c2ecf20Sopenharmony_ci#define WP_2_21		1		/* 2^21 clocks */
5408c2ecf20Sopenharmony_ci#define WP_2_25		2		/* 2^25 clocks */
5418c2ecf20Sopenharmony_ci#define WP_2_29		3		/* 2^29 clocks */
5428c2ecf20Sopenharmony_ci#define TCR_WRC(x)	(((x)&0x3)<<28)	/* WDT Reset Control */
5438c2ecf20Sopenharmony_ci#define TCR_WRC_MASK	TCR_WRC(3)
5448c2ecf20Sopenharmony_ci#define WRC_NONE	0		/* No reset will occur */
5458c2ecf20Sopenharmony_ci#define WRC_CORE	1		/* Core reset will occur */
5468c2ecf20Sopenharmony_ci#define WRC_CHIP	2		/* Chip reset will occur */
5478c2ecf20Sopenharmony_ci#define WRC_SYSTEM	3		/* System reset will occur */
5488c2ecf20Sopenharmony_ci#define TCR_WIE		0x08000000	/* WDT Interrupt Enable */
5498c2ecf20Sopenharmony_ci#define TCR_PIE		0x04000000	/* PIT Interrupt Enable */
5508c2ecf20Sopenharmony_ci#define TCR_DIE		TCR_PIE		/* DEC Interrupt Enable */
5518c2ecf20Sopenharmony_ci#define TCR_FP(x)	(((x)&0x3)<<24)	/* FIT Period */
5528c2ecf20Sopenharmony_ci#define TCR_FP_MASK	TCR_FP(3)
5538c2ecf20Sopenharmony_ci#define FP_2_9		0		/* 2^9 clocks */
5548c2ecf20Sopenharmony_ci#define FP_2_13		1		/* 2^13 clocks */
5558c2ecf20Sopenharmony_ci#define FP_2_17		2		/* 2^17 clocks */
5568c2ecf20Sopenharmony_ci#define FP_2_21		3		/* 2^21 clocks */
5578c2ecf20Sopenharmony_ci#define TCR_FIE		0x00800000	/* FIT Interrupt Enable */
5588c2ecf20Sopenharmony_ci#define TCR_ARE		0x00400000	/* Auto Reload Enable */
5598c2ecf20Sopenharmony_ci
5608c2ecf20Sopenharmony_ci#ifdef CONFIG_E500
5618c2ecf20Sopenharmony_ci#define TCR_GET_WP(tcr)  ((((tcr) & 0xC0000000) >> 30) | \
5628c2ecf20Sopenharmony_ci			      (((tcr) & 0x1E0000) >> 15))
5638c2ecf20Sopenharmony_ci#else
5648c2ecf20Sopenharmony_ci#define TCR_GET_WP(tcr)  (((tcr) & 0xC0000000) >> 30)
5658c2ecf20Sopenharmony_ci#endif
5668c2ecf20Sopenharmony_ci
5678c2ecf20Sopenharmony_ci/* Bit definitions for the TSR. */
5688c2ecf20Sopenharmony_ci#define TSR_ENW		0x80000000	/* Enable Next Watchdog */
5698c2ecf20Sopenharmony_ci#define TSR_WIS		0x40000000	/* WDT Interrupt Status */
5708c2ecf20Sopenharmony_ci#define TSR_WRS(x)	(((x)&0x3)<<28)	/* WDT Reset Status */
5718c2ecf20Sopenharmony_ci#define WRS_NONE	0		/* No WDT reset occurred */
5728c2ecf20Sopenharmony_ci#define WRS_CORE	1		/* WDT forced core reset */
5738c2ecf20Sopenharmony_ci#define WRS_CHIP	2		/* WDT forced chip reset */
5748c2ecf20Sopenharmony_ci#define WRS_SYSTEM	3		/* WDT forced system reset */
5758c2ecf20Sopenharmony_ci#define TSR_PIS		0x08000000	/* PIT Interrupt Status */
5768c2ecf20Sopenharmony_ci#define TSR_DIS		TSR_PIS		/* DEC Interrupt Status */
5778c2ecf20Sopenharmony_ci#define TSR_FIS		0x04000000	/* FIT Interrupt Status */
5788c2ecf20Sopenharmony_ci
5798c2ecf20Sopenharmony_ci/* Bit definitions for the DCCR. */
5808c2ecf20Sopenharmony_ci#define DCCR_NOCACHE	0		/* Noncacheable */
5818c2ecf20Sopenharmony_ci#define DCCR_CACHE	1		/* Cacheable */
5828c2ecf20Sopenharmony_ci
5838c2ecf20Sopenharmony_ci/* Bit definitions for DCWR. */
5848c2ecf20Sopenharmony_ci#define DCWR_COPY	0		/* Copy-back */
5858c2ecf20Sopenharmony_ci#define DCWR_WRITE	1		/* Write-through */
5868c2ecf20Sopenharmony_ci
5878c2ecf20Sopenharmony_ci/* Bit definitions for ICCR. */
5888c2ecf20Sopenharmony_ci#define ICCR_NOCACHE	0		/* Noncacheable */
5898c2ecf20Sopenharmony_ci#define ICCR_CACHE	1		/* Cacheable */
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci/* Bit definitions for L1CSR0. */
5928c2ecf20Sopenharmony_ci#define L1CSR0_CPE	0x00010000	/* Data Cache Parity Enable */
5938c2ecf20Sopenharmony_ci#define L1CSR0_CUL	0x00000400	/* Data Cache Unable to Lock */
5948c2ecf20Sopenharmony_ci#define L1CSR0_CLFC	0x00000100	/* Cache Lock Bits Flash Clear */
5958c2ecf20Sopenharmony_ci#define L1CSR0_DCFI	0x00000002	/* Data Cache Flash Invalidate */
5968c2ecf20Sopenharmony_ci#define L1CSR0_CFI	0x00000002	/* Cache Flash Invalidate */
5978c2ecf20Sopenharmony_ci#define L1CSR0_DCE	0x00000001	/* Data Cache Enable */
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_ci/* Bit definitions for L1CSR1. */
6008c2ecf20Sopenharmony_ci#define L1CSR1_CPE	0x00010000	/* Instruction Cache Parity Enable */
6018c2ecf20Sopenharmony_ci#define L1CSR1_ICLFR	0x00000100	/* Instr Cache Lock Bits Flash Reset */
6028c2ecf20Sopenharmony_ci#define L1CSR1_ICFI	0x00000002	/* Instr Cache Flash Invalidate */
6038c2ecf20Sopenharmony_ci#define L1CSR1_ICE	0x00000001	/* Instr Cache Enable */
6048c2ecf20Sopenharmony_ci
6058c2ecf20Sopenharmony_ci/* Bit definitions for L1CSR2. */
6068c2ecf20Sopenharmony_ci#define L1CSR2_DCWS	0x40000000	/* Data Cache write shadow */
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ci/* Bit definitions for BUCSR. */
6098c2ecf20Sopenharmony_ci#define BUCSR_STAC_EN	0x01000000	/* Segment Target Address Cache */
6108c2ecf20Sopenharmony_ci#define BUCSR_LS_EN	0x00400000	/* Link Stack */
6118c2ecf20Sopenharmony_ci#define BUCSR_BBFI	0x00000200	/* Branch Buffer flash invalidate */
6128c2ecf20Sopenharmony_ci#define BUCSR_BPEN	0x00000001	/* Branch prediction enable */
6138c2ecf20Sopenharmony_ci#define BUCSR_INIT	(BUCSR_STAC_EN | BUCSR_LS_EN | BUCSR_BBFI | BUCSR_BPEN)
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ci/* Bit definitions for L2CSR0. */
6168c2ecf20Sopenharmony_ci#define L2CSR0_L2E	0x80000000	/* L2 Cache Enable */
6178c2ecf20Sopenharmony_ci#define L2CSR0_L2PE	0x40000000	/* L2 Cache Parity/ECC Enable */
6188c2ecf20Sopenharmony_ci#define L2CSR0_L2WP	0x1c000000	/* L2 I/D Way Partioning */
6198c2ecf20Sopenharmony_ci#define L2CSR0_L2CM	0x03000000	/* L2 Cache Coherency Mode */
6208c2ecf20Sopenharmony_ci#define L2CSR0_L2FI	0x00200000	/* L2 Cache Flash Invalidate */
6218c2ecf20Sopenharmony_ci#define L2CSR0_L2IO	0x00100000	/* L2 Cache Instruction Only */
6228c2ecf20Sopenharmony_ci#define L2CSR0_L2DO	0x00010000	/* L2 Cache Data Only */
6238c2ecf20Sopenharmony_ci#define L2CSR0_L2REP	0x00003000	/* L2 Line Replacement Algo */
6248c2ecf20Sopenharmony_ci#define L2CSR0_L2FL	0x00000800	/* L2 Cache Flush */
6258c2ecf20Sopenharmony_ci#define L2CSR0_L2LFC	0x00000400	/* L2 Cache Lock Flash Clear */
6268c2ecf20Sopenharmony_ci#define L2CSR0_L2LOA	0x00000080	/* L2 Cache Lock Overflow Allocate */
6278c2ecf20Sopenharmony_ci#define L2CSR0_L2LO	0x00000020	/* L2 Cache Lock Overflow */
6288c2ecf20Sopenharmony_ci
6298c2ecf20Sopenharmony_ci/* Bit definitions for SGR. */
6308c2ecf20Sopenharmony_ci#define SGR_NORMAL	0		/* Speculative fetching allowed. */
6318c2ecf20Sopenharmony_ci#define SGR_GUARDED	1		/* Speculative fetching disallowed. */
6328c2ecf20Sopenharmony_ci
6338c2ecf20Sopenharmony_ci/* Bit definitions for EPCR */
6348c2ecf20Sopenharmony_ci#define SPRN_EPCR_EXTGS		0x80000000	/* External Input interrupt
6358c2ecf20Sopenharmony_ci						 * directed to Guest state */
6368c2ecf20Sopenharmony_ci#define SPRN_EPCR_DTLBGS	0x40000000	/* Data TLB Error interrupt
6378c2ecf20Sopenharmony_ci						 * directed to guest state */
6388c2ecf20Sopenharmony_ci#define SPRN_EPCR_ITLBGS	0x20000000	/* Instr. TLB error interrupt
6398c2ecf20Sopenharmony_ci						 * directed to guest state */
6408c2ecf20Sopenharmony_ci#define SPRN_EPCR_DSIGS		0x10000000	/* Data Storage interrupt
6418c2ecf20Sopenharmony_ci						 * directed to guest state */
6428c2ecf20Sopenharmony_ci#define SPRN_EPCR_ISIGS		0x08000000	/* Instr. Storage interrupt
6438c2ecf20Sopenharmony_ci						 * directed to guest state */
6448c2ecf20Sopenharmony_ci#define SPRN_EPCR_DUVD		0x04000000	/* Disable Hypervisor Debug */
6458c2ecf20Sopenharmony_ci#define SPRN_EPCR_ICM		0x02000000	/* Interrupt computation mode
6468c2ecf20Sopenharmony_ci						 * (copied to MSR:CM on intr) */
6478c2ecf20Sopenharmony_ci#define SPRN_EPCR_GICM		0x01000000	/* Guest Interrupt Comp. mode */
6488c2ecf20Sopenharmony_ci#define SPRN_EPCR_DGTMI		0x00800000	/* Disable TLB Guest Management
6498c2ecf20Sopenharmony_ci						 * instructions */
6508c2ecf20Sopenharmony_ci#define SPRN_EPCR_DMIUH		0x00400000	/* Disable MAS Interrupt updates
6518c2ecf20Sopenharmony_ci						 * for hypervisor */
6528c2ecf20Sopenharmony_ci
6538c2ecf20Sopenharmony_ci/* Bit definitions for EPLC/EPSC */
6548c2ecf20Sopenharmony_ci#define EPC_EPR		0x80000000 /* 1 = user, 0 = kernel */
6558c2ecf20Sopenharmony_ci#define EPC_EPR_SHIFT	31
6568c2ecf20Sopenharmony_ci#define EPC_EAS		0x40000000 /* Address Space */
6578c2ecf20Sopenharmony_ci#define EPC_EAS_SHIFT	30
6588c2ecf20Sopenharmony_ci#define EPC_EGS		0x20000000 /* 1 = guest, 0 = hypervisor */
6598c2ecf20Sopenharmony_ci#define EPC_EGS_SHIFT	29
6608c2ecf20Sopenharmony_ci#define EPC_ELPID	0x00ff0000
6618c2ecf20Sopenharmony_ci#define EPC_ELPID_SHIFT	16
6628c2ecf20Sopenharmony_ci#define EPC_EPID	0x00003fff
6638c2ecf20Sopenharmony_ci#define EPC_EPID_SHIFT	0
6648c2ecf20Sopenharmony_ci
6658c2ecf20Sopenharmony_ci/* Some 476 specific registers */
6668c2ecf20Sopenharmony_ci#define SPRN_SSPCR		830
6678c2ecf20Sopenharmony_ci#define SPRN_USPCR		831
6688c2ecf20Sopenharmony_ci#define SPRN_ISPCR		829
6698c2ecf20Sopenharmony_ci#define SPRN_MMUBE0		820
6708c2ecf20Sopenharmony_ci#define MMUBE0_IBE0_SHIFT	24
6718c2ecf20Sopenharmony_ci#define MMUBE0_IBE1_SHIFT	16
6728c2ecf20Sopenharmony_ci#define MMUBE0_IBE2_SHIFT	8
6738c2ecf20Sopenharmony_ci#define MMUBE0_VBE0		0x00000004
6748c2ecf20Sopenharmony_ci#define MMUBE0_VBE1		0x00000002
6758c2ecf20Sopenharmony_ci#define MMUBE0_VBE2		0x00000001
6768c2ecf20Sopenharmony_ci#define SPRN_MMUBE1		821
6778c2ecf20Sopenharmony_ci#define MMUBE1_IBE3_SHIFT	24
6788c2ecf20Sopenharmony_ci#define MMUBE1_IBE4_SHIFT	16
6798c2ecf20Sopenharmony_ci#define MMUBE1_IBE5_SHIFT	8
6808c2ecf20Sopenharmony_ci#define MMUBE1_VBE3		0x00000004
6818c2ecf20Sopenharmony_ci#define MMUBE1_VBE4		0x00000002
6828c2ecf20Sopenharmony_ci#define MMUBE1_VBE5		0x00000001
6838c2ecf20Sopenharmony_ci
6848c2ecf20Sopenharmony_ci#define TMRN_TMCFG0      16	/* Thread Management Configuration Register 0 */
6858c2ecf20Sopenharmony_ci#define TMRN_TMCFG0_NPRIBITS       0x003f0000 /* Bits of thread priority */
6868c2ecf20Sopenharmony_ci#define TMRN_TMCFG0_NPRIBITS_SHIFT 16
6878c2ecf20Sopenharmony_ci#define TMRN_TMCFG0_NATHRD         0x00003f00 /* Number of active threads */
6888c2ecf20Sopenharmony_ci#define TMRN_TMCFG0_NATHRD_SHIFT   8
6898c2ecf20Sopenharmony_ci#define TMRN_TMCFG0_NTHRD          0x0000003f /* Number of threads */
6908c2ecf20Sopenharmony_ci#define TMRN_IMSR0	0x120	/* Initial MSR Register 0 (e6500) */
6918c2ecf20Sopenharmony_ci#define TMRN_IMSR1	0x121	/* Initial MSR Register 1 (e6500) */
6928c2ecf20Sopenharmony_ci#define TMRN_INIA0	0x140	/* Next Instruction Address Register 0 */
6938c2ecf20Sopenharmony_ci#define TMRN_INIA1	0x141	/* Next Instruction Address Register 1 */
6948c2ecf20Sopenharmony_ci#define SPRN_TENSR	0x1b5	/* Thread Enable Status Register */
6958c2ecf20Sopenharmony_ci#define SPRN_TENS	0x1b6	/* Thread Enable Set Register */
6968c2ecf20Sopenharmony_ci#define SPRN_TENC	0x1b7	/* Thread Enable Clear Register */
6978c2ecf20Sopenharmony_ci
6988c2ecf20Sopenharmony_ci#define TEN_THREAD(x)	(1 << (x))
6998c2ecf20Sopenharmony_ci
7008c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
7018c2ecf20Sopenharmony_ci#define mftmr(rn)	({unsigned long rval; \
7028c2ecf20Sopenharmony_ci			asm volatile(MFTMR(rn, %0) : "=r" (rval)); rval;})
7038c2ecf20Sopenharmony_ci#define mttmr(rn, v)	asm volatile(MTTMR(rn, %0) : \
7048c2ecf20Sopenharmony_ci				     : "r" ((unsigned long)(v)) \
7058c2ecf20Sopenharmony_ci				     : "memory")
7068c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
7078c2ecf20Sopenharmony_ci
7088c2ecf20Sopenharmony_ci#endif /* __ASM_POWERPC_REG_BOOKE_H__ */
7098c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
710