mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-18 02:24:18 +00:00

As a follow-up to bdd2596d4
, and related to SPM Dispatcher
EL3 component and SPM Core S-EL2/S-EL1 component: update
with cosmetic and coding rules changes. In addition:
-Add Armv8.4-SecEL2 arch detection helper.
-Add an SPMC context (on current core) get helper.
-Return more meaningful error return codes.
-Remove complexity in few spmd_smc_handler switch-cases.
-Remove unused defines and structures from spmd_private.h
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: I99e642450b0dafb19d3218a2f0e2d3107e8ca3fe
61 lines
1.5 KiB
C
61 lines
1.5 KiB
C
/*
|
|
* Copyright (c) 2019-2020, Arm Limited. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#ifndef ARCH_FEATURES_H
|
|
#define ARCH_FEATURES_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <arch_helpers.h>
|
|
|
|
static inline bool is_armv7_gentimer_present(void)
|
|
{
|
|
/* The Generic Timer is always present in an ARMv8-A implementation */
|
|
return true;
|
|
}
|
|
|
|
static inline bool is_armv8_2_ttcnp_present(void)
|
|
{
|
|
return ((read_id_aa64mmfr2_el1() >> ID_AA64MMFR2_EL1_CNP_SHIFT) &
|
|
ID_AA64MMFR2_EL1_CNP_MASK) != 0U;
|
|
}
|
|
|
|
static inline bool is_armv8_3_pauth_present(void)
|
|
{
|
|
uint64_t mask = (ID_AA64ISAR1_GPI_MASK << ID_AA64ISAR1_GPI_SHIFT) |
|
|
(ID_AA64ISAR1_GPA_MASK << ID_AA64ISAR1_GPA_SHIFT) |
|
|
(ID_AA64ISAR1_API_MASK << ID_AA64ISAR1_API_SHIFT) |
|
|
(ID_AA64ISAR1_APA_MASK << ID_AA64ISAR1_APA_SHIFT);
|
|
|
|
/* If any of the fields is not zero, PAuth is present */
|
|
return (read_id_aa64isar1_el1() & mask) != 0U;
|
|
}
|
|
|
|
static inline bool is_armv8_4_ttst_present(void)
|
|
{
|
|
return ((read_id_aa64mmfr2_el1() >> ID_AA64MMFR2_EL1_ST_SHIFT) &
|
|
ID_AA64MMFR2_EL1_ST_MASK) == 1U;
|
|
}
|
|
|
|
static inline bool is_armv8_5_bti_present(void)
|
|
{
|
|
return ((read_id_aa64pfr1_el1() >> ID_AA64PFR1_EL1_BT_SHIFT) &
|
|
ID_AA64PFR1_EL1_BT_MASK) == BTI_IMPLEMENTED;
|
|
}
|
|
|
|
static inline unsigned int get_armv8_5_mte_support(void)
|
|
{
|
|
return ((read_id_aa64pfr1_el1() >> ID_AA64PFR1_EL1_MTE_SHIFT) &
|
|
ID_AA64PFR1_EL1_MTE_MASK);
|
|
}
|
|
|
|
static inline bool is_armv8_4_sel2_present(void)
|
|
{
|
|
return ((read_id_aa64pfr0_el1() >> ID_AA64PFR0_SEL2_SHIFT) &
|
|
ID_AA64PFR0_SEL2_MASK) == 1ULL;
|
|
}
|
|
|
|
#endif /* ARCH_FEATURES_H */
|