Jeremy Compostella has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/45628 )
Change subject: libpayload: use PRIu64 type to print u64 ......................................................................
libpayload: use PRIu64 type to print u64
The appropriate way to print a u64 variable regardless of the current architecture is to use the PRI*64 macros. libpayload is mostly used in 32 bits but when ported to other projects and compiled in 64 bits it breaks the compilation.
Change-Id: I479fd701f992701584d77d43c5cd5910f5ab7633 Signed-off-by: Jeremy Compostella jeremy.compostella@intel.com --- M payloads/libpayload/libc/time.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/45628/1
diff --git a/payloads/libpayload/libc/time.c b/payloads/libpayload/libc/time.c index c0a3313..0a4cb06 100644 --- a/payloads/libpayload/libc/time.c +++ b/payloads/libpayload/libc/time.c @@ -173,7 +173,7 @@ if (hz == 0) { hz = timer_hz(); if (hz < 1000000) { - printf("Timer frequency %lld is too low, " + printf("Timer frequency %" PRIu64 " is too low, " "must be at least 1MHz.\n", hz); halt(); }
Hello Stefan Reinauer,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/45628
to look at the new patch set (#2).
Change subject: libpayload: use PRIu64 type to print u64 ......................................................................
libpayload: use PRIu64 type to print u64
The appropriate way to print a u64 variable regardless of the current architecture is to use the PRI*64 macros. libpayload is mostly used in 32 bits but when ported to other projects and compiled in 64 bits it breaks the compilation.
Change-Id: I479fd701f992701584d77d43c5cd5910f5ab7633 Signed-off-by: Jeremy Compostella jeremy.compostella@intel.com --- M payloads/libpayload/drivers/options.c M payloads/libpayload/libc/time.c 2 files changed, 2 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/45628/2
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45628 )
Change subject: libpayload: use PRIu64 type to print u64 ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/45628/2/payloads/libpayload/drivers... File payloads/libpayload/drivers/options.c:
https://review.coreboot.org/c/coreboot/+/45628/2/payloads/libpayload/drivers... PS2, Line 328: sprintf(*dest, "%" PRIu64, *(u64*)raw); "(foo*)" should be "(foo *)"
Hello build bot (Jenkins), Stefan Reinauer,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/45628
to look at the new patch set (#3).
Change subject: libpayload: use PRIu64 type to print u64 ......................................................................
libpayload: use PRIu64 type to print u64
The appropriate way to print a u64 variable regardless of the current architecture is to use the PRI*64 macros. libpayload is mostly used in 32 bits but when ported to other projects and compiled in 64 bits it breaks the compilation.
Change-Id: I479fd701f992701584d77d43c5cd5910f5ab7633 Signed-off-by: Jeremy Compostella jeremy.compostella@intel.com --- M payloads/libpayload/drivers/options.c M payloads/libpayload/libc/time.c 2 files changed, 2 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/45628/3
Stefan Reinauer has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45628 )
Change subject: libpayload: use PRIu64 type to print u64 ......................................................................
Patch Set 3:
Thank you for this fix. Can you try to do this?
----- 8< ----- The ISO C99 standard specifies that these macros must only be defined if explicitly requested. #define __STDC_FORMAT_MACROS #include <inttypes.h> ----- 8< -----
Hello build bot (Jenkins), Stefan Reinauer,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/45628
to look at the new patch set (#4).
Change subject: libpayload: use PRIu64 type to print u64 ......................................................................
libpayload: use PRIu64 type to print u64
The appropriate way to print a u64 variable regardless of the current architecture is to use the PRI*64 macros. libpayload is mostly used in 32 bits but when ported to other projects and compiled in 64 bits it breaks the compilation.
Change-Id: I479fd701f992701584d77d43c5cd5910f5ab7633 Signed-off-by: Jeremy Compostella jeremy.compostella@intel.com --- M payloads/libpayload/drivers/options.c M payloads/libpayload/libc/time.c 2 files changed, 8 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/45628/4
Jeremy Compostella has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45628 )
Change subject: libpayload: use PRIu64 type to print u64 ......................................................................
Patch Set 4:
Patch Set 3:
Thank you for this fix. Can you try to do this?
----- 8< ----- The ISO C99 standard specifies that these macros must only be defined if explicitly requested. #define __STDC_FORMAT_MACROS #include <inttypes.h> ----- 8< -----
Done. I put the define and inclusion on top. But if you prefer I can move the inclusion with the others.
Hello build bot (Jenkins), Stefan Reinauer,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/45628
to look at the new patch set (#5).
Change subject: libpayload: use PRIu64 type to print u64 ......................................................................
libpayload: use PRIu64 type to print u64
The appropriate way to print a u64 variable regardless of the current architecture is to use the PRI*64 macros. libpayload is mostly used in 32 bits but when ported to other projects and compiled in 64 bits it breaks the compilation.
Change-Id: I479fd701f992701584d77d43c5cd5910f5ab7633 Signed-off-by: Jeremy Compostella jeremy.compostella@intel.com --- M payloads/libpayload/drivers/options.c M payloads/libpayload/libc/time.c 2 files changed, 8 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/45628/5
Jeremy Compostella has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45628 )
Change subject: libpayload: use PRIu64 type to print u64 ......................................................................
Patch Set 5:
Nevermind. I moved the inclusion to the inclusion block.
Stefan Reinauer has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45628 )
Change subject: libpayload: use PRIu64 type to print u64 ......................................................................
Patch Set 5: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/45628 )
Change subject: libpayload: use PRIu64 type to print u64 ......................................................................
libpayload: use PRIu64 type to print u64
The appropriate way to print a u64 variable regardless of the current architecture is to use the PRI*64 macros. libpayload is mostly used in 32 bits but when ported to other projects and compiled in 64 bits it breaks the compilation.
Change-Id: I479fd701f992701584d77d43c5cd5910f5ab7633 Signed-off-by: Jeremy Compostella jeremy.compostella@intel.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/45628 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Stefan Reinauer stefan.reinauer@coreboot.org --- M payloads/libpayload/drivers/options.c M payloads/libpayload/libc/time.c 2 files changed, 8 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Stefan Reinauer: Looks good to me, approved
diff --git a/payloads/libpayload/drivers/options.c b/payloads/libpayload/drivers/options.c index 9e437f9..b6d2342 100644 --- a/payloads/libpayload/drivers/options.c +++ b/payloads/libpayload/drivers/options.c @@ -26,8 +26,11 @@ * SUCH DAMAGE. */
+#define __STDC_FORMAT_MACROS + #include <libpayload.h> #include <coreboot_tables.h> +#include <inttypes.h>
u8 *mem_accessor_base;
@@ -325,7 +328,7 @@ /* only works on little endian. 26 bytes is enough for a 64bit value in decimal */ *dest = malloc(26); - sprintf(*dest, "%llu", *(u64*)raw); + sprintf(*dest, "%" PRIu64, *(u64 *)raw); break; case 's': *dest = strdup(raw); diff --git a/payloads/libpayload/libc/time.c b/payloads/libpayload/libc/time.c index c0a3313..6780008 100644 --- a/payloads/libpayload/libc/time.c +++ b/payloads/libpayload/libc/time.c @@ -31,11 +31,14 @@ * General time functions */
+#define __STDC_FORMAT_MACROS + #include <libpayload-config.h> #include <libpayload.h> #if CONFIG(LP_ARCH_X86) && CONFIG(LP_NVRAM) #include <arch/rdtsc.h> #endif +#include <inttypes.h>
extern u32 cpu_khz;
@@ -173,7 +176,7 @@ if (hz == 0) { hz = timer_hz(); if (hz < 1000000) { - printf("Timer frequency %lld is too low, " + printf("Timer frequency %" PRIu64 " is too low, " "must be at least 1MHz.\n", hz); halt(); }