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