Skip to contentSkip to conversation

add mips64 cpus support

PATCH Superseded Zhizhou Zhang 2 participants 11 messages Sep 4, 2012 – Sep 5, 2012 MIPS

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover add mips64 cpus support

This patch add mips64 cpu support. In this version, I have tested it both when configured running in ram version and running in rom version.

qemu-system-mips64 -M mips -cpu MIPS64R2-generic -bios u-boot.bin -nographic

U-Boot 2012.07-00146-g42c7773 (Sep 04 2012 - 21:56:46)

Board: Qemu -M mips CPU: unknown proc_id=0x10000
DRAM:  128 MiB

Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   NE2000

qemu-mips64 #

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: don't define CONFIG_SYS_TEXT_BASE in 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       |  171 +++++++++++++++++++++++
 22 files changed, 1125 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
#1 lore raw

PATCH v5 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/cacheops.h |   82 +++++++++++++++++++-------------------
 5 files changed, 58 insertions(+), 58 deletions(-)
arch/mips/cpu/mips32/cache.S +5 -5
index e683e8b..64dfad0 100644
@@ -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
index 7b49e1b..50bb248 100644
@@ -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
index ddcbfaa..cc190df 100644
@@ -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
index d846104..3a8280c 100644
@@ -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/cacheops.h +41 -41

112 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v5 2/4 MIPS: change address related header files

In reply to Zhizhou Zhang

Prepare for upcoming mips64 support. This patch add mips64 address space support.

---
 arch/mips/include/asm/addrspace.h   |    2 +-
 arch/mips/include/asm/asm.h         |    2 +-
 arch/mips/include/asm/io.h          |   16 ++++++++++++++++
 arch/mips/include/asm/posix_types.h |    6 ++++++
 4 files changed, 24 insertions(+), 2 deletions(-)
arch/mips/include/asm/addrspace.h +1 -1
index 3a1e6d6..b768bb5 100644
@@ -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/asm.h +1 -1
index 608cfcf..933ccb1 100644
@@ -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/io.h +16 -0
index 025012a..80eab75 100644
@@ -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
index 879aae2..6566ad0 100644
@@ -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
#3 lore raw

PATCH v5 2/4 MIPS: change address related header files

2012/9/4 Zhizhou Zhang <[email protected]>:

Quoted 29 lines

Prepare for upcoming mips64 support. This patch add mips64 address space support.

---
 arch/mips/include/asm/addrspace.h   |    2 +-
 arch/mips/include/asm/asm.h         |    2 +-
 arch/mips/include/asm/io.h          |   16 ++++++++++++++++
 arch/mips/include/asm/posix_types.h |    6 ++++++
 4 files changed, 24 insertions(+), 2 deletions(-)
arch/mips/include/asm/addrspace.h +1 -1
index 3a1e6d6..b768bb5 100644
@@ -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/asm.h +0 -0
index 608cfcf..933ccb1 100644

arch/mips/include/asm/asm.h symbol = value · line 404

Quoted 5 lines
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;

this change is unrelated to this patch. I guess this belongs to patch 1/4

Quoted 72 lines
arch/mips/include/asm/asm.h +0 -0
 #else
 #define R10KCBARRIER(addr)
 #endif
arch/mips/include/asm/io.h +16 -0
index 025012a..80eab75 100644
@@ -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 -1
index 879aae2..6566ad0 100644
@@ -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;
--

1.7.9.5

Signature · 2 lines
Best regards,
Daniel
#4 lore raw

PATCH v5 2/4 MIPS: change address related header files

Quoted 34 lines · Daniel Schwierzeck

2012/9/4 Zhizhou Zhang <[email protected]>:

Quoted 4 lines

Prepare for upcoming mips64 support. This patch add mips64 address space support.

Review

Quoted 8 lines
---
 arch/mips/include/asm/addrspace.h   |    2 +-
 arch/mips/include/asm/asm.h         |    2 +-
 arch/mips/include/asm/io.h          |   16 ++++++++++++++++
 arch/mips/include/asm/posix_types.h |    6 ++++++
 4 files changed, 24 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/mips/include/asm/addrspace.h

Quoted 17 lines

index 3a1e6d6..b768bb5 100644

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/asm.h +0 -0
index 608cfcf..933ccb1 100644

