arch/mips/kernel/cevt-r4k.c
Source file repositories/reference/linux-study-clean/arch/mips/kernel/cevt-r4k.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/kernel/cevt-r4k.c- Extension
.c- Size
- 8479 bytes
- Lines
- 330
- Domain
- Architecture Layer
- Bucket
- arch/mips
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clockchips.hlinux/interrupt.hlinux/cpufreq.hlinux/percpu.hlinux/smp.hlinux/irq.hasm/time.hasm/cevt-r4k.h
Detected Declarations
function Copyrightfunction calculate_min_deltafunction handle_perf_irqfunction c0_compare_interruptfunction mips_event_handlerfunction c0_compare_int_usablefunction get_c0_compare_intfunction r4k_cpufreq_callbackfunction for_each_cpufunction r4k_register_cpufreq_notifierfunction r4k_clockevent_initmodule init r4k_register_cpufreq_notifier
Annotated Snippet
core_initcall(r4k_register_cpufreq_notifier);
#endif /* !CONFIG_CPU_FREQ */
int r4k_clockevent_init(void)
{
unsigned long flags = IRQF_PERCPU | IRQF_TIMER | IRQF_SHARED;
unsigned int cpu = smp_processor_id();
struct clock_event_device *cd;
unsigned int irq, min_delta;
if (!cpu_has_counter || !mips_hpt_frequency)
return -ENXIO;
if (!c0_compare_int_usable())
return -ENXIO;
cd = &per_cpu(mips_clockevent_device, cpu);
cd->name = "MIPS";
cd->features = CLOCK_EVT_FEAT_ONESHOT |
CLOCK_EVT_FEAT_C3STOP |
CLOCK_EVT_FEAT_PERCPU;
min_delta = calculate_min_delta();
cd->rating = 300;
cd->cpumask = cpumask_of(cpu);
cd->set_next_event = mips_next_event;
cd->event_handler = mips_event_handler;
clockevents_config_and_register(cd, mips_hpt_frequency, min_delta, 0x7fffffff);
if (cp0_timer_irq_installed)
return 0;
cp0_timer_irq_installed = 1;
/*
* With vectored interrupts things are getting platform specific.
* get_c0_compare_int is a hook to allow a platform to return the
* interrupt number of its liking.
*/
irq = get_c0_compare_int();
if (request_irq(irq, c0_compare_interrupt, flags, "timer",
c0_compare_interrupt))
pr_err("Failed to request irq %d (timer)\n", irq);
return 0;
}
Annotation
- Immediate include surface: `linux/clockchips.h`, `linux/interrupt.h`, `linux/cpufreq.h`, `linux/percpu.h`, `linux/smp.h`, `linux/irq.h`, `asm/time.h`, `asm/cevt-r4k.h`.
- Detected declarations: `function Copyright`, `function calculate_min_delta`, `function handle_perf_irq`, `function c0_compare_interrupt`, `function mips_event_handler`, `function c0_compare_int_usable`, `function get_c0_compare_int`, `function r4k_cpufreq_callback`, `function for_each_cpu`, `function r4k_register_cpufreq_notifier`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: integration implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.