linux/drivers/firmware/smccc/smccc.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0-only
   2/*
   3 * Copyright (C) 2020 Arm Limited
   4 */
   5
   6#define pr_fmt(fmt) "smccc: " fmt
   7
   8#include <linux/cache.h>
   9#include <linux/init.h>
  10#include <linux/arm-smccc.h>
  11#include <linux/kernel.h>
  12#include <asm/archrandom.h>
  13
  14static u32 smccc_version = ARM_SMCCC_VERSION_1_0;
  15static enum arm_smccc_conduit smccc_conduit = SMCCC_CONDUIT_NONE;
  16
  17bool __ro_after_init smccc_trng_available = false;
  18
  19void __init arm_smccc_version_init(u32 version, enum arm_smccc_conduit conduit)
  20{
  21        smccc_version = version;
  22        smccc_conduit = conduit;
  23
  24        smccc_trng_available = smccc_probe_trng();
  25}
  26
  27enum arm_smccc_conduit arm_smccc_1_1_get_conduit(void)
  28{
  29        if (smccc_version < ARM_SMCCC_VERSION_1_1)
  30                return SMCCC_CONDUIT_NONE;
  31
  32        return smccc_conduit;
  33}
  34EXPORT_SYMBOL_GPL(arm_smccc_1_1_get_conduit);
  35
  36u32 arm_smccc_get_version(void)
  37{
  38        return smccc_version;
  39}
  40EXPORT_SYMBOL_GPL(arm_smccc_get_version);
  41