[PATCH] ppc64: prep for NUMA sparsemem rework 2
[linux-2.6.git] / include / asm-powerpc / topology.h
1 #ifndef _ASM_POWERPC_TOPOLOGY_H
2 #define _ASM_POWERPC_TOPOLOGY_H
3
4 #include <linux/config.h>
5
6 #ifdef CONFIG_NUMA
7
8 #include <asm/mmzone.h>
9
10 static inline int cpu_to_node(int cpu)
11 {
12         int node;
13
14         node = numa_cpu_lookup_table[cpu];
15
16 #ifdef DEBUG_NUMA
17         BUG_ON(node == -1);
18 #endif
19
20         return node;
21 }
22
23 #define parent_node(node)       (node)
24
25 static inline cpumask_t node_to_cpumask(int node)
26 {
27         return numa_cpumask_lookup_table[node];
28 }
29
30 static inline int node_to_first_cpu(int node)
31 {
32         cpumask_t tmp;
33         tmp = node_to_cpumask(node);
34         return first_cpu(tmp);
35 }
36
37 #define pcibus_to_node(node)    (-1)
38 #define pcibus_to_cpumask(bus)  (cpu_online_map)
39
40 /* sched_domains SD_NODE_INIT for PPC64 machines */
41 #define SD_NODE_INIT (struct sched_domain) {            \
42         .span                   = CPU_MASK_NONE,        \
43         .parent                 = NULL,                 \
44         .groups                 = NULL,                 \
45         .min_interval           = 8,                    \
46         .max_interval           = 32,                   \
47         .busy_factor            = 32,                   \
48         .imbalance_pct          = 125,                  \
49         .cache_hot_time         = (10*1000000),         \
50         .cache_nice_tries       = 1,                    \
51         .per_cpu_gain           = 100,                  \
52         .flags                  = SD_LOAD_BALANCE       \
53                                 | SD_BALANCE_EXEC       \
54                                 | SD_BALANCE_NEWIDLE    \
55                                 | SD_WAKE_IDLE          \
56                                 | SD_WAKE_BALANCE,      \
57         .last_balance           = jiffies,              \
58         .balance_interval       = 1,                    \
59         .nr_balance_failed      = 0,                    \
60 }
61
62 #else
63
64 #include <asm-generic/topology.h>
65
66 #endif /* CONFIG_NUMA */
67
68 #endif  /* _ASM_POWERPC_TOPOLOGY_H */