[PATCH linux dev-5.3 v2 2/2] fsi: aspeed: Add trace when error occurs

Joel Stanley joel at jms.id.au
Wed Oct 16 13:51:21 AEDT 2019


This prints out three registers in the FSI master when an error occurs.

Signed-off-by: Joel Stanley <joel at jms.id.au>
---
v2:
 endian swap the values
 only read them out when tracepoint is enabled
---
 drivers/fsi/fsi-master-aspeed.c          | 13 +++++++++++++
 include/trace/events/fsi_master_aspeed.h | 18 ++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c
index d796c4012875..6fa9712c70c4 100644
--- a/drivers/fsi/fsi-master-aspeed.c
+++ b/drivers/fsi/fsi-master-aspeed.c
@@ -252,6 +252,19 @@ static int check_errors(struct fsi_master_aspeed *aspeed, int err)
 {
 	int ret;
 
+	 if (trace_fsi_master_aspeed_opb_error_enabled()) {
+		 __be32 mresp0, mstap0, mesrb0;
+
+		 opb_read(aspeed->base, ctrl_base + FSI_MRESP0, 4, &mresp0);
+		 opb_read(aspeed->base, ctrl_base + FSI_MSTAP0, 4, &mstap0);
+		 opb_read(aspeed->base, ctrl_base + FSI_MESRB0, 4, &mesrb0);
+
+		 trace_fsi_master_aspeed_opb_error(
+				 be32_to_cpu(mresp0),
+				 be32_to_cpu(mstap0),
+				 be32_to_cpu(mesrb0));
+	 };
+
 	if (err == -EIO) {
 		/* Check MAEB (0x70) ? */
 
diff --git a/include/trace/events/fsi_master_aspeed.h b/include/trace/events/fsi_master_aspeed.h
index 63b9ce7f0de6..8e47637c5fb7 100644
--- a/include/trace/events/fsi_master_aspeed.h
+++ b/include/trace/events/fsi_master_aspeed.h
@@ -54,6 +54,24 @@ TRACE_EVENT(fsi_master_aspeed_opb_write,
 		)
 	);
 
+TRACE_EVENT(fsi_master_aspeed_opb_error,
+	TP_PROTO(uint32_t mresp0, uint32_t mstap0, uint32_t mesrb0),
+	TP_ARGS(mresp0, mstap0, mesrb0),
+	TP_STRUCT__entry(
+		__field(uint32_t,  mresp0)
+		__field(uint32_t,  mstap0)
+		__field(uint32_t,  mesrb0)
+		),
+	TP_fast_assign(
+		__entry->mresp0 = mresp0;
+		__entry->mstap0 = mstap0;
+		__entry->mesrb0 = mesrb0;
+		),
+	TP_printk("mresp0 %08x mstap0 %08x mesrb0 %08x",
+		__entry->mresp0, __entry->mstap0, __entry->mesrb0
+		)
+	);
+
 #endif
 
 #include <trace/define_trace.h>
-- 
2.23.0



More information about the openbmc mailing list