blob: 624e53cecc0298a70b6393ff4a262ae0935af727 [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
Kay Sievers10fbcf42011-12-21 14:48:43 -080017#include <linux/device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#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 {
Kay Sievers10fbcf42011-12-21 14:48:43 -080022 struct device dev;
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 Schermerhorn9a3052302009-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);
Nathan Fontenotd3360162011-01-20 10:44:29 -060042extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
43 unsigned long phys_index);
Lee Schermerhorn9a3052302009-12-14 17:58:25 -080044
45#ifdef CONFIG_HUGETLBFS
46extern void register_hugetlbfs_with_node(node_registration_func_t doregister,
47 node_registration_func_t unregister);
48#endif
KAMEZAWA Hiroyuki76b67ed2006-06-27 02:53:41 -070049#else
KAMEZAWA Hiroyuki36920e02006-08-27 01:23:52 -070050static inline int register_one_node(int nid)
51{
52 return 0;
53}
54static inline int unregister_one_node(int nid)
55{
56 return 0;
57}
KAMEZAWA Hiroyuki76b67ed2006-06-27 02:53:41 -070058static inline int register_cpu_under_node(unsigned int cpu, unsigned int nid)
59{
60 return 0;
61}
62static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
63{
64 return 0;
65}
Gary Hadec04fc582009-01-06 14:39:14 -080066static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
67 int nid)
68{
69 return 0;
70}
Nathan Fontenotd3360162011-01-20 10:44:29 -060071static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
72 unsigned long phys_index)
Gary Hadec04fc582009-01-06 14:39:14 -080073{
74 return 0;
75}
Lee Schermerhorn9a3052302009-12-14 17:58:25 -080076
77static inline void register_hugetlbfs_with_node(node_registration_func_t reg,
78 node_registration_func_t unreg)
79{
80}
KAMEZAWA Hiroyuki76b67ed2006-06-27 02:53:41 -070081#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070082
Kay Sievers10fbcf42011-12-21 14:48:43 -080083#define to_node(device) container_of(device, struct node, dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
85#endif /* _LINUX_NODE_H_ */