aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/scsi_scan.c1
-rw-r--r--drivers/scsi/sd.c36
2 files changed, 28 insertions, 9 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index cca772624ae7..588611568d14 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -625,6 +625,7 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
625 case TYPE_MEDIUM_CHANGER: 625 case TYPE_MEDIUM_CHANGER:
626 case TYPE_ENCLOSURE: 626 case TYPE_ENCLOSURE:
627 case TYPE_COMM: 627 case TYPE_COMM:
628 case TYPE_RBC:
628 sdev->writeable = 1; 629 sdev->writeable = 1;
629 break; 630 break;
630 case TYPE_WORM: 631 case TYPE_WORM:
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 19afb25e44d3..bb8235598787 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1368,17 +1368,26 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname,
1368 */ 1368 */
1369static void 1369static void
1370sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, 1370sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
1371 struct scsi_request *SRpnt, unsigned char *buffer) { 1371 struct scsi_request *SRpnt, unsigned char *buffer)
1372{
1372 int len = 0, res; 1373 int len = 0, res;
1373 1374
1374 const int dbd = 0; /* DBD */ 1375 int dbd;
1375 const int modepage = 0x08; /* current values, cache page */ 1376 int modepage;
1376 struct scsi_mode_data data; 1377 struct scsi_mode_data data;
1377 struct scsi_sense_hdr sshdr; 1378 struct scsi_sense_hdr sshdr;
1378 1379
1379 if (sdkp->device->skip_ms_page_8) 1380 if (sdkp->device->skip_ms_page_8)
1380 goto defaults; 1381 goto defaults;
1381 1382
1383 if (sdkp->device->type == TYPE_RBC) {
1384 modepage = 6;
1385 dbd = 8;
1386 } else {
1387 modepage = 8;
1388 dbd = 0;
1389 }
1390
1382 /* cautiously ask */ 1391 /* cautiously ask */
1383 res = sd_do_mode_sense(SRpnt, dbd, modepage, buffer, 4, &data); 1392 res = sd_do_mode_sense(SRpnt, dbd, modepage, buffer, 4, &data);
1384 1393
@@ -1409,11 +1418,20 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
1409 "write back, no read (daft)" 1418 "write back, no read (daft)"
1410 }; 1419 };
1411 int ct = 0; 1420 int ct = 0;
1412 int offset = data.header_length + 1421 int offset = data.header_length + data.block_descriptor_length;
1413 data.block_descriptor_length + 2;
1414 1422
1415 sdkp->WCE = ((buffer[offset] & 0x04) != 0); 1423 if ((buffer[offset] & 0x3f) != modepage) {
1416 sdkp->RCD = ((buffer[offset] & 0x01) != 0); 1424 printk(KERN_ERR "%s: got wrong page\n", diskname);
1425 goto defaults;
1426 }
1427
1428 if (modepage == 8) {
1429 sdkp->WCE = ((buffer[offset + 2] & 0x04) != 0);
1430 sdkp->RCD = ((buffer[offset + 2] & 0x01) != 0);
1431 } else {
1432 sdkp->WCE = ((buffer[offset + 2] & 0x01) == 0);
1433 sdkp->RCD = 0;
1434 }
1417 1435
1418 ct = sdkp->RCD + 2*sdkp->WCE; 1436 ct = sdkp->RCD + 2*sdkp->WCE;
1419 1437
@@ -1533,7 +1551,7 @@ static int sd_probe(struct device *dev)
1533 int error; 1551 int error;
1534 1552
1535 error = -ENODEV; 1553 error = -ENODEV;
1536 if ((sdp->type != TYPE_DISK) && (sdp->type != TYPE_MOD)) 1554 if (sdp->type != TYPE_DISK && sdp->type != TYPE_MOD && sdp->type != TYPE_RBC)
1537 goto out; 1555 goto out;
1538 1556
1539 SCSI_LOG_HLQUEUE(3, printk("sd_attach: scsi device: <%d,%d,%d,%d>\n", 1557 SCSI_LOG_HLQUEUE(3, printk("sd_attach: scsi device: <%d,%d,%d,%d>\n",
@@ -1570,7 +1588,7 @@ static int sd_probe(struct device *dev)
1570 sdkp->openers = 0; 1588 sdkp->openers = 0;
1571 1589
1572 if (!sdp->timeout) { 1590 if (!sdp->timeout) {
1573 if (sdp->type == TYPE_DISK) 1591 if (sdp->type != TYPE_MOD)
1574 sdp->timeout = SD_TIMEOUT; 1592 sdp->timeout = SD_TIMEOUT;
1575 else 1593 else
1576 sdp->timeout = SD_MOD_TIMEOUT; 1594 sdp->timeout = SD_MOD_TIMEOUT;