From bf9093e79443b7a3cf8986999e20a7fe0626abdc Mon Sep 17 00:00:00 2001 From: X512 Date: Tue, 24 Mar 2020 02:49:13 +0900 Subject: [PATCH] Efi: fix headers for 32 bit platforms Change-Id: Id43bfcbfc24b1adb8f6e9fff587c6df9b62910f2 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2413 Reviewed-by: Alex von Gluck IV Reviewed-by: waddlesplash --- headers/private/kernel/platform/efi/protocol/block-io.h | 4 ++-- headers/private/kernel/platform/efi/types.h | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/headers/private/kernel/platform/efi/protocol/block-io.h b/headers/private/kernel/platform/efi/protocol/block-io.h index cf53e6b49b..6f1c52b8d2 100644 --- a/headers/private/kernel/platform/efi/protocol/block-io.h +++ b/headers/private/kernel/platform/efi/protocol/block-io.h @@ -26,10 +26,10 @@ struct efi_block_io_protocol { bool ExtendedVerification) EFIAPI; efi_status (*ReadBlocks)(efi_block_io_protocol* self, uint32_t MediaId, uint64_t LBA, - uint64_t BufferSize, void* Buffer) EFIAPI; + size_t BufferSize, void* Buffer) EFIAPI; efi_status (*WriteBlocks)(efi_block_io_protocol* self, uint32_t MediaId, uint64_t LBA, - uint64_t BufferSize, const void* Buffer) EFIAPI; + size_t BufferSize, const void* Buffer) EFIAPI; efi_status (*FlushBlocks)(efi_block_io_protocol* self); diff --git a/headers/private/kernel/platform/efi/types.h b/headers/private/kernel/platform/efi/types.h index 0295e7fbc6..8aec5553d5 100644 --- a/headers/private/kernel/platform/efi/types.h +++ b/headers/private/kernel/platform/efi/types.h @@ -14,9 +14,14 @@ #define EFIAPI #endif +#if UINTPTR_MAX == 0xffffffff +#define EFI_ERROR_MASK 0x80000000 +#elif UINTPTR_MAX == 0xffffffffffffffff #define EFI_ERROR_MASK 0x8000000000000000 +#endif + #define EFI_ERR(x) (EFI_ERROR_MASK | x) -#define EFI_ERROR(x) (((int64_t)x) < 0) +#define EFI_ERROR(x) (((ssize_t)x) < 0) #define EFI_SUCCESS 0 #define EFI_LOAD_ERROR EFI_ERR(1)