Commit e692ed1d560f8d9ece0e0b9e57c91233825be7ed

Authored by Heinrich Schuchardt
1 parent 9bb62fa63b

efi_loader: EFI_FILE_PROTOCOL rev 2 stub

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>

Showing 2 changed files with 47 additions and 9 deletions Side-by-side Diff

... ... @@ -1461,6 +1461,12 @@
1461 1461 #define EFI_FILE_PROTOCOL_REVISION2 0x00020000
1462 1462 #define EFI_FILE_PROTOCOL_LATEST_REVISION EFI_FILE_PROTOCOL_REVISION2
1463 1463  
  1464 +struct efi_file_io_token {
  1465 + struct efi_event *event;
  1466 + efi_status_t status;
  1467 + efi_uintn_t buffer_size;
  1468 + void *buffer;};
  1469 +
1464 1470 struct efi_file_handle {
1465 1471 u64 rev;
1466 1472 efi_status_t (EFIAPI *open)(struct efi_file_handle *file,
... ... @@ -1483,10 +1489,16 @@
1483 1489 const efi_guid_t *info_type, efi_uintn_t buffer_size,
1484 1490 void *buffer);
1485 1491 efi_status_t (EFIAPI *flush)(struct efi_file_handle *file);
1486   - /*
1487   - * TODO: We currently only support EFI file protocol revision 0x00010000
1488   - * while UEFI specs 2.4 - 2.7 prescribe revision 0x00020000.
1489   - */
  1492 + efi_status_t (EFIAPI *open_ex)(struct efi_file_handle *file,
  1493 + struct efi_file_handle **new_handle,
  1494 + u16 *file_name, u64 open_mode, u64 attributes,
  1495 + struct efi_file_io_token *token);
  1496 + efi_status_t (EFIAPI *read_ex)(struct efi_file_handle *file,
  1497 + struct efi_file_io_token *token);
  1498 + efi_status_t (EFIAPI *write_ex)(struct efi_file_handle *file,
  1499 + struct efi_file_io_token *token);
  1500 + efi_status_t (EFIAPI *flush_ex)(struct efi_file_handle *file,
  1501 + struct efi_file_io_token *token);
1490 1502 };
1491 1503  
1492 1504 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
lib/efi_loader/efi_file.c
... ... @@ -741,12 +741,34 @@
741 741 return EFI_EXIT(EFI_SUCCESS);
742 742 }
743 743  
  744 +static efi_status_t EFIAPI efi_file_open_ex(struct efi_file_handle *file,
  745 + struct efi_file_handle **new_handle,
  746 + u16 *file_name, u64 open_mode, u64 attributes,
  747 + struct efi_file_io_token *token)
  748 +{
  749 + return EFI_UNSUPPORTED;
  750 +}
  751 +
  752 +static efi_status_t EFIAPI efi_file_read_ex(struct efi_file_handle *file,
  753 + struct efi_file_io_token *token)
  754 +{
  755 + return EFI_UNSUPPORTED;
  756 +}
  757 +
  758 +static efi_status_t EFIAPI efi_file_write_ex(struct efi_file_handle *file,
  759 + struct efi_file_io_token *token)
  760 +{
  761 + return EFI_UNSUPPORTED;
  762 +}
  763 +
  764 +static efi_status_t EFIAPI efi_file_flush_ex(struct efi_file_handle *file,
  765 + struct efi_file_io_token *token)
  766 +{
  767 + return EFI_UNSUPPORTED;
  768 +}
  769 +
744 770 static const struct efi_file_handle efi_file_handle_protocol = {
745   - /*
746   - * TODO: We currently only support EFI file protocol revision 0x00010000
747   - * while UEFI specs 2.4 - 2.7 prescribe revision 0x00020000.
748   - */
749   - .rev = EFI_FILE_PROTOCOL_REVISION,
  771 + .rev = EFI_FILE_PROTOCOL_REVISION2,
750 772 .open = efi_file_open,
751 773 .close = efi_file_close,
752 774 .delete = efi_file_delete,
... ... @@ -757,6 +779,10 @@
757 779 .getinfo = efi_file_getinfo,
758 780 .setinfo = efi_file_setinfo,
759 781 .flush = efi_file_flush,
  782 + .open_ex = efi_file_open_ex,
  783 + .read_ex = efi_file_read_ex,
  784 + .write_ex = efi_file_write_ex,
  785 + .flush_ex = efi_file_flush_ex,
760 786 };
761 787  
762 788 /**