1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <console/console.h>
7 /* Assumes at least a PSCI implementation is present */
8 uint8_t smccc_supports_arch_soc_id(void)
10 static uint8_t supported
= 0xff;
13 if (supported
!= 0xff)
16 // PSCI_FEATURES mandatory from PSCI 1.0
17 smc_ret
= smc_call0(PSCI_VERSION
);
18 if (smc_ret
< 0x10000)
21 smc_ret
= smc_call1(PSCI_FEATURES
, SMCCC_VERSION
);
22 if (smc_ret
== PSCI_NOT_SUPPORTED
)
25 // SMCCC_ARCH_FEATURES supported from SMCCC 1.1
26 smc_ret
= smc_call0(SMCCC_VERSION
);
27 if (smc_ret
< 0x10001)
30 smc_ret
= smc_call1(SMCCC_ARCH_FEATURES
, SMCCC_ARCH_SOC_ID
);
31 if (smc_ret
!= SMC_SUCCESS
)
42 enum cb_err
smccc_arch_soc_id(uint32_t *jep106code
, uint32_t *soc_revision
)
46 if (jep106code
== NULL
|| soc_revision
== NULL
)
49 smc_ret
= smc_call1(SMCCC_ARCH_SOC_ID
, SMCCC_GET_SOC_VERSION
);
50 if (smc_ret
!= SMC_INVALID_PARAMETER
)
51 *jep106code
= smc_ret
;
55 smc_ret
= smc_call1(SMCCC_ARCH_SOC_ID
, SMCCC_GET_SOC_REVISION
);
56 if (smc_ret
!= SMC_INVALID_PARAMETER
)
57 *soc_revision
= smc_ret
;
61 if (*jep106code
== -1 || *soc_revision
== -1) {
62 printk(BIOS_ERR
, "SMCCC_ARCH_SOC_ID failed!\n");