coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
cache.h File Reference
#include <stddef.h>
#include <stdint.h>
Include dependency graph for cache.h:

Go to the source code of this file.

Macros

#define SCTLR_M   (1 << 0) /* MMU enable */
 
#define SCTLR_A   (1 << 1) /* Alignment check enable */
 
#define SCTLR_C   (1 << 2) /* Data/unified cache enable */
 
#define SCTLR_CP15BEN   (1 << 5) /* CP15 barrier enable */
 
#define SCTLR_B   (1 << 7) /* Endianness */
 
#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 */
 
#define SCTLR_HA   (1 << 17) /* Hardware Access flag enable */
 
#define SCTLR_WXN   (1 << 19) /* Write permission implies XN */
 
#define SCTLR_UWXN
 
#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 */
 
#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 */
 

Enumerations

enum  dcache_policy { DCACHE_OFF , DCACHE_WRITEBACK , DCACHE_WRITETHROUGH }
 

Functions

static void dmb (void)
 
static void dsb (void)
 
static void isb (void)
 
static void tlbiall (void)
 
static void tlbimva (unsigned long mva)
 
static void write_dacr (uint32_t val)
 
static uint32_t read_mmfr0 (void)
 
static uint32_t read_mair0 (void)
 
static void write_mair0 (uint32_t val)
 
static void write_ttbr0 (uint32_t val)
 
static uint32_t read_ttbcr (void)
 
static void write_ttbcr (uint32_t val)
 
static void bpiall (void)
 
static void dccimvac (unsigned long mva)
 
static void dccisw (uint32_t val)
 
static void dccmvac (unsigned long mva)
 
static void dccsw (uint32_t val)
 
static void dcimvac (unsigned long mva)
 
static void dcisw (uint32_t val)
 
static void iciallu (void)
 
static uint32_t read_clidr (void)
 
static uint32_t read_ccsidr (void)
 
static uint32_t read_csselr (void)
 
static void write_csselr (uint32_t val)
 
static uint32_t read_l2ctlr (void)
 
static void write_l2ctlr (uint32_t val)
 
static uint32_t read_l2actlr (void)
 
static void write_l2actlr (uint32_t val)
 
static uint32_t read_sctlr (void)
 
static void write_sctlr (uint32_t val)
 
static uint32_t read_dfar (void)
 
static uint32_t read_dfsr (void)
 
static uint32_t read_ifar (void)
 
static uint32_t read_ifsr (void)
 
static uint32_t read_adfsr (void)
 
static uint32_t read_aifsr (void)
 
void dcache_clean_invalidate_all (void)
 
void dcache_clean_by_mva (void const *addr, size_t len)
 
void dcache_clean_invalidate_by_mva (void const *addr, size_t len)
 
void dcache_invalidate_by_mva (void const *addr, size_t len)
 
void dcache_clean_all (void)
 
void dcache_invalidate_all (void)
 
unsigned int dcache_line_bytes (void)
 
void dcache_mmu_disable (void)
 
void dcache_mmu_enable (void)
 
void cache_sync_instructions (void)
 
void tlb_invalidate_all (void)
 
void mmu_init (void)
 
void mmu_disable_range (u32 start_mb, u32 size_mb)
 
void mmu_config_range (u32 start_mb, u32 size_mb, enum dcache_policy policy)
 
void mmu_config_range_kb (u32 start_kb, u32 size_kb, enum dcache_policy policy)
 
void mmu_disable_range_kb (u32 start_kb, u32 size_kb)
 

Macro Definition Documentation

◆ SCTLR_A

#define SCTLR_A   (1 << 1) /* Alignment check enable */

Definition at line 14 of file cache.h.

◆ SCTLR_AFE

#define SCTLR_AFE   (1 << 29) /* Access flag enable */

Definition at line 39 of file cache.h.

◆ SCTLR_B

#define SCTLR_B   (1 << 7) /* Endianness */

Definition at line 19 of file cache.h.

◆ SCTLR_C

#define SCTLR_C   (1 << 2) /* Data/unified cache enable */

Definition at line 15 of file cache.h.

◆ SCTLR_CP15BEN

#define SCTLR_CP15BEN   (1 << 5) /* CP15 barrier enable */

Definition at line 17 of file cache.h.

◆ SCTLR_EE

#define SCTLR_EE   (1 << 25) /* Exception endianness */

Definition at line 35 of file cache.h.

◆ SCTLR_FI

