add mips64 cpus support
v6 cover add mips64 cpus support
I'm so sorry, because of my careless, I made a serious fault in last version. I wish everything is ok in this version.
Changes in V6:
- reorganise patch
- add flash support
Changes in V5:
- omit camel-case style
- avoid running "git bisect" failed
- some code style problem corrected
Changes in V4:
- Add both big-endian and little-endian support
- Remove cache probe
- Add standalone support for mips64
Changes in V3:
- merge related files into one patch, no longer one file one patch.
- add detailed commit message.
- remove standalone example. it's too complicate.
Zhizhou Zhang (4):
MIPS: don't use camel-case style
MIPS: change address related header files
MIPS: remove board/qemu-mips/config.mk
MIPS: add board qemu-mips64 support
Zhizhou Zhang (4):
MIPS: don't use camel-case style
MIPS: change address related header files
MIPS: remove board/qemu-mips/config.mk
MIPS: add board qemu-mips64 support
arch/mips/cpu/mips32/cache.S | 10 +- arch/mips/cpu/mips32/cpu.c | 8 +- arch/mips/cpu/mips64/Makefile | 45 ++++++ arch/mips/cpu/mips64/cache.S | 229 +++++++++++++++++++++++++++++++ arch/mips/cpu/mips64/config.mk | 40 ++++++ arch/mips/cpu/mips64/cpu.c | 111 +++++++++++++++ arch/mips/cpu/mips64/interrupts.c | 34 +++++ arch/mips/cpu/mips64/start.S | 256 +++++++++++++++++++++++++++++++++++ arch/mips/cpu/mips64/time.c | 87 ++++++++++++ arch/mips/cpu/xburst/cpu.c | 12 +- arch/mips/cpu/xburst/start.S | 4 +- arch/mips/include/asm/addrspace.h | 2 +- arch/mips/include/asm/asm.h | 2 +- arch/mips/include/asm/cacheops.h | 82 +++++------ arch/mips/include/asm/io.h | 16 +++ arch/mips/include/asm/posix_types.h | 6 + board/qemu-mips/config.mk | 10 -- board/qemu-mips/u-boot.lds | 8 ++ boards.cfg | 2 + examples/standalone/mips64.lds | 59 ++++++++ include/configs/qemu-mips.h | 1 + include/configs/qemu-mips64.h | 175 ++++++++++++++++++++++++ 22 files changed, 1129 insertions(+), 70 deletions(-) create mode 100644 arch/mips/cpu/mips64/Makefile create mode 100644 arch/mips/cpu/mips64/cache.S create mode 100644 arch/mips/cpu/mips64/config.mk create mode 100644 arch/mips/cpu/mips64/cpu.c create mode 100644 arch/mips/cpu/mips64/interrupts.c create mode 100644 arch/mips/cpu/mips64/start.S create mode 100644 arch/mips/cpu/mips64/time.c delete mode 100644 board/qemu-mips/config.mk create mode 100644 examples/standalone/mips64.lds create mode 100644 include/configs/qemu-mips64.h
Signature · 1 line
1.7.9.5
PATCH v6 1/4 MIPS: don't use camel-case style
Replace camel-case style with upper-case style globally.
--- arch/mips/cpu/mips32/cache.S | 10 ++--- arch/mips/cpu/mips32/cpu.c | 8 ++-- arch/mips/cpu/xburst/cpu.c | 12 +++--- arch/mips/cpu/xburst/start.S | 4 +- arch/mips/include/asm/asm.h | 2 +- arch/mips/include/asm/cacheops.h | 82 +++++++++++++++++++------------------- 6 files changed, 59 insertions(+), 59 deletions(-)
arch/mips/cpu/mips32/cache.S +5 -5
@@ -85,17 +85,17 @@ LEAF(mips_init_icache) /* clear tag to invalidate */ PTR_LI t0, INDEX_BASE PTR_ADDU t1, t0, a1 -1: cache_op Index_Store_Tag_I t0 +1: cache_op INDEX_STORE_TAG_I t0 PTR_ADDU t0, a2 bne t0, t1, 1b /* fill once, so data field parity is correct */ PTR_LI t0, INDEX_BASE -2: cache_op Fill t0 +2: cache_op FILL t0 PTR_ADDU t0, a2 bne t0, t1, 2b /* invalidate again - prudent but not strictly neccessary */ PTR_LI t0, INDEX_BASE -1: cache_op Index_Store_Tag_I t0 +1: cache_op INDEX_STORE_TAG_I t0 PTR_ADDU t0, a2 bne t0, t1, 1b 9: jr ra
@@ -110,7 +110,7 @@ LEAF(mips_init_dcache) /* clear all tags */ PTR_LI t0, INDEX_BASE PTR_ADDU t1, t0, a1 -1: cache_op Index_Store_Tag_D t0 +1: cache_op INDEX_STORE_TAG_D t0 PTR_ADDU t0, a2 bne t0, t1, 1b /* load from each line (in cached space) */
@@ -120,7 +120,7 @@ LEAF(mips_init_dcache) bne t0, t1, 2b /* clear all tags */ PTR_LI t0, INDEX_BASE -1: cache_op Index_Store_Tag_D t0 +1: cache_op INDEX_STORE_TAG_D t0 PTR_ADDU t0, a2 bne t0, t1, 1b 9: jr ra
arch/mips/cpu/mips32/cpu.c +4 -4
@@ -61,8 +61,8 @@ void flush_cache(ulong start_addr, ulong size)return ;while (1 ) { -cache_op (Hit_Writeback_Inv_D, addr); -cache_op (Hit_Invalidate_I, addr); +cache_op (HIT_WRITEBACK_INV_D , addr); +cache_op (HIT_INVALIDATE_I , addr);if (addr == aend)break ; addr += lsize;
@@ -76,7 +76,7 @@ void flush_dcache_range(ulong start_addr, ulong stop)unsigned long aend = (stop -1 ) & ~(lsize -1 );while (1 ) { -cache_op (Hit_Writeback_Inv_D, addr); +cache_op (HIT_WRITEBACK_INV_D , addr);if (addr == aend)break ; addr += lsize;
@@ -90,7 +90,7 @@ void invalidate_dcache_range(ulong start_addr, ulong stop)unsigned long aend = (stop -1 ) & ~(lsize -1 );while (1 ) { -cache_op (Hit_Invalidate_D, addr); +cache_op (HIT_INVALIDATE_D , addr);if (addr == aend)break ; addr += lsize;
arch/mips/cpu/xburst/cpu.c +6 -6
@@ -84,8 +84,8 @@ void flush_cache(ulong start_addr, ulong size)unsigned long aend = (start_addr + size -1 ) & ~(lsize -1 );for (; addr <= aend; addr += lsize) { -cache_op (Hit_Writeback_Inv_D, addr); -cache_op (Hit_Invalidate_I, addr); +cache_op (HIT_WRITEBACK_INV_D , addr); +cache_op (HIT_INVALIDATE_I , addr); } }
@@ -96,7 +96,7 @@ void flush_dcache_range(ulong start_addr, ulong stop)unsigned long aend = (stop -1 ) & ~(lsize -1 );for (; addr <= aend; addr += lsize) -cache_op (Hit_Writeback_Inv_D, addr); +cache_op (HIT_WRITEBACK_INV_D , addr); }void invalidate_dcache_range (ulong start_addr,ulong stop)
@@ -106,7 +106,7 @@ void invalidate_dcache_range(ulong start_addr, ulong stop)unsigned long aend = (stop -1 ) & ~(lsize -1 );for (; addr <= aend; addr += lsize) -cache_op (Hit_Invalidate_D, addr); +cache_op (HIT_INVALIDATE_D , addr); }void flush_icache_all (void )
@@ -118,7 +118,7 @@ void flush_icache_all(void)for (addr =CKSEG0 ; addr <CKSEG0 +CONFIG_SYS_ICACHE_SIZE ; addr +=CONFIG_SYS_CACHELINE_SIZE ) { -cache_op (Index_Store_Tag_I, addr); +cache_op (INDEX_STORE_TAG_I , addr); }/* invalidate btb */
@@ -139,7 +139,7 @@ void flush_dcache_all(void)for (addr =CKSEG0 ; addr <CKSEG0 +CONFIG_SYS_DCACHE_SIZE ; addr +=CONFIG_SYS_CACHELINE_SIZE ) { -cache_op (Index_Writeback_Inv_D, addr); +cache_op (INDEX_WRITEBACK_INV_D , addr); } __asm__ __volatile__("sync" );
arch/mips/cpu/xburst/start.S +2 -2
@@ -96,7 +96,7 @@ relocate_code: li t0, KSEG0 addi t1, t0, CONFIG_SYS_DCACHE_SIZE 2: - cache Index_Writeback_Inv_D, 0(t0) + cache INDEX_WRITEBACK_INV_D, 0(t0) bne t0, t1, 2b addi t0, CONFIG_SYS_CACHELINE_SIZE
@@ -106,7 +106,7 @@ relocate_code: li t0, KSEG0 addi t1, t0, CONFIG_SYS_ICACHE_SIZE 3: - cache Index_Invalidate_I, 0(t0) + cache INDEX_INVALIDATE_I, 0(t0) bne t0, t1, 3b addi t0, CONFIG_SYS_CACHELINE_SIZE
arch/mips/include/asm/asm.h +1 -1
@@ -401,7 +401,7 @@ symbol = value#ifdef CONFIG_SGI_IP28 /* Inhibit speculative stores to volatile (e.g.DMA) or invalid addresses. */ #include <asm/cacheops.h> -#define R10KCBARRIER (addr) cache Cache_Barrier, addr; +#define R10KCBARRIER (addr) cache CACHE_BARRIER, addr;#else #define R10KCBARRIER (addr)#endif
arch/mips/include/asm/cacheops.h +41 -41
112 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v6 2/4 MIPS: change address related header files
In reply to Zhizhou ZhangPrepare for upcoming mips64 support. This patch add mips64 address support.
--- arch/mips/include/asm/addrspace.h | 2 +- arch/mips/include/asm/io.h | 16 ++++++++++++++++ arch/mips/include/asm/posix_types.h | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-)
arch/mips/include/asm/addrspace.h +1 -1
@@ -136,7 +136,7 @@cannot access physical memory directly from core */ #define UNCACHED_SDRAM (a) (((unsigned long)(a)) | 0x20000000)#else /* !CONFIG_SOC_AU1X00 */ -#define UNCACHED_SDRAM (a) KSEG1ADDR(a) +#define UNCACHED_SDRAM (a) CKSEG1ADDR(a)#endif /* CONFIG_SOC_AU1X00 */ #endif /* __ASSEMBLY__ */
arch/mips/include/asm/io.h +16 -0
@@ -120,12 +120,20 @@ static inline void set_io_port_base(unsigned long base)*/ extern inline phys_addr_t virt_to_phys (volatile void * address) { +#ifndef CONFIG_64BIT return CPHYSADDR (address); +#else +return XPHYSADDR (address); +#endif }extern inline void *phys_to_virt (unsigned long address) { +#ifndef CONFIG_64BIT return (void *)KSEG0ADDR (address); +#else +return (void *)CKSEG0ADDR (address); +#endif }/*
@@ -133,12 +141,20 @@ extern inline void * phys_to_virt(unsigned long address)*/ extern inline unsigned long virt_to_bus (volatile void * address) { +#ifndef CONFIG_64BIT return CPHYSADDR (address); +#else +return XPHYSADDR (address); +#endif }extern inline void *bus_to_virt (unsigned long address) { +#ifndef CONFIG_64BIT return (void *)KSEG0ADDR (address); +#else +return (void *)CKSEG0ADDR (address); +#endif }/*
arch/mips/include/asm/posix_types.h +6 -0
@@ -24,9 +24,15 @@ typedef int __kernel_pid_t;typedef int __kernel_ipc_pid_t ;typedef int __kernel_uid_t ;typedef int __kernel_gid_t ; +#ifndef CONFIG_MIPS64 typedef unsigned int __kernel_size_t ;typedef int __kernel_ssize_t ;typedef int __kernel_ptrdiff_t ; +#else +typedef unsigned long __kernel_size_t ; +typedef long __kernel_ssize_t ; +typedef long __kernel_ptrdiff_t ; +#endif typedef long __kernel_time_t ;typedef long __kernel_suseconds_t ;typedef long __kernel_clock_t ;
Signature · 1 line
1.7.9.5
PATCH v6 3/4 MIPS: remove board/qemu-mips/config.mk
In reply to Zhizhou ZhangWe define CONFIG_SYS_TEXT_BASE in board's specified header file. So config.mk is useless, then remove it.
--- board/qemu-mips/config.mk | 10 ---------- include/configs/qemu-mips.h | 1 + 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 board/qemu-mips/config.mk
board/qemu-mips/config.mk deleted +0 -10
@@ -1,10 +0,0 @@ -# -# Qemu -M mips system emulator -# See http://fabrice.bellard.free.fr/qemu -# - -# ROM version -CONFIG_SYS_TEXT_BASE = 0xbfc00000 - -# RAM version -#CONFIG_SYS_TEXT_BASE = 0x80001000
include/configs/qemu-mips.h +1 -0
@@ -137,6 +137,7 @@*/ /* The following #defines are needed to get flash environment right */ +#define CONFIG_SYS_TEXT_BASE 0xbfc00000/* Rom version */ #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE#define CONFIG_SYS_MONITOR_LEN (192 << 10)
Signature · 1 line
1.7.9.5
PATCH v6 4/4 MIPS: add board qemu-mips64 support
In reply to Zhizhou ZhangBoth big-endian and little-endian are tested with below commands:
Rom version: (Default, Now we config it as rom version) qemu-system-mips64el -M mips -bios u-boot.bin -cpu MIPS64R2-generic -nographic qemu-system-mips64 -M mips -bios u-boot.bin -cpu MIPS64R2-generic -nographic Ram version:
qemu-system-mips64el -M mips -cpu MIPS64R2-generic -kernel u-boot -nographic qemu-system-mips64 -M mips -cpu MIPS64R2-generic -kernel u-boot -nographic
--- arch/mips/cpu/mips64/Makefile | 45 +++++++ arch/mips/cpu/mips64/cache.S | 229 +++++++++++++++++++++++++++++++++ arch/mips/cpu/mips64/config.mk | 40 ++++++ arch/mips/cpu/mips64/cpu.c | 111 ++++++++++++++++ arch/mips/cpu/mips64/interrupts.c | 34 +++++ arch/mips/cpu/mips64/start.S | 256 +++++++++++++++++++++++++++++++++++++ arch/mips/cpu/mips64/time.c | 87 +++++++++++++ board/qemu-mips/u-boot.lds | 8 ++ boards.cfg | 2 + examples/standalone/mips64.lds | 59 +++++++++ include/configs/qemu-mips64.h | 175 +++++++++++++++++++++++++ 11 files changed, 1046 insertions(+) create mode 100644 arch/mips/cpu/mips64/Makefile create mode 100644 arch/mips/cpu/mips64/cache.S create mode 100644 arch/mips/cpu/mips64/config.mk create mode 100644 arch/mips/cpu/mips64/cpu.c create mode 100644 arch/mips/cpu/mips64/interrupts.c create mode 100644 arch/mips/cpu/mips64/start.S create mode 100644 arch/mips/cpu/mips64/time.c create mode 100644 examples/standalone/mips64.lds create mode 100644 include/configs/qemu-mips64.h
arch/mips/cpu/mips64/Makefile new file +45 -0
@@ -0,0 +1,45 @@ +# +# (C) Copyright 2003-2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(CPU).o + +START = start.o +COBJS-y = cpu.o interrupts.o time.o cache.o + +SRCS := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) +START := $(addprefix $(obj),$(START)) + +all: $(obj).depend $(START) $(LIB) + +$(LIB): $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend
arch/mips/cpu/mips64/cache.S new file +229 -0
229 lines not on this page · raw message
arch/mips/cpu/mips64/config.mk new file +40 -0
@@ -0,0 +1,40 @@ +# +# (C) Copyright 2003 +# Wolfgang Denk, DENX Software Engineering, <[email protected]> +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +# +# Default optimization level for MIPS64 +# +# Note: Toolchains with binutils prior to v2.16 +# are no longer supported by U-Boot MIPS tree! +# +MIPSFLAGS = -march=mips64 + +PLATFORM_CPPFLAGS += $(MIPSFLAGS) +PLATFORM_CPPFLAGS += -mabi=64 -DCONFIG_64BIT +ifdef CONFIG_SYS_BIG_ENDIAN +PLATFORM_LDFLAGS += -m elf64btsmip +else +PLATFORM_LDFLAGS += -m elf64ltsmip +endif + +CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 -T mips64.lds
arch/mips/cpu/mips64/cpu.c new file +111 -0
111 lines not on this page · raw message
arch/mips/cpu/mips64/interrupts.c new file +34 -0
@@ -0,0 +1,34 @@ +/* +* (C) Copyright 2003 +* Wolfgang Denk, DENX Software Engineering, <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#include <common.h> +#include <asm/mipsregs.h> + +void enable_interrupts (void ) +{ +} + +int disable_interrupts (void ) +{ +return 0 ; +}
arch/mips/cpu/mips64/start.S new file +256 -0
256 lines not on this page · raw message
arch/mips/cpu/mips64/time.c new file +87 -0
87 lines not on this page · raw message
board/qemu-mips/u-boot.lds +8 -0
@@ -24,7 +24,11 @@ /* OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips") */ +#if defined(CONFIG_64BIT) +OUTPUT_FORMAT("elf64-tradbigmips", "elf64-tradbigmips", "elf64-tradlittlemips") +#else OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips") +#endif OUTPUT_ARCH(mips) ENTRY(_start) SECTIONS
@@ -63,7 +67,11 @@ SECTIONS } uboot_end_data = .; +#if defined(CONFIG_64BIT) + num_got_entries = (__got_end - __got_start) >> 3; +#else num_got_entries = (__got_end - __got_start) >> 2; +#endif . = ALIGN(4); .sbss : { *(.sbss*) }
boards.cfg +2 -0
@@ -380,6 +380,8 @@ M5485HFE m68k mcf547x_8x m548xevb freescale - microblaze-generic microblaze microblaze microblaze-generic xilinx qemu_mips mips mips32 qemu-mips - - qemu-mips:SYS_BIG_ENDIAN qemu_mipsel mips mips32 qemu-mips - - qemu-mips:SYS_LITTLE_ENDIAN +qemu_mips64 mips mips64 qemu-mips - - qemu-mips64:SYS_BIG_ENDIAN +qemu_mips64el mips mips64 qemu-mips - - qemu-mips64:SYS_LITTLE_ENDIAN vct_platinum mips mips32 vct micronas - vct:VCT_PLATINUM vct_platinumavc mips mips32 vct micronas - vct:VCT_PLATINUMAVC vct_platinumavc_onenand mips mips32 vct micronas - vct:VCT_PLATINUMAVC,VCT_ONENAND
examples/standalone/mips64.lds new file +59 -0
59 lines not on this page · raw message
include/configs/qemu-mips64.h new file +175 -0
175 lines not on this page · raw message
Signature · 1 line
1.7.9.5