Kumar Gala | 620165f | 2009-02-12 13:54:53 +0000 | [diff] [blame^] | 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 | |
| 12 | #include <linux/stddef.h> |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/smp.h> |
| 15 | #include <linux/threads.h> |
| 16 | |
| 17 | #include <asm/dbell.h> |
| 18 | |
| 19 | #ifdef CONFIG_SMP |
| 20 | unsigned long dbell_smp_message[NR_CPUS]; |
| 21 | |
| 22 | void smp_dbell_message_pass(int target, int msg) |
| 23 | { |
| 24 | int i; |
| 25 | |
| 26 | if(target < NR_CPUS) { |
| 27 | set_bit(msg, &dbell_smp_message[target]); |
| 28 | ppc_msgsnd(PPC_DBELL, 0, target); |
| 29 | } |
| 30 | else if(target == MSG_ALL_BUT_SELF) { |
| 31 | for_each_online_cpu(i) { |
| 32 | if (i == smp_processor_id()) |
| 33 | continue; |
| 34 | set_bit(msg, &dbell_smp_message[i]); |
| 35 | ppc_msgsnd(PPC_DBELL, 0, i); |
| 36 | } |
| 37 | } |
| 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); |
| 42 | } |
| 43 | } |
| 44 | #endif |