Re: [PATCH] mips/loongson: unify compiler flags and load location for Loongson 2E and 2F
On Thu, Aug 25, 2011 at 4:00 AM, Andreas Barth <aba@not.so.argh.org> wrote:
> This patch starts to merge the Loongson 2E and 2F code together with the
> goal to produce a binary kernel image that can run on both machines. As
> code compiled for 2E cannot run on 2F and vice versa, the usage of cpu
> dependend code is optionally now (and old behaviour is default).
>
> The load address is unified as well, and the 2F workarounds can be enabled
> while compiling on a 2E machine (disabled there by default).
>
> Signed-off-by: Andreas Barth <aba@not.so.argh.org>
I think we can simplify this a bit. How about something like what I've
attached? (I didn't touch the load location stuff)
Thanks,
Matt
From 58728ae98a00d032cc367cafb79400f024a36bae Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Thu, 25 Aug 2011 19:39:43 -0400
Subject: [PATCH] mips/loongson: unify compiler flags
This patch starts to merge the Loongson 2E and 2F code together with the
goal to produce a binary kernel image that can run on both machines. As
code compiled for 2E cannot run on 2F and vice versa, the usage of CPU
dependent code is optional now (and old behaviour is default).
Signed-off-by: Matt Turner <mattst88@gmail.com>
---
arch/mips/Kconfig | 12 ++++++++++--
arch/mips/loongson/Platform | 14 ++++++++++++--
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 177cdaf..6ff6813 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1166,6 +1166,14 @@ choice
prompt "CPU type"
default CPU_R4X00
+config CPU_LOONGSON2_GENERIC
+ bool "Loongson 2 (generic)"
+ depends on SYS_HAS_CPU_LOONGSON2E || SYS_HAS_LOONGSON2F
+ select CPU_LOONGSON2
+ help
+ The Loongson 2 processor implements the MIPS III instruction set
+ with many extensions.
+
config CPU_LOONGSON2E
bool "Loongson 2E"
depends on SYS_HAS_CPU_LOONGSON2E
@@ -1475,7 +1483,7 @@ config CPU_XLR
Netlogic Microsystems XLR/XLS processors.
endchoice
-if CPU_LOONGSON2F
+if CPU_LOONGSON2
config CPU_NOP_WORKAROUNDS
bool
@@ -1500,7 +1508,7 @@ config CPU_LOONGSON2F_WORKAROUNDS
systems.
If unsure, please say Y.
-endif # CPU_LOONGSON2F
+endif # CPU_LOONGSON2
config SYS_SUPPORTS_ZBOOT
bool
diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
index 29692e5..4a14e39 100644
--- a/arch/mips/loongson/Platform
+++ b/arch/mips/loongson/Platform
@@ -4,10 +4,20 @@
# Only gcc >= 4.4 have Loongson specific support
cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap
-cflags-$(CONFIG_CPU_LOONGSON2E) += \
+ifdef CONFIG_CPU_LOONGSON2E
+ cflags-$(CONFIG_CPU_LOONGSON2E) += \
$(call cc-option,-march=loongson2e,-march=r4600)
-cflags-$(CONFIG_CPU_LOONGSON2F) += \
+else
+ ifdef CONFIG_CPU_LOONGSON2F
+ cflags-$(CONFIG_CPU_LOONGSON2F) += \
$(call cc-option,-march=loongson2f,-march=r4600)
+ else
+ ifdef CONFIG_CPU_LOONGSON
+ cflags-$(CONFIG_CPU_LOONGSON2) += \
+ $(call cc-option,-march=r4600)
+ endif
+ endif
+endif
# Enable the workarounds for Loongson2f
ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),)
--
1.7.3.4
Reply to: