mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-12 07:57:21 +00:00
a78cd86132
As part of testing booting Linux kernels on Rockchip devices, it was discovered by Ziyuan Xu and Sandy Patterson that we had multiple and for some cases incomplete isb definitions. This was causing a failure to boot of the Linux kernel. In order to solve this problem as well as cover any corner cases that we may also have had a number of changes are made in order to consolidate things. First, <asm/barriers.h> now becomes the source of isb/dsb/dmb definitions. This however introduces another complexity. Due to needing to build SPL for 32bit tegra with -march=armv4 we need to borrow the __LINUX_ARM_ARCH__ logic from the Linux Kernel in a more complete form. Move this from arch/arm/lib/Makefile to arch/arm/Makefile and add a comment about it. Now that we can always know what the target CPU is capable off we can get always do the correct thing for the barrier. The final part of this is that need to be consistent everywhere and call isb()/dsb()/dmb() and NOT call ISB/DSB/DMB in some cases and the function names in others. Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Acked-by: Ziyuan Xu <xzy.xu@rock-chips.com> Acked-by: Sandy Patterson <apatterson@sightlogix.com> Reported-by: Ziyuan Xu <xzy.xu@rock-chips.com> Reported-by: Sandy Patterson <apatterson@sightlogix.com> Signed-off-by: Tom Rini <trini@konsulko.com>
51 lines
1.4 KiB
C
51 lines
1.4 KiB
C
/*
|
|
* Copyright (C) 2016 ARM Ltd.
|
|
*
|
|
* ARM and ARM64 barrier instructions
|
|
* split from armv7.h to allow sharing between ARM and ARM64
|
|
*
|
|
* Original copyright in armv7.h was:
|
|
* (C) Copyright 2010 Texas Instruments, <www.ti.com> Aneesh V <aneesh@ti.com>
|
|
*
|
|
* Much of the original barrier code was contributed by:
|
|
* Valentine Barshak <valentine.barshak@cogentembedded.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
#ifndef __BARRIERS_H__
|
|
#define __BARRIERS_H__
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#ifndef CONFIG_ARM64
|
|
/*
|
|
* CP15 Barrier instructions
|
|
* Please note that we have separate barrier instructions in ARMv7
|
|
* However, we use the CP15 based instructtions because we use
|
|
* -march=armv5 in U-Boot
|
|
*/
|
|
#define CP15ISB asm volatile ("mcr p15, 0, %0, c7, c5, 4" : : "r" (0))
|
|
#define CP15DSB asm volatile ("mcr p15, 0, %0, c7, c10, 4" : : "r" (0))
|
|
#define CP15DMB asm volatile ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0))
|
|
|
|
#endif /* !CONFIG_ARM64 */
|
|
|
|
#if __LINUX_ARM_ARCH__ >= 7
|
|
#define ISB asm volatile ("isb sy" : : : "memory")
|
|
#define DSB asm volatile ("dsb sy" : : : "memory")
|
|
#define DMB asm volatile ("dmb sy" : : : "memory")
|
|
#elif __LINUX_ARM_ARCH__ == 6
|
|
#define ISB CP15ISB
|
|
#define DSB CP15DSB
|
|
#define DMB CP15DMB
|
|
#else
|
|
#define ISB asm volatile ("" : : : "memory")
|
|
#define DSB CP15DSB
|
|
#define DMB asm volatile ("" : : : "memory")
|
|
#endif
|
|
|
|
#define isb() ISB
|
|
#define dsb() DSB
|
|
#define dmb() DMB
|
|
#endif /* __ASSEMBLY__ */
|
|
#endif /* __BARRIERS_H__ */
|