arch/arm/mach-versatile/tc2_pm.c
Source file repositories/reference/linux-study-clean/arch/arm/mach-versatile/tc2_pm.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/mach-versatile/tc2_pm.c- Extension
.c- Size
- 7291 bytes
- Lines
- 262
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/init.hlinux/io.hlinux/kernel.hlinux/of_address.hlinux/of_irq.hlinux/errno.hlinux/irqchip/arm-gic.hasm/mcpm.hasm/proc-fns.hasm/cacheflush.hasm/cputype.hasm/cp15.hlinux/arm-cci.hspc.h
Detected Declarations
function tc2_pm_cpu_powerupfunction tc2_pm_cluster_powerupfunction tc2_pm_cpu_powerdown_preparefunction tc2_pm_cluster_powerdown_preparefunction tc2_pm_cpu_cache_disablefunction tc2_pm_cluster_cache_disablefunction tc2_core_in_resetfunction tc2_pm_wait_for_powerdownfunction tc2_pm_cpu_suspend_preparefunction tc2_pm_cpu_is_upfunction tc2_pm_cluster_is_upfunction tc2_pm_power_up_setupfunction tc2_pm_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Created by: Nicolas Pitre, October 2012
* Copyright: (C) 2012-2013 Linaro Limited
*
* Some portions of this file were originally written by Achin Gupta
* Copyright: (C) 2012 ARM Limited
*/
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/errno.h>
#include <linux/irqchip/arm-gic.h>
#include <asm/mcpm.h>
#include <asm/proc-fns.h>
#include <asm/cacheflush.h>
#include <asm/cputype.h>
#include <asm/cp15.h>
#include <linux/arm-cci.h>
#include "spc.h"
/* SCC conf registers */
#define RESET_CTRL 0x018
#define RESET_A15_NCORERESET(cpu) (1 << (2 + (cpu)))
#define RESET_A7_NCORERESET(cpu) (1 << (16 + (cpu)))
#define A15_CONF 0x400
#define A7_CONF 0x500
#define SYS_INFO 0x700
#define SPC_BASE 0xb00
static void __iomem *scc;
#define TC2_CLUSTERS 2
#define TC2_MAX_CPUS_PER_CLUSTER 3
static unsigned int tc2_nr_cpus[TC2_CLUSTERS];
static int tc2_pm_cpu_powerup(unsigned int cpu, unsigned int cluster)
{
pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
if (cluster >= TC2_CLUSTERS || cpu >= tc2_nr_cpus[cluster])
return -EINVAL;
ve_spc_set_resume_addr(cluster, cpu,
__pa_symbol(mcpm_entry_point));
ve_spc_cpu_wakeup_irq(cluster, cpu, true);
return 0;
}
static int tc2_pm_cluster_powerup(unsigned int cluster)
{
pr_debug("%s: cluster %u\n", __func__, cluster);
if (cluster >= TC2_CLUSTERS)
return -EINVAL;
ve_spc_powerdown(cluster, false);
return 0;
}
static void tc2_pm_cpu_powerdown_prepare(unsigned int cpu, unsigned int cluster)
{
pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
BUG_ON(cluster >= TC2_CLUSTERS || cpu >= TC2_MAX_CPUS_PER_CLUSTER);
ve_spc_cpu_wakeup_irq(cluster, cpu, true);
/*
* If the CPU is committed to power down, make sure
* the power controller will be in charge of waking it
* up upon IRQ, ie IRQ lines are cut from GIC CPU IF
* to the CPU by disabling the GIC CPU IF to prevent wfi
* from completing execution behind power controller back
*/
gic_cpu_if_down(0);
}
static void tc2_pm_cluster_powerdown_prepare(unsigned int cluster)
{
pr_debug("%s: cluster %u\n", __func__, cluster);
BUG_ON(cluster >= TC2_CLUSTERS);
ve_spc_powerdown(cluster, true);
ve_spc_global_wakeup_irq(true);
}
static void tc2_pm_cpu_cache_disable(void)
{
Annotation
- Immediate include surface: `linux/delay.h`, `linux/init.h`, `linux/io.h`, `linux/kernel.h`, `linux/of_address.h`, `linux/of_irq.h`, `linux/errno.h`, `linux/irqchip/arm-gic.h`.
- Detected declarations: `function tc2_pm_cpu_powerup`, `function tc2_pm_cluster_powerup`, `function tc2_pm_cpu_powerdown_prepare`, `function tc2_pm_cluster_powerdown_prepare`, `function tc2_pm_cpu_cache_disable`, `function tc2_pm_cluster_cache_disable`, `function tc2_core_in_reset`, `function tc2_pm_wait_for_powerdown`, `function tc2_pm_cpu_suspend_prepare`, `function tc2_pm_cpu_is_up`.
- 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.