arch/mips/include/asm/asm.h symbol = value · line 402

Quoted 2 lines
arch/mips/include/asm/asm.h +0 -0
@@ -401,7 +401,7 @@ symbol              =       value
 #ifdef CONFIG_SGI_IP28
 /* Inhibit speculative stores to volatile (e.g.DMA) or invalid

addresses. */

Quoted 7 lines

arch/mips/include/asm/asm.h symbol = value · line 404

Quoted 3 lines
arch/mips/include/asm/asm.h +1 -1
 #include <asm/cacheops.h>
-#define R10KCBARRIER(addr)  cache   Cache_Barrier, addr;
+#define R10KCBARRIER(addr)  cache   CACHE_BARRIER, addr;

this change is unrelated to this patch. I guess this belongs to patch 1/4

I'm so careless! Then what should I do now? need I resend these once

again? I think that's not good..

Quoted 82 lines

arch/mips/include/asm/io.h static inline void set_io_port_base(unsigned long

Quoted 8 lines
arch/mips/include/asm/asm.h +0 -0
 #else
 #define R10KCBARRIER(addr)
 #endif
arch/mips/include/asm/io.h +0 -0
index 025012a..80eab75 100644
@@ -120,12 +120,20 @@ static inline void set_io_port_base(unsigned long

base)

arch/mips/include/asm/io.h extern inline void * phys_to_virt(unsigned long

Quoted 21 lines
arch/mips/include/asm/io.h +8 -0
  */
 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)

Review

Quoted 21 lines
arch/mips/include/asm/io.h +8 -0
  */
 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
 }
 
 /*
(quoted diff) +0 -0

b/arch/mips/include/asm/posix_types.h

Quoted 20 lines

index 879aae2..6566ad0 100644

arch/mips/include/asm/posix_types.h +6 -1
@@ -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;
--
Quoted 2 lines

1.7.9.5

--
Best regards,
Daniel

Signature · 2 lines
Regards,
Zhizhou Zhang
#5 lore raw

PATCH v5 3/4 MIPS: don't define CONFIG_SYS_TEXT_BASE in config.mk

In reply to Zhizhou Zhang

We 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
deleted file mode 100644
index 27cd34a..0000000
@@ -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
index b8b9705..f45f78b 100644
@@ -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
#6 lore raw

PATCH v5 4/4 MIPS: add board qemu-mips64 support

In reply to Zhizhou Zhang

Both 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     |  171 +++++++++++++++++++++++++
 11 files changed, 1042 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
new file mode 100644
index 0000000..be38664
@@ -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
new file mode 100644
index 0000000..ebc1ceb
@@ -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
new file mode 100644
index 0000000..e4e9aae
@@ -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
index 9460b20..4d9580f 100644
@@ -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
index 6b54941..ff4bb0c 100644
@@ -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 +171 -0

171 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#7 lore raw

PATCH v5 4/4 MIPS: add board qemu-mips64 support

2012/9/4 Zhizhou Zhang <[email protected]>:

Quoted 32 lines

Both 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     |  171 +++++++++++++++++++++++++
 11 files changed, 1042 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

[...]

Quoted 28 lines
include/configs/qemu-mips64.h new file +22 -0
new file mode 100644
index 0000000..216326d
@@ -0,0 +1,171 @@
+/*
+ * (C) Copyright 2003
+ * 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/configs/qemu-mips64.h line 32

Quoted 10 lines
include/configs/qemu-mips64.h new file +10 -0
+
+/*
+ * This file contains the configuration parameters for qemu-mips64 target.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_MIPS64                  /* MIPS64 CPU core */
+#define CONFIG_QEMU_MIPS1

#define CONFIG_QEMU_MIPS

arch/mips/lib/config.mk depends on that config option

