99
99
#define MSR_LE __MASK(MSR_LE_LG) /* Little Endian */
101
101
#if defined(CONFIG_PPC_BOOK3S_64)
102
#define MSR_64BIT MSR_SF
102
104
/* Server variant */
103
105
#define MSR_ MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_ISF |MSR_HV
104
#define MSR_KERNEL MSR_ | MSR_SF
106
#define MSR_KERNEL MSR_ | MSR_64BIT
105
107
#define MSR_USER32 MSR_ | MSR_PR | MSR_EE
106
#define MSR_USER64 MSR_USER32 | MSR_SF
108
#define MSR_USER64 MSR_USER32 | MSR_64BIT
107
109
#elif defined(CONFIG_PPC_BOOK3S_32) || defined(CONFIG_8xx)
108
110
/* Default MSR for kernel mode. */
109
111
#define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR)
110
112
#define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE)
113
119
/* Floating Point Status and Control Register (FPSCR) Fields */
114
120
#define FPSCR_FX 0x80000000 /* FPU exception summary */
115
121
#define FPSCR_FEX 0x40000000 /* FPU enabled exception summary */
170
176
#define SPEFSCR_FRMC 0x00000003 /* Embedded FP rounding mode control */
172
178
/* Special Purpose Registers (SPRNs)*/
181
#define SPRN_PID 0x3B1 /* Process ID */
183
#define SPRN_PID 0x030 /* Process ID */
185
#define SPRN_PID0 SPRN_PID/* Process ID Register 0 */
173
189
#define SPRN_CTR 0x009 /* Count Register */
174
190
#define SPRN_DSCR 0x11
191
#define SPRN_CFAR 0x1c /* Come From Address Register */
192
#define SPRN_ACOP 0x1F /* Available Coprocessor Register */
175
193
#define SPRN_CTRLF 0x088
176
194
#define SPRN_CTRLT 0x098
177
195
#define CTRL_CT 0xc0000000 /* current thread */
200
218
#define SPRN_TBWL 0x11C /* Time Base Lower Register (super, R/W) */
201
219
#define SPRN_TBWU 0x11D /* Time Base Upper Register (super, R/W) */
202
220
#define SPRN_SPURR 0x134 /* Scaled PURR */
221
#define SPRN_HSPRG0 0x130 /* Hypervisor Scratch 0 */
222
#define SPRN_HSPRG1 0x131 /* Hypervisor Scratch 1 */
223
#define SPRN_HDSISR 0x132
224
#define SPRN_HDAR 0x133
225
#define SPRN_HDEC 0x136 /* Hypervisor Decrementer */
203
226
#define SPRN_HIOR 0x137 /* 970 Hypervisor interrupt offset */
227
#define SPRN_RMOR 0x138 /* Real mode offset register */
228
#define SPRN_HRMOR 0x139 /* Real mode offset register */
229
#define SPRN_HSRR0 0x13A /* Hypervisor Save/Restore 0 */
230
#define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */
204
231
#define SPRN_LPCR 0x13E /* LPAR Control Register */
232
#define LPCR_VPM0 (1ul << (63-0))
233
#define LPCR_VPM1 (1ul << (63-1))
234
#define LPCR_ISL (1ul << (63-2))
235
#define LPCR_DPFD_SH (63-11)
236
#define LPCR_VRMA_L (1ul << (63-12))
237
#define LPCR_VRMA_LP0 (1ul << (63-15))
238
#define LPCR_VRMA_LP1 (1ul << (63-16))
239
#define LPCR_RMLS 0x1C000000 /* impl dependent rmo limit sel */
240
#define LPCR_ILE 0x02000000 /* !HV irqs set MSR:LE */
241
#define LPCR_PECE 0x00007000 /* powersave exit cause enable */
242
#define LPCR_PECE0 0x00004000 /* ext. exceptions can cause exit */
243
#define LPCR_PECE1 0x00002000 /* decrementer can cause exit */
244
#define LPCR_PECE2 0x00001000 /* machine check etc can cause exit */
245
#define LPCR_MER 0x00000800 /* Mediated External Exception */
246
#define LPCR_LPES0 0x00000008 /* LPAR Env selector 0 */
247
#define LPCR_LPES1 0x00000004 /* LPAR Env selector 1 */
248
#define LPCR_RMI 0x00000002 /* real mode is cache inhibit */
249
#define LPCR_HDICE 0x00000001 /* Hyp Decr enable (HV,PR,EE) */
250
#define SPRN_LPID 0x13F /* Logical Partition Identifier */
251
#define SPRN_HMER 0x150 /* Hardware m? error recovery */
252
#define SPRN_HMEER 0x151 /* Hardware m? enable error recovery */
253
#define SPRN_HEIR 0x153 /* Hypervisor Emulated Instruction Register */
254
#define SPRN_TLBINDEXR 0x154 /* P7 TLB control register */
255
#define SPRN_TLBVPNR 0x155 /* P7 TLB control register */
256
#define SPRN_TLBRPNR 0x156 /* P7 TLB control register */
257
#define SPRN_TLBLPIDR 0x157 /* P7 TLB control register */
205
258
#define SPRN_DBAT0L 0x219 /* Data BAT 0 Lower Register */
206
259
#define SPRN_DBAT0U 0x218 /* Data BAT 0 Upper Register */
207
260
#define SPRN_DBAT1L 0x21B /* Data BAT 1 Lower Register */
424
477
#define SPRN_SRR0 0x01A /* Save/Restore Register 0 */
425
478
#define SPRN_SRR1 0x01B /* Save/Restore Register 1 */
426
479
#define SRR1_WAKEMASK 0x00380000 /* reason for wakeup */
427
#define SRR1_WAKERESET 0x00380000 /* System reset */
428
480
#define SRR1_WAKESYSERR 0x00300000 /* System error */
429
481
#define SRR1_WAKEEE 0x00200000 /* External interrupt */
430
482
#define SRR1_WAKEMT 0x00280000 /* mtctrl */
483
#define SRR1_WAKEHMI 0x00280000 /* Hypervisor maintenance */
431
484
#define SRR1_WAKEDEC 0x00180000 /* Decrementer interrupt */
432
485
#define SRR1_WAKETHERM 0x00100000 /* Thermal management interrupt */
486
#define SRR1_WAKERESET 0x00100000 /* System reset */
487
#define SRR1_WAKESTATE 0x00030000 /* Powersave exit mask [46:47] */
488
#define SRR1_WS_DEEPEST 0x00030000 /* Some resources not maintained,
489
* may not be recoverable */
490
#define SRR1_WS_DEEPER 0x00020000 /* Some resources not maintained */
491
#define SRR1_WS_DEEP 0x00010000 /* All resources maintained */
433
492
#define SRR1_PROGFPE 0x00100000 /* Floating Point Enabled */
434
493
#define SRR1_PROGPRIV 0x00040000 /* Privileged instruction */
435
494
#define SRR1_PROGTRAP 0x00020000 /* Trap */
436
495
#define SRR1_PROGADDR 0x00010000 /* SRR0 contains subsequent addr */
437
497
#define SPRN_HSRR0 0x13A /* Save/Restore Register 0 */
438
498
#define SPRN_HSRR1 0x13B /* Save/Restore Register 1 */
666
* - SPRG1 stores PACA pointer
726
* - SPRG1 stores PACA pointer except 64-bit server in
727
* HV mode in which case it is HSPRG0
669
730
* - SPRG0 unused (reserved for HV on Power4)
670
731
* - SPRG2 scratch for exception vectors
671
732
* - SPRG3 unused (user visible)
733
* - HSPRG0 stores PACA in HV mode
734
* - HSPRG1 scratch for "HV" exceptions
673
736
* 64-bit embedded
674
737
* - SPRG0 generic exception scratch
732
795
#ifdef CONFIG_PPC_BOOK3S_64
733
796
#define SPRN_SPRG_SCRATCH0 SPRN_SPRG2
797
#define SPRN_SPRG_HPACA SPRN_HSPRG0
798
#define SPRN_SPRG_HSCRATCH0 SPRN_HSPRG1
800
#define GET_PACA(rX) \
801
BEGIN_FTR_SECTION_NESTED(66); \
802
mfspr rX,SPRN_SPRG_PACA; \
803
FTR_SECTION_ELSE_NESTED(66); \
804
mfspr rX,SPRN_SPRG_HPACA; \
805
ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE_206, 66)
807
#define SET_PACA(rX) \
808
BEGIN_FTR_SECTION_NESTED(66); \
809
mtspr SPRN_SPRG_PACA,rX; \
810
FTR_SECTION_ELSE_NESTED(66); \
811
mtspr SPRN_SPRG_HPACA,rX; \
812
ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE_206, 66)
814
#define GET_SCRATCH0(rX) \
815
BEGIN_FTR_SECTION_NESTED(66); \
816
mfspr rX,SPRN_SPRG_SCRATCH0; \
817
FTR_SECTION_ELSE_NESTED(66); \
818
mfspr rX,SPRN_SPRG_HSCRATCH0; \
819
ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE_206, 66)
821
#define SET_SCRATCH0(rX) \
822
BEGIN_FTR_SECTION_NESTED(66); \
823
mtspr SPRN_SPRG_SCRATCH0,rX; \
824
FTR_SECTION_ELSE_NESTED(66); \
825
mtspr SPRN_SPRG_HSCRATCH0,rX; \
826
ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE_206, 66)
828
#else /* CONFIG_PPC_BOOK3S_64 */
829
#define GET_SCRATCH0(rX) mfspr rX,SPRN_SPRG_SCRATCH0
830
#define SET_SCRATCH0(rX) mtspr SPRN_SPRG_SCRATCH0,rX
736
834
#ifdef CONFIG_PPC_BOOK3E_64
740
838
#define SPRN_SPRG_TLB_EXFRAME SPRN_SPRG2
741
839
#define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6
742
840
#define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0
842
#define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX
843
#define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA
745
847
#ifdef CONFIG_PPC_BOOK3S_32
852
956
#define PVR_7450 0x80000000
853
957
#define PVR_8540 0x80200000
854
958
#define PVR_8560 0x80200000
959
#define PVR_VER_E500V1 0x8020
960
#define PVR_VER_E500V2 0x8021
856
962
* For the 8xx processors, all of them report the same PVR family for
857
963
* the PowerPC core. The various versions of these processors must be