summaryrefslogtreecommitdiff
path: root/src/drivers/intel/fsp1_1/raminit.c
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2019-12-09 13:03:29 -0800
committerPatrick Georgi <pgeorgi@google.com>2019-12-11 11:38:59 +0000
commit540a98001d05a7b780e415c34d14a97b14e44ac6 (patch)
treedb4cffc987097c64fb6c6be996e57bdcbf9786ac /src/drivers/intel/fsp1_1/raminit.c
parent86da00db899c4c58df90b4270082007c871169c7 (diff)
downloadcoreboot-540a98001d05a7b780e415c34d14a97b14e44ac6.tar.xz
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
Diffstat (limited to 'src/drivers/intel/fsp1_1/raminit.c')
-rw-r--r--src/drivers/intel/fsp1_1/raminit.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/drivers/intel/fsp1_1/raminit.c b/src/drivers/intel/fsp1_1/raminit.c
index 59a60cfb83..208ebb5a58 100644
--- a/src/drivers/intel/fsp1_1/raminit.c
+++ b/src/drivers/intel/fsp1_1/raminit.c
@@ -66,10 +66,10 @@ void raminit(struct romstage_params *params)
fsp_header = params->chipset_context;
vpd_ptr = (VPD_DATA_REGION *)(fsp_header->CfgRegionOffset +
fsp_header->ImageBase);
- printk(BIOS_DEBUG, "VPD Data: 0x%p\n", vpd_ptr);
+ printk(BIOS_DEBUG, "VPD Data: %p\n", vpd_ptr);
upd_ptr = (UPD_DATA_REGION *)(vpd_ptr->PcdUpdRegionOffset +
fsp_header->ImageBase);
- printk(BIOS_DEBUG, "UPD Data: 0x%p\n", upd_ptr);
+ printk(BIOS_DEBUG, "UPD Data: %p\n", upd_ptr);
original_params = (void *)((u8 *)upd_ptr +
upd_ptr->MemoryInitUpdOffset);
memcpy(&memory_init_params, original_params,
@@ -110,12 +110,12 @@ void raminit(struct romstage_params *params)
/* Call FspMemoryInit to initialize RAM */
fsp_memory_init = (FSP_MEMORY_INIT)(fsp_header->ImageBase
+ fsp_header->FspMemoryInitEntryOffset);
- printk(BIOS_DEBUG, "Calling FspMemoryInit: 0x%p\n", fsp_memory_init);
- printk(BIOS_SPEW, " 0x%p: NvsBufferPtr\n",
+ printk(BIOS_DEBUG, "Calling FspMemoryInit: %p\n", fsp_memory_init);
+ printk(BIOS_SPEW, " %p: NvsBufferPtr\n",
fsp_memory_init_params.NvsBufferPtr);
- printk(BIOS_SPEW, " 0x%p: RtBufferPtr\n",
+ printk(BIOS_SPEW, " %p: RtBufferPtr\n",
fsp_memory_init_params.RtBufferPtr);
- printk(BIOS_SPEW, " 0x%p: HobListPtr\n",
+ printk(BIOS_SPEW, " %p: HobListPtr\n",
fsp_memory_init_params.HobListPtr);
timestamp_add_now(TS_FSP_MEMORY_INIT_START);
@@ -151,7 +151,7 @@ void raminit(struct romstage_params *params)
}
/* Migrate CAR data */
- printk(BIOS_DEBUG, "0x%p: cbmem_top\n", cbmem_top());
+ printk(BIOS_DEBUG, "%p: cbmem_top\n", cbmem_top());
if (!s3wake) {
cbmem_initialize_empty_id_size(CBMEM_ID_FSP_RESERVED_MEMORY,
fsp_reserved_bytes);
@@ -216,7 +216,7 @@ void raminit(struct romstage_params *params)
/* Get the address of the CBMEM region for the FSP reserved memory */
fsp_reserved_memory_area = cbmem_find(CBMEM_ID_FSP_RESERVED_MEMORY);
- printk(BIOS_DEBUG, "0x%p: fsp_reserved_memory_area\n",
+ printk(BIOS_DEBUG, "%p: fsp_reserved_memory_area\n",
fsp_reserved_memory_area);
/* Verify the order of CBMEM root and FSP memory */