diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-01-30 07:30:38 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:30:38 -0500 |
commit | b4ea9299df1fa04dbd51840f60918a63ff6a8a44 (patch) | |
tree | a11ec0c494e37f68a235d2af5c28677c43ebf73d /include/asm-x86/topology_64.h | |
parent | fe21a445b98c9d52f02f3412d7a2fd39784f3b22 (diff) |
x86: consolidate toloplogy_32/64.h
Reorder defines and do white space / coding style cleanups
to get a readable diff.
Also convert the macros to inline functions. Move the pci
related inlines to pci.h
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86/topology_64.h')
-rw-r--r-- | include/asm-x86/topology_64.h | 60 |
1 files changed, 41 insertions, 19 deletions
diff --git a/include/asm-x86/topology_64.h b/include/asm-x86/topology_64.h index cf529341b16c..93de948bd337 100644 --- a/include/asm-x86/topology_64.h +++ b/include/asm-x86/topology_64.h | |||
@@ -1,27 +1,47 @@ | |||
1 | #ifndef _ASM_X86_64_TOPOLOGY_H | 1 | #ifndef _ASM_X86_TOPOLOGY_H |
2 | #define _ASM_X86_64_TOPOLOGY_H | 2 | #define _ASM_X86_TOPOLOGY_H |
3 | |||
4 | 3 | ||
5 | #ifdef CONFIG_NUMA | 4 | #ifdef CONFIG_NUMA |
6 | 5 | #include <linux/cpumask.h> | |
7 | #include <asm/mpspec.h> | 6 | #include <asm/mpspec.h> |
8 | #include <linux/bitops.h> | ||
9 | 7 | ||
8 | /* Mappings between logical cpu number and node number */ | ||
10 | extern int cpu_to_node_map[]; | 9 | extern int cpu_to_node_map[]; |
11 | extern cpumask_t node_to_cpumask_map[]; | 10 | extern cpumask_t node_to_cpumask_map[]; |
12 | 11 | ||
13 | #ifdef CONFIG_ACPI_NUMA | 12 | #ifdef CONFIG_ACPI_NUMA |
14 | extern int __node_distance(int, int); | 13 | extern int __node_distance(int, int); |
15 | #define node_distance(a,b) __node_distance(a,b) | 14 | #define node_distance(a,b) __node_distance(a,b) |
16 | /* #else fallback version */ | ||
17 | #endif | 15 | #endif |
18 | 16 | ||
19 | #define cpu_to_node(cpu) (cpu_to_node_map[cpu]) | 17 | /* Returns the number of the node containing CPU 'cpu' */ |
20 | #define parent_node(node) (node) | 18 | static inline int cpu_to_node(int cpu) |
21 | #define node_to_first_cpu(node) (first_cpu(node_to_cpumask_map[node])) | 19 | { |
22 | #define node_to_cpumask(node) (node_to_cpumask_map[node]) | 20 | return cpu_to_node_map[cpu]; |
23 | #define pcibus_to_node(bus) ((struct pci_sysdata *)((bus)->sysdata))->node | 21 | } |
24 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)); | 22 | |
23 | /* | ||
24 | * Returns the number of the node containing Node 'node'. This | ||
25 | * architecture is flat, so it is a pretty simple function! | ||
26 | */ | ||
27 | #define parent_node(node) (node) | ||
28 | |||
29 | /* Returns a bitmask of CPUs on Node 'node'. */ | ||
30 | static inline cpumask_t node_to_cpumask(int node) | ||
31 | { | ||
32 | return node_to_cpumask_map[node]; | ||
33 | } | ||
34 | |||
35 | /* Returns the number of the first CPU on Node 'node'. */ | ||
36 | static inline int node_to_first_cpu(int node) | ||
37 | { | ||
38 | cpumask_t mask = node_to_cpumask(node); | ||
39 | |||
40 | return first_cpu(mask); | ||
41 | } | ||
42 | |||
43 | #define pcibus_to_node(bus) __pcibus_to_node(bus) | ||
44 | #define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus) | ||
25 | 45 | ||
26 | #define numa_node_id() read_pda(nodenumber) | 46 | #define numa_node_id() read_pda(nodenumber) |
27 | 47 | ||
@@ -38,12 +58,12 @@ extern int __node_distance(int, int); | |||
38 | .cache_nice_tries = 2, \ | 58 | .cache_nice_tries = 2, \ |
39 | .busy_idx = 3, \ | 59 | .busy_idx = 3, \ |
40 | .idle_idx = 2, \ | 60 | .idle_idx = 2, \ |
41 | .newidle_idx = 0, \ | 61 | .newidle_idx = 0, \ |
42 | .wake_idx = 1, \ | 62 | .wake_idx = 1, \ |
43 | .forkexec_idx = 1, \ | 63 | .forkexec_idx = 1, \ |
44 | .flags = SD_LOAD_BALANCE \ | 64 | .flags = SD_LOAD_BALANCE \ |
45 | | SD_BALANCE_FORK \ | ||
46 | | SD_BALANCE_EXEC \ | 65 | | SD_BALANCE_EXEC \ |
66 | | SD_BALANCE_FORK \ | ||
47 | | SD_SERIALIZE \ | 67 | | SD_SERIALIZE \ |
48 | | SD_WAKE_BALANCE, \ | 68 | | SD_WAKE_BALANCE, \ |
49 | .last_balance = jiffies, \ | 69 | .last_balance = jiffies, \ |
@@ -51,19 +71,21 @@ extern int __node_distance(int, int); | |||
51 | .nr_balance_failed = 0, \ | 71 | .nr_balance_failed = 0, \ |
52 | } | 72 | } |
53 | 73 | ||
74 | #else /* CONFIG_NUMA */ | ||
75 | |||
76 | #include <asm-generic/topology.h> | ||
77 | |||
54 | #endif | 78 | #endif |
55 | 79 | ||
80 | extern cpumask_t cpu_coregroup_map(int cpu); | ||
81 | |||
56 | #ifdef CONFIG_SMP | 82 | #ifdef CONFIG_SMP |
57 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) | 83 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) |
58 | #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) | 84 | #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) |
59 | #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) | 85 | #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) |
60 | #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) | 86 | #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) |
61 | #define mc_capable() (boot_cpu_data.x86_max_cores > 1) | 87 | #define mc_capable() (boot_cpu_data.x86_max_cores > 1) |
62 | #define smt_capable() (smp_num_siblings > 1) | 88 | #define smt_capable() (smp_num_siblings > 1) |
63 | #endif | 89 | #endif |
64 | 90 | ||
65 | #include <asm-generic/topology.h> | ||
66 | |||
67 | extern cpumask_t cpu_coregroup_map(int cpu); | ||
68 | |||
69 | #endif | 91 | #endif |