#define SCTLR_FI   (1 << 21) /* Fast interrupt config enable */

Definition at line 32 of file cache.h.

◆ SCTLR_HA

#define SCTLR_HA   (1 << 17) /* Hardware Access flag enable */

Definition at line 27 of file cache.h.

◆ SCTLR_I

#define SCTLR_I   (1 << 12) /* Instruction cache enable */

Definition at line 23 of file cache.h.

◆ SCTLR_M

#define SCTLR_M   (1 << 0) /* MMU enable */

Definition at line 13 of file cache.h.

◆ SCTLR_NMFI

#define SCTLR_NMFI   (1 << 27) /* Non-maskable FIQ support */

Definition at line 37 of file cache.h.

◆ SCTLR_RR

#define SCTLR_RR   (1 << 14) /* Round Robin select */

Definition at line 25 of file cache.h.

◆ SCTLR_SW

#define SCTLR_SW   (1 << 10) /* SWP and SWPB enable */

Definition at line 21 of file cache.h.

◆ SCTLR_TE

#define SCTLR_TE   (1 << 30) /* Thumb exception enable */

Definition at line 40 of file cache.h.

◆ SCTLR_TRE

#define SCTLR_TRE   (1 << 28) /* TEX remap enable */

Definition at line 38 of file cache.h.

◆ SCTLR_U

#define SCTLR_U   (1 << 22) /* Unaligned access behavior */

Definition at line 33 of file cache.h.

◆ SCTLR_UWXN

#define SCTLR_UWXN
Value:
(1 << 20) /* Unprivileged write permission
implies PL1 XN */

Definition at line 31 of file cache.h.

◆ SCTLR_V

#define SCTLR_V   (1 << 13) /* Low/high exception vectors */

Definition at line 24 of file cache.h.

◆ SCTLR_VE

#define SCTLR_VE   (1 << 24) /* Interrupt vectors enable */

Definition at line 34 of file cache.h.

◆ SCTLR_WXN

#define SCTLR_WXN   (1 << 19) /* Write permission implies XN */

Definition at line 30 of file cache.h.

◆ SCTLR_Z

#define SCTLR_Z   (1 << 11) /* Branch prediction enable */

Definition at line 22 of file cache.h.

Enumeration Type Documentation

◆ dcache_policy

Enumerator
DCACHE_OFF 
DCACHE_WRITEBACK 
DCACHE_WRITETHROUGH 

Definition at line 362 of file cache.h.

Function Documentation

◆ bpiall()

static void bpiall ( void  )
inlinestatic

Definition at line 135 of file cache.h.

◆ cache_sync_instructions()

void cache_sync_instructions ( void  )

Definition at line 57 of file cache.c.

References dcache_clean_all(), dcache_clean_invalidate_all(), dsb, iciallu(), isb, read_sctlr(), SCTLR_C, and SCTLR_I.

Referenced by arch_prog_run(), arch_segment_loaded(), and load_ipq_blob().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dcache_clean_all()

void dcache_clean_all ( void  )

Definition at line 14 of file cache.c.

◆ dcache_clean_by_mva()

void dcache_clean_by_mva ( void const *  addr,
size_t  len 
)

Definition at line 37 of file cache.c.

◆ dcache_clean_invalidate_all()

void dcache_clean_invalidate_all ( void  )

Definition at line 18 of file cache.c.

◆ dcache_clean_invalidate_by_mva()

void dcache_clean_invalidate_by_mva ( void const *  addr,
size_t  len 
)

Definition at line 41 of file cache.c.

◆ dcache_invalidate_all()

void dcache_invalidate_all ( void  )

Definition at line 22 of file cache.c.

◆ dcache_invalidate_by_mva()

void dcache_invalidate_by_mva ( void const *  addr,
size_t  len 
)

Definition at line 45 of file cache.c.

◆ dcache_line_bytes()

unsigned int dcache_line_bytes ( void  )

Definition at line 26 of file cache.c.

◆ dcache_mmu_disable()

void dcache_mmu_disable ( void  )

Definition at line 49 of file cache.c.

References dcache_clean_invalidate_all(), read_sctlr(), SCTLR_C, SCTLR_M, and write_sctlr().

Referenced by arch_prog_run(), mainboard_init(), setup_mmu(), usb_cbfs_open(), and wakeup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dcache_mmu_enable()

void dcache_mmu_enable ( void  )

Definition at line 53 of file cache.c.

References read_sctlr(), SCTLR_C, SCTLR_M, and write_sctlr().

