xref: /linux/arch/sparc/kernel/cpu.c (revision 3560f788fe207de25c96ea547c56fc8a750e37a5)
1d34dd829SSam Ravnborg /* cpu.c: Dinky routines to look for the kind of Sparc cpu
2d34dd829SSam Ravnborg  *        we are on.
3d34dd829SSam Ravnborg  *
4d34dd829SSam Ravnborg  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
5d34dd829SSam Ravnborg  */
6d34dd829SSam Ravnborg 
7d34dd829SSam Ravnborg #include <linux/kernel.h>
86943f3daSSam Ravnborg #include <linux/module.h>
9d34dd829SSam Ravnborg #include <linux/init.h>
10d34dd829SSam Ravnborg #include <linux/smp.h>
11d34dd829SSam Ravnborg #include <linux/threads.h>
12d34dd829SSam Ravnborg 
13d34dd829SSam Ravnborg #include <asm/spitfire.h>
14d34dd829SSam Ravnborg #include <asm/oplib.h>
15d34dd829SSam Ravnborg #include <asm/page.h>
16d34dd829SSam Ravnborg #include <asm/head.h>
17d34dd829SSam Ravnborg #include <asm/psr.h>
18d34dd829SSam Ravnborg #include <asm/mbus.h>
19d34dd829SSam Ravnborg #include <asm/cpudata.h>
20d34dd829SSam Ravnborg 
21d34dd829SSam Ravnborg #include "kernel.h"
22d34dd829SSam Ravnborg 
23d34dd829SSam Ravnborg DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
246943f3daSSam Ravnborg EXPORT_PER_CPU_SYMBOL(__cpu_data);
25d34dd829SSam Ravnborg 
26d34dd829SSam Ravnborg struct cpu_info {
27d34dd829SSam Ravnborg 	int psr_vers;
28d34dd829SSam Ravnborg 	const char *name;
29c3cf5e8cSDavid S. Miller 	const char *pmu_name;
30d34dd829SSam Ravnborg };
31d34dd829SSam Ravnborg 
32d34dd829SSam Ravnborg struct fpu_info {
33d34dd829SSam Ravnborg 	int fp_vers;
34d34dd829SSam Ravnborg 	const char *name;
35d34dd829SSam Ravnborg };
36d34dd829SSam Ravnborg 
37d34dd829SSam Ravnborg #define NOCPU 8
38d34dd829SSam Ravnborg #define NOFPU 8
39d34dd829SSam Ravnborg 
40d34dd829SSam Ravnborg struct manufacturer_info {
41d34dd829SSam Ravnborg 	int psr_impl;
42d34dd829SSam Ravnborg 	struct cpu_info cpu_info[NOCPU];
43d34dd829SSam Ravnborg 	struct fpu_info fpu_info[NOFPU];
44d34dd829SSam Ravnborg };
45d34dd829SSam Ravnborg 
46d34dd829SSam Ravnborg #define CPU(ver, _name) \
47d34dd829SSam Ravnborg { .psr_vers = ver, .name = _name }
48d34dd829SSam Ravnborg 
49c3cf5e8cSDavid S. Miller #define CPU_PMU(ver, _name, _pmu_name)	\
50c3cf5e8cSDavid S. Miller { .psr_vers = ver, .name = _name, .pmu_name = _pmu_name }
51c3cf5e8cSDavid S. Miller 
52d34dd829SSam Ravnborg #define FPU(ver, _name) \
53d34dd829SSam Ravnborg { .fp_vers = ver, .name = _name }
54d34dd829SSam Ravnborg 
55d34dd829SSam Ravnborg static const struct manufacturer_info __initconst manufacturer_info[] = {
56d34dd829SSam Ravnborg {
57d34dd829SSam Ravnborg 	0,
58d34dd829SSam Ravnborg 	/* Sun4/100, 4/200, SLC */
59d34dd829SSam Ravnborg 	.cpu_info = {
60d34dd829SSam Ravnborg 		CPU(0, "Fujitsu  MB86900/1A or LSI L64831 SparcKIT-40"),
61d34dd829SSam Ravnborg 		/* borned STP1012PGA */
62d34dd829SSam Ravnborg 		CPU(4,  "Fujitsu  MB86904"),
63d34dd829SSam Ravnborg 		CPU(5, "Fujitsu TurboSparc MB86907"),
64d34dd829SSam Ravnborg 		CPU(-1, NULL)
65d34dd829SSam Ravnborg 	},
66d34dd829SSam Ravnborg 	.fpu_info = {
67d34dd829SSam Ravnborg 		FPU(0, "Fujitsu MB86910 or Weitek WTL1164/5"),
68d34dd829SSam Ravnborg 		FPU(1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"),
69d34dd829SSam Ravnborg 		FPU(2, "LSI Logic L64802 or Texas Instruments ACT8847"),
70d34dd829SSam Ravnborg 		/* SparcStation SLC, SparcStation1 */
71d34dd829SSam Ravnborg 		FPU(3, "Weitek WTL3170/2"),
72d34dd829SSam Ravnborg 		/* SPARCstation-5 */
73d34dd829SSam Ravnborg 		FPU(4, "Lsi Logic/Meiko L64804 or compatible"),
74d34dd829SSam Ravnborg 		FPU(-1, NULL)
75d34dd829SSam Ravnborg 	}
76d34dd829SSam Ravnborg },{
77d34dd829SSam Ravnborg 	1,
78d34dd829SSam Ravnborg 	.cpu_info = {
79d34dd829SSam Ravnborg 		/* SparcStation2, SparcServer 490 & 690 */
80d34dd829SSam Ravnborg 		CPU(0, "LSI Logic Corporation - L64811"),
81d34dd829SSam Ravnborg 		/* SparcStation2 */
82d34dd829SSam Ravnborg 		CPU(1, "Cypress/ROSS CY7C601"),
83d34dd829SSam Ravnborg 		/* Embedded controller */
84d34dd829SSam Ravnborg 		CPU(3, "Cypress/ROSS CY7C611"),
85d34dd829SSam Ravnborg 		/* Ross Technologies HyperSparc */
86d34dd829SSam Ravnborg 		CPU(0xf, "ROSS HyperSparc RT620"),
87d34dd829SSam Ravnborg 		CPU(0xe, "ROSS HyperSparc RT625 or RT626"),
88d34dd829SSam Ravnborg 		CPU(-1, NULL)
89d34dd829SSam Ravnborg 	},
90d34dd829SSam Ravnborg 	.fpu_info = {
91d34dd829SSam Ravnborg 		FPU(0, "ROSS HyperSparc combined IU/FPU"),
92d34dd829SSam Ravnborg 		FPU(1, "Lsi Logic L64814"),
93d34dd829SSam Ravnborg 		FPU(2, "Texas Instruments TMS390-C602A"),
94d34dd829SSam Ravnborg 		FPU(3, "Cypress CY7C602 FPU"),
95d34dd829SSam Ravnborg 		FPU(-1, NULL)
96d34dd829SSam Ravnborg 	}
97d34dd829SSam Ravnborg },{
98d34dd829SSam Ravnborg 	2,
99d34dd829SSam Ravnborg 	.cpu_info = {
100d34dd829SSam Ravnborg 		/* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */
101d34dd829SSam Ravnborg 		/* Someone please write the code to support this beast! ;) */
102d34dd829SSam Ravnborg 		CPU(0, "Bipolar Integrated Technology - B5010"),
103d34dd829SSam Ravnborg 		CPU(-1, NULL)
104d34dd829SSam Ravnborg 	},
105d34dd829SSam Ravnborg 	.fpu_info = {
106d34dd829SSam Ravnborg 		FPU(-1, NULL)
107d34dd829SSam Ravnborg 	}
108d34dd829SSam Ravnborg },{
109d34dd829SSam Ravnborg 	3,
110d34dd829SSam Ravnborg 	.cpu_info = {
111d34dd829SSam Ravnborg 		CPU(0, "LSI Logic Corporation - unknown-type"),
112d34dd829SSam Ravnborg 		CPU(-1, NULL)
113d34dd829SSam Ravnborg 	},
114d34dd829SSam Ravnborg 	.fpu_info = {
115d34dd829SSam Ravnborg 		FPU(-1, NULL)
116d34dd829SSam Ravnborg 	}
117d34dd829SSam Ravnborg },{
118d34dd829SSam Ravnborg 	4,
119d34dd829SSam Ravnborg 	.cpu_info = {
120d34dd829SSam Ravnborg 		CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"),
121d34dd829SSam Ravnborg 		/* SparcClassic  --  borned STP1010TAB-50*/
122d34dd829SSam Ravnborg 		CPU(1, "Texas Instruments, Inc. - MicroSparc"),
123d34dd829SSam Ravnborg 		CPU(2, "Texas Instruments, Inc. - MicroSparc II"),
124d34dd829SSam Ravnborg 		CPU(3, "Texas Instruments, Inc. - SuperSparc 51"),
125d34dd829SSam Ravnborg 		CPU(4, "Texas Instruments, Inc. - SuperSparc 61"),
126d34dd829SSam Ravnborg 		CPU(5, "Texas Instruments, Inc. - unknown"),
127d34dd829SSam Ravnborg 		CPU(-1, NULL)
128d34dd829SSam Ravnborg 	},
129d34dd829SSam Ravnborg 	.fpu_info = {
130d34dd829SSam Ravnborg 		/* SuperSparc 50 module */
131d34dd829SSam Ravnborg 		FPU(0, "SuperSparc on-chip FPU"),
132d34dd829SSam Ravnborg 		/* SparcClassic */
133d34dd829SSam Ravnborg 		FPU(4, "TI MicroSparc on chip FPU"),
134d34dd829SSam Ravnborg 		FPU(-1, NULL)
135d34dd829SSam Ravnborg 	}
136d34dd829SSam Ravnborg },{
137d34dd829SSam Ravnborg 	5,
138d34dd829SSam Ravnborg 	.cpu_info = {
139d34dd829SSam Ravnborg 		CPU(0, "Matsushita - MN10501"),
140d34dd829SSam Ravnborg 		CPU(-1, NULL)
141d34dd829SSam Ravnborg 	},
142d34dd829SSam Ravnborg 	.fpu_info = {
143d34dd829SSam Ravnborg 		FPU(0, "Matsushita MN10501"),
144d34dd829SSam Ravnborg 		FPU(-1, NULL)
145d34dd829SSam Ravnborg 	}
146d34dd829SSam Ravnborg },{
147d34dd829SSam Ravnborg 	6,
148d34dd829SSam Ravnborg 	.cpu_info = {
149d34dd829SSam Ravnborg 		CPU(0, "Philips Corporation - unknown"),
150d34dd829SSam Ravnborg 		CPU(-1, NULL)
151d34dd829SSam Ravnborg 	},
152d34dd829SSam Ravnborg 	.fpu_info = {
153d34dd829SSam Ravnborg 		FPU(-1, NULL)
154d34dd829SSam Ravnborg 	}
155d34dd829SSam Ravnborg },{
156d34dd829SSam Ravnborg 	7,
157d34dd829SSam Ravnborg 	.cpu_info = {
158d34dd829SSam Ravnborg 		CPU(0, "Harvest VLSI Design Center, Inc. - unknown"),
159d34dd829SSam Ravnborg 		CPU(-1, NULL)
160d34dd829SSam Ravnborg 	},
161d34dd829SSam Ravnborg 	.fpu_info = {
162d34dd829SSam Ravnborg 		FPU(-1, NULL)
163d34dd829SSam Ravnborg 	}
164d34dd829SSam Ravnborg },{
165d34dd829SSam Ravnborg 	8,
166d34dd829SSam Ravnborg 	.cpu_info = {
167d34dd829SSam Ravnborg 		CPU(0, "Systems and Processes Engineering Corporation (SPEC)"),
168d34dd829SSam Ravnborg 		CPU(-1, NULL)
169d34dd829SSam Ravnborg 	},
170d34dd829SSam Ravnborg 	.fpu_info = {
171d34dd829SSam Ravnborg 		FPU(-1, NULL)
172d34dd829SSam Ravnborg 	}
173d34dd829SSam Ravnborg },{
174d34dd829SSam Ravnborg 	9,
175d34dd829SSam Ravnborg 	.cpu_info = {
176d34dd829SSam Ravnborg 		/* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */
177d34dd829SSam Ravnborg 		CPU(0, "Fujitsu or Weitek Power-UP"),
178d34dd829SSam Ravnborg 		CPU(1, "Fujitsu or Weitek Power-UP"),
179d34dd829SSam Ravnborg 		CPU(2, "Fujitsu or Weitek Power-UP"),
180d34dd829SSam Ravnborg 		CPU(3, "Fujitsu or Weitek Power-UP"),
181d34dd829SSam Ravnborg 		CPU(-1, NULL)
182d34dd829SSam Ravnborg 	},
183d34dd829SSam Ravnborg 	.fpu_info = {
184d34dd829SSam Ravnborg 		FPU(3, "Fujitsu or Weitek on-chip FPU"),
185d34dd829SSam Ravnborg 		FPU(-1, NULL)
186d34dd829SSam Ravnborg 	}
187d34dd829SSam Ravnborg },{
188*3560f788SKristoffer Glembo 	0xF,		/* Aeroflex Gaisler */
189*3560f788SKristoffer Glembo 	.cpu_info = {
190*3560f788SKristoffer Glembo 		CPU(3, "LEON"),
191*3560f788SKristoffer Glembo 		CPU(-1, NULL)
192*3560f788SKristoffer Glembo 	},
193*3560f788SKristoffer Glembo 	.fpu_info = {
194*3560f788SKristoffer Glembo 		FPU(2, "GRFPU"),
195*3560f788SKristoffer Glembo 		FPU(3, "GRFPU-Lite"),
196*3560f788SKristoffer Glembo 		FPU(-1, NULL)
197*3560f788SKristoffer Glembo 	}
198*3560f788SKristoffer Glembo },{
199d34dd829SSam Ravnborg 	0x17,
200d34dd829SSam Ravnborg 	.cpu_info = {
201c3cf5e8cSDavid S. Miller 		CPU_PMU(0x10, "TI UltraSparc I   (SpitFire)", "ultra12"),
202c3cf5e8cSDavid S. Miller 		CPU_PMU(0x11, "TI UltraSparc II  (BlackBird)", "ultra12"),
203c3cf5e8cSDavid S. Miller 		CPU_PMU(0x12, "TI UltraSparc IIi (Sabre)", "ultra12"),
204c3cf5e8cSDavid S. Miller 		CPU_PMU(0x13, "TI UltraSparc IIe (Hummingbird)", "ultra12"),
205d34dd829SSam Ravnborg 		CPU(-1, NULL)
206d34dd829SSam Ravnborg 	},
207d34dd829SSam Ravnborg 	.fpu_info = {
208d34dd829SSam Ravnborg 		FPU(0x10, "UltraSparc I integrated FPU"),
209d34dd829SSam Ravnborg 		FPU(0x11, "UltraSparc II integrated FPU"),
210d34dd829SSam Ravnborg 		FPU(0x12, "UltraSparc IIi integrated FPU"),
211d34dd829SSam Ravnborg 		FPU(0x13, "UltraSparc IIe integrated FPU"),
212d34dd829SSam Ravnborg 		FPU(-1, NULL)
213d34dd829SSam Ravnborg 	}
214d34dd829SSam Ravnborg },{
215d34dd829SSam Ravnborg 	0x22,
216d34dd829SSam Ravnborg 	.cpu_info = {
217c3cf5e8cSDavid S. Miller 		CPU_PMU(0x10, "TI UltraSparc I   (SpitFire)", "ultra12"),
218d34dd829SSam Ravnborg 		CPU(-1, NULL)
219d34dd829SSam Ravnborg 	},
220d34dd829SSam Ravnborg 	.fpu_info = {
221d34dd829SSam Ravnborg 		FPU(0x10, "UltraSparc I integrated FPU"),
222d34dd829SSam Ravnborg 		FPU(-1, NULL)
223d34dd829SSam Ravnborg 	}
224d34dd829SSam Ravnborg },{
225d34dd829SSam Ravnborg 	0x3e,
226d34dd829SSam Ravnborg 	.cpu_info = {
227c3cf5e8cSDavid S. Miller 		CPU_PMU(0x14, "TI UltraSparc III (Cheetah)", "ultra3"),
228c3cf5e8cSDavid S. Miller 		CPU_PMU(0x15, "TI UltraSparc III+ (Cheetah+)", "ultra3+"),
229c3cf5e8cSDavid S. Miller 		CPU_PMU(0x16, "TI UltraSparc IIIi (Jalapeno)", "ultra3i"),
230c3cf5e8cSDavid S. Miller 		CPU_PMU(0x18, "TI UltraSparc IV (Jaguar)", "ultra3+"),
231c3cf5e8cSDavid S. Miller 		CPU_PMU(0x19, "TI UltraSparc IV+ (Panther)", "ultra4+"),
232c3cf5e8cSDavid S. Miller 		CPU_PMU(0x22, "TI UltraSparc IIIi+ (Serrano)", "ultra3i"),
233d34dd829SSam Ravnborg 		CPU(-1, NULL)
234d34dd829SSam Ravnborg 	},
235d34dd829SSam Ravnborg 	.fpu_info = {
236d34dd829SSam Ravnborg 		FPU(0x14, "UltraSparc III integrated FPU"),
237d34dd829SSam Ravnborg 		FPU(0x15, "UltraSparc III+ integrated FPU"),
238d34dd829SSam Ravnborg 		FPU(0x16, "UltraSparc IIIi integrated FPU"),
239d34dd829SSam Ravnborg 		FPU(0x18, "UltraSparc IV integrated FPU"),
240d34dd829SSam Ravnborg 		FPU(0x19, "UltraSparc IV+ integrated FPU"),
241d34dd829SSam Ravnborg 		FPU(0x22, "UltraSparc IIIi+ integrated FPU"),
242d34dd829SSam Ravnborg 		FPU(-1, NULL)
243d34dd829SSam Ravnborg 	}
244d34dd829SSam Ravnborg }};
245d34dd829SSam Ravnborg 
246d34dd829SSam Ravnborg /* In order to get the fpu type correct, you need to take the IDPROM's
247d34dd829SSam Ravnborg  * machine type value into consideration too.  I will fix this.
248d34dd829SSam Ravnborg  */
249d34dd829SSam Ravnborg 
250d34dd829SSam Ravnborg const char *sparc_cpu_type;
251d34dd829SSam Ravnborg const char *sparc_fpu_type;
252c3cf5e8cSDavid S. Miller const char *sparc_pmu_type;
253d34dd829SSam Ravnborg 
254d34dd829SSam Ravnborg unsigned int fsr_storage;
255d34dd829SSam Ravnborg 
256d34dd829SSam Ravnborg static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
257d34dd829SSam Ravnborg {
258c275ce44SSam Ravnborg 	const struct manufacturer_info *manuf;
259c275ce44SSam Ravnborg 	int i;
260c275ce44SSam Ravnborg 
261d34dd829SSam Ravnborg 	sparc_cpu_type = NULL;
262d34dd829SSam Ravnborg 	sparc_fpu_type = NULL;
263c3cf5e8cSDavid S. Miller 	sparc_pmu_type = NULL;
264c275ce44SSam Ravnborg 	manuf = NULL;
265c275ce44SSam Ravnborg 
266c275ce44SSam Ravnborg 	for (i = 0; i < ARRAY_SIZE(manufacturer_info); i++)
267c275ce44SSam Ravnborg 	{
268c275ce44SSam Ravnborg 		if (psr_impl == manufacturer_info[i].psr_impl) {
269c275ce44SSam Ravnborg 			manuf = &manufacturer_info[i];
270c275ce44SSam Ravnborg 			break;
271c275ce44SSam Ravnborg 		}
272c275ce44SSam Ravnborg 	}
273c275ce44SSam Ravnborg 	if (manuf != NULL)
274d34dd829SSam Ravnborg 	{
275d34dd829SSam Ravnborg 		const struct cpu_info *cpu;
276d34dd829SSam Ravnborg 		const struct fpu_info *fpu;
277d34dd829SSam Ravnborg 
278c275ce44SSam Ravnborg 		cpu = &manuf->cpu_info[0];
279d34dd829SSam Ravnborg 		while (cpu->psr_vers != -1)
280d34dd829SSam Ravnborg 		{
281d34dd829SSam Ravnborg 			if (cpu->psr_vers == psr_vers) {
282d34dd829SSam Ravnborg 				sparc_cpu_type = cpu->name;
283c3cf5e8cSDavid S. Miller 				sparc_pmu_type = cpu->pmu_name;
284d34dd829SSam Ravnborg 				sparc_fpu_type = "No FPU";
285d34dd829SSam Ravnborg 				break;
286d34dd829SSam Ravnborg 			}
287d34dd829SSam Ravnborg 			cpu++;
288d34dd829SSam Ravnborg 		}
289c275ce44SSam Ravnborg 		fpu =  &manuf->fpu_info[0];
290d34dd829SSam Ravnborg 		while (fpu->fp_vers != -1)
291d34dd829SSam Ravnborg 		{
292d34dd829SSam Ravnborg 			if (fpu->fp_vers == fpu_vers) {
293d34dd829SSam Ravnborg 				sparc_fpu_type = fpu->name;
294d34dd829SSam Ravnborg 				break;
295d34dd829SSam Ravnborg 			}
296d34dd829SSam Ravnborg 			fpu++;
297d34dd829SSam Ravnborg 		}
298d34dd829SSam Ravnborg 	}
299d34dd829SSam Ravnborg 	if (sparc_cpu_type == NULL)
300d34dd829SSam Ravnborg 	{
301d34dd829SSam Ravnborg 		printk(KERN_ERR "CPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
302d34dd829SSam Ravnborg 		       psr_impl, psr_vers);
303d34dd829SSam Ravnborg 		sparc_cpu_type = "Unknown CPU";
304d34dd829SSam Ravnborg 	}
305d34dd829SSam Ravnborg 	if (sparc_fpu_type == NULL)
306d34dd829SSam Ravnborg 	{
307d34dd829SSam Ravnborg 		printk(KERN_ERR "FPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
308d34dd829SSam Ravnborg 		       psr_impl, fpu_vers);
309d34dd829SSam Ravnborg 		sparc_fpu_type = "Unknown FPU";
310d34dd829SSam Ravnborg 	}
311c3cf5e8cSDavid S. Miller 	if (sparc_pmu_type == NULL)
312c3cf5e8cSDavid S. Miller 		sparc_pmu_type = "Unknown PMU";
313d34dd829SSam Ravnborg }
314d34dd829SSam Ravnborg 
315d34dd829SSam Ravnborg #ifdef CONFIG_SPARC32
316d34dd829SSam Ravnborg void __cpuinit cpu_probe(void)
317d34dd829SSam Ravnborg {
318d34dd829SSam Ravnborg 	int psr_impl, psr_vers, fpu_vers;
319d34dd829SSam Ravnborg 	int psr;
320d34dd829SSam Ravnborg 
321d34dd829SSam Ravnborg 	psr_impl = ((get_psr() >> 28) & 0xf);
322d34dd829SSam Ravnborg 	psr_vers = ((get_psr() >> 24) & 0xf);
323d34dd829SSam Ravnborg 
324d34dd829SSam Ravnborg 	psr = get_psr();
325d34dd829SSam Ravnborg 	put_psr(psr | PSR_EF);
3260fd7ef1fSKonrad Eisele #ifdef CONFIG_SPARC_LEON
3270fd7ef1fSKonrad Eisele 	fpu_vers = 7;
3280fd7ef1fSKonrad Eisele #else
329d34dd829SSam Ravnborg 	fpu_vers = ((get_fsr() >> 17) & 0x7);
3300fd7ef1fSKonrad Eisele #endif
3310fd7ef1fSKonrad Eisele 
332d34dd829SSam Ravnborg 	put_psr(psr);
333d34dd829SSam Ravnborg 
334d34dd829SSam Ravnborg 	set_cpu_and_fpu(psr_impl, psr_vers, fpu_vers);
335d34dd829SSam Ravnborg }
336d34dd829SSam Ravnborg #else
337d34dd829SSam Ravnborg static void __init sun4v_cpu_probe(void)
338d34dd829SSam Ravnborg {
339d34dd829SSam Ravnborg 	switch (sun4v_chip_type) {
340d34dd829SSam Ravnborg 	case SUN4V_CHIP_NIAGARA1:
341d34dd829SSam Ravnborg 		sparc_cpu_type = "UltraSparc T1 (Niagara)";
342d34dd829SSam Ravnborg 		sparc_fpu_type = "UltraSparc T1 integrated FPU";
343c3cf5e8cSDavid S. Miller 		sparc_pmu_type = "niagara";
344d34dd829SSam Ravnborg 		break;
345d34dd829SSam Ravnborg 
346d34dd829SSam Ravnborg 	case SUN4V_CHIP_NIAGARA2:
347d34dd829SSam Ravnborg 		sparc_cpu_type = "UltraSparc T2 (Niagara2)";
348d34dd829SSam Ravnborg 		sparc_fpu_type = "UltraSparc T2 integrated FPU";
349c3cf5e8cSDavid S. Miller 		sparc_pmu_type = "niagara2";
350d34dd829SSam Ravnborg 		break;
351d34dd829SSam Ravnborg 
352d34dd829SSam Ravnborg 	default:
353d34dd829SSam Ravnborg 		printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
354d34dd829SSam Ravnborg 		       prom_cpu_compatible);
355d34dd829SSam Ravnborg 		sparc_cpu_type = "Unknown SUN4V CPU";
356d34dd829SSam Ravnborg 		sparc_fpu_type = "Unknown SUN4V FPU";
357d34dd829SSam Ravnborg 		break;
358d34dd829SSam Ravnborg 	}
359d34dd829SSam Ravnborg }
360d34dd829SSam Ravnborg 
361d34dd829SSam Ravnborg static int __init cpu_type_probe(void)
362d34dd829SSam Ravnborg {
363d34dd829SSam Ravnborg 	if (tlb_type == hypervisor) {
364d34dd829SSam Ravnborg 		sun4v_cpu_probe();
365d34dd829SSam Ravnborg 	} else {
366d34dd829SSam Ravnborg 		unsigned long ver;
367d34dd829SSam Ravnborg 		int manuf, impl;
368d34dd829SSam Ravnborg 
369d34dd829SSam Ravnborg 		__asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver));
370d34dd829SSam Ravnborg 
371d34dd829SSam Ravnborg 		manuf = ((ver >> 48) & 0xffff);
372d34dd829SSam Ravnborg 		impl = ((ver >> 32) & 0xffff);
373d34dd829SSam Ravnborg 		set_cpu_and_fpu(manuf, impl, impl);
374d34dd829SSam Ravnborg 	}
375d34dd829SSam Ravnborg 	return 0;
376d34dd829SSam Ravnborg }
377d34dd829SSam Ravnborg 
378d34dd829SSam Ravnborg arch_initcall(cpu_type_probe);
379d34dd829SSam Ravnborg #endif
380