Skip to content

Commit

Permalink
mwifiex: add fw_dump debugfs file
Browse files Browse the repository at this point in the history
This option be useful to dump firmware memory for debugging
purpose. Actual code to dump firmware momory for SDIO and PCIe
chipsets will be added later.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Amitkumar Karwar authored and John W. Linville committed Apr 22, 2014
1 parent bc0df75 commit 1c09bf6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/net/wireless/mwifiex/README
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,11 @@ getlog

cat getlog

fw_dump
This command is used to dump firmware memory into files.
Separate file will be created for each memory segment.
Usage:

cat fw_dump

===============================================================================
25 changes: 25 additions & 0 deletions drivers/net/wireless/mwifiex/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,29 @@ mwifiex_info_read(struct file *file, char __user *ubuf,
return ret;
}

/*
* Proc firmware dump read handler.
*
* This function is called when the 'fw_dump' file is opened for
* reading.
* This function dumps firmware memory in different files
* (ex. DTCM, ITCM, SQRAM etc.) based on the the segments for
* debugging.
*/
static ssize_t
mwifiex_fw_dump_read(struct file *file, char __user *ubuf,
size_t count, loff_t *ppos)
{
struct mwifiex_private *priv = file->private_data;

if (!priv->adapter->if_ops.fw_dump)
return -EIO;

priv->adapter->if_ops.fw_dump(priv->adapter);

return 0;
}

/*
* Proc getlog file read handler.
*
Expand Down Expand Up @@ -699,6 +722,7 @@ static const struct file_operations mwifiex_dfs_##name##_fops = { \
MWIFIEX_DFS_FILE_READ_OPS(info);
MWIFIEX_DFS_FILE_READ_OPS(debug);
MWIFIEX_DFS_FILE_READ_OPS(getlog);
MWIFIEX_DFS_FILE_READ_OPS(fw_dump);
MWIFIEX_DFS_FILE_OPS(regrdwr);
MWIFIEX_DFS_FILE_OPS(rdeeprom);

Expand All @@ -722,6 +746,7 @@ mwifiex_dev_debugfs_init(struct mwifiex_private *priv)
MWIFIEX_DFS_ADD_FILE(getlog);
MWIFIEX_DFS_ADD_FILE(regrdwr);
MWIFIEX_DFS_ADD_FILE(rdeeprom);
MWIFIEX_DFS_ADD_FILE(fw_dump);
}

/*
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/mwifiex/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ struct mwifiex_if_ops {
int (*init_fw_port) (struct mwifiex_adapter *);
int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
void (*card_reset) (struct mwifiex_adapter *);
void (*fw_dump)(struct mwifiex_adapter *);
int (*clean_pcie_ring) (struct mwifiex_adapter *adapter);
};

Expand Down

0 comments on commit 1c09bf6

Please sign in to comment.