* [PATCH] arm cache fixes @ 2010-01-22 15:06 Uwe Kleine-König 2010-01-22 15:14 ` [PATCH 1/2] give nice output when generating barebox.bin and barebox.S Uwe Kleine-König 2010-01-22 15:14 ` [PATCH 2/2] arm: make disabling the cache actually work Uwe Kleine-König 0 siblings, 2 replies; 4+ messages in thread From: Uwe Kleine-König @ 2010-01-22 15:06 UTC (permalink / raw) To: barebox Hi, while digging around in Linux' early boot code for ARM I noticed that the mmu hasn't been disabled on iMX27 when giving control to Linux. The other patch mostly cosmetic to print out when barebox.bin (and barebox.S) are updated. I send the patches as reply to this mail. Shortlog and diffstat are below. Best regards Uwe The following changes since commit 0dde20da20411bf4dcd5593601d2f36e9ba04f66: Peter Korsgaard (1): documentation: It's U-Boot that doesn't have getopt, not Barebox are available in the git repository at: git://git.pengutronix.de/git/ukl/barebox.git master Uwe Kleine-König (2): give nice output when generating barebox.bin and barebox.S arm: make disabling the cache actually work Makefile | 15 ++++++++++++--- arch/arm/cpu/mmu.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 4 deletions(-) -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] give nice output when generating barebox.bin and barebox.S 2010-01-22 15:06 [PATCH] arm cache fixes Uwe Kleine-König @ 2010-01-22 15:14 ` Uwe Kleine-König 2010-03-12 9:51 ` [PATCH] " Uwe Kleine-König 2010-01-22 15:14 ` [PATCH 2/2] arm: make disabling the cache actually work Uwe Kleine-König 1 sibling, 1 reply; 4+ messages in thread From: Uwe Kleine-König @ 2010-01-22 15:14 UTC (permalink / raw) To: barebox As a side effect don't build barebox.S when barebox.bin is updated. I didn't manage to keep the old behaviour and I consider it cleaner this way. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- Makefile | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0c00829..5b5c2e8 100644 --- a/Makefile +++ b/Makefile @@ -641,9 +641,18 @@ define rule_barebox-modpost $(Q)echo 'cmd_$@ := $(cmd_barebox-modpost)' > $(dot-target).cmd endef -barebox.bin: barebox - $(Q)$(OBJCOPY) -O binary barebox barebox.bin - $(Q)$(OBJDUMP) -d barebox > barebox.S +quiet_cmd_objcopy = OBJCOPY $@ + cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ + +OBJCOPYFLAGS_barebox.bin = -O binary +barebox.bin: barebox FORCE + $(call if_changed,objcopy) +#$(Q)$(OBJCOPY) -O binary barebox barebox.bin + +quiet_cmd_disasm = DISASM $@ + cmd_disasm = $(OBJDUMP) -d $< > $@ +barebox.S: barebox FORCE + $(call if_changed,disasm) # barebox image barebox: $(barebox-lds) $(barebox-head) $(barebox-common) $(kallsyms.o) FORCE -- 1.6.6 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] give nice output when generating barebox.bin and barebox.S 2010-01-22 15:14 ` [PATCH 1/2] give nice output when generating barebox.bin and barebox.S Uwe Kleine-König @ 2010-03-12 9:51 ` Uwe Kleine-König 0 siblings, 0 replies; 4+ messages in thread From: Uwe Kleine-König @ 2010-03-12 9:51 UTC (permalink / raw) To: barebox As a side effect don't build barebox.S when barebox.bin is updated. I didn't manage to keep the old behaviour and I consider it cleaner this way. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- Hello, I rebased this to current master. The X86 stuff is untouched, probably it could be integrated, too, but I didn't want to spend the time trying, if the patch isn't welcome in principle. Sascha? Grüßle Uwe Makefile | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 01d2052..8b9b454 100644 --- a/Makefile +++ b/Makefile @@ -641,9 +641,16 @@ define rule_barebox-modpost $(Q)echo 'cmd_$@ := $(cmd_barebox-modpost)' > $(dot-target).cmd endef -barebox.bin: barebox - $(Q)$(OBJCOPY) -O binary barebox barebox.bin +quiet_cmd_objcopy = OBJCOPY $@ + cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ + +OBJCOPYFLAGS_barebox.bin = -O binary + +barebox.bin: barebox FORCE + $(call if_changed,objcopy) + ifdef CONFIG_X86 +barebox.S: barebox ifdef CONFIG_X86_HDBOOT @echo "-------------------------------------------------" > barebox.S @echo " * MBR content" >> barebox.S @@ -665,7 +672,11 @@ endif @echo " * Init Calls content" >> barebox.S $(Q)$(OBJDUMP) -j .barebox_initcalls -d barebox >> barebox.S else - $(Q)$(OBJDUMP) -d barebox > barebox.S +quiet_cmd_disasm = DISASM $@ + cmd_disasm = $(OBJDUMP) -d $< > $@ + +barebox.S: barebox FORCE + $(call if_changed,disasm) endif # barebox image -- 1.7.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] arm: make disabling the cache actually work 2010-01-22 15:06 [PATCH] arm cache fixes Uwe Kleine-König 2010-01-22 15:14 ` [PATCH 1/2] give nice output when generating barebox.bin and barebox.S Uwe Kleine-König @ 2010-01-22 15:14 ` Uwe Kleine-König 1 sibling, 0 replies; 4+ messages in thread From: Uwe Kleine-König @ 2010-01-22 15:14 UTC (permalink / raw) To: barebox The code before looks to me like work in progress. It only drained the write buffer and skipped disabling mmu and caches by an early return from inline assembler (which is broken in itself as it doesn't restore frame pointer, stack pointer and other saved registers). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- arch/arm/cpu/mmu.c | 29 ++++++++++++++++++++++++++++- 1 files changed, 28 insertions(+), 1 deletions(-) diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c index 9e00927..95b8302 100644 --- a/arch/arm/cpu/mmu.c +++ b/arch/arm/cpu/mmu.c @@ -54,7 +54,7 @@ void mmu_enable(void) { asm volatile ( "mrc p15, 0, r1, c1, c0, 0;" - "orr r1, r1, #0x0007;" /* enable MMU + Dcache */ + "orr r1, r1, #0x0007;" /* enable MMU + Dcache + alignment fault checking */ "mcr p15, 0, r1, c1, c0, 0" : : @@ -67,6 +67,30 @@ void mmu_enable(void) */ void mmu_disable(void) { +#if defined(CONFIG_CPU_ARM926T) + unsigned int tmp = 0; + asm volatile ( + /* test, clean and invalidate D cache */ + "1: mrc p15, 0, r15, c7, c14, 3\n" + " bne 1b\n" + /* invalidate I cache (Rd SBZ) */ + " mcr p15, 0, %1, c7, c5, 0\n" + /* drain write buffer (Rd SBZ) */ + " mcr p15, 0, %1, c7, c10, 4\n" + + /* read control register */ + " mrc p15, 0, %0, c1, c0\n" + /* clear C and M */ + " bic %0, %0, #0x0005\n" + /* write back control register */ + " mcr p15, 0, %0, c1, c0\n" + + /* invalidate TLBs (Rd SBZ) */ + " mcr p15, 0, %1, c8, c7, 0;" + : "=&r" (tmp) : "r" (tmp) : "cc" ); + +#else + /* ??? */ asm volatile ( "nop; " "nop; " @@ -75,9 +99,11 @@ void mmu_disable(void) "nop; " "nop; " /* test, clean and invalidate cache */ + /* mrc p15, 0, $rd, c7, c14, 3; is armv5tej specific */ "1: mrc p15, 0, r15, c7, c14, 3;" " bne 1b;" " mov pc, lr;" + /* the following code is never reached */ " mov r0, #0x0;" " mcr p15, 0, r0, c7, c10, 4;" /* drain the write buffer */ " mcr p15, 0, r1, c7, c6, 0;" /* clear data cache */ @@ -90,6 +116,7 @@ void mmu_disable(void) : : "r0" /* Clobber list */ ); +#endif } /* -- 1.6.6 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-03-12 9:51 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-01-22 15:06 [PATCH] arm cache fixes Uwe Kleine-König 2010-01-22 15:14 ` [PATCH 1/2] give nice output when generating barebox.bin and barebox.S Uwe Kleine-König 2010-03-12 9:51 ` [PATCH] " Uwe Kleine-König 2010-01-22 15:14 ` [PATCH 2/2] arm: make disabling the cache actually work Uwe Kleine-König
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox