blob: 1466945cc9ef46c252fe7cd7834758fb3ddf9e19 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * include/linux/node.h - generic node definition
3 *
4 * This is mainly for topological representation. We define the
5 * basic 'struct node' here, which can be embedded in per-arch
6 * definitions of processors.
7 *
8 * Basic handling of the devices is done in drivers/base/node.c
9 * and system devices are handled in drivers/base/sys.c.
10 *
11 * Nodes are exported via driverfs in the class/node/devices/
12 * directory.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 */
14#ifndef _LINUX_NODE_H_
15#define _LINUX_NODE_H_
16
17#include <linux/sysdev.h>
18#include <linux/cpumask.h>
Lee Schermerhorn39da08c2009-12-14 17:58:36 -080019#include <linux/workqueue.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
21struct node {
22 struct sys_device sysdev;
Lee Schermerhorn39da08c2009-12-14 17:58:36 -080023
24#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
25 struct work_struct node_work;
26#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070027};
28
Gary Hadec04fc582009-01-06 14:39:14 -080029struct memory_block;
Yasunori Goto0fc44152006-06-27 02:53:38 -070030extern struct node node_devices[];
Lee Schermerhorn9a305232009-12-14 17:58:25 -080031typedef void (*node_registration_func_t)(struct node *);
Yasunori Goto0fc44152006-06-27 02:53:38 -070032
Linus Torvalds1da177e2005-04-16 15:20:36 -070033extern int register_node(struct node *, int, struct node *);
Keiichiro Tokunaga4b450992005-05-08 21:28:53 +090034extern void unregister_node(struct node *node);
KAMEZAWA Hiroyuki36920e02006-08-27 01:23:52 -070035#ifdef CONFIG_NUMA
Yasunori Goto0fc44152006-06-27 02:53:38 -070036extern int register_one_node(int nid);
37extern void unregister_one_node(int nid);
KAMEZAWA Hiroyuki76b67ed2006-06-27 02:53:41 -070038extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
39extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
Gary Hadec04fc582009-01-06 14:39:14 -080040extern int register_mem_sect_under_node(struct memory_block *mem_blk,
41 int nid);
42extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk);
Lee Schermerhorn9a305232009-12-14 17:58:25 -080043
44#ifdef CONFIG_HUGETLBFS
45extern void register_hugetlbfs_with_node(node_registration_func_t doregister,
46 node_registration_func_t unregister);
47#endif
KAMEZAWA Hiroyuki76b67ed2006-06-27 02:53:41 -070048#else
KAMEZAWA Hiroyuki36920e02006-08-27 01:23:52 -070049static inline int register_one_node(int nid)
50{
51 return 0;
52}
53static inline int unregister_one_node(int nid)
54{
55 return 0;
56}
KAMEZAWA Hiroyuki76b67ed2006-06-27 02:53:41 -070057static inline int register_cpu_under_node(unsigned int cpu, unsigned int nid)
58{
59 return 0;
60}
61static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
62{
63 return 0;
64}
Gary Hadec04fc582009-01-06 14:39:14 -080065static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
66 int nid)
67{
68 return 0;
69}
70static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)
71{
72 return 0;
73}
Lee Schermerhorn9a305232009-12-14 17:58:25 -080074
75static inline void register_hugetlbfs_with_node(node_registration_func_t reg,
76 node_registration_func_t unreg)
77{
78}
KAMEZAWA Hiroyuki76b67ed2006-06-27 02:53:41 -070079#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070080
81#define to_node(sys_device) container_of(sys_device, struct node, sysdev)
82
83#endif /* _LINUX_NODE_H_ */