|
@@ -2355,6 +2355,47 @@ static int mwifiex_pcie_host_to_card(struct mwifiex_adapter *adapter, u8 type,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+/* Function to dump PCIE scratch registers in case of FW crash
|
|
|
+ */
|
|
|
+static int
|
|
|
+mwifiex_pcie_reg_dump(struct mwifiex_adapter *adapter, char *drv_buf)
|
|
|
+{
|
|
|
+ char *p = drv_buf;
|
|
|
+ char buf[256], *ptr;
|
|
|
+ int i;
|
|
|
+ u32 value;
|
|
|
+ struct pcie_service_card *card = adapter->card;
|
|
|
+ const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
|
|
|
+ int pcie_scratch_reg[] = {PCIE_SCRATCH_12_REG,
|
|
|
+ PCIE_SCRATCH_13_REG,
|
|
|
+ PCIE_SCRATCH_14_REG};
|
|
|
+
|
|
|
+ if (!p)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ mwifiex_dbg(adapter, MSG, "PCIE register dump start\n");
|
|
|
+
|
|
|
+ if (mwifiex_read_reg(adapter, reg->fw_status, &value)) {
|
|
|
+ mwifiex_dbg(adapter, ERROR, "failed to read firmware status");
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptr = buf;
|
|
|
+ mwifiex_dbg(adapter, MSG, "pcie scratch register:");
|
|
|
+ for (i = 0; i < ARRAY_SIZE(pcie_scratch_reg); i++) {
|
|
|
+ mwifiex_read_reg(adapter, pcie_scratch_reg[i], &value);
|
|
|
+ ptr += sprintf(ptr, "reg:0x%x, value=0x%x\n",
|
|
|
+ pcie_scratch_reg[i], value);
|
|
|
+ }
|
|
|
+
|
|
|
+ mwifiex_dbg(adapter, MSG, "%s\n", buf);
|
|
|
+ p += sprintf(p, "%s\n", buf);
|
|
|
+
|
|
|
+ mwifiex_dbg(adapter, MSG, "PCIE register dump end\n");
|
|
|
+
|
|
|
+ return p - drv_buf;
|
|
|
+}
|
|
|
+
|
|
|
/* This function read/write firmware */
|
|
|
static enum rdwr_status
|
|
|
mwifiex_pcie_rdwr_firmware(struct mwifiex_adapter *adapter, u8 doneflag)
|
|
@@ -2899,6 +2940,7 @@ static struct mwifiex_if_ops pcie_ops = {
|
|
|
.cleanup_mpa_buf = NULL,
|
|
|
.init_fw_port = mwifiex_pcie_init_fw_port,
|
|
|
.clean_pcie_ring = mwifiex_clean_pcie_ring_buf,
|
|
|
+ .reg_dump = mwifiex_pcie_reg_dump,
|
|
|
.device_dump = mwifiex_pcie_device_dump,
|
|
|
};
|
|
|
|