summaryrefslogtreecommitdiffstats
path: root/src/cpu/x86
diff options
context:
space:
mode:
authorPaul Menzel <pmenzel@molgen.mpg.de>2021-05-16 19:53:43 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-05-30 20:19:40 +0000
commit2ea9595fcbb63dca2a09a87f19e8598b6346860e (patch)
tree01c2cad82369941ca46a2cb4afa4ca24ed39ceb9 /src/cpu/x86
parent3585dc5be4ddf01ee61907d963e070386d31d054 (diff)
downloadcoreboot-2ea9595fcbb63dca2a09a87f19e8598b6346860e.tar.gz
coreboot-2ea9595fcbb63dca2a09a87f19e8598b6346860e.tar.bz2
coreboot-2ea9595fcbb63dca2a09a87f19e8598b6346860e.zip
cpu/x86/smm: Fix uintptr_t type mismatches in print statements
The 64-bit compiler x86_64-linux-gnu-gcc-10 aborts the build with the format warning below: CC ramstage/cpu/x86/smm/smm_module_loader.o src/cpu/x86/smm/smm_module_loader.c: In function 'smm_create_map': src/cpu/x86/smm/smm_module_loader.c:146:19: error: format '%zx' expects argument of type 'size_t', but argument 3 has type 'uintptr_t' {aka 'long unsigned int'} [-Werror=format=] 146 | " smbase %zx entry %zx\n", | ~~^ | | | unsigned int | %lx 147 | cpus[i].smbase, cpus[i].entry); | ~~~~~~~~~~~~~~ | | | uintptr_t {aka long unsigned int} In coreboot `uintptr_t` is defined in `src/include/stdint.h`: typedef unsigned long uintptr_t; As `size_t` is defined as `long unsigned int` in i386-elf (32-bit), the length modifier `z` matches there. With x86_64-elf/x86_64-linux-gnu (64-bit) and `-m32` `size_t` is defined as `unsigned int` resulting in a type mismatch. Normally, `PRIxPTR` would need to be used as a length modifier, but as coreboot always defines `uintptr_t` to `unsigned long` (and in `src/include/inttypes.h` also defines `PRIxPTR` as `"lx"`), use the length modifier `l` to make the code more readable. Found-by: x86_64-linux-gnu-gcc-10 (Debian 10.2.1-6) 10.2.1 20210110 Fixes: afb7a814 ("cpu/x86/smm: Introduce SMM module loader version 2") Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Change-Id: I32bff397c8a033fe34390e6c1a7dfe773707a4e8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/54341 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Diffstat (limited to 'src/cpu/x86')
-rw-r--r--src/cpu/x86/smm/smm_module_loader.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c
index e3b84179f4c9..6d999a729043 100644
--- a/src/cpu/x86/smm/smm_module_loader.c
+++ b/src/cpu/x86/smm/smm_module_loader.c
@@ -143,10 +143,10 @@ static int smm_create_map(uintptr_t smbase, unsigned int num_cpus,
for (i = 0; i < num_cpus; i++) {
printk(BIOS_DEBUG, "CPU 0x%x\n", i);
printk(BIOS_DEBUG,
- " smbase %zx entry %zx\n",
+ " smbase %lx entry %lx\n",
cpus[i].smbase, cpus[i].entry);
printk(BIOS_DEBUG,
- " ss_start %zx code_end %zx\n",
+ " ss_start %lx code_end %lx\n",
cpus[i].ss_start, cpus[i].code_end);
seg_count++;
if (seg_count >= cpus_in_segment) {
@@ -217,13 +217,13 @@ static int smm_place_entry_code(uintptr_t smbase, unsigned int num_cpus,
if (cpus[num_cpus].active) {
if (cpus[num_cpus - 1].smbase + SMM_ENTRY_OFFSET < stack_top) {
printk(BIOS_ERR, "%s: stack encroachment\n", __func__);
- printk(BIOS_ERR, "%s: smbase %zx, stack_top %lx\n",
+ printk(BIOS_ERR, "%s: smbase %lx, stack_top %lx\n",
__func__, cpus[num_cpus].smbase, stack_top);
return 0;
}
}
- printk(BIOS_INFO, "%s: smbase %zx, stack_top %lx\n",
+ printk(BIOS_INFO, "%s: smbase %lx, stack_top %lx\n",
__func__, cpus[num_cpus-1].smbase, stack_top);
/* start at 1, the first CPU stub code is already there */
@@ -231,9 +231,9 @@ static int smm_place_entry_code(uintptr_t smbase, unsigned int num_cpus,
for (i = 1; i < num_cpus; i++) {
memcpy((int *)cpus[i].code_start, (int *)cpus[0].code_start, size);
printk(BIOS_DEBUG,
- "SMM Module: placing smm entry code at %zx, cpu # 0x%x\n",
+ "SMM Module: placing smm entry code at %lx, cpu # 0x%x\n",
cpus[i].code_start, i);
- printk(BIOS_DEBUG, "%s: copying from %zx to %zx 0x%x bytes\n",
+ printk(BIOS_DEBUG, "%s: copying from %lx to %lx 0x%x bytes\n",
__func__, cpus[0].code_start, cpus[i].code_start, size);
}
return 1;