From 53fc667943052bd592b8406bdf4bf652c6c9cd3a Mon Sep 17 00:00:00 2001 From: Jon Murphy Date: Tue, 26 Sep 2023 21:05:37 -0600 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/78183 Reviewed-by: Raul Rangel Reviewed-by: Karthik Ramasubramanian Tested-by: build bot (Jenkins) --- src/security/tpm/tss/tcg-1.2/tss.c | 10 +++++----- src/security/tpm/tss/tcg-2.0/tss.c | 22 +++++++++++----------- src/security/tpm/tss/vendor/cr50/cr50.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src/security/tpm') diff --git a/src/security/tpm/tss/tcg-1.2/tss.c b/src/security/tpm/tss/tcg-1.2/tss.c index b6527a6482..076b8a7562 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 @@ static uint32_t tlcl_send_receive_no_retry(const uint8_t *request, 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 @@ static uint32_t tlcl_send_receive_no_retry(const uint8_t *request, * (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_continue_self_test(void) 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 @@ uint32_t tlcl_write(uint32_t index, const void *data, uint32_t length) 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 tlcl_read(uint32_t index, void *data, uint32_t length) 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 5b9aab82bf..e780bd24d3 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 @@ static uint32_t tlcl_send_startup(TPM_SU type) 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 @@ static uint32_t tlcl_send_shutdown(TPM_SU type) 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 @@ uint32_t tlcl_extend(int pcr_num, const uint8_t *digest_data, 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 @@ uint32_t tlcl_force_clear(void) 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 @@ uint32_t tlcl_clear_control(bool disable) }; 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 @@ uint32_t tlcl_read(uint32_t index, void *data, uint32_t length) 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 @@ uint32_t tlcl_self_test_full(void) 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 @@ uint32_t tlcl_lock_nv_write(uint32_t index) 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 @@ uint32_t tlcl_write(uint32_t index, const void *data, uint32_t length) 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 @@ uint32_t tlcl_set_bits(uint32_t index, uint64_t bits) 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 @@ uint32_t tlcl_define_space(uint32_t space_index, size_t space_size, } 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 5dbf0148bb..1711501323 100644 --- a/src/security/tpm/tss/vendor/cr50/cr50.c +++ b/src/security/tpm/tss/vendor/cr50/cr50.c @@ -20,7 +20,7 @@ uint32_t tlcl_cr50_enable_nvcommits(void) 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__); -- cgit v1.2.3