From 47cf5d3f28f4d9bf1912c0470eac01599dd4a7c8 Mon Sep 17 00:00:00 2001 From: Etienne Carriere Date: Sun, 8 Dec 2019 08:14:03 +0100 Subject: [PATCH] stm32mp1: introduce shared resources support STM32MP1 SoC includes peripheral interfaces that can be assigned to the secure world, or that can be opened to the non-secure world. This change introduces the basics of a driver that manages such resources which assignation is done at run time. It currently offers API functions that state whether a service exposed to non-secure world has permission to access a targeted clock or reset controller. Change-Id: Iff20028f41586bc501085488c03546ffe31046d8 Signed-off-by: Etienne Carriere --- .../common/include/stm32mp_shared_resources.h | 18 ++++++++++++++++++ plat/st/stm32mp1/sp_min/sp_min-stm32mp1.mk | 3 +++ plat/st/stm32mp1/stm32mp1_shared_resources.c | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 plat/st/common/include/stm32mp_shared_resources.h create mode 100644 plat/st/stm32mp1/stm32mp1_shared_resources.c diff --git a/plat/st/common/include/stm32mp_shared_resources.h b/plat/st/common/include/stm32mp_shared_resources.h new file mode 100644 index 000000000..2ab42ef45 --- /dev/null +++ b/plat/st/common/include/stm32mp_shared_resources.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2017-2020, STMicroelectronics - All Rights Reserved + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef STM32MP_SHARED_RESOURCES_H +#define STM32MP_SHARED_RESOURCES_H + +#include + +/* Return true if @clock_id is shared by secure and non-secure worlds */ +bool stm32mp_nsec_can_access_clock(unsigned long clock_id); + +/* Return true if and only if @reset_id relates to a non-secure peripheral */ +bool stm32mp_nsec_can_access_reset(unsigned int reset_id); + +#endif /* STM32MP_SHARED_RESOURCES_H */ diff --git a/plat/st/stm32mp1/sp_min/sp_min-stm32mp1.mk b/plat/st/stm32mp1/sp_min/sp_min-stm32mp1.mk index 180620e88..913a486e3 100644 --- a/plat/st/stm32mp1/sp_min/sp_min-stm32mp1.mk +++ b/plat/st/stm32mp1/sp_min/sp_min-stm32mp1.mk @@ -6,10 +6,13 @@ SP_MIN_WITH_SECURE_FIQ := 1 +BL32_CFLAGS += -DSTM32MP_SHARED_RESOURCES + BL32_SOURCES += drivers/st/etzpc/etzpc.c \ plat/common/aarch32/platform_mp_stack.S \ plat/st/stm32mp1/sp_min/sp_min_setup.c \ plat/st/stm32mp1/stm32mp1_pm.c \ + plat/st/stm32mp1/stm32mp1_shared_resources.c \ plat/st/stm32mp1/stm32mp1_topology.c # Generic GIC v2 diff --git a/plat/st/stm32mp1/stm32mp1_shared_resources.c b/plat/st/stm32mp1/stm32mp1_shared_resources.c new file mode 100644 index 000000000..a68615298 --- /dev/null +++ b/plat/st/stm32mp1/stm32mp1_shared_resources.c @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2017-2020, STMicroelectronics - All Rights Reserved + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include + +/* Currently allow full access by non-secure to platform clock services */ +bool stm32mp_nsec_can_access_clock(unsigned long clock_id) +{ + return true; +} + +/* Currently allow full access by non-secure to platform reset services */ +bool stm32mp_nsec_can_access_reset(unsigned int reset_id) +{ + return true; +}