Commit 3c642694 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Jeff Garzik

[PATCH] ide: TCQ initialization fixes

- do not enable TCQ in ide_init_drive(), its too early
- enable TCQ in __ide_dma_on() only if CONFIG_BLK_DEV_IDE_TCQ_DEFAULT=y
- try to enable TCQ only on disk drives
- correct check for two drives on one channel
parent ba1de12c
......@@ -523,7 +523,6 @@ int __ide_dma_off_quietly (ide_drive_t *drive)
if (HWIF(drive)->ide_dma_host_off(drive))
return 1;
if (drive->queue_setup)
HWIF(drive)->ide_dma_queued_off(drive);
return 0;
......@@ -585,8 +584,9 @@ int __ide_dma_on (ide_drive_t *drive)
if (HWIF(drive)->ide_dma_host_on(drive))
return 1;
if (drive->queue_setup)
#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
HWIF(drive)->ide_dma_queued_on(drive);
#endif
return 0;
}
......
......@@ -983,7 +983,6 @@ static void ide_init_queue(ide_drive_t *drive)
blk_init_queue(q, do_ide_request, &ide_lock);
q->queuedata = HWGROUP(drive);
drive->queue_setup = 1;
blk_queue_segment_boundary(q, 0xffff);
if (!hwif->rqsize)
......@@ -1005,10 +1004,6 @@ static void ide_init_queue(ide_drive_t *drive)
static void ide_init_drive(ide_drive_t *drive)
{
ide_toggle_bounce(drive, 1);
#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
HWIF(drive)->ide_dma_queued_on(drive);
#endif
}
/*
......
......@@ -501,8 +501,10 @@ static int ide_tcq_configure(ide_drive_t *drive)
* bit 14 and 1 must be set in word 83 of the device id to indicate
* support for dma queued protocol, and bit 15 must be cleared
*/
if ((drive->id->command_set_2 & tcq_bits) ^ tcq_mask)
if ((drive->id->command_set_2 & tcq_bits) ^ tcq_mask) {
printk(KERN_INFO "%s: TCQ not supported\n", drive->name);
return -EIO;
}
args = kmalloc(sizeof(*args), GFP_ATOMIC);
if (!args)
......@@ -655,21 +657,24 @@ static int ide_tcq_check_blacklist(ide_drive_t *drive)
int __ide_dma_queued_on(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
if (drive->media != ide_disk)
return 1;
if (!drive->using_dma)
return 1;
if (HWIF(drive)->chipset == ide_pdc4030)
if (hwif->chipset == ide_pdc4030)
return 1;
if (ide_tcq_check_blacklist(drive)) {
printk(KERN_WARNING "%s: tcq forbidden by blacklist\n",
drive->name);
return 1;
}
if (drive->next != drive) {
if (hwif->drives[0].present && hwif->drives[1].present) {
printk(KERN_WARNING "%s: only one drive on a channel supported"
" for tcq\n", drive->name);
return 1;
}
if (ata_pending_commands(drive)) {
printk(KERN_WARNING "ide-tcq; can't toggle tcq feature on "
"busy drive\n");
......@@ -681,6 +686,8 @@ int __ide_dma_queued_on(ide_drive_t *drive)
int __ide_dma_queued_off(ide_drive_t *drive)
{
if (drive->media != ide_disk)
return 1;
if (ata_pending_commands(drive)) {
printk("ide-tcq; can't toggle tcq feature on busy drive\n");
return 1;
......
......@@ -726,7 +726,6 @@ typedef struct ide_drive_s {
unsigned ata_flash : 1; /* 1=present, 0=default */
unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */
unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */
unsigned queue_setup : 1;
unsigned addressing; /* : 3;
* 0=28-bit
* 1=48-bit
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment