diff options
-rw-r--r-- | arch/sparc64/kernel/devices.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/arch/sparc64/kernel/devices.c b/arch/sparc64/kernel/devices.c index df9a1ca8fd77..ac11d872ef74 100644 --- a/arch/sparc64/kernel/devices.c +++ b/arch/sparc64/kernel/devices.c | |||
@@ -29,13 +29,30 @@ DEFINE_SPINLOCK(ns87303_lock); | |||
29 | extern void cpu_probe(void); | 29 | extern void cpu_probe(void); |
30 | extern void central_probe(void); | 30 | extern void central_probe(void); |
31 | 31 | ||
32 | static char *cpu_mid_prop(void) | 32 | static const char *cpu_mid_prop(void) |
33 | { | 33 | { |
34 | if (tlb_type == spitfire) | 34 | if (tlb_type == spitfire) |
35 | return "upa-portid"; | 35 | return "upa-portid"; |
36 | return "portid"; | 36 | return "portid"; |
37 | } | 37 | } |
38 | 38 | ||
39 | static int get_cpu_mid(int prom_node) | ||
40 | { | ||
41 | if (tlb_type == hypervisor) { | ||
42 | struct linux_prom64_registers reg; | ||
43 | |||
44 | if (prom_getproplen(prom_node, "cpuid") == 4) | ||
45 | return prom_getintdefault(prom_node, "cpuid", 0); | ||
46 | |||
47 | prom_getproperty(prom_node, "reg", (char *) ®, sizeof(reg)); | ||
48 | return (reg.phys_addr >> 32) & 0x0fffffffUL; | ||
49 | } else { | ||
50 | const char *prop_name = cpu_mid_prop(); | ||
51 | |||
52 | return prom_getintdefault(prom_node, prop_name, 0); | ||
53 | } | ||
54 | } | ||
55 | |||
39 | static int check_cpu_node(int nd, int *cur_inst, | 56 | static int check_cpu_node(int nd, int *cur_inst, |
40 | int (*compare)(int, int, void *), void *compare_arg, | 57 | int (*compare)(int, int, void *), void *compare_arg, |
41 | int *prom_node, int *mid) | 58 | int *prom_node, int *mid) |
@@ -50,7 +67,7 @@ static int check_cpu_node(int nd, int *cur_inst, | |||
50 | if (prom_node) | 67 | if (prom_node) |
51 | *prom_node = nd; | 68 | *prom_node = nd; |
52 | if (mid) | 69 | if (mid) |
53 | *mid = prom_getintdefault(nd, cpu_mid_prop(), 0); | 70 | *mid = get_cpu_mid(nd); |
54 | return 0; | 71 | return 0; |
55 | } | 72 | } |
56 | 73 | ||
@@ -105,7 +122,7 @@ static int cpu_mid_compare(int nd, int instance, void *_arg) | |||
105 | int desired_mid = (int) (long) _arg; | 122 | int desired_mid = (int) (long) _arg; |
106 | int this_mid; | 123 | int this_mid; |
107 | 124 | ||
108 | this_mid = prom_getintdefault(nd, cpu_mid_prop(), 0); | 125 | this_mid = get_cpu_mid(nd); |
109 | if (this_mid == desired_mid) | 126 | if (this_mid == desired_mid) |
110 | return 0; | 127 | return 0; |
111 | return -ENODEV; | 128 | return -ENODEV; |