arch/powerpc/sysdev/fsl_rcpm.c
Source file repositories/reference/linux-study-clean/arch/powerpc/sysdev/fsl_rcpm.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/sysdev/fsl_rcpm.c- Extension
.c- Size
- 8740 bytes
- Lines
- 383
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- 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/types.hlinux/errno.hlinux/of_address.hlinux/export.hasm/io.hlinux/fsl/guts.hasm/cputhreads.hasm/fsl_pm.hasm/smp.h
Detected Declarations
function rcpm_v1_irq_maskfunction rcpm_v2_irq_maskfunction rcpm_v1_irq_unmaskfunction rcpm_v2_irq_unmaskfunction rcpm_v1_set_ip_powerfunction rcpm_v2_set_ip_powerfunction rcpm_v1_cpu_enter_statefunction rcpm_v2_cpu_enter_statefunction rcpm_v1_cpu_diefunction qoriq_disable_threadfunction rcpm_v2_cpu_diefunction rcpm_v1_cpu_exit_statefunction rcpm_v1_cpu_up_preparefunction rcpm_v2_cpu_exit_statefunction rcpm_v2_cpu_up_preparefunction rcpm_v1_plat_enter_statefunction rcpm_v2_plat_enter_statefunction rcpm_v1_plat_enter_sleepfunction rcpm_v2_plat_enter_sleepfunction rcpm_common_freeze_time_basefunction rcpm_v1_freeze_time_basefunction rcpm_v2_freeze_time_basefunction rcpm_get_pm_modesfunction fsl_rcpm_init
Annotated Snippet
if (cpu_is_offline(primary) && cpu_is_offline(primary + 1)) {
/* if both threads are offline, put the cpu in PH20 */
rcpm_v2_cpu_enter_state(cpu, E500_PM_PH20);
} else {
/* if only one thread is offline, disable the thread */
qoriq_disable_thread(cpu);
}
}
#endif
if (threads_per_core == 1)
rcpm_v2_cpu_enter_state(cpu, E500_PM_PH20);
}
static void rcpm_v1_cpu_exit_state(int cpu, int state)
{
int hw_cpu = get_hard_smp_processor_id(cpu);
unsigned int mask = 1 << hw_cpu;
switch (state) {
case E500_PM_PH10:
clrbits32(&rcpm_v1_regs->cdozcr, mask);
break;
case E500_PM_PH15:
clrbits32(&rcpm_v1_regs->cnapcr, mask);
break;
default:
pr_warn("Unknown cpu PM state (%d)\n", state);
break;
}
}
static void rcpm_v1_cpu_up_prepare(int cpu)
{
rcpm_v1_cpu_exit_state(cpu, E500_PM_PH15);
rcpm_v1_irq_unmask(cpu);
}
static void rcpm_v2_cpu_exit_state(int cpu, int state)
{
int hw_cpu = get_hard_smp_processor_id(cpu);
u32 mask = 1 << cpu_core_index_of_thread(cpu);
switch (state) {
case E500_PM_PH10:
setbits32(&rcpm_v2_regs->tph10clrr0, 1 << hw_cpu);
break;
case E500_PM_PH15:
setbits32(&rcpm_v2_regs->pcph15clrr, mask);
break;
case E500_PM_PH20:
setbits32(&rcpm_v2_regs->pcph20clrr, mask);
break;
case E500_PM_PH30:
setbits32(&rcpm_v2_regs->pcph30clrr, mask);
break;
default:
pr_warn("Unknown cpu PM state (%d)\n", state);
}
}
static void rcpm_v2_cpu_up_prepare(int cpu)
{
rcpm_v2_cpu_exit_state(cpu, E500_PM_PH20);
rcpm_v2_irq_unmask(cpu);
}
static int rcpm_v1_plat_enter_state(int state)
{
u32 *pmcsr_reg = &rcpm_v1_regs->powmgtcsr;
int ret = 0;
int result;
switch (state) {
case PLAT_PM_SLEEP:
setbits32(pmcsr_reg, RCPM_POWMGTCSR_SLP);
/* Upon resume, wait for RCPM_POWMGTCSR_SLP bit to be clear. */
result = spin_event_timeout(
!(in_be32(pmcsr_reg) & RCPM_POWMGTCSR_SLP), 10000, 10);
if (!result) {
pr_err("timeout waiting for SLP bit to be cleared\n");
ret = -ETIMEDOUT;
}
break;
default:
pr_warn("Unknown platform PM state (%d)", state);
ret = -EINVAL;
}
Annotation
- Immediate include surface: `linux/types.h`, `linux/errno.h`, `linux/of_address.h`, `linux/export.h`, `asm/io.h`, `linux/fsl/guts.h`, `asm/cputhreads.h`, `asm/fsl_pm.h`.
- Detected declarations: `function rcpm_v1_irq_mask`, `function rcpm_v2_irq_mask`, `function rcpm_v1_irq_unmask`, `function rcpm_v2_irq_unmask`, `function rcpm_v1_set_ip_power`, `function rcpm_v2_set_ip_power`, `function rcpm_v1_cpu_enter_state`, `function rcpm_v2_cpu_enter_state`, `function rcpm_v1_cpu_die`, `function qoriq_disable_thread`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.