aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-13 19:29:20 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-04-29 18:00:29 -0400
commitd265250341f83fa904d4fecdfadb46d7ab50765f (patch)
tree81407ab57e35ac7adaa481e6d878019b228e2d2c
parent511f7b3227eef52b56cf336a5313d8ff766c3050 (diff)
ieee1394: csr1212: log if devices have CRC errors in their ROM
This will point out firmware bugs. I tested with 11 SBP-2 devices and one OS X PC and got these errors from two old CD-RWs only. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r--drivers/ieee1394/csr1212.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c
index 43f5b7f814ae..d08166bda1c5 100644
--- a/drivers/ieee1394/csr1212.c
+++ b/drivers/ieee1394/csr1212.c
@@ -34,6 +34,7 @@
34 */ 34 */
35 35
36#include <linux/errno.h> 36#include <linux/errno.h>
37#include <linux/kernel.h>
37#include <linux/string.h> 38#include <linux/string.h>
38#include <asm/bug.h> 39#include <asm/bug.h>
39#include <asm/byteorder.h> 40#include <asm/byteorder.h>
@@ -113,10 +114,7 @@ static u16 csr1212_crc16(const u32 *buffer, size_t length)
113 return cpu_to_be16(crc); 114 return cpu_to_be16(crc);
114} 115}
115 116
116#if 0 117/* Microsoft computes the CRC with the bytes in reverse order. */
117/* Microsoft computes the CRC with the bytes in reverse order. Therefore we
118 * have a special version of the CRC algorithm to account for their buggy
119 * software. */
120static u16 csr1212_msft_crc16(const u32 *buffer, size_t length) 118static u16 csr1212_msft_crc16(const u32 *buffer, size_t length)
121{ 119{
122 int shift; 120 int shift;
@@ -135,7 +133,6 @@ static u16 csr1212_msft_crc16(const u32 *buffer, size_t length)
135 133
136 return cpu_to_be16(crc); 134 return cpu_to_be16(crc);
137} 135}
138#endif
139 136
140static struct csr1212_dentry * 137static struct csr1212_dentry *
141csr1212_find_keyval(struct csr1212_keyval *dir, struct csr1212_keyval *kv) 138csr1212_find_keyval(struct csr1212_keyval *dir, struct csr1212_keyval *kv)
@@ -1096,13 +1093,11 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr)
1096 return ret; 1093 return ret;
1097 } 1094 }
1098 1095
1099#if 0 1096 /* Apparently there are many different wrong implementations of the CRC
1100 /* Apparently there are too many differnt wrong implementations of the 1097 * algorithm. We don't fail, we just warn. */
1101 * CRC algorithm that verifying them is moot. */
1102 if ((csr1212_crc16(bi->data, bi->crc_length) != bi->crc) && 1098 if ((csr1212_crc16(bi->data, bi->crc_length) != bi->crc) &&
1103 (csr1212_msft_crc16(bi->data, bi->crc_length) != bi->crc)) 1099 (csr1212_msft_crc16(bi->data, bi->crc_length) != bi->crc))
1104 return -EINVAL; 1100 printk(KERN_DEBUG "IEEE 1394 device has ROM CRC error\n");
1105#endif
1106 1101
1107 cr = CSR1212_MALLOC(sizeof(*cr)); 1102 cr = CSR1212_MALLOC(sizeof(*cr));
1108 if (!cr) 1103 if (!cr)
@@ -1207,15 +1202,11 @@ int csr1212_parse_keyval(struct csr1212_keyval *kv,
1207 &cache->data[bytes_to_quads(kv->offset - cache->offset)]; 1202 &cache->data[bytes_to_quads(kv->offset - cache->offset)];
1208 kvi_len = be16_to_cpu(kvi->length); 1203 kvi_len = be16_to_cpu(kvi->length);
1209 1204
1210#if 0 1205 /* Apparently there are many different wrong implementations of the CRC
1211 /* Apparently there are too many differnt wrong implementations of the 1206 * algorithm. We don't fail, we just warn. */
1212 * CRC algorithm that verifying them is moot. */
1213 if ((csr1212_crc16(kvi->data, kvi_len) != kvi->crc) && 1207 if ((csr1212_crc16(kvi->data, kvi_len) != kvi->crc) &&
1214 (csr1212_msft_crc16(kvi->data, kvi_len) != kvi->crc)) { 1208 (csr1212_msft_crc16(kvi->data, kvi_len) != kvi->crc))
1215 ret = -EINVAL; 1209 printk(KERN_DEBUG "IEEE 1394 device has ROM CRC error\n");
1216 goto out;
1217 }
1218#endif
1219 1210
1220 switch (kv->key.type) { 1211 switch (kv->key.type) {
1221 case CSR1212_KV_TYPE_DIRECTORY: 1212 case CSR1212_KV_TYPE_DIRECTORY: