Commit b23ab8eb authored by Andre Przywara's avatar Andre Przywara Committed by Samuel Holland
Browse files

allwinner: Allow conditional compilation of SCPI and native PSCI ops



Now that we have split the native and the SCPI version of the PSCI ops,
we can introduce build options to compile in either or both of them.

If one version is not compiled in, some stub functions make sure the
common code still compiles and makes the right decisions.

By default both version are enabled (as before), but one of them can be
disabled on the make command line, or via a platform specific Makefile.

Change-Id: I0c019d8700c0208365eacf57809fb8bc608eb9c0
Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
parent fe753c97
# #
# Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. # Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved.
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
# #
...@@ -20,8 +20,6 @@ PLAT_BL_COMMON_SOURCES := drivers/ti/uart/${ARCH}/16550_console.S \ ...@@ -20,8 +20,6 @@ PLAT_BL_COMMON_SOURCES := drivers/ti/uart/${ARCH}/16550_console.S \
${AW_PLAT}/common/sunxi_common.c ${AW_PLAT}/common/sunxi_common.c
BL31_SOURCES += drivers/allwinner/axp/common.c \ BL31_SOURCES += drivers/allwinner/axp/common.c \
drivers/allwinner/sunxi_msgbox.c \
drivers/arm/css/scpi/css_scpi.c \
${GICV2_SOURCES} \ ${GICV2_SOURCES} \
drivers/delay_timer/delay_timer.c \ drivers/delay_timer/delay_timer.c \
drivers/delay_timer/generic_delay_timer.c \ drivers/delay_timer/generic_delay_timer.c \
...@@ -29,14 +27,40 @@ BL31_SOURCES += drivers/allwinner/axp/common.c \ ...@@ -29,14 +27,40 @@ BL31_SOURCES += drivers/allwinner/axp/common.c \
plat/common/plat_gicv2.c \ plat/common/plat_gicv2.c \
plat/common/plat_psci_common.c \ plat/common/plat_psci_common.c \
${AW_PLAT}/common/sunxi_bl31_setup.c \ ${AW_PLAT}/common/sunxi_bl31_setup.c \
${AW_PLAT}/common/sunxi_cpu_ops.c \
${AW_PLAT}/common/sunxi_native_pm.c \
${AW_PLAT}/common/sunxi_pm.c \ ${AW_PLAT}/common/sunxi_pm.c \
${AW_PLAT}/common/sunxi_scpi_pm.c \
${AW_PLAT}/${PLAT}/sunxi_power.c \ ${AW_PLAT}/${PLAT}/sunxi_power.c \
${AW_PLAT}/common/sunxi_security.c \ ${AW_PLAT}/common/sunxi_security.c \
${AW_PLAT}/common/sunxi_topology.c ${AW_PLAT}/common/sunxi_topology.c
# By default, attempt to use SCPI to the ARISC management processor. If SCPI
# is not enabled or SCP firmware is not loaded, fall back to a simpler native
# implementation that does not support CPU or system suspend.
#
# If SCP firmware will always be present (or absent), the unused implementation
# can be compiled out.
SUNXI_PSCI_USE_NATIVE ?= 1
SUNXI_PSCI_USE_SCPI ?= 1
$(eval $(call assert_boolean,SUNXI_PSCI_USE_NATIVE))
$(eval $(call assert_boolean,SUNXI_PSCI_USE_SCPI))
$(eval $(call add_define,SUNXI_PSCI_USE_NATIVE))
$(eval $(call add_define,SUNXI_PSCI_USE_SCPI))
ifeq (${SUNXI_PSCI_USE_NATIVE}${SUNXI_PSCI_USE_SCPI},00)
$(error "At least one of SCPI or native PSCI ops must be enabled")
endif
ifeq (${SUNXI_PSCI_USE_NATIVE},1)
BL31_SOURCES += ${AW_PLAT}/common/sunxi_cpu_ops.c \
${AW_PLAT}/common/sunxi_native_pm.c
endif
ifeq (${SUNXI_PSCI_USE_SCPI},1)
BL31_SOURCES += drivers/allwinner/sunxi_msgbox.c \
drivers/arm/css/scpi/css_scpi.c \
${AW_PLAT}/common/sunxi_scpi_pm.c
endif
# The bootloader is guaranteed to only run on CPU 0 by the boot ROM. # The bootloader is guaranteed to only run on CPU 0 by the boot ROM.
COLD_BOOT_SINGLE_CPU := 1 COLD_BOOT_SINGLE_CPU := 1
......
...@@ -16,8 +16,21 @@ void sunxi_cpu_power_off_others(void); ...@@ -16,8 +16,21 @@ void sunxi_cpu_power_off_others(void);
void sunxi_cpu_power_off_self(void); void sunxi_cpu_power_off_self(void);
void sunxi_power_down(void); void sunxi_power_down(void);
#if SUNXI_PSCI_USE_NATIVE
void sunxi_set_native_psci_ops(const plat_psci_ops_t **psci_ops); void sunxi_set_native_psci_ops(const plat_psci_ops_t **psci_ops);
#else
static inline void sunxi_set_native_psci_ops(const plat_psci_ops_t **psci_ops)
{
}
#endif
#if SUNXI_PSCI_USE_SCPI
int sunxi_set_scpi_psci_ops(const plat_psci_ops_t **psci_ops); int sunxi_set_scpi_psci_ops(const plat_psci_ops_t **psci_ops);
#else
static inline int sunxi_set_scpi_psci_ops(const plat_psci_ops_t **psci_ops)
{
return -1;
}
#endif
int sunxi_validate_ns_entrypoint(uintptr_t ns_entrypoint); int sunxi_validate_ns_entrypoint(uintptr_t ns_entrypoint);
int sunxi_pmic_setup(uint16_t socid, const void *fdt); int sunxi_pmic_setup(uint16_t socid, const void *fdt);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment