]> git.sur5r.net Git - u-boot/blobdiff - include/efi.h
Merge branch 'master' of git://git.denx.de/u-boot-sunxi
[u-boot] / include / efi.h
index a432c892cc5bee9735295406584f57d57adeb6d1..0fe15e65c06c6737d2c6b5ce1da765b25c5afc80 100644 (file)
 #include <linux/string.h>
 #include <linux/types.h>
 
-#ifdef CONFIG_EFI_STUB_64BIT
-/* EFI uses the Microsoft ABI which is not the default for GCC */
+/*
+ * EFI on x86_64 uses the Microsoft ABI which is not the default for GCC.
+ *
+ * There are two scenarios for EFI on x86_64: building a 64-bit EFI stub
+ * codes (CONFIG_EFI_STUB_64BIT) and building a 64-bit U-Boot (CONFIG_X86_64).
+ * Either needs to be properly built with the '-m64' compiler flag, and hence
+ * it is enough to only check the compiler provided define __x86_64__ here.
+ */
+#ifdef __x86_64__
 #define EFIAPI __attribute__((ms_abi))
 #else
 #define EFIAPI asmlinkage
-#endif
+#endif /* __x86_64__ */
 
 struct efi_device_path;
 
@@ -32,16 +39,7 @@ typedef struct {
        u8 b[16];
 } efi_guid_t;
 
-#define EFI_BITS_PER_LONG      BITS_PER_LONG
-
-/*
- * With 64-bit EFI stub, EFI_BITS_PER_LONG has to be 64. EFI_STUB is set
- * in lib/efi/Makefile, when building the stub.
- */
-#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
-#undef EFI_BITS_PER_LONG
-#define EFI_BITS_PER_LONG      64
-#endif
+#define EFI_BITS_PER_LONG      (sizeof(long) * 8)
 
 /* Bit mask for EFI status code with error */
 #define EFI_ERROR_MASK (1UL << (EFI_BITS_PER_LONG - 1))
@@ -89,12 +87,11 @@ typedef u64 efi_virtual_addr_t;
 typedef void *efi_handle_t;
 
 #define EFI_GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
-       ((efi_guid_t) \
        {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, \
                ((a) >> 24) & 0xff, \
                (b) & 0xff, ((b) >> 8) & 0xff, \
                (c) & 0xff, ((c) >> 8) & 0xff, \
-               (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) } })
+               (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) } }
 
 /* Generic EFI table header */
 struct efi_table_hdr {
@@ -227,9 +224,9 @@ struct efi_time_cap {
 };
 
 enum efi_locate_search_type {
-       all_handles,
-       by_register_notify,
-       by_protocol
+       ALL_HANDLES,
+       BY_REGISTER_NOTIFY,
+       BY_PROTOCOL
 };
 
 struct efi_open_protocol_info_entry {
@@ -242,6 +239,7 @@ struct efi_open_protocol_info_entry {
 enum efi_entry_t {
        EFIET_END,      /* Signals this is the last (empty) entry */
        EFIET_MEMORY_MAP,
+       EFIET_GOP_MODE,
 
        /* Number of entries */
        EFIET_MEMORY_COUNT,
@@ -298,6 +296,40 @@ struct efi_entry_memmap {
        struct efi_mem_desc desc[];
 };
 
+/**
+ * struct efi_entry_gopmode - a GOP mode table passed to U-Boot
+ *
+ * @fb_base:   EFI's framebuffer base address
+ * @fb_size:   EFI's framebuffer size
+ * @info_size: GOP mode info structure size
+ * @info:      Start address of the GOP mode info structure
+ */
+struct efi_entry_gopmode {
+       efi_physical_addr_t fb_base;
+       /*
+        * Not like the ones in 'struct efi_gop_mode' which are 'unsigned
+        * long', @fb_size and @info_size have to be 'u64' here. As the EFI
+        * stub codes may have different bit size from the U-Boot payload,
+        * using 'long' will cause mismatch between the producer (stub) and
+        * the consumer (payload).
+        */
+       u64 fb_size;
+       u64 info_size;
+       /*
+        * We cannot directly use 'struct efi_gop_mode_info info[]' here as
+        * it causes compiler to complain: array type has incomplete element
+        * type 'struct efi_gop_mode_info'.
+        */
+       struct /* efi_gop_mode_info */ {
+               u32 version;
+               u32 width;
+               u32 height;
+               u32 pixel_format;
+               u32 pixel_bitmask[4];
+               u32 pixels_per_scanline;
+       } info[];
+};
+
 static inline struct efi_mem_desc *efi_get_next_mem_desc(
                struct efi_entry_memmap *map, struct efi_mem_desc *desc)
 {
@@ -324,6 +356,25 @@ extern char image_base[];
 /* Start and end of U-Boot image (for payload) */
 extern char _binary_u_boot_bin_start[], _binary_u_boot_bin_end[];
 
+/*
+ * Variable Attributes
+ */
+#define EFI_VARIABLE_NON_VOLATILE       0x0000000000000001
+#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002
+#define EFI_VARIABLE_RUNTIME_ACCESS     0x0000000000000004
+#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x0000000000000008
+#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x0000000000000010
+#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x0000000000000020
+#define EFI_VARIABLE_APPEND_WRITE      0x0000000000000040
+
+#define EFI_VARIABLE_MASK      (EFI_VARIABLE_NON_VOLATILE | \
+                               EFI_VARIABLE_BOOTSERVICE_ACCESS | \
+                               EFI_VARIABLE_RUNTIME_ACCESS | \
+                               EFI_VARIABLE_HARDWARE_ERROR_RECORD | \
+                               EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | \
+                               EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \
+                               EFI_VARIABLE_APPEND_WRITE)
+
 /**
  * efi_get_sys_table() - Get access to the main EFI system table
  *