2 * Author: Kumar Gala <galak@kernel.crashing.org>
4 * Copyright 2009 Freescale Semiconductor Inc.
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.
12 #include <linux/stddef.h>
13 #include <linux/kernel.h>
14 #include <linux/smp.h>
15 #include <linux/threads.h>
17 #include <asm/dbell.h>
20 unsigned long dbell_smp_message
[NR_CPUS
];
22 void smp_dbell_message_pass(int target
, int msg
)
26 if(target
< NR_CPUS
) {
27 set_bit(msg
, &dbell_smp_message
[target
]);
28 ppc_msgsnd(PPC_DBELL
, 0, target
);
30 else if(target
== MSG_ALL_BUT_SELF
) {
31 for_each_online_cpu(i
) {
32 if (i
== smp_processor_id())
34 set_bit(msg
, &dbell_smp_message
[i
]);
35 ppc_msgsnd(PPC_DBELL
, 0, i
);
38 else { /* target == MSG_ALL */
39 for_each_online_cpu(i
)
40 set_bit(msg
, &dbell_smp_message
[i
]);
41 ppc_msgsnd(PPC_DBELL
, PPC_DBELL_MSG_BRDCAST
, 0);
45 void doorbell_exception(struct pt_regs
*regs
)
47 int cpu
= smp_processor_id();
50 if (num_online_cpus() < 2)
53 for (msg
= 0; msg
< 4; msg
++)
54 if (test_and_clear_bit(msg
, &dbell_smp_message
[cpu
]))
55 smp_message_recv(msg
);
58 #else /* CONFIG_SMP */
59 void doorbell_exception(struct pt_regs
*regs
)
61 printk(KERN_WARNING
"Received doorbell on non-smp system\n");
63 #endif /* CONFIG_SMP */