astlpc: Log changes to KCS status register

Break down what the current state of the interface is whenever it
changes.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ic636f5cd471f35da7851da0e448e62417104cd3e
diff --git a/astlpc.c b/astlpc.c
index c8f7a68..33714a8 100644
--- a/astlpc.c
+++ b/astlpc.c
@@ -153,6 +153,8 @@
 	astlpc_prlog(ctx, MCTP_LOG_ERR, fmt, ##__VA_ARGS__)
 #define astlpc_prwarn(ctx, fmt, ...)                                           \
 	astlpc_prlog(ctx, MCTP_LOG_WARNING, fmt, ##__VA_ARGS__)
+#define astlpc_prnotice(ctx, fmt, ...)                                         \
+	astlpc_prlog(ctx, MCTP_LOG_NOTICE, fmt, ##__VA_ARGS__)
 #define astlpc_prinfo(ctx, fmt, ...)                                           \
 	astlpc_prlog(ctx, MCTP_LOG_INFO, fmt, ##__VA_ARGS__)
 #define astlpc_prdebug(ctx, fmt, ...)                                          \
@@ -348,6 +350,17 @@
 	return 0;
 }
 
+static void
+mctp_astlpc_kcs_print_status_write(struct mctp_binding_astlpc *astlpc,
+				   uint8_t status)
+{
+	astlpc_prnotice(
+		astlpc, "Binding state is 0x%hhx: BMC %s, Channel %s, OBF %s",
+		status, status & KCS_STATUS_BMC_READY ? "active" : "inactive",
+		status & KCS_STATUS_CHANNEL_ACTIVE ? "active" : "inactive",
+		status & KCS_STATUS_OBF ? "preserved" : "cleared");
+}
+
 static int mctp_astlpc_kcs_set_status(struct mctp_binding_astlpc *astlpc,
 				      uint8_t status)
 {
@@ -368,6 +381,8 @@
 		return -1;
 	}
 
+	mctp_astlpc_kcs_print_status_write(astlpc, status);
+
 	rc = mctp_astlpc_kcs_write(astlpc, MCTP_ASTLPC_KCS_REG_DATA, data);
 	if (rc) {
 		astlpc_prwarn(astlpc, "KCS dummy data write failed");