xref: /OK3568_Linux_fs/kernel/arch/ia64/include/asm/nodedata.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * This file is subject to the terms and conditions of the GNU General Public
3*4882a593Smuzhiyun  * License.  See the file "COPYING" in the main directory of this archive
4*4882a593Smuzhiyun  * for more details.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Copyright (c) 2000 Silicon Graphics, Inc.  All rights reserved.
7*4882a593Smuzhiyun  * Copyright (c) 2002 NEC Corp.
8*4882a593Smuzhiyun  * Copyright (c) 2002 Erich Focht <efocht@ess.nec.de>
9*4882a593Smuzhiyun  * Copyright (c) 2002 Kimio Suganuma <k-suganuma@da.jp.nec.com>
10*4882a593Smuzhiyun  */
11*4882a593Smuzhiyun #ifndef _ASM_IA64_NODEDATA_H
12*4882a593Smuzhiyun #define _ASM_IA64_NODEDATA_H
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #include <linux/numa.h>
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun #include <asm/percpu.h>
17*4882a593Smuzhiyun #include <asm/mmzone.h>
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun #ifdef CONFIG_NUMA
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun /*
22*4882a593Smuzhiyun  * Node Data. One of these structures is located on each node of a NUMA system.
23*4882a593Smuzhiyun  */
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun struct pglist_data;
26*4882a593Smuzhiyun struct ia64_node_data {
27*4882a593Smuzhiyun 	short			active_cpu_count;
28*4882a593Smuzhiyun 	short			node;
29*4882a593Smuzhiyun 	struct pglist_data	*pg_data_ptrs[MAX_NUMNODES];
30*4882a593Smuzhiyun };
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun /*
34*4882a593Smuzhiyun  * Return a pointer to the node_data structure for the executing cpu.
35*4882a593Smuzhiyun  */
36*4882a593Smuzhiyun #define local_node_data		(local_cpu_data->node_data)
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun /*
39*4882a593Smuzhiyun  * Given a node id, return a pointer to the pg_data_t for the node.
40*4882a593Smuzhiyun  *
41*4882a593Smuzhiyun  * NODE_DATA 	- should be used in all code not related to system
42*4882a593Smuzhiyun  *		  initialization. It uses pernode data structures to minimize
43*4882a593Smuzhiyun  *		  offnode memory references. However, these structure are not
44*4882a593Smuzhiyun  *		  present during boot. This macro can be used once cpu_init
45*4882a593Smuzhiyun  *		  completes.
46*4882a593Smuzhiyun  */
47*4882a593Smuzhiyun #define NODE_DATA(nid)		(local_node_data->pg_data_ptrs[nid])
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun /*
50*4882a593Smuzhiyun  * LOCAL_DATA_ADDR - This is to calculate the address of other node's
51*4882a593Smuzhiyun  *		     "local_node_data" at hot-plug phase. The local_node_data
52*4882a593Smuzhiyun  *		     is pointed by per_cpu_page. Kernel usually use it for
53*4882a593Smuzhiyun  *		     just executing cpu. However, when new node is hot-added,
54*4882a593Smuzhiyun  *		     the addresses of local data for other nodes are necessary
55*4882a593Smuzhiyun  *		     to update all of them.
56*4882a593Smuzhiyun  */
57*4882a593Smuzhiyun #define LOCAL_DATA_ADDR(pgdat)  			\
58*4882a593Smuzhiyun 	((struct ia64_node_data *)((u64)(pgdat) + 	\
59*4882a593Smuzhiyun 				   L1_CACHE_ALIGN(sizeof(struct pglist_data))))
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun #endif /* CONFIG_NUMA */
62*4882a593Smuzhiyun 
63*4882a593Smuzhiyun #endif /* _ASM_IA64_NODEDATA_H */
64