mirror of https://gitee.com/openkylin/linux.git
wil6210: add debugfs to show PMC ring content
PMC is a hardware debug mechanism which allows capturing real time debug data and stream it to host memory. The driver allocates memory buffers and set them inside PMC ring of descriptors. Add pmcring debugfs that application can use to read the binary content of descriptors inside the PMC ring (cat pmcring). Signed-off-by: Dedy Lansky <dlansky@codeaurora.org> Signed-off-by: Maya Erez <merez@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
f99fe49ff3
commit
977c45ab5f
|
@ -959,6 +959,18 @@ static const struct file_operations fops_pmcdata = {
|
|||
.llseek = wil_pmc_llseek,
|
||||
};
|
||||
|
||||
static int wil_pmcring_seq_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, wil_pmcring_read, inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations fops_pmcring = {
|
||||
.open = wil_pmcring_seq_open,
|
||||
.release = single_release,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
};
|
||||
|
||||
/*---tx_mgmt---*/
|
||||
/* Write mgmt frame to this file to send it */
|
||||
static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf,
|
||||
|
@ -2371,6 +2383,7 @@ static const struct {
|
|||
{"back", 0644, &fops_back},
|
||||
{"pmccfg", 0644, &fops_pmccfg},
|
||||
{"pmcdata", 0444, &fops_pmcdata},
|
||||
{"pmcring", 0444, &fops_pmcring},
|
||||
{"temp", 0444, &temp_fops},
|
||||
{"freq", 0444, &freq_fops},
|
||||
{"link", 0444, &link_fops},
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include "wmi.h"
|
||||
#include "wil6210.h"
|
||||
#include "txrx.h"
|
||||
|
@ -431,3 +432,28 @@ loff_t wil_pmc_llseek(struct file *filp, loff_t off, int whence)
|
|||
|
||||
return newpos;
|
||||
}
|
||||
|
||||
int wil_pmcring_read(struct seq_file *s, void *data)
|
||||
{
|
||||
struct wil6210_priv *wil = s->private;
|
||||
struct pmc_ctx *pmc = &wil->pmc;
|
||||
size_t pmc_ring_size =
|
||||
sizeof(struct vring_rx_desc) * pmc->num_descriptors;
|
||||
|
||||
mutex_lock(&pmc->lock);
|
||||
|
||||
if (!wil_is_pmc_allocated(pmc)) {
|
||||
wil_err(wil, "error, pmc is not allocated!\n");
|
||||
pmc->last_cmd_status = -EPERM;
|
||||
mutex_unlock(&pmc->lock);
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
wil_dbg_misc(wil, "pmcring_read: size %zu\n", pmc_ring_size);
|
||||
|
||||
seq_write(s, pmc->pring_va, pmc_ring_size);
|
||||
|
||||
mutex_unlock(&pmc->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -25,3 +25,4 @@ void wil_pmc_free(struct wil6210_priv *wil, int send_pmc_cmd);
|
|||
int wil_pmc_last_cmd_status(struct wil6210_priv *wil);
|
||||
ssize_t wil_pmc_read(struct file *, char __user *, size_t, loff_t *);
|
||||
loff_t wil_pmc_llseek(struct file *filp, loff_t off, int whence);
|
||||
int wil_pmcring_read(struct seq_file *s, void *data);
|
||||
|
|
Loading…
Reference in New Issue