memcpy_fromio(&layout, addr, sizeof(layout));
- if (!kfifo_initialized(&adev->dbg.trace_fifo))
+ if (!avs_logging_fw(adev))
/* consume the logs regardless of consumer presence */
goto update_read_ptr;
buf = apl_log_payload_addr(addr);
if (layout.read_ptr > layout.write_ptr) {
- __kfifo_fromio(&adev->dbg.trace_fifo, buf + layout.read_ptr,
- apl_log_payload_size(adev) - layout.read_ptr);
+ avs_dump_fw_log(adev, buf + layout.read_ptr,
+ apl_log_payload_size(adev) - layout.read_ptr);
layout.read_ptr = 0;
}
- __kfifo_fromio(&adev->dbg.trace_fifo, buf + layout.read_ptr,
- layout.write_ptr - layout.read_ptr);
-
- wake_up(&adev->dbg.trace_waitq);
+ avs_dump_fw_log_wakeup(adev, buf + layout.read_ptr, layout.write_ptr - layout.read_ptr);
update_read_ptr:
writel(layout.write_ptr, addr);
struct list_head node;
};
-struct avs_debug {
- struct kfifo trace_fifo;
- spinlock_t trace_lock; /* serialize debug window I/O between each LOG_BUFFER_STATUS */
- wait_queue_head_t trace_waitq;
- u32 aging_timer_period;
- u32 fifo_full_timer_period;
- u32 logged_resources; /* context dependent: core or library */
-};
-
/*
* struct avs_dev - Intel HD-Audio driver data
*
spinlock_t path_list_lock;
struct mutex path_mutex;
- struct avs_debug dbg;
spinlock_t trace_lock; /* serialize debug window I/O between each LOG_BUFFER_STATUS */
#ifdef CONFIG_DEBUG_FS
struct kfifo trace_fifo;
/* Firmware tracing helpers */
-unsigned int __kfifo_fromio(struct kfifo *fifo, const void __iomem *src, unsigned int len);
-
#define avs_log_buffer_size(adev) \
((adev)->fw_cfg.trace_log_bytes / (adev)->hw_cfg.dsp_cores)
unsigned long flags;
int ret;
- spin_lock_irqsave(&adev->dbg.trace_lock, flags);
+ spin_lock_irqsave(&adev->trace_lock, flags);
ret = avs_dsp_op(adev, log_buffer_status, msg);
- spin_unlock_irqrestore(&adev->dbg.trace_lock, flags);
+ spin_unlock_irqrestore(&adev->trace_lock, flags);
return ret;
}
#include <linux/wait.h>
#include "avs.h"
+static unsigned int __kfifo_fromio(struct kfifo *fifo, const void __iomem *src, unsigned int len)
+{
+ struct __kfifo *__fifo = &fifo->kfifo;
+ unsigned int l, off;
+
+ len = min(len, kfifo_avail(fifo));
+ off = __fifo->in & __fifo->mask;
+ l = min(len, kfifo_size(fifo) - off);
+
+ memcpy_fromio(__fifo->data + off, src, l);
+ memcpy_fromio(__fifo->data, src + l, len - l);
+ /* Make sure data copied from SRAM is visible to all CPUs. */
+ smp_mb();
+ __fifo->in += len;
+
+ return len;
+}
+
bool avs_logging_fw(struct avs_dev *adev)
{
return kfifo_initialized(&adev->trace_fifo);
void __iomem *buf;
u16 size, write, offset;
- if (!kfifo_initialized(&adev->dbg.trace_fifo))
+ if (!avs_logging_fw(adev))
return 0;
size = avs_log_buffer_size(adev) / 2;
/* Address is guaranteed to exist in SRAM2. */
buf = avs_log_buffer_addr(adev, msg->log.core) + offset;
- __kfifo_fromio(&adev->dbg.trace_fifo, buf, size);
- wake_up(&adev->dbg.trace_waitq);
+ avs_dump_fw_log_wakeup(adev, buf, size);
return 0;
}
kfree(entry);
}
}
-
-unsigned int __kfifo_fromio(struct kfifo *fifo, const void __iomem *src, unsigned int len)
-{
- struct __kfifo *__fifo = &fifo->kfifo;
- unsigned int l, off;
-
- len = min(len, kfifo_avail(fifo));
- off = __fifo->in & __fifo->mask;
- l = min(len, kfifo_size(fifo) - off);
-
- memcpy_fromio(__fifo->data + off, src, l);
- memcpy_fromio(__fifo->data, src + l, len - l);
- /* Make sure data copied from SRAM is visible to all CPUs. */
- smp_mb();
- __fifo->in += len;
-
- return len;
-}