diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-05-04 22:22:32 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-14 16:29:42 -0400 |
commit | 8dd266ef4eb51d034fa1c5f9307a9ff07547d8e6 (patch) | |
tree | ca9097eca519737450c518a62b81b5fcd6c91ef7 /drivers/net/wireless/iwlwifi/iwl-debugfs.c | |
parent | 6def9761f72501e638e79eebcd70afea12a3a93d (diff) |
iwlwifi: debugfs EEPROM dump
This patch adds EEPROM dump in debugfs.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 37b52e63739b..ad25806dfaf1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -277,8 +277,48 @@ static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf, | |||
277 | return ret; | 277 | return ret; |
278 | } | 278 | } |
279 | 279 | ||
280 | static ssize_t iwl_dbgfs_eeprom_read(struct file *file, | ||
281 | char __user *user_buf, | ||
282 | size_t count, | ||
283 | loff_t *ppos) | ||
284 | { | ||
285 | ssize_t ret; | ||
286 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | ||
287 | int pos = 0, ofs = 0, buf_size = 0; | ||
288 | const u8 *ptr; | ||
289 | char *buf; | ||
290 | size_t eeprom_len = priv->cfg->eeprom_size; | ||
291 | buf_size = 4 * eeprom_len + 256; | ||
292 | |||
293 | if (eeprom_len % 16) { | ||
294 | IWL_ERROR("EEPROM size is not multiple of 16.\n"); | ||
295 | return -ENODATA; | ||
296 | } | ||
297 | |||
298 | /* 4 characters for byte 0xYY */ | ||
299 | buf = kzalloc(buf_size, GFP_KERNEL); | ||
300 | if (!buf) { | ||
301 | IWL_ERROR("Can not allocate Buffer\n"); | ||
302 | return -ENOMEM; | ||
303 | } | ||
304 | |||
305 | ptr = priv->eeprom; | ||
306 | for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { | ||
307 | pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs); | ||
308 | hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos, | ||
309 | buf_size - pos, 0); | ||
310 | pos += strlen(buf); | ||
311 | if (buf_size - pos > 0) | ||
312 | buf[pos++] = '\n'; | ||
313 | } | ||
314 | |||
315 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
316 | kfree(buf); | ||
317 | return ret; | ||
318 | } | ||
280 | 319 | ||
281 | DEBUGFS_READ_WRITE_FILE_OPS(sram); | 320 | DEBUGFS_READ_WRITE_FILE_OPS(sram); |
321 | DEBUGFS_READ_FILE_OPS(eeprom); | ||
282 | DEBUGFS_READ_FILE_OPS(stations); | 322 | DEBUGFS_READ_FILE_OPS(stations); |
283 | DEBUGFS_READ_FILE_OPS(rx_statistics); | 323 | DEBUGFS_READ_FILE_OPS(rx_statistics); |
284 | DEBUGFS_READ_FILE_OPS(tx_statistics); | 324 | DEBUGFS_READ_FILE_OPS(tx_statistics); |
@@ -304,6 +344,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
304 | } | 344 | } |
305 | 345 | ||
306 | DEBUGFS_ADD_DIR(data, dbgfs->dir_drv); | 346 | DEBUGFS_ADD_DIR(data, dbgfs->dir_drv); |
347 | DEBUGFS_ADD_FILE(eeprom, data); | ||
307 | DEBUGFS_ADD_FILE(sram, data); | 348 | DEBUGFS_ADD_FILE(sram, data); |
308 | DEBUGFS_ADD_FILE(stations, data); | 349 | DEBUGFS_ADD_FILE(stations, data); |
309 | DEBUGFS_ADD_FILE(rx_statistics, data); | 350 | DEBUGFS_ADD_FILE(rx_statistics, data); |
@@ -327,6 +368,7 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
327 | if (!(priv->dbgfs)) | 368 | if (!(priv->dbgfs)) |
328 | return; | 369 | return; |
329 | 370 | ||
371 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_eeprom); | ||
330 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_rx_statistics); | 372 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_rx_statistics); |
331 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_tx_statistics); | 373 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_tx_statistics); |
332 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sram); | 374 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sram); |