treewide: convert to %#x hex prints

Convert hex print values to use the %#x qualifier to print 0x{value}.

BUG=b:296439237
TEST=build and boot to Skyrim
BRANCH=None

Change-Id: I0d1ac4b920530635fb758c5165a6a99c11b414c8
Signed-off-by: Jon Murphy <jpmurphy@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78183
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/drivers/i2c/tpm/cr50.c b/src/drivers/i2c/tpm/cr50.c
index 75b235e..9296284 100644
--- a/src/drivers/i2c/tpm/cr50.c
+++ b/src/drivers/i2c/tpm/cr50.c
@@ -460,7 +460,7 @@
 	if (claim_locality())
 		return -1;
 
-	printk(BIOS_DEBUG, "cr50 TPM 2.0 (i2c %u:0x%02x id 0x%x)\n",
+	printk(BIOS_DEBUG, "cr50 TPM 2.0 (i2c %u:0x%02x id %#x)\n",
 	       bus, dev_addr, did_vid >> 16);
 
 	if (tpm_first_access_this_boot()) {
diff --git a/src/drivers/i2c/tpm/tis.c b/src/drivers/i2c/tpm/tis.c
index e9bf2cf..25b7f40 100644
--- a/src/drivers/i2c/tpm/tis.c
+++ b/src/drivers/i2c/tpm/tis.c
@@ -62,7 +62,7 @@
 		return -1;
 	}
 	if (count > sbufsiz) {
-		printk(BIOS_DEBUG, "%s: invalid count value %x %zx\n", __func__,
+		printk(BIOS_DEBUG, "%s: invalid count value %#x %zx\n", __func__,
 			count, sbufsiz);
 		return -1;
 	}
diff --git a/src/drivers/i2c/tpm/tpm.c b/src/drivers/i2c/tpm/tpm.c
index 68b7042..c88dcdd 100644
--- a/src/drivers/i2c/tpm/tpm.c
+++ b/src/drivers/i2c/tpm/tpm.c
@@ -534,7 +534,7 @@
 		goto out_err;
 	}
 
-	printk(BIOS_DEBUG, "I2C TPM %u:%02x (chip type %s device-id 0x%X)\n",
+	printk(BIOS_DEBUG, "I2C TPM %u:%02x (chip type %s device-id %#X)\n",
 	       tpm_dev.bus, tpm_dev.addr,
 	       chip_name[tpm_dev.chip_type], vendor >> 16);
 
diff --git a/src/drivers/pc80/tpm/tis.c b/src/drivers/pc80/tpm/tis.c
index 5bb5662..a7a3e9d 100644
--- a/src/drivers/pc80/tpm/tis.c
+++ b/src/drivers/pc80/tpm/tis.c
@@ -35,9 +35,9 @@
 		printk(BIOS_DEBUG, fmt, ##args);	\
 	}
 #define TPM_DEBUG_IO_READ(reg_, val_) \
-	TPM_DEBUG("Read reg 0x%x returns 0x%x\n", (reg_), (val_))
+	TPM_DEBUG("Read reg %#x returns %#x\n", (reg_), (val_))
 #define TPM_DEBUG_IO_WRITE(reg_, val_) \
-	TPM_DEBUG("Write reg 0x%x with 0x%x\n", (reg_), (val_))
+	TPM_DEBUG("Write reg %#x with %#x\n", (reg_), (val_))
 #define printf(x...) printk(BIOS_ERR, x)
 
 /* coreboot wrapper for TPM driver (end) */
@@ -499,7 +499,7 @@
 	 * command.
 	 */
 	if (tis_wait_valid(locality) || tis_expect_data(locality)) {
-		printf("%s:%d unexpected TPM status 0x%x\n",
+		printf("%s:%d unexpected TPM status %#x\n",
 		       __FILE__, __LINE__, tpm_read_status(locality));
 		return TPM_DRIVER_ERR;
 	}
@@ -596,7 +596,7 @@
 
 	/* * Make sure we indeed read all there was. */
 	if (tis_has_valid_data(locality)) {
-		printf("%s:%d wrong receive status: %x %u bytes left\n",
+		printf("%s:%d wrong receive status: %#x %u bytes left\n",
 		       __FILE__, __LINE__, tpm_read_status(locality),
 	               tpm_read_burst_count(locality));
 		return TPM_DRIVER_ERR;
diff --git a/src/drivers/spi/tpm/tpm.c b/src/drivers/spi/tpm/tpm.c
index 898d570..01f04f4 100644
--- a/src/drivers/spi/tpm/tpm.c
+++ b/src/drivers/spi/tpm/tpm.c
@@ -509,7 +509,7 @@
 	do {
 		udelay(1000);
 		if (stopwatch_expired(&sw)) {
-			printk(BIOS_ERR, "failed to get expected status %x\n",
+			printk(BIOS_ERR, "failed to get expected status %#x\n",
 			       status_expected);
 			return CB_ERR;
 		}
diff --git a/src/mainboard/facebook/fbg1701/romstage.c b/src/mainboard/facebook/fbg1701/romstage.c
index c3d817b..41ae099 100644
--- a/src/mainboard/facebook/fbg1701/romstage.c
+++ b/src/mainboard/facebook/fbg1701/romstage.c
@@ -88,7 +88,7 @@
 				       tcgEventHdr.eventSize, &tcgEventHdr,
 				       (uint8_t *)crtm_version);
 	if (rc) {
-		printk(BIOS_DEBUG, "Measure CRTM Version returned 0x%x\n", rc);
+		printk(BIOS_DEBUG, "Measure CRTM Version returned %#x\n", rc);
 	}
 
 	return rc;
diff --git a/src/mainboard/google/brya/mainboard.c b/src/mainboard/google/brya/mainboard.c
index a460337..638d402 100644
--- a/src/mainboard/google/brya/mainboard.c
+++ b/src/mainboard/google/brya/mainboard.c
@@ -38,7 +38,7 @@
 
 	rc = tlcl_lib_init();
 	if (rc != VB2_SUCCESS) {
-		printk(BIOS_ERR, "tlcl_lib_init() failed: 0x%x\n", rc);
+		printk(BIOS_ERR, "tlcl_lib_init() failed: %#x\n", rc);
 		return;
 	}
 
diff --git a/src/mainboard/google/dedede/mainboard.c b/src/mainboard/google/dedede/mainboard.c
index 444eef8..3abee01 100644
--- a/src/mainboard/google/dedede/mainboard.c
+++ b/src/mainboard/google/dedede/mainboard.c
@@ -18,7 +18,7 @@
 
 	rc = tlcl_lib_init();
 	if (rc != VB2_SUCCESS) {
-		printk(BIOS_ERR, "tlcl_lib_init() failed: 0x%x\n", rc);
+		printk(BIOS_ERR, "tlcl_lib_init() failed: %#x\n", rc);
 		return;
 	}
 
diff --git a/src/mainboard/google/volteer/mainboard.c b/src/mainboard/google/volteer/mainboard.c
index 7409a5b..4dc97c3 100644
--- a/src/mainboard/google/volteer/mainboard.c
+++ b/src/mainboard/google/volteer/mainboard.c
@@ -95,7 +95,7 @@
 
 	rc = tlcl_lib_init();
 	if (rc != VB2_SUCCESS) {
-		printk(BIOS_ERR, "tlcl_lib_init() failed: 0x%x\n", rc);
+		printk(BIOS_ERR, "tlcl_lib_init() failed: %#x\n", rc);
 		return;
 	}
 
diff --git a/src/security/tpm/tss/tcg-1.2/tss.c b/src/security/tpm/tss/tcg-1.2/tss.c
index b6527a6..076b8a7 100644
--- a/src/security/tpm/tss/tcg-1.2/tss.c
+++ b/src/security/tpm/tss/tcg-1.2/tss.c
@@ -82,7 +82,7 @@
 					response, &response_length);
 	if (rc != 0) {
 		/* Communication with TPM failed, so response is garbage */
-		VBDEBUG("TPM: command 0x%x send/receive failed: 0x%x\n",
+		VBDEBUG("TPM: command %#x send/receive failed: %#x\n",
 			tpm_command_code(request), rc);
 		return rc;
 	}
@@ -93,7 +93,7 @@
 	 * (and possibly expected length from the response header).  See
 	 * crosbug.com/17017 */
 
-	VBDEBUG("TPM: command 0x%x returned 0x%x\n",
+	VBDEBUG("TPM: command %#x returned %#x\n",
 		tpm_command_code(request), rc);
 
 return rc;
@@ -193,7 +193,7 @@
 uint32_t tlcl_define_space(uint32_t index, uint32_t perm, uint32_t size)
 {
 	struct s_tpm_nv_definespace_cmd cmd;
-	VBDEBUG("TPM: TlclDefineSpace(0x%x, 0x%x, %d)\n", index, perm, size);
+	VBDEBUG("TPM: TlclDefineSpace(%#x, %#x, %d)\n", index, perm, size);
 	memcpy(&cmd, &tpm_nv_definespace_cmd, sizeof(cmd));
 	to_tpm_uint32(cmd.buffer + tpm_nv_definespace_cmd.index, index);
 	to_tpm_uint32(cmd.buffer + tpm_nv_definespace_cmd.perm, perm);
@@ -208,7 +208,7 @@
 	const int total_length =
 			kTpmRequestHeaderLength + kWriteInfoLength + length;
 
-	VBDEBUG("TPM: %s(0x%x, %d)\n", __func__, index, length);
+	VBDEBUG("TPM: %s(%#x, %d)\n", __func__, index, length);
 	memcpy(&cmd, &tpm_nv_write_cmd, sizeof(cmd));
 	assert(total_length <= TPM_LARGE_ENOUGH_COMMAND_SIZE);
 	set_tpm_command_size(cmd.buffer, total_length);
@@ -228,7 +228,7 @@
 	uint32_t result_length;
 	uint32_t rc;
 
-	VBDEBUG("TPM: %s(0x%x, %d)\n", __func__, index, length);
+	VBDEBUG("TPM: %s(%#x, %d)\n", __func__, index, length);
 	memcpy(&cmd, &tpm_nv_read_cmd, sizeof(cmd));
 	to_tpm_uint32(cmd.buffer + tpm_nv_read_cmd.index, index);
 	to_tpm_uint32(cmd.buffer + tpm_nv_read_cmd.length, length);
diff --git a/src/security/tpm/tss/tcg-2.0/tss.c b/src/security/tpm/tss/tcg-2.0/tss.c
index 5b9aab8..e780bd2 100644
--- a/src/security/tpm/tss/tcg-2.0/tss.c
+++ b/src/security/tpm/tss/tcg-2.0/tss.c
@@ -60,7 +60,7 @@
 		return TPM_IOERROR;
 	}
 
-	printk(BIOS_INFO, "%s: Startup return code is %x\n",
+	printk(BIOS_INFO, "%s: Startup return code is %#x\n",
 	       __func__, response->hdr.tpm_code);
 
 	switch (response->hdr.tpm_code) {
@@ -94,7 +94,7 @@
 		return TPM_IOERROR;
 	}
 
-	printk(BIOS_INFO, "%s: Shutdown return code is %x\n",
+	printk(BIOS_INFO, "%s: Shutdown return code is %#x\n",
 	       __func__, response->hdr.tpm_code);
 
 	if (response->hdr.tpm_code == TPM2_RC_SUCCESS)
@@ -155,7 +155,7 @@
 
 	response = tpm_process_command(TPM2_PCR_Extend, &pcr_ext_cmd);
 
-	printk(BIOS_INFO, "%s: response is %x\n",
+	printk(BIOS_INFO, "%s: response is %#x\n",
 	       __func__, response ? response->hdr.tpm_code : -1);
 	if (!response || response->hdr.tpm_code)
 		return TPM_IOERROR;
@@ -175,7 +175,7 @@
 	struct tpm2_response *response;
 
 	response = tpm_process_command(TPM2_Clear, NULL);
-	printk(BIOS_INFO, "%s: response is %x\n",
+	printk(BIOS_INFO, "%s: response is %#x\n",
 	       __func__, response ? response->hdr.tpm_code : -1);
 
 	if (!response || response->hdr.tpm_code)
@@ -192,7 +192,7 @@
 	};
 
 	response = tpm_process_command(TPM2_ClearControl, &cc);
-	printk(BIOS_INFO, "%s: response is %x\n",
+	printk(BIOS_INFO, "%s: response is %#x\n",
 		__func__, response ? response->hdr.tpm_code : -1);
 
 	if (!response || response->hdr.tpm_code)
@@ -246,7 +246,7 @@
 	if (!response)
 		return TPM_CB_READ_FAILURE;
 
-	printk(BIOS_INFO, "%s:%d index %#x return code %x\n",
+	printk(BIOS_INFO, "%s:%d index %#x return code %#x\n",
 	       __FILE__, __LINE__, index, response->hdr.tpm_code);
 	switch (response->hdr.tpm_code) {
 	case 0:
@@ -287,7 +287,7 @@
 	st.yes_no = 1;
 
 	response = tpm_process_command(TPM2_SelfTest, &st);
-	printk(BIOS_INFO, "%s: response is %x\n",
+	printk(BIOS_INFO, "%s: response is %#x\n",
 	       __func__, response ? response->hdr.tpm_code : -1);
 	return TPM_SUCCESS;
 }
@@ -302,7 +302,7 @@
 
 	response = tpm_process_command(TPM2_NV_WriteLock, &nv_wl);
 
-	printk(BIOS_INFO, "%s: response is %x\n",
+	printk(BIOS_INFO, "%s: response is %#x\n",
 	       __func__, response ? response->hdr.tpm_code : -1);
 
 	if (!response || response->hdr.tpm_code)
@@ -329,7 +329,7 @@
 
 	response = tpm_process_command(TPM2_NV_Write, &nv_writec);
 
-	printk(BIOS_INFO, "%s: response is %x\n",
+	printk(BIOS_INFO, "%s: response is %#x\n",
 	       __func__, response ? response->hdr.tpm_code : -1);
 
 	/* Need to map tpm error codes into internal values. */
@@ -352,7 +352,7 @@
 
 	response = tpm_process_command(TPM2_NV_SetBits, &nvsb_cmd);
 
-	printk(BIOS_INFO, "%s: response is %x\n",
+	printk(BIOS_INFO, "%s: response is %#x\n",
 	       __func__, response ? response->hdr.tpm_code : -1);
 
 	/* Need to map tpm error codes into internal values. */
@@ -388,7 +388,7 @@
 	}
 
 	response = tpm_process_command(TPM2_NV_DefineSpace, &nvds_cmd);
-	printk(BIOS_INFO, "%s: response is %x\n", __func__,
+	printk(BIOS_INFO, "%s: response is %#x\n", __func__,
 	       response ? response->hdr.tpm_code : -1);
 
 	if (!response)
diff --git a/src/security/tpm/tss/vendor/cr50/cr50.c b/src/security/tpm/tss/vendor/cr50/cr50.c
index 5dbf014..1711501 100644
--- a/src/security/tpm/tss/vendor/cr50/cr50.c
+++ b/src/security/tpm/tss/vendor/cr50/cr50.c
@@ -20,7 +20,7 @@
 
 	if (!response || (response && response->hdr.tpm_code)) {
 		if (response)
-			printk(BIOS_INFO, "%s: failed %x\n", __func__,
+			printk(BIOS_INFO, "%s: failed %#x\n", __func__,
 			       response->hdr.tpm_code);
 		else
 			printk(BIOS_INFO, "%s: failed\n", __func__);
diff --git a/src/security/vboot/mrc_cache_hash_tpm.c b/src/security/vboot/mrc_cache_hash_tpm.c
index f67eae4..07baed7 100644
--- a/src/security/vboot/mrc_cache_hash_tpm.c
+++ b/src/security/vboot/mrc_cache_hash_tpm.c
@@ -41,7 +41,7 @@
 		return;
 	}
 
-	printk(BIOS_INFO, "MRC: TPM MRC hash idx 0x%x updated successfully.\n", index);
+	printk(BIOS_INFO, "MRC: TPM MRC hash idx %#x updated successfully.\n", index);
 }
 
 int mrc_cache_verify_hash(uint32_t index, const uint8_t *data, size_t size)
@@ -67,7 +67,7 @@
 		return 0;
 	}
 
-	printk(BIOS_INFO, "MRC: Hash idx 0x%x comparison successful.\n", index);
+	printk(BIOS_INFO, "MRC: Hash idx %#x comparison successful.\n", index);
 
 	return 1;
 }
diff --git a/src/security/vboot/secdata_tpm.c b/src/security/vboot/secdata_tpm.c
index fdf98cc..d19b47e 100644
--- a/src/security/vboot/secdata_tpm.c
+++ b/src/security/vboot/secdata_tpm.c
@@ -436,8 +436,8 @@
 uint32_t antirollback_read_space_mrc_hash(uint32_t index, uint8_t *data, uint32_t size)
 {
 	if (size != HASH_NV_SIZE) {
-		VBDEBUG("TPM: Incorrect buffer size for hash idx 0x%x. "
-			"(Expected=0x%x Actual=0x%x).\n", index, HASH_NV_SIZE,
+		VBDEBUG("TPM: Incorrect buffer size for hash idx %#x. "
+			"(Expected=%#x Actual=%#x).\n", index, HASH_NV_SIZE,
 			size);
 		return TPM_CB_READ_FAILURE;
 	}
@@ -450,8 +450,8 @@
 	uint32_t rc;
 
 	if (size != HASH_NV_SIZE) {
-		VBDEBUG("TPM: Incorrect buffer size for hash idx 0x%x. "
-			"(Expected=0x%x Actual=0x%x).\n", index, HASH_NV_SIZE,
+		VBDEBUG("TPM: Incorrect buffer size for hash idx %#x. "
+			"(Expected=%#x Actual=%#x).\n", index, HASH_NV_SIZE,
 			size);
 		return TPM_CB_WRITE_FAILURE;
 	}
@@ -486,8 +486,8 @@
 uint32_t antirollback_read_space_vbios_hash(uint8_t *data, uint32_t size)
 {
 	if (size != HASH_NV_SIZE) {
-		VBDEBUG("TPM: Incorrect buffer size for hash idx 0x%x. "
-			"(Expected=0x%x Actual=0x%x).\n", VBIOS_CACHE_NV_INDEX, HASH_NV_SIZE,
+		VBDEBUG("TPM: Incorrect buffer size for hash idx %#x. "
+			"(Expected=%#x Actual=%#x).\n", VBIOS_CACHE_NV_INDEX, HASH_NV_SIZE,
 			size);
 		return TPM_CB_READ_FAILURE;
 	}
@@ -500,8 +500,8 @@
 	uint32_t rc;
 
 	if (size != HASH_NV_SIZE) {
-		VBDEBUG("TPM: Incorrect buffer size for hash idx 0x%x. "
-			"(Expected=0x%x Actual=0x%x).\n", VBIOS_CACHE_NV_INDEX, HASH_NV_SIZE,
+		VBDEBUG("TPM: Incorrect buffer size for hash idx %#x. "
+			"(Expected=%#x Actual=%#x).\n", VBIOS_CACHE_NV_INDEX, HASH_NV_SIZE,
 			size);
 		return TPM_CB_WRITE_FAILURE;
 	}
diff --git a/src/security/vboot/vbios_cache_hash_tpm.c b/src/security/vboot/vbios_cache_hash_tpm.c
index aa54f19..6ad09ac 100644
--- a/src/security/vboot/vbios_cache_hash_tpm.c
+++ b/src/security/vboot/vbios_cache_hash_tpm.c
@@ -41,7 +41,7 @@
 		return;
 	}
 
-	printk(BIOS_INFO, "VBIOS_CACHE: TPM NV idx 0x%x updated successfully.\n",
+	printk(BIOS_INFO, "VBIOS_CACHE: TPM NV idx %#x updated successfully.\n",
 			VBIOS_CACHE_NV_INDEX);
 }
 
@@ -68,7 +68,7 @@
 		return CB_ERR;
 	}
 
-	printk(BIOS_INFO, "VBIOS_CACHE: Hash idx 0x%x comparison successful.\n",
+	printk(BIOS_INFO, "VBIOS_CACHE: Hash idx %#x comparison successful.\n",
 			VBIOS_CACHE_NV_INDEX);
 
 	return CB_SUCCESS;
diff --git a/src/security/vboot/vboot_logic.c b/src/security/vboot/vboot_logic.c
index 69cfaf8..f6d8bad 100644
--- a/src/security/vboot/vboot_logic.c
+++ b/src/security/vboot/vboot_logic.c
@@ -318,7 +318,7 @@
 		 * For any other error code, save context if needed and reboot.
 		 */
 		if (rv == VB2_ERROR_API_PHASE1_RECOVERY) {
-			printk(BIOS_INFO, "Recovery requested (%x)\n", rv);
+			printk(BIOS_INFO, "Recovery requested (%#x)\n", rv);
 			vboot_save_data(ctx);
 			extend_pcrs(ctx); /* ignore failures */
 			goto verstage_main_exit;
@@ -376,7 +376,7 @@
 	timestamp_add_now(TS_TPMLOCK_START);
 	rv = antirollback_lock_space_firmware();
 	if (rv) {
-		printk(BIOS_INFO, "Failed to lock TPM (%x)\n", rv);
+		printk(BIOS_INFO, "Failed to lock TPM (%#x)\n", rv);
 		vboot_fail_and_reboot(ctx, VB2_RECOVERY_RO_TPM_L_ERROR, 0);
 	}
 	timestamp_add_now(TS_TPMLOCK_END);
@@ -385,7 +385,7 @@
 	if (CONFIG(VBOOT_HAS_REC_HASH_SPACE)) {
 		rv = antirollback_lock_space_mrc_hash(MRC_REC_HASH_NV_INDEX);
 		if (rv) {
-			printk(BIOS_INFO, "Failed to lock rec hash space(%x)\n", rv);
+			printk(BIOS_INFO, "Failed to lock rec hash space(%#x)\n", rv);
 			vboot_fail_and_reboot(ctx, VB2_RECOVERY_RO_TPM_REC_HASH_L_ERROR, rv);
 		}
 	}
diff --git a/src/vendorcode/eltan/security/mboot/mboot.c b/src/vendorcode/eltan/security/mboot/mboot.c
index ac7ce4b..783f5873 100644
--- a/src/vendorcode/eltan/security/mboot/mboot.c
+++ b/src/vendorcode/eltan/security/mboot/mboot.c
@@ -47,7 +47,7 @@
 			case TPM_ALG_SM3_256:
 			default:
 				printk(BIOS_DEBUG, "%s: unsupported algorithm "
-					"reported - 0x%x\n", __func__,
+					"reported - %#x\n", __func__,
 					Pcrs.pcrSelections[index].hash);
 				break;
 			}
@@ -88,7 +88,7 @@
 		for (index = 0; index < Pcrs->count; index++) {
 			Pcrs->pcrSelections[index].hash =
 				swab16(TpmCap.data.assignedPCR.pcrSelections[index].hash);
-			printk(BIOS_DEBUG, "Pcrs->pcrSelections[%d].hash = 0x%x\n", index,
+			printk(BIOS_DEBUG, "Pcrs->pcrSelections[%d].hash = %#x\n", index,
 			       Pcrs->pcrSelections[index].hash);
 			Pcrs->pcrSelections[index].sizeofSelect =
 				TpmCap.data.assignedPCR.pcrSelections[index].sizeofSelect;
@@ -166,7 +166,7 @@
 					       (uint8_t *)"Invalidate PCR");
 		if (rc != TPM_SUCCESS)
 			printk(BIOS_DEBUG, "%s: invalidating pcr %d returned"
-				" 0x%x\n", __func__, pcr, rc);
+				" %#x\n", __func__, pcr, rc);
 	}
 }
 
@@ -291,7 +291,7 @@
 	}
 
 	if (rc)
-		printk(BIOS_ERR, "%s: StartUp failed 0x%x!\n", __func__, rc);
+		printk(BIOS_ERR, "%s: StartUp failed %#x!\n", __func__, rc);
 
 	return rc;
 }
@@ -327,12 +327,12 @@
 			printk(BIOS_DEBUG, "%s: Measuring, successful!\n", __func__);
 		} else {
 			invalidate_pcrs();
-			printk(BIOS_ERR, "%s: Measuring returned 0x%x unsuccessful! PCRs invalidated.\n",
+			printk(BIOS_ERR, "%s: Measuring returned %#x unsuccessful! PCRs invalidated.\n",
 			       __func__, rc);
 		}
 	} else {
 		invalidate_pcrs();
-		printk(BIOS_ERR, "%s: StartUp returned 0x%x, unsuccessful! PCRs invalidated.\n", __func__,
+		printk(BIOS_ERR, "%s: StartUp returned %#x, unsuccessful! PCRs invalidated.\n", __func__,
 		       rc);
 	}
 	return rc;
@@ -433,13 +433,13 @@
 	rc = mboot_hash_extend_log(0, (uint8_t *)crtm_version, tcgEventHdr.eventSize,
 				       &tcgEventHdr, (uint8_t *)crtm_version);
 	if (rc) {
-		printk(BIOS_DEBUG, "Measure CRTM Version returned 0x%x\n", rc);
+		printk(BIOS_DEBUG, "Measure CRTM Version returned %#x\n", rc);
 		return rc;
 	}
 
 	rc = get_intel_me_hash(hash);
 	if (rc) {
-		printk(BIOS_DEBUG, "get_intel_me_hash returned 0x%x\n", rc);
+		printk(BIOS_DEBUG, "get_intel_me_hash returned %#x\n", rc);
 		rc = TPM_IOERROR;
 		return rc;
 	}
@@ -456,7 +456,7 @@
 	rc = mboot_hash_extend_log(MBOOT_HASH_PROVIDED, hash, sizeof(hash), &tcgEventHdr,
 				       msgPtr);
 	if (rc)
-		printk(BIOS_DEBUG, "Add ME hash returned 0x%x\n", rc);
+		printk(BIOS_DEBUG, "Add ME hash returned %#x\n", rc);
 
 	return rc;
 }
diff --git a/src/vendorcode/eltan/security/verified_boot/vboot_check.c b/src/vendorcode/eltan/security/verified_boot/vboot_check.c
index a8c6cb5..9ea31b8 100644
--- a/src/vendorcode/eltan/security/verified_boot/vboot_check.c
+++ b/src/vendorcode/eltan/security/verified_boot/vboot_check.c
@@ -256,7 +256,7 @@
 						   list[i].hash_index, list[i].pcr);
 			break;
 		default:
-			printk(BIOS_EMERG, "INVALID TYPE IN VERIFY LIST 0x%x\n", list[i].type);
+			printk(BIOS_EMERG, "INVALID TYPE IN VERIFY LIST %#x\n", list[i].type);
 			die("HASH verification failed!\n");
 		}
 		i++;
@@ -289,7 +289,7 @@
 	printk(BIOS_SPEW, "%s: processing early items\n", __func__);
 
 	if (CONFIG(VENDORCODE_ELTAN_MBOOT)) {
-		printk(BIOS_DEBUG, "mb_measure returned 0x%x\n",
+		printk(BIOS_DEBUG, "mb_measure returned %#x\n",
 		mb_measure(platform_is_resuming()));
 	}
 
@@ -338,7 +338,7 @@
 			}
 			break;
 		default:
-			printk(BIOS_EMERG, "%s: INVALID TYPE IN OPTION ROM LIST 0x%x\n",
+			printk(BIOS_EMERG, "%s: INVALID TYPE IN OPTION ROM LIST %#x\n",
 			       __func__, list[i].type);
 			die("HASH verification failed!\n");
 		}
diff --git a/src/vendorcode/google/chromeos/cr50_enable_update.c b/src/vendorcode/google/chromeos/cr50_enable_update.c
index aea804f..abc132d 100644
--- a/src/vendorcode/google/chromeos/cr50_enable_update.c
+++ b/src/vendorcode/google/chromeos/cr50_enable_update.c
@@ -45,7 +45,7 @@
 		return 1;
 	} else if (rc != TPM_SUCCESS)	{
 		/* TPM command failed, continue booting. */
-		printk(BIOS_ERR, "Attempt to get CR50 TPM mode failed: %x\n", rc);
+		printk(BIOS_ERR, "Attempt to get CR50 TPM mode failed: %#x\n", rc);
 		return 0;
 	}
 
@@ -85,7 +85,7 @@
 	rc = tlcl_lib_init();
 
 	if (rc != VB2_SUCCESS) {
-		printk(BIOS_ERR, "tlcl_lib_init() failed for CR50 update: %x\n",
+		printk(BIOS_ERR, "tlcl_lib_init() failed for CR50 update: %#x\n",
 		       rc);
 		return;
 	}
@@ -97,7 +97,7 @@
 				      &num_restored_headers);
 
 	if (rc != TPM_SUCCESS) {
-		printk(BIOS_ERR, "Attempt to enable CR50 update failed: %x\n",
+		printk(BIOS_ERR, "Attempt to enable CR50 update failed: %#x\n",
 		       rc);
 		return;
 	}
@@ -150,7 +150,7 @@
 			 * booting but the current boot will likely end up at
 			 * the recovery screen.
 			 */
-			printk(BIOS_ERR, "Attempt to reset CR50 failed: %x\n",
+			printk(BIOS_ERR, "Attempt to reset CR50 failed: %#x\n",
 			       rc);
 			return;
 		}
diff --git a/src/vendorcode/google/chromeos/cse_board_reset.c b/src/vendorcode/google/chromeos/cse_board_reset.c
index 7d19408..87c4916 100644
--- a/src/vendorcode/google/chromeos/cse_board_reset.c
+++ b/src/vendorcode/google/chromeos/cse_board_reset.c
@@ -23,7 +23,7 @@
 		/* Initialize TPM and get the cr50 firmware version. */
 		rc = tlcl_lib_init();
 		if (rc != VB2_SUCCESS) {
-			printk(BIOS_ERR, "tlcl_lib_init() failed: 0x%x\n", rc);
+			printk(BIOS_ERR, "tlcl_lib_init() failed: %#x\n", rc);
 			return;
 		}
 
diff --git a/src/vendorcode/google/chromeos/tpm2.c b/src/vendorcode/google/chromeos/tpm2.c
index a28b02e..8e3a4eb 100644
--- a/src/vendorcode/google/chromeos/tpm2.c
+++ b/src/vendorcode/google/chromeos/tpm2.c
@@ -18,13 +18,13 @@
 	rc = tlcl_lib_init();
 
 	if (rc != VB2_SUCCESS) {
-		printk(BIOS_ERR, "tlcl_lib_init() failed: %x\n", rc);
+		printk(BIOS_ERR, "tlcl_lib_init() failed: %#x\n", rc);
 		return;
 	}
 
 	rc = tlcl_disable_platform_hierarchy();
 	if (rc != TPM_SUCCESS)
-		printk(BIOS_ERR, "Platform hierarchy disablement failed: %x\n",
+		printk(BIOS_ERR, "Platform hierarchy disablement failed: %#x\n",
 			rc);
 }