Referenced by bootblock_soc_init(), enable_cache(), mainboard_enable(), romstage(), setup_mmu(), and usb_cbfs_open().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dccimvac()

static void dccimvac ( unsigned long  mva)
inlinestatic

Definition at line 141 of file cache.h.

Referenced by dcache_op_mva().

Here is the caller graph for this function:

◆ dccisw()

static void dccisw ( uint32_t  val)
inlinestatic

Definition at line 147 of file cache.h.

References val.

◆ dccmvac()

static void dccmvac ( unsigned long  mva)
inlinestatic

Definition at line 153 of file cache.h.

Referenced by dcache_op_mva(), mmu_create_subtable(), and mmu_fill_table().

Here is the caller graph for this function:

◆ dccsw()

static void dccsw ( uint32_t  val)
inlinestatic

Definition at line 159 of file cache.h.

References val.

◆ dcimvac()

static void dcimvac ( unsigned long  mva)
inlinestatic

Definition at line 165 of file cache.h.

Referenced by dcache_op_mva().

Here is the caller graph for this function:

◆ dcisw()

static void dcisw ( uint32_t  val)
inlinestatic

Definition at line 171 of file cache.h.

References val.

◆ dmb()

static void dmb ( void  )
inlinestatic

Definition at line 48 of file cache.h.

◆ dsb()

static void dsb ( void  )
inlinestatic

Definition at line 54 of file cache.h.

Referenced by icache_invalidate_all(), and tlb_invalidate_all().

Here is the caller graph for this function:

◆ iciallu()

static void iciallu ( void  )
inlinestatic

Definition at line 177 of file cache.h.

Referenced by cache_sync_instructions(), icache_invalidate_all(), and low_power_start().

Here is the caller graph for this function:

◆ isb()

static void isb ( void  )
inlinestatic

Definition at line 60 of file cache.h.

Referenced by icache_invalidate_all(), tlb_invalidate_all(), write_csselr(), write_l2actlr(), write_l2ctlr(), and write_sctlr().

Here is the caller graph for this function:

◆ mmu_config_range()

◆ mmu_config_range_kb()

void mmu_config_range_kb ( u32  start_kb,
u32  size_kb,
enum dcache_policy  policy 
)

Definition at line 174 of file mmu.c.

References ALIGN_UP, assert, ATTR_PAGE, attrs, BIOS_DEBUG, BLOCK_SIZE, CONFIG, KiB, mask, mmu_fill_table(), mmu_validate_create_sub_table(), name, PAGE_SHIFT, PAGE_SIZE, and printk.

Referenced by bootblock_soc_init(), and setup_mmu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmu_disable_range()

void mmu_disable_range ( u32  start_mb,
u32  size_mb 
)

Definition at line 211 of file mmu.c.

References assert, BIOS_DEBUG, BLOCK_SHIFT, BLOCK_SIZE, DIV_ROUND_UP, GiB, MiB, mmu_fill_table(), printk, and ttb_buff.

Referenced by bootblock_soc_init(), enable_cache(), romstage(), setup_dram_mappings(), and setup_mmu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmu_disable_range_kb()

void mmu_disable_range_kb ( u32  start_kb,
u32  size_kb 
)

Definition at line 198 of file mmu.c.

References BIOS_DEBUG, BLOCK_SIZE, DIV_ROUND_UP, KiB, mask, mmu_fill_table(), mmu_validate_create_sub_table(), PAGE_SHIFT, PAGE_SIZE, and printk.

Referenced by setup_mmu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmu_init()

void mmu_init ( void  )

Definition at line 242 of file mmu.c.

◆ read_adfsr()

static uint32_t read_adfsr ( void  )
inlinestatic

Definition at line 303 of file cache.h.

References val.

Referenced by exception_data_abort().

Here is the caller graph for this function:

◆ read_aifsr()

static uint32_t read_aifsr ( void  )
inlinestatic

Definition at line 311 of file cache.h.

References val.

Referenced by exception_prefetch_abort().

Here is the caller graph for this function:

◆ read_ccsidr()

static uint32_t read_ccsidr ( void  )
inlinestatic

Definition at line 195 of file cache.h.

References val.

Referenced by dcache_line_bytes().

Here is the caller graph for this function:

◆ read_clidr()

static uint32_t read_clidr ( void  )
inlinestatic

Definition at line 187 of file cache.h.

References val.

◆ read_csselr()

static uint32_t read_csselr ( void  )
inlinestatic

