u-boot-brain/lib/efi_loader
Eugeniu Rosca 9b89183b97 efi: Fix truncation of constant value
Starting with commit 867a6ac86d ("efi: Add start-up library code"),
sparse constantly complains about truncated constant value in efi.h:

include/efi.h:176:35: warning: cast truncates bits from constant value (8000000000000000 becomes 0)

This can get quite noisy, preventing real issues to be noticed:

$ make defconfig
*** Default configuration is based on 'sandbox_defconfig'
$ make C=2 -j12 2>&1 | grep truncates | wc -l
441

After the patch is applied:
$ make C=2 -j12 2>&1 | grep truncates | wc -l
0
$ sparse --version
v0.5.2

Following the suggestion of Heinrich Schuchardt, instead of only
fixing the root-cause, I replaced the whole enum of _SHIFT values
by ULL defines. This matches both the UEFI 2.7 spec and the Linux
kernel implementation.

Some ELF size comparison before and after the patch (gcc 7.3.0):

efi-x86_payload64_defconfig:
text    data    bss     dec       hex   filename
407174  29432   278676  715282    aea12 u-boot.old
407152  29464   278676  715292    aea1c u-boot.new
-22     +32     0       +10

efi-x86_payload32_defconfig:
text    data    bss     dec       hex   filename
447075  30308   280076  757459    b8ed3 u-boot.old
447053  30340   280076  757469    b8edd u-boot.new
-22     +32     0       +10

Fixes: 867a6ac86d ("efi: Add start-up library code")
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-08-21 00:03:01 +02:00
..
.gitignore lib: gitignore *.elf and *.so generated by efi_loader 2017-01-09 10:30:24 -05:00
Kconfig Revert "efi_loader: no support for ARMV7_NONSEC=y" 2018-07-25 14:57:43 +02:00
Makefile efi_loader: provide firmware revision 2018-07-25 14:59:44 +02:00
efi_acpi.c efi_loader: Install ACPI configuration tables 2018-07-02 09:23:28 +08:00
efi_bootmgr.c efi_loader: adjust definitions of variable services 2018-06-03 15:27:20 +02:00
efi_boottime.c efi_loader: update runtime services table crc32 2018-08-20 14:43:12 +02:00
efi_console.c efi_loader: EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset() 2018-08-21 00:01:01 +02:00
efi_device_path.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
efi_device_path_to_text.c SPDX: Convert a few files that were missed before 2018-05-10 20:38:35 -04:00
efi_device_path_utilities.c SPDX: Convert a few files that were missed before 2018-05-10 20:38:35 -04:00
efi_disk.c SPDX: Convert a few files that were missed before 2018-05-10 20:38:35 -04:00
efi_file.c SPDX: Convert a few files that were missed before 2018-05-10 20:38:35 -04:00
efi_gop.c efi_loader: Fix GOP 32bpp exposure 2018-06-21 17:18:18 +02:00
efi_image_loader.c efi_loader: Use compiler constants for image loader 2018-07-25 14:57:43 +02:00
efi_memory.c efi: Fix truncation of constant value 2018-08-21 00:03:01 +02:00
efi_net.c initialize net_mode.if_type 2018-07-26 14:08:20 -05:00
efi_runtime.c efi_loader: document runtime functions 2018-08-20 14:43:31 +02:00
efi_smbios.c efi_loader: Allow SMBIOS tables in highmem 2018-07-25 14:57:43 +02:00
efi_variable.c efi_loader: fix off-by-one bug in efi_get_variable 2018-06-03 15:27:20 +02:00
efi_watchdog.c SPDX: Convert a few files that were missed before 2018-05-10 20:38:35 -04:00
helloworld.c efi_loader: helloworld: Output ACPI configuration table 2018-07-02 09:23:28 +08:00