Quoted 142 lines
include/configs/qemu-mips64.h new file +139 -1
+#define CONFIG_MISC_INIT_R
+
+#define CONFIG_BOOTDELAY       10      /* autoboot after 10 seconds */
+
+#define CONFIG_BAUDRATE                115200
+
+/* valid baudrates */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
+
+#define CONFIG_TIMESTAMP               /* Print image info with timestamp */
+#undef CONFIG_BOOTARGS
+
+#define CONFIG_EXTRA_ENV_SETTINGS                                      \
+       "addmisc=setenv bootargs ${bootargs} "                          \
+               "console=ttyS0,${baudrate} "                            \
+               "panic=1\0"                                             \
+       "bootfile=/tftpboot/vmlinux\0"                                  \
+       "load=tftp ffffffff80500000 ${u-boot}\0"                        \
+       ""
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE
+#define CONFIG_BOOTP_BOOTPATH
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_HOSTNAME
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#define CONFIG_DP83902A
+
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT2
+#undef CONFIG_CMD_LOADB
+#undef CONFIG_CMD_LOADS
+#define CONFIG_CMD_DHCP
+
+#define CONFIG_DRIVER_NE2000
+#define CONFIG_DRIVER_NE2000_BASE      0xffffffffb4000300
+
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE    1
+#define CONFIG_SYS_NS16550_CLK         115200
+#define CONFIG_SYS_NS16550_COM1                (0xffffffffb40003f8)
+#define CONFIG_CONS_INDEX              1
+
+#define CONFIG_CMD_IDE
+#define CONFIG_DOS_PARTITION
+
+#define CONFIG_SYS_IDE_MAXBUS          2
+#define CONFIG_SYS_ATA_IDE0_OFFSET     (0x1f0)
+#define CONFIG_SYS_ATA_IDE1_OFFSET     (0x170)
+#define CONFIG_SYS_ATA_DATA_OFFSET     (0)
+#define CONFIG_SYS_ATA_REG_OFFSET      (0)
+#define CONFIG_SYS_ATA_BASE_ADDR       (0xffffffffb4000000)
+
+#define CONFIG_SYS_IDE_MAXDEVICE       (4)
+
+#define CONFIG_CMD_RARP
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+
+/* Monitor Command Prompt */
+#if defined(CONFIG_SYS_LITTLE_ENDIAN)
+#define CONFIG_SYS_PROMPT              "qemu-mips64el # "
+#else
+#define CONFIG_SYS_PROMPT              "qemu-mips64 # "
+#endif
+
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
+
+/* Console I/O Buffer Size */
+#define CONFIG_SYS_CBSIZE              256
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
+/* max number of command args */
+#define CONFIG_SYS_MAXARGS             16
+
+#define CONFIG_SYS_MALLOC_LEN          128*1024
+
+#define CONFIG_SYS_BOOTPARAMS_LEN      128*1024
+
+#define CONFIG_SYS_MHZ                 132
+
+#define CONFIG_SYS_MIPS_TIMER_FREQ     (CONFIG_SYS_MHZ * 1000000)
+
+#define CONFIG_SYS_HZ                  1000
+
+/* Cached addr */
+#define CONFIG_SYS_SDRAM_BASE          0xffffffff80000000
+
+/* default load address */
+#define CONFIG_SYS_LOAD_ADDR           0xffffffff81000000
+
+#define CONFIG_SYS_MEMTEST_START       0xffffffff80100000
+#define CONFIG_SYS_MEMTEST_END         0xffffffff80800000
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_CMD_NO_FLASH
+#define CONFIG_SYS_NO_FLASH
+#undef CONFIG_CMD_IMLS
+
+/* The following #defines are needed to get flash environment right */
+#undef CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_TEXT_BASE           0xffffffffbfc00000 /* ROM Version */
+#define CONFIG_SYS_MONITOR_BASE                CONFIG_SYS_TEXT_BASE
+
+#define CONFIG_SYS_INIT_SP_OFFSET      0x400000
+#define CONFIG_ENV_IS_NOWHERE
+
+/* Address and size of Primary Environment Sector */
+#define CONFIG_ENV_SIZE                0x8000
+
+#define CONFIG_ENV_OVERWRITE
+
+#define MEM_SIZE               128
+
+#define CONFIG_LZA
+
+/*-----------------------------------------------------------------------
+ * Cache Configuration
+ */
+#define CONFIG_SYS_DCACHE_SIZE         16384
+#define CONFIG_SYS_ICACHE_SIZE         16384
+#define CONFIG_SYS_CACHELINE_SIZE      32
+
+#endif /* __CONFIG_H */
--

1.7.9.5

Signature · 2 lines
Best regards,
Daniel
#8 lore raw

