Linux v2.6.15-rc6
[pohmelfs.git] / include / asm-i386 / topology.h
blob0ec27c9e8e45ba696be1a06a81df49d27d222729
1 /*
2 * linux/include/asm-i386/topology.h
4 * Written by: Matthew Dobson, IBM Corporation
6 * Copyright (C) 2002, IBM Corp.
8 * All rights reserved.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
18 * NON INFRINGEMENT. See the GNU General Public License for more
19 * details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * Send feedback to <colpatch@us.ibm.com>
27 #ifndef _ASM_I386_TOPOLOGY_H
28 #define _ASM_I386_TOPOLOGY_H
30 #ifdef CONFIG_NUMA
32 #include <asm/mpspec.h>
34 #include <linux/cpumask.h>
36 /* Mappings between logical cpu number and node number */
37 extern cpumask_t node_2_cpu_mask[];
38 extern int cpu_2_node[];
40 /* Returns the number of the node containing CPU 'cpu' */
41 static inline int cpu_to_node(int cpu)
43 return cpu_2_node[cpu];
46 /* Returns the number of the node containing Node 'node'. This architecture is flat,
47 so it is a pretty simple function! */
48 #define parent_node(node) (node)
50 /* Returns a bitmask of CPUs on Node 'node'. */
51 static inline cpumask_t node_to_cpumask(int node)
53 return node_2_cpu_mask[node];
56 /* Returns the number of the first CPU on Node 'node'. */
57 static inline int node_to_first_cpu(int node)
59 cpumask_t mask = node_to_cpumask(node);
60 return first_cpu(mask);
63 #define pcibus_to_node(bus) ((long) (bus)->sysdata)
64 #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus))
66 /* sched_domains SD_NODE_INIT for NUMAQ machines */
67 #define SD_NODE_INIT (struct sched_domain) { \
68 .span = CPU_MASK_NONE, \
69 .parent = NULL, \
70 .groups = NULL, \
71 .min_interval = 8, \
72 .max_interval = 32, \
73 .busy_factor = 32, \
74 .imbalance_pct = 125, \
75 .cache_hot_time = (10*1000000), \
76 .cache_nice_tries = 1, \
77 .busy_idx = 3, \
78 .idle_idx = 1, \
79 .newidle_idx = 2, \
80 .wake_idx = 1, \
81 .per_cpu_gain = 100, \
82 .flags = SD_LOAD_BALANCE \
83 | SD_BALANCE_EXEC \
84 | SD_BALANCE_FORK \
85 | SD_WAKE_BALANCE, \
86 .last_balance = jiffies, \
87 .balance_interval = 1, \
88 .nr_balance_failed = 0, \
91 extern unsigned long node_start_pfn[];
92 extern unsigned long node_end_pfn[];
93 extern unsigned long node_remap_size[];
95 #define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid])
97 #else /* !CONFIG_NUMA */
99 * Other i386 platforms should define their own version of the
100 * above macros here.
103 #include <asm-generic/topology.h>
105 #endif /* CONFIG_NUMA */
107 #endif /* _ASM_I386_TOPOLOGY_H */