Al Viro 286e310f94 [TG3]: Endianness bugfix.
tg3_nvram_write_block_unbuffered() is reading data from nvram into
allocated buffer before overwriting a part of it with user-supplied
data.  Then it feeds the entire page back to nvram.  It should be
storing the words it had read as little-endian, not as host-endian.
Note that tg3_set_eeprom() does exactly that for padding the same
data to full words before it gets passed down to tg3_nvram_write_block()
and then to tg3_nvram_write_block_unbuffered().

Moreover, when we get to sending the entire thing back to nvram, we
go through it word-by-word, doing essentially
	writel(swab32(le32_to_cpu(word)), ...)
so if we want them to reach the card in host-independent endianness,
we'd better really have all that buffer filled with fixed-endian.
For user-supplied part we obviously do have that (it's an array of
octets memcpy'd in), ditto for padding of user-supplied part to word
boundaries (taken care of in tg3_set_eeprom()).  The rest of the
buffer gets filled by tg3_nvram_write_block_unbuffered() and it would
damn better be consistent with that (and with tg3_get_eeprom(), while
we are at it - there we also convert the words read from nvram to
little-endian before returning the buffer to user).

The bug should get triggered on big-endian boxen when set_eeprom is done
for less than entire page.  Then the words that should've been unaffected
at all will actually get byteswapped in place in nvram.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-12-19 16:43:48 -08:00
..
2007-12-04 14:52:58 -05:00
2007-11-14 18:45:47 -08:00
2007-12-07 15:00:36 -05:00
2007-12-16 14:09:44 -08:00
2007-10-30 14:32:17 -04:00
2007-12-17 16:02:15 -05:00
2007-11-23 21:02:53 -05:00
2007-10-17 20:23:30 -04:00
2007-10-10 16:52:06 -07:00
2007-10-10 16:51:57 -07:00
2007-07-10 12:41:08 -04:00
2007-11-05 17:57:30 -05:00
2007-10-10 16:55:27 -07:00
2007-10-10 16:51:43 -07:00
2007-10-10 16:54:07 -07:00
2007-12-11 02:45:31 -08:00
2007-12-11 02:45:30 -08:00
2007-02-09 16:23:17 +00:00
2007-10-10 16:55:27 -07:00
2007-10-19 23:00:01 -04:00
2007-10-10 16:51:13 -07:00
2007-10-10 16:51:13 -07:00
2007-10-19 11:53:42 -07:00
2007-11-23 20:59:59 -05:00
2007-07-30 15:48:16 -04:00
2007-07-30 15:48:16 -04:00
2007-12-04 15:06:11 -05:00
2007-10-17 20:11:28 -04:00
2007-12-14 15:26:15 -05:00
2007-10-10 16:50:46 -07:00
2007-10-25 03:31:13 -04:00
2007-10-25 03:31:13 -04:00
2007-10-19 11:53:41 -07:00
2007-10-10 16:51:13 -07:00
2007-11-02 08:47:06 +01:00
2007-10-19 11:53:42 -07:00
2007-04-28 11:01:05 -04:00
2007-10-15 14:29:49 -04:00
2007-10-10 16:51:13 -07:00
2007-10-23 21:28:40 -04:00
2007-12-07 01:05:47 -08:00
2007-10-10 16:54:38 -07:00
2007-10-10 16:54:30 -07:00
2007-11-12 18:07:31 -08:00
2007-12-14 15:26:22 -05:00
2007-10-19 11:53:42 -07:00
2007-10-15 14:29:48 -04:00
2007-12-17 16:02:28 -05:00
2007-12-01 16:32:30 -05:00
2007-10-16 21:10:29 -04:00
2007-12-14 15:25:47 -05:00
2007-05-04 17:59:08 -07:00
2007-07-16 15:02:47 +02:00
2007-12-14 15:26:04 -05:00
2007-10-10 16:51:13 -07:00
2007-12-14 15:26:00 -05:00
2007-11-15 15:38:45 -08:00
2007-10-10 16:51:34 -07:00
2007-10-10 16:51:34 -07:00
2007-12-19 16:43:48 -08:00
2007-11-12 21:22:02 -08:00
2007-10-10 16:51:13 -07:00
2007-10-19 23:00:03 -04:00
2007-09-13 15:43:46 -05:00
2007-12-14 16:12:38 -05:00
2007-10-10 16:52:04 -07:00
2007-10-10 16:53:49 -07:00