|
@@ -55,6 +55,9 @@ static int scsi_command ( struct scsi_device *scsi,
|
55
|
55
|
struct scsi_command *command ) {
|
56
|
56
|
int rc;
|
57
|
57
|
|
|
58
|
+ DBGC2 ( scsi, "SCSI %p " SCSI_CDB_FORMAT "\n",
|
|
59
|
+ scsi, SCSI_CDB_DATA ( command->cdb ) );
|
|
60
|
+
|
58
|
61
|
/* Clear sense response code before issuing command */
|
59
|
62
|
command->sense_response = 0;
|
60
|
63
|
|
|
@@ -64,8 +67,8 @@ static int scsi_command ( struct scsi_device *scsi,
|
64
|
67
|
/* Issue SCSI command */
|
65
|
68
|
if ( ( rc = scsi->command ( scsi, command ) ) != 0 ) {
|
66
|
69
|
/* Something went wrong with the issuing mechanism */
|
67
|
|
- DBG ( "SCSI %p " SCSI_CDB_FORMAT " err %s\n",
|
68
|
|
- scsi, SCSI_CDB_DATA ( command->cdb ), strerror ( rc ) );
|
|
70
|
+ DBGC ( scsi, "SCSI %p " SCSI_CDB_FORMAT " err %s\n",
|
|
71
|
+ scsi, SCSI_CDB_DATA ( command->cdb ), strerror ( rc ) );
|
69
|
72
|
return rc;
|
70
|
73
|
}
|
71
|
74
|
|
|
@@ -74,16 +77,16 @@ static int scsi_command ( struct scsi_device *scsi,
|
74
|
77
|
step();
|
75
|
78
|
if ( ( rc = command->rc ) != 0 ) {
|
76
|
79
|
/* Something went wrong with the command execution */
|
77
|
|
- DBG ( "SCSI %p " SCSI_CDB_FORMAT " err %s\n",
|
78
|
|
- scsi, SCSI_CDB_DATA ( command->cdb ), strerror ( rc ) );
|
|
80
|
+ DBGC ( scsi, "SCSI %p " SCSI_CDB_FORMAT " err %s\n",
|
|
81
|
+ scsi, SCSI_CDB_DATA ( command->cdb ), strerror ( rc ) );
|
79
|
82
|
return rc;
|
80
|
83
|
}
|
81
|
84
|
|
82
|
85
|
/* Check for SCSI errors */
|
83
|
86
|
if ( command->status != 0 ) {
|
84
|
|
- DBG ( "SCSI %p " SCSI_CDB_FORMAT " status %02x sense %02x\n",
|
85
|
|
- scsi, SCSI_CDB_DATA ( command->cdb ),
|
86
|
|
- command->status, command->sense_response );
|
|
87
|
+ DBGC ( scsi, "SCSI %p " SCSI_CDB_FORMAT " status %02x sense "
|
|
88
|
+ "%02x\n", scsi, SCSI_CDB_DATA ( command->cdb ),
|
|
89
|
+ command->status, command->sense_response );
|
87
|
90
|
return -EIO;
|
88
|
91
|
}
|
89
|
92
|
|
|
@@ -285,12 +288,17 @@ int init_scsidev ( struct scsi_device *scsi ) {
|
285
|
288
|
for ( i = 0 ; i < SCSI_MAX_DUMMY_READ_CAP ; i++ ) {
|
286
|
289
|
if ( ( rc = scsi_read_capacity_10 ( &scsi->blockdev ) ) == 0 )
|
287
|
290
|
break;
|
|
291
|
+ DBGC ( scsi, "SCSI %p ignoring start-of-day error (#%d)\n",
|
|
292
|
+ scsi, ( i + 1 ) );
|
288
|
293
|
}
|
289
|
294
|
|
290
|
295
|
/* Try READ CAPACITY (10), which is a mandatory command, first. */
|
291
|
296
|
scsi->blockdev.op = &scsi_operations_10;
|
292
|
|
- if ( ( rc = scsi_read_capacity_10 ( &scsi->blockdev ) ) != 0 )
|
|
297
|
+ if ( ( rc = scsi_read_capacity_10 ( &scsi->blockdev ) ) != 0 ) {
|
|
298
|
+ DBGC ( scsi, "SCSI %p could not READ CAPACITY (10): %s\n",
|
|
299
|
+ scsi, strerror ( rc ) );
|
293
|
300
|
return rc;
|
|
301
|
+ }
|
294
|
302
|
|
295
|
303
|
/* If capacity range was exceeded (i.e. capacity.lba was
|
296
|
304
|
* 0xffffffff, meaning that blockdev->blocks is now zero), use
|
|
@@ -299,9 +307,18 @@ int init_scsidev ( struct scsi_device *scsi ) {
|
299
|
307
|
*/
|
300
|
308
|
if ( scsi->blockdev.blocks == 0 ) {
|
301
|
309
|
scsi->blockdev.op = &scsi_operations_16;
|
302
|
|
- if ( ( rc = scsi_read_capacity_16 ( &scsi->blockdev ) ) != 0 )
|
|
310
|
+ if ( ( rc = scsi_read_capacity_16 ( &scsi->blockdev ) ) != 0 ){
|
|
311
|
+ DBGC ( scsi, "SCSI %p could not READ CAPACITY (16): "
|
|
312
|
+ "%s\n", scsi, strerror ( rc ) );
|
303
|
313
|
return rc;
|
|
314
|
+ }
|
304
|
315
|
}
|
305
|
316
|
|
|
317
|
+ DBGC ( scsi, "SCSI %p using READ/WRITE (%d) commands\n", scsi,
|
|
318
|
+ ( ( scsi->blockdev.op == &scsi_operations_10 ) ? 10 : 16 ) );
|
|
319
|
+ DBGC ( scsi, "SCSI %p capacity is %ld MB (%#llx blocks)\n", scsi,
|
|
320
|
+ ( ( unsigned long ) ( scsi->blockdev.blocks >> 11 ) ),
|
|
321
|
+ scsi->blockdev.blocks );
|
|
322
|
+
|
306
|
323
|
return 0;
|
307
|
324
|
}
|