.. | .. |
---|
12 | 12 | #ifdef __KERNEL__ |
---|
13 | 13 | |
---|
14 | 14 | #include <linux/stringify.h> |
---|
| 15 | +#include <linux/const.h> |
---|
15 | 16 | #include <asm/cputable.h> |
---|
16 | 17 | #include <asm/asm-const.h> |
---|
17 | 18 | #include <asm/feature-fixups.h> |
---|
.. | .. |
---|
25 | 26 | #include <asm/reg_fsl_emb.h> |
---|
26 | 27 | #endif |
---|
27 | 28 | |
---|
28 | | -#ifdef CONFIG_PPC_8xx |
---|
29 | 29 | #include <asm/reg_8xx.h> |
---|
30 | | -#endif /* CONFIG_PPC_8xx */ |
---|
31 | 30 | |
---|
32 | 31 | #define MSR_SF_LG 63 /* Enable 64 bit mode */ |
---|
33 | 32 | #define MSR_ISF_LG 61 /* Interrupt 64b mode valid on 630 */ |
---|
.. | .. |
---|
38 | 37 | #define MSR_TM_LG 32 /* Trans Mem Available */ |
---|
39 | 38 | #define MSR_VEC_LG 25 /* Enable AltiVec */ |
---|
40 | 39 | #define MSR_VSX_LG 23 /* Enable VSX */ |
---|
| 40 | +#define MSR_S_LG 22 /* Secure state */ |
---|
41 | 41 | #define MSR_POW_LG 18 /* Enable Power Management */ |
---|
42 | 42 | #define MSR_WE_LG 18 /* Wait State Enable */ |
---|
43 | 43 | #define MSR_TGPR_LG 17 /* TLB Update registers in use */ |
---|
.. | .. |
---|
71 | 71 | #define MSR_SF __MASK(MSR_SF_LG) /* Enable 64 bit mode */ |
---|
72 | 72 | #define MSR_ISF __MASK(MSR_ISF_LG) /* Interrupt 64b mode valid on 630 */ |
---|
73 | 73 | #define MSR_HV __MASK(MSR_HV_LG) /* Hypervisor state */ |
---|
| 74 | +#define MSR_S __MASK(MSR_S_LG) /* Secure state */ |
---|
74 | 75 | #else |
---|
75 | 76 | /* so tests for these bits fail on 32-bit */ |
---|
76 | 77 | #define MSR_SF 0 |
---|
77 | 78 | #define MSR_ISF 0 |
---|
78 | 79 | #define MSR_HV 0 |
---|
| 80 | +#define MSR_S 0 |
---|
79 | 81 | #endif |
---|
80 | 82 | |
---|
81 | 83 | /* |
---|
.. | .. |
---|
168 | 170 | #define PSSCR_ESL 0x00200000 /* Enable State Loss */ |
---|
169 | 171 | #define PSSCR_SD 0x00400000 /* Status Disable */ |
---|
170 | 172 | #define PSSCR_PLS 0xf000000000000000 /* Power-saving Level Status */ |
---|
| 173 | +#define PSSCR_PLS_SHIFT 60 |
---|
171 | 174 | #define PSSCR_GUEST_VIS 0xf0000000000003ffUL /* Guest-visible PSSCR fields */ |
---|
172 | 175 | #define PSSCR_FAKE_SUSPEND 0x00000400 /* Fake-suspend bit (P9 DD2.2) */ |
---|
173 | 176 | #define PSSCR_FAKE_SUSPEND_LG 10 /* Fake-suspend bit position */ |
---|
.. | .. |
---|
281 | 284 | #define CTRL_CT1 0x40000000 /* thread 1 */ |
---|
282 | 285 | #define CTRL_TE 0x00c00000 /* thread enable */ |
---|
283 | 286 | #define CTRL_RUNLATCH 0x1 |
---|
284 | | -#define SPRN_DAWR 0xB4 |
---|
| 287 | +#define SPRN_DAWR0 0xB4 |
---|
| 288 | +#define SPRN_DAWR1 0xB5 |
---|
285 | 289 | #define SPRN_RPR 0xBA /* Relative Priority Register */ |
---|
286 | 290 | #define SPRN_CIABR 0xBB |
---|
287 | 291 | #define CIABR_PRIV 0x3 |
---|
288 | 292 | #define CIABR_PRIV_USER 1 |
---|
289 | 293 | #define CIABR_PRIV_SUPER 2 |
---|
290 | 294 | #define CIABR_PRIV_HYPER 3 |
---|
291 | | -#define SPRN_DAWRX 0xBC |
---|
| 295 | +#define SPRN_DAWRX0 0xBC |
---|
| 296 | +#define SPRN_DAWRX1 0xBD |
---|
292 | 297 | #define DAWRX_USER __MASK(0) |
---|
293 | 298 | #define DAWRX_KERNEL __MASK(1) |
---|
294 | 299 | #define DAWRX_HYP __MASK(2) |
---|
.. | .. |
---|
395 | 400 | #define SPRN_RWMR 0x375 /* Region-Weighting Mode Register */ |
---|
396 | 401 | |
---|
397 | 402 | /* HFSCR and FSCR bit numbers are the same */ |
---|
| 403 | +#define FSCR_PREFIX_LG 13 /* Enable Prefix Instructions */ |
---|
398 | 404 | #define FSCR_SCV_LG 12 /* Enable System Call Vectored */ |
---|
399 | 405 | #define FSCR_MSGP_LG 10 /* Enable MSGP */ |
---|
400 | 406 | #define FSCR_TAR_LG 8 /* Enable Target Address Register */ |
---|
.. | .. |
---|
406 | 412 | #define FSCR_VECVSX_LG 1 /* Enable VMX/VSX */ |
---|
407 | 413 | #define FSCR_FP_LG 0 /* Enable Floating Point */ |
---|
408 | 414 | #define SPRN_FSCR 0x099 /* Facility Status & Control Register */ |
---|
| 415 | +#define FSCR_PREFIX __MASK(FSCR_PREFIX_LG) |
---|
409 | 416 | #define FSCR_SCV __MASK(FSCR_SCV_LG) |
---|
410 | 417 | #define FSCR_TAR __MASK(FSCR_TAR_LG) |
---|
411 | 418 | #define FSCR_EBB __MASK(FSCR_EBB_LG) |
---|
412 | 419 | #define FSCR_DSCR __MASK(FSCR_DSCR_LG) |
---|
413 | 420 | #define SPRN_HFSCR 0xbe /* HV=1 Facility Status & Control Register */ |
---|
| 421 | +#define HFSCR_PREFIX __MASK(FSCR_PREFIX_LG) |
---|
414 | 422 | #define HFSCR_MSGP __MASK(FSCR_MSGP_LG) |
---|
415 | 423 | #define HFSCR_TAR __MASK(FSCR_TAR_LG) |
---|
416 | 424 | #define HFSCR_EBB __MASK(FSCR_EBB_LG) |
---|
.. | .. |
---|
420 | 428 | #define HFSCR_DSCR __MASK(FSCR_DSCR_LG) |
---|
421 | 429 | #define HFSCR_VECVSX __MASK(FSCR_VECVSX_LG) |
---|
422 | 430 | #define HFSCR_FP __MASK(FSCR_FP_LG) |
---|
| 431 | +#define HFSCR_INTR_CAUSE (ASM_CONST(0xFF) << 56) /* interrupt cause */ |
---|
423 | 432 | #define SPRN_TAR 0x32f /* Target Address Register */ |
---|
424 | 433 | #define SPRN_LPCR 0x13E /* LPAR Control Register */ |
---|
425 | 434 | #define LPCR_VPM0 ASM_CONST(0x8000000000000000) |
---|
.. | .. |
---|
435 | 444 | #define LPCR_VRMA_LP1 ASM_CONST(0x0000800000000000) |
---|
436 | 445 | #define LPCR_RMLS 0x1C000000 /* Implementation dependent RMO limit sel */ |
---|
437 | 446 | #define LPCR_RMLS_SH 26 |
---|
| 447 | +#define LPCR_HAIL ASM_CONST(0x0000000004000000) /* HV AIL (ISAv3.1) */ |
---|
438 | 448 | #define LPCR_ILE ASM_CONST(0x0000000002000000) /* !HV irqs set MSR:LE */ |
---|
439 | 449 | #define LPCR_AIL ASM_CONST(0x0000000001800000) /* Alternate interrupt location */ |
---|
440 | 450 | #define LPCR_AIL_0 ASM_CONST(0x0000000000000000) /* MMU off exception offset 0x0 */ |
---|
.. | .. |
---|
465 | 475 | #ifndef SPRN_LPID |
---|
466 | 476 | #define SPRN_LPID 0x13F /* Logical Partition Identifier */ |
---|
467 | 477 | #endif |
---|
468 | | -#define LPID_RSVD 0x3ff /* Reserved LPID for partn switching */ |
---|
| 478 | +#define LPID_RSVD_POWER7 0x3ff /* Reserved LPID for partn switching */ |
---|
| 479 | +#define LPID_RSVD 0xfff /* Reserved LPID for partn switching */ |
---|
469 | 480 | #define SPRN_HMER 0x150 /* Hypervisor maintenance exception reg */ |
---|
470 | 481 | #define HMER_DEBUG_TRIG (1ul << (63 - 17)) /* Debug trigger */ |
---|
471 | 482 | #define SPRN_HMEER 0x151 /* Hyp maintenance exception enable reg */ |
---|
472 | 483 | #define SPRN_PCR 0x152 /* Processor compatibility register */ |
---|
473 | | -#define PCR_VEC_DIS (1ul << (63-0)) /* Vec. disable (bit NA since POWER8) */ |
---|
474 | | -#define PCR_VSX_DIS (1ul << (63-1)) /* VSX disable (bit NA since POWER8) */ |
---|
475 | | -#define PCR_TM_DIS (1ul << (63-2)) /* Trans. memory disable (POWER8) */ |
---|
| 484 | +#define PCR_VEC_DIS (__MASK(63-0)) /* Vec. disable (bit NA since POWER8) */ |
---|
| 485 | +#define PCR_VSX_DIS (__MASK(63-1)) /* VSX disable (bit NA since POWER8) */ |
---|
| 486 | +#define PCR_TM_DIS (__MASK(63-2)) /* Trans. memory disable (POWER8) */ |
---|
| 487 | +#define PCR_MMA_DIS (__MASK(63-3)) /* Matrix-Multiply Accelerator */ |
---|
| 488 | +#define PCR_HIGH_BITS (PCR_MMA_DIS | PCR_VEC_DIS | PCR_VSX_DIS | PCR_TM_DIS) |
---|
476 | 489 | /* |
---|
477 | 490 | * These bits are used in the function kvmppc_set_arch_compat() to specify and |
---|
478 | 491 | * determine both the compatibility level which we want to emulate and the |
---|
479 | 492 | * compatibility level which the host is capable of emulating. |
---|
480 | 493 | */ |
---|
| 494 | +#define PCR_ARCH_300 0x10 /* Architecture 3.00 */ |
---|
481 | 495 | #define PCR_ARCH_207 0x8 /* Architecture 2.07 */ |
---|
482 | 496 | #define PCR_ARCH_206 0x4 /* Architecture 2.06 */ |
---|
483 | 497 | #define PCR_ARCH_205 0x2 /* Architecture 2.05 */ |
---|
| 498 | +#define PCR_LOW_BITS (PCR_ARCH_207 | PCR_ARCH_206 | PCR_ARCH_205 | PCR_ARCH_300) |
---|
| 499 | +#define PCR_MASK ~(PCR_HIGH_BITS | PCR_LOW_BITS) /* PCR Reserved Bits */ |
---|
484 | 500 | #define SPRN_HEIR 0x153 /* Hypervisor Emulated Instruction Register */ |
---|
485 | 501 | #define SPRN_TLBINDEXR 0x154 /* P7 TLB control register */ |
---|
486 | 502 | #define SPRN_TLBVPNR 0x155 /* P7 TLB control register */ |
---|
.. | .. |
---|
506 | 522 | #define SPRN_TSCR 0x399 /* Thread Switch Control Register */ |
---|
507 | 523 | |
---|
508 | 524 | #define SPRN_DEC 0x016 /* Decrement Register */ |
---|
| 525 | +#define SPRN_PIT 0x3DB /* Programmable Interval Timer (40x/BOOKE) */ |
---|
| 526 | + |
---|
509 | 527 | #define SPRN_DER 0x095 /* Debug Enable Register */ |
---|
510 | 528 | #define DER_RSTE 0x40000000 /* Reset Interrupt */ |
---|
511 | 529 | #define DER_CHSTPE 0x20000000 /* Check Stop */ |
---|
.. | .. |
---|
581 | 599 | #define HID0_POWER9_RADIX __MASK(63 - 8) |
---|
582 | 600 | |
---|
583 | 601 | #define SPRN_HID1 0x3F1 /* Hardware Implementation Register 1 */ |
---|
584 | | -#ifdef CONFIG_6xx |
---|
| 602 | +#ifdef CONFIG_PPC_BOOK3S_32 |
---|
585 | 603 | #define HID1_EMCP (1<<31) /* 7450 Machine Check Pin Enable */ |
---|
586 | 604 | #define HID1_DFS (1<<22) /* 7447A Dynamic Frequency Scaling */ |
---|
587 | 605 | #define HID1_PC0 (1<<16) /* 7450 PLL_CFG[0] */ |
---|
.. | .. |
---|
740 | 758 | #define SPRN_USPRG7 0x107 /* SPRG7 userspace read */ |
---|
741 | 759 | #define SPRN_SRR0 0x01A /* Save/Restore Register 0 */ |
---|
742 | 760 | #define SPRN_SRR1 0x01B /* Save/Restore Register 1 */ |
---|
| 761 | + |
---|
| 762 | +#ifdef CONFIG_PPC_BOOK3S |
---|
| 763 | +/* |
---|
| 764 | + * Bits loaded from MSR upon interrupt. |
---|
| 765 | + * PPC (64-bit) bits 33-36,42-47 are interrupt dependent, the others are |
---|
| 766 | + * loaded from MSR. The exception is that SRESET and MCE do not always load |
---|
| 767 | + * bit 62 (RI) from MSR. Don't use PPC_BITMASK for this because 32-bit uses |
---|
| 768 | + * it. |
---|
| 769 | + */ |
---|
| 770 | +#define SRR1_MSR_BITS (~0x783f0000UL) |
---|
| 771 | +#endif |
---|
| 772 | + |
---|
743 | 773 | #define SRR1_ISI_NOPT 0x40000000 /* ISI: Not found in hash */ |
---|
744 | | -#define SRR1_ISI_N_OR_G 0x10000000 /* ISI: Access is no-exec or G */ |
---|
| 774 | +#define SRR1_ISI_N_G_OR_CIP 0x10000000 /* ISI: Access is no-exec or G or CI for a prefixed instruction */ |
---|
745 | 775 | #define SRR1_ISI_PROT 0x08000000 /* ISI: Other protection fault */ |
---|
746 | 776 | #define SRR1_WAKEMASK 0x00380000 /* reason for wakeup */ |
---|
747 | 777 | #define SRR1_WAKEMASK_P8 0x003c0000 /* reason for wakeup on POWER8 and 9 */ |
---|
.. | .. |
---|
757 | 787 | #define SRR1_WAKERESET 0x00100000 /* System reset */ |
---|
758 | 788 | #define SRR1_WAKEHDBELL 0x000c0000 /* Hypervisor doorbell on P8 */ |
---|
759 | 789 | #define SRR1_WAKESTATE 0x00030000 /* Powersave exit mask [46:47] */ |
---|
760 | | -#define SRR1_WS_DEEPEST 0x00030000 /* Some resources not maintained, |
---|
761 | | - * may not be recoverable */ |
---|
762 | | -#define SRR1_WS_DEEPER 0x00020000 /* Some resources not maintained */ |
---|
763 | | -#define SRR1_WS_DEEP 0x00010000 /* All resources maintained */ |
---|
| 790 | +#define SRR1_WS_HVLOSS 0x00030000 /* HV resources not maintained */ |
---|
| 791 | +#define SRR1_WS_GPRLOSS 0x00020000 /* GPRs not maintained */ |
---|
| 792 | +#define SRR1_WS_NOLOSS 0x00010000 /* All resources maintained */ |
---|
764 | 793 | #define SRR1_PROGTM 0x00200000 /* TM Bad Thing */ |
---|
765 | 794 | #define SRR1_PROGFPE 0x00100000 /* Floating Point Enabled */ |
---|
766 | 795 | #define SRR1_PROGILL 0x00080000 /* Illegal instruction */ |
---|
.. | .. |
---|
769 | 798 | #define SRR1_PROGADDR 0x00010000 /* SRR0 contains subsequent addr */ |
---|
770 | 799 | |
---|
771 | 800 | #define SRR1_MCE_MCP 0x00080000 /* Machine check signal caused interrupt */ |
---|
| 801 | +#define SRR1_BOUNDARY 0x10000000 /* Prefixed instruction crosses 64-byte boundary */ |
---|
| 802 | +#define SRR1_PREFIXED 0x20000000 /* Exception caused by prefixed instruction */ |
---|
772 | 803 | |
---|
773 | 804 | #define SPRN_HSRR0 0x13A /* Save/Restore Register 0 */ |
---|
774 | 805 | #define SPRN_HSRR1 0x13B /* Save/Restore Register 1 */ |
---|
775 | 806 | #define HSRR1_DENORM 0x00100000 /* Denorm exception */ |
---|
| 807 | +#define HSRR1_HISI_WRITE 0x00010000 /* HISI bcs couldn't update mem */ |
---|
776 | 808 | |
---|
777 | 809 | #define SPRN_TBCTL 0x35f /* PA6T Timebase control register */ |
---|
778 | 810 | #define TBCTL_FREEZE 0x0000000000000000ull /* Freeze all tbs */ |
---|
.. | .. |
---|
833 | 865 | #define MMCR0_BHRBA 0x00200000UL /* BHRB Access allowed in userspace */ |
---|
834 | 866 | #define MMCR0_EBE 0x00100000UL /* Event based branch enable */ |
---|
835 | 867 | #define MMCR0_PMCC 0x000c0000UL /* PMC control */ |
---|
| 868 | +#define MMCR0_PMCCEXT ASM_CONST(0x00000200) /* PMCCEXT control */ |
---|
836 | 869 | #define MMCR0_PMCC_U6 0x00080000UL /* PMC1-6 are R/W by user (PR) */ |
---|
837 | 870 | #define MMCR0_PMC1CE 0x00008000UL /* PMC1 count enable*/ |
---|
838 | 871 | #define MMCR0_PMCjCE ASM_CONST(0x00004000) /* PMCj count enable*/ |
---|
.. | .. |
---|
849 | 882 | #define MMCR0_FCHV 0x00000001UL /* freeze conditions in hypervisor mode */ |
---|
850 | 883 | #define SPRN_MMCR1 798 |
---|
851 | 884 | #define SPRN_MMCR2 785 |
---|
| 885 | +#define SPRN_MMCR3 754 |
---|
852 | 886 | #define SPRN_UMMCR2 769 |
---|
| 887 | +#define SPRN_UMMCR3 738 |
---|
853 | 888 | #define SPRN_MMCRA 0x312 |
---|
854 | 889 | #define MMCRA_SDSYNC 0x80000000UL /* SDAR synced with SIAR */ |
---|
855 | 890 | #define MMCRA_SDAR_DCACHE_MISS 0x40000000UL |
---|
.. | .. |
---|
859 | 894 | #define MMCRA_SLOT 0x07000000UL /* SLOT bits (37-39) */ |
---|
860 | 895 | #define MMCRA_SLOT_SHIFT 24 |
---|
861 | 896 | #define MMCRA_SAMPLE_ENABLE 0x00000001UL /* enable sampling */ |
---|
| 897 | +#define MMCRA_BHRB_DISABLE _UL(0x2000000000) // BHRB disable bit for ISA v3.1 |
---|
862 | 898 | #define POWER6_MMCRA_SDSYNC 0x0000080000000000ULL /* SDAR/SIAR synced */ |
---|
863 | 899 | #define POWER6_MMCRA_SIHV 0x0000040000000000ULL |
---|
864 | 900 | #define POWER6_MMCRA_SIPR 0x0000020000000000ULL |
---|
.. | .. |
---|
891 | 927 | #define SIER_SIHV 0x1000000 /* Sampled MSR_HV */ |
---|
892 | 928 | #define SIER_SIAR_VALID 0x0400000 /* SIAR contents valid */ |
---|
893 | 929 | #define SIER_SDAR_VALID 0x0200000 /* SDAR contents valid */ |
---|
| 930 | +#define SPRN_SIER2 752 |
---|
| 931 | +#define SPRN_SIER3 753 |
---|
| 932 | +#define SPRN_USIER2 736 |
---|
| 933 | +#define SPRN_USIER3 737 |
---|
894 | 934 | #define SPRN_SIAR 796 |
---|
895 | 935 | #define SPRN_SDAR 797 |
---|
896 | 936 | #define SPRN_TACR 888 |
---|
.. | .. |
---|
1060 | 1100 | * - SPRG9 debug exception scratch |
---|
1061 | 1101 | * |
---|
1062 | 1102 | * All 32-bit: |
---|
1063 | | - * - SPRG3 current thread_info pointer |
---|
| 1103 | + * - SPRG3 current thread_struct physical addr pointer |
---|
1064 | 1104 | * (virtual on BookE, physical on others) |
---|
1065 | 1105 | * |
---|
1066 | 1106 | * 32-bit classic: |
---|
.. | .. |
---|
1165 | 1205 | #ifdef CONFIG_PPC_BOOK3S_32 |
---|
1166 | 1206 | #define SPRN_SPRG_SCRATCH0 SPRN_SPRG0 |
---|
1167 | 1207 | #define SPRN_SPRG_SCRATCH1 SPRN_SPRG1 |
---|
1168 | | -#define SPRN_SPRG_RTAS SPRN_SPRG2 |
---|
| 1208 | +#define SPRN_SPRG_PGDIR SPRN_SPRG2 |
---|
1169 | 1209 | #define SPRN_SPRG_603_LRU SPRN_SPRG4 |
---|
1170 | 1210 | #endif |
---|
1171 | 1211 | |
---|
.. | .. |
---|
1317 | 1357 | #define PVR_POWER8NVL 0x004C |
---|
1318 | 1358 | #define PVR_POWER8 0x004D |
---|
1319 | 1359 | #define PVR_POWER9 0x004E |
---|
| 1360 | +#define PVR_POWER10 0x0080 |
---|
1320 | 1361 | #define PVR_BE 0x0070 |
---|
1321 | 1362 | #define PVR_PA6T 0x0090 |
---|
1322 | 1363 | |
---|
.. | .. |
---|
1327 | 1368 | #define PVR_ARCH_206p 0x0f100003 |
---|
1328 | 1369 | #define PVR_ARCH_207 0x0f000004 |
---|
1329 | 1370 | #define PVR_ARCH_300 0x0f000005 |
---|
| 1371 | +#define PVR_ARCH_31 0x0f000006 |
---|
1330 | 1372 | |
---|
1331 | 1373 | /* Macros for setting and retrieving special purpose registers */ |
---|
1332 | 1374 | #ifndef __ASSEMBLY__ |
---|
.. | .. |
---|
1362 | 1404 | #define wrtspr(rn) asm volatile("mtspr " __stringify(rn) ",0" : \ |
---|
1363 | 1405 | : : "memory") |
---|
1364 | 1406 | |
---|
| 1407 | +static inline void wrtee(unsigned long val) |
---|
| 1408 | +{ |
---|
| 1409 | + if (__builtin_constant_p(val)) |
---|
| 1410 | + asm volatile("wrteei %0" : : "i" ((val & MSR_EE) ? 1 : 0) : "memory"); |
---|
| 1411 | + else |
---|
| 1412 | + asm volatile("wrtee %0" : : "r" (val) : "memory"); |
---|
| 1413 | +} |
---|
| 1414 | + |
---|
1365 | 1415 | extern unsigned long msr_check_and_set(unsigned long bits); |
---|
1366 | 1416 | extern bool strict_msr_control; |
---|
1367 | 1417 | extern void __msr_check_and_clear(unsigned long bits); |
---|
.. | .. |
---|
1371 | 1421 | __msr_check_and_clear(bits); |
---|
1372 | 1422 | } |
---|
1373 | 1423 | |
---|
1374 | | -#ifdef __powerpc64__ |
---|
1375 | | -#if defined(CONFIG_PPC_CELL) || defined(CONFIG_PPC_FSL_BOOK3E) |
---|
| 1424 | +#if defined(CONFIG_PPC_CELL) || defined(CONFIG_E500) |
---|
1376 | 1425 | #define mftb() ({unsigned long rval; \ |
---|
1377 | 1426 | asm volatile( \ |
---|
1378 | 1427 | "90: mfspr %0, %2;\n" \ |
---|
1379 | | - "97: cmpwi %0,0;\n" \ |
---|
1380 | | - " beq- 90b;\n" \ |
---|
1381 | | - "99:\n" \ |
---|
1382 | | - ".section __ftr_fixup,\"a\"\n" \ |
---|
1383 | | - ".align 3\n" \ |
---|
1384 | | - "98:\n" \ |
---|
1385 | | - " .8byte %1\n" \ |
---|
1386 | | - " .8byte %1\n" \ |
---|
1387 | | - " .8byte 97b-98b\n" \ |
---|
1388 | | - " .8byte 99b-98b\n" \ |
---|
1389 | | - " .8byte 0\n" \ |
---|
1390 | | - " .8byte 0\n" \ |
---|
1391 | | - ".previous" \ |
---|
| 1428 | + ASM_FTR_IFSET( \ |
---|
| 1429 | + "97: cmpwi %0,0;\n" \ |
---|
| 1430 | + " beq- 90b;\n", "", %1) \ |
---|
1392 | 1431 | : "=r" (rval) \ |
---|
1393 | 1432 | : "i" (CPU_FTR_CELL_TB_BUG), "i" (SPRN_TBRL) : "cr0"); \ |
---|
1394 | 1433 | rval;}) |
---|
| 1434 | +#elif defined(CONFIG_PPC_8xx) |
---|
| 1435 | +#define mftb() ({unsigned long rval; \ |
---|
| 1436 | + asm volatile("mftbl %0" : "=r" (rval)); rval;}) |
---|
1395 | 1437 | #else |
---|
1396 | 1438 | #define mftb() ({unsigned long rval; \ |
---|
1397 | 1439 | asm volatile("mfspr %0, %1" : \ |
---|
1398 | 1440 | "=r" (rval) : "i" (SPRN_TBRL)); rval;}) |
---|
1399 | 1441 | #endif /* !CONFIG_PPC_CELL */ |
---|
1400 | 1442 | |
---|
1401 | | -#else /* __powerpc64__ */ |
---|
1402 | | - |
---|
1403 | 1443 | #if defined(CONFIG_PPC_8xx) |
---|
1404 | | -#define mftbl() ({unsigned long rval; \ |
---|
1405 | | - asm volatile("mftbl %0" : "=r" (rval)); rval;}) |
---|
1406 | 1444 | #define mftbu() ({unsigned long rval; \ |
---|
1407 | 1445 | asm volatile("mftbu %0" : "=r" (rval)); rval;}) |
---|
1408 | 1446 | #else |
---|
1409 | | -#define mftbl() ({unsigned long rval; \ |
---|
1410 | | - asm volatile("mfspr %0, %1" : "=r" (rval) : \ |
---|
1411 | | - "i" (SPRN_TBRL)); rval;}) |
---|
1412 | 1447 | #define mftbu() ({unsigned long rval; \ |
---|
1413 | 1448 | asm volatile("mfspr %0, %1" : "=r" (rval) : \ |
---|
1414 | 1449 | "i" (SPRN_TBRU)); rval;}) |
---|
1415 | 1450 | #endif |
---|
1416 | | -#define mftb() mftbl() |
---|
1417 | | -#endif /* !__powerpc64__ */ |
---|
1418 | 1451 | |
---|
1419 | 1452 | #define mttbl(v) asm volatile("mttbl %0":: "r"(v)) |
---|
1420 | 1453 | #define mttbu(v) asm volatile("mttbu %0":: "r"(v)) |
---|
.. | .. |
---|
1423 | 1456 | #define mfsrin(v) ({unsigned int rval; \ |
---|
1424 | 1457 | asm volatile("mfsrin %0,%1" : "=r" (rval) : "r" (v)); \ |
---|
1425 | 1458 | rval;}) |
---|
| 1459 | + |
---|
| 1460 | +static inline void mtsrin(u32 val, u32 idx) |
---|
| 1461 | +{ |
---|
| 1462 | + asm volatile("mtsrin %0, %1" : : "r" (val), "r" (idx)); |
---|
| 1463 | +} |
---|
1426 | 1464 | #endif |
---|
1427 | 1465 | |
---|
1428 | 1466 | #define proc_trap() asm volatile("trap") |
---|
1429 | 1467 | |
---|
1430 | | -extern unsigned long current_stack_pointer(void); |
---|
| 1468 | +extern unsigned long current_stack_frame(void); |
---|
| 1469 | + |
---|
| 1470 | +register unsigned long current_stack_pointer asm("r1"); |
---|
1431 | 1471 | |
---|
1432 | 1472 | extern unsigned long scom970_read(unsigned int address); |
---|
1433 | 1473 | extern void scom970_write(unsigned int address, unsigned long value); |
---|
.. | .. |
---|
1440 | 1480 | { |
---|
1441 | 1481 | /* |
---|
1442 | 1482 | * The HID0 update on Power8 should at the very least be |
---|
1443 | | - * preceded by a a SYNC instruction followed by an ISYNC |
---|
| 1483 | + * preceded by a SYNC instruction followed by an ISYNC |
---|
1444 | 1484 | * instruction |
---|
1445 | 1485 | */ |
---|
1446 | 1486 | asm volatile("sync; mtspr %0,%1; isync":: "i"(SPRN_HID0), "r"(hid0)); |
---|