wil6210: improve debug for WMI receive

Print message if no events received. This should not happen.
If it is, it points to the problem in firmware.
Track also cases when multiple events processed in one IRQ

Print information as soon as possible - mbox pointers and
event header right after reading it. This helps to identify potential
problem with memory allocation for the event buffer.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Vladimir Kondratiev 2014-05-29 18:37:52 +03:00 committed by John W. Linville
parent 8f1e5d31cf
commit a715c7ddd6

View File

@ -659,21 +659,27 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
u8 *cmd; u8 *cmd;
void __iomem *src; void __iomem *src;
ulong flags; ulong flags;
unsigned n;
if (!test_bit(wil_status_reset_done, &wil->status)) { if (!test_bit(wil_status_reset_done, &wil->status)) {
wil_err(wil, "Reset not completed\n"); wil_err(wil, "Reset not completed\n");
return; return;
} }
for (;;) { for (n = 0;; n++) {
u16 len; u16 len;
r->head = ioread32(wil->csr + HOST_MBOX + r->head = ioread32(wil->csr + HOST_MBOX +
offsetof(struct wil6210_mbox_ctl, rx.head)); offsetof(struct wil6210_mbox_ctl, rx.head));
if (r->tail == r->head) if (r->tail == r->head) {
if (n == 0)
wil_dbg_wmi(wil, "No events?\n");
return; return;
}
/* read cmd from tail */ wil_dbg_wmi(wil, "Mbox head %08x tail %08x\n",
r->head, r->tail);
/* read cmd descriptor from tail */
wil_memcpy_fromio_32(&d_tail, wil->csr + HOSTADDR(r->tail), wil_memcpy_fromio_32(&d_tail, wil->csr + HOSTADDR(r->tail),
sizeof(struct wil6210_mbox_ring_desc)); sizeof(struct wil6210_mbox_ring_desc));
if (d_tail.sync == 0) { if (d_tail.sync == 0) {
@ -681,13 +687,18 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
return; return;
} }
/* read cmd header from descriptor */
if (0 != wmi_read_hdr(wil, d_tail.addr, &hdr)) { if (0 != wmi_read_hdr(wil, d_tail.addr, &hdr)) {
wil_err(wil, "Mbox evt at 0x%08x?\n", wil_err(wil, "Mbox evt at 0x%08x?\n",
le32_to_cpu(d_tail.addr)); le32_to_cpu(d_tail.addr));
return; return;
} }
len = le16_to_cpu(hdr.len); len = le16_to_cpu(hdr.len);
wil_dbg_wmi(wil, "Mbox evt %04x %04x %04x %02x\n",
le16_to_cpu(hdr.seq), len, le16_to_cpu(hdr.type),
hdr.flags);
/* read cmd buffer from descriptor */
src = wmi_buffer(wil, d_tail.addr) + src = wmi_buffer(wil, d_tail.addr) +
sizeof(struct wil6210_mbox_hdr); sizeof(struct wil6210_mbox_hdr);
evt = kmalloc(ALIGN(offsetof(struct pending_wmi_event, evt = kmalloc(ALIGN(offsetof(struct pending_wmi_event,
@ -703,9 +714,6 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
iowrite32(0, wil->csr + HOSTADDR(r->tail) + iowrite32(0, wil->csr + HOSTADDR(r->tail) +
offsetof(struct wil6210_mbox_ring_desc, sync)); offsetof(struct wil6210_mbox_ring_desc, sync));
/* indicate */ /* indicate */
wil_dbg_wmi(wil, "Mbox evt %04x %04x %04x %02x\n",
le16_to_cpu(hdr.seq), len, le16_to_cpu(hdr.type),
hdr.flags);
if ((hdr.type == WIL_MBOX_HDR_TYPE_WMI) && if ((hdr.type == WIL_MBOX_HDR_TYPE_WMI) &&
(len >= sizeof(struct wil6210_mbox_hdr_wmi))) { (len >= sizeof(struct wil6210_mbox_hdr_wmi))) {
struct wil6210_mbox_hdr_wmi *wmi = &evt->event.wmi; struct wil6210_mbox_hdr_wmi *wmi = &evt->event.wmi;
@ -735,6 +743,8 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
wil_dbg_wmi(wil, "queue_work -> %d\n", q); wil_dbg_wmi(wil, "queue_work -> %d\n", q);
} }
} }
if (n > 1)
wil_dbg_wmi(wil, "%s -> %d events processed\n", __func__, n);
} }
int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len, int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len,