diff mbox series

[PATCH-for-9.1,4/5] hw/sd/sdhci: Trace ADMA descriptors

Message ID 20240730092138.32443-5-philmd@linaro.org
State New
Headers show
Series hw/sd: SDcard & SDHCI fixes | expand

Commit Message

Philippe Mathieu-Daudé July 30, 2024, 9:21 a.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/sd/sdhci.c      | 8 ++++++++
 hw/sd/trace-events | 1 +
 2 files changed, 9 insertions(+)

Comments

Richard Henderson July 31, 2024, 4:32 a.m. UTC | #1
On 7/30/24 19:21, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   hw/sd/sdhci.c      | 8 ++++++++
>   hw/sd/trace-events | 1 +
>   2 files changed, 9 insertions(+)
> 
> diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
> index 8293d83556..66b9364e9e 100644
> --- a/hw/sd/sdhci.c
> +++ b/hw/sd/sdhci.c
> @@ -693,6 +693,11 @@ typedef struct ADMADescr {
>       uint8_t incr;
>   } ADMADescr;
>   
> +static void trace_adma_description(const char *type, const ADMADescr *dscr)
> +{
> +    trace_sdhci_adma_desc(type, dscr->addr, dscr->length, dscr->attr, dscr->incr);
> +}
> +

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
diff mbox series

Patch

diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 8293d83556..66b9364e9e 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -693,6 +693,11 @@  typedef struct ADMADescr {
     uint8_t incr;
 } ADMADescr;
 
+static void trace_adma_description(const char *type, const ADMADescr *dscr)
+{
+    trace_sdhci_adma_desc(type, dscr->addr, dscr->length, dscr->attr, dscr->incr);
+}
+
 static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
 {
     uint32_t adma1 = 0;
@@ -710,6 +715,7 @@  static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
         dscr->length = (uint16_t)extract64(adma2, 16, 16);
         dscr->attr = (uint8_t)extract64(adma2, 0, 7);
         dscr->incr = 8;
+        trace_adma_description("ADMA2_32", dscr);
         break;
     case SDHC_CTRL_ADMA1_32:
         dma_memory_read(s->dma_as, entry_addr, &adma1, sizeof(adma1),
@@ -723,6 +729,7 @@  static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
         } else {
             dscr->length = 4 * KiB;
         }
+        trace_adma_description("ADMA1_32", dscr);
         break;
     case SDHC_CTRL_ADMA2_64:
         dma_memory_read(s->dma_as, entry_addr, &dscr->attr, 1,
@@ -735,6 +742,7 @@  static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
         dscr->addr = le64_to_cpu(dscr->addr);
         dscr->attr &= (uint8_t) ~0xC0;
         dscr->incr = 12;
+        trace_adma_description("ADMA2_64", dscr);
         break;
     }
 }
diff --git a/hw/sd/trace-events b/hw/sd/trace-events
index 43671dc791..3d3f5c1cb7 100644
--- a/hw/sd/trace-events
+++ b/hw/sd/trace-events
@@ -35,6 +35,7 @@  sdhci_access(const char *access, unsigned int size, uint64_t offset, const char
 sdhci_read_dataport(uint16_t data_count) "all %u bytes of data have been read from input buffer"
 sdhci_write_dataport(uint16_t data_count) "write buffer filled with %u bytes of data"
 sdhci_capareg(const char *desc, uint16_t val) "%s: %u"
+sdhci_adma_desc(const char *type, uint64_t addr, uint16_t length, uint8_t attr, uint8_t incr) "%s addr:0x%08"PRIx64" len:0x%x, attr:0x%x, incr:%u"
 
 # sd.c
 sdcard_normal_command(const char *proto, const char *cmd_desc, uint8_t cmd, uint32_t arg, const char *state) "%s %20s/ CMD%02d arg 0x%08x (state %s)"