[PATCH v2 3/5] ARM: use generic unaligned.h

Shawn Guo
2012-10-09T02:45:27Z

On Mon, Oct 08, 2012 at 09:27:31PM -0500, Rob Herring wrote:
> I must have had an old config with XZ. LZO fails because of this:
>
> lib/decompress_unlzo.c: version = get_unaligned_be16(parse);
> lib/decompress_unlzo.c: if (get_unaligned_be32(parse) & HEADER_HAS_FILTER)
> lib/decompress_unlzo.c: dst_len = get_unaligned_be32(in_buf);
> lib/decompress_unlzo.c: src_len = get_unaligned_be32(in_buf);
>
> This was what I was afraid of. The decompressor runs with the sysctrl
> register A bit in whatever state the bootloader left it in. In the case
> of u-boot it is set, and the maintainers are pretty set on not allowing
> unaligned accesses if you've seen the recent discussion.
>
> This should fix things.
>
> Rob
>
> 8<---------------------------------------------------------------------
>
> diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
> index bc67cbf..1f87d22 100644
> --- a/arch/arm/boot/compressed/head.S
> +++ b/arch/arm/boot/compressed/head.S
> @@ -654,6 +654,7 @@ __armv7_mmu_cache_on:
> #endif
> mrc p15, 0, r0, c1, c0, 0 @ read control reg
> bic r0, r0, #1 << 28 @ clear SCTLR.TRE
> + bic r0, r0, #1 << 1 @ clear SCTLR.A
> orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement
> orr r0, r0, #0x003c @ write buffer
> #ifdef CONFIG_MMU

Tested-by: Shawn Guo <shawn.guo@linaro.org>