Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 1 | /* |
| 2 | * sun4m SMP support. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) |
| 5 | */ |
| 6 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | #include <linux/interrupt.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | #include <linux/profile.h> |
Adrian Bunk | 6c81c32 | 2008-02-06 01:37:51 -0800 | [diff] [blame] | 9 | #include <linux/delay.h> |
Robert Reif | 4245e59 | 2008-10-12 20:52:26 -0700 | [diff] [blame] | 10 | #include <linux/cpu.h> |
Adrian Bunk | 6c81c32 | 2008-02-06 01:37:51 -0800 | [diff] [blame] | 11 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <asm/cacheflush.h> |
Sam Ravnborg | bde4d8b | 2012-03-30 15:53:50 +0200 | [diff] [blame] | 13 | #include <asm/switch_to.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <asm/tlbflush.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 16 | #include "irq.h" |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 17 | #include "kernel.h" |
Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 18 | |
Daniel Hellstrom | ecbc42b | 2011-05-02 00:08:53 +0000 | [diff] [blame] | 19 | #define IRQ_IPI_SINGLE 12 |
| 20 | #define IRQ_IPI_MASK 13 |
| 21 | #define IRQ_IPI_RESCHED 14 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #define IRQ_CROSS_CALL 15 |
| 23 | |
Wu Fengguang | 1a8a27c | 2009-01-07 18:09:10 -0800 | [diff] [blame] | 24 | static inline unsigned long |
| 25 | swap_ulong(volatile unsigned long *ptr, unsigned long val) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | { |
| 27 | __asm__ __volatile__("swap [%1], %0\n\t" : |
| 28 | "=&r" (val), "=&r" (ptr) : |
| 29 | "0" (val), "1" (ptr)); |
| 30 | return val; |
| 31 | } |
| 32 | |
Daniel Hellstrom | ecbc42b | 2011-05-02 00:08:53 +0000 | [diff] [blame] | 33 | static void smp4m_ipi_init(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | static void smp_setup_percpu_timer(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Bob Breuer | 92d452f | 2006-06-20 00:36:10 -0700 | [diff] [blame] | 36 | void __cpuinit smp4m_callin(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | { |
| 38 | int cpuid = hard_smp_processor_id(); |
| 39 | |
| 40 | local_flush_cache_all(); |
| 41 | local_flush_tlb_all(); |
| 42 | |
Manfred Spraul | e545a61 | 2008-09-07 16:57:22 +0200 | [diff] [blame] | 43 | notify_cpu_starting(cpuid); |
| 44 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | /* Get our local ticker going. */ |
| 46 | smp_setup_percpu_timer(); |
| 47 | |
| 48 | calibrate_delay(); |
| 49 | smp_store_cpu_info(cpuid); |
| 50 | |
| 51 | local_flush_cache_all(); |
| 52 | local_flush_tlb_all(); |
| 53 | |
| 54 | /* |
| 55 | * Unblock the master CPU _only_ when the scheduler state |
| 56 | * of all secondary CPUs will be up-to-date, so after |
| 57 | * the SMP initialization the master will be just allowed |
| 58 | * to call the scheduler code. |
| 59 | */ |
| 60 | /* Allow master to continue. */ |
Wu Fengguang | 1a8a27c | 2009-01-07 18:09:10 -0800 | [diff] [blame] | 61 | swap_ulong(&cpu_callin_map[cpuid], 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 63 | /* XXX: What's up with all the flushes? */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | local_flush_cache_all(); |
| 65 | local_flush_tlb_all(); |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 66 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | /* Fix idle thread fields. */ |
| 68 | __asm__ __volatile__("ld [%0], %%g6\n\t" |
| 69 | : : "r" (¤t_set[cpuid]) |
| 70 | : "memory" /* paranoid */); |
| 71 | |
| 72 | /* Attach to the address space of init_task. */ |
| 73 | atomic_inc(&init_mm.mm_count); |
| 74 | current->active_mm = &init_mm; |
| 75 | |
KOSAKI Motohiro | fb1fece | 2011-05-16 13:38:07 -0700 | [diff] [blame] | 76 | while (!cpumask_test_cpu(cpuid, &smp_commenced_mask)) |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 77 | mb(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | |
| 79 | local_irq_enable(); |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 80 | |
Rusty Russell | fe73971 | 2009-03-16 14:40:22 +1030 | [diff] [blame] | 81 | set_cpu_online(cpuid, true); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | } |
| 83 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | /* |
| 85 | * Cycle through the processors asking the PROM to start each one. |
| 86 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | void __init smp4m_boot_cpus(void) |
| 88 | { |
Daniel Hellstrom | ecbc42b | 2011-05-02 00:08:53 +0000 | [diff] [blame] | 89 | smp4m_ipi_init(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | smp_setup_percpu_timer(); |
| 91 | local_flush_cache_all(); |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 92 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | |
Thomas Gleixner | f0a2bc7 | 2012-04-20 13:05:56 +0000 | [diff] [blame^] | 94 | int __cpuinit smp4m_boot_one_cpu(int i, struct task_struct *idle) |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 95 | { |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 96 | unsigned long *entry = &sun4m_cpu_startup; |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 97 | int timeout; |
| 98 | int cpu_node; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 100 | cpu_find_by_mid(i, &cpu_node); |
Thomas Gleixner | f0a2bc7 | 2012-04-20 13:05:56 +0000 | [diff] [blame^] | 101 | current_set[i] = task_thread_info(idle); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 103 | /* See trampoline.S for details... */ |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 104 | entry += ((i - 1) * 3); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 106 | /* |
| 107 | * Initialize the contexts table |
| 108 | * Since the call to prom_startcpu() trashes the structure, |
| 109 | * we need to re-initialize it for each cpu |
| 110 | */ |
| 111 | smp_penguin_ctable.which_io = 0; |
| 112 | smp_penguin_ctable.phys_addr = (unsigned int) srmmu_ctx_table_phys; |
| 113 | smp_penguin_ctable.reg_size = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 115 | /* whirrr, whirrr, whirrrrrrrrr... */ |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 116 | printk(KERN_INFO "Starting CPU %d at %p\n", i, entry); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | local_flush_cache_all(); |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 118 | prom_startcpu(cpu_node, &smp_penguin_ctable, 0, (char *)entry); |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 119 | |
| 120 | /* wheee... it's going... */ |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 121 | for (timeout = 0; timeout < 10000; timeout++) { |
| 122 | if (cpu_callin_map[i]) |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 123 | break; |
| 124 | udelay(200); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | } |
| 126 | |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 127 | if (!(cpu_callin_map[i])) { |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 128 | printk(KERN_ERR "Processor %d is stuck.\n", i); |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 129 | return -ENODEV; |
| 130 | } |
| 131 | |
| 132 | local_flush_cache_all(); |
| 133 | return 0; |
| 134 | } |
| 135 | |
| 136 | void __init smp4m_smp_done(void) |
| 137 | { |
| 138 | int i, first; |
| 139 | int *prev; |
| 140 | |
| 141 | /* setup cpu list for irq rotation */ |
| 142 | first = 0; |
| 143 | prev = &first; |
Rusty Russell | ec7c14b | 2009-03-16 14:40:24 +1030 | [diff] [blame] | 144 | for_each_online_cpu(i) { |
| 145 | *prev = i; |
| 146 | prev = &cpu_data(i).next; |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 147 | } |
| 148 | *prev = first; |
| 149 | local_flush_cache_all(); |
| 150 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | /* Ok, they are spinning and ready to go. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | } |
| 153 | |
Daniel Hellstrom | ecbc42b | 2011-05-02 00:08:53 +0000 | [diff] [blame] | 154 | |
| 155 | /* Initialize IPIs on the SUN4M SMP machine */ |
| 156 | static void __init smp4m_ipi_init(void) |
| 157 | { |
| 158 | } |
| 159 | |
| 160 | static void smp4m_ipi_resched(int cpu) |
| 161 | { |
| 162 | set_cpu_int(cpu, IRQ_IPI_RESCHED); |
| 163 | } |
| 164 | |
| 165 | static void smp4m_ipi_single(int cpu) |
| 166 | { |
| 167 | set_cpu_int(cpu, IRQ_IPI_SINGLE); |
| 168 | } |
| 169 | |
| 170 | static void smp4m_ipi_mask_one(int cpu) |
| 171 | { |
| 172 | set_cpu_int(cpu, IRQ_IPI_MASK); |
| 173 | } |
| 174 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | static struct smp_funcall { |
| 176 | smpfunc_t func; |
| 177 | unsigned long arg1; |
| 178 | unsigned long arg2; |
| 179 | unsigned long arg3; |
| 180 | unsigned long arg4; |
| 181 | unsigned long arg5; |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 182 | unsigned long processors_in[SUN4M_NCPUS]; /* Set when ipi entered. */ |
| 183 | unsigned long processors_out[SUN4M_NCPUS]; /* Set when ipi exited. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | } ccall_info; |
| 185 | |
| 186 | static DEFINE_SPINLOCK(cross_call_lock); |
| 187 | |
| 188 | /* Cross calls must be serialized, at least currently. */ |
David S. Miller | 66e4f8c | 2008-08-27 20:03:22 -0700 | [diff] [blame] | 189 | static void smp4m_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1, |
Adrian Bunk | c61c65c | 2008-06-05 11:40:58 -0700 | [diff] [blame] | 190 | unsigned long arg2, unsigned long arg3, |
David S. Miller | 66e4f8c | 2008-08-27 20:03:22 -0700 | [diff] [blame] | 191 | unsigned long arg4) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | { |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 193 | register int ncpus = SUN4M_NCPUS; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | unsigned long flags; |
| 195 | |
| 196 | spin_lock_irqsave(&cross_call_lock, flags); |
| 197 | |
| 198 | /* Init function glue. */ |
| 199 | ccall_info.func = func; |
| 200 | ccall_info.arg1 = arg1; |
| 201 | ccall_info.arg2 = arg2; |
| 202 | ccall_info.arg3 = arg3; |
| 203 | ccall_info.arg4 = arg4; |
David S. Miller | 66e4f8c | 2008-08-27 20:03:22 -0700 | [diff] [blame] | 204 | ccall_info.arg5 = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | |
| 206 | /* Init receive/complete mapping, plus fire the IPI's off. */ |
| 207 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | register int i; |
| 209 | |
KOSAKI Motohiro | fb1fece | 2011-05-16 13:38:07 -0700 | [diff] [blame] | 210 | cpumask_clear_cpu(smp_processor_id(), &mask); |
| 211 | cpumask_and(&mask, cpu_online_mask, &mask); |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 212 | for (i = 0; i < ncpus; i++) { |
KOSAKI Motohiro | fb1fece | 2011-05-16 13:38:07 -0700 | [diff] [blame] | 213 | if (cpumask_test_cpu(i, &mask)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | ccall_info.processors_in[i] = 0; |
| 215 | ccall_info.processors_out[i] = 0; |
| 216 | set_cpu_int(i, IRQ_CROSS_CALL); |
| 217 | } else { |
| 218 | ccall_info.processors_in[i] = 1; |
| 219 | ccall_info.processors_out[i] = 1; |
| 220 | } |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | { |
| 225 | register int i; |
| 226 | |
| 227 | i = 0; |
| 228 | do { |
KOSAKI Motohiro | fb1fece | 2011-05-16 13:38:07 -0700 | [diff] [blame] | 229 | if (!cpumask_test_cpu(i, &mask)) |
David S. Miller | 66e4f8c | 2008-08-27 20:03:22 -0700 | [diff] [blame] | 230 | continue; |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 231 | while (!ccall_info.processors_in[i]) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | barrier(); |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 233 | } while (++i < ncpus); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | |
| 235 | i = 0; |
| 236 | do { |
KOSAKI Motohiro | fb1fece | 2011-05-16 13:38:07 -0700 | [diff] [blame] | 237 | if (!cpumask_test_cpu(i, &mask)) |
David S. Miller | 66e4f8c | 2008-08-27 20:03:22 -0700 | [diff] [blame] | 238 | continue; |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 239 | while (!ccall_info.processors_out[i]) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | barrier(); |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 241 | } while (++i < ncpus); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | spin_unlock_irqrestore(&cross_call_lock, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | /* Running cross calls. */ |
| 247 | void smp4m_cross_call_irq(void) |
| 248 | { |
| 249 | int i = smp_processor_id(); |
| 250 | |
| 251 | ccall_info.processors_in[i] = 1; |
| 252 | ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, |
| 253 | ccall_info.arg4, ccall_info.arg5); |
| 254 | ccall_info.processors_out[i] = 1; |
| 255 | } |
| 256 | |
| 257 | void smp4m_percpu_timer_interrupt(struct pt_regs *regs) |
| 258 | { |
Al Viro | 0d84438 | 2006-10-08 14:30:44 +0100 | [diff] [blame] | 259 | struct pt_regs *old_regs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | int cpu = smp_processor_id(); |
| 261 | |
Al Viro | 0d84438 | 2006-10-08 14:30:44 +0100 | [diff] [blame] | 262 | old_regs = set_irq_regs(regs); |
| 263 | |
David S. Miller | 1de937a | 2008-09-13 22:07:56 -0700 | [diff] [blame] | 264 | sun4m_clear_profile_irq(cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | |
Al Viro | 0d84438 | 2006-10-08 14:30:44 +0100 | [diff] [blame] | 266 | profile_tick(CPU_PROFILING); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 268 | if (!--prof_counter(cpu)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | int user = user_mode(regs); |
| 270 | |
| 271 | irq_enter(); |
| 272 | update_process_times(user); |
| 273 | irq_exit(); |
| 274 | |
| 275 | prof_counter(cpu) = prof_multiplier(cpu); |
| 276 | } |
Al Viro | 0d84438 | 2006-10-08 14:30:44 +0100 | [diff] [blame] | 277 | set_irq_regs(old_regs); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | } |
| 279 | |
Al Viro | 409832f | 2008-11-22 17:33:54 +0000 | [diff] [blame] | 280 | static void __cpuinit smp_setup_percpu_timer(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | { |
| 282 | int cpu = smp_processor_id(); |
| 283 | |
| 284 | prof_counter(cpu) = prof_multiplier(cpu) = 1; |
| 285 | load_profile_irq(cpu, lvl14_resolution); |
| 286 | |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 287 | if (cpu == boot_cpu_id) |
Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame] | 288 | sun4m_unmask_profile_irq(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | } |
| 290 | |
Adrian Bunk | c61c65c | 2008-06-05 11:40:58 -0700 | [diff] [blame] | 291 | static void __init smp4m_blackbox_id(unsigned *addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | { |
| 293 | int rd = *addr & 0x3e000000; |
| 294 | int rs1 = rd >> 11; |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 295 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | addr[0] = 0x81580000 | rd; /* rd %tbr, reg */ |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 297 | addr[1] = 0x8130200c | rd | rs1; /* srl reg, 0xc, reg */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | addr[2] = 0x80082003 | rd | rs1; /* and reg, 3, reg */ |
| 299 | } |
| 300 | |
Adrian Bunk | c61c65c | 2008-06-05 11:40:58 -0700 | [diff] [blame] | 301 | static void __init smp4m_blackbox_current(unsigned *addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | { |
| 303 | int rd = *addr & 0x3e000000; |
| 304 | int rs1 = rd >> 11; |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 305 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | addr[0] = 0x81580000 | rd; /* rd %tbr, reg */ |
Sam Ravnborg | aba20a8 | 2011-01-28 22:08:20 +0000 | [diff] [blame] | 307 | addr[2] = 0x8130200a | rd | rs1; /* srl reg, 0xa, reg */ |
David S. Miller | 4cad691 | 2007-04-30 17:59:50 -0700 | [diff] [blame] | 308 | addr[4] = 0x8008200c | rd | rs1; /* and reg, 0xc, reg */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | } |
| 310 | |
| 311 | void __init sun4m_init_smp(void) |
| 312 | { |
| 313 | BTFIXUPSET_BLACKBOX(hard_smp_processor_id, smp4m_blackbox_id); |
| 314 | BTFIXUPSET_BLACKBOX(load_current, smp4m_blackbox_current); |
| 315 | BTFIXUPSET_CALL(smp_cross_call, smp4m_cross_call, BTFIXUPCALL_NORM); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | BTFIXUPSET_CALL(__hard_smp_processor_id, __smp4m_processor_id, BTFIXUPCALL_NORM); |
Daniel Hellstrom | ecbc42b | 2011-05-02 00:08:53 +0000 | [diff] [blame] | 317 | BTFIXUPSET_CALL(smp_ipi_resched, smp4m_ipi_resched, BTFIXUPCALL_NORM); |
| 318 | BTFIXUPSET_CALL(smp_ipi_single, smp4m_ipi_single, BTFIXUPCALL_NORM); |
| 319 | BTFIXUPSET_CALL(smp_ipi_mask_one, smp4m_ipi_mask_one, BTFIXUPCALL_NORM); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | } |