aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-14 09:48:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-24 15:05:14 -0400
commita94ca4e7af0e6b63ef5345750fad8e1400274ba4 (patch)
tree5018e3aa72aa185460a3d78b48752798284bdc11
parent256fc96028f0eae5f7a3f6f77358cdd30a72c988 (diff)
iwlwifi: make some logging functions static/unexport
iwl_dump_nic_error_log can be static and iwl_dump_nic_event_log doesn't need to be exported. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c367
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h1
2 files changed, 182 insertions, 186 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index d5cd9a20edca..b82480a51782 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1290,6 +1290,188 @@ static void iwl_print_rx_config_cmd(struct iwl_priv *priv)
1290} 1290}
1291#endif 1291#endif
1292 1292
1293static const char *desc_lookup_text[] = {
1294 "OK",
1295 "FAIL",
1296 "BAD_PARAM",
1297 "BAD_CHECKSUM",
1298 "NMI_INTERRUPT_WDG",
1299 "SYSASSERT",
1300 "FATAL_ERROR",
1301 "BAD_COMMAND",
1302 "HW_ERROR_TUNE_LOCK",
1303 "HW_ERROR_TEMPERATURE",
1304 "ILLEGAL_CHAN_FREQ",
1305 "VCC_NOT_STABLE",
1306 "FH_ERROR",
1307 "NMI_INTERRUPT_HOST",
1308 "NMI_INTERRUPT_ACTION_PT",
1309 "NMI_INTERRUPT_UNKNOWN",
1310 "UCODE_VERSION_MISMATCH",
1311 "HW_ERROR_ABS_LOCK",
1312 "HW_ERROR_CAL_LOCK_FAIL",
1313 "NMI_INTERRUPT_INST_ACTION_PT",
1314 "NMI_INTERRUPT_DATA_ACTION_PT",
1315 "NMI_TRM_HW_ER",
1316 "NMI_INTERRUPT_TRM",
1317 "NMI_INTERRUPT_BREAK_POINT"
1318 "DEBUG_0",
1319 "DEBUG_1",
1320 "DEBUG_2",
1321 "DEBUG_3",
1322 "UNKNOWN"
1323};
1324
1325static const char *desc_lookup(int i)
1326{
1327 int max = ARRAY_SIZE(desc_lookup_text) - 1;
1328
1329 if (i < 0 || i > max)
1330 i = max;
1331
1332 return desc_lookup_text[i];
1333}
1334
1335#define ERROR_START_OFFSET (1 * sizeof(u32))
1336#define ERROR_ELEM_SIZE (7 * sizeof(u32))
1337
1338static void iwl_dump_nic_error_log(struct iwl_priv *priv)
1339{
1340 u32 data2, line;
1341 u32 desc, time, count, base, data1;
1342 u32 blink1, blink2, ilink1, ilink2;
1343
1344 if (priv->ucode_type == UCODE_INIT)
1345 base = le32_to_cpu(priv->card_alive_init.error_event_table_ptr);
1346 else
1347 base = le32_to_cpu(priv->card_alive.error_event_table_ptr);
1348
1349 if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
1350 IWL_ERR(priv, "Not valid error log pointer 0x%08X\n", base);
1351 return;
1352 }
1353
1354 count = iwl_read_targ_mem(priv, base);
1355
1356 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
1357 IWL_ERR(priv, "Start IWL Error Log Dump:\n");
1358 IWL_ERR(priv, "Status: 0x%08lX, count: %d\n",
1359 priv->status, count);
1360 }
1361
1362 desc = iwl_read_targ_mem(priv, base + 1 * sizeof(u32));
1363 blink1 = iwl_read_targ_mem(priv, base + 3 * sizeof(u32));
1364 blink2 = iwl_read_targ_mem(priv, base + 4 * sizeof(u32));
1365 ilink1 = iwl_read_targ_mem(priv, base + 5 * sizeof(u32));
1366 ilink2 = iwl_read_targ_mem(priv, base + 6 * sizeof(u32));
1367 data1 = iwl_read_targ_mem(priv, base + 7 * sizeof(u32));
1368 data2 = iwl_read_targ_mem(priv, base + 8 * sizeof(u32));
1369 line = iwl_read_targ_mem(priv, base + 9 * sizeof(u32));
1370 time = iwl_read_targ_mem(priv, base + 11 * sizeof(u32));
1371
1372 IWL_ERR(priv, "Desc Time "
1373 "data1 data2 line\n");
1374 IWL_ERR(priv, "%-28s (#%02d) %010u 0x%08X 0x%08X %u\n",
1375 desc_lookup(desc), desc, time, data1, data2, line);
1376 IWL_ERR(priv, "blink1 blink2 ilink1 ilink2\n");
1377 IWL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2,
1378 ilink1, ilink2);
1379
1380}
1381
1382#define EVENT_START_OFFSET (4 * sizeof(u32))
1383
1384/**
1385 * iwl_print_event_log - Dump error event log to syslog
1386 *
1387 */
1388static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
1389 u32 num_events, u32 mode)
1390{
1391 u32 i;
1392 u32 base; /* SRAM byte address of event log header */
1393 u32 event_size; /* 2 u32s, or 3 u32s if timestamp recorded */
1394 u32 ptr; /* SRAM byte address of log data */
1395 u32 ev, time, data; /* event log data */
1396
1397 if (num_events == 0)
1398 return;
1399 if (priv->ucode_type == UCODE_INIT)
1400 base = le32_to_cpu(priv->card_alive_init.log_event_table_ptr);
1401 else
1402 base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
1403
1404 if (mode == 0)
1405 event_size = 2 * sizeof(u32);
1406 else
1407 event_size = 3 * sizeof(u32);
1408
1409 ptr = base + EVENT_START_OFFSET + (start_idx * event_size);
1410
1411 /* "time" is actually "data" for mode 0 (no timestamp).
1412 * place event id # at far right for easier visual parsing. */
1413 for (i = 0; i < num_events; i++) {
1414 ev = iwl_read_targ_mem(priv, ptr);
1415 ptr += sizeof(u32);
1416 time = iwl_read_targ_mem(priv, ptr);
1417 ptr += sizeof(u32);
1418 if (mode == 0) {
1419 /* data, ev */
1420 IWL_ERR(priv, "EVT_LOG:0x%08x:%04u\n", time, ev);
1421 } else {
1422 data = iwl_read_targ_mem(priv, ptr);
1423 ptr += sizeof(u32);
1424 IWL_ERR(priv, "EVT_LOGT:%010u:0x%08x:%04u\n",
1425 time, data, ev);
1426 }
1427 }
1428}
1429
1430void iwl_dump_nic_event_log(struct iwl_priv *priv)
1431{
1432 u32 base; /* SRAM byte address of event log header */
1433 u32 capacity; /* event log capacity in # entries */
1434 u32 mode; /* 0 - no timestamp, 1 - timestamp recorded */
1435 u32 num_wraps; /* # times uCode wrapped to top of log */
1436 u32 next_entry; /* index of next entry to be written by uCode */
1437 u32 size; /* # entries that we'll print */
1438
1439 if (priv->ucode_type == UCODE_INIT)
1440 base = le32_to_cpu(priv->card_alive_init.log_event_table_ptr);
1441 else
1442 base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
1443
1444 if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
1445 IWL_ERR(priv, "Invalid event log pointer 0x%08X\n", base);
1446 return;
1447 }
1448
1449 /* event log header */
1450 capacity = iwl_read_targ_mem(priv, base);
1451 mode = iwl_read_targ_mem(priv, base + (1 * sizeof(u32)));
1452 num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32)));
1453 next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32)));
1454
1455 size = num_wraps ? capacity : next_entry;
1456
1457 /* bail out if nothing in log */
1458 if (size == 0) {
1459 IWL_ERR(priv, "Start IWL Event Log Dump: nothing in log\n");
1460 return;
1461 }
1462
1463 IWL_ERR(priv, "Start IWL Event Log Dump: display count %d, wraps %d\n",
1464 size, num_wraps);
1465
1466 /* if uCode has wrapped back to top of log, start at the oldest entry,
1467 * i.e the next one that uCode would fill. */
1468 if (num_wraps)
1469 iwl_print_event_log(priv, next_entry,
1470 capacity - next_entry, mode);
1471 /* (then/else) start at top of log */
1472 iwl_print_event_log(priv, 0, next_entry, mode);
1473
1474}
1293/** 1475/**
1294 * iwl_irq_handle_error - called for HW or SW error interrupt from card 1476 * iwl_irq_handle_error - called for HW or SW error interrupt from card
1295 */ 1477 */
@@ -2040,191 +2222,6 @@ int iwl_verify_ucode(struct iwl_priv *priv)
2040EXPORT_SYMBOL(iwl_verify_ucode); 2222EXPORT_SYMBOL(iwl_verify_ucode);
2041 2223
2042 2224
2043static const char *desc_lookup_text[] = {
2044 "OK",
2045 "FAIL",
2046 "BAD_PARAM",
2047 "BAD_CHECKSUM",
2048 "NMI_INTERRUPT_WDG",
2049 "SYSASSERT",
2050 "FATAL_ERROR",
2051 "BAD_COMMAND",
2052 "HW_ERROR_TUNE_LOCK",
2053 "HW_ERROR_TEMPERATURE",
2054 "ILLEGAL_CHAN_FREQ",
2055 "VCC_NOT_STABLE",
2056 "FH_ERROR",
2057 "NMI_INTERRUPT_HOST",
2058 "NMI_INTERRUPT_ACTION_PT",
2059 "NMI_INTERRUPT_UNKNOWN",
2060 "UCODE_VERSION_MISMATCH",
2061 "HW_ERROR_ABS_LOCK",
2062 "HW_ERROR_CAL_LOCK_FAIL",
2063 "NMI_INTERRUPT_INST_ACTION_PT",
2064 "NMI_INTERRUPT_DATA_ACTION_PT",
2065 "NMI_TRM_HW_ER",
2066 "NMI_INTERRUPT_TRM",
2067 "NMI_INTERRUPT_BREAK_POINT"
2068 "DEBUG_0",
2069 "DEBUG_1",
2070 "DEBUG_2",
2071 "DEBUG_3",
2072 "UNKNOWN"
2073};
2074
2075static const char *desc_lookup(int i)
2076{
2077 int max = ARRAY_SIZE(desc_lookup_text) - 1;
2078
2079 if (i < 0 || i > max)
2080 i = max;
2081
2082 return desc_lookup_text[i];
2083}
2084
2085#define ERROR_START_OFFSET (1 * sizeof(u32))
2086#define ERROR_ELEM_SIZE (7 * sizeof(u32))
2087
2088void iwl_dump_nic_error_log(struct iwl_priv *priv)
2089{
2090 u32 data2, line;
2091 u32 desc, time, count, base, data1;
2092 u32 blink1, blink2, ilink1, ilink2;
2093
2094 if (priv->ucode_type == UCODE_INIT)
2095 base = le32_to_cpu(priv->card_alive_init.error_event_table_ptr);
2096 else
2097 base = le32_to_cpu(priv->card_alive.error_event_table_ptr);
2098
2099 if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
2100 IWL_ERR(priv, "Not valid error log pointer 0x%08X\n", base);
2101 return;
2102 }
2103
2104 count = iwl_read_targ_mem(priv, base);
2105
2106 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
2107 IWL_ERR(priv, "Start IWL Error Log Dump:\n");
2108 IWL_ERR(priv, "Status: 0x%08lX, count: %d\n",
2109 priv->status, count);
2110 }
2111
2112 desc = iwl_read_targ_mem(priv, base + 1 * sizeof(u32));
2113 blink1 = iwl_read_targ_mem(priv, base + 3 * sizeof(u32));
2114 blink2 = iwl_read_targ_mem(priv, base + 4 * sizeof(u32));
2115 ilink1 = iwl_read_targ_mem(priv, base + 5 * sizeof(u32));
2116 ilink2 = iwl_read_targ_mem(priv, base + 6 * sizeof(u32));
2117 data1 = iwl_read_targ_mem(priv, base + 7 * sizeof(u32));
2118 data2 = iwl_read_targ_mem(priv, base + 8 * sizeof(u32));
2119 line = iwl_read_targ_mem(priv, base + 9 * sizeof(u32));
2120 time = iwl_read_targ_mem(priv, base + 11 * sizeof(u32));
2121
2122 IWL_ERR(priv, "Desc Time "
2123 "data1 data2 line\n");
2124 IWL_ERR(priv, "%-28s (#%02d) %010u 0x%08X 0x%08X %u\n",
2125 desc_lookup(desc), desc, time, data1, data2, line);
2126 IWL_ERR(priv, "blink1 blink2 ilink1 ilink2\n");
2127 IWL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2,
2128 ilink1, ilink2);
2129
2130}
2131EXPORT_SYMBOL(iwl_dump_nic_error_log);
2132
2133#define EVENT_START_OFFSET (4 * sizeof(u32))
2134
2135/**
2136 * iwl_print_event_log - Dump error event log to syslog
2137 *
2138 */
2139static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
2140 u32 num_events, u32 mode)
2141{
2142 u32 i;
2143 u32 base; /* SRAM byte address of event log header */
2144 u32 event_size; /* 2 u32s, or 3 u32s if timestamp recorded */
2145 u32 ptr; /* SRAM byte address of log data */
2146 u32 ev, time, data; /* event log data */
2147
2148 if (num_events == 0)
2149 return;
2150 if (priv->ucode_type == UCODE_INIT)
2151 base = le32_to_cpu(priv->card_alive_init.log_event_table_ptr);
2152 else
2153 base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
2154
2155 if (mode == 0)
2156 event_size = 2 * sizeof(u32);
2157 else
2158 event_size = 3 * sizeof(u32);
2159
2160 ptr = base + EVENT_START_OFFSET + (start_idx * event_size);
2161
2162 /* "time" is actually "data" for mode 0 (no timestamp).
2163 * place event id # at far right for easier visual parsing. */
2164 for (i = 0; i < num_events; i++) {
2165 ev = iwl_read_targ_mem(priv, ptr);
2166 ptr += sizeof(u32);
2167 time = iwl_read_targ_mem(priv, ptr);
2168 ptr += sizeof(u32);
2169 if (mode == 0) {
2170 /* data, ev */
2171 IWL_ERR(priv, "EVT_LOG:0x%08x:%04u\n", time, ev);
2172 } else {
2173 data = iwl_read_targ_mem(priv, ptr);
2174 ptr += sizeof(u32);
2175 IWL_ERR(priv, "EVT_LOGT:%010u:0x%08x:%04u\n",
2176 time, data, ev);
2177 }
2178 }
2179}
2180
2181void iwl_dump_nic_event_log(struct iwl_priv *priv)
2182{
2183 u32 base; /* SRAM byte address of event log header */
2184 u32 capacity; /* event log capacity in # entries */
2185 u32 mode; /* 0 - no timestamp, 1 - timestamp recorded */
2186 u32 num_wraps; /* # times uCode wrapped to top of log */
2187 u32 next_entry; /* index of next entry to be written by uCode */
2188 u32 size; /* # entries that we'll print */
2189
2190 if (priv->ucode_type == UCODE_INIT)
2191 base = le32_to_cpu(priv->card_alive_init.log_event_table_ptr);
2192 else
2193 base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
2194
2195 if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
2196 IWL_ERR(priv, "Invalid event log pointer 0x%08X\n", base);
2197 return;
2198 }
2199
2200 /* event log header */
2201 capacity = iwl_read_targ_mem(priv, base);
2202 mode = iwl_read_targ_mem(priv, base + (1 * sizeof(u32)));
2203 num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32)));
2204 next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32)));
2205
2206 size = num_wraps ? capacity : next_entry;
2207
2208 /* bail out if nothing in log */
2209 if (size == 0) {
2210 IWL_ERR(priv, "Start IWL Event Log Dump: nothing in log\n");
2211 return;
2212 }
2213
2214 IWL_ERR(priv, "Start IWL Event Log Dump: display count %d, wraps %d\n",
2215 size, num_wraps);
2216
2217 /* if uCode has wrapped back to top of log, start at the oldest entry,
2218 * i.e the next one that uCode would fill. */
2219 if (num_wraps)
2220 iwl_print_event_log(priv, next_entry,
2221 capacity - next_entry, mode);
2222 /* (then/else) start at top of log */
2223 iwl_print_event_log(priv, 0, next_entry, mode);
2224
2225}
2226EXPORT_SYMBOL(iwl_dump_nic_event_log);
2227
2228void iwl_rf_kill_ct_config(struct iwl_priv *priv) 2225void iwl_rf_kill_ct_config(struct iwl_priv *priv)
2229{ 2226{
2230 struct iwl_ct_kill_config cmd; 2227 struct iwl_ct_kill_config cmd;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index a658410e66a4..640c4644a165 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -472,7 +472,6 @@ int iwl_pci_resume(struct pci_dev *pdev);
472/***************************************************** 472/*****************************************************
473* Error Handling Debugging 473* Error Handling Debugging
474******************************************************/ 474******************************************************/
475void iwl_dump_nic_error_log(struct iwl_priv *priv);
476void iwl_dump_nic_event_log(struct iwl_priv *priv); 475void iwl_dump_nic_event_log(struct iwl_priv *priv);
477void iwl_clear_isr_stats(struct iwl_priv *priv); 476void iwl_clear_isr_stats(struct iwl_priv *priv);
478 477