summaryrefslogtreecommitdiffstats
path: root/include/efi/efi-mode.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/efi/efi-mode.h')
-rw-r--r--include/efi/efi-mode.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/efi/efi-mode.h b/include/efi/efi-mode.h
new file mode 100644
index 0000000000..a917c038a1
--- /dev/null
+++ b/include/efi/efi-mode.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __EFI_MODE_H
+#define __EFI_MODE_H
+
+#include <linux/stddef.h>
+#include <linux/types.h>
+
+struct efi_boot_services;
+extern struct efi_boot_services *BS;
+
+static inline bool efi_is_payload(void)
+{
+ return IS_ENABLED(CONFIG_EFI_PAYLOAD) && BS;
+}
+
+static inline bool efi_is_loader(void)
+{
+ return false;
+}
+
+static inline struct efi_boot_services *efi_get_boot_services(void)
+{
+ if (efi_is_payload())
+ return BS;
+
+ return NULL;
+}
+
+#endif