soc_id.c (50501936288d6a29d7ef78f25d00e33240fad45f) soc_id.c (d05799d7b4a39fa71c65aa277128ac7c843ffcdc)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2020 Arm Limited
4 */
5
6#define pr_fmt(fmt) "SMCCC: SOC_ID: " fmt
7
8#include <linux/arm-smccc.h>

--- 20 unchanged lines hidden (view full) ---

29#define IMP_DEF_SOC_ID(x) \
30 (u16)(FIELD_GET(SMCCC_SOC_ID_IMP_DEF_SOC_ID_MASK, (x)))
31
32static struct soc_device *soc_dev;
33static struct soc_device_attribute *soc_dev_attr;
34
35static int __init smccc_soc_init(void)
36{
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2020 Arm Limited
4 */
5
6#define pr_fmt(fmt) "SMCCC: SOC_ID: " fmt
7
8#include <linux/arm-smccc.h>

--- 20 unchanged lines hidden (view full) ---

29#define IMP_DEF_SOC_ID(x) \
30 (u16)(FIELD_GET(SMCCC_SOC_ID_IMP_DEF_SOC_ID_MASK, (x)))
31
32static struct soc_device *soc_dev;
33static struct soc_device_attribute *soc_dev_attr;
34
35static int __init smccc_soc_init(void)
36{
37 struct arm_smccc_res res;
38 int soc_id_rev, soc_id_version;
39 static char soc_id_str[20], soc_id_rev_str[12];
40 static char soc_id_jep106_id_str[12];
41
42 if (arm_smccc_get_version() < ARM_SMCCC_VERSION_1_2)
43 return 0;
44
45 soc_id_version = arm_smccc_get_soc_id_version();
46 if (soc_id_version == SMCCC_RET_NOT_SUPPORTED) {
47 pr_info("ARCH_SOC_ID not implemented, skipping ....\n");
48 return 0;
49 }
50
51 if (soc_id_version < 0) {
37 int soc_id_rev, soc_id_version;
38 static char soc_id_str[20], soc_id_rev_str[12];
39 static char soc_id_jep106_id_str[12];
40
41 if (arm_smccc_get_version() < ARM_SMCCC_VERSION_1_2)
42 return 0;
43
44 soc_id_version = arm_smccc_get_soc_id_version();
45 if (soc_id_version == SMCCC_RET_NOT_SUPPORTED) {
46 pr_info("ARCH_SOC_ID not implemented, skipping ....\n");
47 return 0;
48 }
49
50 if (soc_id_version < 0) {
52 pr_err("ARCH_SOC_ID(0) returned error: %lx\n", res.a0);
51 pr_err("Invalid SoC Version: %x\n", soc_id_version);
53 return -EINVAL;
54 }
55
56 soc_id_rev = arm_smccc_get_soc_id_revision();
57 if (soc_id_rev < 0) {
52 return -EINVAL;
53 }
54
55 soc_id_rev = arm_smccc_get_soc_id_revision();
56 if (soc_id_rev < 0) {
58 pr_err("ARCH_SOC_ID(1) returned error: %lx\n", res.a0);
57 pr_err("Invalid SoC Revision: %x\n", soc_id_rev);
59 return -EINVAL;
60 }
61
62 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
63 if (!soc_dev_attr)
64 return -ENOMEM;
65
66 sprintf(soc_id_rev_str, "0x%08x", soc_id_rev);

--- 30 unchanged lines hidden ---
58 return -EINVAL;
59 }
60
61 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
62 if (!soc_dev_attr)
63 return -ENOMEM;
64
65 sprintf(soc_id_rev_str, "0x%08x", soc_id_rev);

--- 30 unchanged lines hidden ---