[PATCH v2 2/4] mmc: core: Add trace event for SD SSR response
From: Raul E Rangel
Date: Tue Apr 16 2019 - 14:33:18 EST
Example:
sd_ssr: mmc0: au: 8192, erase time: 0, erase offset: 0x0, raw: {0x0,0x3000000,0x1019000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}
Signed-off-by: Raul E Rangel <rrangel@xxxxxxxxxxxx>
---
drivers/mmc/core/sd.c | 2 ++
include/trace/events/mmc.h | 32 ++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index f1772972d6a3..908c3087cdcd 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -292,6 +292,8 @@ static int mmc_read_ssr(struct mmc_card *card)
card->erase_arg = (card->scr.sda_specx && discard_support) ?
SD_DISCARD_ARG : SD_ERASE_ARG;
+ trace_sd_ssr(card);
+
return 0;
}
diff --git a/include/trace/events/mmc.h b/include/trace/events/mmc.h
index 9761d3db16db..463cf318d762 100644
--- a/include/trace/events/mmc.h
+++ b/include/trace/events/mmc.h
@@ -61,6 +61,38 @@ TRACE_EVENT(sd_scr,
)
);
+TRACE_EVENT(sd_ssr,
+
+ TP_PROTO(struct mmc_card *card),
+
+ TP_ARGS(card),
+
+ TP_STRUCT__entry(
+ __array(u32, raw, 16)
+ __field(unsigned int, au)
+ __field(unsigned int, erase_timeout)
+ __field(unsigned int, erase_offset)
+ __string(name, mmc_hostname(card->host))
+ ),
+
+ TP_fast_assign(
+ BUILD_BUG_ON(sizeof(card->raw_ssr) != sizeof(__entry->raw));
+ memcpy(__entry->raw, card->raw_ssr, sizeof(__entry->raw));
+ __entry->au = card->ssr.au;
+ __entry->erase_timeout = card->ssr.erase_timeout;
+ __entry->erase_offset = card->ssr.erase_offset;
+ __assign_str(name, mmc_hostname(card->host));
+ ),
+
+ TP_printk("%s: au: %d, erase time: %d, erase offset: %#x, raw: %s",
+ __get_str(name),
+ __entry->au,
+ __entry->erase_timeout,
+ __entry->erase_offset,
+ __print_array(__entry->raw, 16, sizeof(u32))
+ )
+);
+
TRACE_EVENT(mmc_request_start,
TP_PROTO(struct mmc_host *host, struct mmc_request *mrq),
--
2.21.0.392.gf8f6787159e-goog