beat_smp.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * SMP support for Celleb platform. (Incomplete)
  3. *
  4. * (C) Copyright 2006 TOSHIBA CORPORATION
  5. *
  6. * This code is based on arch/powerpc/platforms/cell/smp.c:
  7. * Dave Engebretsen, Peter Bergner, and
  8. * Mike Corrigan {engebret|bergner|mikec}@us.ibm.com
  9. * Plus various changes from other IBM teams...
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License along
  22. * with this program; if not, write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  24. */
  25. #undef DEBUG
  26. #include <linux/kernel.h>
  27. #include <linux/smp.h>
  28. #include <linux/interrupt.h>
  29. #include <linux/init.h>
  30. #include <linux/threads.h>
  31. #include <linux/cpu.h>
  32. #include <asm/irq.h>
  33. #include <asm/smp.h>
  34. #include <asm/machdep.h>
  35. #include <asm/udbg.h>
  36. #include "beat_interrupt.h"
  37. #ifdef DEBUG
  38. #define DBG(fmt...) udbg_printf(fmt)
  39. #else
  40. #define DBG(fmt...)
  41. #endif
  42. /*
  43. * The primary thread of each non-boot processor is recorded here before
  44. * smp init.
  45. */
  46. /* static cpumask_t of_spin_map; */
  47. /**
  48. * smp_startup_cpu() - start the given cpu
  49. *
  50. * At boot time, there is nothing to do for primary threads which were
  51. * started from Open Firmware. For anything else, call RTAS with the
  52. * appropriate start location.
  53. *
  54. * Returns:
  55. * 0 - failure
  56. * 1 - success
  57. */
  58. static inline int __devinit smp_startup_cpu(unsigned int lcpu)
  59. {
  60. return 0;
  61. }
  62. static int __init smp_beatic_probe(void)
  63. {
  64. return cpumask_weight(cpu_possible_mask);
  65. }
  66. static void __devinit smp_beatic_setup_cpu(int cpu)
  67. {
  68. beatic_setup_cpu(cpu);
  69. }
  70. static int __devinit smp_celleb_kick_cpu(int nr)
  71. {
  72. BUG_ON(nr < 0 || nr >= NR_CPUS);
  73. return smp_startup_cpu(nr);
  74. }
  75. static int smp_celleb_cpu_bootable(unsigned int nr)
  76. {
  77. return 1;
  78. }
  79. static struct smp_ops_t bpa_beatic_smp_ops = {
  80. .message_pass = beatic_cause_IPI,
  81. .probe = smp_beatic_probe,
  82. .kick_cpu = smp_celleb_kick_cpu,
  83. .setup_cpu = smp_beatic_setup_cpu,
  84. .cpu_bootable = smp_celleb_cpu_bootable,
  85. };
  86. /* This is called very early */
  87. void __init smp_init_celleb(void)
  88. {
  89. DBG(" -> smp_init_celleb()\n");
  90. smp_ops = &bpa_beatic_smp_ops;
  91. DBG(" <- smp_init_celleb()\n");
  92. }