diff --git a/CHANGELOG b/CHANGELOG index d64acbbd6808f1e81bb8dfc4b005fba90b1377ca..974ce57731cc7405d8c28fa224e91df56b629868 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,13 @@ Changes since U-Boot 1.0.0: ====================================================================== +* Patch by Gleb Natapov, 19 Sep 2003: + Move most of the timer interrupt related PPC code to ppc_lib/interrupts.c + +* Patch by Anders Larsen, 17 Sep 2003: + Bring ARM memory layout in sync with the documentation: + stack and malloc-heap are now located _below_ the U-Boot code + * Accelerate booting on TRAB board: read and check autoupdate image headers first instead of always reading the whole images. diff --git a/MAKEALL b/MAKEALL index ae22c67f55e68cf10de59b9158422e9d39b68301..2494b560407fcfbd17de886711cefaf010de2309 100644 --- a/MAKEALL +++ b/MAKEALL @@ -1,5 +1,7 @@ #!/bin/sh +: ${JOBS:=} + if [ "${CROSS_COMPILE}" ] ; then MAKE="make CROSS_COMPILE=${CROSS_COMPILE}" else @@ -179,7 +181,7 @@ build_target() { ${MAKE} distclean >/dev/null ${MAKE} ${target}_config - ${MAKE} all 2>&1 >LOG/$target.MAKELOG | tee LOG/$target.ERR + ${MAKE} ${JOBS} all 2>&1 >LOG/$target.MAKELOG | tee LOG/$target.ERR ${CROSS_COMPILE:-ppc_8xx-}size u-boot | tee -a LOG/$target.MAKELOG } diff --git a/Makefile b/Makefile index 474683785825527ed6dfbd3c405aa6ed3dfc4957..a4462f899258b19d624e5aa73b1dd52a112687ff 100644 --- a/Makefile +++ b/Makefile @@ -77,24 +77,6 @@ endif export CROSS_COMPILE -# The "tools" are needed early, so put this first -SUBDIRS = tools \ - examples \ - lib_generic \ - lib_$(ARCH) \ - cpu/$(CPU) \ - board/$(BOARDDIR) \ - common \ - disk \ - fs \ - net \ - rtc \ - dtt \ - drivers \ - drivers/sk98lin \ - post \ - post/cpu - ######################################################################### # U-Boot objects....order is important (i.e. start must be first) @@ -123,9 +105,17 @@ LIBS += drivers/sk98lin/libsk98lin.a LIBS += post/libpost.a post/cpu/libcpu.a LIBS += common/libcommon.a LIBS += lib_generic/libgeneric.a + # Add GCC lib PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc +# The "tools" are needed early, so put this first +# Don't include stuff already done in $(LIBS) +SUBDIRS = tools \ + examples \ + post \ + post/cpu + ######################################################################### ######################################################################### @@ -149,14 +139,18 @@ u-boot.img: u-boot.bin u-boot.dis: u-boot $(OBJDUMP) -d $< > $@ -u-boot: depend subdirs $(OBJS) $(LIBS) $(LDSCRIPT) +u-boot: depend $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT) UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\ $(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \ --start-group $(LIBS) $(PLATFORM_LIBS) --end-group \ -Map u-boot.map -o u-boot -subdirs: - @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir || exit 1 ; done +$(LIBS): + $(MAKE) -C `dirname $@` + +$(SUBDIRS): + @echo "#### MAKE $@ ####" + $(MAKE) -C $@ gdbtools: $(MAKE) -C tools/gdb || exit 1 @@ -884,12 +878,12 @@ trab_old_config: unconfig @[ -z "$(findstring _bigflash,$@)" ] || \ { echo "#define CONFIG_RAM_16MB" >>include/config.h ; \ echo "... with 16 MB Flash, 16 MB RAM" ; \ - echo "TEXT_BASE = 0x0CF00000" >board/trab/config.tmp ; \ + echo "TEXT_BASE = 0x0CF40000" >board/trab/config.tmp ; \ } @[ -z "$(findstring _old,$@)" ] || \ { echo "#define CONFIG_OLD_VERSION" >>include/config.h ; \ echo "... with small memory configuration" ; \ - echo "TEXT_BASE = 0x0CF00000" >board/trab/config.tmp ; \ + echo "TEXT_BASE = 0x0CF40000" >board/trab/config.tmp ; \ } @./mkconfig -a $(call xtract_trab,$@) arm arm920t trab diff --git a/README b/README index a1c6a96ba3c8e6171b47a34a88cca9ee0f2e4e64..cdf3f55590794c9f1ba1bd7394db04b877c3c95d 100644 --- a/README +++ b/README @@ -1353,7 +1353,7 @@ The following options need to be configured: of the backslashes before semicolons and special symbols. -- Default Environment +- Default Environment: CONFIG_EXTRA_ENV_SETTINGS Define this to contain any number of null terminated @@ -1379,14 +1379,14 @@ The following options need to be configured: the environment like the autoscript function or the boot command first. -- DataFlash Support +- DataFlash Support: CONFIG_HAS_DATAFLASH Defining this option enables DataFlash features and allows to read/write in Dataflash via the standard commands cp, md... -- Show boot progress +- Show boot progress: CONFIG_SHOW_BOOT_PROGRESS Defining this option allows to add some board- @@ -1466,6 +1466,19 @@ Modem Support: Enables debugging stuff (char screen[1024], dbg()) for modem support. Useful only with BDI2000. +- Interrupt support (PPC): + + There are common interrupt_init() and timer_interrupt() + for all PPC archs. interrupt_init() calls interrupt_init_cpu() + for cpu specific initialization. interrupt_init_cpu() + should set decrementer_count to appropriate value. If + cpu resets decrementer automatically after interrupt + (ppc4xx) it should set decrementer_count to zero. + timer_interrupt() calls timer_interrupt_cpu() for cpu + specific handling. If board has watchdog / status_led + / other_activity_monitor it works automatically from + general timer_interrupt(). + - General: In the target system modem support is enabled when a diff --git a/board/at91rm9200dk/config.mk b/board/at91rm9200dk/config.mk index 9ce161e55f054c050a1f6293fab2b240eda719fc..27cb3b123d7312d8bde4b516cb98cb752168b2cf 100644 --- a/board/at91rm9200dk/config.mk +++ b/board/at91rm9200dk/config.mk @@ -1 +1 @@ -TEXT_BASE = 0x21f00000 +TEXT_BASE = 0x21f80000 diff --git a/board/cogent/lcd.c b/board/cogent/lcd.c index c1b4d116ea843b5b2086911d9e712f74a4a72271..814b4c80a0459b55611b4ea4a2a2b9a930a7179e 100644 --- a/board/cogent/lcd.c +++ b/board/cogent/lcd.c @@ -229,3 +229,17 @@ lcd_heartbeat(void) if (++rotator_index >= (sizeof rotchars / sizeof rotchars[0])) rotator_index = 0; } + +#ifdef CONFIG_SHOW_ACTIVITY +void board_show_activity (ulong timestamp) +{ +#ifdef CONFIG_STATUS_LED + if ((timestamp % (CFG_HZ / 2) == 0) + lcd_heartbeat (); +#endif +} + +void show_activity(int arg) +{ +} +#endif diff --git a/board/cradle/config.mk b/board/cradle/config.mk index 3ffcfe844482b2332c3029b6646f3ebe40719857..aa40388811aada9912ca517296b2811e51d0f96c 100644 --- a/board/cradle/config.mk +++ b/board/cradle/config.mk @@ -1,2 +1,2 @@ -TEXT_BASE = 0xa0f08000 +TEXT_BASE = 0xa0f80000 #TEXT_BASE = 0 diff --git a/board/dnp1110/config.mk b/board/dnp1110/config.mk index 72ba595f1ac93ee62f2c20e86b7384002361b386..4f6af46f8ccabdba7a698c3deecf8ad35cfe6792 100644 --- a/board/dnp1110/config.mk +++ b/board/dnp1110/config.mk @@ -11,7 +11,7 @@ # # Linux-Kernel is expected to be at c000'8000, entry c000'8000 # -# we load ourself to c1f0'0000, the upper 1 MB of the first (only) bank +# we load ourself to c1f8'0000, the upper 1 MB of the first (only) bank # -TEXT_BASE = 0xc1f00000 +TEXT_BASE = 0xc1f80000 diff --git a/board/ep7312/config.mk b/board/ep7312/config.mk index e1ba0e179854a1317a013bf756ac1d30311f3307..0ae16a2efecd919ff13cb0dc91a14db502ea1478 100644 --- a/board/ep7312/config.mk +++ b/board/ep7312/config.mk @@ -25,4 +25,4 @@ # MA 02111-1307 USA # -TEXT_BASE = 0xc0f00000 +TEXT_BASE = 0xc0f80000 diff --git a/board/hymod/hymod.c b/board/hymod/hymod.c index 3611a129771249f6cc55853c29a897888f314592..dea0a70a23a410aa68772a9226500080c64e5043 100644 --- a/board/hymod/hymod.c +++ b/board/hymod/hymod.c @@ -513,3 +513,25 @@ last_stage_init (void) return (0); } + +#ifdef CONFIG_SHOW_ACTIVITY +void board_show_activity (ulong timebase) +{ +#ifdef CFG_HYMOD_DBLEDS + volatile immap_t *immr = (immap_t *) CFG_IMMR; + volatile iop8260_t *iop = &immr->im_ioport; + static int shift = 0; + + if ((timestamp % CFG_HZ) == 0) { + if (++shift > 3) + shift = 0; + iop->iop_pdatd = + (iop->iop_pdatd & ~0x0f000000) | (1 << (24 + shift)); + } +#endif /* CFG_HYMOD_DBLEDS */ +} + +void show_activity(int arg) +{ +} +#endif /* CONFIG_SHOW_ACTIVITY */ diff --git a/board/impa7/config.mk b/board/impa7/config.mk index 69b376c094d791f309d013a9c06fc0499e12d0ec..417d6a8e2cbd6ec8300be63887a8900481365fdf 100644 --- a/board/impa7/config.mk +++ b/board/impa7/config.mk @@ -25,4 +25,4 @@ # MA 02111-1307 USA # -TEXT_BASE = 0xc1700000 +TEXT_BASE = 0xc1780000 diff --git a/board/lart/config.mk b/board/lart/config.mk index 8f1a62bbaa18bc949ad617754f7e9477bc5da12d..3033c4fba6957891b237a33946e98d4691e94224 100644 --- a/board/lart/config.mk +++ b/board/lart/config.mk @@ -14,10 +14,10 @@ # # Linux-Kernel is expected to be at c000'8000, entry c000'8000 # -# we load ourself to c170'0000, the upper 1 MB of second bank +# we load ourself to c178'0000, the upper 1 MB of second bank # # download areas is c800'0000 # -TEXT_BASE = 0xc1700000 +TEXT_BASE = 0xc1780000 diff --git a/board/oxc/oxc.c b/board/oxc/oxc.c index 5f5e59a3ad253d1651a6d4badd8aa03b54485f3a..0d6fc8536c0ccc51d549c27269915c8d4223834c 100644 --- a/board/oxc/oxc.c +++ b/board/oxc/oxc.c @@ -156,6 +156,12 @@ void oxc_toggle_activeled(void) ledtoggle++; } +void board_show_activity (ulong timestamp) +{ + if ((timestamp % (CFG_HZ / 10)) == 0) + oxc_toggle_activeled (); +} + void show_activity(int arg) { static unsigned char led = 0; diff --git a/board/shannon/config.mk b/board/shannon/config.mk index 736d3af623ec61b9b8eb7420feaa0d3f89ee2f9d..ca45733af00e98fe35b8234bd41fd04806bcf48c 100644 --- a/board/shannon/config.mk +++ b/board/shannon/config.mk @@ -14,10 +14,10 @@ # # Linux-Kernel is expected to be at c000'8000, entry c000'8000 # -# we load ourself to d830'0000, the upper 1 MB of the last (4th) bank +# we load ourself to d838'0000, the upper 1 MB of the last (4th) bank # # download areas is c800'0000 # -TEXT_BASE = 0xd8300000 +TEXT_BASE = 0xd8380000 diff --git a/board/trab/config.mk b/board/trab/config.mk index 2cb8edabf227cea66f92d267a18bce97c7a7f9c1..f2411d009c65606cfef21b4fe478df0c1353d43f 100644 --- a/board/trab/config.mk +++ b/board/trab/config.mk @@ -22,5 +22,5 @@ sinclude $(TOPDIR)/board/$(BOARDDIR)/config.tmp ifndef TEXT_BASE -TEXT_BASE = 0x0DF00000 +TEXT_BASE = 0x0DF40000 endif diff --git a/board/wepep250/wepep250.c b/board/wepep250/wepep250.c index 08b1bfde72a15476d25320d384e790b1e4f5d29c..581818316e72dd4878370eb518f5ec6226ecae90 100644 --- a/board/wepep250/wepep250.c +++ b/board/wepep250/wepep250.c @@ -40,15 +40,6 @@ int board_init( void ){ #endif PSSR = 0x20; -/* - * Following code is just bug workaround, remove it if not neccessary - */ - - /* cpu/xscale/cpu.c do not set armboot_real_end that is used for - malloc pool.*/ - if( _armboot_real_end == 0xbadc0de ){ - _armboot_real_end = _armboot_end; - } return 0; } diff --git a/common/Makefile b/common/Makefile index ae8222a6ae3e75f6e53fe25686ec2c56fb92e943..dae5942db5e9a31130ad1c253c1d0af2375263f4 100644 --- a/common/Makefile +++ b/common/Makefile @@ -63,6 +63,9 @@ environment.o: environment.c ../tools/envcrc -DENV_CRC=$(shell ../tools/envcrc) \ -c -o $@ environment.c +../tools/envcrc: + $(MAKE) -C ../tools + ######################################################################### .depend: Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c) diff --git a/common/xilinx.c b/common/xilinx.c index cb153e14eff8fa149258e915d4a9a786b5274655..b2e61692cb0d0a25e4f6f64f0ba9e2a2d02f089f 100644 --- a/common/xilinx.c +++ b/common/xilinx.c @@ -194,6 +194,7 @@ int xilinx_info (Xilinx_desc * desc) /* Add new family types here */ default: /* we don't need a message here - we give one up above */ + ; } } else printf ("No Device Function Table.\n"); diff --git a/cpu/74xx_7xx/interrupts.c b/cpu/74xx_7xx/interrupts.c index 2e2e45615db32d790cd8091db04c83d6d7e83e0a..f0ea4852654fb28c3ebce314e707cc331423d4d6 100644 --- a/cpu/74xx_7xx/interrupts.c +++ b/cpu/74xx_7xx/interrupts.c @@ -32,62 +32,7 @@ #include #include -/****************************************************************************/ - -unsigned decrementer_count; /* count value for 1e6/HZ microseconds */ - -/****************************************************************************/ - -static __inline__ unsigned long -get_msr(void) -{ - unsigned long msr; - - asm volatile("mfmsr %0" : "=r" (msr) :); - return msr; -} - -static __inline__ void -set_msr(unsigned long msr) -{ - asm volatile("mtmsr %0" : : "r" (msr)); -} - -static __inline__ unsigned long -get_dec(void) -{ - unsigned long val; - - asm volatile("mfdec %0" : "=r" (val) :); - return val; -} - - -static __inline__ void -set_dec(unsigned long val) -{ - asm volatile("mtdec %0" : : "r" (val)); -} - - -void -enable_interrupts(void) -{ - set_msr (get_msr() | MSR_EE); -} - -/* returns flag if MSR_EE was set before */ -int -disable_interrupts(void) -{ - ulong msr = get_msr(); - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - -/****************************************************************************/ - -int interrupt_init(void) +int interrupt_init_cpu (unsigned *decrementer_count) { #if defined(DEBUG) && !defined(CONFIG_AMIGAONEG3SE) printf("interrupt_init: GT main cause reg: %08x:%08x\n", @@ -103,22 +48,8 @@ int interrupt_init(void) GTREGREAD(ETHERNET2_INTERRUPT_MASK_REGISTER)); puts("interrupt_init: setting decrementer_count\n"); #endif - decrementer_count = get_tbclk() / CFG_HZ; + *decrementer_count = get_tbclk() / CFG_HZ; -#ifdef DEBUG - puts("interrupt_init: setting actual decremter\n"); -#endif - set_dec (get_tbclk() / CFG_HZ); - -#ifdef DEBUG - printf("interrupt_init: enabling interrupts (msr = %08lx)\n", - get_msr()); -#endif - set_msr (get_msr() | MSR_EE); - -#ifdef DEBUG - printf("interrupt_init: done. (msr = %08lx)\n", get_msr()); -#endif return (0); } @@ -141,40 +72,10 @@ volatile ulong timestamp = 0; * Trivial implementation - no need to be really accurate. */ void -timer_interrupt(struct pt_regs *regs) -{ - set_dec(decrementer_count); - timestamp++; - -#if defined(CONFIG_WATCHDOG) - if ((timestamp % (CFG_HZ / 2)) == 0) { -#if defined(CONFIG_PCIPPC2) - extern void pcippc2_wdt_reset (void); - - pcippc2_wdt_reset(); -#endif - } -#endif /* CONFIG_WATCHDOG */ -} - -/****************************************************************************/ - -void -reset_timer(void) -{ - timestamp = 0; -} - -ulong -get_timer(ulong base) -{ - return (timestamp - base); -} - -void -set_timer(ulong t) +timer_interrupt_cpu (struct pt_regs *regs) { - timestamp = t; + /* nothing to do here */ + return; } /****************************************************************************/ diff --git a/cpu/arm720t/cpu.c b/cpu/arm720t/cpu.c index 7521fbaf5fcf731dab6209e923bf41623551520f..b6fcef9b435e34432a61d01fe7e40b6434da2008 100644 --- a/cpu/arm720t/cpu.c +++ b/cpu/arm720t/cpu.c @@ -82,18 +82,15 @@ static void cp_delay (void) int cpu_init (void) { /* - * setup up stack if necessary + * setup up stacks if necessary */ #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + \ - CONFIG_STACKSIZE + \ - CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; #endif - return (0); + return 0; } int cleanup_before_linux (void) diff --git a/cpu/arm720t/start.S b/cpu/arm720t/start.S index fdedc915fb5822481f59481343e142a936bac01a..8ddb0c9264d1520cce033ae882fabfc4233acb67 100644 --- a/cpu/arm720t/start.S +++ b/cpu/arm720t/start.S @@ -90,14 +90,6 @@ _armboot_end_data: _armboot_end: .word armboot_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -132,32 +124,32 @@ reset: bl cpu_init_crit #endif -relocate: - /* - * relocate armboot to RAM - */ - adr r0, _start /* r0 <- current position of code */ +relocate: /* relocate U-Boot to RAM */ + adr r0, _start /* r0 <- current position of code */ + ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ + cmp r0, r1 /* don't reloc during debug */ + beq stack_setup + ldr r2, _armboot_start ldr r3, _armboot_end - sub r2, r3, r2 /* r2 <- size of armboot */ - ldr r1, _TEXT_BASE /* r1 <- destination address */ - add r2, r0, r2 /* r2 <- source end address */ + sub r2, r3, r2 /* r2 <- size of armboot */ + add r2, r0, r2 /* r2 <- source end address */ - /* - * r0 = source address - * r1 = target address - * r2 = source end address - */ copy_loop: - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - cmp r0, r2 + ldmia r0!, {r3-r10} /* copy from source address [r0] */ + stmia r1!, {r3-r10} /* copy to target address [r1] */ + cmp r0, r2 /* until source end addreee [r2] */ ble copy_loop - /* set up the stack */ - ldr r0, _armboot_end - add r0, r0, #CONFIG_STACKSIZE - sub sp, r0, #12 /* leave 3 words for abort-stack */ + /* Set up the stack */ +stack_setup: + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif + sub sp, r0, #12 /* leave 3 words for abort-stack */ ldr pc, _start_armboot diff --git a/cpu/arm920t/cpu.c b/cpu/arm920t/cpu.c index 41cebdfd94b3710557680ab8faf67c9437b95576..e638c1f8ddee29bdc35fa597b2daa7611f03bb11 100644 --- a/cpu/arm920t/cpu.c +++ b/cpu/arm920t/cpu.c @@ -87,17 +87,15 @@ static void cp_delay (void) int cpu_init (void) { /* - * setup up stack if necessary + * setup up stacks if necessary */ #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + - CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; -#endif /* CONFIG_USE_IRQ */ - return (0); + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; +#endif + return 0; } int cleanup_before_linux (void) diff --git a/cpu/arm920t/start.S b/cpu/arm920t/start.S index 17c5f86bc367ebb572d36253f92f64dd00b96760..d640942d8aaaec53744038eef137125a54e74c94 100644 --- a/cpu/arm920t/start.S +++ b/cpu/arm920t/start.S @@ -91,14 +91,6 @@ _armboot_end_data: _armboot_end: .word armboot_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -171,28 +163,33 @@ reset: bl cpu_init_crit #endif -relocate: - /* - * relocate armboot to RAM - */ - adr r0, _start /* r0 <- current position of code */ +relocate: /* relocate U-Boot to RAM */ + adr r0, _start /* r0 <- current position of code */ + ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ + cmp r0, r1 /* don't reloc during debug */ + beq stack_setup + ldr r2, _armboot_start ldr r3, _armboot_end - sub r2, r3, r2 /* r2 <- size of armboot */ - ldr r1, _TEXT_BASE /* r1 <- destination address */ - add r2, r0, r2 /* r2 <- source end address */ + sub r2, r3, r2 /* r2 <- size of armboot */ + add r2, r0, r2 /* r2 <- source end address */ - /* - * r0 = source address - * r1 = target address - * r2 = source end address - */ copy_loop: - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - cmp r0, r2 + ldmia r0!, {r3-r10} /* copy from source address [r0] */ + stmia r1!, {r3-r10} /* copy to target address [r1] */ + cmp r0, r2 /* until source end addreee [r2] */ ble copy_loop + /* Set up the stack */ +stack_setup: + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif + sub sp, r0, #12 /* leave 3 words for abort-stack */ + #if 0 /* try doing this stuff after the relocation */ ldr r0, =pWTCON @@ -214,11 +211,6 @@ copy_loop: /* END stuff after relocation */ #endif - /* set up the stack */ - ldr r0, _armboot_end - add r0, r0, #CONFIG_STACKSIZE - sub sp, r0, #12 /* leave 3 words for abort-stack */ - ldr pc, _start_armboot _start_armboot: .word start_armboot diff --git a/cpu/arm925t/cpu.c b/cpu/arm925t/cpu.c index c55fbc7959f46a4a00a6b324f8c75888b5bc92c1..6bac53da824e6a12c6b7a8c402e9ede56741778e 100644 --- a/cpu/arm925t/cpu.c +++ b/cpu/arm925t/cpu.c @@ -88,17 +88,15 @@ static void cp_delay (void) int cpu_init (void) { /* - * setup up stack if necessary + * setup up stacks if necessary */ #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + - CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; -#endif /* CONFIG_USE_IRQ */ - return (0); + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; +#endif + return 0; } int cleanup_before_linux (void) diff --git a/cpu/arm925t/start.S b/cpu/arm925t/start.S index 6dd3012055986883c382e913447e25a704598031..0a3042d9a650a92277c1840ecef2605bf0d9f53c 100644 --- a/cpu/arm925t/start.S +++ b/cpu/arm925t/start.S @@ -100,14 +100,6 @@ _armboot_end_data: _armboot_end: .word armboot_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -168,34 +160,41 @@ poll1: ldrh r1, [r0] ands r1, r1, #0x01 beq poll1 - bl cpu_init_crit -relocate: /* - * relocate armboot to RAM + * we do sys-critical inits only at reboot, + * not when booting from ram! */ - adr r0, _start /* r0 <- current position of code */ +#ifdef CONFIG_INIT_CRITICAL + bl cpu_init_crit +#endif + +relocate: /* relocate U-Boot to RAM */ + adr r0, _start /* r0 <- current position of code */ + ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ + cmp r0, r1 /* don't reloc during debug */ + beq stack_setup + ldr r2, _armboot_start ldr r3, _armboot_end - sub r2, r3, r2 /* r2 <- size of armboot */ - ldr r1, _TEXT_BASE /* r1 <- destination address */ - add r2, r0, r2 /* r2 <- source end address */ + sub r2, r3, r2 /* r2 <- size of armboot */ + add r2, r0, r2 /* r2 <- source end address */ - /* - * r0 = source address - * r1 = target address - * r2 = source end address - */ copy_loop: - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - cmp r0, r2 + ldmia r0!, {r3-r10} /* copy from source address [r0] */ + stmia r1!, {r3-r10} /* copy to target address [r1] */ + cmp r0, r2 /* until source end addreee [r2] */ ble copy_loop - /* set up the stack */ - ldr r0, _armboot_end - add r0, r0, #CONFIG_STACKSIZE - sub sp, r0, #12 /* leave 3 words for abort-stack */ + /* Set up the stack */ +stack_setup: + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif + sub sp, r0, #12 /* leave 3 words for abort-stack */ ldr pc, _start_armboot diff --git a/cpu/arm926ejs/cpu.c b/cpu/arm926ejs/cpu.c index a91aa3782858335b5b52290399875e4512563a42..748a21a416e395a537badbbdf549168f43535f81 100644 --- a/cpu/arm926ejs/cpu.c +++ b/cpu/arm926ejs/cpu.c @@ -88,17 +88,15 @@ static void cp_delay (void) int cpu_init (void) { /* - * setup up stack if necessary + * setup up stacks if necessary */ #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + - CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; -#endif /* CONFIG_USE_IRQ */ - return (0); + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; +#endif + return 0; } int cleanup_before_linux (void) diff --git a/cpu/arm926ejs/start.S b/cpu/arm926ejs/start.S index b860fd408ee2de1a9639c74299bf590738c54583..39d7409b030a323e9a38e9fcb70fe9a9e6d9e39a 100644 --- a/cpu/arm926ejs/start.S +++ b/cpu/arm926ejs/start.S @@ -108,14 +108,6 @@ _armboot_end_data: _armboot_end: .word armboot_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -162,34 +154,41 @@ reset: str r1, [r0] ldr r0, =REG_IHL2_MIR str r1, [r0] - bl cpu_init_crit -relocate: /* - * relocate armboot to RAM + * we do sys-critical inits only at reboot, + * not when booting from ram! */ - adr r0, _start /* r0 <- current position of code */ +#ifdef CONFIG_INIT_CRITICAL + bl cpu_init_crit +#endif + +relocate: /* relocate U-Boot to RAM */ + adr r0, _start /* r0 <- current position of code */ + ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ + cmp r0, r1 /* don't reloc during debug */ + beq stack_setup + ldr r2, _armboot_start ldr r3, _armboot_end - sub r2, r3, r2 /* r2 <- size of armboot */ - ldr r1, _TEXT_BASE /* r1 <- destination address */ - add r2, r0, r2 /* r2 <- source end address */ + sub r2, r3, r2 /* r2 <- size of armboot */ + add r2, r0, r2 /* r2 <- source end address */ - /* - * r0 = source address - * r1 = target address - * r2 = source end address - */ copy_loop: - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - cmp r0, r2 + ldmia r0!, {r3-r10} /* copy from source address [r0] */ + stmia r1!, {r3-r10} /* copy to target address [r1] */ + cmp r0, r2 /* until source end addreee [r2] */ ble copy_loop - /* set up the stack */ - ldr r0, _armboot_end - add r0, r0, #CONFIG_STACKSIZE - sub sp, r0, #12 /* leave 3 words for abort-stack */ + /* Set up the stack */ +stack_setup: + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif + sub sp, r0, #12 /* leave 3 words for abort-stack */ ldr pc, _start_armboot diff --git a/cpu/at91rm9200/cpu.c b/cpu/at91rm9200/cpu.c index 262ca340e12d90ed5d8a34ca52f6041e4efcf762..b0cfcefeca552aa9734021c2bb9178ceee7ff47a 100644 --- a/cpu/at91rm9200/cpu.c +++ b/cpu/at91rm9200/cpu.c @@ -81,18 +81,16 @@ static void cp_delay(void) int cpu_init(void) { - /* - * setup up stack if necessary - */ + /* + * setup up stacks if necessary + */ #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + - CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; #endif - return 0; + return 0; } int cleanup_before_linux(void) diff --git a/cpu/at91rm9200/start.S b/cpu/at91rm9200/start.S index 9fa1461d2d895ba8c60ed07c96a9ec7d4ceedb6c..a93d0454d6d19b2bc287bbcded38090a00a4b40e 100644 --- a/cpu/at91rm9200/start.S +++ b/cpu/at91rm9200/start.S @@ -93,14 +93,6 @@ _armboot_end_data: _armboot_end: .word armboot_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -147,10 +139,16 @@ copyex: bl cpu_init_crit #endif - /* set up the stack */ - ldr r0, _armboot_end - add r0, r0, #CONFIG_STACKSIZE - sub sp, r0, #12 /* leave 3 words for abort-stack */ + /* Set up the stack */ +stack_setup: + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif + sub sp, r0, #12 /* leave 3 words for abort-stack */ + ldr pc,_start_armboot _start_armboot: .word start_armboot diff --git a/cpu/mpc5xx/interrupts.c b/cpu/mpc5xx/interrupts.c index 461868000077d288894d112b4c6e8246d83d91dd..3678b5bfc8d7092e33a98f98dc7afd87ade0807c 100644 --- a/cpu/mpc5xx/interrupts.c +++ b/cpu/mpc5xx/interrupts.c @@ -28,16 +28,9 @@ */ #include -#include #include #include -/************************************************************************/ - -unsigned decrementer_count; /* count value for 1e6/HZ microseconds */ - -/************************************************************************/ - struct interrupt_action { interrupt_handler_t *handler; void *arg; @@ -45,74 +38,20 @@ struct interrupt_action { static struct interrupt_action irq_vecs[NR_IRQS]; -/* - * Local function prototypes - */ -static __inline__ unsigned long get_msr (void) -{ - unsigned long msr; - - asm volatile ("mfmsr %0":"=r" (msr):); - - return msr; -} - -static __inline__ void set_msr (unsigned long msr) -{ - asm volatile ("mtmsr %0"::"r" (msr)); -} - -static __inline__ unsigned long get_dec (void) -{ - unsigned long val; - - asm volatile ("mfdec %0":"=r" (val):); - - return val; -} - - -static __inline__ void set_dec (unsigned long val) -{ - asm volatile ("mtdec %0"::"r" (val)); -} - -/* - * Enable interrupts - */ -void enable_interrupts (void) -{ - set_msr (get_msr () | MSR_EE); -} - -/* - * Returns flag if MSR_EE was set before - */ -int disable_interrupts (void) -{ - ulong msr = get_msr (); - - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - /* * Initialise interrupts */ -int interrupt_init (void) +int interrupt_init_cpu (ulong *decrementer_count) { volatile immap_t *immr = (immap_t *) CFG_IMMR; /* Decrementer used here for status led */ - decrementer_count = get_tbclk () / CFG_HZ; + *decrementer_count = get_tbclk () / CFG_HZ; /* Disable all interrupts */ immr->im_siu_conf.sc_simask = 0; - set_dec (decrementer_count); - - set_msr (get_msr () | MSR_EE); return (0); } @@ -206,19 +145,14 @@ void irq_free_handler (int vec) irq_vecs[vec].arg = NULL; } -volatile ulong timestamp = 0; - /* * Timer interrupt - gets called when bit 0 of DEC changes from * 0. Decrementer is enabled with bit TBE in TBSCR. */ -void timer_interrupt (struct pt_regs *regs) +void timer_interrupt_cpu (struct pt_regs *regs) { volatile immap_t *immr = (immap_t *) CFG_IMMR; -#ifdef CONFIG_STATUS_LED - extern void status_led_tick (ulong); -#endif #if 0 printf ("*** Timer Interrupt *** "); #endif @@ -227,47 +161,5 @@ void timer_interrupt (struct pt_regs *regs) __asm__ ("nop"); immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS | PLPRCR_TMIST; - /* Restore Decrementer Count */ - set_dec (decrementer_count); - - timestamp++; - -#ifdef CONFIG_STATUS_LED - status_led_tick (timestamp); -#endif /* CONFIG_STATUS_LED */ - -#if defined(CONFIG_WATCHDOG) - /* - * The shortest watchdog period of all boards - * is approx. 1 sec, thus re-trigger watchdog at least - * every 500 ms = CFG_HZ / 2 - */ - if ((timestamp % (CFG_HZ / 2)) == 0) { - reset_5xx_watchdog (immr); - } -#endif /* CONFIG_WATCHDOG */ -} - -/* - * Reset timer - */ -void reset_timer (void) -{ - timestamp = 0; -} - -/* - * Get Timer - */ -ulong get_timer (ulong base) -{ - return (timestamp - base); -} - -/* - * Set timer - */ -void set_timer (ulong t) -{ - timestamp = t; + return; } diff --git a/cpu/mpc5xxx/interrupts.c b/cpu/mpc5xxx/interrupts.c index 5aa43880bb7ae5ff4e5177eaf3b6741d6bb4b4de..7bacecd595b3561a93a9beb4d0429ca828f13eff 100644 --- a/cpu/mpc5xxx/interrupts.c +++ b/cpu/mpc5xxx/interrupts.c @@ -32,79 +32,10 @@ #include #include -/****************************************************************************/ - -unsigned decrementer_count; /* count value for 1e6/HZ microseconds */ - -/****************************************************************************/ - -static __inline__ unsigned long -get_msr(void) -{ - unsigned long msr; - - asm volatile("mfmsr %0" : "=r" (msr) :); - return msr; -} - -static __inline__ void -set_msr(unsigned long msr) -{ - asm volatile("mtmsr %0" : : "r" (msr)); -} - -static __inline__ unsigned long -get_dec(void) -{ - unsigned long val; - - asm volatile("mfdec %0" : "=r" (val) :); - return val; -} - - -static __inline__ void -set_dec(unsigned long val) -{ - asm volatile("mtdec %0" : : "r" (val)); -} - - -void -enable_interrupts(void) -{ - set_msr (get_msr() | MSR_EE); -} - -/* returns flag if MSR_EE was set before */ -int -disable_interrupts(void) -{ - ulong msr = get_msr(); - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - -/****************************************************************************/ - -int interrupt_init(void) +int interrupt_init_cpu (ulong *decrementer_count) { - decrementer_count = get_tbclk() / CFG_HZ; + *decrementer_count = get_tbclk() / CFG_HZ; -#ifdef DEBUG - puts("interrupt_init: setting actual decremter\n"); -#endif - set_dec (get_tbclk() / CFG_HZ); - -#ifdef DEBUG - printf("interrupt_init: enabling interrupts (msr = %08lx)\n", - get_msr()); -#endif - set_msr (get_msr() | MSR_EE); - -#ifdef DEBUG - printf("interrupt_init: done. (msr = %08lx)\n", get_msr()); -#endif return (0); } @@ -119,38 +50,11 @@ external_interrupt(struct pt_regs *regs) puts("external_interrupt (oops!)\n"); } -volatile ulong timestamp = 0; - -/* - * timer_interrupt - gets called when the decrementer overflows, - * with interrupts disabled. - * Trivial implementation - no need to be really accurate. - */ -void -timer_interrupt(struct pt_regs *regs) -{ - set_dec(decrementer_count); - timestamp++; -} - -/****************************************************************************/ - -void -reset_timer(void) -{ - timestamp = 0; -} - -ulong -get_timer(ulong base) -{ - return (timestamp - base); -} - void -set_timer(ulong t) +timer_interrupt_cpu (struct pt_regs *regs) { - timestamp = t; + /* nothing to do here */ + return; } /****************************************************************************/ diff --git a/cpu/mpc824x/interrupts.c b/cpu/mpc824x/interrupts.c index 825857b05482af6465bb37c9b720bafc2f37b47e..acb8947e0d8a9c6acbd69c62113c8834181f9537 100644 --- a/cpu/mpc824x/interrupts.c +++ b/cpu/mpc824x/interrupts.c @@ -27,62 +27,11 @@ #include #include #include -#include #include "drivers/epic.h" -/****************************************************************************/ - -unsigned decrementer_count; /* count val for 1e6/HZ microseconds */ - -static __inline__ unsigned long get_msr (void) -{ - unsigned long msr; - - asm volatile ("mfmsr %0":"=r" (msr):); - - return msr; -} - -static __inline__ void set_msr (unsigned long msr) -{ - asm volatile ("mtmsr %0"::"r" (msr)); -} - -static __inline__ unsigned long get_dec (void) -{ - unsigned long val; - - asm volatile ("mfdec %0":"=r" (val):); - - return val; -} - - -static __inline__ void set_dec (unsigned long val) -{ - asm volatile ("mtdec %0"::"r" (val)); -} - - -void enable_interrupts (void) +int interrupt_init_cpu (unsigned *decrementer_count) { - set_msr (get_msr () | MSR_EE); -} - -/* returns flag if MSR_EE was set before */ -int disable_interrupts (void) -{ - ulong msr = get_msr (); - - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - -/****************************************************************************/ - -int interrupt_init (void) -{ - decrementer_count = (get_bus_freq (0) / 4) / CFG_HZ; + *decrementer_count = (get_bus_freq (0) / 4) / CFG_HZ; /* * It's all broken at the moment and I currently don't need @@ -96,10 +45,6 @@ int interrupt_init (void) /* EPIC won't generate INT unless Current Task Pri < 15 */ epicCurTaskPrioSet(0); - set_dec (decrementer_count); - - set_msr (get_msr () | MSR_EE); - return (0); } @@ -141,42 +86,8 @@ void irq_free_handler (int vec) vga? */ -volatile ulong timestamp = 0; - -void timer_interrupt (struct pt_regs *regs) -{ - /* Restore Decrementer Count */ - set_dec (decrementer_count); - - timestamp++; - -#if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG) - if ((timestamp % (CFG_HZ / 2)) == 0) { - WATCHDOG_RESET (); - } -#endif /* CONFIG_WATCHDOG */ -#if defined(CONFIG_SHOW_ACTIVITY) && defined(CONFIG_OXC) - if ((timestamp % (CFG_HZ / 10)) == 0) { - { - extern void oxc_toggle_activeled (void); - - oxc_toggle_activeled (); - } - } -#endif -} - -void reset_timer (void) -{ - timestamp = 0; -} - -ulong get_timer (ulong base) -{ - return (timestamp - base); -} - -void set_timer (ulong t) +void timer_interrupt_cpu (struct pt_regs *regs, ulong timestamp) { - timestamp = t; + /* nothing to do here */ + return; } diff --git a/cpu/mpc8260/interrupts.c b/cpu/mpc8260/interrupts.c index 3c5ef7460ebdc7a1ca074c172db13453e6137fa5..e2a6c977821df219f303c949814ef638cfbc5eaa 100644 --- a/cpu/mpc8260/interrupts.c +++ b/cpu/mpc8260/interrupts.c @@ -24,19 +24,13 @@ */ #include -#include #include #include #include #include -#ifdef CONFIG_STATUS_LED -#include -#endif /****************************************************************************/ -unsigned decrementer_count; /* count val for 1e6/HZ microseconds */ - struct irq_action { interrupt_handler_t *handler; void *arg; @@ -144,57 +138,13 @@ static int m8260_get_irq (struct pt_regs *regs) /* end of code ripped out of arch/ppc/kernel/ppc8260_pic.c */ /****************************************************************************/ -static __inline__ unsigned long get_msr (void) -{ - unsigned long msr; - - __asm__ __volatile__ ("mfmsr %0":"=r" (msr):); - - return msr; -} - -static __inline__ void set_msr (unsigned long msr) -{ - __asm__ __volatile__ ("mtmsr %0;sync;isync"::"r" (msr)); -} - -static __inline__ unsigned long get_dec (void) -{ - unsigned long val; - - __asm__ __volatile__ ("mfdec %0":"=r" (val):); - - return val; -} - -static __inline__ void set_dec (unsigned long val) -{ - __asm__ __volatile__ ("mtdec %0"::"r" (val)); -} - -void enable_interrupts (void) -{ - set_msr (get_msr () | MSR_EE); -} - -/* returns flag if MSR_EE was set before */ -int disable_interrupts (void) -{ - ulong msr = get_msr (); - - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - -/****************************************************************************/ - -int interrupt_init (void) +int interrupt_init_cpu (unsigned *decrementer_count) { DECLARE_GLOBAL_DATA_PTR; volatile immap_t *immr = (immap_t *) CFG_IMMR; - decrementer_count = (gd->bus_clk / 4) / CFG_HZ; + *decrementer_count = (gd->bus_clk / 4) / CFG_HZ; /* Initialize the default interrupt mapping priorities */ immr->im_intctl.ic_sicr = 0; @@ -216,10 +166,6 @@ int interrupt_init (void) immr->im_intctl.ic_siexr = -1; #endif - set_dec (decrementer_count); - - set_msr (get_msr () | MSR_EE); - return (0); } @@ -236,7 +182,7 @@ void external_interrupt (struct pt_regs *regs) m8260_mask_and_ack (irq); - set_msr (get_msr () | MSR_EE); + enable_interrupts (); if (irq_handlers[irq].handler != NULL) (*irq_handlers[irq].handler) (irq_handlers[irq].arg); @@ -292,75 +238,10 @@ void irq_free_handler (int irq) /****************************************************************************/ -volatile ulong timestamp = 0; - -/* - * timer_interrupt - gets called when the decrementer overflows, - * with interrupts disabled. - * Trivial implementation - no need to be really accurate. - */ -void timer_interrupt (struct pt_regs *regs) -{ -#if defined(CONFIG_WATCHDOG) || defined(CFG_HYMOD_DBLEDS) - volatile immap_t *immr = (immap_t *) CFG_IMMR; -#endif /* CONFIG_WATCHDOG */ - - /* Restore Decrementer Count */ - set_dec (decrementer_count); - - timestamp++; - -#if defined(CONFIG_WATCHDOG) || \ - defined(CFG_CMA_LCD_HEARTBEAT) || \ - defined(CFG_HYMOD_DBLEDS) - - if ((timestamp % CFG_HZ) == 0) { -#if defined(CFG_CMA_LCD_HEARTBEAT) - extern void lcd_heartbeat (void); -#endif /* CFG_CMA_LCD_HEARTBEAT */ -#if defined(CFG_HYMOD_DBLEDS) - volatile iop8260_t *iop = &immr->im_ioport; - static int shift = 0; -#endif /* CFG_HYMOD_DBLEDS */ - -#if defined(CFG_CMA_LCD_HEARTBEAT) - lcd_heartbeat (); -#endif /* CFG_CMA_LCD_HEARTBEAT */ - -#if defined(CONFIG_WATCHDOG) - reset_8260_watchdog (immr); -#endif /* CONFIG_WATCHDOG */ - -#if defined(CFG_HYMOD_DBLEDS) - /* hymod daughter board LEDs */ - if (++shift > 3) - shift = 0; - iop->iop_pdatd = - (iop->iop_pdatd & ~0x0f000000) | (1 << (24 + shift)); -#endif /* CFG_HYMOD_DBLEDS */ - } -#endif /* CONFIG_WATCHDOG || CFG_CMA_LCD_HEARTBEAT */ - -#ifdef CONFIG_STATUS_LED - status_led_tick (timestamp); -#endif /* CONFIG_STATUS_LED */ -} - -/****************************************************************************/ - -void reset_timer (void) -{ - timestamp = 0; -} - -ulong get_timer (ulong base) -{ - return (timestamp - base); -} - -void set_timer (ulong t) +void timer_interrupt_cpu (struct pt_regs *regs) { - timestamp = t; + /* nothing to do here */ + return; } /****************************************************************************/ diff --git a/cpu/mpc8xx/interrupts.c b/cpu/mpc8xx/interrupts.c index 8bc0a1afdea3dd0b9c9601ac3e92b66c49f27bbf..558dc09c078de5969b12c63d357760188c0c05f3 100644 --- a/cpu/mpc8xx/interrupts.c +++ b/cpu/mpc8xx/interrupts.c @@ -22,7 +22,6 @@ */ #include -#include #include #include #include @@ -30,10 +29,6 @@ /************************************************************************/ -unsigned decrementer_count; /* count value for 1e6/HZ microseconds */ - -/************************************************************************/ - /* * CPM interrupt vector functions. */ @@ -50,57 +45,11 @@ static void cpm_interrupt (void *regs); /************************************************************************/ -static __inline__ unsigned long get_msr (void) -{ - unsigned long msr; - - asm volatile ("mfmsr %0":"=r" (msr):); - - return msr; -} - -static __inline__ void set_msr (unsigned long msr) -{ - asm volatile ("mtmsr %0"::"r" (msr)); -} - -static __inline__ unsigned long get_dec (void) -{ - unsigned long val; - - asm volatile ("mfdec %0":"=r" (val):); - - return val; -} - - -static __inline__ void set_dec (unsigned long val) -{ - asm volatile ("mtdec %0"::"r" (val)); -} - - -void enable_interrupts (void) -{ - set_msr (get_msr () | MSR_EE); -} - -/* returns flag if MSR_EE was set before */ -int disable_interrupts (void) -{ - ulong msr = get_msr (); - - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - -/************************************************************************/ - -int interrupt_init (void) +int interrupt_init_cpu (unsigned *decrementer_count) { volatile immap_t *immr = (immap_t *) CFG_IMMR; - decrementer_count = get_tbclk () / CFG_HZ; + *decrementer_count = get_tbclk () / CFG_HZ; /* disable all interrupts */ immr->im_siu_conf.sc_simask = 0; @@ -108,10 +57,6 @@ int interrupt_init (void) /* Configure CPM interrupts */ cpm_interrupt_init (); - set_dec (decrementer_count); - - set_msr (get_msr () | MSR_EE); - return (0); } @@ -314,20 +259,15 @@ static void cpm_interrupt_init (void) /************************************************************************/ -volatile ulong timestamp = 0; - /* * timer_interrupt - gets called when the decrementer overflows, * with interrupts disabled. * Trivial implementation - no need to be really accurate. */ -void timer_interrupt (struct pt_regs *regs) +void timer_interrupt_cpu (struct pt_regs *regs) { volatile immap_t *immr = (immap_t *) CFG_IMMR; -#ifdef CONFIG_STATUS_LED - extern void status_led_tick (ulong); -#endif #if 0 printf ("*** Timer Interrupt *** "); #endif @@ -339,57 +279,6 @@ void timer_interrupt (struct pt_regs *regs) #else immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS | PLPRCR_TMIST; #endif - /* Restore Decrementer Count */ - set_dec (decrementer_count); - - timestamp++; - -#ifdef CONFIG_STATUS_LED - status_led_tick (timestamp); -#endif /* CONFIG_STATUS_LED */ - -#if defined(CONFIG_WATCHDOG) || defined(CFG_CMA_LCD_HEARTBEAT) - - /* - * The shortest watchdog period of all boards (except LWMON) - * is approx. 1 sec, thus re-trigger watchdog at least - * every 500 ms = CFG_HZ / 2 - */ -#ifndef CONFIG_LWMON - if ((timestamp % (CFG_HZ / 2)) == 0) { -#else - if ((timestamp % (CFG_HZ / 20)) == 0) { -#endif - -#if defined(CFG_CMA_LCD_HEARTBEAT) - extern void lcd_heartbeat (void); - - lcd_heartbeat (); -#endif /* CFG_CMA_LCD_HEARTBEAT */ - -#if defined(CONFIG_WATCHDOG) - reset_8xx_watchdog (immr); -#endif /* CONFIG_WATCHDOG */ - - } -#endif /* CONFIG_WATCHDOG || CFG_CMA_LCD_HEARTBEAT */ -} - -/************************************************************************/ - -void reset_timer (void) -{ - timestamp = 0; -} - -ulong get_timer (ulong base) -{ - return (timestamp - base); -} - -void set_timer (ulong t) -{ - timestamp = t; } /************************************************************************/ diff --git a/cpu/ppc4xx/405gp_enet.c b/cpu/ppc4xx/405gp_enet.c index c222c719e8d72c88d249052df964638bec73f5d6..a9c7cfe0506731d80c2e694e47520fb3737e31aa 100644 --- a/cpu/ppc4xx/405gp_enet.c +++ b/cpu/ppc4xx/405gp_enet.c @@ -159,7 +159,7 @@ static int tx_i_index = 0; /* Transmit Interrupt Queue Index */ static int tx_u_index = 0; /* Transmit User Queue Index */ static int tx_run[NUM_TX_BUFF]; /* Transmit Running Queue */ -#undef INFO_405_ENET 1 +#undef INFO_405_ENET #ifdef INFO_405_ENET static int packetSent = 0; static int packetReceived = 0; diff --git a/cpu/ppc4xx/interrupts.c b/cpu/ppc4xx/interrupts.c index b6a956c152ced8f08e4b2e7f95e525d014bb5cb4..1a9ae9d7d1f559ab5dddc0e9b1efed3bf5526aea 100644 --- a/cpu/ppc4xx/interrupts.c +++ b/cpu/ppc4xx/interrupts.c @@ -35,10 +35,6 @@ /****************************************************************************/ -unsigned decrementer_count; /* count value for 1e6/HZ microseconds */ - -/****************************************************************************/ - /* * CPM interrupt vector functions. */ @@ -57,20 +53,6 @@ void uic1_interrupt( void * parms); /* UIC1 handler */ #endif /****************************************************************************/ - -static __inline__ unsigned long get_msr(void) -{ - unsigned long msr; - - asm volatile("mfmsr %0" : "=r" (msr) :); - return msr; -} - -static __inline__ void set_msr(unsigned long msr) -{ - asm volatile("mtmsr %0" : : "r" (msr)); -} - #if defined(CONFIG_440) /* SPRN changed in 440 */ @@ -81,21 +63,6 @@ static __inline__ void set_evpr(unsigned long val) #else /* !defined(CONFIG_440) */ -static __inline__ unsigned long get_dec(void) -{ - unsigned long val; - - asm volatile("mfdec %0" : "=r" (val) :); - return val; -} - - -static __inline__ void set_dec(unsigned long val) -{ - asm volatile("mtdec %0" : : "r" (val)); -} - - static __inline__ void set_pit(unsigned long val) { asm volatile("mtpit %0" : : "r" (val)); @@ -114,29 +81,18 @@ static __inline__ void set_evpr(unsigned long val) } #endif /* defined(CONFIG_440 */ - -void enable_interrupts (void) -{ - set_msr (get_msr() | MSR_EE); -} - -/* returns flag if MSR_EE was set before */ -int disable_interrupts (void) -{ - ulong msr = get_msr(); - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - /****************************************************************************/ -int interrupt_init(void) +int interrupt_init_cpu (unsigned *decrementer_count) { DECLARE_GLOBAL_DATA_PTR; int vec; unsigned long val; + /* decrementer is automatically reloaded */ + *decrementer_count = 0; + /* * Mark all irqs as free */ @@ -194,10 +150,6 @@ int interrupt_init(void) irq_install_handler(VECNUM_UIC1NC, uic1_interrupt, 0); irq_install_handler(VECNUM_UIC1C, uic1_interrupt, 0); #endif - /* - * Enable external interrupts (including PIT) - */ - set_msr (get_msr() | MSR_EE); return (0); } @@ -362,47 +314,14 @@ irq_free_handler(int vec) /****************************************************************************/ - -volatile ulong timestamp = 0; - -/* - * timer_interrupt - gets called when the decrementer overflows, - * with interrupts disabled. - * Trivial implementation - no need to be really accurate. - */ -void timer_interrupt(struct pt_regs *regs) -{ -#if 0 - printf ("*** Timer Interrupt *** "); -#endif - timestamp++; - -#if defined(CONFIG_WATCHDOG) - if ((timestamp % 1000) == 0) - reset_4xx_watchdog(); -#endif /* CONFIG_WATCHDOG */ -} - -/****************************************************************************/ - -void reset_timer (void) -{ - timestamp = 0; -} - -ulong get_timer (ulong base) -{ - return (timestamp - base); -} - -void set_timer (ulong t) +void timer_interrupt_cpu (struct pt_regs *regs) { - timestamp = t; + /* nothing to do here */ + return; } /****************************************************************************/ - #if (CONFIG_COMMANDS & CFG_CMD_IRQ) /******************************************************************************* diff --git a/cpu/pxa/cpu.c b/cpu/pxa/cpu.c index 6b82f04f7d716fffcff07eebde526cc77f92ab27..32ec4f692acb9c939d613a5775e4eef66846118d 100644 --- a/cpu/pxa/cpu.c +++ b/cpu/pxa/cpu.c @@ -37,22 +37,15 @@ int cpu_init (void) { /* - * setup up stack if necessary + * setup up stacks if necessary */ -/* - - FIXME: the stack is _below_ the uboot code!! - #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + - CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; #endif -*/ - return (0); + return 0; } int cleanup_before_linux (void) diff --git a/cpu/pxa/start.S b/cpu/pxa/start.S index a4254492659eec71e92b8a8b222fe0135b1381f1..d41b414774dd251dddc0acf4aaaedc28025952ce 100644 --- a/cpu/pxa/start.S +++ b/cpu/pxa/start.S @@ -4,10 +4,10 @@ * Copyright (C) 1998 Dan Malek * Copyright (C) 1999 Magnus Damm * Copyright (C) 2000 Wolfgang Denk - * Copyright (C) 2001 Alex Züpke + * Copyright (C) 2001 Alex Zuepke * Copyright (C) 2002 Kyle Harris * Copyright (C) 2003 Robert Schwebel - * Copyright (C) 2003 Kai-Uwe Bloehm + * Copyright (C) 2003 Kai-Uwe Bloem * * See file CREDITS for list of people who contributed to this * project. @@ -55,7 +55,7 @@ _fiq: .word fiq /* * Startup Code (reset vector) * - * do important init only if we don't start from memory! + * do important init only if we don't start from RAM! * - relocate armboot to ram * - setup stack * - jump to second stage @@ -91,21 +91,6 @@ _bss_start: _bss_end: .word bss_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - -/* - * We relocate uboot to this address (end of RAM - 128 KiB) - */ -.globl _uboot_reloc -_uboot_reloc: - .word TEXT_BASE - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -131,7 +116,13 @@ reset: orr r0,r0,#0x13 msr cpsr,r0 + /* + * we do sys-critical inits only at reboot, + * not when booting from ram! + */ +#ifdef CONFIG_INIT_CRITICAL bl cpu_init_crit /* we do sys-critical inits */ +#endif relocate: /* relocate U-Boot to RAM */ adr r0, _start /* r0 <- current position of code */ @@ -151,12 +142,13 @@ copy_loop: ble copy_loop /* Set up the stack */ - stack_setup: - - ldr r0, _uboot_reloc /* upper 128 KiB: relocated uboot */ - sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ - /* FIXME: bdinfo should be here */ + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif sub sp, r0, #12 /* leave 3 words for abort-stack */ clear_bss: @@ -202,9 +194,13 @@ OSTIMER_BASE: .word 0x40a00000 #define OIER 0x1C /* Clock Manager Registers */ +#ifdef CFG_CPUSPEED CC_BASE: .word 0x41300000 #define CCCR 0x00 cpuspeed: .word CFG_CPUSPEED +#else +#error "You have to define CFG_CPUSPEED!!" +#endif /* RS: ??? */ diff --git a/cpu/sa1100/cpu.c b/cpu/sa1100/cpu.c index 370ea6cb96a482a84027388e7a42a72dc5549a32..b613fe7ebf1ea9cf343291023cac78ec879a611c 100644 --- a/cpu/sa1100/cpu.c +++ b/cpu/sa1100/cpu.c @@ -36,17 +36,15 @@ int cpu_init (void) { /* - * setup up stack if necessary + * setup up stacks if necessary */ #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + - CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; #endif - return (0); + return 0; } int cleanup_before_linux (void) diff --git a/cpu/sa1100/start.S b/cpu/sa1100/start.S index 6b4c948913749c186c38f76e72476ec4290e3074..0c8946e008c3f484b0870bc9ae7693e94604af17 100644 --- a/cpu/sa1100/start.S +++ b/cpu/sa1100/start.S @@ -92,14 +92,6 @@ _armboot_end_data: _armboot_end: .word armboot_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -134,32 +126,32 @@ reset: bl cpu_init_crit #endif -relocate: - /* - * relocate armboot to RAM - */ - adr r0, _start /* r0 <- current position of code */ +relocate: /* relocate U-Boot to RAM */ + adr r0, _start /* r0 <- current position of code */ + ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ + cmp r0, r1 /* don't reloc during debug */ + beq stack_setup + ldr r2, _armboot_start ldr r3, _armboot_end - sub r2, r3, r2 /* r2 <- size of armboot */ - ldr r1, _TEXT_BASE /* r1 <- destination address */ - add r2, r0, r2 /* r2 <- source end address */ + sub r2, r3, r2 /* r2 <- size of armboot */ + add r2, r0, r2 /* r2 <- source end address */ - /* - * r0 = source address - * r1 = target address - * r2 = source end address - */ copy_loop: - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - cmp r0, r2 + ldmia r0!, {r3-r10} /* copy from source address [r0] */ + stmia r1!, {r3-r10} /* copy to target address [r1] */ + cmp r0, r2 /* until source end addreee [r2] */ ble copy_loop - /* set up the stack */ - ldr r0, _armboot_end - add r0, r0, #CONFIG_STACKSIZE - sub sp, r0, #12 /* leave 3 words for abort-stack */ + /* Set up the stack */ +stack_setup: + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif + sub sp, r0, #12 /* leave 3 words for abort-stack */ ldr pc, _start_armboot diff --git a/doc/README.ARM-memory-map b/doc/README.ARM-memory-map new file mode 100644 index 0000000000000000000000000000000000000000..8905a50b8888e4a26aac0b67a4003bc5a172a623 --- /dev/null +++ b/doc/README.ARM-memory-map @@ -0,0 +1,27 @@ +Subject: Re: [PATCH][CFT] bring ARM memory layout in line with the documented behaviour +From: "Anders Larsen" +Date: Thu, 18 Sep 2003 14:15:21 +0200 +To: Wolfgang Denk + +... +>I still see references to _armboot_start, _armboot_end_data, and +>_armboot_end - which role do these play now? Can we get rid of them? +> +>How are they (should they be) set in your memory map above? + +_armboot_start contains the value of TEXT_BASE (0xA07E0000); it seems +TEXT_BASE and _armboot_start are both used for the same purpose in +different parts of the (ARM) code. +Furthermore, the startup code (cpu//start.S) internally uses +another variable (_TEXT_BASE) with the same content as _armboot_start. +I agree that this mess should be cleaned up. + +_armboot_end_data is the end address of the initialized data section, +and is only used in one place (board/logodl/flash.c - the reference in +lib_arm/board.c is purely informational). + +_armboot_end is the end address of the BSS and is used to determine +the address of the VFD buffer. + +Eliminating those should be doable, and at least the patch already +eliminates _armboot_real_end. diff --git a/include/asm-arm/u-boot-arm.h b/include/asm-arm/u-boot-arm.h index 355b1e4e6808a3708544814999a091bc96de0c71..4c92b1f361cb46b213bbdd3a48aacb8e04a48b7f 100644 --- a/include/asm-arm/u-boot-arm.h +++ b/include/asm-arm/u-boot-arm.h @@ -35,7 +35,6 @@ extern ulong _armboot_end_data; /* code + data end */ extern ulong _armboot_end; /* BSS end */ extern ulong IRQ_STACK_START; /* top of IRQ stack */ extern ulong FIQ_STACK_START; /* top of FIQ stack */ -extern ulong _armboot_real_end; /* first usable RAM address */ /* cpu/.../cpu.c */ int cpu_init(void); diff --git a/include/configs/VCMA9.h b/include/configs/VCMA9.h index 9f868f8c8790bb4dad25555ad5b664aa30f6c498..8a09da688021dcada8f6b25d5c9ee179f2f2086f 100644 --- a/include/configs/VCMA9.h +++ b/include/configs/VCMA9.h @@ -97,6 +97,7 @@ * Size of malloc() pool */ #define CONFIG_MALLOC_SIZE (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ #define CFG_MONITOR_LEN (256 * 1024) #define CFG_MALLOC_LEN (128 * 1024) diff --git a/include/configs/at91rm9200dk.h b/include/configs/at91rm9200dk.h index 415b7fb6ea642f0a96fe0cee3217535837ee2feb..b092ec7a156e6ce23eb7bc012aa7634db704ee34 100644 --- a/include/configs/at91rm9200dk.h +++ b/include/configs/at91rm9200dk.h @@ -25,6 +25,12 @@ #ifndef __CONFIG_H #define __CONFIG_H +/* + * If we are developing, we might want to start armboot from ram + * so we MUST NOT initialize critical regs like mem-timing ... + */ +#define CONFIG_INIT_CRITICAL /* undef for developing */ + /* ARM asynchronous clock */ #define AT91C_MAIN_CLOCK 179712000 /* from 18.432 MHz crystal (18432000 / 4 * 39) */ #define AT91C_MASTER_CLOCK 59904000 /* peripheral clock (AT91C_MASTER_CLOCK / 3) */ @@ -40,7 +46,10 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ + #define CONFIG_BAUDRATE 115200 + /* * Hardware drivers */ diff --git a/include/configs/cogent_mpc8260.h b/include/configs/cogent_mpc8260.h index 22d154e6d238819b0fe026527b21a662419c31ef..d7305272d2629b08cd1fa49a3975939ab5f64f2a 100644 --- a/include/configs/cogent_mpc8260.h +++ b/include/configs/cogent_mpc8260.h @@ -160,6 +160,7 @@ #define CFG_CMA_CONS_SERIAL /* use Cogent motherboard serial for console */ #endif #define CFG_CMA_LCD_HEARTBEAT /* define for sec rotator in lcd corner */ +#define CONFIG_SHOW_ACTIVITY #if (CMA_MB_CAPS & CMA_MB_CAP_FLASH) /* diff --git a/include/configs/cogent_mpc8xx.h b/include/configs/cogent_mpc8xx.h index 2fd4037fdea75a884ed3ed3f69550f7c7ff903d8..51d4a7a7f0bffd410ec144abe7ed7caf44caaee8 100644 --- a/include/configs/cogent_mpc8xx.h +++ b/include/configs/cogent_mpc8xx.h @@ -126,6 +126,7 @@ #define CFG_CMA_CONS_SERIAL /* use Cogent motherboard serial for console */ #define CONFIG_CONS_INDEX 1 #define CFG_CMA_LCD_HEARTBEAT /* define for sec rotator in lcd corner */ +#define CONFIG_SHOW_ACTIVITY #if (CMA_MB_CAPS & CMA_MB_CAP_FLASH) /* * flash exists on the motherboard diff --git a/include/configs/cradle.h b/include/configs/cradle.h index 13996d4ab64fd97daab2cbff691a7181b15b3a81..2cec4c7c513ae8be85cdff988547e2399811dff1 100644 --- a/include/configs/cradle.h +++ b/include/configs/cradle.h @@ -47,6 +47,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/csb226.h b/include/configs/csb226.h index 879607cb56d1766dc0576bd94b885b345b17790e..1b39d23c884e38e22ef525e07a35a1d5e503e984 100644 --- a/include/configs/csb226.h +++ b/include/configs/csb226.h @@ -94,6 +94,7 @@ * */ #define CFG_MALLOC_LEN (128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ #define CFG_LONGHELP /* undef to save memory */ #define CFG_PROMPT "uboot> " /* Monitor Command Prompt */ diff --git a/include/configs/dnp1110.h b/include/configs/dnp1110.h index 8594e65822b4a1b7634a59d4a701ed198dbe03ea..f3a871bda3f8d3df608325ba646fc8e5a35c9770 100644 --- a/include/configs/dnp1110.h +++ b/include/configs/dnp1110.h @@ -47,6 +47,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/ep7312.h b/include/configs/ep7312.h index 9a4c7e6ac41ffbab168915775c7cc9dbbe6dffa6..d9dd620c1ca851627d54e82ec0e3bd29cee5c062 100644 --- a/include/configs/ep7312.h +++ b/include/configs/ep7312.h @@ -48,6 +48,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/impa7.h b/include/configs/impa7.h index fb35bd4e7cad9117568fc7b9206c0d9fb55cfdf2..b4c1edfa3dc6e22b2f5a4c5561a26637676c3a82 100644 --- a/include/configs/impa7.h +++ b/include/configs/impa7.h @@ -48,6 +48,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/innokom.h b/include/configs/innokom.h index cfe9032893d1f3676580dad94aa56d471e2ec009..709c0d7a9934e7bf68342b82fa304441f08ddac8 100644 --- a/include/configs/innokom.h +++ b/include/configs/innokom.h @@ -87,6 +87,7 @@ * */ #define CFG_MALLOC_LEN (256*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ #define CFG_LONGHELP /* undef to save memory */ #define CFG_PROMPT "uboot> " /* Monitor Command Prompt */ diff --git a/include/configs/lart.h b/include/configs/lart.h index 32153fc5216449130c87b9c44769eacbae170950..c98f3777ca2f704c8fe8103361474f760c29be21 100644 --- a/include/configs/lart.h +++ b/include/configs/lart.h @@ -46,6 +46,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/lubbock.h b/include/configs/lubbock.h index 609ce339ae186150333772c27bf4a00166311c9a..bfced4420ba9da47d6db49853f14ce763a83cc32 100644 --- a/include/configs/lubbock.h +++ b/include/configs/lubbock.h @@ -52,6 +52,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/lwmon.h b/include/configs/lwmon.h index 74511922de5b0eece3830e1480ebb457943c9772..04215a60ece7ec83d1d1a78835af35786d80827d 100644 --- a/include/configs/lwmon.h +++ b/include/configs/lwmon.h @@ -113,6 +113,7 @@ #undef CFG_LOADS_BAUD_CHANGE /* don't allow baudrate change */ #define CONFIG_WATCHDOG 1 /* watchdog enabled */ +#define CFG_WATCHDOG_FREQ (CFG_HZ / 20) #undef CONFIG_STATUS_LED /* Status LED disabled */ diff --git a/include/configs/omap1510inn.h b/include/configs/omap1510inn.h index 66a8b6bbd4c231120524e45193f938c40af86e82..845e4d2473c73f719eeacb270073f7c607c7be2a 100644 --- a/include/configs/omap1510inn.h +++ b/include/configs/omap1510inn.h @@ -26,6 +26,12 @@ #ifndef __CONFIG_H #define __CONFIG_H +/* + * If we are developing, we might want to start armboot from ram + * so we MUST NOT initialize critical regs like mem-timing ... + */ +#define CONFIG_INIT_CRITICAL /* undef for developing */ + /* * High Level Configuration Options * (easy to change) @@ -49,6 +55,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/omap1610inn.h b/include/configs/omap1610inn.h index d65e2a01d6fc35211467fa2e56322423d3c41bb5..9bdd795b887c9b67d0f057ca4da7662054f1d3a3 100644 --- a/include/configs/omap1610inn.h +++ b/include/configs/omap1610inn.h @@ -26,6 +26,12 @@ #ifndef __CONFIG_H #define __CONFIG_H +/* + * If we are developing, we might want to start armboot from ram + * so we MUST NOT initialize critical regs like mem-timing ... + */ +#define CONFIG_INIT_CRITICAL /* undef for developing */ + /* * High Level Configuration Options * (easy to change) @@ -50,6 +56,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers @@ -66,14 +73,13 @@ #define CFG_NS16550 #define CFG_NS16550_SERIAL #define CFG_NS16550_REG_SIZE (-4) -#define CFG_NS16550_CLK (48000000) /* can be 12M/32Khz or 48Mhz */ -#define CFG_NS16550_COM1 0xfffb0000 /* uart1, bluetooth uart - on helen */ +#define CFG_NS16550_CLK (48000000) /* can be 12M/32Khz or 48Mhz */ +#define CFG_NS16550_COM1 0xfffb0000 /* uart1, bluetooth uart on helen */ /* * select serial console configuration */ -#define CONFIG_SERIAL1 1 /* we use SERIAL 1 on OMAP1610 Innovator */ +#define CONFIG_SERIAL1 1 /* we use SERIAL 1 on OMAP1610 Innovator */ /* allow to overwrite serial and ethaddr */ #define CONFIG_ENV_OVERWRITE diff --git a/include/configs/shannon.h b/include/configs/shannon.h index 77af2f3bc1cafa31f9cd9d08213ed1cd30c40f28..7afe62d7cc1f0f8fd3f9048df406345b51b8aa3a 100644 --- a/include/configs/shannon.h +++ b/include/configs/shannon.h @@ -52,6 +52,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/smdk2400.h b/include/configs/smdk2400.h index a557bc6cf93b54a6d79adcc79d78a0e524765d44..a7621a2d11aba5a3b9ac055cf6da5cf175fcfde7 100644 --- a/include/configs/smdk2400.h +++ b/include/configs/smdk2400.h @@ -55,6 +55,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/smdk2410.h b/include/configs/smdk2410.h index 0dcbbb063d3e75a16beef0d6c2f0cc364ac3c1bd..7e3a02d29baccf473fb9af070ae5456771124bf9 100644 --- a/include/configs/smdk2410.h +++ b/include/configs/smdk2410.h @@ -54,6 +54,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/trab.h b/include/configs/trab.h index 4d37807e7d6ca83331c3ece3bf74fcb6d000d081..95ee37e2a7427c8523a2a20affc3cf84707e1c87 100644 --- a/include/configs/trab.h +++ b/include/configs/trab.h @@ -89,6 +89,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/wepep250.h b/include/configs/wepep250.h index ecb7215e2e6049be612d16c5f99f9e53540c4d95..a8a8ee535cdc7708e714b0bb761356ce5c37a2db 100644 --- a/include/configs/wepep250.h +++ b/include/configs/wepep250.h @@ -23,6 +23,12 @@ #ifndef __CONFIG_H #define __CONFIG_H +/* + * If we are developing, we might want to start armboot from ram + * so we MUST NOT initialize critical regs like mem-timing ... + */ +#define CONFIG_INIT_CRITICAL /* undef for developing */ + #define CONFIG_PXA250 1 /* this is an PXA250 CPU */ #define CONFIG_WEPEP250 1 /* config for wepep250 board */ #undef CONFIG_USE_IRQ /* don't need use IRQ/FIQ */ @@ -93,6 +99,7 @@ * Malloc pool need to host env + 128 Kb reserve for other allocations. */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + (128<<10) ) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ #define CONFIG_STACKSIZE (120<<10) /* stack size */ diff --git a/lib_arm/board.c b/lib_arm/board.c index a6029b0f200977ac13da0fe59e5a726107e65cdc..16e1575ed5112e3e23383144c42d23dec94f917c 100644 --- a/lib_arm/board.c +++ b/lib_arm/board.c @@ -149,7 +149,7 @@ static int display_dram_config (void) return (0); #endif - puts ("DRAM Configuration:\n"); + puts ("RAM Configuration:\n"); for(i=0; ibd->bi_dram[i].start); @@ -173,7 +173,7 @@ static void display_flash_config (ulong size) /* - * Breath some life into the board... + * Breathe some life into the board... * * Initialize a serial port as console, and carry out some hardware * tests. @@ -219,8 +219,6 @@ void start_armboot (void) DECLARE_GLOBAL_DATA_PTR; ulong size; - gd_t gd_data; - bd_t bd_data; init_fnc_t **init_fnc_ptr; char *s; #if defined(CONFIG_VFD) @@ -228,9 +226,9 @@ void start_armboot (void) #endif /* Pointer is writable since we allocated a register for it */ - gd = &gd_data; - memset ((void *)gd, 0, sizeof (gd_t)); - gd->bd = &bd_data; + gd = (gd_t*)(_armboot_start - CFG_MALLOC_LEN - sizeof(gd_t)); + memset ((void*)gd, 0, sizeof (gd_t)); + gd->bd = (bd_t*)((char*)gd - sizeof(bd_t)); memset (gd->bd, 0, sizeof (bd_t)); monitor_flash_len = _armboot_end_data - _armboot_start; @@ -246,25 +244,21 @@ void start_armboot (void) display_flash_config (size); #ifdef CONFIG_VFD -# ifndef PAGE_SIZE -# define PAGE_SIZE 4096 -# endif +# ifndef PAGE_SIZE +# define PAGE_SIZE 4096 +# endif /* * reserve memory for VFD display (always full pages) */ - /* armboot_real_end is defined in the board-specific linker script */ - addr = (_armboot_real_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); + /* armboot_end is defined in the board-specific linker script */ + addr = (_armboot_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); size = vfd_setmem (addr); gd->fb_base = addr; - /* round to the next page boundary */ - addr += size; - addr = (addr + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); - mem_malloc_init (addr); -#else - /* armboot_real_end is defined in the board-specific linker script */ - mem_malloc_init (_armboot_real_end); #endif /* CONFIG_VFD */ + /* armboot_start is defined in the board-specific linker script */ + mem_malloc_init (_armboot_start - CFG_MALLOC_LEN); + #if (CONFIG_COMMANDS & CFG_CMD_NAND) puts ("NAND:"); nand_init(); /* go init the NAND */ @@ -281,10 +275,10 @@ void start_armboot (void) #ifdef CONFIG_VFD /* must do this after the framebuffer is allocated */ drv_vfd_init(); -#endif +#endif /* CONFIG_VFD */ /* IP Address */ - bd_data.bi_ip_addr = getenv_IPaddr ("ipaddr"); + gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr"); /* MAC Address */ { @@ -297,7 +291,7 @@ void start_armboot (void) s = (i > 0) ? tmp : NULL; for (reg = 0; reg < 6; ++reg) { - bd_data.bi_enetaddr[reg] = s ? simple_strtoul (s, &e, 16) : 0; + gd->bd->bi_enetaddr[reg] = s ? simple_strtoul (s, &e, 16) : 0; if (s) s = (*e) ? e + 1 : e; } @@ -317,6 +311,7 @@ void start_armboot (void) /* enable exceptions */ enable_interrupts (); + /* Perform network card initialisation if necessary */ #ifdef CONFIG_DRIVER_CS8900 cs8900_get_enetaddr (gd->bd->bi_enetaddr); #endif diff --git a/lib_ppc/Makefile b/lib_ppc/Makefile index 36ddf3cacf424306eabb429a2e23beb4a939ad58..652a4199ec5172a05544a1d0b200c79d9526f1d7 100644 --- a/lib_ppc/Makefile +++ b/lib_ppc/Makefile @@ -28,7 +28,7 @@ LIB = lib$(ARCH).a AOBJS = ppcstring.o ticks.o COBJS = board.o \ - bat_rw.o cache.o extable.o kgdb.o time.o + bat_rw.o cache.o extable.o kgdb.o time.o interrupts.o OBJS = $(AOBJS) $(COBJS) diff --git a/lib_ppc/interrupts.c b/lib_ppc/interrupts.c new file mode 100644 index 0000000000000000000000000000000000000000..1e540a5c3f79a5dfc3ce327c3991a7c8e7891ac8 --- /dev/null +++ b/lib_ppc/interrupts.c @@ -0,0 +1,148 @@ +/* + * (C) Copyright 2000-2002 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * (C) Copyright 2003 + * Gleb Natapov + * + * 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 +#include +#include +#ifdef CONFIG_STATUS_LED +#include +#endif + +#ifdef CONFIG_SHOW_ACTIVITY + extern void board_show_activity (ulong); +#endif /* CONFIG_SHOW_ACTIVITY */ + +#ifndef CFG_WATCHDOG_FREQ +#define CFG_WATCHDOG_FREQ (CFG_HZ / 2) +#endif + +extern int interrupt_init_cpu (unsigned *); +extern void timer_interrupt_cpu (struct pt_regs *); + +static unsigned decrementer_count; /* count value for 1e6/HZ microseconds */ + +static __inline__ unsigned long get_msr (void) +{ + unsigned long msr; + + asm volatile ("mfmsr %0":"=r" (msr):); + + return msr; +} + +static __inline__ void set_msr (unsigned long msr) +{ + asm volatile ("mtmsr %0"::"r" (msr)); +} + +static __inline__ unsigned long get_dec (void) +{ + unsigned long val; + + asm volatile ("mfdec %0":"=r" (val):); + + return val; +} + + +static __inline__ void set_dec (unsigned long val) +{ + if (val) + asm volatile ("mtdec %0"::"r" (val)); +} + + +void enable_interrupts (void) +{ + set_msr (get_msr () | MSR_EE); +} + +/* returns flag if MSR_EE was set before */ +int disable_interrupts (void) +{ + ulong msr = get_msr (); + + set_msr (msr & ~MSR_EE); + return ((msr & MSR_EE) != 0); +} + +int interrupt_init (void) +{ + int ret; + + /* call cpu specific function from $(CPU)/interrupts.c */ + ret = interrupt_init_cpu (&decrementer_count); + + if (ret) + return ret; + + set_dec (decrementer_count); + + set_msr (get_msr () | MSR_EE); + + return (0); +} + +static volatile ulong timestamp = 0; + +void timer_interrupt (struct pt_regs *regs) +{ + /* call cpu specific function from $(CPU)/interrupts.c */ + timer_interrupt_cpu (regs); + + /* Restore Decrementer Count */ + set_dec (decrementer_count); + + timestamp++; + +#if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG) + if ((timestamp % (CFG_WATCHDOG_FREQ)) == 0) + WATCHDOG_RESET (); +#endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */ + +#ifdef CONFIG_STATUS_LED + status_led_tick (timestamp); +#endif /* CONFIG_STATUS_LED */ + +#ifdef CONFIG_SHOW_ACTIVITY + board_show_activity (timestamp); +#endif /* CONFIG_SHOW_ACTIVITY */ +} + +void reset_timer (void) +{ + timestamp = 0; +} + +ulong get_timer (ulong base) +{ + return (timestamp - base); +} + +void set_timer (ulong t) +{ + timestamp = t; +} diff --git a/tools/Makefile b/tools/Makefile index c191203e4533e7f1740028cd07125c568b2b6302..0576a3f43e70c70951f53999be3a5fba4ffb436e 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -180,12 +180,14 @@ else endif environment.c: + @rm -f environment.c ln -s ../common/environment.c environment.c environment.o: environment.c $(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c $< crc32.c: + @rm -f crc32.c ln -s ../lib_generic/crc32.c crc32.c $(LOGO_H): bmp_logo $(LOGO_BMP)