Merge tag 'u-boot-imx-20200825' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
[platform/kernel/u-boot.git] / drivers / firmware / psci.c
index e0d66d7..68953cc 100644 (file)
 #include <linux/errno.h>
 #include <linux/printk.h>
 #include <linux/psci.h>
+#include <asm/system.h>
 
 #define DRIVER_NAME "psci"
 
 #define PSCI_METHOD_HVC 1
 #define PSCI_METHOD_SMC 2
 
+#if CONFIG_IS_ENABLED(EFI_LOADER)
 int __efi_runtime_data psci_method;
+#else
+int psci_method __attribute__ ((section(".data")));
+#endif
 
 unsigned long __efi_runtime invoke_psci_fn
                (unsigned long function_id, unsigned long arg0,
@@ -67,11 +72,14 @@ static int psci_bind(struct udevice *dev)
 
 static int psci_probe(struct udevice *dev)
 {
-       DECLARE_GLOBAL_DATA_PTR;
        const char *method;
 
-       method = fdt_stringlist_get(gd->fdt_blob, dev_of_offset(dev), "method",
-                                   0, NULL);
+#if defined(CONFIG_ARM64)
+       if (current_el() == 3)
+               return -EINVAL;
+#endif
+
+       method = ofnode_read_string(dev_ofnode(dev), "method");
        if (!method) {
                pr_warn("missing \"method\" property\n");
                return -ENXIO;