aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-08-26 02:11:08 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-29 15:30:27 -0400
commit16db88ba51d669ef63c58990771a47208913152c (patch)
tree9382f559cc8a20bdfaf84be0d47395c82e85d560 /drivers/net/wireless/iwlwifi
parent72012474b01e2f2d433e4253505f5dcfb3345d17 (diff)
iwlagn: move dump_csr and dump_fh to transport layer
These are transport layer related. Move also the corresponding debugfs handlers. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c130
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c44
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.c182
6 files changed, 187 insertions, 178 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index bca5f99377ac..359bd9060560 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -1395,136 +1395,6 @@ u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant, u8 valid)
1395 return ant; 1395 return ant;
1396} 1396}
1397 1397
1398static const char *get_csr_string(int cmd)
1399{
1400 switch (cmd) {
1401 IWL_CMD(CSR_HW_IF_CONFIG_REG);
1402 IWL_CMD(CSR_INT_COALESCING);
1403 IWL_CMD(CSR_INT);
1404 IWL_CMD(CSR_INT_MASK);
1405 IWL_CMD(CSR_FH_INT_STATUS);
1406 IWL_CMD(CSR_GPIO_IN);
1407 IWL_CMD(CSR_RESET);
1408 IWL_CMD(CSR_GP_CNTRL);
1409 IWL_CMD(CSR_HW_REV);
1410 IWL_CMD(CSR_EEPROM_REG);
1411 IWL_CMD(CSR_EEPROM_GP);
1412 IWL_CMD(CSR_OTP_GP_REG);
1413 IWL_CMD(CSR_GIO_REG);
1414 IWL_CMD(CSR_GP_UCODE_REG);
1415 IWL_CMD(CSR_GP_DRIVER_REG);
1416 IWL_CMD(CSR_UCODE_DRV_GP1);
1417 IWL_CMD(CSR_UCODE_DRV_GP2);
1418 IWL_CMD(CSR_LED_REG);
1419 IWL_CMD(CSR_DRAM_INT_TBL_REG);
1420 IWL_CMD(CSR_GIO_CHICKEN_BITS);
1421 IWL_CMD(CSR_ANA_PLL_CFG);
1422 IWL_CMD(CSR_HW_REV_WA_REG);
1423 IWL_CMD(CSR_DBG_HPET_MEM_REG);
1424 default:
1425 return "UNKNOWN";
1426 }
1427}
1428
1429void iwl_dump_csr(struct iwl_priv *priv)
1430{
1431 int i;
1432 static const u32 csr_tbl[] = {
1433 CSR_HW_IF_CONFIG_REG,
1434 CSR_INT_COALESCING,
1435 CSR_INT,
1436 CSR_INT_MASK,
1437 CSR_FH_INT_STATUS,
1438 CSR_GPIO_IN,
1439 CSR_RESET,
1440 CSR_GP_CNTRL,
1441 CSR_HW_REV,
1442 CSR_EEPROM_REG,
1443 CSR_EEPROM_GP,
1444 CSR_OTP_GP_REG,
1445 CSR_GIO_REG,
1446 CSR_GP_UCODE_REG,
1447 CSR_GP_DRIVER_REG,
1448 CSR_UCODE_DRV_GP1,
1449 CSR_UCODE_DRV_GP2,
1450 CSR_LED_REG,
1451 CSR_DRAM_INT_TBL_REG,
1452 CSR_GIO_CHICKEN_BITS,
1453 CSR_ANA_PLL_CFG,
1454 CSR_HW_REV_WA_REG,
1455 CSR_DBG_HPET_MEM_REG
1456 };
1457 IWL_ERR(priv, "CSR values:\n");
1458 IWL_ERR(priv, "(2nd byte of CSR_INT_COALESCING is "
1459 "CSR_INT_PERIODIC_REG)\n");
1460 for (i = 0; i < ARRAY_SIZE(csr_tbl); i++) {
1461 IWL_ERR(priv, " %25s: 0X%08x\n",
1462 get_csr_string(csr_tbl[i]),
1463 iwl_read32(priv, csr_tbl[i]));
1464 }
1465}
1466
1467static const char *get_fh_string(int cmd)
1468{
1469 switch (cmd) {
1470 IWL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG);
1471 IWL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG);
1472 IWL_CMD(FH_RSCSR_CHNL0_WPTR);
1473 IWL_CMD(FH_MEM_RCSR_CHNL0_CONFIG_REG);
1474 IWL_CMD(FH_MEM_RSSR_SHARED_CTRL_REG);
1475 IWL_CMD(FH_MEM_RSSR_RX_STATUS_REG);
1476 IWL_CMD(FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV);
1477 IWL_CMD(FH_TSSR_TX_STATUS_REG);
1478 IWL_CMD(FH_TSSR_TX_ERROR_REG);
1479 default:
1480 return "UNKNOWN";
1481 }
1482}
1483
1484int iwl_dump_fh(struct iwl_priv *priv, char **buf, bool display)
1485{
1486 int i;
1487#ifdef CONFIG_IWLWIFI_DEBUG
1488 int pos = 0;
1489 size_t bufsz = 0;
1490#endif
1491 static const u32 fh_tbl[] = {
1492 FH_RSCSR_CHNL0_STTS_WPTR_REG,
1493 FH_RSCSR_CHNL0_RBDCB_BASE_REG,
1494 FH_RSCSR_CHNL0_WPTR,
1495 FH_MEM_RCSR_CHNL0_CONFIG_REG,
1496 FH_MEM_RSSR_SHARED_CTRL_REG,
1497 FH_MEM_RSSR_RX_STATUS_REG,
1498 FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV,
1499 FH_TSSR_TX_STATUS_REG,
1500 FH_TSSR_TX_ERROR_REG
1501 };
1502#ifdef CONFIG_IWLWIFI_DEBUG
1503 if (display) {
1504 bufsz = ARRAY_SIZE(fh_tbl) * 48 + 40;
1505 *buf = kmalloc(bufsz, GFP_KERNEL);
1506 if (!*buf)
1507 return -ENOMEM;
1508 pos += scnprintf(*buf + pos, bufsz - pos,
1509 "FH register values:\n");
1510 for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) {
1511 pos += scnprintf(*buf + pos, bufsz - pos,
1512 " %34s: 0X%08x\n",
1513 get_fh_string(fh_tbl[i]),
1514 iwl_read_direct32(priv, fh_tbl[i]));
1515 }
1516 return pos;
1517 }
1518#endif
1519 IWL_ERR(priv, "FH register values:\n");
1520 for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) {
1521 IWL_ERR(priv, " %34s: 0X%08x\n",
1522 get_fh_string(fh_tbl[i]),
1523 iwl_read_direct32(priv, fh_tbl[i]));
1524 }
1525 return 0;
1526}
1527
1528/* notification wait support */ 1398/* notification wait support */
1529void iwlagn_init_notification_wait(struct iwl_priv *priv, 1399void iwlagn_init_notification_wait(struct iwl_priv *priv,
1530 struct iwl_notification_wait *wait_entry, 1400 struct iwl_notification_wait *wait_entry,
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index e5b3c356b392..c3bdba5a48f2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -375,8 +375,6 @@ __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
375/***************************************************** 375/*****************************************************
376* Error Handling Debugging 376* Error Handling Debugging
377******************************************************/ 377******************************************************/
378void iwl_dump_csr(struct iwl_priv *priv);
379int iwl_dump_fh(struct iwl_priv *priv, char **buf, bool display);
380#ifdef CONFIG_IWLWIFI_DEBUG 378#ifdef CONFIG_IWLWIFI_DEBUG
381void iwl_print_rx_config_cmd(struct iwl_priv *priv, 379void iwl_print_rx_config_cmd(struct iwl_priv *priv,
382 struct iwl_rxon_context *ctx); 380 struct iwl_rxon_context *ctx);
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 9ca429c23ad1..a12b8d47ccbc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -1991,27 +1991,6 @@ static ssize_t iwl_dbgfs_clear_ucode_statistics_write(struct file *file,
1991 return count; 1991 return count;
1992} 1992}
1993 1993
1994static ssize_t iwl_dbgfs_csr_write(struct file *file,
1995 const char __user *user_buf,
1996 size_t count, loff_t *ppos)
1997{
1998 struct iwl_priv *priv = file->private_data;
1999 char buf[8];
2000 int buf_size;
2001 int csr;
2002
2003 memset(buf, 0, sizeof(buf));
2004 buf_size = min(count, sizeof(buf) - 1);
2005 if (copy_from_user(buf, user_buf, buf_size))
2006 return -EFAULT;
2007 if (sscanf(buf, "%d", &csr) != 1)
2008 return -EFAULT;
2009
2010 iwl_dump_csr(priv);
2011
2012 return count;
2013}
2014
2015static ssize_t iwl_dbgfs_ucode_tracing_read(struct file *file, 1994static ssize_t iwl_dbgfs_ucode_tracing_read(struct file *file,
2016 char __user *user_buf, 1995 char __user *user_buf,
2017 size_t count, loff_t *ppos) { 1996 size_t count, loff_t *ppos) {
@@ -2088,25 +2067,6 @@ static ssize_t iwl_dbgfs_rxon_filter_flags_read(struct file *file,
2088 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 2067 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
2089} 2068}
2090 2069
2091static ssize_t iwl_dbgfs_fh_reg_read(struct file *file,
2092 char __user *user_buf,
2093 size_t count, loff_t *ppos)
2094{
2095 struct iwl_priv *priv = file->private_data;
2096 char *buf;
2097 int pos = 0;
2098 ssize_t ret = -EFAULT;
2099
2100 ret = pos = iwl_dump_fh(priv, &buf, true);
2101 if (buf) {
2102 ret = simple_read_from_buffer(user_buf,
2103 count, ppos, buf, pos);
2104 kfree(buf);
2105 }
2106
2107 return ret;
2108}
2109
2110static ssize_t iwl_dbgfs_missed_beacon_read(struct file *file, 2070static ssize_t iwl_dbgfs_missed_beacon_read(struct file *file,
2111 char __user *user_buf, 2071 char __user *user_buf,
2112 size_t count, loff_t *ppos) { 2072 size_t count, loff_t *ppos) {
@@ -2391,9 +2351,7 @@ DEBUGFS_READ_FILE_OPS(chain_noise);
2391DEBUGFS_READ_FILE_OPS(power_save_status); 2351DEBUGFS_READ_FILE_OPS(power_save_status);
2392DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); 2352DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics);
2393DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); 2353DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics);
2394DEBUGFS_WRITE_FILE_OPS(csr);
2395DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); 2354DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing);
2396DEBUGFS_READ_FILE_OPS(fh_reg);
2397DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); 2355DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon);
2398DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); 2356DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta);
2399DEBUGFS_READ_WRITE_FILE_OPS(force_reset); 2357DEBUGFS_READ_WRITE_FILE_OPS(force_reset);
@@ -2448,8 +2406,6 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
2448 DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); 2406 DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR);
2449 DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); 2407 DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR);
2450 DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); 2408 DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR);
2451 DEBUGFS_ADD_FILE(csr, dir_debug, S_IWUSR);
2452 DEBUGFS_ADD_FILE(fh_reg, dir_debug, S_IRUSR);
2453 DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); 2409 DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR);
2454 DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); 2410 DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR);
2455 DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR); 2411 DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
index b2af467430a9..0e4efb0e189b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
@@ -169,6 +169,9 @@ void iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
169******************************************************/ 169******************************************************/
170int iwl_dump_nic_event_log(struct iwl_priv *priv, 170int iwl_dump_nic_event_log(struct iwl_priv *priv,
171 bool full_log, char **buf, bool display); 171 bool full_log, char **buf, bool display);
172int iwl_dump_fh(struct iwl_trans *trans, char **buf, bool display);
173void iwl_dump_csr(struct iwl_trans *trans);
174
172 175
173static inline void iwl_disable_interrupts(struct iwl_trans *trans) 176static inline void iwl_disable_interrupts(struct iwl_trans *trans)
174{ 177{
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
index b1635eee24b7..0b6c5278e28b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
@@ -655,8 +655,8 @@ static void iwl_irq_handle_error(struct iwl_priv *priv)
655 priv->hw->wiphy->fw_version); 655 priv->hw->wiphy->fw_version);
656 656
657 iwl_dump_nic_error_log(priv); 657 iwl_dump_nic_error_log(priv);
658 iwl_dump_csr(priv); 658 iwl_dump_csr(trans(priv));
659 iwl_dump_fh(priv, NULL, false); 659 iwl_dump_fh(trans(priv), NULL, false);
660 iwl_dump_nic_event_log(priv, false, NULL, false); 660 iwl_dump_nic_event_log(priv, false, NULL, false);
661#ifdef CONFIG_IWLWIFI_DEBUG 661#ifdef CONFIG_IWLWIFI_DEBUG
662 if (iwl_get_debug_level(priv->shrd) & IWL_DL_FW_ERRORS) 662 if (iwl_get_debug_level(priv->shrd) & IWL_DL_FW_ERRORS)
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c
index 73883fe1c2d1..e55636e1deaf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.c
@@ -1324,6 +1324,14 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
1324 .llseek = generic_file_llseek, \ 1324 .llseek = generic_file_llseek, \
1325}; 1325};
1326 1326
1327#define DEBUGFS_WRITE_FILE_OPS(name) \
1328 DEBUGFS_WRITE_FUNC(name); \
1329static const struct file_operations iwl_dbgfs_##name##_ops = { \
1330 .write = iwl_dbgfs_##name##_write, \
1331 .open = iwl_dbgfs_open_file_generic, \
1332 .llseek = generic_file_llseek, \
1333};
1334
1327#define DEBUGFS_READ_WRITE_FILE_OPS(name) \ 1335#define DEBUGFS_READ_WRITE_FILE_OPS(name) \
1328 DEBUGFS_READ_FUNC(name); \ 1336 DEBUGFS_READ_FUNC(name); \
1329 DEBUGFS_WRITE_FUNC(name); \ 1337 DEBUGFS_WRITE_FUNC(name); \
@@ -1635,11 +1643,183 @@ static ssize_t iwl_dbgfs_interrupt_write(struct file *file,
1635 return count; 1643 return count;
1636} 1644}
1637 1645
1646static const char *get_csr_string(int cmd)
1647{
1648 switch (cmd) {
1649 IWL_CMD(CSR_HW_IF_CONFIG_REG);
1650 IWL_CMD(CSR_INT_COALESCING);
1651 IWL_CMD(CSR_INT);
1652 IWL_CMD(CSR_INT_MASK);
1653 IWL_CMD(CSR_FH_INT_STATUS);
1654 IWL_CMD(CSR_GPIO_IN);
1655 IWL_CMD(CSR_RESET);
1656 IWL_CMD(CSR_GP_CNTRL);
1657 IWL_CMD(CSR_HW_REV);
1658 IWL_CMD(CSR_EEPROM_REG);
1659 IWL_CMD(CSR_EEPROM_GP);
1660 IWL_CMD(CSR_OTP_GP_REG);
1661 IWL_CMD(CSR_GIO_REG);
1662 IWL_CMD(CSR_GP_UCODE_REG);
1663 IWL_CMD(CSR_GP_DRIVER_REG);
1664 IWL_CMD(CSR_UCODE_DRV_GP1);
1665 IWL_CMD(CSR_UCODE_DRV_GP2);
1666 IWL_CMD(CSR_LED_REG);
1667 IWL_CMD(CSR_DRAM_INT_TBL_REG);
1668 IWL_CMD(CSR_GIO_CHICKEN_BITS);
1669 IWL_CMD(CSR_ANA_PLL_CFG);
1670 IWL_CMD(CSR_HW_REV_WA_REG);
1671 IWL_CMD(CSR_DBG_HPET_MEM_REG);
1672 default:
1673 return "UNKNOWN";
1674 }
1675}
1676
1677void iwl_dump_csr(struct iwl_trans *trans)
1678{
1679 int i;
1680 static const u32 csr_tbl[] = {
1681 CSR_HW_IF_CONFIG_REG,
1682 CSR_INT_COALESCING,
1683 CSR_INT,
1684 CSR_INT_MASK,
1685 CSR_FH_INT_STATUS,
1686 CSR_GPIO_IN,
1687 CSR_RESET,
1688 CSR_GP_CNTRL,
1689 CSR_HW_REV,
1690 CSR_EEPROM_REG,
1691 CSR_EEPROM_GP,
1692 CSR_OTP_GP_REG,
1693 CSR_GIO_REG,
1694 CSR_GP_UCODE_REG,
1695 CSR_GP_DRIVER_REG,
1696 CSR_UCODE_DRV_GP1,
1697 CSR_UCODE_DRV_GP2,
1698 CSR_LED_REG,
1699 CSR_DRAM_INT_TBL_REG,
1700 CSR_GIO_CHICKEN_BITS,
1701 CSR_ANA_PLL_CFG,
1702 CSR_HW_REV_WA_REG,
1703 CSR_DBG_HPET_MEM_REG
1704 };
1705 IWL_ERR(trans, "CSR values:\n");
1706 IWL_ERR(trans, "(2nd byte of CSR_INT_COALESCING is "
1707 "CSR_INT_PERIODIC_REG)\n");
1708 for (i = 0; i < ARRAY_SIZE(csr_tbl); i++) {
1709 IWL_ERR(trans, " %25s: 0X%08x\n",
1710 get_csr_string(csr_tbl[i]),
1711 iwl_read32(priv(trans), csr_tbl[i]));
1712 }
1713}
1714
1715static ssize_t iwl_dbgfs_csr_write(struct file *file,
1716 const char __user *user_buf,
1717 size_t count, loff_t *ppos)
1718{
1719 struct iwl_trans *trans = file->private_data;
1720 char buf[8];
1721 int buf_size;
1722 int csr;
1723
1724 memset(buf, 0, sizeof(buf));
1725 buf_size = min(count, sizeof(buf) - 1);
1726 if (copy_from_user(buf, user_buf, buf_size))
1727 return -EFAULT;
1728 if (sscanf(buf, "%d", &csr) != 1)
1729 return -EFAULT;
1730
1731 iwl_dump_csr(trans);
1732
1733 return count;
1734}
1735
1736static const char *get_fh_string(int cmd)
1737{
1738 switch (cmd) {
1739 IWL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG);
1740 IWL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG);
1741 IWL_CMD(FH_RSCSR_CHNL0_WPTR);
1742 IWL_CMD(FH_MEM_RCSR_CHNL0_CONFIG_REG);
1743 IWL_CMD(FH_MEM_RSSR_SHARED_CTRL_REG);
1744 IWL_CMD(FH_MEM_RSSR_RX_STATUS_REG);
1745 IWL_CMD(FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV);
1746 IWL_CMD(FH_TSSR_TX_STATUS_REG);
1747 IWL_CMD(FH_TSSR_TX_ERROR_REG);
1748 default:
1749 return "UNKNOWN";
1750 }
1751}
1752
1753int iwl_dump_fh(struct iwl_trans *trans, char **buf, bool display)
1754{
1755 int i;
1756#ifdef CONFIG_IWLWIFI_DEBUG
1757 int pos = 0;
1758 size_t bufsz = 0;
1759#endif
1760 static const u32 fh_tbl[] = {
1761 FH_RSCSR_CHNL0_STTS_WPTR_REG,
1762 FH_RSCSR_CHNL0_RBDCB_BASE_REG,
1763 FH_RSCSR_CHNL0_WPTR,
1764 FH_MEM_RCSR_CHNL0_CONFIG_REG,
1765 FH_MEM_RSSR_SHARED_CTRL_REG,
1766 FH_MEM_RSSR_RX_STATUS_REG,
1767 FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV,
1768 FH_TSSR_TX_STATUS_REG,
1769 FH_TSSR_TX_ERROR_REG
1770 };
1771#ifdef CONFIG_IWLWIFI_DEBUG
1772 if (display) {
1773 bufsz = ARRAY_SIZE(fh_tbl) * 48 + 40;
1774 *buf = kmalloc(bufsz, GFP_KERNEL);
1775 if (!*buf)
1776 return -ENOMEM;
1777 pos += scnprintf(*buf + pos, bufsz - pos,
1778 "FH register values:\n");
1779 for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) {
1780 pos += scnprintf(*buf + pos, bufsz - pos,
1781 " %34s: 0X%08x\n",
1782 get_fh_string(fh_tbl[i]),
1783 iwl_read_direct32(priv(trans), fh_tbl[i]));
1784 }
1785 return pos;
1786 }
1787#endif
1788 IWL_ERR(trans, "FH register values:\n");
1789 for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) {
1790 IWL_ERR(trans, " %34s: 0X%08x\n",
1791 get_fh_string(fh_tbl[i]),
1792 iwl_read_direct32(priv(trans), fh_tbl[i]));
1793 }
1794 return 0;
1795}
1796
1797static ssize_t iwl_dbgfs_fh_reg_read(struct file *file,
1798 char __user *user_buf,
1799 size_t count, loff_t *ppos)
1800{
1801 struct iwl_trans *trans = file->private_data;
1802 char *buf;
1803 int pos = 0;
1804 ssize_t ret = -EFAULT;
1805
1806 ret = pos = iwl_dump_fh(trans, &buf, true);
1807 if (buf) {
1808 ret = simple_read_from_buffer(user_buf,
1809 count, ppos, buf, pos);
1810 kfree(buf);
1811 }
1812
1813 return ret;
1814}
1815
1638DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); 1816DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);
1639DEBUGFS_READ_WRITE_FILE_OPS(log_event); 1817DEBUGFS_READ_WRITE_FILE_OPS(log_event);
1640DEBUGFS_READ_WRITE_FILE_OPS(interrupt); 1818DEBUGFS_READ_WRITE_FILE_OPS(interrupt);
1819DEBUGFS_READ_FILE_OPS(fh_reg);
1641DEBUGFS_READ_FILE_OPS(rx_queue); 1820DEBUGFS_READ_FILE_OPS(rx_queue);
1642DEBUGFS_READ_FILE_OPS(tx_queue); 1821DEBUGFS_READ_FILE_OPS(tx_queue);
1822DEBUGFS_WRITE_FILE_OPS(csr);
1643 1823
1644/* 1824/*
1645 * Create the debugfs files and directories 1825 * Create the debugfs files and directories
@@ -1653,6 +1833,8 @@ static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans,
1653 DEBUGFS_ADD_FILE(tx_queue, dir, S_IRUSR); 1833 DEBUGFS_ADD_FILE(tx_queue, dir, S_IRUSR);
1654 DEBUGFS_ADD_FILE(log_event, dir, S_IWUSR | S_IRUSR); 1834 DEBUGFS_ADD_FILE(log_event, dir, S_IWUSR | S_IRUSR);
1655 DEBUGFS_ADD_FILE(interrupt, dir, S_IWUSR | S_IRUSR); 1835 DEBUGFS_ADD_FILE(interrupt, dir, S_IWUSR | S_IRUSR);
1836 DEBUGFS_ADD_FILE(csr, dir, S_IWUSR);
1837 DEBUGFS_ADD_FILE(fh_reg, dir, S_IRUSR);
1656 return 0; 1838 return 0;
1657} 1839}
1658#else 1840#else