14 #include <linux/sched.h>
15 #include <linux/module.h>
17 #include <asm/mmu_context.h>
19 #include <asm/setup.h>
29 #ifdef CONFIG_HOTPLUG_CPU
36 const int coreid = cvmx_get_core_num();
40 action = cvmx_read_csr(CVMX_CIU_MBOX_CLRX(coreid)) & 0xffff;
43 cvmx_write_csr(CVMX_CIU_MBOX_CLRX(coreid), action);
52 asm volatile (
"synci 0($0)\n");
68 cvmx_write_csr(CVMX_CIU_MBOX_SETX(coreid), action);
71 static inline void octeon_send_ipi_mask(
const struct cpumask *
mask,
83 static
void octeon_smp_hotplug_setup(
void)
85 #ifdef CONFIG_HOTPLUG_CPU
90 panic(
"The bootloader version on this board is incorrect.");
96 static void octeon_smp_setup(
void)
98 const int coreid = cvmx_get_core_num();
102 #ifdef CONFIG_HOTPLUG_CPU
103 unsigned int num_cores = cvmx_octeon_num_cores();
107 for (
id = 0;
id <
NR_CPUS;
id++) {
117 for (
id = 0;
id <
NR_CPUS;
id++) {
118 if ((
id != coreid) && (core_mask & (1 <<
id))) {
127 #ifdef CONFIG_HOTPLUG_CPU
133 for (
id = 0;
id < num_cores &&
id <
NR_CPUS;
id++) {
134 if (!(core_mask & (1 <<
id))) {
143 octeon_smp_hotplug_setup();
154 pr_info(
"SMP: Booting CPU%02d (CoreId %2d)...\n", cpu,
169 pr_err(
"Secondary boot timeout\n");
176 static void __cpuinit octeon_init_secondary(
void)
196 #ifdef CONFIG_HOTPLUG_CPU
202 panic(
"The bootloader version on this board is incorrect.");
208 cvmx_write_csr(CVMX_CIU_MBOX_CLRX(cvmx_get_core_num()), 0xffff);
211 mailbox_interrupt)) {
212 panic(
"Cannot request_irq(OCTEON_IRQ_MBOX0)");
220 static void octeon_smp_finish(
void)
222 #ifdef CONFIG_CAVIUM_GDB
227 asm volatile (
"dmfc0 %0, $22\n"
228 "ori %0, %0, 0x9100\n" "dmtc0 %0, $22\n" :
"=r" (
tmp));
241 static void octeon_cpus_done(
void)
243 #ifdef CONFIG_CAVIUM_GDB
248 asm volatile (
"dmfc0 %0, $22\n"
249 "ori %0, %0, 0x9100\n" "dmtc0 %0, $22\n" :
"=r" (
tmp));
253 #ifdef CONFIG_HOTPLUG_CPU
260 static int octeon_cpu_disable(
void)
279 static void octeon_cpu_die(
unsigned int cpu)
311 pr_info(
"Reset core %d. Available Coremask = 0x%x \n", coreid, new_mask);
331 extern void kernel_entry(
unsigned long arg1, ...);
333 static void start_after_reset(
void)
335 kernel_entry(0, 0, 0);
338 static int octeon_update_boot_vector(
unsigned int cpu)
361 if (!(avail_coremask & (1 << coreid))) {
368 (
uint32_t) (
unsigned long) start_after_reset;
373 cvmx_write_csr(
CVMX_CIU_NMI, (1 << coreid) & avail_coremask);
379 unsigned long action,
void *hcpu)
381 unsigned int cpu = (
unsigned long)hcpu;
385 octeon_update_boot_vector(cpu);
388 pr_info(
"Cpu %d online\n", cpu);
397 static int __cpuinit register_cavium_notifier(
void)
408 .send_ipi_mask = octeon_send_ipi_mask,
409 .init_secondary = octeon_init_secondary,
410 .smp_finish = octeon_smp_finish,
411 .cpus_done = octeon_cpus_done,
412 .boot_secondary = octeon_boot_secondary,
413 .smp_setup = octeon_smp_setup,
415 #ifdef CONFIG_HOTPLUG_CPU
416 .cpu_disable = octeon_cpu_disable,
417 .cpu_die = octeon_cpu_die,