Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/include/asm-generic/topology.h |
| 3 | * |
| 4 | * Written by: Matthew Dobson, IBM Corporation |
| 5 | * |
| 6 | * Copyright (C) 2002, IBM Corp. |
| 7 | * |
| 8 | * All rights reserved. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, but |
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or |
| 18 | * NON INFRINGEMENT. See the GNU General Public License for more |
| 19 | * details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 24 | * |
| 25 | * Send feedback to <colpatch@us.ibm.com> |
| 26 | */ |
| 27 | #ifndef _ASM_GENERIC_TOPOLOGY_H |
| 28 | #define _ASM_GENERIC_TOPOLOGY_H |
| 29 | |
Mike Travis | aa6b544 | 2008-03-31 08:41:55 -0700 | [diff] [blame] | 30 | #ifndef CONFIG_NUMA |
| 31 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | /* Other architectures wishing to use this simple topology API should fill |
| 33 | in the below functions as appropriate in their own <asm/topology.h> file. */ |
| 34 | #ifndef cpu_to_node |
Andi Kleen | 271cad6 | 2008-02-11 20:03:17 +0100 | [diff] [blame] | 35 | #define cpu_to_node(cpu) ((void)(cpu),0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | #endif |
| 37 | #ifndef parent_node |
Andi Kleen | 271cad6 | 2008-02-11 20:03:17 +0100 | [diff] [blame] | 38 | #define parent_node(node) ((void)(node),0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | #endif |
| 40 | #ifndef node_to_cpumask |
Andi Kleen | 271cad6 | 2008-02-11 20:03:17 +0100 | [diff] [blame] | 41 | #define node_to_cpumask(node) ((void)node, cpu_online_map) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | #endif |
Rusty Russell | f0b848ce | 2008-12-13 21:20:27 +1030 | [diff] [blame] | 43 | #ifndef cpumask_of_node |
| 44 | #define cpumask_of_node(node) ((void)node, cpu_online_mask) |
| 45 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | #ifndef node_to_first_cpu |
Andi Kleen | 271cad6 | 2008-02-11 20:03:17 +0100 | [diff] [blame] | 47 | #define node_to_first_cpu(node) ((void)(node),0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | #endif |
Christoph Lameter | 8c5a090 | 2005-06-23 00:08:18 -0700 | [diff] [blame] | 49 | #ifndef pcibus_to_node |
Andi Kleen | 271cad6 | 2008-02-11 20:03:17 +0100 | [diff] [blame] | 50 | #define pcibus_to_node(bus) ((void)(bus), -1) |
Christoph Lameter | 8c5a090 | 2005-06-23 00:08:18 -0700 | [diff] [blame] | 51 | #endif |
| 52 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | #ifndef pcibus_to_cpumask |
Christoph Lameter | 8c5a090 | 2005-06-23 00:08:18 -0700 | [diff] [blame] | 54 | #define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \ |
| 55 | CPU_MASK_ALL : \ |
| 56 | node_to_cpumask(pcibus_to_node(bus)) \ |
| 57 | ) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | #endif |
| 59 | |
Rusty Russell | f0b848ce | 2008-12-13 21:20:27 +1030 | [diff] [blame] | 60 | #ifndef cpumask_of_pcibus |
| 61 | #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ |
| 62 | cpu_all_mask : \ |
| 63 | cpumask_of_node(pcibus_to_node(bus))) |
| 64 | #endif |
| 65 | |
Mike Travis | aa6b544 | 2008-03-31 08:41:55 -0700 | [diff] [blame] | 66 | #endif /* CONFIG_NUMA */ |
| 67 | |
Rusty Russell | f0b848ce | 2008-12-13 21:20:27 +1030 | [diff] [blame] | 68 | /* |
| 69 | * returns pointer to cpumask for specified node |
| 70 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" |
| 71 | */ |
Mike Travis | aa6b544 | 2008-03-31 08:41:55 -0700 | [diff] [blame] | 72 | #ifndef node_to_cpumask_ptr |
| 73 | |
| 74 | #define node_to_cpumask_ptr(v, node) \ |
Mike Travis | 11369f35 | 2008-07-08 14:35:21 -0700 | [diff] [blame] | 75 | cpumask_t _##v = node_to_cpumask(node); \ |
| 76 | const cpumask_t *v = &_##v |
Mike Travis | aa6b544 | 2008-03-31 08:41:55 -0700 | [diff] [blame] | 77 | |
| 78 | #define node_to_cpumask_ptr_next(v, node) \ |
| 79 | _##v = node_to_cpumask(node) |
| 80 | #endif |
| 81 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | #endif /* _ASM_GENERIC_TOPOLOGY_H */ |