efi_loader: EFI_FILE_PROTOCOL rev 2 stub
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 8 Sep 2019 07:35:32 +0000 (09:35 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Mon, 9 Sep 2019 13:21:09 +0000 (15:21 +0200)
The UEFI specification requires to implement version 2 of the
EFI_FILE_PROTOCOL. Provide the missing functions as stubs.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
include/efi_api.h
lib/efi_loader/efi_file.c

index cb895f31e5eb1f1502eb7b757a54b46659aae66d..f43fb7a9eaa2694cd929dd926b58a9fabff6d71c 100644 (file)
@@ -1461,6 +1461,12 @@ struct efi_pxe_base_code_protocol {
 #define EFI_FILE_PROTOCOL_REVISION2    0x00020000
 #define EFI_FILE_PROTOCOL_LATEST_REVISION EFI_FILE_PROTOCOL_REVISION2
 
+struct efi_file_io_token {
+       struct efi_event *event;
+       efi_status_t status;
+       efi_uintn_t buffer_size;
+       void *buffer;};
+
 struct efi_file_handle {
        u64 rev;
        efi_status_t (EFIAPI *open)(struct efi_file_handle *file,
@@ -1483,10 +1489,16 @@ struct efi_file_handle {
                        const efi_guid_t *info_type, efi_uintn_t buffer_size,
                        void *buffer);
        efi_status_t (EFIAPI *flush)(struct efi_file_handle *file);
-       /*
-        * TODO: We currently only support EFI file protocol revision 0x00010000
-        *       while UEFI specs 2.4 - 2.7 prescribe revision 0x00020000.
-        */
+       efi_status_t (EFIAPI *open_ex)(struct efi_file_handle *file,
+                       struct efi_file_handle **new_handle,
+                       u16 *file_name, u64 open_mode, u64 attributes,
+                       struct efi_file_io_token *token);
+       efi_status_t (EFIAPI *read_ex)(struct efi_file_handle *file,
+                       struct efi_file_io_token *token);
+       efi_status_t (EFIAPI *write_ex)(struct efi_file_handle *file,
+                       struct efi_file_io_token *token);
+       efi_status_t (EFIAPI *flush_ex)(struct efi_file_handle *file,
+                       struct efi_file_io_token *token);
 };
 
 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
index 504b1d175511c2e3319cec200644b5c380acfff3..4b53016bf1bb298045e0c5d25144df312ecb1e5d 100644 (file)
@@ -741,12 +741,34 @@ static efi_status_t EFIAPI efi_file_flush(struct efi_file_handle *file)
        return EFI_EXIT(EFI_SUCCESS);
 }
 
+static efi_status_t EFIAPI efi_file_open_ex(struct efi_file_handle *file,
+                       struct efi_file_handle **new_handle,
+                       u16 *file_name, u64 open_mode, u64 attributes,
+                       struct efi_file_io_token *token)
+{
+       return EFI_UNSUPPORTED;
+}
+
+static efi_status_t EFIAPI efi_file_read_ex(struct efi_file_handle *file,
+                       struct efi_file_io_token *token)
+{
+       return EFI_UNSUPPORTED;
+}
+
+static efi_status_t EFIAPI efi_file_write_ex(struct efi_file_handle *file,
+                       struct efi_file_io_token *token)
+{
+       return EFI_UNSUPPORTED;
+}
+
+static efi_status_t EFIAPI efi_file_flush_ex(struct efi_file_handle *file,
+                       struct efi_file_io_token *token)
+{
+       return EFI_UNSUPPORTED;
+}
+
 static const struct efi_file_handle efi_file_handle_protocol = {
-       /*
-        * TODO: We currently only support EFI file protocol revision 0x00010000
-        *       while UEFI specs 2.4 - 2.7 prescribe revision 0x00020000.
-        */
-       .rev = EFI_FILE_PROTOCOL_REVISION,
+       .rev = EFI_FILE_PROTOCOL_REVISION2,
        .open = efi_file_open,
        .close = efi_file_close,
        .delete = efi_file_delete,
@@ -757,6 +779,10 @@ static const struct efi_file_handle efi_file_handle_protocol = {
        .getinfo = efi_file_getinfo,
        .setinfo = efi_file_setinfo,
        .flush = efi_file_flush,
+       .open_ex = efi_file_open_ex,
+       .read_ex = efi_file_read_ex,
+       .write_ex = efi_file_write_ex,
+       .flush_ex = efi_file_flush_ex,
 };
 
 /**