|
@@ -109,180 +109,6 @@ void rtl8192_dump_reg(struct net_device *dev)
|
|
|
printk("\n");
|
|
|
}
|
|
|
|
|
|
-#ifdef CONFIG_RTLWIFI_DEBUGFS
|
|
|
-/* debugfs related stuff */
|
|
|
-static struct dentry *rtl_debugfs_root;
|
|
|
-static int rtl_dbgfs_open(struct inode *inode, struct file *file)
|
|
|
-{
|
|
|
- file->private_data = inode->i_private;
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-static ssize_t rtl_dbgfs_register_write(struct file *file,
|
|
|
- const char __user *user_buf,
|
|
|
- size_t count,
|
|
|
- loff_t *ppos)
|
|
|
-{
|
|
|
- struct r8192_priv *priv = (struct r8192_priv *)file->private_data;
|
|
|
- char buf[32];
|
|
|
- int buf_size;
|
|
|
- u32 type, offset;
|
|
|
-
|
|
|
- memset(buf, 0, sizeof(buf));
|
|
|
- buf_size = min(count, sizeof(buf) - 1);
|
|
|
- if (copy_from_user(buf, user_buf, buf_size))
|
|
|
- return -EFAULT;
|
|
|
-
|
|
|
- if (sscanf(buf, "%x,%x", &type, &offset ) == 2) {
|
|
|
- priv->debug->hw_type = type;
|
|
|
- priv->debug->hw_offset = offset;
|
|
|
- } else {
|
|
|
- priv->debug->hw_type = 0;
|
|
|
- priv->debug->hw_offset = 0;
|
|
|
- }
|
|
|
-
|
|
|
- return count;
|
|
|
-}
|
|
|
-
|
|
|
-void rtl_hardware_grab(struct net_device *dev)
|
|
|
-{
|
|
|
- struct r8192_priv *priv = rtllib_priv(dev);
|
|
|
- int t = 0;
|
|
|
- int timeout = 20;
|
|
|
- u32 mask = RF_CHANGE_BY_HW|RF_CHANGE_BY_PS|RF_CHANGE_BY_IPS;
|
|
|
-
|
|
|
- priv->debug->hw_holding = true;
|
|
|
- rtllib_ips_leave_wq(dev);
|
|
|
- do {
|
|
|
- if ((priv->rtllib->RfOffReason & mask)) {
|
|
|
- msleep(100);
|
|
|
- t++;
|
|
|
- } else {
|
|
|
- return;
|
|
|
- }
|
|
|
- } while (t < timeout);
|
|
|
-
|
|
|
- return;
|
|
|
-}
|
|
|
-
|
|
|
-static ssize_t rtl_dbgfs_register_read(struct file *file,
|
|
|
- char __user *user_buf,
|
|
|
- size_t count,
|
|
|
- loff_t *ppos)
|
|
|
-{
|
|
|
- struct r8192_priv *priv = (struct r8192_priv *)file->private_data;
|
|
|
- struct net_device *dev = priv->rtllib->dev;
|
|
|
- ssize_t ret = 0;
|
|
|
- char buf[2048];
|
|
|
- int n,i;
|
|
|
- u32 len = 0;
|
|
|
- u32 max = 0xff;
|
|
|
- u32 page_no, path;
|
|
|
-
|
|
|
- rtl_hardware_grab(dev);
|
|
|
-
|
|
|
- if (!priv->debug->hw_type) {
|
|
|
- page_no = (priv->debug->hw_offset > 0x0f)? 0x0f: priv->debug->hw_offset;
|
|
|
- {
|
|
|
- len += snprintf(buf + len,count - len,
|
|
|
- "\n#################### MAC page- %x##################\n ", page_no);
|
|
|
- for (n=0;n<=max;) {
|
|
|
- len += snprintf(buf + len, count - len, "\nD: %2x > ",n);
|
|
|
- for (i=0;i<16 && n<=max;i++,n++)
|
|
|
- len += snprintf(buf + len, count - len,
|
|
|
- "%2.2x ",read_nic_byte(dev,((page_no<<8)|n)));
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- path = (priv->debug->hw_offset < RF90_PATH_MAX)? priv->debug->hw_offset:(RF90_PATH_MAX - 1);
|
|
|
- len += snprintf(buf + len, count - len,
|
|
|
- "\n#################### RF-PATH-%x ##################\n ", 0x0a+path);
|
|
|
- for (n=0;n<=max;) {
|
|
|
- len += snprintf(buf+ len, count - len, "\nD: %2x > ",n);
|
|
|
- for (i=0;i<4 && n<=max;n+=4,i++)
|
|
|
- len += snprintf(buf + len, count - len,
|
|
|
- "%8.8x ",rtl8192_phy_QueryRFReg(dev, (RF90_RADIO_PATH_E)path,\
|
|
|
- n, bMaskDWord));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- priv->debug->hw_holding = false;
|
|
|
-
|
|
|
- len += snprintf(buf + len, count - len, "\n");
|
|
|
- ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
-static const struct file_operations rtl_register_debug = {
|
|
|
- .read = rtl_dbgfs_register_read,
|
|
|
- .write = rtl_dbgfs_register_write,
|
|
|
- .open = rtl_dbgfs_open,
|
|
|
- .owner = THIS_MODULE
|
|
|
-};
|
|
|
-
|
|
|
-int rtl_debug_module_init(struct r8192_priv *priv, const char *name)
|
|
|
-{
|
|
|
- rtl_fs_debug *debug;
|
|
|
- int ret = 0;
|
|
|
-
|
|
|
- if (!rtl_debugfs_root)
|
|
|
- return -ENOENT;
|
|
|
-
|
|
|
- debug = kzalloc(sizeof(rtl_fs_debug), GFP_KERNEL);
|
|
|
- if (!debug) {
|
|
|
- ret = -ENOMEM;
|
|
|
- goto err;
|
|
|
- }
|
|
|
- priv->debug = debug;
|
|
|
-
|
|
|
- debug->name = name;
|
|
|
- debug->dir_drv = debugfs_create_dir(name, rtl_debugfs_root);
|
|
|
- if (!debug->dir_drv ) {
|
|
|
- ret = -ENOENT;
|
|
|
- goto err;
|
|
|
- }
|
|
|
-
|
|
|
- debug->debug_register = debugfs_create_file("debug_register", S_IRUGO,
|
|
|
- debug->dir_drv, priv, &rtl_register_debug);
|
|
|
- if (!debug->debug_register) {
|
|
|
- ret = -ENOENT;
|
|
|
- goto err;
|
|
|
- }
|
|
|
-
|
|
|
- return 0;
|
|
|
-err:
|
|
|
- RT_TRACE(COMP_DBG, "Can't open the debugfs directory\n");
|
|
|
- rtl_debug_module_remove(priv);
|
|
|
- return ret;
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-void rtl_debug_module_remove(struct r8192_priv *priv)
|
|
|
-{
|
|
|
- if (!priv->debug)
|
|
|
- return;
|
|
|
- debugfs_remove(priv->debug->debug_register);
|
|
|
- debugfs_remove(priv->debug->dir_drv);
|
|
|
- kfree(priv->debug);
|
|
|
- priv->debug = NULL;
|
|
|
-}
|
|
|
-
|
|
|
-int rtl_create_debugfs_root(void)
|
|
|
-{
|
|
|
- rtl_debugfs_root = debugfs_create_dir(DRV_NAME, NULL);
|
|
|
- if (!rtl_debugfs_root)
|
|
|
- return -ENOENT;
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-void rtl_remove_debugfs_root(void)
|
|
|
-{
|
|
|
- debugfs_remove(rtl_debugfs_root);
|
|
|
- rtl_debugfs_root = NULL;
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
/****************************************************************************
|
|
|
-----------------------------PROCFS STUFF-------------------------
|
|
|
*****************************************************************************/
|