mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 09:34:18 +00:00
feat(allwinner): add SMCCC SOCID support
The Allwinner SID device holds a 16-bit SoC identifier, which we already use in our code. Export this number through the generic SMCCC SOCID interface, to allow an architectural identification of an Allwinner SoC. This enables access to this information from non-secure world, simplifies generic drivers (ACPI comes to mind), and gives easy and precise access to the SoC ID from userland in OSes like Linux. Change-Id: I91753046b2ae5408ca7bc0b864fcd97d24c8267c Signed-off-by: Andre Przywara <andre.przywara@arm.com>
This commit is contained in:
parent
3e0a087f30
commit
436cd754f2
2 changed files with 31 additions and 0 deletions
|
@ -20,4 +20,7 @@
|
|||
#define SUNXI_SOC_H616 0x1823
|
||||
#define SUNXI_SOC_R329 0x1851
|
||||
|
||||
#define JEDEC_ALLWINNER_BKID 9U
|
||||
#define JEDEC_ALLWINNER_MFID 0x9eU
|
||||
|
||||
#endif /* SUNXI_DEF_H */
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
|
||||
#include <common/debug.h>
|
||||
#include <lib/mmio.h>
|
||||
#include <lib/smccc.h>
|
||||
#include <lib/xlat_tables/xlat_tables_v2.h>
|
||||
#include <services/arm_arch_svc.h>
|
||||
|
||||
#include <sunxi_def.h>
|
||||
#include <sunxi_mmap.h>
|
||||
|
@ -157,3 +159,29 @@ int sunxi_init_platform_r_twi(uint16_t socid, bool use_rsb)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t plat_is_smccc_feature_available(u_register_t fid)
|
||||
{
|
||||
switch (fid) {
|
||||
case SMCCC_ARCH_SOC_ID:
|
||||
return SMC_ARCH_CALL_SUCCESS;
|
||||
default:
|
||||
return SMC_ARCH_CALL_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t plat_get_soc_version(void)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
ret = SOC_ID_SET_JEP_106(JEDEC_ALLWINNER_BKID, JEDEC_ALLWINNER_MFID);
|
||||
|
||||
return ret | (sunxi_read_soc_id() & SOC_ID_IMPL_DEF_MASK);
|
||||
}
|
||||
|
||||
int32_t plat_get_soc_revision(void)
|
||||
{
|
||||
uint32_t reg = mmio_read_32(SRAM_VER_REG);
|
||||
|
||||
return reg & GENMASK_32(7, 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue