aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl4965-base.c
diff options
context:
space:
mode:
authorEster Kummer <ester.kummer@intel.com>2008-05-15 01:54:18 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-21 21:48:07 -0400
commit189a2b5942d62bd18e1e01772c4c784253f5dd16 (patch)
treed5f85b77bccc796651d73243db76aa717d1f309c /drivers/net/wireless/iwlwifi/iwl4965-base.c
parent6ba879562289bcad537a2374754ef750307c7d32 (diff)
iwlwifi: trigger event log from debugfs
This patch adds a trigger for event log printing to debugfs. It removes the triger from sysfs. Signed-off-by: Ester Kummer <ester.kummer@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c114
1 files changed, 1 insertions, 113 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 05edde178302..48c59cbefb4a 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -2692,103 +2692,6 @@ static void iwl4965_dump_nic_error_log(struct iwl_priv *priv)
2692 iwl_release_nic_access(priv); 2692 iwl_release_nic_access(priv);
2693} 2693}
2694 2694
2695#define EVENT_START_OFFSET (4 * sizeof(u32))
2696
2697/**
2698 * iwl4965_print_event_log - Dump error event log to syslog
2699 *
2700 * NOTE: Must be called with iwl_grab_nic_access() already obtained!
2701 */
2702static void iwl4965_print_event_log(struct iwl_priv *priv, u32 start_idx,
2703 u32 num_events, u32 mode)
2704{
2705 u32 i;
2706 u32 base; /* SRAM byte address of event log header */
2707 u32 event_size; /* 2 u32s, or 3 u32s if timestamp recorded */
2708 u32 ptr; /* SRAM byte address of log data */
2709 u32 ev, time, data; /* event log data */
2710
2711 if (num_events == 0)
2712 return;
2713
2714 base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
2715
2716 if (mode == 0)
2717 event_size = 2 * sizeof(u32);
2718 else
2719 event_size = 3 * sizeof(u32);
2720
2721 ptr = base + EVENT_START_OFFSET + (start_idx * event_size);
2722
2723 /* "time" is actually "data" for mode 0 (no timestamp).
2724 * place event id # at far right for easier visual parsing. */
2725 for (i = 0; i < num_events; i++) {
2726 ev = iwl_read_targ_mem(priv, ptr);
2727 ptr += sizeof(u32);
2728 time = iwl_read_targ_mem(priv, ptr);
2729 ptr += sizeof(u32);
2730 if (mode == 0)
2731 IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */
2732 else {
2733 data = iwl_read_targ_mem(priv, ptr);
2734 ptr += sizeof(u32);
2735 IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev);
2736 }
2737 }
2738}
2739
2740static void iwl4965_dump_nic_event_log(struct iwl_priv *priv)
2741{
2742 int rc;
2743 u32 base; /* SRAM byte address of event log header */
2744 u32 capacity; /* event log capacity in # entries */
2745 u32 mode; /* 0 - no timestamp, 1 - timestamp recorded */
2746 u32 num_wraps; /* # times uCode wrapped to top of log */
2747 u32 next_entry; /* index of next entry to be written by uCode */
2748 u32 size; /* # entries that we'll print */
2749
2750 base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
2751 if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
2752 IWL_ERROR("Invalid event log pointer 0x%08X\n", base);
2753 return;
2754 }
2755
2756 rc = iwl_grab_nic_access(priv);
2757 if (rc) {
2758 IWL_WARNING("Can not read from adapter at this time.\n");
2759 return;
2760 }
2761
2762 /* event log header */
2763 capacity = iwl_read_targ_mem(priv, base);
2764 mode = iwl_read_targ_mem(priv, base + (1 * sizeof(u32)));
2765 num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32)));
2766 next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32)));
2767
2768 size = num_wraps ? capacity : next_entry;
2769
2770 /* bail out if nothing in log */
2771 if (size == 0) {
2772 IWL_ERROR("Start IWL Event Log Dump: nothing in log\n");
2773 iwl_release_nic_access(priv);
2774 return;
2775 }
2776
2777 IWL_ERROR("Start IWL Event Log Dump: display count %d, wraps %d\n",
2778 size, num_wraps);
2779
2780 /* if uCode has wrapped back to top of log, start at the oldest entry,
2781 * i.e the next one that uCode would fill. */
2782 if (num_wraps)
2783 iwl4965_print_event_log(priv, next_entry,
2784 capacity - next_entry, mode);
2785
2786 /* (then/else) start at top of log */
2787 iwl4965_print_event_log(priv, 0, next_entry, mode);
2788
2789 iwl_release_nic_access(priv);
2790}
2791
2792/** 2695/**
2793 * iwl4965_irq_handle_error - called for HW or SW error interrupt from card 2696 * iwl4965_irq_handle_error - called for HW or SW error interrupt from card
2794 */ 2697 */
@@ -2803,7 +2706,7 @@ static void iwl4965_irq_handle_error(struct iwl_priv *priv)
2803#ifdef CONFIG_IWLWIFI_DEBUG 2706#ifdef CONFIG_IWLWIFI_DEBUG
2804 if (priv->debug_level & IWL_DL_FW_ERRORS) { 2707 if (priv->debug_level & IWL_DL_FW_ERRORS) {
2805 iwl4965_dump_nic_error_log(priv); 2708 iwl4965_dump_nic_error_log(priv);
2806 iwl4965_dump_nic_event_log(priv); 2709 iwl_dump_nic_event_log(priv);
2807 iwl4965_print_rx_config_cmd(priv); 2710 iwl4965_print_rx_config_cmd(priv);
2808 } 2711 }
2809#endif 2712#endif
@@ -5640,20 +5543,6 @@ static ssize_t dump_error_log(struct device *d,
5640 5543
5641static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, dump_error_log); 5544static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, dump_error_log);
5642 5545
5643static ssize_t dump_event_log(struct device *d,
5644 struct device_attribute *attr,
5645 const char *buf, size_t count)
5646{
5647 char *p = (char *)buf;
5648
5649 if (p[0] == '1')
5650 iwl4965_dump_nic_event_log((struct iwl_priv *)d->driver_data);
5651
5652 return strnlen(buf, count);
5653}
5654
5655static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log);
5656
5657/***************************************************************************** 5546/*****************************************************************************
5658 * 5547 *
5659 * driver setup and teardown 5548 * driver setup and teardown
@@ -5700,7 +5589,6 @@ static void iwl4965_cancel_deferred_work(struct iwl_priv *priv)
5700static struct attribute *iwl4965_sysfs_entries[] = { 5589static struct attribute *iwl4965_sysfs_entries[] = {
5701 &dev_attr_channels.attr, 5590 &dev_attr_channels.attr,
5702 &dev_attr_dump_errors.attr, 5591 &dev_attr_dump_errors.attr,
5703 &dev_attr_dump_events.attr,
5704 &dev_attr_flags.attr, 5592 &dev_attr_flags.attr,
5705 &dev_attr_filter_flags.attr, 5593 &dev_attr_filter_flags.attr,
5706#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 5594#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT