summaryrefslogtreecommitdiffstats
path: root/include/efi
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2017-02-15 20:34:11 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-02-24 08:21:33 +0100
commit3858b78c1bea4d8b6aca73348edd48cbe59a428e (patch)
treed575f91e5d75c244d08b7196bc9b5445ab7543e0 /include/efi
parent5596f405ff03cd5de12ad592a6d696e112fed0c1 (diff)
downloadbarebox-3858b78c1bea4d8b6aca73348edd48cbe59a428e.tar.gz
barebox-3858b78c1bea4d8b6aca73348edd48cbe59a428e.tar.xz
efi: move bus driver to driver/efi
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/efi')
-rw-r--r--include/efi/efi-device.h45
-rw-r--r--include/efi/efi.h28
2 files changed, 73 insertions, 0 deletions
diff --git a/include/efi/efi-device.h b/include/efi/efi-device.h
new file mode 100644
index 0000000000..8f5f1f3f13
--- /dev/null
+++ b/include/efi/efi-device.h
@@ -0,0 +1,45 @@
+#ifndef __EFI_EFI_DEVICE_H
+#define __EFI_EFI_DEVICE_H
+
+struct efi_device {
+ struct device_d dev;
+ efi_guid_t *guids;
+ int num_guids;
+ efi_handle_t handle;
+ efi_handle_t parent_handle;
+ void *protocol;
+ struct efi_device_path *devpath;
+};
+
+struct efi_driver {
+ struct driver_d driver;
+ int (*probe)(struct efi_device *efidev);
+ void (*remove)(struct efi_device *efidev);
+ efi_guid_t guid;
+};
+
+extern struct bus_type efi_bus;
+
+static inline struct efi_device *to_efi_device(struct device_d *dev)
+{
+ return container_of(dev, struct efi_device, dev);
+}
+
+static inline struct efi_driver *to_efi_driver(struct driver_d *drv)
+{
+ return container_of(drv, struct efi_driver, driver);
+}
+
+#define device_efi_driver(drv) \
+ register_driver_macro(device, efi, drv)
+
+static inline int efi_driver_register(struct efi_driver *efidrv)
+{
+ efidrv->driver.bus = &efi_bus;
+ return register_driver(&efidrv->driver);
+}
+
+int efi_connect_all(void);
+void efi_register_devices(void);
+
+#endif /* __EFI_EFI_DEVICE_H */
diff --git a/include/efi/efi.h b/include/efi/efi.h
new file mode 100644
index 0000000000..2b25cf1868
--- /dev/null
+++ b/include/efi/efi.h
@@ -0,0 +1,28 @@
+#ifndef __MACH_EFI_H
+#define __MACH_EFI_H
+
+#include <efi.h>
+
+const char *efi_strerror(efi_status_t err);
+
+extern efi_system_table_t *efi_sys_table;
+extern efi_handle_t efi_parent_image;
+extern struct efi_device_path *efi_device_path;
+extern efi_loaded_image_t *efi_loaded_image;
+
+int efi_errno(efi_status_t err);
+
+int efi_clocksource_init(void);
+
+void *efi_get_variable(char *name, efi_guid_t *vendor, int *var_size);
+
+static inline void *efi_get_global_var(char *name, int *var_size)
+{
+ return efi_get_variable(name, &efi_global_variable_guid, var_size);
+}
+
+int efi_set_variable(char *name, efi_guid_t *vendor, uint32_t attributes,
+ void *buf, unsigned long size);
+int efi_set_variable_usec(char *name, efi_guid_t *vendor, uint64_t usec);
+
+#endif /* __MACH_EFI_H */