0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef __FIRMWARE_TRUSTED_FOUNDATIONS_H
0018 #define __FIRMWARE_TRUSTED_FOUNDATIONS_H
0019
0020 #include <linux/printk.h>
0021 #include <linux/bug.h>
0022 #include <linux/of.h>
0023 #include <linux/cpu.h>
0024 #include <linux/smp.h>
0025 #include <linux/types.h>
0026
0027 #include <asm/hardware/cache-l2x0.h>
0028 #include <asm/outercache.h>
0029
0030 #define TF_PM_MODE_LP0 0
0031 #define TF_PM_MODE_LP1 1
0032 #define TF_PM_MODE_LP1_NO_MC_CLK 2
0033 #define TF_PM_MODE_LP2 3
0034 #define TF_PM_MODE_LP2_NOFLUSH_L2 4
0035 #define TF_PM_MODE_NONE 5
0036
0037 struct trusted_foundations_platform_data {
0038 unsigned int version_major;
0039 unsigned int version_minor;
0040 };
0041
0042 #if IS_ENABLED(CONFIG_TRUSTED_FOUNDATIONS)
0043
0044 void register_trusted_foundations(struct trusted_foundations_platform_data *pd);
0045 void of_register_trusted_foundations(void);
0046 bool trusted_foundations_registered(void);
0047
0048 #else
0049 static inline void tf_dummy_write_sec(unsigned long val, unsigned int reg)
0050 {
0051 }
0052
0053 static inline void register_trusted_foundations(
0054 struct trusted_foundations_platform_data *pd)
0055 {
0056
0057
0058
0059
0060 pr_err("No support for Trusted Foundations, continuing in degraded mode.\n");
0061 pr_err("Secondary processors as well as CPU PM will be disabled.\n");
0062 #if IS_ENABLED(CONFIG_CACHE_L2X0)
0063 pr_err("L2X0 cache will be kept disabled.\n");
0064 outer_cache.write_sec = tf_dummy_write_sec;
0065 #endif
0066 #if IS_ENABLED(CONFIG_SMP)
0067 setup_max_cpus = 0;
0068 #endif
0069 cpu_idle_poll_ctrl(true);
0070 }
0071
0072 static inline void of_register_trusted_foundations(void)
0073 {
0074 struct device_node *np = of_find_compatible_node(NULL, NULL, "tlm,trusted-foundations");
0075
0076 if (!np)
0077 return;
0078 of_node_put(np);
0079
0080
0081
0082
0083 register_trusted_foundations(NULL);
0084 }
0085
0086 static inline bool trusted_foundations_registered(void)
0087 {
0088 return false;
0089 }
0090 #endif
0091
0092 #endif