From 25fbe5ca4d0f37170451b682bd150a70f944aca0 Mon Sep 17 00:00:00 2001 From: Wolfgang Wiedmeyer Date: Fri, 23 Oct 2015 17:03:23 +0200 Subject: update other arm platforms from 3.2.72 and also merge some general arm code (boot) --- arch/arm/boot/Makefile | 17 + arch/arm/boot/compressed/Makefile | 56 ++- arch/arm/boot/compressed/head-sa1100.S | 1 + arch/arm/boot/compressed/head-shark.S | 1 + arch/arm/boot/compressed/head-shmobile.S | 12 +- arch/arm/boot/compressed/head.S | 167 +++++-- arch/arm/boot/compressed/misc.c | 42 +- arch/arm/boot/compressed/mmcif-sh7372.c | 4 +- arch/arm/boot/compressed/vmlinux.lds.in | 16 +- arch/arm/mach-shark/Makefile.boot | 2 +- arch/arm/mach-shark/core.c | 3 +- arch/arm/mach-shark/include/mach/debug-macro.S | 2 +- arch/arm/mach-shark/include/mach/entry-macro.S | 10 +- arch/arm/mach-shark/include/mach/hardware.h | 6 - arch/arm/mach-shark/include/mach/memory.h | 2 - arch/arm/mach-shark/leds.c | 6 +- arch/arm/mach-shark/pci.c | 14 +- arch/arm/mach-shmobile/Kconfig | 8 + arch/arm/mach-shmobile/Makefile | 3 +- arch/arm/mach-shmobile/Makefile.boot | 2 +- arch/arm/mach-shmobile/board-ag5evm.c | 65 ++- arch/arm/mach-shmobile/board-ap4evb.c | 35 +- arch/arm/mach-shmobile/board-g3evm.c | 3 + arch/arm/mach-shmobile/board-g4evm.c | 3 + arch/arm/mach-shmobile/board-mackerel.c | 56 ++- arch/arm/mach-shmobile/clock-sh7367.c | 3 - arch/arm/mach-shmobile/clock-sh7372.c | 44 +- arch/arm/mach-shmobile/clock-sh7377.c | 3 - arch/arm/mach-shmobile/clock-sh73a0.c | 24 +- arch/arm/mach-shmobile/clock.c | 1 + arch/arm/mach-shmobile/cpuidle.c | 52 +- arch/arm/mach-shmobile/entry-intc.S | 3 - arch/arm/mach-shmobile/include/mach/common.h | 8 +- arch/arm/mach-shmobile/include/mach/entry-macro.S | 3 - arch/arm/mach-shmobile/include/mach/gpio.h | 24 +- arch/arm/mach-shmobile/include/mach/memory.h | 3 - arch/arm/mach-shmobile/include/mach/sh7372.h | 46 ++ arch/arm/mach-shmobile/include/mach/sh73a0.h | 25 + arch/arm/mach-shmobile/intc-sh7367.c | 40 +- arch/arm/mach-shmobile/intc-sh7372.c | 131 +++-- arch/arm/mach-shmobile/intc-sh7377.c | 67 +-- arch/arm/mach-shmobile/intc-sh73a0.c | 187 +++++++ arch/arm/mach-shmobile/pfc-sh7367.c | 122 +---- arch/arm/mach-shmobile/pfc-sh7372.c | 262 +++++----- arch/arm/mach-shmobile/pfc-sh7377.c | 159 ++---- arch/arm/mach-shmobile/pfc-sh73a0.c | 315 +++++++----- arch/arm/mach-shmobile/platsmp.c | 21 +- arch/arm/mach-shmobile/pm-sh7372.c | 439 ++++++++++++++-- arch/arm/mach-shmobile/pm_runtime.c | 58 --- arch/arm/mach-shmobile/setup-sh7372.c | 212 +++++++- arch/arm/mach-shmobile/sleep-sh7372.S | 221 ++------- arch/arm/mach-shmobile/smp-sh73a0.c | 6 +- arch/arm/mach-tegra/Kconfig | 25 +- arch/arm/mach-tegra/Makefile | 5 +- arch/arm/mach-tegra/Makefile.boot | 6 +- arch/arm/mach-tegra/board-harmony-pcie.c | 10 +- arch/arm/mach-tegra/board-harmony-pinmux.c | 12 + arch/arm/mach-tegra/board-harmony-power.c | 13 +- arch/arm/mach-tegra/board-harmony.c | 33 +- arch/arm/mach-tegra/board-harmony.h | 3 + arch/arm/mach-tegra/board-paz00-pinmux.c | 25 +- arch/arm/mach-tegra/board-paz00.c | 99 +++- arch/arm/mach-tegra/board-paz00.h | 20 +- arch/arm/mach-tegra/board-seaboard-pinmux.c | 79 ++- arch/arm/mach-tegra/board-seaboard.c | 115 +++-- arch/arm/mach-tegra/board-seaboard.h | 14 +- arch/arm/mach-tegra/board-trimslice-pinmux.c | 22 +- arch/arm/mach-tegra/board-trimslice.c | 64 ++- arch/arm/mach-tegra/board-trimslice.h | 5 + arch/arm/mach-tegra/clock.c | 7 +- arch/arm/mach-tegra/common.c | 2 +- arch/arm/mach-tegra/cpu-tegra.c | 7 +- arch/arm/mach-tegra/devices.c | 139 +++++- arch/arm/mach-tegra/devices.h | 2 + arch/arm/mach-tegra/dma.c | 14 +- arch/arm/mach-tegra/gpio.c | 431 ---------------- arch/arm/mach-tegra/include/mach/barriers.h | 30 -- arch/arm/mach-tegra/include/mach/clkdev.h | 34 -- arch/arm/mach-tegra/include/mach/debug-macro.S | 2 +- arch/arm/mach-tegra/include/mach/gpio.h | 61 +-- arch/arm/mach-tegra/include/mach/hardware.h | 28 -- arch/arm/mach-tegra/include/mach/io.h | 18 +- arch/arm/mach-tegra/include/mach/memory.h | 28 -- arch/arm/mach-tegra/include/mach/pinmux.h | 4 + arch/arm/mach-tegra/include/mach/powergate.h | 1 - arch/arm/mach-tegra/include/mach/system.h | 1 - arch/arm/mach-tegra/io.c | 9 +- arch/arm/mach-tegra/pcie.c | 13 +- arch/arm/mach-tegra/pinmux-t2-tables.c | 76 +-- arch/arm/mach-tegra/pinmux.c | 163 ++++-- arch/arm/mach-tegra/platsmp.c | 19 +- arch/arm/mach-tegra/powergate.c | 5 +- arch/arm/mach-tegra/tegra2_clocks.c | 54 +- arch/arm/mach-tegra/timer.c | 6 +- arch/arm/mach-tegra/usb_phy.c | 1 + arch/arm/mach-versatile/Kconfig | 8 + arch/arm/mach-versatile/Makefile | 1 + arch/arm/mach-versatile/Makefile.boot | 2 +- arch/arm/mach-versatile/core.c | 62 +++ arch/arm/mach-versatile/core.h | 4 + arch/arm/mach-versatile/include/mach/debug-macro.S | 2 +- arch/arm/mach-versatile/include/mach/gpio.h | 7 +- arch/arm/mach-versatile/include/mach/hardware.h | 6 - arch/arm/mach-versatile/include/mach/memory.h | 28 -- arch/arm/mach-versatile/pci.c | 5 +- arch/arm/mach-versatile/versatile_ab.c | 2 +- arch/arm/mach-versatile/versatile_pb.c | 2 +- arch/arm/mach-vexpress/Makefile.boot | 2 +- arch/arm/mach-vexpress/ct-ca9x4.c | 10 +- arch/arm/mach-vexpress/hotplug.c | 11 +- arch/arm/mach-vexpress/include/mach/debug-macro.S | 2 +- arch/arm/mach-vexpress/include/mach/io.h | 2 - arch/arm/mach-vexpress/include/mach/memory.h | 25 - arch/arm/mach-vexpress/v2m.c | 9 +- arch/arm/plat-iop/gpio.c | 1 + arch/arm/plat-iop/pci.c | 3 + arch/arm/plat-iop/time.c | 1 + arch/arm/plat-s3c24xx/Kconfig | 3 +- arch/arm/plat-s3c24xx/Makefile | 4 +- arch/arm/plat-s3c24xx/clock-dclk.c | 4 - arch/arm/plat-s3c24xx/cpu-freq-debugfs.c | 2 +- arch/arm/plat-s3c24xx/cpu.c | 24 +- arch/arm/plat-s3c24xx/devs.c | 552 --------------------- arch/arm/plat-s3c24xx/dma.c | 10 +- arch/arm/plat-s3c24xx/gpio.c | 96 ---- arch/arm/plat-s3c24xx/gpiolib.c | 229 --------- arch/arm/plat-s3c24xx/include/mach/pwm-clock.h | 55 -- arch/arm/plat-s3c24xx/include/plat/audio-simtec.h | 37 -- arch/arm/plat-s3c24xx/include/plat/common-smdk.h | 15 - arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h | 287 ----------- arch/arm/plat-s3c24xx/include/plat/fiq.h | 13 - arch/arm/plat-s3c24xx/include/plat/irq.h | 115 ----- arch/arm/plat-s3c24xx/include/plat/map.h | 100 ---- arch/arm/plat-s3c24xx/include/plat/mci.h | 52 -- arch/arm/plat-s3c24xx/include/plat/pll.h | 62 --- arch/arm/plat-s3c24xx/include/plat/regs-dma.h | 145 ------ arch/arm/plat-s3c24xx/include/plat/regs-iis.h | 77 --- arch/arm/plat-s3c24xx/include/plat/regs-spi.h | 82 --- arch/arm/plat-s3c24xx/include/plat/regs-udc.h | 153 ------ arch/arm/plat-s3c24xx/include/plat/s3c2400.h | 31 -- arch/arm/plat-s3c24xx/include/plat/s3c2410.h | 33 -- arch/arm/plat-s3c24xx/include/plat/s3c2412.h | 29 -- arch/arm/plat-s3c24xx/include/plat/s3c2416.h | 31 -- arch/arm/plat-s3c24xx/include/plat/s3c2443.h | 51 -- arch/arm/plat-s3c24xx/include/plat/s3c244x.h | 42 -- arch/arm/plat-s3c24xx/include/plat/udc.h | 57 --- arch/arm/plat-s3c24xx/s3c2410-clock.c | 21 +- arch/arm/plat-s3c24xx/s3c2443-clock.c | 231 +++++++-- arch/arm/plat-s3c24xx/sleep.S | 25 - arch/arm/tools/mach-types | 41 +- 150 files changed, 2921 insertions(+), 4703 deletions(-) delete mode 100644 arch/arm/mach-shmobile/pm_runtime.c delete mode 100644 arch/arm/mach-tegra/gpio.c delete mode 100644 arch/arm/mach-tegra/include/mach/barriers.h delete mode 100644 arch/arm/mach-tegra/include/mach/clkdev.h delete mode 100644 arch/arm/mach-tegra/include/mach/hardware.h delete mode 100644 arch/arm/mach-tegra/include/mach/memory.h delete mode 100644 arch/arm/mach-versatile/include/mach/memory.h delete mode 100644 arch/arm/mach-vexpress/include/mach/memory.h delete mode 100644 arch/arm/plat-s3c24xx/devs.c delete mode 100644 arch/arm/plat-s3c24xx/gpio.c delete mode 100644 arch/arm/plat-s3c24xx/gpiolib.c delete mode 100644 arch/arm/plat-s3c24xx/include/mach/pwm-clock.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/audio-simtec.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/common-smdk.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/fiq.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/irq.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/map.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/mci.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/pll.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/regs-dma.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/regs-iis.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/regs-spi.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/regs-udc.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/s3c2400.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/s3c2410.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/s3c2412.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/s3c2416.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/s3c2443.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/s3c244x.h delete mode 100644 arch/arm/plat-s3c24xx/include/plat/udc.h diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile index 9ec1a8d..6b27a16 100644 --- a/arch/arm/boot/Makefile +++ b/arch/arm/boot/Makefile @@ -63,6 +63,14 @@ endif endif +# Rule to build device tree blobs +$(obj)/%.dtb: $(src)/dts/%.dts + $(call cmd,dtc) + +$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y)) + +clean-files := *.dtb + quiet_cmd_uimage = UIMAGE $@ cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \ -C none -a $(LOADADDR) -e $(STARTADDR) \ @@ -76,7 +84,16 @@ endif $(obj)/uImage: STARTADDR=$(LOADADDR) +check_for_multiple_loadaddr = \ +if [ $(words $(LOADADDR)) -gt 1 ]; then \ + echo 'multiple load addresses: $(LOADADDR)'; \ + echo 'This is incompatible with uImages'; \ + echo 'Specify LOADADDR on the commandline to build an uImage'; \ + false; \ +fi + $(obj)/uImage: $(obj)/zImage FORCE + @$(check_for_multiple_loadaddr) $(call if_changed,uimage) @echo ' Image $@ is ready' diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 54c9428..5954a1a 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -6,25 +6,30 @@ OBJS = -# Ensure that mmcif loader code appears early in the image +# Ensure that MMCIF loader code appears early in the image # to minimise that number of bocks that have to be read in # order to load it. ifeq ($(CONFIG_ZBOOT_ROM_MMCIF),y) -ifeq ($(CONFIG_ARCH_SH7372),y) OBJS += mmcif-sh7372.o endif + +# Ensure that SDHI loader code appears early in the image +# to minimise that number of bocks that have to be read in +# order to load it. +ifeq ($(CONFIG_ZBOOT_ROM_SH_MOBILE_SDHI),y) +OBJS += sdhi-shmobile.o +OBJS += sdhi-sh7372.o endif AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET) -# change@wtl.rsengott -# FIPS_KERNEL_RAM_BASE is start of kernel text in RAM -ifeq ($(CONFIG_CRYPTO_FIPS),y) -AFLAGS_head.o += -DFIPS_KERNEL_RAM_BASE=0x40008000 -endif HEAD = head.o OBJS += misc.o decompress.o FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c +# string library code (-Os is enforced to keep it much smaller) +OBJS += string.o +CFLAGS_string.o := -Os + # # Architecture dependencies # @@ -88,21 +93,40 @@ suffix_$(CONFIG_KERNEL_GZIP) = gzip suffix_$(CONFIG_KERNEL_LZO) = lzo suffix_$(CONFIG_KERNEL_LZMA) = lzma +# Borrowed libfdt files for the ATAG compatibility mode + +libfdt := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c +libfdt_hdrs := fdt.h libfdt.h libfdt_internal.h + +libfdt_objs := $(addsuffix .o, $(basename $(libfdt))) + +$(addprefix $(obj)/,$(libfdt) $(libfdt_hdrs)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/% + $(call cmd,shipped) + +$(addprefix $(obj)/,$(libfdt_objs) atags_to_fdt.o): \ + $(addprefix $(obj)/,$(libfdt_hdrs)) + +ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y) +OBJS += $(libfdt_objs) atags_to_fdt.o +endif + targets := vmlinux vmlinux.lds \ piggy.$(suffix_y) piggy.$(suffix_y).o \ - font.o font.c head.o misc.o $(OBJS) + lib1funcs.o lib1funcs.S font.o font.c head.o misc.o $(OBJS) # Make sure files are removed during clean -extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S +extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S $(libfdt) $(libfdt_hdrs) ifeq ($(CONFIG_FUNCTION_TRACER),y) ORIG_CFLAGS := $(KBUILD_CFLAGS) KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) endif -ccflags-y := -fpic -fno-builtin -asflags-y := -Wa,-march=all +ccflags-y := -fpic -fno-builtin -I$(obj) +# Supply kernel BSS size to the decompressor via a linker symbol. +KBSS_SZ = $(shell size $(obj)/../../../../vmlinux | awk 'END{print $$3}') +LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ) # Supply ZRELADDR to the decompressor via a linker symbol. ifneq ($(CONFIG_AUTO_ZRELADDR),y) LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR) @@ -122,7 +146,7 @@ LDFLAGS_vmlinux += -T # For __aeabi_uidivmod lib1funcs = $(obj)/lib1funcs.o -$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE +$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S $(call cmd,shipped) # We need to prevent any GOTOFF relocs being used with references @@ -138,8 +162,16 @@ bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \ ( echo "following symbols must have non local/private scope:" >&2; \ echo "$$bad_syms" >&2; rm -f $@; false ) +check_for_multiple_zreladdr = \ +if [ $(words $(ZRELADDR)) -gt 1 -a "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \ + echo 'multiple zreladdrs: $(ZRELADDR)'; \ + echo 'This needs CONFIG_AUTO_ZRELADDR to be set'; \ + false; \ +fi + $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE + @$(check_for_multiple_zreladdr) $(call if_changed,ld) @$(check_for_bad_syms) diff --git a/arch/arm/boot/compressed/head-sa1100.S b/arch/arm/boot/compressed/head-sa1100.S index 6179d94..3115e31 100644 --- a/arch/arm/boot/compressed/head-sa1100.S +++ b/arch/arm/boot/compressed/head-sa1100.S @@ -11,6 +11,7 @@ #include .section ".start", "ax" + .arch armv4 __SA1100_start: diff --git a/arch/arm/boot/compressed/head-shark.S b/arch/arm/boot/compressed/head-shark.S index 089c560..92b5689 100644 --- a/arch/arm/boot/compressed/head-shark.S +++ b/arch/arm/boot/compressed/head-shark.S @@ -18,6 +18,7 @@ .section ".start", "ax" + .arch armv4 b __beginning __ofw_data: .long 0 @ the number of memory blocks diff --git a/arch/arm/boot/compressed/head-shmobile.S b/arch/arm/boot/compressed/head-shmobile.S index c943d2e..fe3719b 100644 --- a/arch/arm/boot/compressed/head-shmobile.S +++ b/arch/arm/boot/compressed/head-shmobile.S @@ -25,14 +25,14 @@ /* load board-specific initialization code */ #include -#ifdef CONFIG_ZBOOT_ROM_MMCIF - /* Load image from MMC */ - adr sp, __tmp_stack + 128 +#if defined(CONFIG_ZBOOT_ROM_MMCIF) || defined(CONFIG_ZBOOT_ROM_SH_MOBILE_SDHI) + /* Load image from MMC/SD */ + adr sp, __tmp_stack + 256 ldr r0, __image_start ldr r1, __image_end subs r1, r1, r0 ldr r0, __load_base - bl mmcif_loader + bl mmc_loader /* Jump to loaded code */ ldr r0, __loaded @@ -51,9 +51,9 @@ __loaded: .long __continue .align __tmp_stack: - .space 128 + .space 256 __continue: -#endif /* CONFIG_ZBOOT_ROM_MMCIF */ +#endif /* CONFIG_ZBOOT_ROM_MMC || CONFIG_ZBOOT_ROM_SH_MOBILE_SDHI */ b 1f __atags:@ tag #1 diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index e28de2a..8c57359 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -10,6 +10,7 @@ */ #include + .arch armv7-a /* * Debugging stuff * @@ -216,6 +217,104 @@ restart: adr r0, LC0 mov r10, r6 #endif + mov r5, #0 @ init dtb size to 0 +#ifdef CONFIG_ARM_APPENDED_DTB +/* + * r0 = delta + * r2 = BSS start + * r3 = BSS end + * r4 = final kernel address + * r5 = appended dtb size (still unknown) + * r6 = _edata + * r7 = architecture ID + * r8 = atags/device tree pointer + * r9 = size of decompressed image + * r10 = end of this image, including bss/stack/malloc space if non XIP + * r11 = GOT start + * r12 = GOT end + * sp = stack pointer + * + * if there are device trees (dtb) appended to zImage, advance r10 so that the + * dtb data will get relocated along with the kernel if necessary. + */ + + ldr lr, [r6, #0] +#ifndef __ARMEB__ + ldr r1, =0xedfe0dd0 @ sig is 0xd00dfeed big endian +#else + ldr r1, =0xd00dfeed +#endif + cmp lr, r1 + bne dtb_check_done @ not found + +#ifdef CONFIG_ARM_ATAG_DTB_COMPAT + /* + * OK... Let's do some funky business here. + * If we do have a DTB appended to zImage, and we do have + * an ATAG list around, we want the later to be translated + * and folded into the former here. To be on the safe side, + * let's temporarily move the stack away into the malloc + * area. No GOT fixup has occurred yet, but none of the + * code we're about to call uses any global variable. + */ + add sp, sp, #0x10000 + stmfd sp!, {r0-r3, ip, lr} + mov r0, r8 + mov r1, r6 + sub r2, sp, r6 + bl atags_to_fdt + + /* + * If returned value is 1, there is no ATAG at the location + * pointed by r8. Try the typical 0x100 offset from start + * of RAM and hope for the best. + */ + cmp r0, #1 + sub r0, r4, #TEXT_OFFSET + add r0, r0, #0x100 + mov r1, r6 + sub r2, sp, r6 + bleq atags_to_fdt + + ldmfd sp!, {r0-r3, ip, lr} + sub sp, sp, #0x10000 +#endif + + mov r8, r6 @ use the appended device tree + + /* + * Make sure that the DTB doesn't end up in the final + * kernel's .bss area. To do so, we adjust the decompressed + * kernel size to compensate if that .bss size is larger + * than the relocated code. + */ + ldr r5, =_kernel_bss_size + adr r1, wont_overwrite + sub r1, r6, r1 + subs r1, r5, r1 + addhi r9, r9, r1 + + /* Get the dtb's size */ + ldr r5, [r6, #4] +#ifndef __ARMEB__ + /* convert r5 (dtb size) to little endian */ + eor r1, r5, r5, ror #16 + bic r1, r1, #0x00ff0000 + mov r5, r5, ror #8 + eor r5, r5, r1, lsr #8 +#endif + + /* preserve 64-bit alignment */ + add r5, r5, #7 + bic r5, r5, #7 + + /* relocate some pointers past the appended dtb */ + add r6, r6, r5 + add r10, r10, r5 + add sp, sp, r5 +dtb_check_done: +#endif + /* * Check to see if we will overwrite ourselves. * r4 = final kernel address @@ -223,15 +322,14 @@ restart: adr r0, LC0 * r10 = end of this image, including bss/stack/malloc space if non XIP * We basically want: * r4 - 16k page directory >= r10 -> OK - * r4 + image length <= current position (pc) -> OK + * r4 + image length <= address of wont_overwrite -> OK */ add r10, r10, #16384 cmp r4, r10 bhs wont_overwrite add r10, r4, r9 - ARM( cmp r10, pc ) - THUMB( mov lr, pc ) - THUMB( cmp r10, lr ) + adr r9, wont_overwrite + cmp r10, r9 bls wont_overwrite /* @@ -285,20 +383,16 @@ wont_overwrite: * r2 = BSS start * r3 = BSS end * r4 = kernel execution address + * r5 = appended dtb size (0 if not present) * r7 = architecture ID * r8 = atags pointer * r11 = GOT start * r12 = GOT end * sp = stack pointer */ - teq r0, #0 -#ifndef CONFIG_CRYPTO_FIPS + orrs r1, r0, r5 beq not_relocated -#else - movw r5, #:lower16:zimage_ram_base_addr - movt r5, #:upper16:zimage_ram_base_addr - beq not_relocated_copy -#endif + add r11, r11, r0 add r12, r12, r0 @@ -311,19 +405,23 @@ wont_overwrite: add r2, r2, r0 add r3, r3, r0 -#ifdef CONFIG_CRYPTO_FIPS - movw r5, #:lower16:zimage_ram_base_addr - movt r5, #:upper16:zimage_ram_base_addr - bl copy_compressed -#endif /* * Relocate all entries in the GOT table. + * Bump bss entries to _edata + dtb size */ 1: ldr r1, [r11, #0] @ relocate entries in the GOT - add r1, r1, r0 @ table. This fixes up the - str r1, [r11], #4 @ C references. + add r1, r1, r0 @ This fixes up C references + cmp r1, r2 @ if entry >= bss_start && + cmphs r3, r1 @ bss_end > entry + addhi r1, r1, r5 @ entry += dtb size + str r1, [r11], #4 @ next entry cmp r11, r12 blo 1b + + /* bump our bss pointers too */ + add r2, r2, r5 + add r3, r3, r5 + #else /* @@ -364,7 +462,8 @@ not_relocated: mov r0, #0 mov r0, #0 @ must be zero mov r1, r7 @ restore architecture number mov r2, r8 @ restore atags pointer - mov pc, r4 @ call kernel + ARM( mov pc, r4 ) @ call kernel + THUMB( bx r4 ) @ entry point is always ARM .align 2 .type LC0, #object @@ -378,10 +477,6 @@ LC0: .word LC0 @ r1 .word .L_user_stack_end @ sp .size LC0, . - LC0 -#ifdef CONFIG_CRYPTO_FIPS - .equ zimage_ram_base_addr, FIPS_KERNEL_RAM_BASE -#endif - #ifdef CONFIG_ARCH_RPC .globl params params: ldr r0, =0x10000100 @ params_phys for RPC @@ -390,29 +485,6 @@ params: ldr r0, =0x10000100 @ params_phys for RPC .align #endif - -#ifdef CONFIG_CRYPTO_FIPS -not_relocated_copy: - bl copy_compressed - b not_relocated - -copy_compressed: - mov r1, r5 - add r9, r4, #CONFIG_CRYPTO_FIPS_INTEG_OFFSET - -1: - ldmia r1!, {r5} - stmia r9!, {r5} - cmp r1, r2 - blo 1b - - .rept 8 - ldmia r1!, {r5} - stmia r9!, {r5} - .endr - mov pc, lr -#endif - /* * Turn on the cache. We need to setup some page tables so that we * can have both the I and D caches on. @@ -695,8 +767,6 @@ proc_types: @ b __arm6_mmu_cache_off @ b __armv3_mmu_cache_flush -#if !defined(CONFIG_CPU_V7) - /* This collides with some V7 IDs, preventing correct detection */ .word 0x00000000 @ old ARM ID .word 0x0000f000 mov pc, lr @@ -705,7 +775,6 @@ proc_types: THUMB( nop ) mov pc, lr THUMB( nop ) -#endif .word 0x41007000 @ ARM7/710 .word 0xfff8fe00 diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index 832d372..8e2a8fc 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -18,14 +18,9 @@ unsigned int __machine_arch_type; -#define _LINUX_STRING_H_ - #include /* for inline */ -#include /* for size_t */ -#include /* for NULL */ +#include #include -#include - static void putstr(const char *ptr); extern void error(char *x); @@ -101,41 +96,6 @@ static void putstr(const char *ptr) flush(); } - -void *memcpy(void *__dest, __const void *__src, size_t __n) -{ - int i = 0; - unsigned char *d = (unsigned char *)__dest, *s = (unsigned char *)__src; - - for (i = __n >> 3; i > 0; i--) { - *d++ = *s++; - *d++ = *s++; - *d++ = *s++; - *d++ = *s++; - *d++ = *s++; - *d++ = *s++; - *d++ = *s++; - *d++ = *s++; - } - - if (__n & 1 << 2) { - *d++ = *s++; - *d++ = *s++; - *d++ = *s++; - *d++ = *s++; - } - - if (__n & 1 << 1) { - *d++ = *s++; - *d++ = *s++; - } - - if (__n & 1) - *d++ = *s++; - - return __dest; -} - /* * gzip declarations */ diff --git a/arch/arm/boot/compressed/mmcif-sh7372.c b/arch/arm/boot/compressed/mmcif-sh7372.c index 7453c83..672ae95 100644 --- a/arch/arm/boot/compressed/mmcif-sh7372.c +++ b/arch/arm/boot/compressed/mmcif-sh7372.c @@ -40,7 +40,7 @@ * to an MMC card * # dd if=vrl4.out of=/dev/sdx bs=512 seek=1 */ -asmlinkage void mmcif_loader(unsigned char *buf, unsigned long len) +asmlinkage void mmc_loader(unsigned char *buf, unsigned long len) { mmc_init_progress(); mmc_update_progress(MMC_PROGRESS_ENTER); @@ -82,7 +82,7 @@ asmlinkage void mmcif_loader(unsigned char *buf, unsigned long len) /* Disable clock to MMC hardware block */ - __raw_writel(__raw_readl(SMSTPCR3) & (1 << 12), SMSTPCR3); + __raw_writel(__raw_readl(SMSTPCR3) | (1 << 12), SMSTPCR3); mmc_update_progress(MMC_PROGRESS_DONE); } diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in index ea80abe..4919f2a 100644 --- a/arch/arm/boot/compressed/vmlinux.lds.in +++ b/arch/arm/boot/compressed/vmlinux.lds.in @@ -33,20 +33,28 @@ SECTIONS *(.text.*) *(.fixup) *(.gnu.warning) + *(.glue_7t) + *(.glue_7) + } + .rodata : { *(.rodata) *(.rodata.*) - *(.glue_7) - *(.glue_7t) + } + .piggydata : { *(.piggydata) - . = ALIGN(4); } + . = ALIGN(4); _etext = .; + .got.plt : { *(.got.plt) } _got_start = .; .got : { *(.got) } _got_end = .; - .got.plt : { *(.got.plt) } + + /* ensure the zImage file size is always a multiple of 64 bits */ + /* (without a dummy byte, ld just ignores the empty section) */ + .pad : { BYTE(0); . = ALIGN(8); } _edata = .; . = BSS_START; diff --git a/arch/arm/mach-shark/Makefile.boot b/arch/arm/mach-shark/Makefile.boot index 4320f8b..e40e24e 100644 --- a/arch/arm/mach-shark/Makefile.boot +++ b/arch/arm/mach-shark/Makefile.boot @@ -1,2 +1,2 @@ - zreladdr-y := 0x08008000 + zreladdr-y += 0x08008000 diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c index 5cf7f94..feda3ca 100644 --- a/arch/arm/mach-shark/core.c +++ b/arch/arm/mach-shark/core.c @@ -152,8 +152,9 @@ static struct sys_timer shark_timer = { MACHINE_START(SHARK, "Shark") /* Maintainer: Alexander Schulz */ - .boot_params = 0x08003000, + .atag_offset = 0x3000, .map_io = shark_map_io, .init_irq = shark_init_irq, .timer = &shark_timer, + .dma_zone_size = SZ_4M, MACHINE_END diff --git a/arch/arm/mach-shark/include/mach/debug-macro.S b/arch/arm/mach-shark/include/mach/debug-macro.S index a473f55..20eb2bf 100644 --- a/arch/arm/mach-shark/include/mach/debug-macro.S +++ b/arch/arm/mach-shark/include/mach/debug-macro.S @@ -11,7 +11,7 @@ * */ - .macro addruart, rp, rv + .macro addruart, rp, rv, tmp mov \rp, #0xe0000000 orr \rp, \rp, #0x000003f8 mov \rv, \rp diff --git a/arch/arm/mach-shark/include/mach/entry-macro.S b/arch/arm/mach-shark/include/mach/entry-macro.S index e2853c0..0bb6cc6 100644 --- a/arch/arm/mach-shark/include/mach/entry-macro.S +++ b/arch/arm/mach-shark/include/mach/entry-macro.S @@ -11,17 +11,17 @@ .endm .macro get_irqnr_preamble, base, tmp + mov \base, #0xe0000000 .endm .macro arch_ret_to_user, tmp1, tmp2 .endm .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - mov r4, #0xe0000000 mov \irqstat, #0x0C - strb \irqstat, [r4, #0x20] @outb(0x0C, 0x20) /* Poll command */ - ldrb \irqnr, [r4, #0x20] @irq = inb(0x20) & 7 + strb \irqstat, [\base, #0x20] @outb(0x0C, 0x20) /* Poll command */ + ldrb \irqnr, [\base, #0x20] @irq = inb(0x20) & 7 and \irqstat, \irqnr, #0x80 teq \irqstat, #0 beq 43f @@ -29,8 +29,8 @@ teq \irqnr, #2 bne 44f 43: mov \irqstat, #0x0C - strb \irqstat, [r4, #0xa0] @outb(0x0C, 0xA0) /* Poll command */ - ldrb \irqnr, [r4, #0xa0] @irq = (inb(0xA0) & 7) + 8 + strb \irqstat, [\base, #0xa0] @outb(0x0C, 0xA0) /* Poll command */ + ldrb \irqnr, [\base, #0xa0] @irq = (inb(0xA0) & 7) + 8 and \irqstat, \irqnr, #0x80 teq \irqstat, #0 beq 44f diff --git a/arch/arm/mach-shark/include/mach/hardware.h b/arch/arm/mach-shark/include/mach/hardware.h index 94d84b2..663f952 100644 --- a/arch/arm/mach-shark/include/mach/hardware.h +++ b/arch/arm/mach-shark/include/mach/hardware.h @@ -12,11 +12,5 @@ #define UNCACHEABLE_ADDR 0xdf010000 -#define pcibios_assign_all_busses() 1 - -#define PCIBIOS_MIN_IO 0x6000 -#define PCIBIOS_MIN_MEM 0x50000000 -#define PCIMEM_BASE 0xe8000000 - #endif diff --git a/arch/arm/mach-shark/include/mach/memory.h b/arch/arm/mach-shark/include/mach/memory.h index 4c0831f8..1cf8d69 100644 --- a/arch/arm/mach-shark/include/mach/memory.h +++ b/arch/arm/mach-shark/include/mach/memory.h @@ -17,8 +17,6 @@ */ #define PLAT_PHYS_OFFSET UL(0x08000000) -#define ARM_DMA_ZONE_SIZE SZ_4M - /* * Cache flushing area */ diff --git a/arch/arm/mach-shark/leds.c b/arch/arm/mach-shark/leds.c index c9e32de..ccd4918 100644 --- a/arch/arm/mach-shark/leds.c +++ b/arch/arm/mach-shark/leds.c @@ -36,7 +36,7 @@ static char led_state; static short hw_led_state; static short saved_state; -static DEFINE_SPINLOCK(leds_lock); +static DEFINE_RAW_SPINLOCK(leds_lock); short sequoia_read(int addr) { outw(addr,0x24); @@ -52,7 +52,7 @@ static void sequoia_leds_event(led_event_t evt) { unsigned long flags; - spin_lock_irqsave(&leds_lock, flags); + raw_spin_lock_irqsave(&leds_lock, flags); hw_led_state = sequoia_read(0x09); @@ -144,7 +144,7 @@ static void sequoia_leds_event(led_event_t evt) if (led_state & LED_STATE_ENABLED) sequoia_write(hw_led_state,0x09); - spin_unlock_irqrestore(&leds_lock, flags); + raw_spin_unlock_irqrestore(&leds_lock, flags); } static int __init leds_init(void) diff --git a/arch/arm/mach-shark/pci.c b/arch/arm/mach-shark/pci.c index 89d175c..7cb79a0 100644 --- a/arch/arm/mach-shark/pci.c +++ b/arch/arm/mach-shark/pci.c @@ -8,12 +8,13 @@ #include #include #include +#include