aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-02-27 11:49:05 -0500
committerJeff Garzik <jeff@garzik.org>2006-02-27 11:49:05 -0500
commitcccc65a3b60edaf721cdee5a14f68ba009341822 (patch)
treea458d28f70cbe0e848596aad6005442a2621d388 /drivers/scsi
parentba70d0614728892b86b2be2f7eae0c696b436461 (diff)
parente95a9ec1bb66e07b138861c743192f06e7b3e4de (diff)
Merge branch 'master'
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/esp.c4
-rw-r--r--drivers/scsi/sata_sil.c52
-rw-r--r--drivers/scsi/sd.c20
3 files changed, 61 insertions, 15 deletions
diff --git a/drivers/scsi/esp.c b/drivers/scsi/esp.c
index f6900538be90..87a8c3d2072c 100644
--- a/drivers/scsi/esp.c
+++ b/drivers/scsi/esp.c
@@ -2068,14 +2068,12 @@ static int esp_reset(struct scsi_cmnd *SCptr)
2068{ 2068{
2069 struct esp *esp = (struct esp *) SCptr->device->host->hostdata; 2069 struct esp *esp = (struct esp *) SCptr->device->host->hostdata;
2070 2070
2071 spin_lock_irq(esp->ehost->host_lock);
2071 (void) esp_do_resetbus(esp); 2072 (void) esp_do_resetbus(esp);
2072
2073 spin_unlock_irq(esp->ehost->host_lock); 2073 spin_unlock_irq(esp->ehost->host_lock);
2074 2074
2075 wait_event(esp->reset_queue, (esp->resetting_bus == 0)); 2075 wait_event(esp->reset_queue, (esp->resetting_bus == 0));
2076 2076
2077 spin_lock_irq(esp->ehost->host_lock);
2078
2079 return SUCCESS; 2077 return SUCCESS;
2080} 2078}
2081 2079
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index e14ed4ebbeed..91ecf527bb8a 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -49,11 +49,13 @@
49#define DRV_VERSION "0.9" 49#define DRV_VERSION "0.9"
50 50
51enum { 51enum {
52 SIL_FLAG_RERR_ON_DMA_ACT = (1 << 29),
52 SIL_FLAG_MOD15WRITE = (1 << 30), 53 SIL_FLAG_MOD15WRITE = (1 << 30),
53 54
54 sil_3112 = 0, 55 sil_3112 = 0,
55 sil_3112_m15w = 1, 56 sil_3112_m15w = 1,
56 sil_3114 = 2, 57 sil_3512 = 2,
58 sil_3114 = 3,
57 59
58 SIL_FIFO_R0 = 0x40, 60 SIL_FIFO_R0 = 0x40,
59 SIL_FIFO_W0 = 0x41, 61 SIL_FIFO_W0 = 0x41,
@@ -90,7 +92,7 @@ static void sil_post_set_mode (struct ata_port *ap);
90static const struct pci_device_id sil_pci_tbl[] = { 92static const struct pci_device_id sil_pci_tbl[] = {
91 { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, 93 { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
92 { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, 94 { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
93 { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, 95 { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3512 },
94 { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 }, 96 { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 },
95 { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, 97 { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
96 { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, 98 { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
@@ -185,7 +187,8 @@ static const struct ata_port_info sil_port_info[] = {
185 .mwdma_mask = 0x07, /* mwdma0-2 */ 187 .mwdma_mask = 0x07, /* mwdma0-2 */
186 .udma_mask = 0x3f, /* udma0-5 */ 188 .udma_mask = 0x3f, /* udma0-5 */
187 .port_ops = &sil_ops, 189 .port_ops = &sil_ops,
188 }, /* sil_3112_15w - keep it sync'd w/ sil_3112 */ 190 },
191 /* sil_3112_15w - keep it sync'd w/ sil_3112 */
189 { 192 {
190 .sht = &sil_sht, 193 .sht = &sil_sht,
191 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 194 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
@@ -194,11 +197,24 @@ static const struct ata_port_info sil_port_info[] = {
194 .mwdma_mask = 0x07, /* mwdma0-2 */ 197 .mwdma_mask = 0x07, /* mwdma0-2 */
195 .udma_mask = 0x3f, /* udma0-5 */ 198 .udma_mask = 0x3f, /* udma0-5 */
196 .port_ops = &sil_ops, 199 .port_ops = &sil_ops,
197 }, /* sil_3114 */ 200 },
201 /* sil_3512 */
198 { 202 {
199 .sht = &sil_sht, 203 .sht = &sil_sht,
200 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 204 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
201 ATA_FLAG_MMIO, 205 ATA_FLAG_SRST | ATA_FLAG_MMIO |
206 SIL_FLAG_RERR_ON_DMA_ACT,
207 .pio_mask = 0x1f, /* pio0-4 */
208 .mwdma_mask = 0x07, /* mwdma0-2 */
209 .udma_mask = 0x3f, /* udma0-5 */
210 .port_ops = &sil_ops,
211 },
212 /* sil_3114 */
213 {
214 .sht = &sil_sht,
215 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
216 ATA_FLAG_MMIO |
217 SIL_FLAG_RERR_ON_DMA_ACT,
202 .pio_mask = 0x1f, /* pio0-4 */ 218 .pio_mask = 0x1f, /* pio0-4 */
203 .mwdma_mask = 0x07, /* mwdma0-2 */ 219 .mwdma_mask = 0x07, /* mwdma0-2 */
204 .udma_mask = 0x3f, /* udma0-5 */ 220 .udma_mask = 0x3f, /* udma0-5 */
@@ -215,12 +231,13 @@ static const struct {
215 unsigned long scr; /* SATA control register block */ 231 unsigned long scr; /* SATA control register block */
216 unsigned long sien; /* SATA Interrupt Enable register */ 232 unsigned long sien; /* SATA Interrupt Enable register */
217 unsigned long xfer_mode;/* data transfer mode register */ 233 unsigned long xfer_mode;/* data transfer mode register */
234 unsigned long sfis_cfg; /* SATA FIS reception config register */
218} sil_port[] = { 235} sil_port[] = {
219 /* port 0 ... */ 236 /* port 0 ... */
220 { 0x80, 0x8A, 0x00, 0x100, 0x148, 0xb4 }, 237 { 0x80, 0x8A, 0x00, 0x100, 0x148, 0xb4, 0x14c },
221 { 0xC0, 0xCA, 0x08, 0x180, 0x1c8, 0xf4 }, 238 { 0xC0, 0xCA, 0x08, 0x180, 0x1c8, 0xf4, 0x1cc },
222 { 0x280, 0x28A, 0x200, 0x300, 0x348, 0x2b4 }, 239 { 0x280, 0x28A, 0x200, 0x300, 0x348, 0x2b4, 0x34c },
223 { 0x2C0, 0x2CA, 0x208, 0x380, 0x3c8, 0x2f4 }, 240 { 0x2C0, 0x2CA, 0x208, 0x380, 0x3c8, 0x2f4, 0x3cc },
224 /* ... port 3 */ 241 /* ... port 3 */
225}; 242};
226 243
@@ -458,6 +475,23 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
458 dev_printk(KERN_WARNING, &pdev->dev, 475 dev_printk(KERN_WARNING, &pdev->dev,
459 "cache line size not set. Driver may not function\n"); 476 "cache line size not set. Driver may not function\n");
460 477
478 /* Apply R_ERR on DMA activate FIS errata workaround */
479 if (probe_ent->host_flags & SIL_FLAG_RERR_ON_DMA_ACT) {
480 int cnt;
481
482 for (i = 0, cnt = 0; i < probe_ent->n_ports; i++) {
483 tmp = readl(mmio_base + sil_port[i].sfis_cfg);
484 if ((tmp & 0x3) != 0x01)
485 continue;
486 if (!cnt)
487 dev_printk(KERN_INFO, &pdev->dev,
488 "Applying R_ERR on DMA activate "
489 "FIS errata fix\n");
490 writel(tmp & ~0x3, mmio_base + sil_port[i].sfis_cfg);
491 cnt++;
492 }
493 }
494
461 if (ent->driver_data == sil_3114) { 495 if (ent->driver_data == sil_3114) {
462 irq_mask = SIL_MASK_4PORT; 496 irq_mask = SIL_MASK_4PORT;
463 497
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 930db398d107..9d9872347f56 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -89,6 +89,11 @@
89#define SD_MAX_RETRIES 5 89#define SD_MAX_RETRIES 5
90#define SD_PASSTHROUGH_RETRIES 1 90#define SD_PASSTHROUGH_RETRIES 1
91 91
92/*
93 * Size of the initial data buffer for mode and read capacity data
94 */
95#define SD_BUF_SIZE 512
96
92static void scsi_disk_release(struct kref *kref); 97static void scsi_disk_release(struct kref *kref);
93 98
94struct scsi_disk { 99struct scsi_disk {
@@ -1239,7 +1244,7 @@ sd_do_mode_sense(struct scsi_device *sdp, int dbd, int modepage,
1239 1244
1240/* 1245/*
1241 * read write protect setting, if possible - called only in sd_revalidate_disk() 1246 * read write protect setting, if possible - called only in sd_revalidate_disk()
1242 * called with buffer of length 512 1247 * called with buffer of length SD_BUF_SIZE
1243 */ 1248 */
1244static void 1249static void
1245sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, 1250sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname,
@@ -1297,7 +1302,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname,
1297 1302
1298/* 1303/*
1299 * sd_read_cache_type - called only from sd_revalidate_disk() 1304 * sd_read_cache_type - called only from sd_revalidate_disk()
1300 * called with buffer of length 512 1305 * called with buffer of length SD_BUF_SIZE
1301 */ 1306 */
1302static void 1307static void
1303sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, 1308sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
@@ -1342,6 +1347,8 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
1342 1347
1343 /* Take headers and block descriptors into account */ 1348 /* Take headers and block descriptors into account */
1344 len += data.header_length + data.block_descriptor_length; 1349 len += data.header_length + data.block_descriptor_length;
1350 if (len > SD_BUF_SIZE)
1351 goto bad_sense;
1345 1352
1346 /* Get the data */ 1353 /* Get the data */
1347 res = sd_do_mode_sense(sdp, dbd, modepage, buffer, len, &data, &sshdr); 1354 res = sd_do_mode_sense(sdp, dbd, modepage, buffer, len, &data, &sshdr);
@@ -1354,6 +1361,12 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
1354 int ct = 0; 1361 int ct = 0;
1355 int offset = data.header_length + data.block_descriptor_length; 1362 int offset = data.header_length + data.block_descriptor_length;
1356 1363
1364 if (offset >= SD_BUF_SIZE - 2) {
1365 printk(KERN_ERR "%s: malformed MODE SENSE response",
1366 diskname);
1367 goto defaults;
1368 }
1369
1357 if ((buffer[offset] & 0x3f) != modepage) { 1370 if ((buffer[offset] & 0x3f) != modepage) {
1358 printk(KERN_ERR "%s: got wrong page\n", diskname); 1371 printk(KERN_ERR "%s: got wrong page\n", diskname);
1359 goto defaults; 1372 goto defaults;
@@ -1398,6 +1411,7 @@ defaults:
1398 diskname); 1411 diskname);
1399 sdkp->WCE = 0; 1412 sdkp->WCE = 0;
1400 sdkp->RCD = 0; 1413 sdkp->RCD = 0;
1414 sdkp->DPOFUA = 0;
1401} 1415}
1402 1416
1403/** 1417/**
@@ -1421,7 +1435,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
1421 if (!scsi_device_online(sdp)) 1435 if (!scsi_device_online(sdp))
1422 goto out; 1436 goto out;
1423 1437
1424 buffer = kmalloc(512, GFP_KERNEL | __GFP_DMA); 1438 buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL | __GFP_DMA);
1425 if (!buffer) { 1439 if (!buffer) {
1426 printk(KERN_WARNING "(sd_revalidate_disk:) Memory allocation " 1440 printk(KERN_WARNING "(sd_revalidate_disk:) Memory allocation "
1427 "failure.\n"); 1441 "failure.\n");