libpldm-google: Adds more logging to catch fw update oddities

Tested: Built. No functionality changes, only added logging.
No fusion2 link.
Google-Bug-Id: 500125676
Change-Id: I356349a0bef4796b7fdedf3c5526b212ac7bd67f
Signed-off-by: Luka Strizic <lstrz@google.com>
Platforms-Affected: platform22,platform24,platform31
diff --git a/recipes-google/pldmd/libpldm-google/0001-firmware_update-Adds-logging-to-catch-fw-update-oddi.patch b/recipes-google/pldmd/libpldm-google/0001-firmware_update-Adds-logging-to-catch-fw-update-oddi.patch
new file mode 100644
index 0000000..ec3d68f
--- /dev/null
+++ b/recipes-google/pldmd/libpldm-google/0001-firmware_update-Adds-logging-to-catch-fw-update-oddi.patch
@@ -0,0 +1,90 @@
+From 3500d9e6bc58b61da43b906a804deb37b0038d47 Mon Sep 17 00:00:00 2001
+From: Luka Strizic <lstrz@google.com>
+Date: Thu, 9 Apr 2026 14:30:53 -0700
+Subject: [PATCH] firmware_update: Adds logging to catch fw update oddities
+
+Tested: Built. No functionality changes, only added logging.
+Google-Bug-Id: 500125676
+Signed-off-by: Luka Strizic <lstrz@google.com>
+---
+ src/dsp/firmware_update.c | 28 +++++++++++++++++++++++++++-
+ 1 file changed, 27 insertions(+), 1 deletion(-)
+
+diff --git a/src/dsp/firmware_update.c b/src/dsp/firmware_update.c
+index 968f645..26781d4 100644
+--- a/src/dsp/firmware_update.c
++++ b/src/dsp/firmware_update.c
+@@ -11,6 +11,7 @@
+ 
+ #include <endian.h>
+ #include <stdbool.h>
++#include <stdio.h>
+ #include <string.h>
+ 
+ static_assert(PLDM_FIRMWARE_MAX_STRING <= UINT8_MAX, "too large");
+@@ -3025,6 +3026,9 @@ int decode_get_status_resp(const struct pldm_msg *msg, size_t payload_length,
+ 	    aux_state_status == NULL || progress_percent == NULL ||
+ 	    reason_code == NULL || update_option_flags_enabled == NULL ||
+ 	    !payload_length) {
++		printf("decode_get_status_resp returns "
++			"PLDM_ERROR_INVALID_DATA because "
++			"input ars are invalid.");
+ 		return PLDM_ERROR_INVALID_DATA;
+ 	}
+ 
+@@ -3040,21 +3044,39 @@ int decode_get_status_resp(const struct pldm_msg *msg, size_t payload_length,
+ 		(struct pldm_get_status_resp *)msg->payload;
+ 
+ 	if (!is_state_valid(response->current_state)) {
++		printf("decode_get_status_resp returns "
++			"PLDM_ERROR_INVALID_DATA because "
++			"current state is invalid: %d", response->current_state);
+ 		return PLDM_ERROR_INVALID_DATA;
+ 	}
+ 	if (!is_state_valid(response->previous_state)) {
++		printf("decode_get_status_resp returns "
++			"PLDM_ERROR_INVALID_DATA because "
++			"previous state is invalid: %d", response->previous_state);
+ 		return PLDM_ERROR_INVALID_DATA;
+ 	}
+ 	if (!is_aux_state_valid(response->aux_state)) {
++		printf("decode_get_status_resp returns "
++			"PLDM_ERROR_INVALID_DATA because "
++			"aux state is invalid: %d", response->aux_state);
+ 		return PLDM_ERROR_INVALID_DATA;
+ 	}
+ 	if (!is_aux_state_status_valid(response->aux_state_status)) {
++		printf("decode_get_status_resp returns "
++			"PLDM_ERROR_INVALID_DATA because "
++			"aux state status is invalid: %d", response->aux_state_status);
+ 		return PLDM_ERROR_INVALID_DATA;
+ 	}
+ 	if (response->progress_percent > PLDM_FWUP_MAX_PROGRESS_PERCENT) {
++		printf("decode_get_status_resp returns "
++			"PLDM_ERROR_INVALID_DATA because "
++			"progress percent is invalid: %d", response->progress_percent);
+ 		return PLDM_ERROR_INVALID_DATA;
+ 	}
+ 	if (!is_reason_code_valid(response->reason_code)) {
++		printf("decode_get_status_resp returns "
++			"PLDM_ERROR_INVALID_DATA because "
++			"reason code is invalid: %d", response->reason_code);
+ 		return PLDM_ERROR_INVALID_DATA;
+ 	}
+ 
+@@ -3062,7 +3084,11 @@ int decode_get_status_resp(const struct pldm_msg *msg, size_t payload_length,
+ 	    (response->current_state == PLDM_FD_STATE_LEARN_COMPONENTS) ||
+ 	    (response->current_state == PLDM_FD_STATE_READY_XFER)) {
+ 		if (response->aux_state !=
+-		    PLDM_FD_IDLE_LEARN_COMPONENTS_READ_XFER) {
++		PLDM_FD_IDLE_LEARN_COMPONENTS_READ_XFER) {
++			printf("decode_get_status_resp returns "
++				"PLDM_ERROR_INVALID_DATA because "
++				"aux state (%d) didn't match current state (%d) expectations",
++				response->aux_state, response->current_state);
+ 			return PLDM_ERROR_INVALID_DATA;
+ 		}
+ 	}
+-- 
+2.53.0.1213.gd9a14994de-goog
+
diff --git a/recipes-google/pldmd/libpldm-google_git.bb b/recipes-google/pldmd/libpldm-google_git.bb
index 6c1a785..138b98f 100644
--- a/recipes-google/pldmd/libpldm-google_git.bb
+++ b/recipes-google/pldmd/libpldm-google_git.bb
@@ -22,6 +22,7 @@
 
 SRC_URI:append = " \
     file://0001-Update-minimum-meson-version-to-build-with-gBMC.patch \
+    file://0001-firmware_update-Adds-logging-to-catch-fw-update-oddi.patch \
 "
 
 S = "${WORKDIR}/git"