PATCH v5 4/4 MIPS: add board qemu-mips64 support

In reply to Zhizhou Zhang

2012/9/4 Zhizhou Zhang <[email protected]>:

Quoted 32 lines

Both 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     |  171 +++++++++++++++++++++++++
 11 files changed, 1042 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

[...]

Quoted 48 lines
include/configs/qemu-mips64.h new file +42 -0
new file mode 100644
index 0000000..216326d
@@ -0,0 +1,171 @@
+/*
+ * (C) Copyright 2003
+ * 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
+ */
+
+/*
+ * This file contains the configuration parameters for qemu-mips64 target.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_MIPS64                  /* MIPS64 CPU core */
+#define CONFIG_QEMU_MIPS1
+#define CONFIG_MISC_INIT_R
+
+#define CONFIG_BOOTDELAY       10      /* autoboot after 10 seconds */
+
+#define CONFIG_BAUDRATE                115200
+
+/* valid baudrates */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
+
+#define CONFIG_TIMESTAMP               /* Print image info with timestamp */

include/configs/qemu-mips64.h line 52

Quoted 10 lines
include/configs/qemu-mips64.h new file +10 -0
+#undef CONFIG_BOOTARGS
+
+#define CONFIG_EXTRA_ENV_SETTINGS                                      \
+       "addmisc=setenv bootargs ${bootargs} "                          \
+               "console=ttyS0,${baudrate} "                            \
+               "panic=1\0"                                             \
+       "bootfile=/tftpboot/vmlinux\0"                                  \
+       "load=tftp ffffffff80500000 ${u-boot}\0"                        \
+       ""
+

why have you omitted this?

#define CONFIG_BOOTCOMMAND "bootp;bootelf"

#define CONFIG_CMD_ELF

Quoted 83 lines
include/configs/qemu-mips64.h new file +83 -0
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE
+#define CONFIG_BOOTP_BOOTPATH
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_HOSTNAME
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#define CONFIG_DP83902A
+
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT2
+#undef CONFIG_CMD_LOADB
+#undef CONFIG_CMD_LOADS
+#define CONFIG_CMD_DHCP
+
+#define CONFIG_DRIVER_NE2000
+#define CONFIG_DRIVER_NE2000_BASE      0xffffffffb4000300
+
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE    1
+#define CONFIG_SYS_NS16550_CLK         115200
+#define CONFIG_SYS_NS16550_COM1                (0xffffffffb40003f8)
+#define CONFIG_CONS_INDEX              1
+
+#define CONFIG_CMD_IDE
+#define CONFIG_DOS_PARTITION
+
+#define CONFIG_SYS_IDE_MAXBUS          2
+#define CONFIG_SYS_ATA_IDE0_OFFSET     (0x1f0)
+#define CONFIG_SYS_ATA_IDE1_OFFSET     (0x170)
+#define CONFIG_SYS_ATA_DATA_OFFSET     (0)
+#define CONFIG_SYS_ATA_REG_OFFSET      (0)
+#define CONFIG_SYS_ATA_BASE_ADDR       (0xffffffffb4000000)
+
+#define CONFIG_SYS_IDE_MAXDEVICE       (4)
+
+#define CONFIG_CMD_RARP
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+
+/* Monitor Command Prompt */
+#if defined(CONFIG_SYS_LITTLE_ENDIAN)
+#define CONFIG_SYS_PROMPT              "qemu-mips64el # "
+#else
+#define CONFIG_SYS_PROMPT              "qemu-mips64 # "
+#endif
+
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
+
+/* Console I/O Buffer Size */
+#define CONFIG_SYS_CBSIZE              256
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
+/* max number of command args */
+#define CONFIG_SYS_MAXARGS             16
+
+#define CONFIG_SYS_MALLOC_LEN          128*1024
+
+#define CONFIG_SYS_BOOTPARAMS_LEN      128*1024
+
+#define CONFIG_SYS_MHZ                 132
+
+#define CONFIG_SYS_MIPS_TIMER_FREQ     (CONFIG_SYS_MHZ * 1000000)
+
+#define CONFIG_SYS_HZ                  1000
+
+/* Cached addr */
+#define CONFIG_SYS_SDRAM_BASE          0xffffffff80000000
+
+/* default load address */
+#define CONFIG_SYS_LOAD_ADDR           0xffffffff81000000

