arch/arm/include/asm/arch_timer.h
Source file repositories/reference/linux-study-clean/arch/arm/include/asm/arch_timer.h
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/include/asm/arch_timer.h- Extension
.h- Size
- 3124 bytes
- Lines
- 147
- Domain
- Architecture Layer
- Bucket
- arch/arm
- 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
asm/barrier.hasm/errno.hasm/hwcap.hlinux/clocksource.hlinux/init.hlinux/io-64-nonatomic-lo-hi.hlinux/types.hclocksource/arm_arch_timer.h
Detected Declarations
function arch_timer_reg_write_cp15function arch_timer_reg_read_cp15function arch_timer_get_cntfrqfunction __arch_counter_get_cntpctfunction __arch_counter_get_cntpct_stablefunction __arch_counter_get_cntvctfunction __arch_counter_get_cntvct_stablefunction arch_timer_get_cntkctlfunction arch_timer_set_cntkctlfunction arch_timer_set_evtstrm_featurefunction arch_timer_have_evtstrm_feature
Annotated Snippet
switch (reg) {
case ARCH_TIMER_REG_CTRL:
asm volatile("mcr p15, 0, %0, c14, c2, 1" : : "r" ((u32)val));
isb();
break;
case ARCH_TIMER_REG_CVAL:
asm volatile("mcrr p15, 2, %Q0, %R0, c14" : : "r" (val));
break;
default:
BUILD_BUG();
}
} else if (access == ARCH_TIMER_VIRT_ACCESS) {
switch (reg) {
case ARCH_TIMER_REG_CTRL:
asm volatile("mcr p15, 0, %0, c14, c3, 1" : : "r" ((u32)val));
isb();
break;
case ARCH_TIMER_REG_CVAL:
asm volatile("mcrr p15, 3, %Q0, %R0, c14" : : "r" (val));
break;
default:
BUILD_BUG();
}
} else {
BUILD_BUG();
}
}
static __always_inline
u32 arch_timer_reg_read_cp15(int access, enum arch_timer_reg reg)
{
u32 val = 0;
if (access == ARCH_TIMER_PHYS_ACCESS) {
switch (reg) {
case ARCH_TIMER_REG_CTRL:
asm volatile("mrc p15, 0, %0, c14, c2, 1" : "=r" (val));
break;
default:
BUILD_BUG();
}
} else if (access == ARCH_TIMER_VIRT_ACCESS) {
switch (reg) {
case ARCH_TIMER_REG_CTRL:
asm volatile("mrc p15, 0, %0, c14, c3, 1" : "=r" (val));
break;
default:
BUILD_BUG();
}
} else {
BUILD_BUG();
}
return val;
}
static inline u32 arch_timer_get_cntfrq(void)
{
u32 val;
asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r" (val));
return val;
}
static inline u64 __arch_counter_get_cntpct(void)
{
u64 cval;
isb();
asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (cval));
return cval;
}
static inline u64 __arch_counter_get_cntpct_stable(void)
{
return __arch_counter_get_cntpct();
}
static inline u64 __arch_counter_get_cntvct(void)
{
u64 cval;
isb();
asm volatile("mrrc p15, 1, %Q0, %R0, c14" : "=r" (cval));
return cval;
}
static inline u64 __arch_counter_get_cntvct_stable(void)
{
return __arch_counter_get_cntvct();
}
Annotation
- Immediate include surface: `asm/barrier.h`, `asm/errno.h`, `asm/hwcap.h`, `linux/clocksource.h`, `linux/init.h`, `linux/io-64-nonatomic-lo-hi.h`, `linux/types.h`, `clocksource/arm_arch_timer.h`.
- Detected declarations: `function arch_timer_reg_write_cp15`, `function arch_timer_reg_read_cp15`, `function arch_timer_get_cntfrq`, `function __arch_counter_get_cntpct`, `function __arch_counter_get_cntpct_stable`, `function __arch_counter_get_cntvct`, `function __arch_counter_get_cntvct_stable`, `function arch_timer_get_cntkctl`, `function arch_timer_set_cntkctl`, `function arch_timer_set_evtstrm_feature`.
- Atlas domain: Architecture Layer / arch/arm.
- 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.