iwlwifi: mvm: dump NVM from debugfs
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Mon, 18 Nov 2013 15:00:03 +0000 (17:00 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Mon, 9 Dec 2013 20:29:45 +0000 (22:29 +0200)
This allows to see the content of the NVM the driver reads.
Note that the output is in binary, and requires some
external user space tool to display the data properly.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/mvm/debugfs.c
drivers/net/wireless/iwlwifi/mvm/mvm.h
drivers/net/wireless/iwlwifi/mvm/nvm.c

index 931723a..e8f62a6 100644 (file)
@@ -720,6 +720,19 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
                goto err;
 #endif
 
+       if (!debugfs_create_blob("nvm_hw", S_IRUSR,
+                                 mvm->debugfs_dir, &mvm->nvm_hw_blob))
+               goto err;
+       if (!debugfs_create_blob("nvm_sw", S_IRUSR,
+                                 mvm->debugfs_dir, &mvm->nvm_sw_blob))
+               goto err;
+       if (!debugfs_create_blob("nvm_calib", S_IRUSR,
+                                 mvm->debugfs_dir, &mvm->nvm_calib_blob))
+               goto err;
+       if (!debugfs_create_blob("nvm_prod", S_IRUSR,
+                                 mvm->debugfs_dir, &mvm->nvm_prod_blob))
+               goto err;
+
        /*
         * Create a symlink with mac80211. It will be removed when mac80211
         * exists (before the opmode exists which removes the target.)
index e7c97cc..7dc57cf 100644 (file)
@@ -494,6 +494,11 @@ struct iwl_mvm {
        u32 dbgfs_sram_offset, dbgfs_sram_len;
        bool disable_power_off;
        bool disable_power_off_d3;
+
+       struct debugfs_blob_wrapper nvm_hw_blob;
+       struct debugfs_blob_wrapper nvm_sw_blob;
+       struct debugfs_blob_wrapper nvm_calib_blob;
+       struct debugfs_blob_wrapper nvm_prod_blob;
 #endif
 
        struct iwl_mvm_phy_ctxt phy_ctxts[NUM_PHY_CTX];
index 2beffd0..48089b1 100644 (file)
@@ -443,6 +443,29 @@ int iwl_nvm_init(struct iwl_mvm *mvm)
                        }
                        mvm->nvm_sections[section].data = temp;
                        mvm->nvm_sections[section].length = ret;
+
+#ifdef CONFIG_IWLWIFI_DEBUGFS
+                       switch (section) {
+                       case NVM_SECTION_TYPE_HW:
+                               mvm->nvm_hw_blob.data = temp;
+                               mvm->nvm_hw_blob.size = ret;
+                               break;
+                       case NVM_SECTION_TYPE_SW:
+                               mvm->nvm_sw_blob.data = temp;
+                               mvm->nvm_sw_blob.size  = ret;
+                               break;
+                       case NVM_SECTION_TYPE_CALIBRATION:
+                               mvm->nvm_calib_blob.data = temp;
+                               mvm->nvm_calib_blob.size  = ret;
+                               break;
+                       case NVM_SECTION_TYPE_PRODUCTION:
+                               mvm->nvm_prod_blob.data = temp;
+                               mvm->nvm_prod_blob.size  = ret;
+                               break;
+                       default:
+                               WARN(1, "section: %d", section);
+                       }
+#endif
                }
                kfree(nvm_buffer);
                if (ret < 0)