#ifdef CONFIG_SMP /* * Get the number of CPU cores from the SCU configuration
*/ unsignedint __init scu_get_core_count(void __iomem *scu_base)
{ unsignedint ncores = readl_relaxed(scu_base + SCU_CONFIG); return (ncores & 0x03) + 1;
}
/* Cortex-A9 earlier than r2p0 has no standby bit in SCU */ if ((read_cpuid_id() & 0xff0ffff0) == 0x410fc090 &&
(read_cpuid_id() & 0x00f0000f) >= 0x00200000)
scu_ctrl |= SCU_STANDBY_ENABLE;
writel_relaxed(scu_ctrl, scu_base + SCU_CTRL);
/* * Ensure that the data accessed by CPU0 before the SCU was * initialised is visible to the other CPUs.
*/
flush_cache_all();
} #endif
staticint scu_set_power_mode_internal(void __iomem *scu_base, unsignedint logical_cpu, unsignedint mode)
{ unsignedint val; int cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(logical_cpu), 0);
if (mode > 3 || mode == 1 || cpu > 3) return -EINVAL;
val = readb_relaxed(scu_base + SCU_CPU_STATUS + cpu);
val &= ~SCU_CPU_STATUS_MASK;
val |= mode;
writeb_relaxed(val, scu_base + SCU_CPU_STATUS + cpu);
return 0;
}
/* * Set the executing CPUs power mode as defined. This will be in * preparation for it executing a WFI instruction. * * This function must be called with preemption disabled, and as it * has the side effect of disabling coherency, caches must have been * flushed. Interrupts must also have been disabled.
*/ int scu_power_mode(void __iomem *scu_base, unsignedint mode)
{ return scu_set_power_mode_internal(scu_base, smp_processor_id(), mode);
}
/* * Set the given (logical) CPU's power mode to SCU_PM_NORMAL.
*/ int scu_cpu_power_enable(void __iomem *scu_base, unsignedint cpu)
{ return scu_set_power_mode_internal(scu_base, cpu, SCU_PM_NORMAL);
}
int scu_get_cpu_power_mode(void __iomem *scu_base, unsignedint logical_cpu)
{ unsignedint val; int cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(logical_cpu), 0);
if (cpu > 3) return -EINVAL;
val = readb_relaxed(scu_base + SCU_CPU_STATUS + cpu);
val &= SCU_CPU_STATUS_MASK;
return val;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.