mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-08-14 08:27:00 +02:00
When using SCPI as the PSCI backend, firmware can wake up the CPUs and cluster from sleep, so CPU idle states are available for the rich OS to use. In that case, advertise them to the rich OS via the DTB. Change-Id: I718ef6ef41212fe5213b11b4799613adbbe6e0eb Signed-off-by: Samuel Holland <samuel@sholland.org>
61 lines
1.2 KiB
C
61 lines
1.2 KiB
C
/*
|
|
* Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <assert.h>
|
|
|
|
#include <platform_def.h>
|
|
|
|
#include <common/debug.h>
|
|
#include <common/fdt_fixup.h>
|
|
#include <lib/mmio.h>
|
|
#include <lib/psci/psci.h>
|
|
|
|
#include <sunxi_cpucfg.h>
|
|
#include <sunxi_private.h>
|
|
|
|
static bool psci_is_scpi;
|
|
|
|
#if SUNXI_PSCI_USE_SCPI
|
|
bool sunxi_psci_is_scpi(void)
|
|
{
|
|
return psci_is_scpi;
|
|
}
|
|
#endif
|
|
|
|
int sunxi_validate_ns_entrypoint(uintptr_t ns_entrypoint)
|
|
{
|
|
/* The non-secure entry point must be in DRAM */
|
|
if (ns_entrypoint < SUNXI_DRAM_BASE) {
|
|
return PSCI_E_INVALID_ADDRESS;
|
|
}
|
|
|
|
return PSCI_E_SUCCESS;
|
|
}
|
|
|
|
int plat_setup_psci_ops(uintptr_t sec_entrypoint,
|
|
const plat_psci_ops_t **psci_ops)
|
|
{
|
|
assert(psci_ops);
|
|
|
|
/* Program all CPU entry points. */
|
|
for (unsigned int cpu = 0; cpu < PLATFORM_CORE_COUNT; ++cpu) {
|
|
mmio_write_32(SUNXI_CPUCFG_RVBAR_LO_REG(cpu),
|
|
sec_entrypoint & 0xffffffff);
|
|
mmio_write_32(SUNXI_CPUCFG_RVBAR_HI_REG(cpu),
|
|
sec_entrypoint >> 32);
|
|
}
|
|
|
|
if (sunxi_set_scpi_psci_ops(psci_ops) == 0) {
|
|
INFO("PSCI: Suspend is available via SCPI\n");
|
|
psci_is_scpi = true;
|
|
} else {
|
|
INFO("PSCI: Suspend is unavailable\n");
|
|
sunxi_set_native_psci_ops(psci_ops);
|
|
}
|
|
|
|
return 0;
|
|
}
|