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 */
210
218
#define SPRN_TBWL 0x11C /* Time Base Lower Register (super, R/W) */
211
219
#define SPRN_TBWU 0x11D /* Time Base Upper Register (super, R/W) */
212
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 */
213
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 */
214
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 */
215
258
#define SPRN_DBAT0L 0x219 /* Data BAT 0 Lower Register */
216
259
#define SPRN_DBAT0U 0x218 /* Data BAT 0 Upper Register */
217
260
#define SPRN_DBAT1L 0x21B /* Data BAT 1 Lower Register */
434
477
#define SPRN_SRR0 0x01A /* Save/Restore Register 0 */
435
478
#define SPRN_SRR1 0x01B /* Save/Restore Register 1 */
436
479
#define SRR1_WAKEMASK 0x00380000 /* reason for wakeup */
437
#define SRR1_WAKERESET 0x00380000 /* System reset */
438
480
#define SRR1_WAKESYSERR 0x00300000 /* System error */
439
481
#define SRR1_WAKEEE 0x00200000 /* External interrupt */
440
482
#define SRR1_WAKEMT 0x00280000 /* mtctrl */
483
#define SRR1_WAKEHMI 0x00280000 /* Hypervisor maintenance */
441
484
#define SRR1_WAKEDEC 0x00180000 /* Decrementer interrupt */
442
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 */
443
492
#define SRR1_PROGFPE 0x00100000 /* Floating Point Enabled */
444
493
#define SRR1_PROGPRIV 0x00040000 /* Privileged instruction */
445
494
#define SRR1_PROGTRAP 0x00020000 /* Trap */
446
495
#define SRR1_PROGADDR 0x00010000 /* SRR0 contains subsequent addr */
447
497
#define SPRN_HSRR0 0x13A /* Save/Restore Register 0 */
448
498
#define SPRN_HSRR1 0x13B /* Save/Restore Register 1 */
676
* - SPRG1 stores PACA pointer
726
* - SPRG1 stores PACA pointer except 64-bit server in
727
* HV mode in which case it is HSPRG0
679
730
* - SPRG0 unused (reserved for HV on Power4)
680
731
* - SPRG2 scratch for exception vectors
681
732
* - SPRG3 unused (user visible)
733
* - HSPRG0 stores PACA in HV mode
734
* - HSPRG1 scratch for "HV" exceptions
683
736
* 64-bit embedded
684
737
* - SPRG0 generic exception scratch
742
795
#ifdef CONFIG_PPC_BOOK3S_64
743
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
746
834
#ifdef CONFIG_PPC_BOOK3E_64
750
838
#define SPRN_SPRG_TLB_EXFRAME SPRN_SPRG2
751
839
#define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6
752
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
755
847
#ifdef CONFIG_PPC_BOOK3S_32