aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-25 14:23:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-25 14:23:37 -0400
commita37f6b84c4f3d3ca61634a7b36bf64c6ea452271 (patch)
tree308105401c7c60f91903d6da78c938f1cc74578f
parent9d73777e500929b71dcfed16eec05f6760e345a6 (diff)
parentd7e2f36d9a92284754ed5254562766cb3d61c7ca (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6: ide cs5520: Initialize second port's interrupt number. ide: improve handling of Power Management requests ide: add QUANTUM FIREBALLct20 30 with firmware APL.090 to ivb_list[] ide: relax DMA info validity checking ide-cd: Improve "weird block size" error message ide-cd: Don't warn on bogus block size unless it actually matters. ide: fix handling of unexpected IRQs vs request_irq()
-rw-r--r--drivers/ide/cs5520.c1
-rw-r--r--drivers/ide/ide-cd.c10
-rw-r--r--drivers/ide/ide-dma.c21
-rw-r--r--drivers/ide/ide-io.c54
-rw-r--r--drivers/ide/ide-iops.c4
-rw-r--r--drivers/ide/ide-probe.c23
-rw-r--r--include/linux/ide.h2
7 files changed, 50 insertions, 65 deletions
diff --git a/drivers/ide/cs5520.c b/drivers/ide/cs5520.c
index bd066bb9d611..09f98ed0731f 100644
--- a/drivers/ide/cs5520.c
+++ b/drivers/ide/cs5520.c
@@ -135,6 +135,7 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic
135 135
136 ide_pci_setup_ports(dev, d, &hw[0], &hws[0]); 136 ide_pci_setup_ports(dev, d, &hw[0], &hws[0]);
137 hw[0].irq = 14; 137 hw[0].irq = 14;
138 hw[1].irq = 15;
138 139
139 return ide_host_add(d, hws, 2, NULL); 140 return ide_host_add(d, hws, 2, NULL);
140} 141}
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 4a19686fcfe9..f0ede5953af8 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -876,9 +876,12 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
876 return stat; 876 return stat;
877 877
878 /* 878 /*
879 * Sanity check the given block size 879 * Sanity check the given block size, in so far as making
880 * sure the sectors_per_frame we give to the caller won't
881 * end up being bogus.
880 */ 882 */
881 blocklen = be32_to_cpu(capbuf.blocklen); 883 blocklen = be32_to_cpu(capbuf.blocklen);
884 blocklen = (blocklen >> SECTOR_BITS) << SECTOR_BITS;
882 switch (blocklen) { 885 switch (blocklen) {
883 case 512: 886 case 512:
884 case 1024: 887 case 1024:
@@ -886,10 +889,9 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
886 case 4096: 889 case 4096:
887 break; 890 break;
888 default: 891 default:
889 printk(KERN_ERR PFX "%s: weird block size %u\n", 892 printk_once(KERN_ERR PFX "%s: weird block size %u; "
893 "setting default block size to 2048\n",
890 drive->name, blocklen); 894 drive->name, blocklen);
891 printk(KERN_ERR PFX "%s: default to 2kb block size\n",
892 drive->name);
893 blocklen = 2048; 895 blocklen = 2048;
894 break; 896 break;
895 } 897 }
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 219e6fb78dc6..ee58c88dee5a 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -361,9 +361,6 @@ static int ide_tune_dma(ide_drive_t *drive)
361 if (__ide_dma_bad_drive(drive)) 361 if (__ide_dma_bad_drive(drive))
362 return 0; 362 return 0;
363 363
364 if (ide_id_dma_bug(drive))
365 return 0;
366
367 if (hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA) 364 if (hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA)
368 return config_drive_for_dma(drive); 365 return config_drive_for_dma(drive);
369 366
@@ -394,24 +391,6 @@ static int ide_dma_check(ide_drive_t *drive)
394 return -1; 391 return -1;
395} 392}
396 393
397int ide_id_dma_bug(ide_drive_t *drive)
398{
399 u16 *id = drive->id;
400
401 if (id[ATA_ID_FIELD_VALID] & 4) {
402 if ((id[ATA_ID_UDMA_MODES] >> 8) &&
403 (id[ATA_ID_MWDMA_MODES] >> 8))
404 goto err_out;
405 } else if ((id[ATA_ID_MWDMA_MODES] >> 8) &&
406 (id[ATA_ID_SWDMA_MODES] >> 8))
407 goto err_out;
408
409 return 0;
410err_out:
411 printk(KERN_ERR "%s: bad DMA info in identify block\n", drive->name);
412 return 1;
413}
414
415int ide_set_dma(ide_drive_t *drive) 394int ide_set_dma(ide_drive_t *drive)
416{ 395{
417 int rc; 396 int rc;
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 1059f809b809..93b7886a2d6e 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -476,10 +476,14 @@ void do_ide_request(struct request_queue *q)
476 476
477 if (!ide_lock_port(hwif)) { 477 if (!ide_lock_port(hwif)) {
478 ide_hwif_t *prev_port; 478 ide_hwif_t *prev_port;
479
480 WARN_ON_ONCE(hwif->rq);
481repeat: 479repeat:
482 prev_port = hwif->host->cur_port; 480 prev_port = hwif->host->cur_port;
481
482 if (drive->dev_flags & IDE_DFLAG_BLOCKED)
483 rq = hwif->rq;
484 else
485 WARN_ON_ONCE(hwif->rq);
486
483 if (drive->dev_flags & IDE_DFLAG_SLEEPING && 487 if (drive->dev_flags & IDE_DFLAG_SLEEPING &&
484 time_after(drive->sleep, jiffies)) { 488 time_after(drive->sleep, jiffies)) {
485 ide_unlock_port(hwif); 489 ide_unlock_port(hwif);
@@ -506,43 +510,29 @@ repeat:
506 hwif->cur_dev = drive; 510 hwif->cur_dev = drive;
507 drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); 511 drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED);
508 512
509 spin_unlock_irq(&hwif->lock); 513 if (rq == NULL) {
510 spin_lock_irq(q->queue_lock); 514 spin_unlock_irq(&hwif->lock);
511 /* 515 spin_lock_irq(q->queue_lock);
512 * we know that the queue isn't empty, but this can happen 516 /*
513 * if the q->prep_rq_fn() decides to kill a request 517 * we know that the queue isn't empty, but this can
514 */ 518 * happen if ->prep_rq_fn() decides to kill a request
515 if (!rq) 519 */
516 rq = blk_fetch_request(drive->queue); 520 rq = blk_fetch_request(drive->queue);
521 spin_unlock_irq(q->queue_lock);
522 spin_lock_irq(&hwif->lock);
517 523
518 spin_unlock_irq(q->queue_lock); 524 if (rq == NULL) {
519 spin_lock_irq(&hwif->lock); 525 ide_unlock_port(hwif);
520 526 goto out;
521 if (!rq) { 527 }
522 ide_unlock_port(hwif);
523 goto out;
524 } 528 }
525 529
526 /* 530 /*
527 * Sanity: don't accept a request that isn't a PM request 531 * Sanity: don't accept a request that isn't a PM request
528 * if we are currently power managed. This is very important as 532 * if we are currently power managed.
529 * blk_stop_queue() doesn't prevent the blk_fetch_request()
530 * above to return us whatever is in the queue. Since we call
531 * ide_do_request() ourselves, we end up taking requests while
532 * the queue is blocked...
533 *
534 * We let requests forced at head of queue with ide-preempt
535 * though. I hope that doesn't happen too much, hopefully not
536 * unless the subdriver triggers such a thing in its own PM
537 * state machine.
538 */ 533 */
539 if ((drive->dev_flags & IDE_DFLAG_BLOCKED) && 534 BUG_ON((drive->dev_flags & IDE_DFLAG_BLOCKED) &&
540 blk_pm_request(rq) == 0 && 535 blk_pm_request(rq) == 0);
541 (rq->cmd_flags & REQ_PREEMPT) == 0) {
542 /* there should be no pending command at this point */
543 ide_unlock_port(hwif);
544 goto plug_device;
545 }
546 536
547 hwif->rq = rq; 537 hwif->rq = rq;
548 538
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index fa047150a1c6..2892b242bbe1 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -210,6 +210,7 @@ EXPORT_SYMBOL_GPL(ide_in_drive_list);
210 */ 210 */
211static const struct drive_list_entry ivb_list[] = { 211static const struct drive_list_entry ivb_list[] = {
212 { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, 212 { "QUANTUM FIREBALLlct10 05" , "A03.0900" },
213 { "QUANTUM FIREBALLlct20 30" , "APL.0900" },
213 { "TSSTcorp CDDVDW SH-S202J" , "SB00" }, 214 { "TSSTcorp CDDVDW SH-S202J" , "SB00" },
214 { "TSSTcorp CDDVDW SH-S202J" , "SB01" }, 215 { "TSSTcorp CDDVDW SH-S202J" , "SB01" },
215 { "TSSTcorp CDDVDW SH-S202N" , "SB00" }, 216 { "TSSTcorp CDDVDW SH-S202N" , "SB00" },
@@ -329,9 +330,6 @@ int ide_driveid_update(ide_drive_t *drive)
329 330
330 kfree(id); 331 kfree(id);
331 332
332 if ((drive->dev_flags & IDE_DFLAG_USING_DMA) && ide_id_dma_bug(drive))
333 ide_dma_off(drive);
334
335 return 1; 333 return 1;
336out_err: 334out_err:
337 if (rc == 2) 335 if (rc == 2)
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 51af4eea0d36..1bb106f6221a 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -818,6 +818,24 @@ static int ide_port_setup_devices(ide_hwif_t *hwif)
818 return j; 818 return j;
819} 819}
820 820
821static void ide_host_enable_irqs(struct ide_host *host)
822{
823 ide_hwif_t *hwif;
824 int i;
825
826 ide_host_for_each_port(i, hwif, host) {
827 if (hwif == NULL)
828 continue;
829
830 /* clear any pending IRQs */
831 hwif->tp_ops->read_status(hwif);
832
833 /* unmask IRQs */
834 if (hwif->io_ports.ctl_addr)
835 hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
836 }
837}
838
821/* 839/*
822 * This routine sets up the IRQ for an IDE interface. 840 * This routine sets up the IRQ for an IDE interface.
823 */ 841 */
@@ -831,9 +849,6 @@ static int init_irq (ide_hwif_t *hwif)
831 if (irq_handler == NULL) 849 if (irq_handler == NULL)
832 irq_handler = ide_intr; 850 irq_handler = ide_intr;
833 851
834 if (io_ports->ctl_addr)
835 hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
836
837 if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif)) 852 if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif))
838 goto out_up; 853 goto out_up;
839 854
@@ -1404,6 +1419,8 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
1404 ide_port_tune_devices(hwif); 1419 ide_port_tune_devices(hwif);
1405 } 1420 }
1406 1421
1422 ide_host_enable_irqs(host);
1423
1407 ide_host_for_each_port(i, hwif, host) { 1424 ide_host_for_each_port(i, hwif, host) {
1408 if (hwif == NULL) 1425 if (hwif == NULL)
1409 continue; 1426 continue;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 95c6e00a72e8..cf1f3888067c 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1361,7 +1361,6 @@ int ide_in_drive_list(u16 *, const struct drive_list_entry *);
1361#ifdef CONFIG_BLK_DEV_IDEDMA 1361#ifdef CONFIG_BLK_DEV_IDEDMA
1362int ide_dma_good_drive(ide_drive_t *); 1362int ide_dma_good_drive(ide_drive_t *);
1363int __ide_dma_bad_drive(ide_drive_t *); 1363int __ide_dma_bad_drive(ide_drive_t *);
1364int ide_id_dma_bug(ide_drive_t *);
1365 1364
1366u8 ide_find_dma_mode(ide_drive_t *, u8); 1365u8 ide_find_dma_mode(ide_drive_t *, u8);
1367 1366
@@ -1402,7 +1401,6 @@ void ide_dma_lost_irq(ide_drive_t *);
1402ide_startstop_t ide_dma_timeout_retry(ide_drive_t *, int); 1401ide_startstop_t ide_dma_timeout_retry(ide_drive_t *, int);
1403 1402
1404#else 1403#else
1405static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
1406static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } 1404static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
1407static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; } 1405static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
1408static inline void ide_dma_off_quietly(ide_drive_t *drive) { ; } 1406static inline void ide_dma_off_quietly(ide_drive_t *drive) { ; }