]> Git Repo - J-u-boot.git/blobdiff - include/efi_api.h
Merge tag 'v2025.01-rc6' into next
[J-u-boot.git] / include / efi_api.h
index 00c98e0984d5ae3b32f36d731d4165680efb48e4..61c4eda8f8a7f90ec9e79278bda68120f8a8620a 100644 (file)
@@ -21,7 +21,7 @@
 #include <pe.h>
 
 /* UEFI spec version 2.9 */
-#define EFI_SPECIFICATION_VERSION (2 << 16 | 90)
+#define EFI_SPECIFICATION_VERSION (2 << 16 | 100)
 
 /* Types and defines for EFI CreateEvent */
 enum efi_timer_delay {
@@ -192,7 +192,7 @@ struct efi_boot_services {
                                        struct efi_event *event,
                                        void *context),
                                void *notify_context,
-                               efi_guid_t *event_group,
+                               const efi_guid_t *event_group,
                                struct efi_event **event);
 };
 
@@ -404,6 +404,9 @@ struct efi_runtime_services {
 #define EFI_EVENT_GROUP_RESET_SYSTEM \
        EFI_GUID(0x62da6a56, 0x13fb, 0x485a, 0xa8, 0xda, \
                 0xa3, 0xdd, 0x79, 0x12, 0xcb, 0x6b)
+#define EFI_EVENT_GROUP_RETURN_TO_EFIBOOTMGR \
+       EFI_GUID(0xb4a40fe6, 0x9149, 0x4f29, 0x94, 0x47, \
+                0x49, 0x38, 0x7a, 0x7f, 0xab, 0x87)
 
 /* EFI Configuration Table and GUID definitions */
 #define NULL_GUID \
@@ -430,6 +433,10 @@ struct efi_runtime_services {
        EFI_GUID(0xeb9d2d31, 0x2d88, 0x11d3,  \
                 0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
 
+#define SMBIOS3_TABLE_GUID \
+       EFI_GUID(0xf2fd1544, 0x9794, 0x4a2c, \
+                0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94)
+
 #define EFI_LOAD_FILE_PROTOCOL_GUID \
        EFI_GUID(0x56ec3091, 0x954c, 0x11d2, \
                 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
@@ -513,6 +520,16 @@ struct efi_system_table {
        struct efi_configuration_table *tables;
 };
 
+/**
+ * efi_main() - entry point of EFI applications
+ *
+ * @image_handle:      handle with the Loaded Image Protocol
+ * @systab:            pointer to the system table
+ * Return:             status code
+ */
+efi_status_t EFIAPI efi_main(efi_handle_t image_handle,
+                            struct efi_system_table *systab);
+
 #define EFI_LOADED_IMAGE_PROTOCOL_GUID \
        EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, \
                 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
@@ -547,12 +564,6 @@ struct efi_loaded_image {
 #  define DEVICE_PATH_SUB_TYPE_INSTANCE_END    0x01
 #  define DEVICE_PATH_SUB_TYPE_END             0xff
 
-struct efi_device_path {
-       u8 type;
-       u8 sub_type;
-       u16 length;
-} __packed;
-
 struct efi_mac_addr {
        u8 addr[32];
 } __packed;
@@ -560,6 +571,7 @@ struct efi_mac_addr {
 #define DEVICE_PATH_TYPE_HARDWARE_DEVICE       0x01
 #  define DEVICE_PATH_SUB_TYPE_MEMORY          0x03
 #  define DEVICE_PATH_SUB_TYPE_VENDOR          0x04
+#  define DEVICE_PATH_SUB_TYPE_CONTROLLER      0x05
 
 struct efi_device_path_memory {
        struct efi_device_path dp;
@@ -574,6 +586,18 @@ struct efi_device_path_vendor {
        u8 vendor_data[];
 } __packed;
 
+struct efi_device_path_udevice {
+       struct efi_device_path dp;
+       efi_guid_t guid;
+       int uclass_id;
+       int dev_number;
+} __packed;
+
+struct efi_device_path_controller {
+       struct efi_device_path dp;
+       u32 controller_number;
+} __packed;
+
 #define DEVICE_PATH_TYPE_ACPI_DEVICE           0x02
 #  define DEVICE_PATH_SUB_TYPE_ACPI_DEVICE     0x01
 
@@ -592,8 +616,10 @@ struct efi_device_path_acpi_path {
 #  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_IPV4                0x0c
 #  define DEVICE_PATH_SUB_TYPE_MSG_UART                0x0e
 #  define DEVICE_PATH_SUB_TYPE_MSG_USB_CLASS   0x0f
+#  define DEVICE_PATH_SUB_TYPE_MSG_USB_WWI     0x10
 #  define DEVICE_PATH_SUB_TYPE_MSG_SATA                0x12
 #  define DEVICE_PATH_SUB_TYPE_MSG_NVME                0x17
 #  define DEVICE_PATH_SUB_TYPE_MSG_URI         0x18
@@ -666,6 +692,22 @@ struct efi_device_path_uri {
        u8 uri[];
 } __packed;
 
+struct efi_ipv4_address {
+       u8 ip_addr[4];
+};
+
+struct efi_device_path_ipv4 {
+       struct efi_device_path dp;
+       struct efi_ipv4_address local_ip_address;
+       struct efi_ipv4_address remote_ip_address;
+       u16 local_port;
+       u16 remote_port;
+       u16 protocol;
+       u8 static_ip_address;
+       struct efi_ipv4_address gateway_ip_address;
+       struct efi_ipv4_address subnet_mask;
+} __packed;
+
 #define DEVICE_PATH_TYPE_MEDIA_DEVICE          0x04
 #  define DEVICE_PATH_SUB_TYPE_HARD_DRIVE_PATH 0x01
 #  define DEVICE_PATH_SUB_TYPE_CDROM_PATH      0x02
@@ -817,7 +859,7 @@ struct efi_simple_text_output_protocol {
 
 struct efi_input_key {
        u16 scan_code;
-       s16 unicode_char;
+       u16 unicode_char;
 };
 
 #define EFI_SHIFT_STATE_INVALID                0x00000000
@@ -1159,10 +1201,36 @@ struct efi_key_descriptor {
 
 struct efi_hii_keyboard_layout {
        u16 layout_length;
-       efi_guid_t guid;
+       /*
+        * The EFI spec defines this as efi_guid_t.
+        * clang and gcc both report alignment problems here.
+        * clang with -Wunaligned-access
+        * warning: field guid within 'struct efi_hii_keyboard_layout' is less
+        * aligned than 'efi_guid_t' and is usually due to
+        * 'struct efi_hii_keyboard_layout' being packed, which can lead to
+        * unaligned accesses
+        *
+        * GCC with -Wpacked-not-aligned -Waddress-of-packed-member
+        * 'efi_guid_t' offset 2 in 'struct efi_hii_keyboard_layout'
+        * isn't aligned to 4
+        *
+        * Removing the alignment from efi_guid_t is not an option, since
+        * it is also used in non-packed structs and that would break
+        * calculations with offsetof
+        *
+        * This is the only place we get a report for. That happens because
+        * all other declarations of efi_guid_t within a packed struct happens
+        * to be 4-byte aligned.  i.e a u32, a u64 a 2 * u16 or any combination
+        * that ends up landing efi_guid_t on a 4byte boundary precedes.
+        *
+        * Replace this with a 1-byte aligned counterpart of b[16].  This is a
+        * packed struct so the memory  placement of efi_guid_t should not change
+        *
+        */
+       u8 guid[16];
        u32 layout_descriptor_string_offset;
        u8 descriptor_count;
-       struct efi_key_descriptor descriptors[];
+       /* struct efi_key_descriptor descriptors[]; follows here */
 } __packed;
 
 struct efi_hii_keyboard_package {
@@ -1657,6 +1725,209 @@ struct efi_pxe_base_code_protocol {
        struct efi_pxe_mode *mode;
 };
 
+#define EFI_IP4_CONFIG2_PROTOCOL_GUID \
+       EFI_GUID(0x5b446ed1, 0xe30b, 0x4faa, \
+                0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80)
+
+enum efi_ip4_config2_data_type {
+       EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
+       EFI_IP4_CONFIG2_DATA_TYPE_POLICY,
+       EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
+       EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY,
+       EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+       EFI_IP4_CONFIG2_DATA_TYPE_MAXIMUM,
+};
+
+struct efi_ip4_config2_protocol {
+       efi_status_t (EFIAPI * set_data)(struct efi_ip4_config2_protocol *this,
+                                        enum efi_ip4_config2_data_type data_type,
+                                        efi_uintn_t data_size,
+                                        void *data);
+       efi_status_t (EFIAPI * get_data)(struct efi_ip4_config2_protocol *this,
+                                        enum efi_ip4_config2_data_type data_type,
+                                        efi_uintn_t *data_size,
+                                        void *data);
+       efi_status_t (EFIAPI * register_data_notify)(struct efi_ip4_config2_protocol *this,
+                                                    enum efi_ip4_config2_data_type data_type,
+                                                    struct efi_event *event);
+       efi_status_t (EFIAPI * unregister_data_notify)(struct efi_ip4_config2_protocol *this,
+                                                      enum efi_ip4_config2_data_type data_type,
+                                                      struct efi_event *event);
+};
+
+struct efi_ip4_route_table {
+       struct efi_ipv4_address subnet_address;
+       struct efi_ipv4_address subnet_mask;
+       struct efi_ipv4_address gateway_address;
+};
+
+#define EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE 32
+
+struct efi_ip4_config2_interface_info {
+       u16 name[EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE];
+       u8 if_type;
+       u32 hw_address_size;
+       struct efi_mac_address hw_address;
+       struct efi_ipv4_address station_address;
+       struct efi_ipv4_address subnet_mask;
+       u32 route_table_size;
+       struct efi_ip4_route_table *route_table;
+};
+
+enum efi_ip4_config2_policy {
+       EFI_IP4_CONFIG2_POLICY_STATIC,
+       EFI_IP4_CONFIG2_POLICY_DHCP,
+       EFI_IP4_CONFIG2_POLICY_MAX
+};
+
+struct efi_ip4_config2_manual_address {
+       struct efi_ipv4_address address;
+       struct efi_ipv4_address subnet_mask;
+};
+
+#define EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID \
+       EFI_GUID(0xbdc8e6af, 0xd9bc, 0x4379, \
+                0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 0x1c)
+
+struct efi_service_binding_protocol {
+       efi_status_t (EFIAPI * create_child)(struct efi_service_binding_protocol *this,
+                                            efi_handle_t *child_handle);
+       efi_status_t (EFIAPI * destroy_child)(struct efi_service_binding_protocol *this,
+                                             efi_handle_t child_handle);
+};
+
+#define EFI_HTTP_PROTOCOL_GUID \
+       EFI_GUID(0x7A59B29B, 0x910B, 0x4171, \
+                0x82, 0x42, 0xA8, 0x5A, 0x0D, 0xF2, 0x5B, 0x5B)
+
+enum efi_http_version {
+       HTTPVERSION10,
+       HTTPVERSION11,
+       HTTPVERSIONUNSUPPORTED
+};
+
+struct efi_httpv4_access_point {
+       bool use_default_address;
+       struct efi_ipv4_address local_address;
+       struct efi_ipv4_address local_subnet;
+       u16 local_port;
+};
+
+union efi_http_access_point {
+       struct efi_httpv4_access_point *ipv4_node;
+       struct efi_httpv6_access_point *ipv6_node;
+};
+
+struct efi_http_config_data {
+       enum efi_http_version http_version;
+       u32 timeout;
+       bool is_ipv6;
+       union efi_http_access_point access_point;
+};
+
+enum efi_http_method {
+       HTTP_METHOD_GET,
+       HTTP_METHOD_POST,
+       HTTP_METHOD_PATCH,
+       HTTP_METHOD_OPTIONS,
+       HTTP_METHOD_CONNECT,
+       HTTP_METHOD_HEAD,
+       HTTP_METHOD_PUT,
+       HTTP_METHOD_DELETE,
+       HTTP_METHOD_TRACE,
+       HTTP_METHOD_MAX
+};
+
+enum efi_http_status_code {
+       HTTP_STATUS_UNSUPPORTED_STATUS = 0,
+       HTTP_STATUS_100_CONTINUE,
+       HTTP_STATUS_101_SWITCHING_PROTOCOLS,
+       HTTP_STATUS_200_OK,
+       HTTP_STATUS_201_CREATED,
+       HTTP_STATUS_202_ACCEPTED,
+       HTTP_STATUS_203_NON_AUTHORITATIVE_INFORMATION,
+       HTTP_STATUS_204_NO_CONTENT,
+       HTTP_STATUS_205_RESET_CONTENT,
+       HTTP_STATUS_206_PARTIAL_CONTENT,
+       HTTP_STATUS_300_MULTIPLE_CHOICES,
+       HTTP_STATUS_301_MOVED_PERMANENTLY,
+       HTTP_STATUS_302_FOUND,
+       HTTP_STATUS_303_SEE_OTHER,
+       HTTP_STATUS_304_NOT_MODIFIED,
+       HTTP_STATUS_305_USE_PROXY,
+       HTTP_STATUS_307_TEMPORARY_REDIRECT,
+       HTTP_STATUS_400_BAD_REQUEST,
+       HTTP_STATUS_401_UNAUTHORIZED,
+       HTTP_STATUS_402_PAYMENT_REQUIRED,
+       HTTP_STATUS_403_FORBIDDEN,
+       HTTP_STATUS_404_NOT_FOUND,
+       HTTP_STATUS_405_METHOD_NOT_ALLOWED,
+       HTTP_STATUS_406_NOT_ACCEPTABLE,
+       HTTP_STATUS_407_PROXY_AUTHENTICATION_REQUIRED,
+       HTTP_STATUS_408_REQUEST_TIME_OUT,
+       HTTP_STATUS_409_CONFLICT,
+       HTTP_STATUS_410_GONE,
+       HTTP_STATUS_411_LENGTH_REQUIRED,
+       HTTP_STATUS_412_PRECONDITION_FAILED,
+       HTTP_STATUS_413_REQUEST_ENTITY_TOO_LARGE,
+       HTTP_STATUS_414_REQUEST_URI_TOO_LARGE,
+       HTTP_STATUS_415_UNSUPPORTED_MEDIA_TYPE,
+       HTTP_STATUS_416_REQUESTED_RANGE_NOT_SATISFIED,
+       HTTP_STATUS_417_EXPECTATION_FAILED,
+       HTTP_STATUS_500_INTERNAL_SERVER_ERROR,
+       HTTP_STATUS_501_NOT_IMPLEMENTED,
+       HTTP_STATUS_502_BAD_GATEWAY,
+       HTTP_STATUS_503_SERVICE_UNAVAILABLE,
+       HTTP_STATUS_504_GATEWAY_TIME_OUT,
+       HTTP_STATUS_505_HTTP_VERSION_NOT_SUPPORTED,
+       HTTP_STATUS_308_PERMANENT_REDIRECT
+};
+
+struct efi_http_request_data {
+       enum efi_http_method method;
+       u16 *url;
+};
+
+struct efi_http_response_data {
+       enum efi_http_status_code status_code;
+};
+
+struct efi_http_header {
+       char *field_name;
+       char *field_value;
+};
+
+struct efi_http_message {
+       union {
+               struct efi_http_request_data *request;
+               struct efi_http_response_data *response;
+       } data;
+       efi_uintn_t header_count;
+       struct efi_http_header *headers;
+       efi_uintn_t body_length;
+       void *body;
+};
+
+struct efi_http_token {
+       struct efi_event *event;
+       efi_status_t status;
+       struct efi_http_message *message;
+};
+
+struct efi_http_protocol {
+       efi_status_t (EFIAPI * get_mode_data)(struct efi_http_protocol *this,
+                                             struct efi_http_config_data *data);
+       efi_status_t (EFIAPI * configure)(struct efi_http_protocol *this,
+                                         struct efi_http_config_data *data);
+       efi_status_t (EFIAPI * request)(struct efi_http_protocol *this,
+                                       struct efi_http_token *token);
+       efi_status_t (EFIAPI * cancel)(struct efi_http_protocol *this,
+                                      struct efi_http_token *token);
+       efi_status_t (EFIAPI * response)(struct efi_http_protocol *this,
+                                        struct efi_http_token *token);
+       efi_status_t (EFIAPI * poll)(struct efi_http_protocol *this);
+};
+
 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
        EFI_GUID(0x964e5b22, 0x6459, 0x11d2, \
                 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
@@ -1899,6 +2170,25 @@ struct efi_system_resource_table {
        EFI_GUID(0x4aafd29d, 0x68df, 0x49ee, 0x8a, 0xa9, \
                 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7)
 
+#define EFI_LZMA_COMPRESSED \
+       EFI_GUID(0xee4e5898, 0x3914, 0x4259, 0x9d, 0x6e, \
+                0xdc, 0x7b, 0xd7, 0x94, 0x03, 0xcf)
+#define EFI_DXE_SERVICES \
+       EFI_GUID(0x05ad34ba, 0x6f02, 0x4214, 0x95, 0x2e, \
+                0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9)
+#define EFI_HOB_LIST \
+       EFI_GUID(0x7739f24c, 0x93d7, 0x11d4, 0x9a, 0x3a,  \
+                0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
+#define EFI_MEMORY_TYPE \
+       EFI_GUID(0x4c19049f, 0x4137, 0x4dd3, 0x9c, 0x10, \
+                0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa)
+#define EFI_MEM_STATUS_CODE_REC \
+       EFI_GUID(0x060cc026, 0x4c0d, 0x4dda, 0x8f, 0x41, \
+                0x59, 0x5f, 0xef, 0x00, 0xa5, 0x02)
+#define EFI_GUID_EFI_ACPI1 \
+       EFI_GUID(0xeb9d2d30, 0x2d88, 0x11d3,  0x9a, 0x16, \
+                0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
+
 /**
  * struct win_certificate_uefi_guid - A certificate that encapsulates
  * a GUID-specific signature
@@ -1947,7 +2237,6 @@ struct efi_firmware_image_authentication {
        struct win_certificate_uefi_guid auth_info;
 } __attribute__((__packed__));
 
-
 /**
  * struct efi_signature_data - A format of signature
  *
This page took 0.036256 seconds and 4 git commands to generate.