aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c76
1 files changed, 62 insertions, 14 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 927131192572..9b04b25f0e57 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1696,8 +1696,6 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv)
1696 1696
1697} 1697}
1698 1698
1699#ifdef CONFIG_IWLWIFI_DEBUG
1700
1701#define EVENT_START_OFFSET (4 * sizeof(u32)) 1699#define EVENT_START_OFFSET (4 * sizeof(u32))
1702 1700
1703/** 1701/**
@@ -1758,10 +1756,42 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
1758 spin_unlock_irqrestore(&priv->reg_lock, reg_flags); 1756 spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
1759} 1757}
1760 1758
1759/**
1760 * iwl_print_last_event_logs - Dump the newest # of event log to syslog
1761 */
1762static void iwl_print_last_event_logs(struct iwl_priv *priv, u32 capacity,
1763 u32 num_wraps, u32 next_entry,
1764 u32 size, u32 mode)
1765{
1766 /*
1767 * display the newest DEFAULT_LOG_ENTRIES entries
1768 * i.e the entries just before the next ont that uCode would fill.
1769 */
1770 if (num_wraps) {
1771 if (next_entry < size) {
1772 iwl_print_event_log(priv,
1773 capacity - (size - next_entry),
1774 size - next_entry, mode);
1775 iwl_print_event_log(priv, 0,
1776 next_entry, mode);
1777 } else
1778 iwl_print_event_log(priv, next_entry - size,
1779 size, mode);
1780 } else {
1781 if (next_entry < size)
1782 iwl_print_event_log(priv, 0, next_entry, mode);
1783 else
1784 iwl_print_event_log(priv, next_entry - size,
1785 size, mode);
1786 }
1787}
1788
1761/* For sanity check only. Actual size is determined by uCode, typ. 512 */ 1789/* For sanity check only. Actual size is determined by uCode, typ. 512 */
1762#define MAX_EVENT_LOG_SIZE (512) 1790#define MAX_EVENT_LOG_SIZE (512)
1763 1791
1764void iwl_dump_nic_event_log(struct iwl_priv *priv) 1792#define DEFAULT_DUMP_EVENT_LOG_ENTRIES (20)
1793
1794void iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log)
1765{ 1795{
1766 u32 base; /* SRAM byte address of event log header */ 1796 u32 base; /* SRAM byte address of event log header */
1767 u32 capacity; /* event log capacity in # entries */ 1797 u32 capacity; /* event log capacity in # entries */
@@ -1806,19 +1836,37 @@ void iwl_dump_nic_event_log(struct iwl_priv *priv)
1806 return; 1836 return;
1807 } 1837 }
1808 1838
1809 IWL_ERR(priv, "Start IWL Event Log Dump: display count %d, wraps %d\n", 1839#ifdef CONFIG_IWLWIFI_DEBUG
1810 size, num_wraps); 1840 if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS))
1811 1841 size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
1812 /* if uCode has wrapped back to top of log, start at the oldest entry, 1842 ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
1813 * i.e the next one that uCode would fill. */ 1843#else
1814 if (num_wraps) 1844 size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
1815 iwl_print_event_log(priv, next_entry, 1845 ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
1816 capacity - next_entry, mode); 1846#endif
1817 /* (then/else) start at top of log */ 1847 IWL_ERR(priv, "Start IWL Event Log Dump: display last %u entries\n",
1818 iwl_print_event_log(priv, 0, next_entry, mode); 1848 size);
1819 1849
1820} 1850#ifdef CONFIG_IWLWIFI_DEBUG
1851 if ((iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) || full_log) {
1852 /*
1853 * if uCode has wrapped back to top of log,
1854 * start at the oldest entry,
1855 * i.e the next one that uCode would fill.
1856 */
1857 if (num_wraps)
1858 iwl_print_event_log(priv, next_entry,
1859 capacity - next_entry, mode);
1860 /* (then/else) start at top of log */
1861 iwl_print_event_log(priv, 0, next_entry, mode);
1862 } else
1863 iwl_print_last_event_logs(priv, capacity, num_wraps,
1864 next_entry, size, mode);
1865#else
1866 iwl_print_last_event_logs(priv, capacity, num_wraps,
1867 next_entry, size, mode);
1821#endif 1868#endif
1869}
1822 1870
1823/** 1871/**
1824 * iwl_alive_start - called after REPLY_ALIVE notification received 1872 * iwl_alive_start - called after REPLY_ALIVE notification received