dbell.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Author: Kumar Gala <galak@kernel.crashing.org>
  3. *
  4. * Copyright 2009 Freescale Semiconductor Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. */
  11. #include <linux/stddef.h>
  12. #include <linux/kernel.h>
  13. #include <linux/smp.h>
  14. #include <linux/threads.h>
  15. #include <linux/hardirq.h>
  16. #include <asm/dbell.h>
  17. #include <asm/irq_regs.h>
  18. #ifdef CONFIG_SMP
  19. void doorbell_setup_this_cpu(void)
  20. {
  21. unsigned long tag = mfspr(SPRN_PIR) & 0x3fff;
  22. smp_muxed_ipi_set_data(smp_processor_id(), tag);
  23. }
  24. void doorbell_cause_ipi(int cpu, unsigned long data)
  25. {
  26. ppc_msgsnd(PPC_DBELL, 0, data);
  27. }
  28. void doorbell_exception(struct pt_regs *regs)
  29. {
  30. struct pt_regs *old_regs = set_irq_regs(regs);
  31. irq_enter();
  32. smp_ipi_demux();
  33. irq_exit();
  34. set_irq_regs(old_regs);
  35. }
  36. #else /* CONFIG_SMP */
  37. void doorbell_exception(struct pt_regs *regs)
  38. {
  39. printk(KERN_WARNING "Received doorbell on non-smp system\n");
  40. }
  41. #endif /* CONFIG_SMP */