HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42448 )
Change subject: temporarily silent GCC on none reliable macro ......................................................................
temporarily silent GCC on none reliable macro
GCC-10 highlighted a none reliable MCHBARx_AND_OR macro:
x4x: src/northbridge/intel/x4x/x4x.h:79:16: error: overflow in conversion from 'int' to 'u8' {aka 'volatile unsigned char'} changes value from '(int)*(volatile u8 *)((unsigned int)((int)i * 1024) + 4275126888) & -256 | 74' to '74' [-Werror=overflow] 79 | (MCHBAR8(x) = (MCHBAR8(x) & (and)) | (or)) | ^ src/northbridge/intel/x4x/raminit_ddr23.c:627:3: note: in expansion of macro 'MCHBAR8_AND_OR' 627 | MCHBAR8_AND_OR(0x400*i + 0x268, ~0xff, 0x4a); | ^~~~~~~~~~~~~~ src/northbridge/intel/x4x/raminit_ddr23.c: In function 'prog_rcomp': src/northbridge/intel/x4x/x4x.h:83:17: error: overflow in conversion from 'int' to 'u16' {aka 'volatile short unsigned int'} changes value from '(int)*(volatile u16 *)((unsigned int)((int)i * 1024) + 4275127072) & -65536 | 26214' to '26214' [-Werror=overflow] 83 | (MCHBAR16(x) = (MCHBAR16(x) & (and)) | (or)) | ^
and for pineview: src/northbridge/intel/pineview/raminit.c: In function 'sdram_timings': src/northbridge/intel/pineview/pineview.h:98:52: error: overflow in conversion from 'int' to 'u8' {aka 'volatile unsigned char'} changes value from '(int)*4275126567 & -256 | 64' to '64' [-Werror=overflow] 98 | #define MCHBAR8_AND_OR(x, and, or) (MCHBAR8(x) = (MCHBAR8(x) & (and)) | (or)) | ^ src/northbridge/intel/pineview/raminit.c:793:2: note: in expansion of macro 'MCHBAR8_AND_OR' 793 | MCHBAR8_AND_OR(SHPAGECTRL, ~0xff, 0x40); | ^~~~~~~~~~~~~~
Also initialize 'reply.command' to avoid this error: src/northbridge/intel/ironlake/raminit.c: In function 'setup_heci_uma': src/northbridge/intel/ironlake/raminit.c:1805:11: error: 'reply.command' may be used uninitialized in this function [-Werror=maybe-uninitialized] 1805 | if (reply.command != (MKHI_SET_UMA | (1 << 7))) | ~~~~~^~~~~~~~ cc1: all warnings being treated as errors
Change-Id: I07c1b3bd00de27c115994233086d32497b4c0925 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M Makefile.inc M src/northbridge/intel/ironlake/raminit.c 2 files changed, 7 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/42448/1
diff --git a/Makefile.inc b/Makefile.inc index 86335d9..4e515c4 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -412,6 +412,12 @@ CFLAGS_common += -Wlogical-op -Wduplicated-cond -Wdangling-else CFLAGS_common += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer CFLAGS_common += -ffunction-sections -fdata-sections -fno-pie + +# Disable 'overflow' waring for not reliable MCHBARx_AND_OR macro +ifeq ($(CONFIG_NORTHBRIDGE_INTEL_X4X)$(CONFIG_NORTHBRIDGE_INTEL_PINEVIEW)$(CONFIG_NORTHBRIDGE_INTEL_SANDYBRIDGE)$(CONFIG_NORTHBRIDGE_INTEL_IRONLAKE)$(CONFIG_NORTHBRIDGE_INTEL_HASWELL),y) +CFLAGS_common += -Wno-overflow +endif + ifeq ($(CONFIG_COMPILER_GCC),y) # Don't add these GCC specific flags when running scan-build ifeq ($(CCC_ANALYZER_OUTPUT_FORMAT),) diff --git a/src/northbridge/intel/ironlake/raminit.c b/src/northbridge/intel/ironlake/raminit.c index e85163f..12162ff 100644 --- a/src/northbridge/intel/ironlake/raminit.c +++ b/src/northbridge/intel/ironlake/raminit.c @@ -1775,7 +1775,7 @@ { struct uma_reply { u8 group_id; - u8 command; + u8 command = 0; u8 reserved; u8 result; u8 field2;