Skip to content

Commit

Permalink
sparc: unify kernel/cpu
Browse files Browse the repository at this point in the history
o use cpu_32.c as base
o move all sparc64 definitions to the common cpu.c
o use ifdef for the parts that differs and use cpu_32 as base
o spitfire.h required a CONFIG_SPARC64 guard to fix build on 32 bit

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sam Ravnborg authored and David S. Miller committed Dec 7, 2008
1 parent 2bf05fa commit d34dd82
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 169 deletions.
4 changes: 3 additions & 1 deletion arch/sparc/include/asm/spitfire.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef _SPARC64_SPITFIRE_H
#define _SPARC64_SPITFIRE_H

#ifdef CONFIG_SPARC64

#include <asm/asi.h>

/* The following register addresses are accessible via ASI_DMMU
Expand Down Expand Up @@ -338,5 +340,5 @@ static inline void cheetah_put_itlb_data(int entry, unsigned long data)
}

#endif /* !(__ASSEMBLY__) */

#endif /* CONFIG_SPARC64 */
#endif /* !(_SPARC64_SPITFIRE_H) */
2 changes: 1 addition & 1 deletion arch/sparc/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ obj-y += sys_sparc_$(BITS).o
obj-$(CONFIG_SPARC32) += systbls_32.o
obj-y += time_$(BITS).o
obj-$(CONFIG_SPARC32) += windows.o
obj-y += cpu_$(BITS).o
obj-y += cpu.o
obj-$(CONFIG_SPARC32) += devices.o
obj-$(CONFIG_SPARC32) += tadpole.o
obj-$(CONFIG_SPARC32) += tick14.o
Expand Down
91 changes: 91 additions & 0 deletions arch/sparc/kernel/cpu_32.c → arch/sparc/kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <linux/init.h>
#include <linux/smp.h>
#include <linux/threads.h>

#include <asm/spitfire.h>
#include <asm/oplib.h>
#include <asm/page.h>
#include <asm/head.h>
Expand Down Expand Up @@ -176,6 +178,52 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
FPU(3, "Fujitsu or Weitek on-chip FPU"),
FPU(-1, NULL)
}
},{
0x17,
.cpu_info = {
CPU(0x10, "TI UltraSparc I (SpitFire)"),
CPU(0x11, "TI UltraSparc II (BlackBird)"),
CPU(0x12, "TI UltraSparc IIi (Sabre)"),
CPU(0x13, "TI UltraSparc IIe (Hummingbird)"),
CPU(-1, NULL)
},
.fpu_info = {
FPU(0x10, "UltraSparc I integrated FPU"),
FPU(0x11, "UltraSparc II integrated FPU"),
FPU(0x12, "UltraSparc IIi integrated FPU"),
FPU(0x13, "UltraSparc IIe integrated FPU"),
FPU(-1, NULL)
}
},{
0x22,
.cpu_info = {
CPU(0x10, "TI UltraSparc I (SpitFire)"),
CPU(-1, NULL)
},
.fpu_info = {
FPU(0x10, "UltraSparc I integrated FPU"),
FPU(-1, NULL)
}
},{
0x3e,
.cpu_info = {
CPU(0x14, "TI UltraSparc III (Cheetah)"),
CPU(0x15, "TI UltraSparc III+ (Cheetah+)"),
CPU(0x16, "TI UltraSparc IIIi (Jalapeno)"),
CPU(0x18, "TI UltraSparc IV (Jaguar)"),
CPU(0x19, "TI UltraSparc IV+ (Panther)"),
CPU(0x22, "TI UltraSparc IIIi+ (Serrano)"),
CPU(-1, NULL)
},
.fpu_info = {
FPU(0x14, "UltraSparc III integrated FPU"),
FPU(0x15, "UltraSparc III+ integrated FPU"),
FPU(0x16, "UltraSparc IIIi integrated FPU"),
FPU(0x18, "UltraSparc IV integrated FPU"),
FPU(0x19, "UltraSparc IV+ integrated FPU"),
FPU(0x22, "UltraSparc IIIi+ integrated FPU"),
FPU(-1, NULL)
}
}};

/* In order to get the fpu type correct, you need to take the IDPROM's
Expand Down Expand Up @@ -230,6 +278,7 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
}
}

#ifdef CONFIG_SPARC32
void __cpuinit cpu_probe(void)
{
int psr_impl, psr_vers, fpu_vers;
Expand All @@ -245,3 +294,45 @@ void __cpuinit cpu_probe(void)

set_cpu_and_fpu(psr_impl, psr_vers, fpu_vers);
}
#else
static void __init sun4v_cpu_probe(void)
{
switch (sun4v_chip_type) {
case SUN4V_CHIP_NIAGARA1:
sparc_cpu_type = "UltraSparc T1 (Niagara)";
sparc_fpu_type = "UltraSparc T1 integrated FPU";
break;

case SUN4V_CHIP_NIAGARA2:
sparc_cpu_type = "UltraSparc T2 (Niagara2)";
sparc_fpu_type = "UltraSparc T2 integrated FPU";
break;

default:
printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
prom_cpu_compatible);
sparc_cpu_type = "Unknown SUN4V CPU";
sparc_fpu_type = "Unknown SUN4V FPU";
break;
}
}

static int __init cpu_type_probe(void)
{
if (tlb_type == hypervisor) {
sun4v_cpu_probe();
} else {
unsigned long ver;
int manuf, impl;

__asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver));

manuf = ((ver >> 48) & 0xffff);
impl = ((ver >> 32) & 0xffff);
set_cpu_and_fpu(manuf, impl, impl);
}
return 0;
}

arch_initcall(cpu_type_probe);
#endif
167 changes: 0 additions & 167 deletions arch/sparc/kernel/cpu_64.c

This file was deleted.

0 comments on commit d34dd82

Please sign in to comment.