arch/mips/mm/sc-rm7k.c
Source file repositories/reference/linux-study-clean/arch/mips/mm/sc-rm7k.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/mm/sc-rm7k.c- Extension
.c- Size
- 5550 bytes
- Lines
- 271
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/mm.hlinux/bitops.hasm/addrspace.hasm/bcache.hasm/cacheops.hasm/mipsregs.hasm/processor.hasm/sections.hasm/cacheflush.hasm/r4kcache.h
Detected Declarations
function rm7k_sc_wback_invfunction rm7k_sc_invfunction blast_rm7k_tcachefunction __rm7k_tc_enablefunction rm7k_tc_enablefunction __rm7k_sc_enablefunction rm7k_sc_enablefunction rm7k_tc_disablefunction rm7k_sc_disablefunction __probe_tcachefunction rm7k_sc_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* sc-rm7k.c: RM7000 cache management functions.
*
* Copyright (C) 1997, 2001, 2003, 2004 Ralf Baechle (ralf@linux-mips.org)
*/
#undef DEBUG
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/bitops.h>
#include <asm/addrspace.h>
#include <asm/bcache.h>
#include <asm/cacheops.h>
#include <asm/mipsregs.h>
#include <asm/processor.h>
#include <asm/sections.h>
#include <asm/cacheflush.h> /* for run_uncached() */
/* Primary cache parameters. */
#define sc_lsize 32
#define tc_pagesize (32*128)
/* Secondary cache parameters. */
#define scache_size (256*1024) /* Fixed to 256KiB on RM7000 */
/* Tertiary cache parameters */
#define tc_lsize 32
extern unsigned long icache_way_size, dcache_way_size;
static unsigned long tcache_size;
#include <asm/r4kcache.h>
static int rm7k_tcache_init;
/*
* Writeback and invalidate the primary cache dcache before DMA.
* (XXX These need to be fixed ...)
*/
static void rm7k_sc_wback_inv(unsigned long addr, unsigned long size)
{
unsigned long end, a;
pr_debug("rm7k_sc_wback_inv[%08lx,%08lx]", addr, size);
/* Catch bad driver code */
BUG_ON(size == 0);
blast_scache_range(addr, addr + size);
if (!rm7k_tcache_init)
return;
a = addr & ~(tc_pagesize - 1);
end = (addr + size - 1) & ~(tc_pagesize - 1);
while(1) {
invalidate_tcache_page(a); /* Page_Invalidate_T */
if (a == end)
break;
a += tc_pagesize;
}
}
static void rm7k_sc_inv(unsigned long addr, unsigned long size)
{
unsigned long end, a;
pr_debug("rm7k_sc_inv[%08lx,%08lx]", addr, size);
/* Catch bad driver code */
BUG_ON(size == 0);
blast_inv_scache_range(addr, addr + size);
if (!rm7k_tcache_init)
return;
a = addr & ~(tc_pagesize - 1);
end = (addr + size - 1) & ~(tc_pagesize - 1);
while(1) {
invalidate_tcache_page(a); /* Page_Invalidate_T */
if (a == end)
break;
a += tc_pagesize;
}
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/mm.h`, `linux/bitops.h`, `asm/addrspace.h`, `asm/bcache.h`, `asm/cacheops.h`, `asm/mipsregs.h`, `asm/processor.h`.
- Detected declarations: `function rm7k_sc_wback_inv`, `function rm7k_sc_inv`, `function blast_rm7k_tcache`, `function __rm7k_tc_enable`, `function rm7k_tc_enable`, `function __rm7k_sc_enable`, `function rm7k_sc_enable`, `function rm7k_tc_disable`, `function rm7k_sc_disable`, `function __probe_tcache`.
- 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.