Definition at line 203 of file cache.h.

References val.

◆ read_dfar()

static uint32_t read_dfar ( void  )
inlinestatic

Definition at line 271 of file cache.h.

References val.

Referenced by exception_data_abort().

Here is the caller graph for this function:

◆ read_dfsr()

static uint32_t read_dfsr ( void  )
inlinestatic

Definition at line 279 of file cache.h.

References val.

Referenced by exception_data_abort().

Here is the caller graph for this function:

◆ read_ifar()

static uint32_t read_ifar ( void  )
inlinestatic

Definition at line 287 of file cache.h.

References val.

Referenced by exception_prefetch_abort().

Here is the caller graph for this function:

◆ read_ifsr()

static uint32_t read_ifsr ( void  )
inlinestatic

Definition at line 295 of file cache.h.

References val.

Referenced by exception_prefetch_abort().

Here is the caller graph for this function:

◆ read_l2actlr()

static uint32_t read_l2actlr ( void  )
inlinestatic

Definition at line 241 of file cache.h.

References val.

Referenced by configure_l2actlr().

Here is the caller graph for this function:

◆ read_l2ctlr()

static uint32_t read_l2ctlr ( void  )
inlinestatic

Definition at line 222 of file cache.h.

References val.

Referenced by configure_l2ctlr().

Here is the caller graph for this function:

◆ read_mair0()

static uint32_t read_mair0 ( void  )
inlinestatic

Definition at line 95 of file cache.h.

◆ read_mmfr0()

static uint32_t read_mmfr0 ( void  )
inlinestatic

Definition at line 88 of file cache.h.

Referenced by mmu_init().

Here is the caller graph for this function:

◆ read_sctlr()

static uint32_t read_sctlr ( void  )
inlinestatic

Definition at line 256 of file cache.h.

References val.

Referenced by cache_sync_instructions(), dcache_mmu_disable(), dcache_mmu_enable(), exception_init(), and low_power_start().

Here is the caller graph for this function:

◆ read_ttbcr()

static uint32_t read_ttbcr ( void  )
inlinestatic

Definition at line 117 of file cache.h.

References val.

◆ tlb_invalidate_all()

void tlb_invalidate_all ( void  )

Definition at line 10 of file cache.c.

References dsb, isb, and tlbiall().

Referenced by mmu_restore_context().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tlbiall()

static void tlbiall ( void  )
inlinestatic

Definition at line 70 of file cache.h.

Referenced by low_power_start(), and tlb_invalidate_all().

Here is the caller graph for this function:

◆ tlbimva()

static void tlbimva ( unsigned long  mva)
inlinestatic

Definition at line 76 of file cache.h.

Referenced by mmu_create_subtable(), and mmu_fill_table().

Here is the caller graph for this function:

◆ write_csselr()

static void write_csselr ( uint32_t  val)
inlinestatic

Definition at line 211 of file cache.h.

References isb(), and val.

Here is the call graph for this function:

◆ write_dacr()

static void write_dacr ( uint32_t  val)
inlinestatic

Definition at line 82 of file cache.h.

References val.

Referenced by mmu_init().

Here is the caller graph for this function:

◆ write_l2actlr()

static void write_l2actlr ( uint32_t  val)
inlinestatic

Definition at line 249 of file cache.h.

References isb(), and val.

Referenced by configure_l2actlr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_l2ctlr()

static void write_l2ctlr ( uint32_t  val)
inlinestatic

Definition at line 230 of file cache.h.

References isb(), and val.

Referenced by configure_l2ctlr(), and exynos5250_config_l2_cache().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_mair0()

static void write_mair0 ( uint32_t  val)
inlinestatic

Definition at line 102 of file cache.h.

References val.

Referenced by mmu_init().

Here is the caller graph for this function:

◆ write_sctlr()

static void write_sctlr ( uint32_t  val)
inlinestatic

Definition at line 264 of file cache.h.

References isb(), and val.

Referenced by dcache_mmu_disable(), dcache_mmu_enable(), exception_init(), and low_power_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_ttbcr()

static void write_ttbcr ( uint32_t  val)
inlinestatic

Definition at line 125 of file cache.h.

References val.

Referenced by mmu_init().

Here is the caller graph for this function:

◆ write_ttbr0()

static void write_ttbr0 ( uint32_t  val)
inlinestatic

Definition at line 107 of file cache.h.

References CONFIG, and val.

Referenced by mmu_init().

Here is the caller graph for this function: