diff options
author | Chris Boot <bootc@bootc.net> | 2012-02-15 09:59:10 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2012-02-22 16:36:02 -0500 |
commit | 6503de65459da619d3ade0824c9cc17ea0a57141 (patch) | |
tree | 4d2212199dfa1b72239594479345cb2a9c5c73af /drivers/firewire | |
parent | 74044563a2318f2c56fa53af64f7800f49fb479d (diff) |
firewire: sbp2: Fix SCSI sense data mangling
SCSI sense data in SBP-2/3 is carried in an unusual format that means we
have to un-mangle it on our end before we pass it to the SCSI subsystem.
Currently our un-mangling code doesn't quite follow the SBP-2 standard
in that we always assume Current and never Deferred error types, we
never set the VALID bit, and we mishandle the FILEMARK, EOM and ILI
bits.
This patch fixes the sense un-mangling to correctly handle those and
follow the spec.
Signed-off-by: Chris Boot <bootc@bootc.net>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/sbp2.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 0c92ed835e06..cc5828e7c735 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
@@ -1309,10 +1309,19 @@ static void sbp2_unmap_scatterlist(struct device *card_device, | |||
1309 | static unsigned int sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data) | 1309 | static unsigned int sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data) |
1310 | { | 1310 | { |
1311 | int sam_status; | 1311 | int sam_status; |
1312 | int sfmt = (sbp2_status[0] >> 6) & 0x03; | ||
1312 | 1313 | ||
1313 | sense_data[0] = 0x70; | 1314 | if (sfmt == 2 || sfmt == 3) { |
1315 | /* | ||
1316 | * Reserved for future standardization (2) or | ||
1317 | * Status block format vendor-dependent (3) | ||
1318 | */ | ||
1319 | return DID_ERROR << 16; | ||
1320 | } | ||
1321 | |||
1322 | sense_data[0] = 0x70 | sfmt | (sbp2_status[1] & 0x80); | ||
1314 | sense_data[1] = 0x0; | 1323 | sense_data[1] = 0x0; |
1315 | sense_data[2] = sbp2_status[1]; | 1324 | sense_data[2] = ((sbp2_status[1] << 1) & 0xe0) | (sbp2_status[1] & 0x0f); |
1316 | sense_data[3] = sbp2_status[4]; | 1325 | sense_data[3] = sbp2_status[4]; |
1317 | sense_data[4] = sbp2_status[5]; | 1326 | sense_data[4] = sbp2_status[5]; |
1318 | sense_data[5] = sbp2_status[6]; | 1327 | sense_data[5] = sbp2_status[6]; |