include/configs/qemu-mips64.h line 145

Quoted 10 lines
include/configs/qemu-mips64.h new file +10 -0
+
+#define CONFIG_SYS_MEMTEST_START       0xffffffff80100000
+#define CONFIG_SYS_MEMTEST_END         0xffffffff80800000
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_CMD_NO_FLASH
+#define CONFIG_SYS_NO_FLASH
+#undef CONFIG_CMD_IMLS

why have you omitted the flash support? qemu-system-mips supports flash emulation
with the option -pflash. It already works with a qemu_mips32 U-boot.

include/configs/qemu-mips64.h line 148

Quoted 3 lines
include/configs/qemu-mips64.h new file +3 -0
+
+/* The following #defines are needed to get flash environment right */
+#undef CONFIG_SYS_TEXT_BASE

drop this line

Quoted 4 lines
include/configs/qemu-mips64.h new file +4 -0
+#define CONFIG_SYS_TEXT_BASE           0xffffffffbfc00000 /* ROM Version */
+#define CONFIG_SYS_MONITOR_BASE                CONFIG_SYS_TEXT_BASE
+
+#define CONFIG_SYS_INIT_SP_OFFSET      0x400000

include/configs/qemu-mips64.h line 162

Quoted 10 lines
include/configs/qemu-mips64.h new file +10 -0
+#define CONFIG_ENV_IS_NOWHERE
+
+/* Address and size of Primary Environment Sector */
+#define CONFIG_ENV_SIZE                0x8000
+
+#define CONFIG_ENV_OVERWRITE
+
+#define MEM_SIZE               128
+
+#define CONFIG_LZA

#define CONFIG_LZMA

Quoted 12 lines
include/configs/qemu-mips64.h new file +9 -1
+
+/*-----------------------------------------------------------------------
+ * Cache Configuration
+ */
+#define CONFIG_SYS_DCACHE_SIZE         16384
+#define CONFIG_SYS_ICACHE_SIZE         16384
+#define CONFIG_SYS_CACHELINE_SIZE      32
+
+#endif /* __CONFIG_H */
--

1.7.9.5

Signature · 2 lines
Best regards,
Daniel
#9 lore raw

PATCH v5 4/4 MIPS: add board qemu-mips64 support

Quoted 105 lines · Daniel Schwierzeck

2012/9/4 Zhizhou Zhang <[email protected]>:

Quoted 3 lines

Both 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

Quoted 1 line

qemu-system-mips64 -M mips -bios u-boot.bin -cpu MIPS64R2-generic

-nographic

Quoted 2 lines

Ram version:
qemu-system-mips64el -M mips -cpu MIPS64R2-generic -kernel u-boot

-nographic

Quoted 1 line

qemu-system-mips64 -M mips -cpu MIPS64R2-generic -kernel u-boot

-nographic

Quoted 5 lines
---
 arch/mips/cpu/mips64/Makefile     |   45 +++++++
 arch/mips/cpu/mips64/cache.S      |  229

+++++++++++++++++++++++++++++++++

Quoted 4 lines
 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

+++++++++++++++++++++++++++++++++++++

Quoted 16 lines
 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     |  171 +++++++++++++++++++++++++
 11 files changed, 1042 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

[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/include/configs/qemu-mips64.h

Quoted 20 lines

new file mode 100644
index 0000000..216326d

include/configs/qemu-mips64.h new file +15 -0
@@ -0,0 +1,171 @@
+/*
+ * (C) Copyright 2003
+ * 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

include/configs/qemu-mips64.h line 25

Quoted 10 lines
include/configs/qemu-mips64.h new file +10 -0
+ * 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
+ */
+
+/*
+ * This file contains the configuration parameters for qemu-mips64

target.

Quoted 5 lines
include/configs/qemu-mips64.h new file +5 -0
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+

include/configs/qemu-mips64.h

Quoted 10 lines
include/configs/qemu-mips64.h new file +10 -0
+#define CONFIG_MIPS64                  /* MIPS64 CPU core */
+#define CONFIG_QEMU_MIPS1
+#define CONFIG_MISC_INIT_R
+
+#define CONFIG_BOOTDELAY       10      /* autoboot after 10 seconds */
+
+#define CONFIG_BAUDRATE                115200
+
+/* valid baudrates */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600,

115200 }

