dbell.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 <asm/dbell.h>
  16. #ifdef CONFIG_SMP
  17. unsigned long dbell_smp_message[NR_CPUS];
  18. void smp_dbell_message_pass(int target, int msg)
  19. {
  20. int i;
  21. if(target < NR_CPUS) {
  22. set_bit(msg, &dbell_smp_message[target]);
  23. ppc_msgsnd(PPC_DBELL, 0, target);
  24. }
  25. else if(target == MSG_ALL_BUT_SELF) {
  26. for_each_online_cpu(i) {
  27. if (i == smp_processor_id())
  28. continue;
  29. set_bit(msg, &dbell_smp_message[i]);
  30. ppc_msgsnd(PPC_DBELL, 0, i);
  31. }
  32. }
  33. else { /* target == MSG_ALL */
  34. for_each_online_cpu(i)
  35. set_bit(msg, &dbell_smp_message[i]);
  36. ppc_msgsnd(PPC_DBELL, PPC_DBELL_MSG_BRDCAST, 0);
  37. }
  38. }
  39. #endif