diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-05-25 18:49:59 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-05-29 05:49:41 -0400 |
commit | 5cbc30737398b49f62ae8603129ce43ac7db1a41 (patch) | |
tree | 45d01a686865e6fd9c32b670f77af1e37db03008 /include | |
parent | e01c0d6d8cf29c1c11725837b265598cab687952 (diff) |
[SPARC64]: Use machine description and OBP properly for cpu probing.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-sparc64/cpudata.h | 22 | ||||
-rw-r--r-- | include/asm-sparc64/hypervisor.h | 5 | ||||
-rw-r--r-- | include/asm-sparc64/mdesc.h | 39 | ||||
-rw-r--r-- | include/asm-sparc64/oplib.h | 5 | ||||
-rw-r--r-- | include/asm-sparc64/percpu.h | 4 | ||||
-rw-r--r-- | include/asm-sparc64/prom.h | 1 | ||||
-rw-r--r-- | include/asm-sparc64/smp.h | 4 | ||||
-rw-r--r-- | include/asm-sparc64/topology.h | 3 |
8 files changed, 69 insertions, 14 deletions
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h index e89922d6718c..f321b1d21227 100644 --- a/include/asm-sparc64/cpudata.h +++ b/include/asm-sparc64/cpudata.h | |||
@@ -17,11 +17,11 @@ | |||
17 | typedef struct { | 17 | typedef struct { |
18 | /* Dcache line 1 */ | 18 | /* Dcache line 1 */ |
19 | unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ | 19 | unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ |
20 | unsigned int __pad0_1; | 20 | unsigned int __pad0; |
21 | unsigned int __pad0_2; | ||
22 | unsigned int __pad1; | ||
23 | unsigned long clock_tick; /* %tick's per second */ | 21 | unsigned long clock_tick; /* %tick's per second */ |
24 | unsigned long udelay_val; | 22 | unsigned long udelay_val; |
23 | unsigned int __pad1; | ||
24 | unsigned int __pad2; | ||
25 | 25 | ||
26 | /* Dcache line 2, rarely used */ | 26 | /* Dcache line 2, rarely used */ |
27 | unsigned int dcache_size; | 27 | unsigned int dcache_size; |
@@ -30,8 +30,8 @@ typedef struct { | |||
30 | unsigned int icache_line_size; | 30 | unsigned int icache_line_size; |
31 | unsigned int ecache_size; | 31 | unsigned int ecache_size; |
32 | unsigned int ecache_line_size; | 32 | unsigned int ecache_line_size; |
33 | int core_id; | ||
33 | unsigned int __pad3; | 34 | unsigned int __pad3; |
34 | unsigned int __pad4; | ||
35 | } cpuinfo_sparc; | 35 | } cpuinfo_sparc; |
36 | 36 | ||
37 | DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data); | 37 | DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data); |
@@ -76,12 +76,18 @@ struct trap_per_cpu { | |||
76 | 76 | ||
77 | /* Dcache line 8: IRQ work list, and keep trap_block a power-of-2 in size. */ | 77 | /* Dcache line 8: IRQ work list, and keep trap_block a power-of-2 in size. */ |
78 | unsigned int irq_worklist; | 78 | unsigned int irq_worklist; |
79 | unsigned int __pad1; | 79 | unsigned int cpu_mondo_qmask; |
80 | unsigned long __pad2[3]; | 80 | unsigned int dev_mondo_qmask; |
81 | unsigned int resum_qmask; | ||
82 | unsigned int nonresum_qmask; | ||
83 | unsigned int __pad2[3]; | ||
81 | } __attribute__((aligned(64))); | 84 | } __attribute__((aligned(64))); |
82 | extern struct trap_per_cpu trap_block[NR_CPUS]; | 85 | extern struct trap_per_cpu trap_block[NR_CPUS]; |
83 | extern void init_cur_cpu_trap(struct thread_info *); | 86 | extern void init_cur_cpu_trap(struct thread_info *); |
84 | extern void setup_tba(void); | 87 | extern void setup_tba(void); |
88 | extern int ncpus_probed; | ||
89 | |||
90 | extern unsigned long real_hard_smp_processor_id(void); | ||
85 | 91 | ||
86 | struct cpuid_patch_entry { | 92 | struct cpuid_patch_entry { |
87 | unsigned int addr; | 93 | unsigned int addr; |
@@ -122,6 +128,10 @@ extern struct sun4v_2insn_patch_entry __sun4v_2insn_patch, | |||
122 | #define TRAP_PER_CPU_TSB_HUGE 0xd0 | 128 | #define TRAP_PER_CPU_TSB_HUGE 0xd0 |
123 | #define TRAP_PER_CPU_TSB_HUGE_TEMP 0xd8 | 129 | #define TRAP_PER_CPU_TSB_HUGE_TEMP 0xd8 |
124 | #define TRAP_PER_CPU_IRQ_WORKLIST 0xe0 | 130 | #define TRAP_PER_CPU_IRQ_WORKLIST 0xe0 |
131 | #define TRAP_PER_CPU_CPU_MONDO_QMASK 0xe4 | ||
132 | #define TRAP_PER_CPU_DEV_MONDO_QMASK 0xe8 | ||
133 | #define TRAP_PER_CPU_RESUM_QMASK 0xec | ||
134 | #define TRAP_PER_CPU_NONRESUM_QMASK 0xf0 | ||
125 | 135 | ||
126 | #define TRAP_BLOCK_SZ_SHIFT 8 | 136 | #define TRAP_BLOCK_SZ_SHIFT 8 |
127 | 137 | ||
diff --git a/include/asm-sparc64/hypervisor.h b/include/asm-sparc64/hypervisor.h index 17b233b64aff..0a241c82fc7b 100644 --- a/include/asm-sparc64/hypervisor.h +++ b/include/asm-sparc64/hypervisor.h | |||
@@ -120,6 +120,11 @@ | |||
120 | */ | 120 | */ |
121 | #define HV_FAST_MACH_DESC 0x01 | 121 | #define HV_FAST_MACH_DESC 0x01 |
122 | 122 | ||
123 | #ifndef __ASSEMBLY__ | ||
124 | extern unsigned long sun4v_mach_desc(unsigned long buffer_pa, unsigned long buf_len, | ||
125 | unsigned long *real_buf_len); | ||
126 | #endif | ||
127 | |||
123 | /* mach_exit() | 128 | /* mach_exit() |
124 | * TRAP: HV_FAST_TRAP | 129 | * TRAP: HV_FAST_TRAP |
125 | * FUNCTION: HV_FAST_MACH_SIR | 130 | * FUNCTION: HV_FAST_MACH_SIR |
diff --git a/include/asm-sparc64/mdesc.h b/include/asm-sparc64/mdesc.h new file mode 100644 index 000000000000..124eb8ca2378 --- /dev/null +++ b/include/asm-sparc64/mdesc.h | |||
@@ -0,0 +1,39 @@ | |||
1 | #ifndef _SPARC64_MDESC_H | ||
2 | #define _SPARC64_MDESC_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <asm/prom.h> | ||
6 | |||
7 | struct mdesc_node; | ||
8 | struct mdesc_arc { | ||
9 | const char *name; | ||
10 | struct mdesc_node *arc; | ||
11 | }; | ||
12 | |||
13 | struct mdesc_node { | ||
14 | const char *name; | ||
15 | u64 node; | ||
16 | unsigned int unique_id; | ||
17 | unsigned int num_arcs; | ||
18 | struct property *properties; | ||
19 | struct mdesc_node *hash_next; | ||
20 | struct mdesc_node *allnodes_next; | ||
21 | struct mdesc_arc arcs[0]; | ||
22 | }; | ||
23 | |||
24 | extern struct mdesc_node *md_find_node_by_name(struct mdesc_node *from, | ||
25 | const char *name); | ||
26 | #define md_for_each_node_by_name(__mn, __name) \ | ||
27 | for (__mn = md_find_node_by_name(NULL, __name); __mn; \ | ||
28 | __mn = md_find_node_by_name(__mn, __name)) | ||
29 | |||
30 | extern struct property *md_find_property(const struct mdesc_node *mp, | ||
31 | const char *name, | ||
32 | int *lenp); | ||
33 | extern const void *md_get_property(const struct mdesc_node *mp, | ||
34 | const char *name, | ||
35 | int *lenp); | ||
36 | |||
37 | extern void sun4v_mdesc_init(void); | ||
38 | |||
39 | #endif | ||
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h index 07275e2366a3..992f9f7a476c 100644 --- a/include/asm-sparc64/oplib.h +++ b/include/asm-sparc64/oplib.h | |||
@@ -319,11 +319,6 @@ extern int prom_inst2pkg(int); | |||
319 | extern int prom_service_exists(const char *service_name); | 319 | extern int prom_service_exists(const char *service_name); |
320 | extern void prom_sun4v_guest_soft_state(void); | 320 | extern void prom_sun4v_guest_soft_state(void); |
321 | 321 | ||
322 | /* CPU probing helpers. */ | ||
323 | struct device_node; | ||
324 | int cpu_find_by_instance(int instance, struct device_node **dev_node, int *mid); | ||
325 | int cpu_find_by_mid(int mid, struct device_node **prom_node); | ||
326 | |||
327 | /* Client interface level routines. */ | 322 | /* Client interface level routines. */ |
328 | extern void prom_set_trap_table(unsigned long tba); | 323 | extern void prom_set_trap_table(unsigned long tba); |
329 | extern void prom_set_trap_table_sun4v(unsigned long tba, unsigned long mmfsa); | 324 | extern void prom_set_trap_table_sun4v(unsigned long tba, unsigned long mmfsa); |
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h index ced8cbde046d..88db872ce2f8 100644 --- a/include/asm-sparc64/percpu.h +++ b/include/asm-sparc64/percpu.h | |||
@@ -5,7 +5,8 @@ | |||
5 | 5 | ||
6 | #ifdef CONFIG_SMP | 6 | #ifdef CONFIG_SMP |
7 | 7 | ||
8 | extern void setup_per_cpu_areas(void); | 8 | #define setup_per_cpu_areas() do { } while (0) |
9 | extern void real_setup_per_cpu_areas(void); | ||
9 | 10 | ||
10 | extern unsigned long __per_cpu_base; | 11 | extern unsigned long __per_cpu_base; |
11 | extern unsigned long __per_cpu_shift; | 12 | extern unsigned long __per_cpu_shift; |
@@ -34,6 +35,7 @@ do { \ | |||
34 | } while (0) | 35 | } while (0) |
35 | #else /* ! SMP */ | 36 | #else /* ! SMP */ |
36 | 37 | ||
38 | #define real_setup_per_cpu_areas() do { } while (0) | ||
37 | #define DEFINE_PER_CPU(type, name) \ | 39 | #define DEFINE_PER_CPU(type, name) \ |
38 | __typeof__(type) per_cpu__##name | 40 | __typeof__(type) per_cpu__##name |
39 | 41 | ||
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h index ddad5f99ac7f..b4df3042add0 100644 --- a/include/asm-sparc64/prom.h +++ b/include/asm-sparc64/prom.h | |||
@@ -90,6 +90,7 @@ extern struct device_node *of_find_compatible_node(struct device_node *from, | |||
90 | const char *type, const char *compat); | 90 | const char *type, const char *compat); |
91 | extern struct device_node *of_find_node_by_path(const char *path); | 91 | extern struct device_node *of_find_node_by_path(const char *path); |
92 | extern struct device_node *of_find_node_by_phandle(phandle handle); | 92 | extern struct device_node *of_find_node_by_phandle(phandle handle); |
93 | extern struct device_node *of_find_node_by_cpuid(int cpuid); | ||
93 | extern struct device_node *of_get_parent(const struct device_node *node); | 94 | extern struct device_node *of_get_parent(const struct device_node *node); |
94 | extern struct device_node *of_get_next_child(const struct device_node *node, | 95 | extern struct device_node *of_get_next_child(const struct device_node *node, |
95 | struct device_node *prev); | 96 | struct device_node *prev); |
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h index 869d16fb907b..f76e1492add5 100644 --- a/include/asm-sparc64/smp.h +++ b/include/asm-sparc64/smp.h | |||
@@ -41,7 +41,7 @@ extern cpumask_t cpu_sibling_map[NR_CPUS]; | |||
41 | extern int hard_smp_processor_id(void); | 41 | extern int hard_smp_processor_id(void); |
42 | #define raw_smp_processor_id() (current_thread_info()->cpu) | 42 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
43 | 43 | ||
44 | extern void smp_setup_cpu_possible_map(void); | 44 | extern void smp_fill_in_sib_core_maps(void); |
45 | extern unsigned char boot_cpu_id; | 45 | extern unsigned char boot_cpu_id; |
46 | 46 | ||
47 | #endif /* !(__ASSEMBLY__) */ | 47 | #endif /* !(__ASSEMBLY__) */ |
@@ -49,7 +49,7 @@ extern unsigned char boot_cpu_id; | |||
49 | #else | 49 | #else |
50 | 50 | ||
51 | #define hard_smp_processor_id() 0 | 51 | #define hard_smp_processor_id() 0 |
52 | #define smp_setup_cpu_possible_map() do { } while (0) | 52 | #define smp_fill_in_sib_core_maps() do { } while (0) |
53 | #define boot_cpu_id (0) | 53 | #define boot_cpu_id (0) |
54 | 54 | ||
55 | #endif /* !(CONFIG_SMP) */ | 55 | #endif /* !(CONFIG_SMP) */ |
diff --git a/include/asm-sparc64/topology.h b/include/asm-sparc64/topology.h index 98a6c613589d..e0d450d600ec 100644 --- a/include/asm-sparc64/topology.h +++ b/include/asm-sparc64/topology.h | |||
@@ -6,4 +6,7 @@ | |||
6 | 6 | ||
7 | #include <asm-generic/topology.h> | 7 | #include <asm-generic/topology.h> |
8 | 8 | ||
9 | #define topology_core_id(cpu) (cpu_data(cpu).core_id) | ||
10 | #define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) | ||
11 | |||
9 | #endif /* _ASM_SPARC64_TOPOLOGY_H */ | 12 | #endif /* _ASM_SPARC64_TOPOLOGY_H */ |