include/configs/qemu-mips64.h line 42

Quoted 2 lines
include/configs/qemu-mips64.h new file +2 -0
+
+#define CONFIG_TIMESTAMP               /* Print image info with

timestamp */

include/configs/qemu-mips64.h line 52

Quoted 10 lines
include/configs/qemu-mips64.h new file +10 -0
+#undef CONFIG_BOOTARGS
+
+#define CONFIG_EXTRA_ENV_SETTINGS                                      \
+       "addmisc=setenv bootargs ${bootargs} "                          \
+               "console=ttyS0,${baudrate} "                            \
+               "panic=1\0"                                             \
+       "bootfile=/tftpboot/vmlinux\0"                                  \
+       "load=tftp ffffffff80500000 ${u-boot}\0"                        \
+       ""
+

why have you omitted this?

Quoted 5 lines

#define CONFIG_BOOTCOMMAND "bootp;bootelf"

#define CONFIG_CMD_ELF

Because I haven't tested `bootelf' command. I'm not should it work or not.

Another reason is that when I configure CONFIG_CMD_ELF I will get lots of warning such as:
cmd_elf.c: In function 'load_elf_image_phdr':
cmd_elf.c:289:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
cmd_elf.c: In function 'load_elf_image_shdr':
cmd_elf.c:343:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
cmd_elf.c:346:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Quoted 100 lines

+/*

Quoted 54 lines
include/configs/qemu-mips64.h new file +54 -0
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE
+#define CONFIG_BOOTP_BOOTPATH
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_HOSTNAME
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#define CONFIG_DP83902A
+
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT2
+#undef CONFIG_CMD_LOADB
+#undef CONFIG_CMD_LOADS
+#define CONFIG_CMD_DHCP
+
+#define CONFIG_DRIVER_NE2000
+#define CONFIG_DRIVER_NE2000_BASE      0xffffffffb4000300
+
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE    1
+#define CONFIG_SYS_NS16550_CLK         115200
+#define CONFIG_SYS_NS16550_COM1                (0xffffffffb40003f8)
+#define CONFIG_CONS_INDEX              1
+
+#define CONFIG_CMD_IDE
+#define CONFIG_DOS_PARTITION
+
+#define CONFIG_SYS_IDE_MAXBUS          2
+#define CONFIG_SYS_ATA_IDE0_OFFSET     (0x1f0)
+#define CONFIG_SYS_ATA_IDE1_OFFSET     (0x170)
+#define CONFIG_SYS_ATA_DATA_OFFSET     (0)
+#define CONFIG_SYS_ATA_REG_OFFSET      (0)
+#define CONFIG_SYS_ATA_BASE_ADDR       (0xffffffffb4000000)
+
+#define CONFIG_SYS_IDE_MAXDEVICE       (4)
+
+#define CONFIG_CMD_RARP
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP            /* undef to save memory */
+
+/* Monitor Command Prompt */
+#if defined(CONFIG_SYS_LITTLE_ENDIAN)
+#define CONFIG_SYS_PROMPT              "qemu-mips64el # "
+#else
+#define CONFIG_SYS_PROMPT              "qemu-mips64 # "
+#endif

include/configs/qemu-mips64.h

Quoted 10 lines
include/configs/qemu-mips64.h new file +10 -0
+
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
+
+/* Console I/O Buffer Size */
+#define CONFIG_SYS_CBSIZE              256
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE

(CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)

Quoted 13 lines
include/configs/qemu-mips64.h new file +12 -0
+/* max number of command args */
+#define CONFIG_SYS_MAXARGS             16
+
+#define CONFIG_SYS_MALLOC_LEN          128*1024
+
+#define CONFIG_SYS_BOOTPARAMS_LEN      128*1024
+
+#define CONFIG_SYS_MHZ                 132
+
+#define CONFIG_SYS_MIPS_TIMER_FREQ     (CONFIG_SYS_MHZ * 1000000)
+
+#define CONFIG_SYS_HZ                  1000

include/configs/qemu-mips64.h line 139

