printf: Automatically prefix %p with 0x
According to the POSIX standard, %p is supposed to print a pointer "as if by %#x", meaning the "0x" prefix should automatically be prepended. All other implementations out there (glibc, Linux, even libpayload) do this, so we should make coreboot match. This patch changes vtxprintf() accordingly and removes any explicit instances of "0x%p" from existing format strings. How to handle zero padding is less clear: the official POSIX definition above technically says there should be no automatic zero padding, but in practice most other implementations seem to do it and I assume most programmers would prefer it. The way chosen here is to always zero-pad to 32 bits, even on a 64-bit system. The rationale for this is that even on 64-bit systems, coreboot always avoids using any memory above 4GB for itself, so in practice all pointers should fit in that range and padding everything to 64 bits would just hurt readability. Padding it this way also helps pointers that do exceed 4GB (e.g. prints from MMU config on some arm64 systems) stand out better from the others. Change-Id: I0171b52f7288abb40e3fc3c8b874aee14b9bdcd6 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/37626 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: David Guckian
This commit is contained in:
committed by
Patrick Georgi
parent
86da00db89
commit
540a98001d
@@ -40,9 +40,9 @@ void fsp_debug_before_memory_init(fsp_memory_init_fn memory_init,
|
||||
/* Display the call entry point and parameters */
|
||||
if (!CONFIG(DISPLAY_FSP_CALLS_AND_STATUS))
|
||||
return;
|
||||
printk(BIOS_SPEW, "Calling FspMemoryInit: 0x%p\n", memory_init);
|
||||
printk(BIOS_SPEW, "\t0x%p: raminit_upd\n", fspm_new_upd);
|
||||
printk(BIOS_SPEW, "\t0x%p: &hob_list_ptr\n", fsp_get_hob_list_ptr());
|
||||
printk(BIOS_SPEW, "Calling FspMemoryInit: %p\n", memory_init);
|
||||
printk(BIOS_SPEW, "\t%p: raminit_upd\n", fspm_new_upd);
|
||||
printk(BIOS_SPEW, "\t%p: &hob_list_ptr\n", fsp_get_hob_list_ptr());
|
||||
}
|
||||
|
||||
void fsp_debug_after_memory_init(uint32_t status)
|
||||
@@ -83,8 +83,8 @@ void fsp_debug_before_silicon_init(fsp_silicon_init_fn silicon_init,
|
||||
/* Display the call to FSP SiliconInit */
|
||||
if (!CONFIG(DISPLAY_FSP_CALLS_AND_STATUS))
|
||||
return;
|
||||
printk(BIOS_SPEW, "Calling FspSiliconInit: 0x%p\n", silicon_init);
|
||||
printk(BIOS_SPEW, "\t0x%p: upd\n", fsps_new_upd);
|
||||
printk(BIOS_SPEW, "Calling FspSiliconInit: %p\n", silicon_init);
|
||||
printk(BIOS_SPEW, "\t%p: upd\n", fsps_new_upd);
|
||||
}
|
||||
|
||||
void fsp_debug_after_silicon_init(uint32_t status)
|
||||
@@ -111,8 +111,8 @@ void fsp_before_debug_notify(fsp_notify_fn notify,
|
||||
return;
|
||||
printk(BIOS_SPEW, "0x%08x: notify_params->phase\n",
|
||||
notify_params->phase);
|
||||
printk(BIOS_SPEW, "Calling FspNotify: 0x%p\n", notify);
|
||||
printk(BIOS_SPEW, "\t0x%p: notify_params\n", notify_params);
|
||||
printk(BIOS_SPEW, "Calling FspNotify: %p\n", notify);
|
||||
printk(BIOS_SPEW, "\t%p: notify_params\n", notify_params);
|
||||
}
|
||||
|
||||
void fsp_debug_after_notify(uint32_t status)
|
||||
|
Reference in New Issue
Block a user