mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 09:34:18 +00:00
feat(zynqmp): add support for custom sip service
Add support for custom sip service. Bare minimum implementation for custom_smc_handler is provided by platform. Actual definition for custom_smc_handler will be provided by custom pkg. This feature is going to be used by external libraries. For example for checking it's status. The similar approach is also used by qti/{sc7180,sc7280} platforms by providing a way to select QTISECLIB_PATH. This code is providing a generic way how to wire any code via custom $(CUSTOM_PKG_PATH)/custom_pkg.mk makefile with also an option to wire custom SMC. SMC functionality depends on "package". Change-Id: Icedffd582f76f89fc399b0bb2e05cdaee9b743a0 Signed-off-by: Amit Nagal <amit.nagal@amd.com>
This commit is contained in:
parent
2b8c608e13
commit
496d708154
5 changed files with 82 additions and 0 deletions
|
@ -71,3 +71,40 @@ for ZynqMP:
|
|||
|
||||
The 4 leaf power domains represent the individual A53 cores, while resources
|
||||
common to the cluster are grouped in the power domain on the top.
|
||||
|
||||
CUSTOM SIP service support
|
||||
--------------------------
|
||||
|
||||
- Dedicated SMC FID ZYNQMP_SIP_SVC_CUSTOM(0x82002000)(32-bit)/
|
||||
(0xC2002000)(64-bit) to be used by a custom package for
|
||||
providing CUSTOM SIP service.
|
||||
|
||||
- by default platform provides bare minimum definition for
|
||||
custom_smc_handler in this service.
|
||||
|
||||
- to use this service, custom package should implement their
|
||||
smc handler with the name custom_smc_handler. once custom package is
|
||||
included in TF-A build, their definition of custom_smc_handler is
|
||||
enabled.
|
||||
|
||||
Custom package makefile fragment inclusion in TF-A build
|
||||
--------------------------------------------------------
|
||||
|
||||
- custom package is not directly part of TF-A source.
|
||||
|
||||
- <CUSTOM_PKG_PATH> is the location at which user clones a
|
||||
custom package locally.
|
||||
|
||||
- custom package needs to implement makefile fragment named
|
||||
custom_pkg.mk so as to get included in TF-A build.
|
||||
|
||||
- custom_pkg.mk specify all the rules to include custom package
|
||||
specific header files, dependent libs, source files that are
|
||||
supposed to be included in TF-A build.
|
||||
|
||||
- when <CUSTOM_PKG_PATH> is specified in TF-A build command,
|
||||
custom_pkg.mk is included from <CUSTOM_PKG_PATH> in TF-A build.
|
||||
|
||||
- TF-A build command:
|
||||
make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1
|
||||
bl31 CUSTOM_PKG_PATH=<...>
|
||||
|
|
17
plat/xilinx/zynqmp/custom_sip_svc.c
Normal file
17
plat/xilinx/zynqmp/custom_sip_svc.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2022-2023, Advanced Micro Devices Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <common/bl_common.h>
|
||||
#include <common/debug.h>
|
||||
#include <smccc_helpers.h>
|
||||
|
||||
uint64_t custom_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2,
|
||||
uint64_t x3, uint64_t x4, void *cookie,
|
||||
void *handle, uint64_t flags)
|
||||
{
|
||||
WARN("Unimplemented SiP Service Call: 0x%x\n", smc_fid);
|
||||
SMC_RET1(handle, SMC_UNK);
|
||||
}
|
16
plat/xilinx/zynqmp/include/custom_svc.h
Normal file
16
plat/xilinx/zynqmp/include/custom_svc.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2022-2023, Advanced Micro Devices Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef CUSTOM_SVC_H
|
||||
#define CUSTOM_SVC_H
|
||||
|
||||
#define ZYNQMP_SIP_SVC_CUSTOM U(0x82002000)
|
||||
#define ZYNQMP_SIP_SVC64_CUSTOM U(0xC2002000)
|
||||
|
||||
uint64_t custom_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2,
|
||||
uint64_t x3, uint64_t x4, void *cookie,
|
||||
void *handle, uint64_t flags);
|
||||
|
||||
#endif /* CUSTOM_SVC_H */
|
|
@ -139,6 +139,12 @@ endif
|
|||
BL31_CPPFLAGS += -fno-jump-tables
|
||||
TF_CFLAGS_aarch64 += -mbranch-protection=none
|
||||
|
||||
ifdef CUSTOM_PKG_PATH
|
||||
include $(CUSTOM_PKG_PATH)/custom_pkg.mk
|
||||
else
|
||||
BL31_SOURCES += plat/xilinx/zynqmp/custom_sip_svc.c
|
||||
endif
|
||||
|
||||
ifneq (${RESET_TO_BL31},1)
|
||||
$(error "Using BL31 as the reset vector is only one option supported on ZynqMP. Please set RESET_TO_BL31 to 1.")
|
||||
endif
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <common/runtime_svc.h>
|
||||
#include <tools_share/uuid.h>
|
||||
|
||||
#include <custom_svc.h>
|
||||
#include "ipi_mailbox_svc.h"
|
||||
#include "pm_svc_main.h"
|
||||
|
||||
|
@ -89,6 +90,11 @@ static uintptr_t sip_svc_smc_handler(uint32_t smc_fid,
|
|||
case ZYNQMP_SIP_SVC_VERSION:
|
||||
SMC_RET2(handle, SIP_SVC_VERSION_MAJOR, SIP_SVC_VERSION_MINOR);
|
||||
|
||||
case ZYNQMP_SIP_SVC_CUSTOM:
|
||||
case ZYNQMP_SIP_SVC64_CUSTOM:
|
||||
return custom_smc_handler(smc_fid, x1, x2, x3, x4, cookie,
|
||||
handle, flags);
|
||||
|
||||
default:
|
||||
WARN("Unimplemented SiP Service Call: 0x%x\n", smc_fid);
|
||||
SMC_RET1(handle, SMC_UNK);
|
||||
|
|
Loading…
Add table
Reference in a new issue