summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-13 08:16:43 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-13 08:16:43 +0100
commit93c55ce0986a47f5b6774a81443e9b3a15fc727c (patch)
tree06860f7e46e7a08b7ecd08ba105a8101a900f037 /include
parent12b6a916d608200a511611c4dfbe84cf4cde8add (diff)
parent534c1fac3e684eefcd9d0372dbf26745a84719ad (diff)
downloadbarebox-93c55ce0986a47f5b6774a81443e9b3a15fc727c.tar.gz
barebox-93c55ce0986a47f5b6774a81443e9b3a15fc727c.tar.xz
Merge branch 'for-next/efi'
Diffstat (limited to 'include')
-rw-r--r--include/clock.h3
-rw-r--r--include/efi.h45
-rw-r--r--include/efi/debug_ll.h20
-rw-r--r--include/efi/efi-device.h45
-rw-r--r--include/efi/efi.h26
5 files changed, 133 insertions, 6 deletions
diff --git a/include/clock.h b/include/clock.h
index d65e404e86..5f2f53ab66 100644
--- a/include/clock.h
+++ b/include/clock.h
@@ -12,7 +12,8 @@ struct clocksource {
uint64_t (*read)(void);
uint64_t cycle_last;
uint64_t mask;
-
+ int priority;
+ int (*init)(struct clocksource*);
};
static inline uint32_t cyc2ns(struct clocksource *cs, uint64_t cycles)
diff --git a/include/efi.h b/include/efi.h
index b2e965bae1..e1fc134ee7 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -14,7 +14,7 @@
#include <linux/string.h>
#include <linux/types.h>
-#ifdef CONFIG_ARCH_EFI
+#ifdef CONFIG_EFI_BOOTUP
#define EFIAPI __attribute__((ms_abi))
#else
#define EFIAPI
@@ -171,6 +171,12 @@ struct efi_open_protocol_information_entry {
u32 open_count;
};
+typedef enum {
+ EFI_TIMER_CANCEL = 0,
+ EFI_TIMER_PERIODIC = 1,
+ EFI_TIMER_RELATIVE = 2
+} efi_timer_delay_t;
+
/*
* EFI Boot Services table
*/
@@ -185,12 +191,25 @@ typedef struct {
unsigned long *, u32 *);
efi_status_t (EFIAPI *allocate_pool)(int, unsigned long, void **);
efi_status_t (EFIAPI *free_pool)(void *);
- void *create_event;
- void *set_timer;
+#define EFI_EVT_TIMER 0x80000000
+#define EFI_EVT_RUNTIME 0x40000000
+#define EFI_EVT_NOTIFY_WAIT 0x00000100
+#define EFI_EVT_NOTIFY_SIGNAL 0x00000200
+#define EFI_EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201
+#define EFI_EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202
+
+#define EFI_TPL_APPLICATION 4
+#define EFI_TPL_CALLBACK 8
+#define EFI_TPL_NOTIFY 16
+#define EFI_TPL_HIGH_LEVEL 31
+ efi_status_t(EFIAPI *create_event)(u32 type , unsigned long tpl,
+ void (*fn) (void *event, void *ctx),
+ void *ctx, void **event);
+ efi_status_t(EFIAPI *set_timer)(void *event, efi_timer_delay_t type, uint64_t time);
efi_status_t(EFIAPI *wait_for_event)(unsigned long number_of_events, void *event,
unsigned long *index);
void *signal_event;
- void *close_event;
+ efi_status_t(EFIAPI *close_event)(void *event);
void *check_event;
void *install_protocol_interface;
void *reinstall_protocol_interface;
@@ -469,6 +488,9 @@ extern efi_runtime_services_t *RT;
#define EFI_VLANCONFIGDXE_INF_GUID \
EFI_GUID(0xe4f61863, 0xfe2c, 0x4b56, 0xa8, 0xf4, 0x08, 0x51, 0x9b, 0xc4, 0x39, 0xdf)
+#define EFI_TIMESTAMP_PROTOCOL_GUID \
+ EFI_GUID(0xafbfde41, 0x2e6e, 0x4262, 0xba, 0x65, 0x62, 0xb9, 0x23, 0x6e, 0x54, 0x95)
+
/* barebox specific GUIDs */
#define EFI_BAREBOX_VENDOR_GUID \
EFI_GUID(0x5b91f69c, 0x8b88, 0x4a2b, 0x92, 0x69, 0x5f, 0x1d, 0x80, 0x2b, 0x51, 0x75)
@@ -477,6 +499,14 @@ extern efi_runtime_services_t *RT;
#define EFI_SYSTEMD_VENDOR_GUID \
EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f)
+/* for TPM 1.2 */
+#define EFI_TCG_PROTOCOL_GUID \
+ EFI_GUID(0xf541796d, 0xa62e, 0x4954, 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd)
+
+/* for TPM 2.0 */
+#define EFI_TCG2_PROTOCOL_GUID \
+ EFI_GUID(0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f)
+
extern efi_guid_t efi_file_info_id;
extern efi_guid_t efi_simple_file_system_protocol_guid;
extern efi_guid_t efi_device_path_protocol_guid;
@@ -488,6 +518,11 @@ extern efi_guid_t efi_block_io_protocol_guid;
extern efi_guid_t efi_barebox_vendor_guid;
extern efi_guid_t efi_systemd_vendor_guid;
+typedef struct {
+ efi_guid_t guid;
+ unsigned long table;
+} efi_config_table_t;
+
#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
#define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30))
@@ -510,7 +545,7 @@ typedef struct {
efi_runtime_services_t *runtime;
efi_boot_services_t *boottime;
unsigned long nr_tables;
- unsigned long tables;
+ efi_config_table_t *tables;
} efi_system_table_t;
typedef struct {
diff --git a/include/efi/debug_ll.h b/include/efi/debug_ll.h
new file mode 100644
index 0000000000..4ca72de312
--- /dev/null
+++ b/include/efi/debug_ll.h
@@ -0,0 +1,20 @@
+#ifndef __MACH_DEBUG_LL_H__
+#define __MACH_DEBUG_LL_H__
+
+#define EFI_DEBUG 0
+#define EFI_DEBUG_CLEAR_MEMORY 0
+
+#include <efi.h>
+#include <efi/efi.h>
+
+static inline void PUTC_LL(char c)
+{
+ uint16_t str[2] = {};
+ struct efi_simple_text_output_protocol *con_out = efi_sys_table->con_out;
+
+ str[0] = c;
+
+ con_out->output_string(con_out, str);
+}
+
+#endif
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..648afb9ec5
--- /dev/null
+++ b/include/efi/efi.h
@@ -0,0 +1,26 @@
+#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);
+
+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 */