📄 1000.tango2.patch
字号:
++#ifdef CONFIG_TANGO2+ /* Aligned by MB boundary */+ em8xxx_kmem_size = ((start_at + mem_size) & 0xfff00000) - start_at;+ kend = KSEG1ADDR(em8xxx_kmem_start + em8xxx_kmem_size) - KSEG1ADDR(MEM_BASE_dram_controller_0);+ m->kernel_end = kend;+ gen_memcfg_checksum(m);+ add_memory_region(start_at, em8xxx_kmem_size, BOOT_MEM_RAM);+#else add_memory_region(start_at, mem_size, BOOT_MEM_RAM);+#endif+ } c = *(from++); if (!c)@@ -494,6 +523,7 @@ void hp_setup(void); void au1x00_setup(void); void frame_info_init(void);+ void tango2_setup(void); frame_info_init(); #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)@@ -691,6 +721,11 @@ pmc_yosemite_setup(); break; #endif+#ifdef CONFIG_TANGO2+ case MACH_GROUP_SIGMADESIGNS:+ tango2_setup();+ break;+#endif default: panic("Unsupported architecture"); }diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/kernel/time.c linuxmips-2.4.30/arch/mips/kernel/time.c--- linuxmips-2.4.30.ref/arch/mips/kernel/time.c 2004-10-07 19:42:43.000000000 -0700+++ linuxmips-2.4.30/arch/mips/kernel/time.c 2007-06-20 14:01:27.000000000 -0700@@ -32,6 +32,13 @@ #include <asm/hardirq.h> #include <asm/div64.h> +#ifdef CONFIG_TANGO2+#include <asm/io.h>+#include <asm/tango2/rmdefs.h>+#include <asm/tango2/tango2.h>+#include <asm/tango2/hardware.h>+#endif+ /* * The integer part of the number of usecs per jiffy is taken from tick, * but the fractional part is not recorded, so we calculate it using the@@ -415,6 +422,34 @@ unsigned long j; unsigned int count; +#ifdef CONFIG_TANGO2+ static int active = 0;+ static long drift = 0;+ static unsigned long old_xtal = 0;+ long diff;+ unsigned long xtal;+ +#ifndef CONFIG_TANGO2_USE_CPU_CLOCK + /* Clear interrupt source */+ gbus_write_uint32(pGBus, REG_BASE_cpu_block + CPU_time0_clr, 1);+#endif++ /* calibrate jiffies against xtal_in_cnt */+ xtal = gbus_read_uint32(pGBus, REG_BASE_system_block + SYS_xtal_in_cnt);+ if (active) {+ int cnt;+ diff = (long)((xtal <= old_xtal) ? ((0xffffffff - old_xtal) + xtal + 1) : (xtal - old_xtal));+ drift += (diff - (TANGO2_BASE_FREQUENCY / HZ));+ if ((cnt = drift / (TANGO2_BASE_FREQUENCY / HZ))) {+ (*(unsigned long *)&jiffies) += cnt;+ drift %= (TANGO2_BASE_FREQUENCY / HZ);+// printk("Compensate drifting %d: 0x%08lx..\n", cnt, jiffies);+ }+ } else+ active = 1;+ old_xtal = xtal;+#endif+ count = mips_hpt_read(); mips_timer_ack(); diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/kernel/traps.c linuxmips-2.4.30/arch/mips/kernel/traps.c--- linuxmips-2.4.30.ref/arch/mips/kernel/traps.c 2004-11-22 05:38:23.000000000 -0800+++ linuxmips-2.4.30/arch/mips/kernel/traps.c 2007-06-20 14:01:27.000000000 -0700@@ -664,6 +664,9 @@ asmlinkage void do_ri(struct pt_regs *regs) {+ dump_tlb_all();+ show_regs(regs);+ die_if_kernel("Reserved instruction in kernel code", regs); if (!cpu_has_llsc)@@ -729,7 +732,16 @@ */ dump_tlb_all(); show_regs(regs);+#if 1+ // clear all of them (should rather identify culprit)+ write_c0_watchlo0(0);+ write_c0_watchlo1(0);+ write_c0_watchlo2(0);+ write_c0_watchlo3(0);+#else+ // just oops and continue. This should be safe. panic("Caught WATCH exception - probably caused by stack overflow.");+#endif } asmlinkage void do_mcheck(struct pt_regs *regs)diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/Makefile linuxmips-2.4.30/arch/mips/Makefile--- linuxmips-2.4.30.ref/arch/mips/Makefile 2005-01-30 00:01:26.000000000 -0800+++ linuxmips-2.4.30/arch/mips/Makefile 2007-06-20 14:02:52.000000000 -0700@@ -44,7 +44,7 @@ # crossformat linking we rely on the elf2ecoff tool for format conversion. # GCCFLAGS := -I $(TOPDIR)/include/asm/gcc-GCCFLAGS += -G 0 -mno-abicalls -fno-pic -pipe+GCCFLAGS += -G 0 -mno-abicalls -fno-pic -pipe -fno-builtin GCCFLAGS += $(call check_gcc, -finline-limit=100000,) LINKFLAGS += -G 0 -static -n MODFLAGS += -mlong-calls@@ -56,6 +56,32 @@ endif endif +ifdef CONFIG_TANGO2+GCCFLAGS += -DEM86XX_CHIP=EM86XX_CHIPID_TANGO2+endif++ifdef CONFIG_TANGO2_ES1+GCCFLAGS += -DEM86XX_REVISION=1+else+ifdef CONFIG_TANGO2_ES2+GCCFLAGS += -DEM86XX_REVISION=2+else+ifdef CONFIG_TANGO2_ES3+GCCFLAGS += -DEM86XX_REVISION=3+else+ifdef CONFIG_TANGO2_ES4+GCCFLAGS += -DEM86XX_REVISION=4+else+ifdef CONFIG_TANGO2_ES6+GCCFLAGS += -DEM86XX_REVISION=6+else+# Wrong revision specified here.+endif+endif+endif+endif+endif+ # # Use: $(call set_gccflags,<cpu0>,<isa0>,<cpu1>,<isa1>,<isa2>) #@@ -727,6 +753,21 @@ endif #+# SigmaDesigns Tango2 board+#+ifdef CONFIG_TANGO2++include include/asm-mips/tango2/emhwlib_registers_tango2.inc+include include/asm-mips/tango2/emhwlib_dram_tango2.inc+SHELL=/bin/bash+internal_hex = 0x$(shell printf "%x" $$[$(1)])++SUBDIRS += arch/mips/tango2+LIBS += arch/mips/tango2/tango2.o+LOADADDR=$(call internal_hex,0x80000000+$(MEM_BASE_dram_controller_0)+$(FM_linuxmips__ftext))+endif++# # Choosing incompatible machines durings configuration will result in # error messages during linking. Select a default linkscript if # none has been choosen above.diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/mm/fault.c linuxmips-2.4.30/arch/mips/mm/fault.c--- linuxmips-2.4.30.ref/arch/mips/mm/fault.c 2003-04-08 17:46:23.000000000 -0700+++ linuxmips-2.4.30/arch/mips/mm/fault.c 2007-06-20 14:01:27.000000000 -0700@@ -164,7 +164,7 @@ if (user_mode(regs)) { tsk->thread.cp0_badvaddr = address; tsk->thread.error_code = write;-#if 0+#if 1 printk("do_page_fault() #2: sending SIGSEGV to %s for illegal %s\n" "%08lx (epc == %08lx, ra == %08lx)\n", tsk->comm,diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/tango2/.cvsignore linuxmips-2.4.30/arch/mips/tango2/.cvsignore--- linuxmips-2.4.30.ref/arch/mips/tango2/.cvsignore 1969-12-31 16:00:00.000000000 -0800+++ linuxmips-2.4.30/arch/mips/tango2/.cvsignore 2007-06-20 14:01:27.000000000 -0700@@ -0,0 +1,6 @@+.depend+.irq.o.flags+.prom.o.flags+.setup.o.flags+.tango2.o.flags+.tango2controllers.o.flagsdiff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/tango2/delay.c linuxmips-2.4.30/arch/mips/tango2/delay.c--- linuxmips-2.4.30.ref/arch/mips/tango2/delay.c 1969-12-31 16:00:00.000000000 -0800+++ linuxmips-2.4.30/arch/mips/tango2/delay.c 2007-06-20 14:01:27.000000000 -0700@@ -0,0 +1,49 @@+/*+ * arch/mips/tango2/delay.c+ *+ * Copyright (C) 2003-2004 Sigma Designs, Inc+ *+ */++#include <linux/config.h>+#include <linux/module.h>+#include <linux/kernel.h>+#include <linux/init.h>+#include <asm/tango2/rmdefs.h>+#include <asm/tango2/hardware.h>+#include <asm/tango2/tango2api.h>+#include <asm/io.h>+#include <linux/irq.h>+#include <linux/sched.h>++static inline unsigned long tango2_getxtal(void)+{+ return(gbus_read_uint32(pGBus, REG_BASE_system_block + SYS_xtal_in_cnt));+}++/* This is the replacement of Linux's udelay. */+void tango2_udelay(unsigned usec)+{+ /* SYS_xtal_in_cnt is a counter running off 27MHz, so 1 usec+ is roughly equivalent to 27 increase of count */+ unsigned long start = tango2_getxtal();+ unsigned long end = start + (usec * 27);++ if (end <= start) + /* Handle overflow condition */+ while (tango2_getxtal() > start);+ while (tango2_getxtal() < end);+}++void tango2_syncwith_xtal(unsigned long *mark, unsigned usec)+{+ unsigned long end = *mark + (usec * 27);+ if (end > *mark)+ /* Handle overflow condition */+ while (tango2_getxtal() > *mark);+ while (tango2_getxtal() < end);+ *mark = end;+}++EXPORT_SYMBOL(tango2_udelay);+diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/tango2/full_sha1.c linuxmips-2.4.30/arch/mips/tango2/full_sha1.c--- linuxmips-2.4.30.ref/arch/mips/tango2/full_sha1.c 1969-12-31 16:00:00.000000000 -0800+++ linuxmips-2.4.30/arch/mips/tango2/full_sha1.c 2007-06-20 14:01:27.000000000 -0700@@ -0,0 +1,48 @@++#ifdef __KERNEL__+#include <linux/config.h>+#include <linux/string.h>+#else+#include "zbootcfg.h"+#include "uart.h"+#include "util.h"+#endif++#include "sha1sum.h"++#if defined(CONFIG_XENV_SUPPORT) || defined(CONFIG_TANGO2_XENV)++// #include "xos.h"++#define XENV_RDONLY++#ifndef __KERNEL__+typedef unsigned int RMuint32;+typedef unsigned short RMuint16;+typedef unsigned char RMuint8;+typedef char RMascii;+typedef int RMstatus;+#else+#include <asm/tango2/rmdefs.h>+#endif++/*+ append a single "1" bit to message+ append "0" bits until message length ~ 448 ~ -64 (mod 512)+ append length of message, in bits as 64-bit big-endian integer to message++ Below, size and left are expressed in bytes. Implementation is compact but endian-dependent+*/++void full_sha1(RMuint32 digest[5],const RMuint8 *src,RMuint32 size,RMuint32 fromISP)+{+#if 0+ if (fromISP) sink(); // unsupported+#else+ if (fromISP) return; // unsupported+#endif++ sha1sum(src, size, digest);+}+#endif /* CONFIG_XENV_SUPPORT */+diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/tango2/gbus_standalone.S linuxmips-2.4.30/arch/mips/tango2/gbus_standalone.S--- linuxmips-2.4.30.ref/arch/mips/tango2/gbus_standalone.S 1969-12-31 16:00:00.000000000 -0800+++ linuxmips-2.4.30/arch/mips/tango2/gbus_standalone.S 2007-06-20 14:01:27.000000000 -0700@@ -0,0 +1,184 @@+/*+ Refer to bug #3644.+ + TLB-based implementation works on the ranges:+ [0x00000000..0x20000000[ access thru kseg1+ [0x20000000..0x2xxxxxxx (size of dram1, a parameter of ioremap())[ access thru tlb. Outside: unpredictable/oops.++ Remap-based implementation does:+ 00xy b27b26..b0 to 101y(b27|x)b26..b0.+ and works everywhere excepted ranges: [0x18000000..0x20000000[ and [0x28000000..0xffffffff]++ Test with+ {+ volatile int q=gbus_read_uint32(pGBus,0x1020212c); // correct+ q=gbus_read_uint32(pGBus,0x1f20212c); // incorrect+ q=gbus_read_uint32(pGBus,0x2020212c); // correct+ q=gbus_read_uint32(pGBus,0x2720212c); // correct+ q=gbus_read_uint32(pGBus,0x2820212c); // incorrect+ q=gbus_read_uint32(pGBus,0x2f20212c); // incorrect+ }+*/+ +#include <asm/asm.h>+#include <asm/regdef.h>+#include <asm/mipsregs.h>++.set noreorder+.set mips32r2++#ifdef CONFIG_TANGO2_USE_TLB_REMAP_DRAM1++LEAF(gbus_read_dram_uint8)+ ext t0, a1, 29, 1 // 0x20000000 is bit29+ bnez t0, 1f+ lui t1, 0xa000+ or t0, t1, a1+ jr ra+ lbu v0, 0(t0)+1:+ lui t1, 0x2000+ sub t0, a1, t1+ lw t1, em86xx_tlb_dram1_map_base+ add t0, t1+ jr ra+ lbu v0, 0(t0)+END(gbus_read_dram_uint8)++LEAF(gbus_read_dram_uint16)+ ext t0, a1, 29, 1 // 0x20000000 is bit29+ bnez t0, 1f+ lui t1, 0xa000+ or t0, t1, a1+ jr ra+ lhu v0, 0(t0)+1:+ lui t1, 0x2000+ sub t0, a1, t1+ lw t1, em86xx_tlb_dram1_map_base+ add t0, t1+ jr ra+ lhu v0, 0(t0)+END(gbus_read_dram_uint16)++LEAF(gbus_read_dram_uint32)+ ext t0, a1, 29, 1 // 0x20000000 is bit29+ bnez t0, 1f+ lui t1, 0xa000+ or t0, t1, a1+ jr ra+ lw v0, 0(t0)+1:+ lui t1, 0x2000+ sub t0, a1, t1+ lw t1, em86xx_tlb_dram1_map_base+ add t0, t1+ jr ra+ lw v0, 0(t0)+END(gbus_read_dram_uint32)++LEAF(gbus_write_dram_uint8)+ ext t0, a1, 29, 1 // 0x20000000 is bit29+ bnez t0, 1f+ lui t1, 0xa000
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -