]> git.sur5r.net Git - u-boot/blobdiff - include/efi_api.h
efi_loader: use const for GUIDs in the EFI_FILE_PROTOCOL
[u-boot] / include / efi_api.h
index 584016dc302d0368fc047b233d9c657c74dbe08d..8af466a6dc7f5421c13a541a6130306e957f1c1f 100644 (file)
@@ -84,11 +84,12 @@ struct efi_boot_services {
        efi_status_t (EFIAPI *reinstall_protocol_interface)(
                        void *handle, const efi_guid_t *protocol,
                        void *old_interface, void *new_interface);
-       efi_status_t (EFIAPI *uninstall_protocol_interface)(void *handle,
-                       const efi_guid_t *protocol, void *protocol_interface);
-       efi_status_t (EFIAPI *handle_protocol)(efi_handle_t,
-                                              const efi_guid_t *protocol,
-                                              void **protocol_interface);
+       efi_status_t (EFIAPI *uninstall_protocol_interface)(
+                       efi_handle_t handle, const efi_guid_t *protocol,
+                       void *protocol_interface);
+       efi_status_t (EFIAPI *handle_protocol)(
+                       efi_handle_t handle, const efi_guid_t *protocol,
+                       void **protocol_interface);
        void *reserved;
        efi_status_t (EFIAPI *register_protocol_notify)(
                        const efi_guid_t *protocol, struct efi_event *event,
@@ -106,14 +107,14 @@ struct efi_boot_services {
        efi_status_t (EFIAPI *load_image)(bool boot_policiy,
                        efi_handle_t parent_image,
                        struct efi_device_path *file_path, void *source_buffer,
-                       unsigned long source_size, efi_handle_t *image);
+                       efi_uintn_t source_size, efi_handle_t *image);
        efi_status_t (EFIAPI *start_image)(efi_handle_t handle,
                                           unsigned long *exitdata_size,
                                           s16 **exitdata);
        efi_status_t (EFIAPI *exit)(efi_handle_t handle,
                                    efi_status_t exit_status,
                                    unsigned long exitdata_size, s16 *exitdata);
-       efi_status_t (EFIAPI *unload_image)(void *image_handle);
+       efi_status_t (EFIAPI *unload_image)(efi_handle_t image_handle);
        efi_status_t (EFIAPI *exit_boot_services)(efi_handle_t, unsigned long);
 
        efi_status_t (EFIAPI *get_next_monotonic_count)(u64 *count);
@@ -125,8 +126,10 @@ struct efi_boot_services {
                        efi_handle_t *driver_image_handle,
                        struct efi_device_path *remaining_device_path,
                        bool recursive);
-       efi_status_t (EFIAPI *disconnect_controller)(void *controller_handle,
-                       void *driver_image_handle, void *child_handle);
+       efi_status_t (EFIAPI *disconnect_controller)(
+                       efi_handle_t controller_handle,
+                       efi_handle_t driver_image_handle,
+                       efi_handle_t child_handle);
 #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x00000001
 #define EFI_OPEN_PROTOCOL_GET_PROTOCOL        0x00000002
 #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL       0x00000004
@@ -137,9 +140,10 @@ struct efi_boot_services {
                        const efi_guid_t *protocol, void **interface,
                        efi_handle_t agent_handle,
                        efi_handle_t controller_handle, u32 attributes);
-       efi_status_t (EFIAPI *close_protocol)(void *handle,
-                       const efi_guid_t *protocol, void *agent_handle,
-                       void *controller_handle);
+       efi_status_t (EFIAPI *close_protocol)(
+                       efi_handle_t handle, const efi_guid_t *protocol,
+                       efi_handle_t agent_handle,
+                       efi_handle_t controller_handle);
        efi_status_t(EFIAPI *open_protocol_information)(efi_handle_t handle,
                        const efi_guid_t *protocol,
                        struct efi_open_protocol_info_entry **entry_buffer,
@@ -162,20 +166,39 @@ struct efi_boot_services {
        void (EFIAPI *copy_mem)(void *destination, const void *source,
                        size_t length);
        void (EFIAPI *set_mem)(void *buffer, size_t size, uint8_t value);
-       void *create_event_ex;
+       efi_status_t (EFIAPI *create_event_ex)(
+                               uint32_t type, efi_uintn_t notify_tpl,
+                               void (EFIAPI *notify_function) (
+                                       struct efi_event *event,
+                                       void *context),
+                               void *notify_context,
+                               efi_guid_t *event_group,
+                               struct efi_event **event);
 };
 
 /* Types and defines for EFI ResetSystem */
 enum efi_reset_type {
        EFI_RESET_COLD = 0,
        EFI_RESET_WARM = 1,
-       EFI_RESET_SHUTDOWN = 2
+       EFI_RESET_SHUTDOWN = 2,
+       EFI_RESET_PLATFORM_SPECIFIC = 3,
 };
 
 /* EFI Runtime Services table */
 #define EFI_RUNTIME_SERVICES_SIGNATURE 0x5652453544e5552ULL
 #define EFI_RUNTIME_SERVICES_REVISION  0x00010000
 
+#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET     0x00010000
+#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE    0x00020000
+#define CAPSULE_FLAGS_INITIATE_RESET           0x00040000
+
+struct efi_capsule_header {
+       efi_guid_t *capsule_guid;
+       u32 header_size;
+       u32 flags;
+       u32 capsule_image_size;
+};
+
 struct efi_runtime_services {
        struct efi_table_hdr hdr;
        efi_status_t (EFIAPI *get_time)(struct efi_time *time,
@@ -205,11 +228,43 @@ struct efi_runtime_services {
        void (EFIAPI *reset_system)(enum efi_reset_type reset_type,
                                    efi_status_t reset_status,
                                    unsigned long data_size, void *reset_data);
-       void *update_capsule;
-       void *query_capsule_caps;
-       void *query_variable_info;
+       efi_status_t (EFIAPI *update_capsule)(
+                       struct efi_capsule_header **capsule_header_array,
+                       efi_uintn_t capsule_count,
+                       u64 scatter_gather_list);
+       efi_status_t (EFIAPI *query_capsule_caps)(
+                       struct efi_capsule_header **capsule_header_array,
+                       efi_uintn_t capsule_count,
+                       u64 maximum_capsule_size,
+                       u32 reset_type);
+       efi_status_t (EFIAPI *query_variable_info)(
+                       u32 attributes,
+                       u64 maximum_variable_storage_size,
+                       u64 remaining_variable_storage_size,
+                       u64 maximum_variable_size);
 };
 
+/* EFI event group GUID definitions */
+#define EFI_EVENT_GROUP_EXIT_BOOT_SERVICES \
+       EFI_GUID(0x27abf055, 0xb1b8, 0x4c26, 0x80, 0x48, \
+                0x74, 0x8f, 0x37, 0xba, 0xa2, 0xdf)
+
+#define EFI_EVENT_GROUP_VIRTUAL_ADDRESS_CHANGE \
+       EFI_GUID(0x13fa7698, 0xc831, 0x49c7, 0x87, 0xea, \
+                0x8f, 0x43, 0xfc, 0xc2, 0x51, 0x96)
+
+#define EFI_EVENT_GROUP_MEMORY_MAP_CHANGE \
+       EFI_GUID(0x78bee926, 0x692f, 0x48fd, 0x9e, 0xdb, \
+                0x01, 0x42, 0x2e, 0xf0, 0xd7, 0xab)
+
+#define EFI_EVENT_GROUP_READY_TO_BOOT \
+       EFI_GUID(0x7ce88fb3, 0x4bd7, 0x4679, 0x87, 0xa8, \
+                0xa8, 0xd8, 0xde, 0xe5, 0x0d, 0x2b)
+
+#define EFI_EVENT_GROUP_RESET_SYSTEM \
+       EFI_GUID(0x62da6a56, 0x13fb, 0x485a, 0xa8, 0xda, \
+                0xa3, 0xdd, 0x79, 0x12, 0xcb, 0x6b)
+
 /* EFI Configuration Table and GUID definitions */
 #define NULL_GUID \
        EFI_GUID(0x00000000, 0x0000, 0x0000, 0x00, 0x00, \
@@ -243,11 +298,11 @@ struct efi_system_table {
        struct efi_table_hdr hdr;
        unsigned long fw_vendor;   /* physical addr of wchar_t vendor string */
        u32 fw_revision;
-       unsigned long con_in_handle;
+       efi_handle_t con_in_handle;
        struct efi_simple_input_interface *con_in;
-       unsigned long con_out_handle;
+       efi_handle_t con_out_handle;
        struct efi_simple_text_output_protocol *con_out;
-       unsigned long stderr_handle;
+       efi_handle_t stderr_handle;
        struct efi_simple_text_output_protocol *std_err;
        struct efi_runtime_services *runtime;
        struct efi_boot_services *boottime;
@@ -263,8 +318,8 @@ struct efi_loaded_image {
        u32 revision;
        void *parent_handle;
        struct efi_system_table *system_table;
-       void *device_handle;
-       void *file_path;
+       efi_handle_t device_handle;
+       struct efi_device_path *file_path;
        void *reserved;
        u32 load_options_size;
        void *load_options;
@@ -276,6 +331,8 @@ struct efi_loaded_image {
 
        /* Below are efi loader private fields */
 #ifdef CONFIG_EFI_LOADER
+       void *reloc_base;
+       aligned_u64 reloc_size;
        efi_status_t exit_status;
        struct jmp_buf_data exit_jmp;
 #endif
@@ -329,12 +386,27 @@ struct efi_device_path_acpi_path {
 } __packed;
 
 #define DEVICE_PATH_TYPE_MESSAGING_DEVICE      0x03
+#  define DEVICE_PATH_SUB_TYPE_MSG_ATAPI       0x01
+#  define DEVICE_PATH_SUB_TYPE_MSG_SCSI                0x02
 #  define DEVICE_PATH_SUB_TYPE_MSG_USB         0x05
 #  define DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR    0x0b
 #  define DEVICE_PATH_SUB_TYPE_MSG_USB_CLASS   0x0f
 #  define DEVICE_PATH_SUB_TYPE_MSG_SD          0x1a
 #  define DEVICE_PATH_SUB_TYPE_MSG_MMC         0x1d
 
+struct efi_device_path_atapi {
+       struct efi_device_path dp;
+       u8 primary_secondary;
+       u8 slave_master;
+       u16 logical_unit_number;
+} __packed;
+
+struct efi_device_path_scsi {
+       struct efi_device_path dp;
+       u16 target_id;
+       u16 logical_unit_number;
+} __packed;
+
 struct efi_device_path_usb {
        struct efi_device_path dp;
        u8 parent_port_number;
@@ -405,18 +477,26 @@ struct efi_block_io_media
        u32 io_align;
        u8 pad2[4];
        u64 last_block;
+       /* Added in revision 2 of the protocol */
+       u64 lowest_aligned_lba;
+       u32 logical_blocks_per_physical_block;
+       /* Added in revision 3 of the protocol */
+       u32 optimal_transfer_length_granualarity;
 };
 
+#define EFI_BLOCK_IO_PROTOCOL_REVISION2        0x00020001
+#define EFI_BLOCK_IO_PROTOCOL_REVISION3        0x0002001f
+
 struct efi_block_io {
        u64 revision;
        struct efi_block_io_media *media;
        efi_status_t (EFIAPI *reset)(struct efi_block_io *this,
                        char extended_verification);
        efi_status_t (EFIAPI *read_blocks)(struct efi_block_io *this,
-                       u32 media_id, u64 lba, unsigned long buffer_size,
+                       u32 media_id, u64 lba, efi_uintn_t buffer_size,
                        void *buffer);
        efi_status_t (EFIAPI *write_blocks)(struct efi_block_io *this,
-                       u32 media_id, u64 lba, unsigned long buffer_size,
+                       u32 media_id, u64 lba, efi_uintn_t buffer_size,
                        void *buffer);
        efi_status_t (EFIAPI *flush_blocks)(struct efi_block_io *this);
 };
@@ -515,24 +595,6 @@ struct efi_simple_input_interface {
        struct efi_event *wait_for_key;
 };
 
-#define CONSOLE_CONTROL_GUID \
-       EFI_GUID(0xf42f7782, 0x12e, 0x4c12, \
-                0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21)
-#define EFI_CONSOLE_MODE_TEXT  0
-#define EFI_CONSOLE_MODE_GFX   1
-
-struct efi_console_control_protocol
-{
-       efi_status_t (EFIAPI *get_mode)(
-                       struct efi_console_control_protocol *this, int *mode,
-                       char *uga_exists, char *std_in_locked);
-       efi_status_t (EFIAPI *set_mode)(
-                       struct efi_console_control_protocol *this, int mode);
-       efi_status_t (EFIAPI *lock_std_in)(
-                       struct efi_console_control_protocol *this,
-                       uint16_t *password);
-};
-
 #define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \
        EFI_GUID(0x8b843e20, 0x8132, 0x4852, \
                 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c)
@@ -549,6 +611,35 @@ struct efi_device_path_to_text_protocol
                        bool allow_shortcuts);
 };
 
+#define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \
+       EFI_GUID(0x0379be4e, 0xd706, 0x437d, \
+                0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4)
+
+struct efi_device_path_utilities_protocol {
+       efi_uintn_t (EFIAPI *get_device_path_size)(
+               const struct efi_device_path *device_path);
+       struct efi_device_path *(EFIAPI *duplicate_device_path)(
+               const struct efi_device_path *device_path);
+       struct efi_device_path *(EFIAPI *append_device_path)(
+               const struct efi_device_path *src1,
+               const struct efi_device_path *src2);
+       struct efi_device_path *(EFIAPI *append_device_node)(
+               const struct efi_device_path *device_path,
+               const struct efi_device_path *device_node);
+       struct efi_device_path *(EFIAPI *append_device_path_instance)(
+               const struct efi_device_path *device_path,
+               const struct efi_device_path *device_path_instance);
+       struct efi_device_path *(EFIAPI *get_next_device_path_instance)(
+               struct efi_device_path **device_path_instance,
+               efi_uintn_t *device_path_instance_size);
+       bool (EFIAPI *is_device_path_multi_instance)(
+               const struct efi_device_path *device_path);
+       struct efi_device_path *(EFIAPI *create_device_node)(
+               uint8_t node_type,
+               uint8_t node_sub_type,
+               uint16_t node_length);
+};
+
 #define EFI_GOP_GUID \
        EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, \
                 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a)
@@ -577,6 +668,13 @@ struct efi_gop_mode
        unsigned long fb_size;
 };
 
+struct efi_gop_pixel {
+       u8 blue;
+       u8 green;
+       u8 red;
+       u8 reserved;
+};
+
 #define EFI_BLT_VIDEO_FILL             0
 #define EFI_BLT_VIDEO_TO_BLT_BUFFER    1
 #define EFI_BLT_BUFFER_TO_VIDEO                2
@@ -588,7 +686,8 @@ struct efi_gop
                                          efi_uintn_t *size_of_info,
                                          struct efi_gop_mode_info **info);
        efi_status_t (EFIAPI *set_mode)(struct efi_gop *this, u32 mode_number);
-       efi_status_t (EFIAPI *blt)(struct efi_gop *this, void *buffer,
+       efi_status_t (EFIAPI *blt)(struct efi_gop *this,
+                                  struct efi_gop_pixel *buffer,
                                   u32 operation, efi_uintn_t sx,
                                   efi_uintn_t sy, efi_uintn_t dx,
                                   efi_uintn_t dy, efi_uintn_t width,
@@ -606,7 +705,7 @@ struct efi_mac_address {
 
 struct efi_ip_address {
        u8 ip_addr[16];
-};
+} __attribute__((aligned(4)));
 
 enum efi_simple_network_state {
        EFI_NETWORK_STOPPED,
@@ -700,7 +799,28 @@ struct efi_pxe_packet {
 
 struct efi_pxe_mode
 {
-       u8 unused[52];
+       u8 started;
+       u8 ipv6_available;
+       u8 ipv6_supported;
+       u8 using_ipv6;
+       u8 bis_supported;
+       u8 bis_detected;
+       u8 auto_arp;
+       u8 send_guid;
+       u8 dhcp_discover_valid;
+       u8 dhcp_ack_received;
+       u8 proxy_offer_received;
+       u8 pxe_discover_valid;
+       u8 pxe_reply_received;
+       u8 pxe_bis_reply_received;
+       u8 icmp_error_received;
+       u8 tftp_error_received;
+       u8 make_callbacks;
+       u8 ttl;
+       u8 tos;
+       u8 pad;
+       struct efi_ip_address station_ip;
+       struct efi_ip_address subnet_mask;
        struct efi_pxe_packet dhcp_discover;
        struct efi_pxe_packet dhcp_ack;
        struct efi_pxe_packet proxy_offer;
@@ -738,17 +858,19 @@ struct efi_file_handle {
        efi_status_t (EFIAPI *close)(struct efi_file_handle *file);
        efi_status_t (EFIAPI *delete)(struct efi_file_handle *file);
        efi_status_t (EFIAPI *read)(struct efi_file_handle *file,
-                       u64 *buffer_size, void *buffer);
+                       efi_uintn_t *buffer_size, void *buffer);
        efi_status_t (EFIAPI *write)(struct efi_file_handle *file,
-                       u64 *buffer_size, void *buffer);
+                       efi_uintn_t *buffer_size, void *buffer);
        efi_status_t (EFIAPI *getpos)(struct efi_file_handle *file,
-                       u64 *pos);
+                       efi_uintn_t *pos);
        efi_status_t (EFIAPI *setpos)(struct efi_file_handle *file,
-                       u64 pos);
+                       efi_uintn_t pos);
        efi_status_t (EFIAPI *getinfo)(struct efi_file_handle *file,
-                       efi_guid_t *info_type, u64 *buffer_size, void *buffer);
+                       const efi_guid_t *info_type, efi_uintn_t *buffer_size,
+                       void *buffer);
        efi_status_t (EFIAPI *setinfo)(struct efi_file_handle *file,
-                       efi_guid_t *info_type, u64 buffer_size, void *buffer);
+                       const efi_guid_t *info_type, efi_uintn_t buffer_size,
+                       void *buffer);
        efi_status_t (EFIAPI *flush)(struct efi_file_handle *file);
 };
 
@@ -790,4 +912,26 @@ struct efi_file_info {
        s16 file_name[0];
 };
 
+#define EFI_DRIVER_BINDING_PROTOCOL_GUID \
+       EFI_GUID(0x18a031ab, 0xb443, 0x4d1a,\
+                0xa5, 0xc0, 0x0c, 0x09, 0x26, 0x1e, 0x9f, 0x71)
+struct efi_driver_binding_protocol {
+       efi_status_t (EFIAPI * supported)(
+                       struct efi_driver_binding_protocol *this,
+                       efi_handle_t controller_handle,
+                       struct efi_device_path *remaining_device_path);
+       efi_status_t (EFIAPI * start)(
+                       struct efi_driver_binding_protocol *this,
+                       efi_handle_t controller_handle,
+                       struct efi_device_path *remaining_device_path);
+       efi_status_t (EFIAPI * stop)(
+                       struct efi_driver_binding_protocol *this,
+                       efi_handle_t controller_handle,
+                       efi_uintn_t number_of_children,
+                       efi_handle_t *child_handle_buffer);
+       u32 version;
+       efi_handle_t image_handle;
+       efi_handle_t driver_binding_handle;
+};
+
 #endif