Quoted 10 lines
include/configs/qemu-mips64.h new file +10 -0
+
+/* Cached addr */
+#define CONFIG_SYS_SDRAM_BASE          0xffffffff80000000
+
+/* default load address */
+#define CONFIG_SYS_LOAD_ADDR           0xffffffff81000000
+
+#define CONFIG_SYS_MEMTEST_START       0xffffffff80100000
+#define CONFIG_SYS_MEMTEST_END         0xffffffff80800000
+

+/*-----------------------------------------------------------------------

include/configs/qemu-mips64.h line 145

Quoted 5 lines
include/configs/qemu-mips64.h new file +5 -0
+ * FLASH and environment organization
+ */
+#define CONFIG_CMD_NO_FLASH
+#define CONFIG_SYS_NO_FLASH
+#undef CONFIG_CMD_IMLS

why have you omitted the flash support? qemu-system-mips supports flash emulation
with the option -pflash. It already works with a qemu_mips32 U-boot.

Quoted 1 line

Yes, I have tested with -pflash in qemu_mips64 either. I have forgot why I

omit
it now. By the way, which commit should I base on of my next patch?

Quoted 46 lines

include/configs/qemu-mips64.h line 148

Quoted 3 lines
include/configs/qemu-mips64.h new file +3 -0
+
+/* The following #defines are needed to get flash environment right */
+#undef CONFIG_SYS_TEXT_BASE

drop this line

include/configs/qemu-mips64.h line 147

Quoted 1 line
include/configs/qemu-mips64.h new file +1 -0
+#define CONFIG_SYS_TEXT_BASE           0xffffffffbfc00000 /* ROM

Version */

include/configs/qemu-mips64.h line 162

Quoted 13 lines
include/configs/qemu-mips64.h new file +13 -0
+#define CONFIG_SYS_MONITOR_BASE                CONFIG_SYS_TEXT_BASE
+
+#define CONFIG_SYS_INIT_SP_OFFSET      0x400000
+#define CONFIG_ENV_IS_NOWHERE
+
+/* Address and size of Primary Environment Sector */
+#define CONFIG_ENV_SIZE                0x8000
+
+#define CONFIG_ENV_OVERWRITE
+
+#define MEM_SIZE               128
+
+#define CONFIG_LZA

#define CONFIG_LZMA

Thanks, I will put more attention on checking this file.

include/configs/qemu-mips64.h line 161

Quoted 2 lines
include/configs/qemu-mips64.h new file +1 -0
+

+/*-----------------------------------------------------------------------

Quoted 10 lines
include/configs/qemu-mips64.h new file +7 -1
+ * Cache Configuration
+ */
+#define CONFIG_SYS_DCACHE_SIZE         16384
+#define CONFIG_SYS_ICACHE_SIZE         16384
+#define CONFIG_SYS_CACHELINE_SIZE      32
+
+#endif /* __CONFIG_H */
--

1.7.9.5

--
Best regards,
Daniel

Signature · 2 lines
Regards,
Zhizhou Zhang
#10 lore raw

PATCH v5 4/4 MIPS: add board qemu-mips64 support

2012/9/5 Zhi-zhou Zhang <[email protected]>:
[...]

Quoted 7 lines
Quoted 7 lines

why have you omitted this?

#define CONFIG_BOOTCOMMAND "bootp;bootelf"

#define CONFIG_CMD_ELF

Quoted 11 lines

Because I haven't tested `bootelf' command. I'm not should it work or not. Another reason is that when I configure CONFIG_CMD_ELF I will get lots of warning such as:
cmd_elf.c: In function 'load_elf_image_phdr':
cmd_elf.c:289:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
cmd_elf.c: In function 'load_elf_image_shdr':
cmd_elf.c:343:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
cmd_elf.c:346:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

ok but there are similar warnings in other files too. We can fix those files later.
My point is that all qemu_mips variants should be configured with the same options.

[...]

Quoted 8 lines
Quoted 5 lines

why have you omitted the flash support? qemu-system-mips supports flash emulation
with the option -pflash. It already works with a qemu_mips32 U-boot.

Yes, I have tested with -pflash in qemu_mips64 either. I have forgot why I omit
it now. By the way, which commit should I base on of my next patch?

it is still git://git.denx.de/u-boot-mips.git master

Signature · 2 lines
Best regards,
Daniel