xref: /OK3568_Linux_fs/kernel/include/asm-generic/topology.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * linux/include/asm-generic/topology.h
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Written by: Matthew Dobson, IBM Corporation
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Copyright (C) 2002, IBM Corp.
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * All rights reserved.
9*4882a593Smuzhiyun  *
10*4882a593Smuzhiyun  * This program is free software; you can redistribute it and/or modify
11*4882a593Smuzhiyun  * it under the terms of the GNU General Public License as published by
12*4882a593Smuzhiyun  * the Free Software Foundation; either version 2 of the License, or
13*4882a593Smuzhiyun  * (at your option) any later version.
14*4882a593Smuzhiyun  *
15*4882a593Smuzhiyun  * This program is distributed in the hope that it will be useful, but
16*4882a593Smuzhiyun  * WITHOUT ANY WARRANTY; without even the implied warranty of
17*4882a593Smuzhiyun  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
18*4882a593Smuzhiyun  * NON INFRINGEMENT.  See the GNU General Public License for more
19*4882a593Smuzhiyun  * details.
20*4882a593Smuzhiyun  *
21*4882a593Smuzhiyun  * You should have received a copy of the GNU General Public License
22*4882a593Smuzhiyun  * along with this program; if not, write to the Free Software
23*4882a593Smuzhiyun  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24*4882a593Smuzhiyun  *
25*4882a593Smuzhiyun  * Send feedback to <colpatch@us.ibm.com>
26*4882a593Smuzhiyun  */
27*4882a593Smuzhiyun #ifndef _ASM_GENERIC_TOPOLOGY_H
28*4882a593Smuzhiyun #define _ASM_GENERIC_TOPOLOGY_H
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun #ifndef	CONFIG_NUMA
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun /* Other architectures wishing to use this simple topology API should fill
33*4882a593Smuzhiyun    in the below functions as appropriate in their own <asm/topology.h> file. */
34*4882a593Smuzhiyun #ifndef cpu_to_node
35*4882a593Smuzhiyun #define cpu_to_node(cpu)	((void)(cpu),0)
36*4882a593Smuzhiyun #endif
37*4882a593Smuzhiyun #ifndef set_numa_node
38*4882a593Smuzhiyun #define set_numa_node(node)
39*4882a593Smuzhiyun #endif
40*4882a593Smuzhiyun #ifndef set_cpu_numa_node
41*4882a593Smuzhiyun #define set_cpu_numa_node(cpu, node)
42*4882a593Smuzhiyun #endif
43*4882a593Smuzhiyun #ifndef cpu_to_mem
44*4882a593Smuzhiyun #define cpu_to_mem(cpu)		((void)(cpu),0)
45*4882a593Smuzhiyun #endif
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun #ifndef cpumask_of_node
48*4882a593Smuzhiyun   #ifdef CONFIG_NEED_MULTIPLE_NODES
49*4882a593Smuzhiyun     #define cpumask_of_node(node)	((node) == 0 ? cpu_online_mask : cpu_none_mask)
50*4882a593Smuzhiyun   #else
51*4882a593Smuzhiyun     #define cpumask_of_node(node)	((void)(node), cpu_online_mask)
52*4882a593Smuzhiyun   #endif
53*4882a593Smuzhiyun #endif
54*4882a593Smuzhiyun #ifndef pcibus_to_node
55*4882a593Smuzhiyun #define pcibus_to_node(bus)	((void)(bus), -1)
56*4882a593Smuzhiyun #endif
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun #ifndef cpumask_of_pcibus
59*4882a593Smuzhiyun #define cpumask_of_pcibus(bus)	(pcibus_to_node(bus) == -1 ?		\
60*4882a593Smuzhiyun 				 cpu_all_mask :				\
61*4882a593Smuzhiyun 				 cpumask_of_node(pcibus_to_node(bus)))
62*4882a593Smuzhiyun #endif
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun #endif	/* CONFIG_NUMA */
65*4882a593Smuzhiyun 
66*4882a593Smuzhiyun #if !defined(CONFIG_NUMA) || !defined(CONFIG_HAVE_MEMORYLESS_NODES)
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun #ifndef set_numa_mem
69*4882a593Smuzhiyun #define set_numa_mem(node)
70*4882a593Smuzhiyun #endif
71*4882a593Smuzhiyun #ifndef set_cpu_numa_mem
72*4882a593Smuzhiyun #define set_cpu_numa_mem(cpu, node)
73*4882a593Smuzhiyun #endif
74*4882a593Smuzhiyun 
75*4882a593Smuzhiyun #endif	/* !CONFIG_NUMA || !CONFIG_HAVE_MEMORYLESS_NODES */
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun #endif /* _ASM_GENERIC_TOPOLOGY_H */
78