diff options
author | Paul Mackerras <paulus@samba.org> | 2005-10-10 00:19:43 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-10-10 00:19:43 -0400 |
commit | 9f04b9e327c495f8ddbf89c08da6cbe626e1b1b3 (patch) | |
tree | 381e9786b837085bd555c705542047f54cd2beab /include/asm-powerpc/reg.h | |
parent | b60fc8bbd2d0ea2a9b1fc7271d521fcf47f27bfd (diff) |
powerpc: Merged processor.h.
This adds register definitions from the ppc64 processor.h to reg.h,
and makes a single merged processor.h. I moved __is_processor from
the ppc64 system.h to the merged reg.h along with the PVR register
constants.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc/reg.h')
-rw-r--r-- | include/asm-powerpc/reg.h | 281 |
1 files changed, 221 insertions, 60 deletions
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h index 1402a2dedff..ff619630dff 100644 --- a/include/asm-powerpc/reg.h +++ b/include/asm-powerpc/reg.h | |||
@@ -6,53 +6,95 @@ | |||
6 | * Implementations of the PowerPC Architecture (a.k.a. Green Book) here. | 6 | * Implementations of the PowerPC Architecture (a.k.a. Green Book) here. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #ifndef _ASM_POWERPC_REGS_H | 9 | #ifndef _ASM_POWERPC_REG_H |
10 | #define _ASM_POWERPC_REGS_H | 10 | #define _ASM_POWERPC_REG_H |
11 | #ifdef __KERNEL__ | 11 | #ifdef __KERNEL__ |
12 | 12 | ||
13 | #include <linux/stringify.h> | 13 | #include <linux/stringify.h> |
14 | #include <asm/cputable.h> | ||
14 | 15 | ||
15 | /* Pickup Book E specific registers. */ | 16 | /* Pickup Book E specific registers. */ |
16 | #if defined(CONFIG_BOOKE) || defined(CONFIG_40x) | 17 | #if defined(CONFIG_BOOKE) || defined(CONFIG_40x) |
17 | #include <asm/reg_booke.h> | 18 | #include <asm/reg_booke.h> |
18 | #endif | 19 | #endif |
19 | 20 | ||
20 | /* Machine State Register (MSR) Fields */ | 21 | #define MSR_SF_LG 63 /* Enable 64 bit mode */ |
21 | #define MSR_SF (1<<63) | 22 | #define MSR_ISF_LG 61 /* Interrupt 64b mode valid on 630 */ |
22 | #define MSR_ISF (1<<61) | 23 | #define MSR_HV_LG 60 /* Hypervisor state */ |
23 | #define MSR_VEC (1<<25) /* Enable AltiVec */ | 24 | #define MSR_VEC_LG 25 /* Enable AltiVec */ |
24 | #define MSR_POW (1<<18) /* Enable Power Management */ | 25 | #define MSR_POW_LG 18 /* Enable Power Management */ |
25 | #define MSR_WE (1<<18) /* Wait State Enable */ | 26 | #define MSR_WE_LG 18 /* Wait State Enable */ |
26 | #define MSR_TGPR (1<<17) /* TLB Update registers in use */ | 27 | #define MSR_TGPR_LG 17 /* TLB Update registers in use */ |
27 | #define MSR_CE (1<<17) /* Critical Interrupt Enable */ | 28 | #define MSR_CE_LG 17 /* Critical Interrupt Enable */ |
28 | #define MSR_ILE (1<<16) /* Interrupt Little Endian */ | 29 | #define MSR_ILE_LG 16 /* Interrupt Little Endian */ |
29 | #define MSR_EE (1<<15) /* External Interrupt Enable */ | 30 | #define MSR_EE_LG 15 /* External Interrupt Enable */ |
30 | #define MSR_PR (1<<14) /* Problem State / Privilege Level */ | 31 | #define MSR_PR_LG 14 /* Problem State / Privilege Level */ |
31 | #define MSR_FP (1<<13) /* Floating Point enable */ | 32 | #define MSR_FP_LG 13 /* Floating Point enable */ |
32 | #define MSR_ME (1<<12) /* Machine Check Enable */ | 33 | #define MSR_ME_LG 12 /* Machine Check Enable */ |
33 | #define MSR_FE0 (1<<11) /* Floating Exception mode 0 */ | 34 | #define MSR_FE0_LG 11 /* Floating Exception mode 0 */ |
34 | #define MSR_SE (1<<10) /* Single Step */ | 35 | #define MSR_SE_LG 10 /* Single Step */ |
35 | #define MSR_BE (1<<9) /* Branch Trace */ | 36 | #define MSR_BE_LG 9 /* Branch Trace */ |
36 | #define MSR_DE (1<<9) /* Debug Exception Enable */ | 37 | #define MSR_DE_LG 9 /* Debug Exception Enable */ |
37 | #define MSR_FE1 (1<<8) /* Floating Exception mode 1 */ | 38 | #define MSR_FE1_LG 8 /* Floating Exception mode 1 */ |
38 | #define MSR_IP (1<<6) /* Exception prefix 0x000/0xFFF */ | 39 | #define MSR_IP_LG 6 /* Exception prefix 0x000/0xFFF */ |
39 | #define MSR_IR (1<<5) /* Instruction Relocate */ | 40 | #define MSR_IR_LG 5 /* Instruction Relocate */ |
40 | #define MSR_DR (1<<4) /* Data Relocate */ | 41 | #define MSR_DR_LG 4 /* Data Relocate */ |
41 | #define MSR_PE (1<<3) /* Protection Enable */ | 42 | #define MSR_PE_LG 3 /* Protection Enable */ |
42 | #define MSR_PX (1<<2) /* Protection Exclusive Mode */ | 43 | #define MSR_PX_LG 2 /* Protection Exclusive Mode */ |
43 | #define MSR_RI (1<<1) /* Recoverable Exception */ | 44 | #define MSR_PMM_LG 2 /* Performance monitor */ |
44 | #define MSR_LE (1<<0) /* Little Endian */ | 45 | #define MSR_RI_LG 1 /* Recoverable Exception */ |
46 | #define MSR_LE_LG 0 /* Little Endian */ | ||
45 | 47 | ||
48 | #ifdef __ASSEMBLY__ | ||
49 | #define __MASK(X) (1<<(X)) | ||
50 | #else | ||
51 | #define __MASK(X) (1UL<<(X)) | ||
52 | #endif | ||
53 | |||
54 | #define MSR_SF __MASK(MSR_SF_LG) /* Enable 64 bit mode */ | ||
55 | #define MSR_ISF __MASK(MSR_ISF_LG) /* Interrupt 64b mode valid on 630 */ | ||
56 | #define MSR_HV __MASK(MSR_HV_LG) /* Hypervisor state */ | ||
57 | #define MSR_VEC __MASK(MSR_VEC_LG) /* Enable AltiVec */ | ||
58 | #define MSR_POW __MASK(MSR_POW_LG) /* Enable Power Management */ | ||
59 | #define MSR_WE __MASK(MSR_WE_LG) /* Wait State Enable */ | ||
60 | #define MSR_TGPR __MASK(MSR_TGPR_LG) /* TLB Update registers in use */ | ||
61 | #define MSR_CE __MASK(MSR_CE_LG) /* Critical Interrupt Enable */ | ||
62 | #define MSR_ILE __MASK(MSR_ILE_LG) /* Interrupt Little Endian */ | ||
63 | #define MSR_EE __MASK(MSR_EE_LG) /* External Interrupt Enable */ | ||
64 | #define MSR_PR __MASK(MSR_PR_LG) /* Problem State / Privilege Level */ | ||
65 | #define MSR_FP __MASK(MSR_FP_LG) /* Floating Point enable */ | ||
66 | #define MSR_ME __MASK(MSR_ME_LG) /* Machine Check Enable */ | ||
67 | #define MSR_FE0 __MASK(MSR_FE0_LG) /* Floating Exception mode 0 */ | ||
68 | #define MSR_SE __MASK(MSR_SE_LG) /* Single Step */ | ||
69 | #define MSR_BE __MASK(MSR_BE_LG) /* Branch Trace */ | ||
70 | #define MSR_DE __MASK(MSR_DE_LG) /* Debug Exception Enable */ | ||
71 | #define MSR_FE1 __MASK(MSR_FE1_LG) /* Floating Exception mode 1 */ | ||
72 | #define MSR_IP __MASK(MSR_IP_LG) /* Exception prefix 0x000/0xFFF */ | ||
73 | #define MSR_IR __MASK(MSR_IR_LG) /* Instruction Relocate */ | ||
74 | #define MSR_DR __MASK(MSR_DR_LG) /* Data Relocate */ | ||
75 | #define MSR_PE __MASK(MSR_PE_LG) /* Protection Enable */ | ||
76 | #define MSR_PX __MASK(MSR_PX_LG) /* Protection Exclusive Mode */ | ||
77 | #define MSR_PMM __MASK(MSR_PMM_LG) /* Performance monitor */ | ||
78 | #define MSR_RI __MASK(MSR_RI_LG) /* Recoverable Exception */ | ||
79 | #define MSR_LE __MASK(MSR_LE_LG) /* Little Endian */ | ||
80 | |||
81 | #ifdef CONFIG_PPC64 | ||
82 | #define MSR_ MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_ISF | ||
83 | #define MSR_KERNEL MSR_ | MSR_SF | MSR_HV | ||
84 | |||
85 | #define MSR_USER32 MSR_ | MSR_PR | MSR_EE | ||
86 | #define MSR_USER64 MSR_USER32 | MSR_SF | ||
87 | |||
88 | #else /* 32-bit */ | ||
46 | /* Default MSR for kernel mode. */ | 89 | /* Default MSR for kernel mode. */ |
47 | #ifdef CONFIG_APUS_FAST_EXCEPT | 90 | #ifdef CONFIG_APUS_FAST_EXCEPT |
48 | #define MSR_KERNEL (MSR_ME|MSR_IP|MSR_RI|MSR_IR|MSR_DR) | 91 | #define MSR_KERNEL (MSR_ME|MSR_IP|MSR_RI|MSR_IR|MSR_DR) |
49 | #endif | 92 | #else |
50 | |||
51 | #ifndef MSR_KERNEL | ||
52 | #define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR) | 93 | #define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR) |
53 | #endif | 94 | #endif |
54 | 95 | ||
55 | #define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE) | 96 | #define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE) |
97 | #endif | ||
56 | 98 | ||
57 | /* Floating Point Status and Control Register (FPSCR) Fields */ | 99 | /* Floating Point Status and Control Register (FPSCR) Fields */ |
58 | #define FPSCR_FX 0x80000000 /* FPU exception summary */ | 100 | #define FPSCR_FX 0x80000000 /* FPU exception summary */ |
@@ -85,6 +127,9 @@ | |||
85 | 127 | ||
86 | /* Special Purpose Registers (SPRNs)*/ | 128 | /* Special Purpose Registers (SPRNs)*/ |
87 | #define SPRN_CTR 0x009 /* Count Register */ | 129 | #define SPRN_CTR 0x009 /* Count Register */ |
130 | #define SPRN_CTRLF 0x088 | ||
131 | #define SPRN_CTRLT 0x098 | ||
132 | #define CTRL_RUNLATCH 0x1 | ||
88 | #define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */ | 133 | #define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */ |
89 | #define DABR_TRANSLATION (1UL << 2) | 134 | #define DABR_TRANSLATION (1UL << 2) |
90 | #define SPRN_DAR 0x013 /* Data Address Register */ | 135 | #define SPRN_DAR 0x013 /* Data Address Register */ |
@@ -193,6 +238,16 @@ | |||
193 | #define SPRN_IABR 0x3F2 /* Instruction Address Breakpoint Register */ | 238 | #define SPRN_IABR 0x3F2 /* Instruction Address Breakpoint Register */ |
194 | #define SPRN_HID4 0x3F4 /* 970 HID4 */ | 239 | #define SPRN_HID4 0x3F4 /* 970 HID4 */ |
195 | #define SPRN_HID5 0x3F6 /* 970 HID5 */ | 240 | #define SPRN_HID5 0x3F6 /* 970 HID5 */ |
241 | #define SPRN_HID6 0x3F9 /* BE HID 6 */ | ||
242 | #define HID6_LB (0x0F<<12) /* Concurrent Large Page Modes */ | ||
243 | #define HID6_DLP (1<<20) /* Disable all large page modes (4K only) */ | ||
244 | #define SPRN_TSCR 0x399 /* Thread switch control on BE */ | ||
245 | #define SPRN_TTR 0x39A /* Thread switch timeout on BE */ | ||
246 | #define TSCR_DEC_ENABLE 0x200000 /* Decrementer Interrupt */ | ||
247 | #define TSCR_EE_ENABLE 0x100000 /* External Interrupt */ | ||
248 | #define TSCR_EE_BOOST 0x080000 /* External Interrupt Boost */ | ||
249 | #define SPRN_TSC 0x3FD /* Thread switch control on others */ | ||
250 | #define SPRN_TST 0x3FC /* Thread switch timeout on others */ | ||
196 | #if !defined(SPRN_IAC1) && !defined(SPRN_IAC2) | 251 | #if !defined(SPRN_IAC1) && !defined(SPRN_IAC2) |
197 | #define SPRN_IAC1 0x3F4 /* Instruction Address Compare 1 */ | 252 | #define SPRN_IAC1 0x3F4 /* Instruction Address Compare 1 */ |
198 | #define SPRN_IAC2 0x3F5 /* Instruction Address Compare 2 */ | 253 | #define SPRN_IAC2 0x3F5 /* Instruction Address Compare 2 */ |
@@ -276,22 +331,18 @@ | |||
276 | #define L3CR_L3DO 0x00000040 /* L3 data only mode */ | 331 | #define L3CR_L3DO 0x00000040 /* L3 data only mode */ |
277 | #define L3CR_PMEN 0x00000004 /* L3 private memory enable */ | 332 | #define L3CR_PMEN 0x00000004 /* L3 private memory enable */ |
278 | #define L3CR_PMSIZ 0x00000001 /* L3 private memory size */ | 333 | #define L3CR_PMSIZ 0x00000001 /* L3 private memory size */ |
334 | |||
279 | #define SPRN_MSSCR0 0x3f6 /* Memory Subsystem Control Register 0 */ | 335 | #define SPRN_MSSCR0 0x3f6 /* Memory Subsystem Control Register 0 */ |
280 | #define SPRN_MSSSR0 0x3f7 /* Memory Subsystem Status Register 1 */ | 336 | #define SPRN_MSSSR0 0x3f7 /* Memory Subsystem Status Register 1 */ |
281 | #define SPRN_LDSTCR 0x3f8 /* Load/Store control register */ | 337 | #define SPRN_LDSTCR 0x3f8 /* Load/Store control register */ |
282 | #define SPRN_LDSTDB 0x3f4 /* */ | 338 | #define SPRN_LDSTDB 0x3f4 /* */ |
283 | #define SPRN_LR 0x008 /* Link Register */ | 339 | #define SPRN_LR 0x008 /* Link Register */ |
284 | #define SPRN_MMCR0 0x3B8 /* Monitor Mode Control Register 0 */ | ||
285 | #define SPRN_MMCR1 0x3BC /* Monitor Mode Control Register 1 */ | ||
286 | #ifndef SPRN_PIR | 340 | #ifndef SPRN_PIR |
287 | #define SPRN_PIR 0x3FF /* Processor Identification Register */ | 341 | #define SPRN_PIR 0x3FF /* Processor Identification Register */ |
288 | #endif | 342 | #endif |
289 | #define SPRN_PMC1 0x3B9 /* Performance Counter Register 1 */ | ||
290 | #define SPRN_PMC2 0x3BA /* Performance Counter Register 2 */ | ||
291 | #define SPRN_PMC3 0x3BD /* Performance Counter Register 3 */ | ||
292 | #define SPRN_PMC4 0x3BE /* Performance Counter Register 4 */ | ||
293 | #define SPRN_PTEHI 0x3D5 /* 981 7450 PTE HI word (S/W TLB load) */ | 343 | #define SPRN_PTEHI 0x3D5 /* 981 7450 PTE HI word (S/W TLB load) */ |
294 | #define SPRN_PTELO 0x3D6 /* 982 7450 PTE LO word (S/W TLB load) */ | 344 | #define SPRN_PTELO 0x3D6 /* 982 7450 PTE LO word (S/W TLB load) */ |
345 | #define SPRN_PURR 0x135 /* Processor Utilization of Resources Reg */ | ||
295 | #define SPRN_PVR 0x11F /* Processor Version Register */ | 346 | #define SPRN_PVR 0x11F /* Processor Version Register */ |
296 | #define SPRN_RPA 0x3D6 /* Required Physical Address Register */ | 347 | #define SPRN_RPA 0x3D6 /* Required Physical Address Register */ |
297 | #define SPRN_SDA 0x3BF /* Sampled Data Address Register */ | 348 | #define SPRN_SDA 0x3BF /* Sampled Data Address Register */ |
@@ -333,6 +384,52 @@ | |||
333 | #define SPRN_VRSAVE 0x100 /* Vector Register Save Register */ | 384 | #define SPRN_VRSAVE 0x100 /* Vector Register Save Register */ |
334 | #define SPRN_XER 0x001 /* Fixed Point Exception Register */ | 385 | #define SPRN_XER 0x001 /* Fixed Point Exception Register */ |
335 | 386 | ||
387 | /* Performance monitor SPRs */ | ||
388 | #ifdef CONFIG_PPC64 | ||
389 | #define SPRN_MMCR0 795 | ||
390 | #define MMCR0_FC 0x80000000UL /* freeze counters */ | ||
391 | #define MMCR0_FCS 0x40000000UL /* freeze in supervisor state */ | ||
392 | #define MMCR0_KERNEL_DISABLE MMCR0_FCS | ||
393 | #define MMCR0_FCP 0x20000000UL /* freeze in problem state */ | ||
394 | #define MMCR0_PROBLEM_DISABLE MMCR0_FCP | ||
395 | #define MMCR0_FCM1 0x10000000UL /* freeze counters while MSR mark = 1 */ | ||
396 | #define MMCR0_FCM0 0x08000000UL /* freeze counters while MSR mark = 0 */ | ||
397 | #define MMCR0_PMXE 0x04000000UL /* performance monitor exception enable */ | ||
398 | #define MMCR0_FCECE 0x02000000UL /* freeze ctrs on enabled cond or event */ | ||
399 | #define MMCR0_TBEE 0x00400000UL /* time base exception enable */ | ||
400 | #define MMCR0_PMC1CE 0x00008000UL /* PMC1 count enable*/ | ||
401 | #define MMCR0_PMCjCE 0x00004000UL /* PMCj count enable*/ | ||
402 | #define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */ | ||
403 | #define MMCR0_PMAO 0x00000080UL /* performance monitor alert has occurred, set to 0 after handling exception */ | ||
404 | #define MMCR0_SHRFC 0x00000040UL /* SHRre freeze conditions between threads */ | ||
405 | #define MMCR0_FCTI 0x00000008UL /* freeze counters in tags inactive mode */ | ||
406 | #define MMCR0_FCTA 0x00000004UL /* freeze counters in tags active mode */ | ||
407 | #define MMCR0_FCWAIT 0x00000002UL /* freeze counter in WAIT state */ | ||
408 | #define MMCR0_FCHV 0x00000001UL /* freeze conditions in hypervisor mode */ | ||
409 | #define SPRN_MMCR1 798 | ||
410 | #define SPRN_MMCRA 0x312 | ||
411 | #define MMCRA_SIHV 0x10000000UL /* state of MSR HV when SIAR set */ | ||
412 | #define MMCRA_SIPR 0x08000000UL /* state of MSR PR when SIAR set */ | ||
413 | #define MMCRA_SAMPLE_ENABLE 0x00000001UL /* enable sampling */ | ||
414 | #define SPRN_PMC1 787 | ||
415 | #define SPRN_PMC2 788 | ||
416 | #define SPRN_PMC3 789 | ||
417 | #define SPRN_PMC4 790 | ||
418 | #define SPRN_PMC5 791 | ||
419 | #define SPRN_PMC6 792 | ||
420 | #define SPRN_PMC7 793 | ||
421 | #define SPRN_PMC8 794 | ||
422 | #define SPRN_SIAR 780 | ||
423 | #define SPRN_SDAR 781 | ||
424 | |||
425 | #else /* 32-bit */ | ||
426 | #define SPRN_MMCR0 0x3B8 /* Monitor Mode Control Register 0 */ | ||
427 | #define SPRN_MMCR1 0x3BC /* Monitor Mode Control Register 1 */ | ||
428 | #define SPRN_PMC1 0x3B9 /* Performance Counter Register 1 */ | ||
429 | #define SPRN_PMC2 0x3BA /* Performance Counter Register 2 */ | ||
430 | #define SPRN_PMC3 0x3BD /* Performance Counter Register 3 */ | ||
431 | #define SPRN_PMC4 0x3BE /* Performance Counter Register 4 */ | ||
432 | |||
336 | /* Bit definitions for MMCR0 and PMC1 / PMC2. */ | 433 | /* Bit definitions for MMCR0 and PMC1 / PMC2. */ |
337 | #define MMCR0_PMC1_CYCLES (1 << 7) | 434 | #define MMCR0_PMC1_CYCLES (1 << 7) |
338 | #define MMCR0_PMC1_ICACHEMISS (5 << 7) | 435 | #define MMCR0_PMC1_ICACHEMISS (5 << 7) |
@@ -342,14 +439,15 @@ | |||
342 | #define MMCR0_PMC2_ITLB 0x7 | 439 | #define MMCR0_PMC2_ITLB 0x7 |
343 | #define MMCR0_PMC2_LOADMISSTIME 0x5 | 440 | #define MMCR0_PMC2_LOADMISSTIME 0x5 |
344 | #define MMCR0_PMXE (1 << 26) | 441 | #define MMCR0_PMXE (1 << 26) |
345 | 442 | #endif | |
346 | /* Processor Version Register */ | ||
347 | 443 | ||
348 | /* Processor Version Register (PVR) field extraction */ | 444 | /* Processor Version Register (PVR) field extraction */ |
349 | 445 | ||
350 | #define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */ | 446 | #define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */ |
351 | #define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */ | 447 | #define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */ |
352 | 448 | ||
449 | #define __is_processor(pv) (PVR_VER(mfspr(SPRN_PVR)) == (pv)) | ||
450 | |||
353 | /* | 451 | /* |
354 | * IBM has further subdivided the standard PowerPC 16-bit version and | 452 | * IBM has further subdivided the standard PowerPC 16-bit version and |
355 | * revision subfields of the PVR for the PowerPC 403s into the following: | 453 | * revision subfields of the PVR for the PowerPC 403s into the following: |
@@ -405,42 +503,105 @@ | |||
405 | #define PVR_8245 0x80811014 | 503 | #define PVR_8245 0x80811014 |
406 | #define PVR_8260 PVR_8240 | 504 | #define PVR_8260 PVR_8240 |
407 | 505 | ||
408 | #if 0 | 506 | /* 64-bit processors */ |
409 | /* Segment Registers */ | 507 | /* XXX the prefix should be PVR_, we'll do a global sweep to fix it one day */ |
410 | #define SR0 0 | 508 | #define PV_NORTHSTAR 0x0033 |
411 | #define SR1 1 | 509 | #define PV_PULSAR 0x0034 |
412 | #define SR2 2 | 510 | #define PV_POWER4 0x0035 |
413 | #define SR3 3 | 511 | #define PV_ICESTAR 0x0036 |
414 | #define SR4 4 | 512 | #define PV_SSTAR 0x0037 |
415 | #define SR5 5 | 513 | #define PV_POWER4p 0x0038 |
416 | #define SR6 6 | 514 | #define PV_970 0x0039 |
417 | #define SR7 7 | 515 | #define PV_POWER5 0x003A |
418 | #define SR8 8 | 516 | #define PV_POWER5p 0x003B |
419 | #define SR9 9 | 517 | #define PV_970FX 0x003C |
420 | #define SR10 10 | 518 | #define PV_630 0x0040 |
421 | #define SR11 11 | 519 | #define PV_630p 0x0041 |
422 | #define SR12 12 | 520 | #define PV_970MP 0x0044 |
423 | #define SR13 13 | 521 | #define PV_BE 0x0070 |
424 | #define SR14 14 | 522 | |
425 | #define SR15 15 | 523 | /* |
426 | #endif | 524 | * Number of entries in the SLB. If this ever changes we should handle |
525 | * it with a use a cpu feature fixup. | ||
526 | */ | ||
527 | #define SLB_NUM_ENTRIES 64 | ||
427 | 528 | ||
428 | /* Macros for setting and retrieving special purpose registers */ | 529 | /* Macros for setting and retrieving special purpose registers */ |
429 | #ifndef __ASSEMBLY__ | 530 | #ifndef __ASSEMBLY__ |
430 | #define mfmsr() ({unsigned int rval; \ | 531 | #define mfmsr() ({unsigned long rval; \ |
431 | asm volatile("mfmsr %0" : "=r" (rval)); rval;}) | 532 | asm volatile("mfmsr %0" : "=r" (rval)); rval;}) |
533 | #ifdef CONFIG_PPC64 | ||
534 | #define __mtmsrd(v, l) asm volatile("mtmsrd %0," __stringify(l) \ | ||
535 | : : "r" (v)) | ||
536 | #define mtmsrd(v) __mtmsrd((v), 0) | ||
537 | #else | ||
432 | #define mtmsr(v) asm volatile("mtmsr %0" : : "r" (v)) | 538 | #define mtmsr(v) asm volatile("mtmsr %0" : : "r" (v)) |
539 | #endif | ||
433 | 540 | ||
434 | #define mfspr(rn) ({unsigned int rval; \ | 541 | #define mfspr(rn) ({unsigned long rval; \ |
435 | asm volatile("mfspr %0," __stringify(rn) \ | 542 | asm volatile("mfspr %0," __stringify(rn) \ |
436 | : "=r" (rval)); rval;}) | 543 | : "=r" (rval)); rval;}) |
437 | #define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v)) | 544 | #define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v)) |
438 | 545 | ||
546 | #define mftb() ({unsigned long rval; \ | ||
547 | asm volatile("mftb %0" : "=r" (rval)); rval;}) | ||
548 | #define mftbl() ({unsigned long rval; \ | ||
549 | asm volatile("mftbl %0" : "=r" (rval)); rval;}) | ||
550 | |||
551 | #define mttbl(v) asm volatile("mttbl %0":: "r"(v)) | ||
552 | #define mttbu(v) asm volatile("mttbu %0":: "r"(v)) | ||
553 | |||
554 | #ifdef CONFIG_PPC32 | ||
439 | #define mfsrin(v) ({unsigned int rval; \ | 555 | #define mfsrin(v) ({unsigned int rval; \ |
440 | asm volatile("mfsrin %0,%1" : "=r" (rval) : "r" (v)); \ | 556 | asm volatile("mfsrin %0,%1" : "=r" (rval) : "r" (v)); \ |
441 | rval;}) | 557 | rval;}) |
558 | #endif | ||
442 | 559 | ||
443 | #define proc_trap() asm volatile("trap") | 560 | #define proc_trap() asm volatile("trap") |
561 | |||
562 | #ifdef CONFIG_PPC64 | ||
563 | static inline void ppc64_runlatch_on(void) | ||
564 | { | ||
565 | unsigned long ctrl; | ||
566 | |||
567 | if (cpu_has_feature(CPU_FTR_CTRL)) { | ||
568 | ctrl = mfspr(SPRN_CTRLF); | ||
569 | ctrl |= CTRL_RUNLATCH; | ||
570 | mtspr(SPRN_CTRLT, ctrl); | ||
571 | } | ||
572 | } | ||
573 | |||
574 | static inline void ppc64_runlatch_off(void) | ||
575 | { | ||
576 | unsigned long ctrl; | ||
577 | |||
578 | if (cpu_has_feature(CPU_FTR_CTRL)) { | ||
579 | ctrl = mfspr(SPRN_CTRLF); | ||
580 | ctrl &= ~CTRL_RUNLATCH; | ||
581 | mtspr(SPRN_CTRLT, ctrl); | ||
582 | } | ||
583 | } | ||
584 | |||
585 | static inline void set_tb(unsigned int upper, unsigned int lower) | ||
586 | { | ||
587 | mttbl(0); | ||
588 | mttbu(upper); | ||
589 | mttbl(lower); | ||
590 | } | ||
591 | #endif | ||
592 | |||
593 | #define __get_SP() ({unsigned long sp; \ | ||
594 | asm volatile("mr %0,1": "=r" (sp)); sp;}) | ||
595 | |||
596 | #else /* __ASSEMBLY__ */ | ||
597 | |||
598 | #define RUNLATCH_ON(REG) \ | ||
599 | BEGIN_FTR_SECTION \ | ||
600 | mfspr (REG),SPRN_CTRLF; \ | ||
601 | ori (REG),(REG),CTRL_RUNLATCH; \ | ||
602 | mtspr SPRN_CTRLT,(REG); \ | ||
603 | END_FTR_SECTION_IFSET(CPU_FTR_CTRL) | ||
604 | |||
444 | #endif /* __ASSEMBLY__ */ | 605 | #endif /* __ASSEMBLY__ */ |
445 | #endif /* __KERNEL__ */ | 606 | #endif /* __KERNEL__ */ |
446 | #endif /* _ASM_POWERPC_REGS_H */ | 607 | #endif /* _ASM_POWERPC_REG_H */ |