ARM: trusted_foundations: Provide information about whether firmware is registered
authorDmitry Osipenko <digetx@gmail.com>
Sat, 19 May 2018 19:49:29 +0000 (22:49 +0300)
committerDmitry Osipenko <digetx@gmail.com>
Sat, 9 Feb 2019 19:15:31 +0000 (22:15 +0300)
Add a helper that provides information about whether Trusted Foundations
firmware operations have been registered.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
arch/arm/firmware/trusted_foundations.c
arch/arm/include/asm/trusted_foundations.h

index c496f4c..d795ed8 100644 (file)
@@ -172,3 +172,8 @@ void of_register_trusted_foundations(void)
                panic("Trusted Foundation: missing version-minor property\n");
        register_trusted_foundations(&pdata);
 }
+
+bool trusted_foundations_registered(void)
+{
+       return firmware_ops == &trusted_foundations_ops;
+}
index cdd48ab..3f23fa4 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/of.h>
 #include <linux/cpu.h>
 #include <linux/smp.h>
+#include <linux/types.h>
 
 #define TF_PM_MODE_LP0                 0
 #define TF_PM_MODE_LP1                 1
@@ -47,6 +48,7 @@ struct trusted_foundations_platform_data {
 
 void register_trusted_foundations(struct trusted_foundations_platform_data *pd);
 void of_register_trusted_foundations(void);
+bool trusted_foundations_registered(void);
 
 #else /* CONFIG_TRUSTED_FOUNDATIONS */
 
@@ -74,6 +76,11 @@ static inline void of_register_trusted_foundations(void)
        if (of_find_compatible_node(NULL, NULL, "tlm,trusted-foundations"))
                register_trusted_foundations(NULL);
 }
+
+static inline bool trusted_foundations_registered(void)
+{
+       return false;
+}
 #endif /* CONFIG_TRUSTED_FOUNDATIONS */
 
 #endif