* [PATCH 1/3] MIPS: Introduce set_elf_platform() helper function
@ 2011-04-16 18:29 Kevin Cernekee
2011-04-16 18:29 ` [PATCH 2/3] MIPS: Set ELF AT_PLATFORM string for BMIPS processors Kevin Cernekee
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Kevin Cernekee @ 2011-04-16 18:29 UTC (permalink / raw)
To: Ralf Baechle
Cc: Robert Millan, David Daney, wu zhangjin, Aurelien Jarno,
linux-mips, linux-kernel
From: Robert Millan <rmh@gnu.org>
Replace these sequences:
if (cpu == 0)
__elf_platform = "foo";
with a trivial inline function.
Signed-off-by: Robert Millan <rmh@gnu.org>
Acked-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
arch/mips/include/asm/elf.h | 6 ++++++
arch/mips/kernel/cpu-probe.c | 6 ++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
index 455c0ac..455da05 100644
--- a/arch/mips/include/asm/elf.h
+++ b/arch/mips/include/asm/elf.h
@@ -348,6 +348,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 f65d4c8..5633ab1 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -956,14 +956,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");
--
1.7.4.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/3] MIPS: Set ELF AT_PLATFORM string for BMIPS processors
2011-04-16 18:29 [PATCH 1/3] MIPS: Introduce set_elf_platform() helper function Kevin Cernekee
@ 2011-04-16 18:29 ` Kevin Cernekee
2011-05-12 10:00 ` Ralf Baechle
2011-04-16 18:29 ` [PATCH 3/3] MIPS: Set ELF AT_PLATFORM string for Loongson2 processors Kevin Cernekee
2011-04-18 17:30 ` [PATCH 1/3] MIPS: Introduce set_elf_platform() helper function David Daney
2 siblings, 1 reply; 6+ messages in thread
From: Kevin Cernekee @ 2011-04-16 18:29 UTC (permalink / raw)
To: Ralf Baechle
Cc: Robert Millan, David Daney, wu zhangjin, Aurelien Jarno,
linux-mips, linux-kernel
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
arch/mips/kernel/cpu-probe.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 5633ab1..e3cf292 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -911,12 +911,14 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
case PRID_IMP_BMIPS32_REV8:
c->cputype = CPU_BMIPS32;
__cpu_name[cpu] = "Broadcom BMIPS32";
+ set_elf_platform(cpu, "bmips32");
break;
case PRID_IMP_BMIPS3300:
case PRID_IMP_BMIPS3300_ALT:
case PRID_IMP_BMIPS3300_BUG:
c->cputype = CPU_BMIPS3300;
__cpu_name[cpu] = "Broadcom BMIPS3300";
+ set_elf_platform(cpu, "bmips3300");
break;
case PRID_IMP_BMIPS43XX: {
int rev = c->processor_id & 0xff;
@@ -925,15 +927,18 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
rev <= PRID_REV_BMIPS4380_HI) {
c->cputype = CPU_BMIPS4380;
__cpu_name[cpu] = "Broadcom BMIPS4380";
+ set_elf_platform(cpu, "bmips4380");
} else {
c->cputype = CPU_BMIPS4350;
__cpu_name[cpu] = "Broadcom BMIPS4350";
+ set_elf_platform(cpu, "bmips4350");
}
break;
}
case PRID_IMP_BMIPS5000:
c->cputype = CPU_BMIPS5000;
__cpu_name[cpu] = "Broadcom BMIPS5000";
+ set_elf_platform(cpu, "bmips5000");
c->options |= MIPS_CPU_ULRI;
break;
}
--
1.7.4.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/3] MIPS: Set ELF AT_PLATFORM string for Loongson2 processors
2011-04-16 18:29 [PATCH 1/3] MIPS: Introduce set_elf_platform() helper function Kevin Cernekee
2011-04-16 18:29 ` [PATCH 2/3] MIPS: Set ELF AT_PLATFORM string for BMIPS processors Kevin Cernekee
@ 2011-04-16 18:29 ` Kevin Cernekee
2011-05-12 10:00 ` Ralf Baechle
2011-04-18 17:30 ` [PATCH 1/3] MIPS: Introduce set_elf_platform() helper function David Daney
2 siblings, 1 reply; 6+ messages in thread
From: Kevin Cernekee @ 2011-04-16 18:29 UTC (permalink / raw)
To: Ralf Baechle
Cc: Robert Millan, David Daney, wu zhangjin, Aurelien Jarno,
linux-mips, linux-kernel
From: Robert Millan <rmh@gnu.org>
Signed-off-by: Robert Millan <rmh@gnu.org>
Acked-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
arch/mips/kernel/cpu-probe.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index e3cf292..27ef0fc 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -614,6 +614,16 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
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:
+ set_elf_platform(cpu, "loongson2e");
+ break;
+ case PRID_REV_LOONGSON2F:
+ set_elf_platform(cpu, "loongson2f");
+ break;
+ }
+
c->isa_level = MIPS_CPU_ISA_III;
c->options = R4K_OPTS |
MIPS_CPU_FPU | MIPS_CPU_LLSC |
--
1.7.4.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 1/3] MIPS: Introduce set_elf_platform() helper function
2011-04-16 18:29 [PATCH 1/3] MIPS: Introduce set_elf_platform() helper function Kevin Cernekee
2011-04-16 18:29 ` [PATCH 2/3] MIPS: Set ELF AT_PLATFORM string for BMIPS processors Kevin Cernekee
2011-04-16 18:29 ` [PATCH 3/3] MIPS: Set ELF AT_PLATFORM string for Loongson2 processors Kevin Cernekee
@ 2011-04-18 17:30 ` David Daney
2 siblings, 0 replies; 6+ messages in thread
From: David Daney @ 2011-04-18 17:30 UTC (permalink / raw)
To: Kevin Cernekee
Cc: Ralf Baechle, Robert Millan, wu zhangjin, Aurelien Jarno,
linux-mips, linux-kernel
On 04/16/2011 11:29 AM, Kevin Cernekee wrote:
> From: Robert Millan<rmh@gnu.org>
>
> Replace these sequences:
>
> if (cpu == 0)
> __elf_platform = "foo";
>
> with a trivial inline function.
>
> Signed-off-by: Robert Millan<rmh@gnu.org>
> Acked-by: David Daney<ddaney@caviumnetworks.com>
> Signed-off-by: Kevin Cernekee<cernekee@gmail.com>
> ---
> arch/mips/include/asm/elf.h | 6 ++++++
> arch/mips/kernel/cpu-probe.c | 6 ++----
> 2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
> index 455c0ac..455da05 100644
> --- a/arch/mips/include/asm/elf.h
> +++ b/arch/mips/include/asm/elf.h
> @@ -348,6 +348,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;
> +}
> +
Now I want to NAK it.
This function is only ever used in cpu-probe.c, can't we just put it in
there (and then make it non-inline)? The less stuff in elf.h the better.
David Daney
> /*
> * 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 f65d4c8..5633ab1 100644
> --- a/arch/mips/kernel/cpu-probe.c
> +++ b/arch/mips/kernel/cpu-probe.c
> @@ -956,14 +956,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");
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-05-12 9:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-16 18:29 [PATCH 1/3] MIPS: Introduce set_elf_platform() helper function Kevin Cernekee
2011-04-16 18:29 ` [PATCH 2/3] MIPS: Set ELF AT_PLATFORM string for BMIPS processors Kevin Cernekee
2011-05-12 10:00 ` Ralf Baechle
2011-04-16 18:29 ` [PATCH 3/3] MIPS: Set ELF AT_PLATFORM string for Loongson2 processors Kevin Cernekee
2011-05-12 10:00 ` Ralf Baechle
2011-04-18 17:30 ` [PATCH 1/3] MIPS: Introduce set_elf_platform() helper function David Daney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox