aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/topology.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-i386/topology.h')
-rw-r--r--include/asm-i386/topology.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h
new file mode 100644
index 000000000000..98f9e6850cba
--- /dev/null
+++ b/include/asm-i386/topology.h
@@ -0,0 +1,108 @@
1/*
2 * linux/include/asm-i386/topology.h
3 *
4 * Written by: Matthew Dobson, IBM Corporation
5 *
6 * Copyright (C) 2002, IBM Corp.
7 *
8 * All rights reserved.
9 *
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.
14 *
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.
20 *
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.
24 *
25 * Send feedback to <colpatch@us.ibm.com>
26 */
27#ifndef _ASM_I386_TOPOLOGY_H
28#define _ASM_I386_TOPOLOGY_H
29
30#ifdef CONFIG_NUMA
31
32#include <asm/mpspec.h>
33
34#include <linux/cpumask.h>
35
36/* Mappings between logical cpu number and node number */
37extern cpumask_t node_2_cpu_mask[];
38extern int cpu_2_node[];
39
40/* Returns the number of the node containing CPU 'cpu' */
41static inline int cpu_to_node(int cpu)
42{
43 return cpu_2_node[cpu];
44}
45
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)
49
50/* Returns a bitmask of CPUs on Node 'node'. */
51static inline cpumask_t node_to_cpumask(int node)
52{
53 return node_2_cpu_mask[node];
54}
55
56/* Returns the number of the first CPU on Node 'node'. */
57static inline int node_to_first_cpu(int node)
58{
59 cpumask_t mask = node_to_cpumask(node);
60 return first_cpu(mask);
61}
62
63/* Returns the number of the node containing PCI bus number 'busnr' */
64static inline cpumask_t __pcibus_to_cpumask(int busnr)
65{
66 return node_to_cpumask(mp_bus_id_to_node[busnr]);
67}
68#define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus->number)
69
70/* sched_domains SD_NODE_INIT for NUMAQ machines */
71#define SD_NODE_INIT (struct sched_domain) { \
72 .span = CPU_MASK_NONE, \
73 .parent = NULL, \
74 .groups = NULL, \
75 .min_interval = 8, \
76 .max_interval = 32, \
77 .busy_factor = 32, \
78 .imbalance_pct = 125, \
79 .cache_hot_time = (10*1000000), \
80 .cache_nice_tries = 1, \
81 .per_cpu_gain = 100, \
82 .flags = SD_LOAD_BALANCE \
83 | SD_BALANCE_EXEC \
84 | SD_BALANCE_NEWIDLE \
85 | SD_WAKE_IDLE \
86 | SD_WAKE_BALANCE, \
87 .last_balance = jiffies, \
88 .balance_interval = 1, \
89 .nr_balance_failed = 0, \
90}
91
92extern unsigned long node_start_pfn[];
93extern unsigned long node_end_pfn[];
94extern unsigned long node_remap_size[];
95
96#define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid])
97
98#else /* !CONFIG_NUMA */
99/*
100 * Other i386 platforms should define their own version of the
101 * above macros here.
102 */
103
104#include <asm-generic/topology.h>
105
106#endif /* CONFIG_NUMA */
107
108#endif /* _ASM_I386_TOPOLOGY_H */