mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Ben Hutchings <bhutchings@solarflare.com>
Subject: [ 3/9 ] sfc: Convert firmware subtypes to native byte order in efx_mcdi_get_board_cfg()
Date: Thu, 11 Apr 2013 19:11:52 -0400	[thread overview]
Message-ID: <20130411231620.290887968@goodmis.org> (raw)
In-Reply-To: <20130411231149.302144972@goodmis.org>

[-- Attachment #1: 0003-sfc-Convert-firmware-subtypes-to-native-byte-order-i.patch --]
[-- Type: text/plain, Size: 1807 bytes --]

From: Ben Hutchings <bhutchings@solarflare.com>

[ Upstream commit bfeed902946a31692e7a24ed355b6d13ac37d014 ]

On big-endian systems the MTD partition names currently have mangled
subtype numbers and are not recognised by the firmware update tool
(sfupdate).

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/net/ethernet/sfc/mcdi.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
index fc5e7bb..516a437 100644
--- a/drivers/net/ethernet/sfc/mcdi.c
+++ b/drivers/net/ethernet/sfc/mcdi.c
@@ -641,9 +641,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
 			   u16 *fw_subtype_list, u32 *capabilities)
 {
 	uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMIN];
-	size_t outlen;
+	size_t outlen, offset, i;
 	int port_num = efx_port_num(efx);
-	int offset;
 	int rc;
 
 	BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_IN_LEN != 0);
@@ -663,11 +662,16 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
 		: MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST;
 	if (mac_address)
 		memcpy(mac_address, outbuf + offset, ETH_ALEN);
-	if (fw_subtype_list)
-		memcpy(fw_subtype_list,
-		       outbuf + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST,
-		       MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM *
-		       sizeof(fw_subtype_list[0]));
+	if (fw_subtype_list) {
+		offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST;
+		for (i = 0;
+		     i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM;
+		     i++) {
+			fw_subtype_list[i] =
+				le16_to_cpup((__le16 *)(outbuf + offset));
+			offset += 2;
+		}
+	}
 	if (capabilities) {
 		if (port_num)
 			*capabilities = MCDI_DWORD(outbuf,
-- 
1.7.10.4



  parent reply	other threads:[~2013-04-11 23:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-11 23:11 [ 0/9 ] 3.6.11.2-stable review (update) Steven Rostedt
2013-04-11 23:11 ` [ 1/9 ] sfc: Disable soft interrupt handling during efx_device_detach_sync() Steven Rostedt
2013-04-11 23:11 ` [ 2/9 ] sfc: Really disable flow control while flushing Steven Rostedt
2013-04-11 23:11 ` Steven Rostedt [this message]
2013-04-11 23:11 ` [ 4/9 ] sfc: Add parentheses around use of bitfield macro arguments Steven Rostedt
2013-04-11 23:11 ` [ 5/9 ] sfc: Fix MCDI structure field lookup Steven Rostedt
2013-04-11 23:11 ` [ 6/9 ] sfc: Avoid generating over-length MC_CMD_FLUSH_RX_QUEUES request Steven Rostedt
2013-04-11 23:11 ` [ 7/9 ] sfc: Work-around flush timeout when flushes have completed Steven Rostedt
2013-04-11 23:11 ` [ 8/9 ] sfc: Correctly initialise reset_method in siena_test_chip() Steven Rostedt
2013-04-11 23:11 ` [ 9/9 ] sfc: Fix timekeeping in efx_mcdi_poll() Steven Rostedt
2013-04-11 23:21 ` [ 0/9 ] 3.6.11.2-stable review (update) Steven Rostedt

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=20130411231620.290887968@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=bhutchings@solarflare.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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

Powered by JetHome