platsmp.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright 2010-2011 Calxeda, Inc.
  3. * Based on platsmp.c, Copyright (C) 2002 ARM Ltd.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #include <linux/init.h>
  18. #include <linux/smp.h>
  19. #include <linux/io.h>
  20. #include <asm/smp_scu.h>
  21. #include "core.h"
  22. extern void secondary_startup(void);
  23. static int highbank_boot_secondary(unsigned int cpu, struct task_struct *idle)
  24. {
  25. highbank_set_cpu_jump(cpu, secondary_startup);
  26. arch_send_wakeup_ipi_mask(cpumask_of(cpu));
  27. return 0;
  28. }
  29. /*
  30. * Initialise the CPU possible map early - this describes the CPUs
  31. * which may be present or become present in the system.
  32. */
  33. static void __init highbank_smp_init_cpus(void)
  34. {
  35. unsigned int i, ncores = 4;
  36. /* sanity check */
  37. if (ncores > NR_CPUS) {
  38. printk(KERN_WARNING
  39. "highbank: no. of cores (%d) greater than configured "
  40. "maximum of %d - clipping\n",
  41. ncores, NR_CPUS);
  42. ncores = NR_CPUS;
  43. }
  44. for (i = 0; i < ncores; i++)
  45. set_cpu_possible(i, true);
  46. }
  47. static void __init highbank_smp_prepare_cpus(unsigned int max_cpus)
  48. {
  49. if (scu_base_addr)
  50. scu_enable(scu_base_addr);
  51. }
  52. struct smp_operations highbank_smp_ops __initdata = {
  53. .smp_init_cpus = highbank_smp_init_cpus,
  54. .smp_prepare_cpus = highbank_smp_prepare_cpus,
  55. .smp_boot_secondary = highbank_boot_secondary,
  56. #ifdef CONFIG_HOTPLUG_CPU
  57. .cpu_die = highbank_cpu_die,
  58. #endif
  59. };