Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89704
b: refs/heads/master
c: d5cdc98
h: refs/heads/master
v: v3
  • Loading branch information
FUJITA Tomonori authored and James Bottomley committed Apr 7, 2008
1 parent 9222f96 commit a127944
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b8e3d3aeabe3be471e448ff5e51b6e57b5819913
refs/heads/master: d5cdc9898b5589acc77db91a1e9c0feb9f32abef
32 changes: 18 additions & 14 deletions trunk/drivers/scsi/scsi_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,33 +252,37 @@ static struct bus_type pseudo_lld_bus;
static void get_data_transfer_info(unsigned char *cmd,
unsigned long long *lba, unsigned int *num)
{
int i;

switch (*cmd) {
case WRITE_16:
case READ_16:
for (*lba = 0, i = 0; i < 8; ++i) {
if (i > 0)
*lba <<= 8;
*lba += cmd[2 + i];
}
*num = cmd[13] + (cmd[12] << 8) +
(cmd[11] << 16) + (cmd[10] << 24);
*lba = (u64)cmd[9] | (u64)cmd[8] << 8 |
(u64)cmd[7] << 16 | (u64)cmd[6] << 24 |
(u64)cmd[5] << 32 | (u64)cmd[4] << 40 |
(u64)cmd[3] << 48 | (u64)cmd[2] << 56;

*num = (u32)cmd[13] | (u32)cmd[12] << 8 | (u32)cmd[11] << 16 |
(u32)cmd[10] << 24;
break;
case WRITE_12:
case READ_12:
*lba = cmd[5] + (cmd[4] << 8) + (cmd[3] << 16) + (cmd[2] << 24);
*num = cmd[9] + (cmd[8] << 8) + (cmd[7] << 16) + (cmd[6] << 24);
*lba = (u32)cmd[5] | (u32)cmd[4] << 8 | (u32)cmd[3] << 16 |
(u32)cmd[2] << 24;

*num = (u32)cmd[9] | (u32)cmd[8] << 8 | (u32)cmd[7] << 16 |
(u32)cmd[6] << 24;
break;
case WRITE_10:
case READ_10:
case XDWRITEREAD_10:
*lba = cmd[5] + (cmd[4] << 8) + (cmd[3] << 16) + (cmd[2] << 24);
*num = cmd[8] + (cmd[7] << 8);
*lba = (u32)cmd[5] | (u32)cmd[4] << 8 | (u32)cmd[3] << 16 |
(u32)cmd[2] << 24;

*num = (u32)cmd[8] | (u32)cmd[7] << 8;
break;
case WRITE_6:
case READ_6:
*lba = cmd[3] + (cmd[2] << 8) + ((cmd[1] & 0x1f) << 16);
*lba = (u32)cmd[3] | (u32)cmd[2] << 8 |
(u32)(cmd[1] & 0x1f) << 16;
*num = (0 == cmd[4]) ? 256 : cmd[4];
break;
default:
Expand Down

0 comments on commit a127944

Please sign in to comment.