linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wey-Yi Guy <wey-yi.w.guy@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
	ipw3945-devel@lists.sourceforge.net,
	Wey-Yi Guy <wey-yi.w.guy@intel.com>
Subject: [PATCH 07/13] iwlagn: add eeprom command to testmode
Date: Fri, 13 May 2011 12:13:24 -0700	[thread overview]
Message-ID: <1305314010-18073-8-git-send-email-wey-yi.w.guy@intel.com> (raw)
In-Reply-To: <1305314010-18073-1-git-send-email-wey-yi.w.guy@intel.com>

Add the capability to dump eeprom through testmode request

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-sv-open.c  |   26 ++++++++++++++++++++++++++
 drivers/net/wireless/iwlwifi/iwl-testmode.h |   12 ++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-sv-open.c b/drivers/net/wireless/iwlwifi/iwl-sv-open.c
index b778c3f..e77ccaa 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sv-open.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sv-open.c
@@ -98,6 +98,8 @@ struct nla_policy iwl_testmode_gnl_msg_policy[IWL_TM_ATTR_MAX] = {
 	[IWL_TM_ATTR_SYNC_RSP] = { .type = NLA_UNSPEC, },
 	[IWL_TM_ATTR_UCODE_RX_PKT] = { .type = NLA_UNSPEC, },
 
+	[IWL_TM_ATTR_EEPROM] = { .type = NLA_UNSPEC, },
+
 	[IWL_TM_ATTR_TRACE_ADDR] = { .type = NLA_UNSPEC, },
 	[IWL_TM_ATTR_TRACE_DATA] = { .type = NLA_UNSPEC, },
 
@@ -418,6 +420,29 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
 				"Error starting the device: %d\n", status);
 		break;
 
+	case IWL_TM_CMD_APP2DEV_GET_EEPROM:
+		if (priv->eeprom) {
+			skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,
+				priv->cfg->base_params->eeprom_size + 20);
+			if (!skb) {
+				IWL_DEBUG_INFO(priv,
+				       "Error allocating memory\n");
+				return -ENOMEM;
+			}
+			NLA_PUT_U32(skb, IWL_TM_ATTR_COMMAND,
+				IWL_TM_CMD_DEV2APP_EEPROM_RSP);
+			NLA_PUT(skb, IWL_TM_ATTR_EEPROM,
+				priv->cfg->base_params->eeprom_size,
+				priv->eeprom);
+			status = cfg80211_testmode_reply(skb);
+			if (status < 0)
+				IWL_DEBUG_INFO(priv,
+					       "Error sending msg : %d\n",
+					       status);
+		} else
+			return -EFAULT;
+		break;
+
 	default:
 		IWL_DEBUG_INFO(priv, "Unknown testmode driver command ID\n");
 		return -ENOSYS;
@@ -581,6 +606,7 @@ int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len)
 	case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW:
 	case IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB:
 	case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW:
+	case IWL_TM_CMD_APP2DEV_GET_EEPROM:
 		IWL_DEBUG_INFO(priv, "testmode cmd to driver\n");
 		result = iwl_testmode_driver(hw, tb);
 		break;
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.h b/drivers/net/wireless/iwlwifi/iwl-testmode.h
index 34634ec..4171d29 100644
--- a/drivers/net/wireless/iwlwifi/iwl-testmode.h
+++ b/drivers/net/wireless/iwlwifi/iwl-testmode.h
@@ -88,6 +88,7 @@ enum iwl_tm_cmd_t {
 	IWL_TM_CMD_APP2DEV_LOAD_INIT_FW,
 	IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB,
 	IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW,
+	IWL_TM_CMD_APP2DEV_GET_EEPROM,
 	/* if there is other new command for the driver layer operation,
 	 * append them here */
 
@@ -103,6 +104,11 @@ enum iwl_tm_cmd_t {
 	/* commands from kernel space to multicast the spontaneous messages
 	 * to user application */
 	IWL_TM_CMD_DEV2APP_UCODE_RX_PKT,
+
+	/* commands from kernel space to carry the eeprom response
+	 * to user application */
+	IWL_TM_CMD_DEV2APP_EEPROM_RSP,
+
 	IWL_TM_CMD_MAX,
 };
 
@@ -148,6 +154,12 @@ enum iwl_tm_attr_t {
 	 * application */
 	IWL_TM_ATTR_UCODE_RX_PKT,
 
+	/* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_EEPROM,
+	 * The mandatory fields are:
+	 * IWL_TM_ATTR_EEPROM for the data content responging to the user
+	 * application */
+	IWL_TM_ATTR_EEPROM,
+
 	/* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_XXX_TRACE,
 	 * The mandatory fields are:
 	 * IWL_TM_ATTR_MEM_TRACE_ADDR for the trace address
-- 
1.7.0.4


  parent reply	other threads:[~2011-05-13 19:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13 19:13 [PATCH 00/13] update for 2.6.40 Wey-Yi Guy
2011-05-13 19:13 ` [PATCH 01/13] iwlagn: prepare for multi-TB commands Wey-Yi Guy
2011-05-13 19:13 ` [PATCH 02/13] iwlagn: clean up TXQ indirection Wey-Yi Guy
2011-05-13 19:13 ` [PATCH 03/13] iwlagn: remove unused pad argument Wey-Yi Guy
2011-05-13 19:13 ` [PATCH 04/13] iwlagn: support multiple TBs per command Wey-Yi Guy
2011-05-13 19:13 ` [PATCH 05/13] iwlagn: more ucode error log info Wey-Yi Guy
2011-05-13 19:13 ` [PATCH 06/13] iwlagn: add testmode trace command Wey-Yi Guy
2011-05-13 19:13 ` Wey-Yi Guy [this message]
2011-05-13 19:13 ` [PATCH 08/13] iwlagn: add testmode set fixed rate command Wey-Yi Guy
2011-05-13 19:13 ` [PATCH 09/13] iwlagn: clear STATUS_HCMD_ACTIVE bit if fail enqueue Wey-Yi Guy
2011-05-13 19:13 ` [PATCH 10/13] iwlagn: always send RXON with disassociate flag before associate Wey-Yi Guy
2011-05-13 19:13 ` [PATCH 11/13] iwlagn: remove set but unused vars Wey-Yi Guy
2011-05-13 19:13 ` [PATCH 12/13] iwlagn: change default beacon interval Wey-Yi Guy
2011-05-13 19:13 ` [PATCH 13/13] iwlagn: remove unused old_assoc parameter Wey-Yi Guy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1305314010-18073-8-git-send-email-wey-yi.w.guy@intel.com \
    --to=wey-yi.w.guy@intel.com \
    --cc=ipw3945-devel@lists.sourceforge.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).