author | Florian Westphal <fw@strlen.de> |
Thu, 09 Apr 2009 12:07:21 +0200 | |
changeset 2 | d1f6d8b6f81c |
parent 0 | aa628870c1d3 |
permissions | -rw-r--r-- |
0
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
1 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
2 |
* include/linux/node.h - generic node definition |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
3 |
* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
4 |
* This is mainly for topological representation. We define the |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
5 |
* basic 'struct node' here, which can be embedded in per-arch |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
6 |
* definitions of processors. |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
7 |
* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
8 |
* Basic handling of the devices is done in drivers/base/node.c |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
9 |
* and system devices are handled in drivers/base/sys.c. |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
10 |
* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
11 |
* Nodes are exported via driverfs in the class/node/devices/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
12 |
* directory. |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
13 |
* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
14 |
* Per-node interfaces can be implemented using a struct device_interface. |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
15 |
* See the following for how to do this: |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
16 |
* - drivers/base/intf.c |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
17 |
* - Documentation/driver-model/interface.txt |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
18 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
19 |
#ifndef _LINUX_NODE_H_ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
20 |
#define _LINUX_NODE_H_ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
21 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
22 |
#include <linux/sysdev.h> |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
23 |
#include <linux/cpumask.h> |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
24 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
25 |
struct node { |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
26 |
struct sys_device sysdev; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
27 |
}; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
28 |
|
2 | 29 |
struct memory_block; |
0
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
30 |
extern struct node node_devices[]; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
31 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
32 |
extern int register_node(struct node *, int, struct node *); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
33 |
extern void unregister_node(struct node *node); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
34 |
#ifdef CONFIG_NUMA |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
35 |
extern int register_one_node(int nid); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
36 |
extern void unregister_one_node(int nid); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
37 |
extern int register_cpu_under_node(unsigned int cpu, unsigned int nid); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
38 |
extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); |
2 | 39 |
extern int register_mem_sect_under_node(struct memory_block *mem_blk, |
40 |
int nid); |
|
41 |
extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk); |
|
0
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
42 |
#else |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
43 |
static inline int register_one_node(int nid) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
44 |
{ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
45 |
return 0; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
46 |
} |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
47 |
static inline int unregister_one_node(int nid) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
48 |
{ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
49 |
return 0; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
50 |
} |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
51 |
static inline int register_cpu_under_node(unsigned int cpu, unsigned int nid) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
52 |
{ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
53 |
return 0; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
54 |
} |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
55 |
static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
56 |
{ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
57 |
return 0; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
58 |
} |
2 | 59 |
static inline int register_mem_sect_under_node(struct memory_block *mem_blk, |
60 |
int nid) |
|
61 |
{ |
|
62 |
return 0; |
|
63 |
} |
|
64 |
static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk) |
|
65 |
{ |
|
66 |
return 0; |
|
67 |
} |
|
0
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
68 |
#endif |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
69 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
70 |
#define to_node(sys_device) container_of(sys_device, struct node, sysdev) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
71 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
72 |
#endif /* _LINUX_NODE_H_ */ |