From 7fcb82665e96a50174084c8bfcd0302ce31291f4 Mon Sep 17 00:00:00 2001 From: Weijie Gao Date: Sun, 7 Jan 2024 03:10:45 +0800 Subject: loongarch64: new target Add target for Loongson LoongArch64-based boards. LoongArch is a new RISC ISA developed by Loongson. It's a bit like MIPS or RISC-V. LoongArch includes both 32-bit and 64-bit versions (LoongArch32/LoongArch64). Loongson 3A5000 and 3A6000 are the two existing CPUs of LoongArch64 and is used for PC products. It's BIOS supports ACPI and UEFI-only boot. These CPUs supports SMP and SMT. At present only LoongArch64 is supported by linux kernel. Toolchain requirement: binutils >= 2.40 gcc >= 13.1 For details, please check the following links: https://lwn.net/Articles/861951/ https://loongson.github.io/LoongArch-Documentation/README-EN.html Signed-off-by: Weijie Gao --- include/kernel.mk | 2 ++ include/site/loongarch64 | 30 ++++++++++++++++++++++++++++++ include/target.mk | 5 +++++ 3 files changed, 37 insertions(+) create mode 100644 include/site/loongarch64 (limited to 'include') diff --git a/include/kernel.mk b/include/kernel.mk index 479c586ea2..6ef766388a 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -86,6 +86,8 @@ else ifneq (,$(findstring $(ARCH) , arceb )) LINUX_KARCH := arc else ifneq (,$(findstring $(ARCH) , armeb )) LINUX_KARCH := arm +else ifneq (,$(findstring $(ARCH) , loongarch64 )) + LINUX_KARCH := loongarch else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el )) LINUX_KARCH := mips else ifneq (,$(findstring $(ARCH) , powerpc64 )) diff --git a/include/site/loongarch64 b/include/site/loongarch64 new file mode 100644 index 0000000000..b8d581d448 --- /dev/null +++ b/include/site/loongarch64 @@ -0,0 +1,30 @@ +#!/bin/sh +. $TOPDIR/include/site/linux +ac_cv_c_littleendian=${ac_cv_c_littleendian=yes} +ac_cv_c_bigendian=${ac_cv_c_bigendian=no} + +ac_cv_sizeof___int64=0 +ac_cv_sizeof_char=1 +ac_cv_sizeof_int=4 +ac_cv_sizeof_int16_t=2 +ac_cv_sizeof_int32_t=4 +ac_cv_sizeof_int64_t=8 +ac_cv_sizeof_long_int=8 +ac_cv_sizeof_long_long=8 +ac_cv_sizeof_long=8 +ac_cv_sizeof_off_t=8 +ac_cv_sizeof_short_int=2 +ac_cv_sizeof_short=2 +ac_cv_sizeof_size_t=8 +ac_cv_sizeof_ssize_t=8 +ac_cv_sizeof_u_int16_t=2 +ac_cv_sizeof_u_int32_t=4 +ac_cv_sizeof_u_int64_t=8 +ac_cv_sizeof_uint16_t=2 +ac_cv_sizeof_uint32_t=4 +ac_cv_sizeof_uint64_t=8 +ac_cv_sizeof_unsigned_int=4 +ac_cv_sizeof_unsigned_long=8 +ac_cv_sizeof_unsigned_long_long=8 +ac_cv_sizeof_unsigned_short=2 +ac_cv_sizeof_void_p=8 diff --git a/include/target.mk b/include/target.mk index b5e3e7ff6f..68558601f3 100644 --- a/include/target.mk +++ b/include/target.mk @@ -264,6 +264,11 @@ ifeq ($(DUMP),1) CPU_TYPE ?= riscv64 CPU_CFLAGS_riscv64:=-mabi=lp64d -march=rv64imafdc endif + ifeq ($(ARCH),loongarch64) + CPU_TYPE ?= generic + CPU_CFLAGS := -O2 -pipe + CPU_CFLAGS_generic:=-march=loongarch64 + endif ifneq ($(CPU_TYPE),) ifndef CPU_CFLAGS_$(CPU_TYPE) $(warning CPU_TYPE "$(CPU_TYPE)" doesn't correspond to a known type) -- cgit v1.2.3