diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2013-02-21 06:51:33 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-02-21 06:51:33 -0500 |
commit | 8bfc245f9ad7bd4e461179e4e7852ef99b8b6144 (patch) | |
tree | 0ad091f645fbc8318634599d278966a53d3922ee /arch/mips/include/asm/netlogic/mips-extns.h | |
parent | 612663a974065c3445e641d046769fe4c55a6438 (diff) | |
parent | 535237cecab2b078114be712c67e89a0db61965f (diff) |
Merge branch 'mips-next-3.9' of git://git.linux-mips.org/pub/scm/john/linux-john into mips-for-linux-next
Diffstat (limited to 'arch/mips/include/asm/netlogic/mips-extns.h')
-rw-r--r-- | arch/mips/include/asm/netlogic/mips-extns.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/arch/mips/include/asm/netlogic/mips-extns.h b/arch/mips/include/asm/netlogic/mips-extns.h index 8ffae43107e6..8ad2e0f81719 100644 --- a/arch/mips/include/asm/netlogic/mips-extns.h +++ b/arch/mips/include/asm/netlogic/mips-extns.h | |||
@@ -68,6 +68,85 @@ do { \ | |||
68 | __write_64bit_c0_register($9, 7, (val)); \ | 68 | __write_64bit_c0_register($9, 7, (val)); \ |
69 | } while (0) | 69 | } while (0) |
70 | 70 | ||
71 | /* | ||
72 | * Handling the 64 bit EIMR and EIRR registers in 32-bit mode with | ||
73 | * standard functions will be very inefficient. This provides | ||
74 | * optimized functions for the normal operations on the registers. | ||
75 | * | ||
76 | * Call with interrupts disabled. | ||
77 | */ | ||
78 | static inline void ack_c0_eirr(int irq) | ||
79 | { | ||
80 | __asm__ __volatile__( | ||
81 | ".set push\n\t" | ||
82 | ".set mips64\n\t" | ||
83 | ".set noat\n\t" | ||
84 | "li $1, 1\n\t" | ||
85 | "dsllv $1, $1, %0\n\t" | ||
86 | "dmtc0 $1, $9, 6\n\t" | ||
87 | ".set pop" | ||
88 | : : "r" (irq)); | ||
89 | } | ||
90 | |||
91 | static inline void set_c0_eimr(int irq) | ||
92 | { | ||
93 | __asm__ __volatile__( | ||
94 | ".set push\n\t" | ||
95 | ".set mips64\n\t" | ||
96 | ".set noat\n\t" | ||
97 | "li $1, 1\n\t" | ||
98 | "dsllv %0, $1, %0\n\t" | ||
99 | "dmfc0 $1, $9, 7\n\t" | ||
100 | "or $1, %0\n\t" | ||
101 | "dmtc0 $1, $9, 7\n\t" | ||
102 | ".set pop" | ||
103 | : "+r" (irq)); | ||
104 | } | ||
105 | |||
106 | static inline void clear_c0_eimr(int irq) | ||
107 | { | ||
108 | __asm__ __volatile__( | ||
109 | ".set push\n\t" | ||
110 | ".set mips64\n\t" | ||
111 | ".set noat\n\t" | ||
112 | "li $1, 1\n\t" | ||
113 | "dsllv %0, $1, %0\n\t" | ||
114 | "dmfc0 $1, $9, 7\n\t" | ||
115 | "or $1, %0\n\t" | ||
116 | "xor $1, %0\n\t" | ||
117 | "dmtc0 $1, $9, 7\n\t" | ||
118 | ".set pop" | ||
119 | : "+r" (irq)); | ||
120 | } | ||
121 | |||
122 | /* | ||
123 | * Read c0 eimr and c0 eirr, do AND of the two values, the result is | ||
124 | * the interrupts which are raised and are not masked. | ||
125 | */ | ||
126 | static inline uint64_t read_c0_eirr_and_eimr(void) | ||
127 | { | ||
128 | uint64_t val; | ||
129 | |||
130 | #ifdef CONFIG_64BIT | ||
131 | val = read_c0_eimr() & read_c0_eirr(); | ||
132 | #else | ||
133 | __asm__ __volatile__( | ||
134 | ".set push\n\t" | ||
135 | ".set mips64\n\t" | ||
136 | ".set noat\n\t" | ||
137 | "dmfc0 %M0, $9, 6\n\t" | ||
138 | "dmfc0 %L0, $9, 7\n\t" | ||
139 | "and %M0, %L0\n\t" | ||
140 | "dsll %L0, %M0, 32\n\t" | ||
141 | "dsra %M0, %M0, 32\n\t" | ||
142 | "dsra %L0, %L0, 32\n\t" | ||
143 | ".set pop" | ||
144 | : "=r" (val)); | ||
145 | #endif | ||
146 | |||
147 | return val; | ||
148 | } | ||
149 | |||
71 | static inline int hard_smp_processor_id(void) | 150 | static inline int hard_smp_processor_id(void) |
72 | { | 151 | { |
73 | return __read_32bit_c0_register($15, 1) & 0x3ff; | 152 | return __read_32bit_c0_register($15, 1) & 0x3ff; |