2013-03-14 23:24:57 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the coreboot project.
|
|
|
|
*
|
|
|
|
* Copyright 2013 Google Inc.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
2013-03-20 01:32:54 +01:00
|
|
|
*
|
ARM: Generalize armv7 as arm.
There are ARM systems which are essentially heterogeneous multicores where
some cores implement a different ARM architecture version than other cores. A
specific example is the tegra124 which boots on an ARMv4 coprocessor while
most code, including most of the firmware, runs on the main ARMv7 core. To
support SOCs like this, the plan is to generalize the ARM architecture so that
all versions are available, and an SOC/CPU can then select what architecture
variant should be used for each component of the firmware; bootblock,
romstage, and ramstage.
Old-Change-Id: I22e048c3bc72bd56371e14200942e436c1e312c2
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://chromium-review.googlesource.com/171338
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
(cherry picked from commit 8423a41529da0ff67fb9873be1e2beb30b09ae2d)
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
ARM: Split out ARMv7 code and make it possible to have other arch versions.
We don't always want to use ARMv7 code when building for ARM, so we should
separate out the ARMv7 code so it can be excluded, and also make it possible
to include code for some other version of the architecture instead, all per
build component for cases where we need more than one architecture version
at a time.
The tegra124 bootblock will ultimately need to be ARMv4, but until we have
some ARMv4 code to switch over to we can leave it set to ARMv7.
Old-Change-Id: Ia982c91057fac9c252397b7c866224f103761cc7
Reviewed-on: https://chromium-review.googlesource.com/171400
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
(cherry picked from commit 799514e6060aa97acdcf081b5c48f965be134483)
Squashed two related patches for splitting ARM support into general
ARM support and ARMv7 specific pieces.
Change-Id: Ic6511507953a2223c87c55f90252c4a4e1dd6010
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
Reviewed-on: http://review.coreboot.org/6782
Tested-by: build bot (Jenkins)
2013-10-01 08:00:33 +02:00
|
|
|
* cache.h: Cache maintenance API for ARM
|
2013-03-14 23:24:57 +01:00
|
|
|
*/
|
|
|
|
|
ARM: Generalize armv7 as arm.
There are ARM systems which are essentially heterogeneous multicores where
some cores implement a different ARM architecture version than other cores. A
specific example is the tegra124 which boots on an ARMv4 coprocessor while
most code, including most of the firmware, runs on the main ARMv7 core. To
support SOCs like this, the plan is to generalize the ARM architecture so that
all versions are available, and an SOC/CPU can then select what architecture
variant should be used for each component of the firmware; bootblock,
romstage, and ramstage.
Old-Change-Id: I22e048c3bc72bd56371e14200942e436c1e312c2
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://chromium-review.googlesource.com/171338
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
(cherry picked from commit 8423a41529da0ff67fb9873be1e2beb30b09ae2d)
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
ARM: Split out ARMv7 code and make it possible to have other arch versions.
We don't always want to use ARMv7 code when building for ARM, so we should
separate out the ARMv7 code so it can be excluded, and also make it possible
to include code for some other version of the architecture instead, all per
build component for cases where we need more than one architecture version
at a time.
The tegra124 bootblock will ultimately need to be ARMv4, but until we have
some ARMv4 code to switch over to we can leave it set to ARMv7.
Old-Change-Id: Ia982c91057fac9c252397b7c866224f103761cc7
Reviewed-on: https://chromium-review.googlesource.com/171400
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
(cherry picked from commit 799514e6060aa97acdcf081b5c48f965be134483)
Squashed two related patches for splitting ARM support into general
ARM support and ARMv7 specific pieces.
Change-Id: Ic6511507953a2223c87c55f90252c4a4e1dd6010
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
Reviewed-on: http://review.coreboot.org/6782
Tested-by: build bot (Jenkins)
2013-10-01 08:00:33 +02:00
|
|
|
#ifndef ARM_CACHE_H
|
|
|
|
#define ARM_CACHE_H
|
2013-03-14 23:24:57 +01:00
|
|
|
|
2013-08-28 23:43:14 +02:00
|
|
|
#include <stddef.h>
|
2013-05-15 01:57:50 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2013-03-14 23:24:57 +01:00
|
|
|
/* SCTLR bits */
|
|
|
|
#define SCTLR_M (1 << 0) /* MMU enable */
|
|
|
|
#define SCTLR_A (1 << 1) /* Alignment check enable */
|
|
|
|
#define SCTLR_C (1 << 2) /* Data/unified cache enable */
|
|
|
|
/* Bits 4:3 are reserved */
|
|
|
|
#define SCTLR_CP15BEN (1 << 5) /* CP15 barrier enable */
|
|
|
|
/* Bit 6 is reserved */
|
|
|
|
#define SCTLR_B (1 << 7) /* Endianness */
|
|
|
|
/* Bits 9:8 */
|
|
|
|
#define SCTLR_SW (1 << 10) /* SWP and SWPB enable */
|
|
|
|
#define SCTLR_Z (1 << 11) /* Branch prediction enable */
|
|
|
|
#define SCTLR_I (1 << 12) /* Instruction cache enable */
|
|
|
|
#define SCTLR_V (1 << 13) /* Low/high exception vectors */
|
|
|
|
#define SCTLR_RR (1 << 14) /* Round Robin select */
|
|
|
|
/* Bits 16:15 are reserved */
|
|
|
|
#define SCTLR_HA (1 << 17) /* Hardware Access flag enable */
|
|
|
|
/* Bit 18 is reserved */
|
|
|
|
/* Bits 20:19 reserved virtualization not supported */
|
|
|
|
#define SCTLR_WXN (1 << 19) /* Write permission implies XN */
|
|
|
|
#define SCTLR_UWXN (1 << 20) /* Unprivileged write permission
|
|
|
|
implies PL1 XN */
|
|
|
|
#define SCTLR_FI (1 << 21) /* Fast interrupt config enable */
|
|
|
|
#define SCTLR_U (1 << 22) /* Unaligned access behavior */
|
|
|
|
#define SCTLR_VE (1 << 24) /* Interrupt vectors enable */
|
|
|
|
#define SCTLR_EE (1 << 25) /* Exception endianness */
|
|
|
|
/* Bit 26 is reserved */
|
|
|
|
#define SCTLR_NMFI (1 << 27) /* Non-maskable FIQ support */
|
|
|
|
#define SCTLR_TRE (1 << 28) /* TEX remap enable */
|
|
|
|
#define SCTLR_AFE (1 << 29) /* Access flag enable */
|
|
|
|
#define SCTLR_TE (1 << 30) /* Thumb exception enable */
|
|
|
|
/* Bit 31 is reserved */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sync primitives
|
|
|
|
*/
|
|
|
|
/* data memory barrier */
|
2014-08-25 07:47:20 +02:00
|
|
|
#define dmb() asm volatile ("dmb" : : : "memory")
|
2013-03-14 23:24:57 +01:00
|
|
|
/* data sync barrier */
|
2014-08-25 07:47:20 +02:00
|
|
|
#define dsb() asm volatile ("dsb" : : : "memory")
|
2013-03-14 23:24:57 +01:00
|
|
|
/* instruction sync barrier */
|
2014-08-25 07:47:20 +02:00
|
|
|
#define isb() asm volatile ("isb" : : : "memory")
|
2013-03-14 23:24:57 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Low-level TLB maintenance operations
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* invalidate entire unified TLB */
|
|
|
|
static inline void tlbiall(void)
|
|
|
|
{
|
2013-03-27 05:26:51 +01:00
|
|
|
asm volatile ("mcr p15, 0, %0, c8, c7, 0" : : "r" (0) : "memory");
|
2013-03-14 23:24:57 +01:00
|
|
|
}
|
|
|
|
|
2013-04-30 21:20:53 +02:00
|
|
|
/* invalidate unified TLB by MVA, all ASID */
|
|
|
|
static inline void tlbimvaa(unsigned long mva)
|
|
|
|
{
|
|
|
|
asm volatile ("mcr p15, 0, %0, c8, c7, 3" : : "r" (mva) : "memory");
|
|
|
|
}
|
|
|
|
|
2013-03-22 05:58:50 +01:00
|
|
|
/* write data access control register (DACR) */
|
|
|
|
static inline void write_dacr(uint32_t val)
|
|
|
|
{
|
|
|
|
asm volatile ("mcr p15, 0, %0, c3, c0, 0" : : "r" (val));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write translation table base register 0 (TTBR0) */
|
|
|
|
static inline void write_ttbr0(uint32_t val)
|
|
|
|
{
|
|
|
|
asm volatile ("mcr p15, 0, %0, c2, c0, 0" : : "r" (val) : "memory");
|
|
|
|
}
|
|
|
|
|
2014-03-06 00:46:28 +01:00
|
|
|
/* read translation table base register 0 (TTBR0) */
|
|
|
|
static inline uint64_t read_ttbr0(void)
|
|
|
|
{
|
|
|
|
uint32_t low, high;
|
|
|
|
asm volatile ("mrrc p15, 0, %[low], %[high], c2" :
|
|
|
|
[low] "=r" (low), [high] "=r" (high));
|
|
|
|
return ((uint64_t)high << 32) | low;
|
|
|
|
}
|
|
|
|
|
2013-03-22 05:58:50 +01:00
|
|
|
/* read translation table base control register (TTBCR) */
|
|
|
|
static inline uint32_t read_ttbcr(void)
|
|
|
|
{
|
|
|
|
uint32_t val = 0;
|
|
|
|
asm volatile ("mrc p15, 0, %0, c2, c0, 2" : "=r" (val));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write translation table base control register (TTBCR) */
|
|
|
|
static inline void write_ttbcr(uint32_t val)
|
|
|
|
{
|
|
|
|
asm volatile ("mcr p15, 0, %0, c2, c0, 2" : : "r" (val) : "memory");
|
|
|
|
}
|
|
|
|
|
2013-03-14 23:24:57 +01:00
|
|
|
/*
|
|
|
|
* Low-level cache maintenance operations
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* branch predictor invalidate all */
|
|
|
|
static inline void bpiall(void)
|
|
|
|
{
|
|
|
|
asm volatile ("mcr p15, 0, %0, c7, c5, 6" : : "r" (0));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* data cache clean and invalidate by MVA to PoC */
|
|
|
|
static inline void dccimvac(unsigned long mva)
|
|
|
|
{
|
2013-03-27 05:26:51 +01:00
|
|
|
asm volatile ("mcr p15, 0, %0, c7, c14, 1" : : "r" (mva) : "memory");
|
2013-03-14 23:24:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* data cache invalidate by set/way */
|
|
|
|
static inline void dccisw(uint32_t val)
|
|
|
|
{
|
2013-03-27 05:26:51 +01:00
|
|
|
asm volatile ("mcr p15, 0, %0, c7, c14, 2" : : "r" (val) : "memory");
|
2013-03-14 23:24:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* data cache clean by MVA to PoC */
|
|
|
|
static inline void dccmvac(unsigned long mva)
|
|
|
|
{
|
2013-03-27 05:26:51 +01:00
|
|
|
asm volatile ("mcr p15, 0, %0, c7, c10, 1" : : "r" (mva) : "memory");
|
2013-03-14 23:24:57 +01:00
|
|
|
}
|
|
|
|
|
2013-08-16 21:17:50 +02:00
|
|
|
/* data cache clean by set/way */
|
|
|
|
static inline void dccsw(uint32_t val)
|
|
|
|
{
|
|
|
|
asm volatile ("mcr p15, 0, %0, c7, c10, 2" : : "r" (val) : "memory");
|
|
|
|
}
|
|
|
|
|
2013-03-14 23:24:57 +01:00
|
|
|
/* data cache invalidate by MVA to PoC */
|
|
|
|
static inline void dcimvac(unsigned long mva)
|
|
|
|
{
|
2013-03-27 05:26:51 +01:00
|
|
|
asm volatile ("mcr p15, 0, %0, c7, c6, 1" : : "r" (mva) : "memory");
|
2013-03-14 23:24:57 +01:00
|
|
|
}
|
|
|
|
|
2013-03-20 01:32:54 +01:00
|
|
|
/* data cache invalidate by set/way */
|
|
|
|
static inline void dcisw(uint32_t val)
|
|
|
|
{
|
2013-03-27 05:26:51 +01:00
|
|
|
asm volatile ("mcr p15, 0, %0, c7, c6, 2" : : "r" (val) : "memory");
|
2013-03-20 01:32:54 +01:00
|
|
|
}
|
|
|
|
|
2013-03-14 23:24:57 +01:00
|
|
|
/* instruction cache invalidate all by PoU */
|
|
|
|
static inline void iciallu(void)
|
|
|
|
{
|
|
|
|
asm volatile ("mcr p15, 0, %0, c7, c5, 0" : : "r" (0));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Cache co-processor (CP15) access functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* read cache level ID register (CLIDR) */
|
|
|
|
static inline uint32_t read_clidr(void)
|
|
|
|
{
|
|
|
|
uint32_t val = 0;
|
|
|
|
asm volatile ("mrc p15, 1, %0, c0, c0, 1" : "=r" (val));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read cache size ID register register (CCSIDR) */
|
|
|
|
static inline uint32_t read_ccsidr(void)
|
|
|
|
{
|
|
|
|
uint32_t val = 0;
|
|
|
|
asm volatile ("mrc p15, 1, %0, c0, c0, 0" : "=r" (val));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read cache size selection register (CSSELR) */
|
|
|
|
static inline uint32_t read_csselr(void)
|
|
|
|
{
|
|
|
|
uint32_t val = 0;
|
|
|
|
asm volatile ("mrc p15, 2, %0, c0, c0, 0" : "=r" (val));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write to cache size selection register (CSSELR) */
|
|
|
|
static inline void write_csselr(uint32_t val)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Bits [3:1] - Cache level + 1 (0b000 = L1, 0b110 = L7, 0b111 is rsvd)
|
|
|
|
* Bit 0 - 0 = data or unified cache, 1 = instruction cache
|
|
|
|
*/
|
|
|
|
asm volatile ("mcr p15, 2, %0, c0, c0, 0" : : "r" (val));
|
|
|
|
isb(); /* ISB to sync the change to CCSIDR */
|
|
|
|
}
|
|
|
|
|
2013-03-29 03:04:14 +01:00
|
|
|
/* read L2 control register (L2CTLR) */
|
2013-03-29 23:40:34 +01:00
|
|
|
static inline uint32_t read_l2ctlr(void)
|
2013-03-29 03:04:14 +01:00
|
|
|
{
|
2013-03-29 23:40:34 +01:00
|
|
|
uint32_t val = 0;
|
2013-03-29 03:04:14 +01:00
|
|
|
asm volatile ("mrc p15, 1, %0, c9, c0, 2" : "=r" (val));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write L2 control register (L2CTLR) */
|
|
|
|
static inline void write_l2ctlr(uint32_t val)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Note: L2CTLR can only be written when the L2 memory system
|
|
|
|
* is idle, ie before the MMU is enabled.
|
|
|
|
*/
|
|
|
|
asm volatile("mcr p15, 1, %0, c9, c0, 2" : : "r" (val) : "memory" );
|
|
|
|
isb();
|
|
|
|
}
|
|
|
|
|
2013-08-07 02:32:41 +02:00
|
|
|
/* read L2 Auxiliary Control Register (L2ACTLR) */
|
|
|
|
static inline uint32_t read_l2actlr(void)
|
|
|
|
{
|
|
|
|
uint32_t val = 0;
|
|
|
|
asm volatile ("mrc p15, 1, %0, c15, c0, 0" : "=r" (val));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write L2 Auxiliary Control Register (L2ACTLR) */
|
|
|
|
static inline void write_l2actlr(uint32_t val)
|
|
|
|
{
|
|
|
|
asm volatile ("mcr p15, 1, %0, c15, c0, 0" : : "r" (val) : "memory" );
|
|
|
|
isb();
|
|
|
|
}
|
|
|
|
|
2013-03-14 23:24:57 +01:00
|
|
|
/* read system control register (SCTLR) */
|
2013-03-29 23:40:34 +01:00
|
|
|
static inline uint32_t read_sctlr(void)
|
2013-03-14 23:24:57 +01:00
|
|
|
{
|
2013-03-29 23:40:34 +01:00
|
|
|
uint32_t val;
|
2013-03-27 05:26:51 +01:00
|
|
|
asm volatile ("mrc p15, 0, %0, c1, c0, 0" : "=r" (val));
|
2013-03-14 23:24:57 +01:00
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write system control register (SCTLR) */
|
2013-03-27 05:26:51 +01:00
|
|
|
static inline void write_sctlr(uint32_t val)
|
2013-03-14 23:24:57 +01:00
|
|
|
{
|
|
|
|
asm volatile ("mcr p15, 0, %0, c1, c0, 0" : : "r" (val) : "cc");
|
|
|
|
isb();
|
|
|
|
}
|
|
|
|
|
2014-10-16 19:23:36 +02:00
|
|
|
/* read data fault address register (DFAR) */
|
|
|
|
static inline uint32_t read_dfar(void)
|
|
|
|
{
|
|
|
|
uint32_t val;
|
|
|
|
asm volatile ("mrc p15, 0, %0, c6, c0, 0" : "=r" (val));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read data fault status register (DFSR) */
|
|
|
|
static inline uint32_t read_dfsr(void)
|
|
|
|
{
|
|
|
|
uint32_t val;
|
|
|
|
asm volatile ("mrc p15, 0, %0, c5, c0, 0" : "=r" (val));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read instruction fault address register (IFAR) */
|
|
|
|
static inline uint32_t read_ifar(void)
|
|
|
|
{
|
|
|
|
uint32_t val;
|
|
|
|
asm volatile ("mrc p15, 0, %0, c6, c0, 2" : "=r" (val));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read instruction fault status register (IFSR) */
|
|
|
|
static inline uint32_t read_ifsr(void)
|
|
|
|
{
|
|
|
|
uint32_t val;
|
|
|
|
asm volatile ("mrc p15, 0, %0, c5, c0, 1" : "=r" (val));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read auxiliary data fault status register (ADFSR) */
|
|
|
|
static inline uint32_t read_adfsr(void)
|
|
|
|
{
|
|
|
|
uint32_t val;
|
|
|
|
asm volatile ("mrc p15, 0, %0, c5, c1, 0" : "=r" (val));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read auxiliary instruction fault status register (AIFSR) */
|
|
|
|
static inline uint32_t read_aifsr(void)
|
|
|
|
{
|
|
|
|
uint32_t val;
|
|
|
|
asm volatile ("mrc p15, 0, %0, c5, c1, 1" : "=r" (val));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2013-03-14 23:24:57 +01:00
|
|
|
/*
|
|
|
|
* Cache maintenance API
|
|
|
|
*/
|
|
|
|
|
2013-03-20 01:32:54 +01:00
|
|
|
/* dcache clean and invalidate all (on current level given by CCSELR) */
|
2013-03-14 23:24:57 +01:00
|
|
|
void dcache_clean_invalidate_all(void);
|
|
|
|
|
2013-03-20 02:38:48 +01:00
|
|
|
/* dcache clean by modified virtual address to PoC */
|
2013-08-28 23:43:14 +02:00
|
|
|
void dcache_clean_by_mva(void const *addr, size_t len);
|
2013-03-20 02:38:48 +01:00
|
|
|
|
2013-03-20 01:32:54 +01:00
|
|
|
/* dcache clean and invalidate by modified virtual address to PoC */
|
2013-08-28 23:43:14 +02:00
|
|
|
void dcache_clean_invalidate_by_mva(void const *addr, size_t len);
|
2013-03-14 23:24:57 +01:00
|
|
|
|
2013-08-16 21:17:50 +02:00
|
|
|
/* dcache invalidate by modified virtual address to PoC */
|
2013-08-28 23:43:14 +02:00
|
|
|
void dcache_invalidate_by_mva(void const *addr, size_t len);
|
2013-08-16 21:17:50 +02:00
|
|
|
|
|
|
|
void dcache_clean_all(void);
|
|
|
|
|
2013-03-20 01:32:54 +01:00
|
|
|
/* dcache invalidate all (on current level given by CCSELR) */
|
|
|
|
void dcache_invalidate_all(void);
|
|
|
|
|
2013-10-10 08:45:07 +02:00
|
|
|
/* returns number of bytes per cache line */
|
|
|
|
unsigned int dcache_line_bytes(void);
|
|
|
|
|
2013-03-22 05:58:50 +01:00
|
|
|
/* dcache and MMU disable */
|
|
|
|
void dcache_mmu_disable(void);
|
|
|
|
|
|
|
|
/* dcache and MMU enable */
|
|
|
|
void dcache_mmu_enable(void);
|
|
|
|
|
2014-01-22 05:11:22 +01:00
|
|
|
/* perform all icache/dcache maintenance needed after loading new code */
|
|
|
|
void cache_sync_instructions(void);
|
2013-03-14 23:24:57 +01:00
|
|
|
|
2013-03-20 01:32:54 +01:00
|
|
|
/* tlb invalidate all */
|
|
|
|
void tlb_invalidate_all(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Generalized setup/init functions
|
|
|
|
*/
|
|
|
|
|
2013-03-22 05:58:50 +01:00
|
|
|
/* mmu initialization (set page table address, set permissions, etc) */
|
|
|
|
void mmu_init(void);
|
|
|
|
|
|
|
|
enum dcache_policy {
|
|
|
|
DCACHE_OFF,
|
|
|
|
DCACHE_WRITEBACK,
|
|
|
|
DCACHE_WRITETHROUGH,
|
|
|
|
};
|
|
|
|
|
2013-04-30 19:11:30 +02:00
|
|
|
/* disable the mmu for a range. Primarily useful to lock out address 0. */
|
|
|
|
void mmu_disable_range(unsigned long start_mb, unsigned long size_mb);
|
2013-03-22 05:58:50 +01:00
|
|
|
/* mmu range configuration (set dcache policy) */
|
|
|
|
void mmu_config_range(unsigned long start_mb, unsigned long size_mb,
|
|
|
|
enum dcache_policy policy);
|
2013-03-14 23:24:57 +01:00
|
|
|
|
ARM: Generalize armv7 as arm.
There are ARM systems which are essentially heterogeneous multicores where
some cores implement a different ARM architecture version than other cores. A
specific example is the tegra124 which boots on an ARMv4 coprocessor while
most code, including most of the firmware, runs on the main ARMv7 core. To
support SOCs like this, the plan is to generalize the ARM architecture so that
all versions are available, and an SOC/CPU can then select what architecture
variant should be used for each component of the firmware; bootblock,
romstage, and ramstage.
Old-Change-Id: I22e048c3bc72bd56371e14200942e436c1e312c2
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://chromium-review.googlesource.com/171338
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
(cherry picked from commit 8423a41529da0ff67fb9873be1e2beb30b09ae2d)
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
ARM: Split out ARMv7 code and make it possible to have other arch versions.
We don't always want to use ARMv7 code when building for ARM, so we should
separate out the ARMv7 code so it can be excluded, and also make it possible
to include code for some other version of the architecture instead, all per
build component for cases where we need more than one architecture version
at a time.
The tegra124 bootblock will ultimately need to be ARMv4, but until we have
some ARMv4 code to switch over to we can leave it set to ARMv7.
Old-Change-Id: Ia982c91057fac9c252397b7c866224f103761cc7
Reviewed-on: https://chromium-review.googlesource.com/171400
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
(cherry picked from commit 799514e6060aa97acdcf081b5c48f965be134483)
Squashed two related patches for splitting ARM support into general
ARM support and ARMv7 specific pieces.
Change-Id: Ic6511507953a2223c87c55f90252c4a4e1dd6010
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
Reviewed-on: http://review.coreboot.org/6782
Tested-by: build bot (Jenkins)
2013-10-01 08:00:33 +02:00
|
|
|
#endif /* ARM_CACHE_H */
|