diff options
author | Ester Kummer <ester.kummer@intel.com> | 2008-05-29 04:34:46 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-03 15:00:17 -0400 |
commit | ede0cba45f2caf47715d105f6acc1086f4112a7a (patch) | |
tree | b5ea2c0ba7c499ec34fb7c1b9da0907983263e4d /drivers | |
parent | e623157b8d778a63736b0f41c04acc57c4f61ae0 (diff) |
iwlwifi: move iwl_dump_nic_error_log to iwlcore module
This patch moves the function iwl_dump_nic_error_log to iwlcore.
Remove sysfs entry it cannot be really triggered.
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')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 72 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 87 |
3 files changed, 74 insertions, 86 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 7e25ca45f671..785396fd39a0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -1056,6 +1056,78 @@ int iwl_verify_ucode(struct iwl_priv *priv) | |||
1056 | EXPORT_SYMBOL(iwl_verify_ucode); | 1056 | EXPORT_SYMBOL(iwl_verify_ucode); |
1057 | 1057 | ||
1058 | 1058 | ||
1059 | static const char *desc_lookup(int i) | ||
1060 | { | ||
1061 | switch (i) { | ||
1062 | case 1: | ||
1063 | return "FAIL"; | ||
1064 | case 2: | ||
1065 | return "BAD_PARAM"; | ||
1066 | case 3: | ||
1067 | return "BAD_CHECKSUM"; | ||
1068 | case 4: | ||
1069 | return "NMI_INTERRUPT"; | ||
1070 | case 5: | ||
1071 | return "SYSASSERT"; | ||
1072 | case 6: | ||
1073 | return "FATAL_ERROR"; | ||
1074 | } | ||
1075 | |||
1076 | return "UNKNOWN"; | ||
1077 | } | ||
1078 | |||
1079 | #define ERROR_START_OFFSET (1 * sizeof(u32)) | ||
1080 | #define ERROR_ELEM_SIZE (7 * sizeof(u32)) | ||
1081 | |||
1082 | void iwl_dump_nic_error_log(struct iwl_priv *priv) | ||
1083 | { | ||
1084 | u32 data2, line; | ||
1085 | u32 desc, time, count, base, data1; | ||
1086 | u32 blink1, blink2, ilink1, ilink2; | ||
1087 | int rc; | ||
1088 | |||
1089 | base = le32_to_cpu(priv->card_alive.error_event_table_ptr); | ||
1090 | |||
1091 | if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) { | ||
1092 | IWL_ERROR("Not valid error log pointer 0x%08X\n", base); | ||
1093 | return; | ||
1094 | } | ||
1095 | |||
1096 | rc = iwl_grab_nic_access(priv); | ||
1097 | if (rc) { | ||
1098 | IWL_WARNING("Can not read from adapter at this time.\n"); | ||
1099 | return; | ||
1100 | } | ||
1101 | |||
1102 | count = iwl_read_targ_mem(priv, base); | ||
1103 | |||
1104 | if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { | ||
1105 | IWL_ERROR("Start IWL Error Log Dump:\n"); | ||
1106 | IWL_ERROR("Status: 0x%08lX, count: %d\n", priv->status, count); | ||
1107 | } | ||
1108 | |||
1109 | desc = iwl_read_targ_mem(priv, base + 1 * sizeof(u32)); | ||
1110 | blink1 = iwl_read_targ_mem(priv, base + 3 * sizeof(u32)); | ||
1111 | blink2 = iwl_read_targ_mem(priv, base + 4 * sizeof(u32)); | ||
1112 | ilink1 = iwl_read_targ_mem(priv, base + 5 * sizeof(u32)); | ||
1113 | ilink2 = iwl_read_targ_mem(priv, base + 6 * sizeof(u32)); | ||
1114 | data1 = iwl_read_targ_mem(priv, base + 7 * sizeof(u32)); | ||
1115 | data2 = iwl_read_targ_mem(priv, base + 8 * sizeof(u32)); | ||
1116 | line = iwl_read_targ_mem(priv, base + 9 * sizeof(u32)); | ||
1117 | time = iwl_read_targ_mem(priv, base + 11 * sizeof(u32)); | ||
1118 | |||
1119 | IWL_ERROR("Desc Time " | ||
1120 | "data1 data2 line\n"); | ||
1121 | IWL_ERROR("%-13s (#%d) %010u 0x%08X 0x%08X %u\n", | ||
1122 | desc_lookup(desc), desc, time, data1, data2, line); | ||
1123 | IWL_ERROR("blink1 blink2 ilink1 ilink2\n"); | ||
1124 | IWL_ERROR("0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2, | ||
1125 | ilink1, ilink2); | ||
1126 | |||
1127 | iwl_release_nic_access(priv); | ||
1128 | } | ||
1129 | EXPORT_SYMBOL(iwl_dump_nic_error_log); | ||
1130 | |||
1059 | #define EVENT_START_OFFSET (4 * sizeof(u32)) | 1131 | #define EVENT_START_OFFSET (4 * sizeof(u32)) |
1060 | 1132 | ||
1061 | /** | 1133 | /** |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index ad7422eadab2..9392fcf6cac3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -237,6 +237,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); | |||
237 | ******************************************************/ | 237 | ******************************************************/ |
238 | void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, | 238 | void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, |
239 | u32 num_events, u32 mode); | 239 | u32 num_events, u32 mode); |
240 | void iwl_dump_nic_error_log(struct iwl_priv *priv); | ||
240 | void iwl_dump_nic_event_log(struct iwl_priv *priv); | 241 | void iwl_dump_nic_event_log(struct iwl_priv *priv); |
241 | 242 | ||
242 | /*************** DRIVER STATUS FUNCTIONS *****/ | 243 | /*************** DRIVER STATUS FUNCTIONS *****/ |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 07c52b69d1e2..e9dfb725763e 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -2613,76 +2613,6 @@ static inline void iwl4965_disable_interrupts(struct iwl_priv *priv) | |||
2613 | IWL_DEBUG_ISR("Disabled interrupts\n"); | 2613 | IWL_DEBUG_ISR("Disabled interrupts\n"); |
2614 | } | 2614 | } |
2615 | 2615 | ||
2616 | static const char *desc_lookup(int i) | ||
2617 | { | ||
2618 | switch (i) { | ||
2619 | case 1: | ||
2620 | return "FAIL"; | ||
2621 | case 2: | ||
2622 | return "BAD_PARAM"; | ||
2623 | case 3: | ||
2624 | return "BAD_CHECKSUM"; | ||
2625 | case 4: | ||
2626 | return "NMI_INTERRUPT"; | ||
2627 | case 5: | ||
2628 | return "SYSASSERT"; | ||
2629 | case 6: | ||
2630 | return "FATAL_ERROR"; | ||
2631 | } | ||
2632 | |||
2633 | return "UNKNOWN"; | ||
2634 | } | ||
2635 | |||
2636 | #define ERROR_START_OFFSET (1 * sizeof(u32)) | ||
2637 | #define ERROR_ELEM_SIZE (7 * sizeof(u32)) | ||
2638 | |||
2639 | static void iwl4965_dump_nic_error_log(struct iwl_priv *priv) | ||
2640 | { | ||
2641 | u32 data2, line; | ||
2642 | u32 desc, time, count, base, data1; | ||
2643 | u32 blink1, blink2, ilink1, ilink2; | ||
2644 | int rc; | ||
2645 | |||
2646 | base = le32_to_cpu(priv->card_alive.error_event_table_ptr); | ||
2647 | |||
2648 | if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) { | ||
2649 | IWL_ERROR("Not valid error log pointer 0x%08X\n", base); | ||
2650 | return; | ||
2651 | } | ||
2652 | |||
2653 | rc = iwl_grab_nic_access(priv); | ||
2654 | if (rc) { | ||
2655 | IWL_WARNING("Can not read from adapter at this time.\n"); | ||
2656 | return; | ||
2657 | } | ||
2658 | |||
2659 | count = iwl_read_targ_mem(priv, base); | ||
2660 | |||
2661 | if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { | ||
2662 | IWL_ERROR("Start IWL Error Log Dump:\n"); | ||
2663 | IWL_ERROR("Status: 0x%08lX, count: %d\n", priv->status, count); | ||
2664 | } | ||
2665 | |||
2666 | desc = iwl_read_targ_mem(priv, base + 1 * sizeof(u32)); | ||
2667 | blink1 = iwl_read_targ_mem(priv, base + 3 * sizeof(u32)); | ||
2668 | blink2 = iwl_read_targ_mem(priv, base + 4 * sizeof(u32)); | ||
2669 | ilink1 = iwl_read_targ_mem(priv, base + 5 * sizeof(u32)); | ||
2670 | ilink2 = iwl_read_targ_mem(priv, base + 6 * sizeof(u32)); | ||
2671 | data1 = iwl_read_targ_mem(priv, base + 7 * sizeof(u32)); | ||
2672 | data2 = iwl_read_targ_mem(priv, base + 8 * sizeof(u32)); | ||
2673 | line = iwl_read_targ_mem(priv, base + 9 * sizeof(u32)); | ||
2674 | time = iwl_read_targ_mem(priv, base + 11 * sizeof(u32)); | ||
2675 | |||
2676 | IWL_ERROR("Desc Time " | ||
2677 | "data1 data2 line\n"); | ||
2678 | IWL_ERROR("%-13s (#%d) %010u 0x%08X 0x%08X %u\n", | ||
2679 | desc_lookup(desc), desc, time, data1, data2, line); | ||
2680 | IWL_ERROR("blink1 blink2 ilink1 ilink2\n"); | ||
2681 | IWL_ERROR("0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2, | ||
2682 | ilink1, ilink2); | ||
2683 | |||
2684 | iwl_release_nic_access(priv); | ||
2685 | } | ||
2686 | 2616 | ||
2687 | /** | 2617 | /** |
2688 | * iwl4965_irq_handle_error - called for HW or SW error interrupt from card | 2618 | * iwl4965_irq_handle_error - called for HW or SW error interrupt from card |
@@ -2697,7 +2627,7 @@ static void iwl4965_irq_handle_error(struct iwl_priv *priv) | |||
2697 | 2627 | ||
2698 | #ifdef CONFIG_IWLWIFI_DEBUG | 2628 | #ifdef CONFIG_IWLWIFI_DEBUG |
2699 | if (priv->debug_level & IWL_DL_FW_ERRORS) { | 2629 | if (priv->debug_level & IWL_DL_FW_ERRORS) { |
2700 | iwl4965_dump_nic_error_log(priv); | 2630 | iwl_dump_nic_error_log(priv); |
2701 | iwl_dump_nic_event_log(priv); | 2631 | iwl_dump_nic_event_log(priv); |
2702 | iwl4965_print_rx_config_cmd(priv); | 2632 | iwl4965_print_rx_config_cmd(priv); |
2703 | } | 2633 | } |
@@ -5519,20 +5449,6 @@ static ssize_t show_status(struct device *d, | |||
5519 | 5449 | ||
5520 | static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); | 5450 | static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); |
5521 | 5451 | ||
5522 | static ssize_t dump_error_log(struct device *d, | ||
5523 | struct device_attribute *attr, | ||
5524 | const char *buf, size_t count) | ||
5525 | { | ||
5526 | char *p = (char *)buf; | ||
5527 | |||
5528 | if (p[0] == '1') | ||
5529 | iwl4965_dump_nic_error_log((struct iwl_priv *)d->driver_data); | ||
5530 | |||
5531 | return strnlen(buf, count); | ||
5532 | } | ||
5533 | |||
5534 | static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, dump_error_log); | ||
5535 | |||
5536 | /***************************************************************************** | 5452 | /***************************************************************************** |
5537 | * | 5453 | * |
5538 | * driver setup and teardown | 5454 | * driver setup and teardown |
@@ -5578,7 +5494,6 @@ static void iwl4965_cancel_deferred_work(struct iwl_priv *priv) | |||
5578 | 5494 | ||
5579 | static struct attribute *iwl4965_sysfs_entries[] = { | 5495 | static struct attribute *iwl4965_sysfs_entries[] = { |
5580 | &dev_attr_channels.attr, | 5496 | &dev_attr_channels.attr, |
5581 | &dev_attr_dump_errors.attr, | ||
5582 | &dev_attr_flags.attr, | 5497 | &dev_attr_flags.attr, |
5583 | &dev_attr_filter_flags.attr, | 5498 | &dev_attr_filter_flags.attr, |
5584 | #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT | 5499 | #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT |