[U-Boot] [PATCH 05/18] efi: Fix efi_uintn_t for 64-bit EFI payload

Alexander Graf agraf at suse.de
Mon Jun 11 19:43:42 UTC 2018



On 11.06.18 11:11, Bin Meng wrote:
> Hi Alex,
> 
> On Sun, Jun 10, 2018 at 9:25 PM, Bin Meng <bmeng.cn at gmail.com> wrote:
>> Since commit bb0bb91cf0aa ("efi_stub: Use efi_uintn_t"), EFI x86
>> 64-bit payload does not work anymore. The call to GetMemoryMap()
>> in efi_stub.c fails with return code EFI_INVALID_PARAMETER. Since
>> the payload itself is still 32-bit U-Boot, efi_uintn_t gets wrongly
>> interpreted as int, but it should actually be long in a 64-bit EFI
>> environment.
>>
>> Fixes: bb0bb91cf0aa ("efi_stub: Use efi_uintn_t")
>> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
>> ---
>>
>>  include/efi_api.h | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/include/efi_api.h b/include/efi_api.h
>> index 64c27e4..d1158de 100644
>> --- a/include/efi_api.h
>> +++ b/include/efi_api.h
>> @@ -28,7 +28,11 @@ enum efi_timer_delay {
>>         EFI_TIMER_RELATIVE = 2
>>  };
>>
>> +#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
>> +#define efi_uintn_t unsigned long
>> +#else
>>  #define efi_uintn_t size_t
>> +#endif
>>  typedef uint16_t *efi_string_t;
>>
>>  #define EVT_TIMER                              0x80000000
>> --
> 
> With your proposed changes to efi.h in [1], do you think we should
> also fix this by:
> 
> #ifdef __x86_64__
> #define efi_uintn_t unsigned long
> #else
> #define efi_uintn_t size_t

Can't we just change the definition in
arch/x86/include/asm/posix_types.h to adhere to __x86_64__ instead? Then
the typedef would just simply always go to size_t.


Alex


More information about the U-Boot mailing list