smp.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Smp support for CHRP machines.
  4. *
  5. * Written by Cort Dougan ([email protected]) borrowing a great
  6. * deal of code from the sparc and intel versions.
  7. *
  8. * Copyright (C) 1999 Cort Dougan <[email protected]>
  9. *
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/sched.h>
  13. #include <linux/smp.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/kernel_stat.h>
  16. #include <linux/delay.h>
  17. #include <linux/spinlock.h>
  18. #include <linux/pgtable.h>
  19. #include <asm/ptrace.h>
  20. #include <linux/atomic.h>
  21. #include <asm/irq.h>
  22. #include <asm/page.h>
  23. #include <asm/sections.h>
  24. #include <asm/io.h>
  25. #include <asm/smp.h>
  26. #include <asm/machdep.h>
  27. #include <asm/mpic.h>
  28. #include <asm/rtas.h>
  29. static int smp_chrp_kick_cpu(int nr)
  30. {
  31. *(unsigned long *)KERNELBASE = nr;
  32. asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory");
  33. return 0;
  34. }
  35. static void smp_chrp_setup_cpu(int cpu_nr)
  36. {
  37. mpic_setup_this_cpu();
  38. }
  39. /* CHRP with openpic */
  40. struct smp_ops_t chrp_smp_ops = {
  41. .cause_nmi_ipi = NULL,
  42. .message_pass = smp_mpic_message_pass,
  43. .probe = smp_mpic_probe,
  44. .kick_cpu = smp_chrp_kick_cpu,
  45. .setup_cpu = smp_chrp_setup_cpu,
  46. .give_timebase = rtas_give_timebase,
  47. .take_timebase = rtas_take_timebase,
  48. };