El 09/11/10 16:40:55, en/na Ralf Baechle va escriure: > Cavium introduced this idion first. Now your patch is repeating it > and I'm > sure other SMP platforms will soon use it. I don't want a thousand > if (cpu == 0) in that file, so can you cook a patch that introduces a > helper, something like > > static void set_elf_platform(const char *plat) > { > if (cpu == 0) > __elf_platform = plat; > } > > Then use that for all assignments to __elf_platform? Thanks. Here.
Signed-off-by: Robert Millan <rmh@xxxxxxx> diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h index fd1d39e..58844f6 100644 --- a/arch/mips/include/asm/elf.h +++ b/arch/mips/include/asm/elf.h @@ -344,6 +344,12 @@ extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); #define ELF_PLATFORM __elf_platform extern const char *__elf_platform; +static inline void set_elf_platform(int cpu, const char *plat) +{ + if (cpu == 0) + __elf_platform = plat; +} + /* * See comments in asm-alpha/elf.h, this is the same thing * on the MIPS. diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 71620e1..7e547ca 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -613,7 +613,18 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) break; case PRID_IMP_LOONGSON2: c->cputype = CPU_LOONGSON2; - __cpu_name[cpu] = "ICT Loongson-2"; + switch (c->processor_id & PRID_REV_MASK) { + case PRID_REV_LOONGSON2E: + __cpu_name[cpu] = "ICT Loongson-2E"; + set_elf_platform(cpu, "loongson2e"); + break; + case PRID_REV_LOONGSON2F: + __cpu_name[cpu] = "ICT Loongson-2F"; + set_elf_platform(cpu, "loongson2f"); + break; + default: + __cpu_name[cpu] = "ICT Loongson-2"; + } c->isa_level = MIPS_CPU_ISA_III; c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC | @@ -957,14 +968,12 @@ static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu) c->cputype = CPU_CAVIUM_OCTEON_PLUS; __cpu_name[cpu] = "Cavium Octeon+"; platform: - if (cpu == 0) - __elf_platform = "octeon"; + set_elf_platform(cpu, "octeon"); break; case PRID_IMP_CAVIUM_CN63XX: c->cputype = CPU_CAVIUM_OCTEON2; __cpu_name[cpu] = "Cavium Octeon II"; - if (cpu == 0) - __elf_platform = "octeon2"; + set_elf_platform(cpu, "octeon2"); break; default: printk(KERN_INFO "Unknown Octeon chip!\n");