]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/wireless/iwlwifi/iwl4965-base.c
iwlwifi: trigger event log from debugfs
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / iwlwifi / iwl4965-base.c
index e06142d9da594b90c679f5bf623666e77d20c95b..48c59cbefb4a0c831aad6dcd2577c6d91e0b2a75 100644 (file)
@@ -2692,103 +2692,6 @@ static void iwl4965_dump_nic_error_log(struct iwl_priv *priv)
        iwl_release_nic_access(priv);
 }
 
-#define EVENT_START_OFFSET  (4 * sizeof(u32))
-
-/**
- * iwl4965_print_event_log - Dump error event log to syslog
- *
- * NOTE: Must be called with iwl_grab_nic_access() already obtained!
- */
-static void iwl4965_print_event_log(struct iwl_priv *priv, u32 start_idx,
-                               u32 num_events, u32 mode)
-{
-       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 */
-
-       if (num_events == 0)
-               return;
-
-       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);
-
-       /* "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_read_targ_mem(priv, ptr);
-               ptr += sizeof(u32);
-               time = iwl_read_targ_mem(priv, ptr);
-               ptr += sizeof(u32);
-               if (mode == 0)
-                       IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */
-               else {
-                       data = iwl_read_targ_mem(priv, ptr);
-                       ptr += sizeof(u32);
-                       IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev);
-               }
-       }
-}
-
-static void iwl4965_dump_nic_event_log(struct iwl_priv *priv)
-{
-       int rc;
-       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 */
-
-       base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
-       if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
-               IWL_ERROR("Invalid event log pointer 0x%08X\n", base);
-               return;
-       }
-
-       rc = iwl_grab_nic_access(priv);
-       if (rc) {
-               IWL_WARNING("Can not read from adapter at this time.\n");
-               return;
-       }
-
-       /* event log header */
-       capacity = iwl_read_targ_mem(priv, base);
-       mode = iwl_read_targ_mem(priv, base + (1 * sizeof(u32)));
-       num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32)));
-       next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32)));
-
-       size = num_wraps ? capacity : next_entry;
-
-       /* bail out if nothing in log */
-       if (size == 0) {
-               IWL_ERROR("Start IWL Event Log Dump: nothing in log\n");
-               iwl_release_nic_access(priv);
-               return;
-       }
-
-       IWL_ERROR("Start IWL Event Log Dump: display count %d, wraps %d\n",
-                 size, num_wraps);
-
-       /* 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)
-               iwl4965_print_event_log(priv, next_entry,
-                                   capacity - next_entry, mode);
-
-       /* (then/else) start at top of log */
-       iwl4965_print_event_log(priv, 0, next_entry, mode);
-
-       iwl_release_nic_access(priv);
-}
-
 /**
  * iwl4965_irq_handle_error - called for HW or SW error interrupt from card
  */
@@ -2803,7 +2706,7 @@ static void iwl4965_irq_handle_error(struct iwl_priv *priv)
 #ifdef CONFIG_IWLWIFI_DEBUG
        if (priv->debug_level & IWL_DL_FW_ERRORS) {
                iwl4965_dump_nic_error_log(priv);
-               iwl4965_dump_nic_event_log(priv);
+               iwl_dump_nic_event_log(priv);
                iwl4965_print_rx_config_cmd(priv);
        }
 #endif
@@ -5640,20 +5543,6 @@ static ssize_t dump_error_log(struct device *d,
 
 static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, dump_error_log);
 
-static ssize_t dump_event_log(struct device *d,
-                             struct device_attribute *attr,
-                             const char *buf, size_t count)
-{
-       char *p = (char *)buf;
-
-       if (p[0] == '1')
-               iwl4965_dump_nic_event_log((struct iwl_priv *)d->driver_data);
-
-       return strnlen(buf, count);
-}
-
-static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log);
-
 /*****************************************************************************
  *
  * driver setup and teardown
@@ -5700,7 +5589,6 @@ static void iwl4965_cancel_deferred_work(struct iwl_priv *priv)
 static struct attribute *iwl4965_sysfs_entries[] = {
        &dev_attr_channels.attr,
        &dev_attr_dump_errors.attr,
-       &dev_attr_dump_events.attr,
        &dev_attr_flags.attr,
        &dev_attr_filter_flags.attr,
 #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
@@ -5878,10 +5766,10 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
        }
 
        /*******************
-        * 6. Setup hw/priv
+        * 6. Setup priv
         *******************/
 
-       err = iwl_setup(priv);
+       err = iwl_init_drv(priv);
        if (err)
                goto out_free_eeprom;
        /* At this point both hw and priv are initialized. */
@@ -5896,9 +5784,6 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
                IWL_DEBUG_INFO("Radio disabled.\n");
        }
 
-       if (priv->cfg->mod_params->enable_qos)
-               priv->qos_data.qos_enable = 1;
-
        /********************
         * 8. Setup services
         ********************/
@@ -5909,14 +5794,9 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
        err = sysfs_create_group(&pdev->dev.kobj, &iwl4965_attribute_group);
        if (err) {
                IWL_ERROR("failed to create sysfs device attributes\n");
-               goto out_free_eeprom;
+               goto out_uninit_drv;
        }
 
-       err = iwl_dbgfs_register(priv, DRV_NAME);
-       if (err) {
-               IWL_ERROR("failed to create debugfs files\n");
-               goto out_remove_sysfs;
-       }
 
        iwl4965_setup_deferred_work(priv);
        iwl4965_setup_rx_handlers(priv);
@@ -5927,12 +5807,26 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
        pci_save_state(pdev);
        pci_disable_device(pdev);
 
+       /**********************************
+        * 10. Setup and register mac80211
+        **********************************/
+
+       err = iwl_setup_mac(priv);
+       if (err)
+               goto out_remove_sysfs;
+
+       err = iwl_dbgfs_register(priv, DRV_NAME);
+       if (err)
+               IWL_ERROR("failed to create debugfs files\n");
+
        /* notify iwlcore to init */
        iwlcore_low_level_notify(priv, IWLCORE_INIT_EVT);
        return 0;
 
  out_remove_sysfs:
        sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group);
+ out_uninit_drv:
+       iwl_uninit_drv(priv);
  out_free_eeprom:
        iwl_eeprom_free(priv);
  out_iounmap:
@@ -6014,8 +5908,7 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
        pci_disable_device(pdev);
        pci_set_drvdata(pdev, NULL);
 
-       iwl_free_channel_map(priv);
-       iwlcore_free_geos(priv);
+       iwl_uninit_drv(priv);
 
        if (priv->ibss_beacon)
                dev_kfree_skb(priv->ibss_beacon);