arch/mips/include/asm/r4kcache.h
Source file repositories/reference/linux-study-clean/arch/mips/include/asm/r4kcache.h
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/include/asm/r4kcache.h- Extension
.h- Size
- 11468 bytes
- Lines
- 339
- Domain
- Architecture Layer
- Bucket
- arch/mips
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
Dependency Surface
linux/stringify.hasm/asm.hasm/asm-eva.hasm/cacheops.hasm/compiler.hasm/cpu-features.hasm/cpu-type.hasm/mipsmtregs.hasm/mmzone.hasm/unroll.h
Detected Declarations
function __volatile__function flush_dcache_line_indexedfunction flush_scache_line_indexedfunction flush_icache_linefunction flush_dcache_linefunction invalidate_dcache_linefunction invalidate_scache_linefunction flush_scache_linefunction protected_flush_icache_linefunction protected_writeback_dcache_linefunction protected_writeback_scache_linefunction invalidate_tcache_page
Annotated Snippet
#ifndef _ASM_R4KCACHE_H
#define _ASM_R4KCACHE_H
#include <linux/stringify.h>
#include <asm/asm.h>
#include <asm/asm-eva.h>
#include <asm/cacheops.h>
#include <asm/compiler.h>
#include <asm/cpu-features.h>
#include <asm/cpu-type.h>
#include <asm/mipsmtregs.h>
#include <asm/mmzone.h>
#include <asm/unroll.h>
extern void r5k_sc_init(void);
extern void rm7k_sc_init(void);
extern int mips_sc_init(void);
extern void (*r4k_blast_dcache)(void);
extern void (*r4k_blast_icache)(void);
/*
* This macro return a properly sign-extended address suitable as base address
* for indexed cache operations. Two issues here:
*
* - The MIPS32 and MIPS64 specs permit an implementation to directly derive
* the index bits from the virtual address. This breaks with tradition
* set by the R4000. To keep unpleasant surprises from happening we pick
* an address in KSEG0 / CKSEG0.
* - We need a properly sign extended address for 64-bit code. To get away
* without ifdefs we let the compiler do it by a type cast.
*/
#define INDEX_BASE CKSEG0
#define _cache_op(insn, op, addr) \
__asm__ __volatile__( \
" .set push \n" \
" .set noreorder \n" \
" .set "MIPS_ISA_ARCH_LEVEL" \n" \
" " insn("%0", "%1") " \n" \
" .set pop \n" \
: \
: "i" (op), "R" (*(unsigned char *)(addr)))
#define cache_op(op, addr) \
_cache_op(kernel_cache, op, addr)
static inline void flush_icache_line_indexed(unsigned long addr)
{
cache_op(Index_Invalidate_I, addr);
}
static inline void flush_dcache_line_indexed(unsigned long addr)
{
cache_op(Index_Writeback_Inv_D, addr);
}
static inline void flush_scache_line_indexed(unsigned long addr)
{
cache_op(Index_Writeback_Inv_SD, addr);
}
static inline void flush_icache_line(unsigned long addr)
{
switch (boot_cpu_type()) {
case CPU_LOONGSON2EF:
cache_op(Hit_Invalidate_I_Loongson2, addr);
break;
default:
cache_op(Hit_Invalidate_I, addr);
break;
}
}
static inline void flush_dcache_line(unsigned long addr)
{
cache_op(Hit_Writeback_Inv_D, addr);
}
static inline void invalidate_dcache_line(unsigned long addr)
{
cache_op(Hit_Invalidate_D, addr);
}
static inline void invalidate_scache_line(unsigned long addr)
{
cache_op(Hit_Invalidate_SD, addr);
}
Annotation
- Immediate include surface: `linux/stringify.h`, `asm/asm.h`, `asm/asm-eva.h`, `asm/cacheops.h`, `asm/compiler.h`, `asm/cpu-features.h`, `asm/cpu-type.h`, `asm/mipsmtregs.h`.
- Detected declarations: `function __volatile__`, `function flush_dcache_line_indexed`, `function flush_scache_line_indexed`, `function flush_icache_line`, `function flush_dcache_line`, `function invalidate_dcache_line`, `function invalidate_scache_line`, `function flush_scache_line`, `function protected_flush_icache_line`, `function protected_writeback_dcache_line`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.