aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-testmode.c41
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-testmode.h19
2 files changed, 57 insertions, 3 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.c b/drivers/net/wireless/iwlwifi/iwl-testmode.c
index b56cd900805c..7684c0e2f21a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-testmode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-testmode.c
@@ -115,6 +115,9 @@ struct nla_policy iwl_testmode_gnl_msg_policy[IWL_TM_ATTR_MAX] = {
115 115
116 [IWL_TM_ATTR_FW_VERSION] = { .type = NLA_U32, }, 116 [IWL_TM_ATTR_FW_VERSION] = { .type = NLA_U32, },
117 [IWL_TM_ATTR_DEVICE_ID] = { .type = NLA_U32, }, 117 [IWL_TM_ATTR_DEVICE_ID] = { .type = NLA_U32, },
118 [IWL_TM_ATTR_FW_TYPE] = { .type = NLA_U32, },
119 [IWL_TM_ATTR_FW_INST_SIZE] = { .type = NLA_U32, },
120 [IWL_TM_ATTR_FW_DATA_SIZE] = { .type = NLA_U32, },
118}; 121};
119 122
120/* 123/*
@@ -422,7 +425,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
422 struct sk_buff *skb; 425 struct sk_buff *skb;
423 unsigned char *rsp_data_ptr = NULL; 426 unsigned char *rsp_data_ptr = NULL;
424 int status = 0, rsp_data_len = 0; 427 int status = 0, rsp_data_len = 0;
425 u32 devid; 428 u32 devid, inst_size = 0, data_size = 0;
426 429
427 switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { 430 switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
428 case IWL_TM_CMD_APP2DEV_GET_DEVICENAME: 431 case IWL_TM_CMD_APP2DEV_GET_DEVICENAME:
@@ -548,6 +551,41 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
548 "Error sending msg : %d\n", status); 551 "Error sending msg : %d\n", status);
549 break; 552 break;
550 553
554 case IWL_TM_CMD_APP2DEV_GET_FW_INFO:
555 skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20 + 8);
556 if (!skb) {
557 IWL_DEBUG_INFO(priv, "Error allocating memory\n");
558 return -ENOMEM;
559 }
560 switch (priv->shrd->ucode_type) {
561 case IWL_UCODE_REGULAR:
562 inst_size = trans(priv)->ucode_rt.code.len;
563 data_size = trans(priv)->ucode_rt.data.len;
564 break;
565 case IWL_UCODE_INIT:
566 inst_size = trans(priv)->ucode_init.code.len;
567 data_size = trans(priv)->ucode_init.data.len;
568 break;
569 case IWL_UCODE_WOWLAN:
570 inst_size = trans(priv)->ucode_wowlan.code.len;
571 data_size = trans(priv)->ucode_wowlan.data.len;
572 break;
573 case IWL_UCODE_NONE:
574 IWL_DEBUG_INFO(priv, "The uCode has not been loaded\n");
575 break;
576 default:
577 IWL_DEBUG_INFO(priv, "Unsupported uCode type\n");
578 break;
579 }
580 NLA_PUT_U32(skb, IWL_TM_ATTR_FW_TYPE, priv->shrd->ucode_type);
581 NLA_PUT_U32(skb, IWL_TM_ATTR_FW_INST_SIZE, inst_size);
582 NLA_PUT_U32(skb, IWL_TM_ATTR_FW_DATA_SIZE, data_size);
583 status = cfg80211_testmode_reply(skb);
584 if (status < 0)
585 IWL_DEBUG_INFO(priv,
586 "Error sending msg : %d\n", status);
587 break;
588
551 default: 589 default:
552 IWL_DEBUG_INFO(priv, "Unknown testmode driver command ID\n"); 590 IWL_DEBUG_INFO(priv, "Unknown testmode driver command ID\n");
553 return -ENOSYS; 591 return -ENOSYS;
@@ -881,6 +919,7 @@ int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data, int len)
881 case IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW: 919 case IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW:
882 case IWL_TM_CMD_APP2DEV_GET_FW_VERSION: 920 case IWL_TM_CMD_APP2DEV_GET_FW_VERSION:
883 case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: 921 case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID:
922 case IWL_TM_CMD_APP2DEV_GET_FW_INFO:
884 IWL_DEBUG_INFO(priv, "testmode cmd to driver\n"); 923 IWL_DEBUG_INFO(priv, "testmode cmd to driver\n");
885 result = iwl_testmode_driver(hw, tb); 924 result = iwl_testmode_driver(hw, tb);
886 break; 925 break;
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.h b/drivers/net/wireless/iwlwifi/iwl-testmode.h
index 9c6a67ab5c34..cb0cf35f91b5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-testmode.h
+++ b/drivers/net/wireless/iwlwifi/iwl-testmode.h
@@ -120,6 +120,8 @@
120 * @IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW: load Weak On Wireless LAN uCode image 120 * @IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW: load Weak On Wireless LAN uCode image
121 * @IWL_TM_CMD_APP2DEV_GET_FW_VERSION: retrieve uCode version 121 * @IWL_TM_CMD_APP2DEV_GET_FW_VERSION: retrieve uCode version
122 * @IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: retrieve ID information in device 122 * @IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: retrieve ID information in device
123 * @IWL_TM_CMD_APP2DEV_GET_FW_INFO:
124 * retrieve informration of existing loaded uCode image
123 * 125 *
124 */ 126 */
125enum iwl_tm_cmd_t { 127enum iwl_tm_cmd_t {
@@ -147,7 +149,8 @@ enum iwl_tm_cmd_t {
147 IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW = 22, 149 IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW = 22,
148 IWL_TM_CMD_APP2DEV_GET_FW_VERSION = 23, 150 IWL_TM_CMD_APP2DEV_GET_FW_VERSION = 23,
149 IWL_TM_CMD_APP2DEV_GET_DEVICE_ID = 24, 151 IWL_TM_CMD_APP2DEV_GET_DEVICE_ID = 24,
150 IWL_TM_CMD_MAX = 25, 152 IWL_TM_CMD_APP2DEV_GET_FW_INFO = 25,
153 IWL_TM_CMD_MAX = 26,
151}; 154};
152 155
153/* 156/*
@@ -237,6 +240,15 @@ enum iwl_tm_cmd_t {
237 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_DEVICE_ID, 240 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_DEVICE_ID,
238 * IWL_TM_ATTR_DEVICE_ID for the device ID information 241 * IWL_TM_ATTR_DEVICE_ID for the device ID information
239 * 242 *
243 * @IWL_TM_ATTR_FW_TYPE:
244 * @IWL_TM_ATTR_FW_INST_SIZE:
245 * @IWL_TM_ATTR_FW_DATA_SIZE:
246 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_FW_INFO,
247 * The mandatory fields are:
248 * IWL_TM_ATTR_FW_TYPE for the uCode type (INIT/RUNTIME/...)
249 * IWL_TM_ATTR_FW_INST_SIZE for the size of instruction section
250 * IWL_TM_ATTR_FW_DATA_SIZE for the size of data section
251 *
240 */ 252 */
241enum iwl_tm_attr_t { 253enum iwl_tm_attr_t {
242 IWL_TM_ATTR_NOT_APPLICABLE = 0, 254 IWL_TM_ATTR_NOT_APPLICABLE = 0,
@@ -259,7 +271,10 @@ enum iwl_tm_attr_t {
259 IWL_TM_ATTR_SRAM_DUMP = 17, 271 IWL_TM_ATTR_SRAM_DUMP = 17,
260 IWL_TM_ATTR_FW_VERSION = 18, 272 IWL_TM_ATTR_FW_VERSION = 18,
261 IWL_TM_ATTR_DEVICE_ID = 19, 273 IWL_TM_ATTR_DEVICE_ID = 19,
262 IWL_TM_ATTR_MAX = 20, 274 IWL_TM_ATTR_FW_TYPE = 20,
275 IWL_TM_ATTR_FW_INST_SIZE = 21,
276 IWL_TM_ATTR_FW_DATA_SIZE = 22,
277 IWL_TM_ATTR_MAX = 23,
263}; 278};
264 279
265/* uCode trace buffer */ 280/* uCode trace buffer */