| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /****************************************************************************** |
|---|
| 2 | 3 | * |
|---|
| 3 | | - * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. |
|---|
| 4 | + * Copyright(c) 2003 - 2014, 2018 - 2020 Intel Corporation. All rights reserved. |
|---|
| 4 | 5 | * Copyright(c) 2015 Intel Deutschland GmbH |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Portions of this file are derived from the ipw3945 project, as well |
|---|
| 7 | 8 | * as portions of the ieee80211 subsystem header files. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 10 | | - * under the terms of version 2 of the GNU General Public License as |
|---|
| 11 | | - * published by the Free Software Foundation. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 14 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 15 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 16 | | - * more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 19 | | - * this program; if not, write to the Free Software Foundation, Inc., |
|---|
| 20 | | - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA |
|---|
| 21 | | - * |
|---|
| 22 | | - * The full GNU General Public License is included in this distribution in the |
|---|
| 23 | | - * file called LICENSE. |
|---|
| 24 | 9 | * |
|---|
| 25 | 10 | * Contact Information: |
|---|
| 26 | 11 | * Intel Linux Wireless <linuxwifi@intel.com> |
|---|
| .. | .. |
|---|
| 67 | 52 | |
|---|
| 68 | 53 | #define DRV_DESCRIPTION "Intel(R) Wireless WiFi Link AGN driver for Linux" |
|---|
| 69 | 54 | MODULE_DESCRIPTION(DRV_DESCRIPTION); |
|---|
| 70 | | -MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); |
|---|
| 55 | +MODULE_AUTHOR(DRV_AUTHOR); |
|---|
| 71 | 56 | MODULE_LICENSE("GPL"); |
|---|
| 72 | 57 | |
|---|
| 73 | 58 | /* Please keep this array *SORTED* by hex value. |
|---|
| .. | .. |
|---|
| 389 | 374 | &statistics_cmd); |
|---|
| 390 | 375 | } |
|---|
| 391 | 376 | |
|---|
| 392 | | -/** |
|---|
| 377 | +/* |
|---|
| 393 | 378 | * iwl_bg_statistics_periodic - Timer callback to queue statistics |
|---|
| 394 | 379 | * |
|---|
| 395 | 380 | * This callback is provided in order to send a statistics request. |
|---|
| .. | .. |
|---|
| 548 | 533 | priv->event_log.next_entry = next_entry; |
|---|
| 549 | 534 | } |
|---|
| 550 | 535 | |
|---|
| 551 | | -/** |
|---|
| 536 | +/* |
|---|
| 552 | 537 | * iwl_bg_ucode_trace - Timer callback to log ucode event |
|---|
| 553 | 538 | * |
|---|
| 554 | 539 | * The timer is continually set to execute every |
|---|
| .. | .. |
|---|
| 777 | 762 | IWL_ERR(priv, "failed to send BT Coex Config\n"); |
|---|
| 778 | 763 | } |
|---|
| 779 | 764 | |
|---|
| 780 | | -/** |
|---|
| 765 | +/* |
|---|
| 781 | 766 | * iwl_alive_start - called after REPLY_ALIVE notification received |
|---|
| 782 | 767 | * from protocol/runtime uCode (initialization uCode's |
|---|
| 783 | 768 | * Alive gets handled by iwl_init_alive_start()). |
|---|
| .. | .. |
|---|
| 1057 | 1042 | ieee80211_restart_hw(priv->hw); |
|---|
| 1058 | 1043 | else |
|---|
| 1059 | 1044 | IWL_ERR(priv, |
|---|
| 1060 | | - "Cannot request restart before registrating with mac80211\n"); |
|---|
| 1045 | + "Cannot request restart before registering with mac80211\n"); |
|---|
| 1061 | 1046 | } else { |
|---|
| 1062 | 1047 | WARN_ON(1); |
|---|
| 1063 | 1048 | } |
|---|
| .. | .. |
|---|
| 1269 | 1254 | ************************/ |
|---|
| 1270 | 1255 | hw = iwl_alloc_all(); |
|---|
| 1271 | 1256 | if (!hw) { |
|---|
| 1272 | | - pr_err("%s: Cannot allocate network device\n", cfg->name); |
|---|
| 1257 | + pr_err("%s: Cannot allocate network device\n", trans->name); |
|---|
| 1273 | 1258 | goto out; |
|---|
| 1274 | 1259 | } |
|---|
| 1275 | 1260 | |
|---|
| .. | .. |
|---|
| 1281 | 1266 | priv->cfg = cfg; |
|---|
| 1282 | 1267 | priv->fw = fw; |
|---|
| 1283 | 1268 | |
|---|
| 1284 | | - switch (priv->cfg->device_family) { |
|---|
| 1269 | + switch (priv->trans->trans_cfg->device_family) { |
|---|
| 1285 | 1270 | case IWL_DEVICE_FAMILY_1000: |
|---|
| 1286 | 1271 | case IWL_DEVICE_FAMILY_100: |
|---|
| 1287 | 1272 | priv->lib = &iwl_dvm_1000_cfg; |
|---|
| .. | .. |
|---|
| 1356 | 1341 | driver_data[2]); |
|---|
| 1357 | 1342 | |
|---|
| 1358 | 1343 | WARN_ON(sizeof(priv->transport_queue_stop) * BITS_PER_BYTE < |
|---|
| 1359 | | - priv->cfg->base_params->num_of_queues); |
|---|
| 1344 | + priv->trans->trans_cfg->base_params->num_of_queues); |
|---|
| 1360 | 1345 | |
|---|
| 1361 | 1346 | ucode_flags = fw->ucode_capa.flags; |
|---|
| 1362 | 1347 | |
|---|
| .. | .. |
|---|
| 1384 | 1369 | |
|---|
| 1385 | 1370 | IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); |
|---|
| 1386 | 1371 | |
|---|
| 1387 | | - /* is antenna coupling more than 35dB ? */ |
|---|
| 1388 | | - priv->bt_ant_couple_ok = |
|---|
| 1389 | | - (iwlwifi_mod_params.antenna_coupling > |
|---|
| 1390 | | - IWL_BT_ANTENNA_COUPLING_THRESHOLD) ? |
|---|
| 1391 | | - true : false; |
|---|
| 1392 | | - |
|---|
| 1393 | 1372 | /* bt channel inhibition enabled*/ |
|---|
| 1394 | 1373 | priv->bt_ch_announce = true; |
|---|
| 1395 | 1374 | IWL_DEBUG_INFO(priv, "BT channel inhibition is %s\n", |
|---|
| .. | .. |
|---|
| 1404 | 1383 | * 2. Read REV register |
|---|
| 1405 | 1384 | ***********************/ |
|---|
| 1406 | 1385 | IWL_INFO(priv, "Detected %s, REV=0x%X\n", |
|---|
| 1407 | | - priv->cfg->name, priv->trans->hw_rev); |
|---|
| 1386 | + priv->trans->name, priv->trans->hw_rev); |
|---|
| 1408 | 1387 | |
|---|
| 1409 | 1388 | if (iwl_trans_start_hw(priv->trans)) |
|---|
| 1410 | 1389 | goto out_free_hw; |
|---|
| .. | .. |
|---|
| 1419 | 1398 | /* Reset chip to save power until we load uCode during "up". */ |
|---|
| 1420 | 1399 | iwl_trans_stop_device(priv->trans); |
|---|
| 1421 | 1400 | |
|---|
| 1422 | | - priv->nvm_data = iwl_parse_eeprom_data(priv->trans->dev, priv->cfg, |
|---|
| 1423 | | - priv->eeprom_blob, |
|---|
| 1424 | | - priv->eeprom_blob_size); |
|---|
| 1401 | + priv->nvm_data = iwl_parse_eeprom_data(priv->trans, priv->cfg, |
|---|
| 1402 | + priv->eeprom_blob, |
|---|
| 1403 | + priv->eeprom_blob_size); |
|---|
| 1425 | 1404 | if (!priv->nvm_data) |
|---|
| 1426 | 1405 | goto out_free_eeprom_blob; |
|---|
| 1427 | 1406 | |
|---|
| .. | .. |
|---|
| 1512 | 1491 | if (iwlagn_mac_setup_register(priv, &fw->ucode_capa)) |
|---|
| 1513 | 1492 | goto out_destroy_workqueue; |
|---|
| 1514 | 1493 | |
|---|
| 1515 | | - if (iwl_dbgfs_register(priv, dbgfs_dir)) |
|---|
| 1516 | | - goto out_mac80211_unregister; |
|---|
| 1494 | + iwl_dbgfs_register(priv, dbgfs_dir); |
|---|
| 1517 | 1495 | |
|---|
| 1518 | 1496 | return op_mode; |
|---|
| 1519 | 1497 | |
|---|
| 1520 | | -out_mac80211_unregister: |
|---|
| 1521 | | - iwlagn_mac_unregister(priv); |
|---|
| 1522 | 1498 | out_destroy_workqueue: |
|---|
| 1523 | 1499 | iwl_tt_exit(priv); |
|---|
| 1524 | 1500 | iwl_cancel_deferred_work(priv); |
|---|
| .. | .. |
|---|
| 1668 | 1644 | priv->status, table.valid); |
|---|
| 1669 | 1645 | } |
|---|
| 1670 | 1646 | |
|---|
| 1671 | | - trace_iwlwifi_dev_ucode_error(trans->dev, &table, 0, table.brd_ver); |
|---|
| 1672 | 1647 | IWL_ERR(priv, "0x%08X | %-28s\n", table.error_id, |
|---|
| 1673 | 1648 | desc_lookup(table.error_id)); |
|---|
| 1674 | 1649 | IWL_ERR(priv, "0x%08X | uPc\n", table.pc); |
|---|
| .. | .. |
|---|
| 1707 | 1682 | |
|---|
| 1708 | 1683 | #define EVENT_START_OFFSET (4 * sizeof(u32)) |
|---|
| 1709 | 1684 | |
|---|
| 1710 | | -/** |
|---|
| 1685 | +/* |
|---|
| 1711 | 1686 | * iwl_print_event_log - Dump error event log to syslog |
|---|
| 1712 | | - * |
|---|
| 1713 | 1687 | */ |
|---|
| 1714 | 1688 | static int iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, |
|---|
| 1715 | 1689 | u32 num_events, u32 mode, |
|---|
| .. | .. |
|---|
| 1787 | 1761 | return pos; |
|---|
| 1788 | 1762 | } |
|---|
| 1789 | 1763 | |
|---|
| 1790 | | -/** |
|---|
| 1764 | +/* |
|---|
| 1791 | 1765 | * iwl_print_last_event_logs - Dump the newest # of event log to syslog |
|---|
| 1792 | 1766 | */ |
|---|
| 1793 | 1767 | static int iwl_print_last_event_logs(struct iwl_priv *priv, u32 capacity, |
|---|
| .. | .. |
|---|
| 1885 | 1859 | return pos; |
|---|
| 1886 | 1860 | } |
|---|
| 1887 | 1861 | |
|---|
| 1888 | | - if (!(iwl_have_debug_level(IWL_DL_FW_ERRORS)) && !full_log) |
|---|
| 1862 | + if (!(iwl_have_debug_level(IWL_DL_FW)) && !full_log) |
|---|
| 1889 | 1863 | size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) |
|---|
| 1890 | 1864 | ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; |
|---|
| 1891 | 1865 | IWL_ERR(priv, "Start IWL Event Log Dump: display last %u entries\n", |
|---|
| .. | .. |
|---|
| 1901 | 1875 | if (!*buf) |
|---|
| 1902 | 1876 | return -ENOMEM; |
|---|
| 1903 | 1877 | } |
|---|
| 1904 | | - if (iwl_have_debug_level(IWL_DL_FW_ERRORS) || full_log) { |
|---|
| 1878 | + if (iwl_have_debug_level(IWL_DL_FW) || full_log) { |
|---|
| 1905 | 1879 | /* |
|---|
| 1906 | 1880 | * if uCode has wrapped back to top of log, |
|---|
| 1907 | 1881 | * start at the oldest entry, |
|---|
| .. | .. |
|---|
| 1931 | 1905 | unsigned int reload_msec; |
|---|
| 1932 | 1906 | unsigned long reload_jiffies; |
|---|
| 1933 | 1907 | |
|---|
| 1934 | | - if (iwl_have_debug_level(IWL_DL_FW_ERRORS)) |
|---|
| 1908 | + if (iwl_have_debug_level(IWL_DL_FW)) |
|---|
| 1935 | 1909 | iwl_print_rx_config_cmd(priv, IWL_RXON_CTX_BSS); |
|---|
| 1936 | 1910 | |
|---|
| 1937 | 1911 | /* uCode is no longer loaded. */ |
|---|
| .. | .. |
|---|
| 1969 | 1943 | |
|---|
| 1970 | 1944 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) { |
|---|
| 1971 | 1945 | if (iwlwifi_mod_params.fw_restart) { |
|---|
| 1972 | | - IWL_DEBUG_FW_ERRORS(priv, |
|---|
| 1973 | | - "Restarting adapter due to uCode error.\n"); |
|---|
| 1946 | + IWL_DEBUG_FW(priv, |
|---|
| 1947 | + "Restarting adapter due to uCode error.\n"); |
|---|
| 1974 | 1948 | queue_work(priv->workqueue, &priv->restart); |
|---|
| 1975 | 1949 | } else |
|---|
| 1976 | | - IWL_DEBUG_FW_ERRORS(priv, |
|---|
| 1977 | | - "Detected FW error, but not restarting\n"); |
|---|
| 1950 | + IWL_DEBUG_FW(priv, |
|---|
| 1951 | + "Detected FW error, but not restarting\n"); |
|---|
| 1978 | 1952 | } |
|---|
| 1979 | 1953 | } |
|---|
| 1980 | 1954 | |
|---|