arm-trusted-firmware/plat/xilinx/common/versal.c
Nithin G 906d589277 fix(xilinx): modify function to have single return
This corrects the MISRA violation C2012-15.5:
A function should have a single point of exit at the end.
Introduced a temporary variable to store the return value to
ensure single return for the function.

Change-Id: Ice3eb939664ffc62c1f586b641e37481f10ffff6
Signed-off-by: Nithin G <nithing@amd.com>
Signed-off-by: Maheedhar Bollapalli <maheedharsai.bollapalli@amd.com>
2025-01-22 04:07:30 +00:00

69 lines
1.6 KiB
C

/*
* Copyright (c) 2023, Advanced Micro Devices, Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <common/debug.h>
#include <lib/mmio.h>
#include <lib/smccc.h>
#include <plat/common/platform.h>
#include <services/arm_arch_svc.h>
#include <plat_private.h>
#include <plat_startup.h>
#include <pm_api_sys.h>
/**
* plat_is_smccc_feature_available() - This function checks whether SMCCC
* feature is availabile for platform.
* @fid: SMCCC function id.
*
* Return: SMC_ARCH_CALL_SUCCESS - if SMCCC feature is available.
* SMC_ARCH_CALL_NOT_SUPPORTED - Otherwise.
*
*/
int32_t plat_is_smccc_feature_available(u_register_t fid)
{
int32_t ret = 0;
switch (fid) {
case SMCCC_ARCH_SOC_ID:
ret = SMC_ARCH_CALL_SUCCESS;
break;
default:
ret = SMC_ARCH_CALL_NOT_SUPPORTED;
}
return ret;
}
/**
* plat_get_soc_version() - Get the SOC version of the platform.
*
* Return: SiP defined SoC version in JEP-106.
*
* This function is called when the SoC_ID_type == 0.
* For further details please refer to section 7.4 of SMC Calling Convention.
*/
int32_t plat_get_soc_version(void)
{
uint32_t manfid;
manfid = SOC_ID_SET_JEP_106(JEDEC_XILINX_BKID, JEDEC_XILINX_MFID);
return (int32_t)(manfid | (platform_version & SOC_ID_IMPL_DEF_MASK));
}
/**
* plat_get_soc_revision() - Get the SOC revision for the platform.
*
* Return: SiP defined SoC revision.
*
* This function is called when the SoC_ID_type == 1
* For further details please refer to section 7.4 of SMC Calling Convention
*/
int32_t plat_get_soc_revision(void)
{
return (int32_t)(platform_id & SOC_ID_REV_MASK);
}