iwlegacy: remove firmware event log
[pandora-kernel.git] / drivers / net / wireless / iwlegacy / iwl3945-base.c
index da42442..795826a 100644 (file)
@@ -1409,212 +1409,6 @@ void iwl3945_dump_nic_error_log(struct iwl_priv *priv)
        }
 }
 
-#define EVENT_START_OFFSET  (6 * sizeof(u32))
-
-/**
- * iwl3945_print_event_log - Dump error event log to syslog
- *
- */
-static int iwl3945_print_event_log(struct iwl_priv *priv, u32 start_idx,
-                                 u32 num_events, u32 mode,
-                                 int pos, char **buf, size_t bufsz)
-{
-       u32 i;
-       u32 base;       /* SRAM byte address of event log header */
-       u32 event_size; /* 2 u32s, or 3 u32s if timestamp recorded */
-       u32 ptr;        /* SRAM byte address of log data */
-       u32 ev, time, data; /* event log data */
-       unsigned long reg_flags;
-
-       if (num_events == 0)
-               return pos;
-
-       base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
-
-       if (mode == 0)
-               event_size = 2 * sizeof(u32);
-       else
-               event_size = 3 * sizeof(u32);
-
-       ptr = base + EVENT_START_OFFSET + (start_idx * event_size);
-
-       /* Make sure device is powered up for SRAM reads */
-       spin_lock_irqsave(&priv->reg_lock, reg_flags);
-       iwl_grab_nic_access(priv);
-
-       /* Set starting address; reads will auto-increment */
-       _iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, ptr);
-       rmb();
-
-       /* "time" is actually "data" for mode 0 (no timestamp).
-        * place event id # at far right for easier visual parsing. */
-       for (i = 0; i < num_events; i++) {
-               ev = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT);
-               time = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT);
-               if (mode == 0) {
-                       /* data, ev */
-                       if (bufsz) {
-                               pos += scnprintf(*buf + pos, bufsz - pos,
-                                               "0x%08x:%04u\n",
-                                               time, ev);
-                       } else {
-                               IWL_ERR(priv, "0x%08x\t%04u\n", time, ev);
-                               trace_iwlwifi_legacy_dev_ucode_event(priv, 0,
-                                                             time, ev);
-                       }
-               } else {
-                       data = _iwl_legacy_read_direct32(priv,
-                                                       HBUS_TARG_MEM_RDAT);
-                       if (bufsz) {
-                               pos += scnprintf(*buf + pos, bufsz - pos,
-                                               "%010u:0x%08x:%04u\n",
-                                                time, data, ev);
-                       } else {
-                               IWL_ERR(priv, "%010u\t0x%08x\t%04u\n",
-                                       time, data, ev);
-                               trace_iwlwifi_legacy_dev_ucode_event(priv, time,
-                                                             data, ev);
-                       }
-               }
-       }
-
-       /* Allow device to power down */
-       iwl_release_nic_access(priv);
-       spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
-       return pos;
-}
-
-/**
- * iwl3945_print_last_event_logs - Dump the newest # of event log to syslog
- */
-static int iwl3945_print_last_event_logs(struct iwl_priv *priv, u32 capacity,
-                                     u32 num_wraps, u32 next_entry,
-                                     u32 size, u32 mode,
-                                     int pos, char **buf, size_t bufsz)
-{
-       /*
-        * display the newest DEFAULT_LOG_ENTRIES entries
-        * i.e the entries just before the next ont that uCode would fill.
-        */
-       if (num_wraps) {
-               if (next_entry < size) {
-                       pos = iwl3945_print_event_log(priv,
-                                            capacity - (size - next_entry),
-                                            size - next_entry, mode,
-                                            pos, buf, bufsz);
-                       pos = iwl3945_print_event_log(priv, 0,
-                                                     next_entry, mode,
-                                                     pos, buf, bufsz);
-               } else
-                       pos = iwl3945_print_event_log(priv, next_entry - size,
-                                                     size, mode,
-                                                     pos, buf, bufsz);
-       } else {
-               if (next_entry < size)
-                       pos = iwl3945_print_event_log(priv, 0,
-                                                     next_entry, mode,
-                                                     pos, buf, bufsz);
-               else
-                       pos = iwl3945_print_event_log(priv, next_entry - size,
-                                                     size, mode,
-                                                     pos, buf, bufsz);
-       }
-       return pos;
-}
-
-#define DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES (20)
-
-int iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
-                           char **buf, bool display)
-{
-       u32 base;       /* SRAM byte address of event log header */
-       u32 capacity;   /* event log capacity in # entries */
-       u32 mode;       /* 0 - no timestamp, 1 - timestamp recorded */
-       u32 num_wraps;  /* # times uCode wrapped to top of log */
-       u32 next_entry; /* index of next entry to be written by uCode */
-       u32 size;       /* # entries that we'll print */
-       int pos = 0;
-       size_t bufsz = 0;
-
-       base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
-       if (!iwl3945_hw_valid_rtc_data_addr(base)) {
-               IWL_ERR(priv, "Invalid event log pointer 0x%08X\n", base);
-               return  -EINVAL;
-       }
-
-       /* event log header */
-       capacity = iwl_legacy_read_targ_mem(priv, base);
-       mode = iwl_legacy_read_targ_mem(priv, base + (1 * sizeof(u32)));
-       num_wraps = iwl_legacy_read_targ_mem(priv, base + (2 * sizeof(u32)));
-       next_entry = iwl_legacy_read_targ_mem(priv, base + (3 * sizeof(u32)));
-
-       if (capacity > priv->cfg->base_params->max_event_log_size) {
-               IWL_ERR(priv, "Log capacity %d is bogus, limit to %d entries\n",
-                       capacity, priv->cfg->base_params->max_event_log_size);
-               capacity = priv->cfg->base_params->max_event_log_size;
-       }
-
-       if (next_entry > priv->cfg->base_params->max_event_log_size) {
-               IWL_ERR(priv, "Log write index %d is bogus, limit to %d\n",
-                       next_entry, priv->cfg->base_params->max_event_log_size);
-               next_entry = priv->cfg->base_params->max_event_log_size;
-       }
-
-       size = num_wraps ? capacity : next_entry;
-
-       /* bail out if nothing in log */
-       if (size == 0) {
-               IWL_ERR(priv, "Start IWL Event Log Dump: nothing in log\n");
-               return pos;
-       }
-
-#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
-       if (!(iwl_legacy_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log)
-               size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES)
-                       ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size;
-#else
-       size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES)
-               ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size;
-#endif
-
-       IWL_ERR(priv, "Start IWL Event Log Dump: display last %d count\n",
-                 size);
-
-#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
-       if (display) {
-               if (full_log)
-                       bufsz = capacity * 48;
-               else
-                       bufsz = size * 48;
-               *buf = kmalloc(bufsz, GFP_KERNEL);
-               if (!*buf)
-                       return -ENOMEM;
-       }
-       if ((iwl_legacy_get_debug_level(priv) & IWL_DL_FW_ERRORS) || full_log) {
-               /* if uCode has wrapped back to top of log,
-                * start at the oldest entry,
-                * i.e the next one that uCode would fill.
-                */
-               if (num_wraps)
-                       pos = iwl3945_print_event_log(priv, next_entry,
-                                               capacity - next_entry, mode,
-                                               pos, buf, bufsz);
-
-               /* (then/else) start at top of log */
-               pos = iwl3945_print_event_log(priv, 0, next_entry, mode,
-                                             pos, buf, bufsz);
-       } else
-               pos = iwl3945_print_last_event_logs(priv, capacity, num_wraps,
-                                                   next_entry, size, mode,
-                                                   pos, buf, bufsz);
-#else
-       pos = iwl3945_print_last_event_logs(priv, capacity, num_wraps,
-                                           next_entry, size, mode,
-                                           pos, buf, bufsz);
-#endif
-       return pos;
-}
-
 static void iwl3945_irq_tasklet(struct iwl_priv *priv)
 {
        u32 inta, handled = 0;