Commit c4f59ba5 authored by Jens Axboe's avatar Jens Axboe

[PATCH] ide tagged command queueing support

This enables tagged command queueing support in the ide layer again and
marks it as an experimental feature.
parent 60ac3a30
...@@ -258,6 +258,37 @@ CONFIG_IDEDMA_NEW_DRIVE_LISTINGS ...@@ -258,6 +258,37 @@ CONFIG_IDEDMA_NEW_DRIVE_LISTINGS
If in doubt, say N. If in doubt, say N.
CONFIG_BLK_DEV_IDE_TCQ
Support for tagged command queueing on ATA disk drives. This enables
the IDE layer to have multiple in-flight requests on hardware that
supports it. For now this includes the IBM Deskstar series drives,
such as the 22GXP, 75GXP, 40GV, 60GXP, and 120GXP (ie any Deskstar made
in the last couple of years), and at least some of the Western
Digital drives in the Expert series (by nature of really being IBM
drives).
If you have such a drive, say Y here.
CONFIG_BLK_DEV_IDE_TCQ_DEPTH
Maximum size of commands to enable per-drive. Any value between 1
and 32 is valid, with 32 being the maxium that the hardware supports.
You probably just want the default of 32 here. If you enter an invalid
number, the default value will be used.
CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
Enable tagged command queueing unconditionally on drives that report
support for it. Regardless of the chosen value here, tagging can be
controlled at run time:
echo "using_tcq:32" > /proc/ide/hdX/settings
where any value between 1-32 selects chosen queue depth and enables
TCQ, and 0 disables it. hdparm version 4.7 an above also support
TCQ manipulations.
Generally say Y here.
CONFIG_BLK_DEV_OFFBOARD CONFIG_BLK_DEV_OFFBOARD
Normally, IDE controllers built into the motherboard (on-board Normally, IDE controllers built into the motherboard (on-board
controllers) are assigned to ide0 and ide1 while those on add-in PCI controllers) are assigned to ide0 and ide1 while those on add-in PCI
...@@ -713,10 +744,10 @@ CONFIG_BLK_DEV_IDE_TCQ ...@@ -713,10 +744,10 @@ CONFIG_BLK_DEV_IDE_TCQ
Support for tagged command queueing on ATA disk drives. This enables Support for tagged command queueing on ATA disk drives. This enables
the IDE layer to have multiple in-flight requests on hardware that the IDE layer to have multiple in-flight requests on hardware that
supports it. For now this includes the IBM Deskstar series drives, supports it. For now this includes the IBM Deskstar series drives,
such as the 22GXP, 75GXP, 40GV, 60GXP, and 120GXP (ie any Deskstar made such as the 22GXP, 75GXP, 40GV, 60GXP, 120GXP, and 180GXP (ie any
in the last couple of years), and at least some of the Western Deskstar made in the last couple of years), and at least some of
Digital drives in the Expert series (by nature of really being IBM the Western Digital drives in the Expert series (by nature of really
drives). being IBM drives).
However, please, note that there are host chip controllers which will However, please, note that there are host chip controllers which will
not cooperate properly if TCQ is enabled. This may cause serious not cooperate properly if TCQ is enabled. This may cause serious
......
...@@ -36,6 +36,11 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then ...@@ -36,6 +36,11 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then
dep_bool ' Generic PCI IDE Chipset Support' CONFIG_BLK_DEV_GENERIC $CONFIG_BLK_DEV_IDEPCI dep_bool ' Generic PCI IDE Chipset Support' CONFIG_BLK_DEV_GENERIC $CONFIG_BLK_DEV_IDEPCI
bool ' Sharing PCI IDE interrupts support' CONFIG_IDEPCI_SHARE_IRQ bool ' Sharing PCI IDE interrupts support' CONFIG_IDEPCI_SHARE_IRQ
bool ' Generic PCI bus-master DMA support' CONFIG_BLK_DEV_IDEDMA_PCI bool ' Generic PCI bus-master DMA support' CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' ATA tagged command queueing (EXPERIMENTAL)' CONFIG_BLK_DEV_IDE_TCQ $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_EXPERIMENTAL
dep_bool ' TCQ on by default' CONFIG_BLK_DEV_IDE_TCQ_DEFAULT $CONFIG_BLK_DEV_IDE_TCQ
if [ "$CONFIG_BLK_DEV_IDE_TCQ" != "n" ]; then
int ' Default queue depth' CONFIG_BLK_DEV_IDE_TCQ_DEPTH 8
fi
bool ' Boot off-board chipsets first support' CONFIG_BLK_DEV_OFFBOARD bool ' Boot off-board chipsets first support' CONFIG_BLK_DEV_OFFBOARD
dep_bool ' Force enable legacy 2.0.X HOSTS to use DMA' CONFIG_BLK_DEV_IDEDMA_FORCED $CONFIG_BLK_DEV_IDEDMA_PCI dep_bool ' Force enable legacy 2.0.X HOSTS to use DMA' CONFIG_BLK_DEV_IDEDMA_FORCED $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' Use PCI DMA by default when available' CONFIG_IDEDMA_PCI_AUTO $CONFIG_BLK_DEV_IDEDMA_PCI dep_bool ' Use PCI DMA by default when available' CONFIG_IDEDMA_PCI_AUTO $CONFIG_BLK_DEV_IDEDMA_PCI
......
...@@ -22,6 +22,7 @@ obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o ...@@ -22,6 +22,7 @@ obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o
obj-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o obj-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o
obj-$(CONFIG_BLK_DEV_IDEDMA_PCI) += ide-dma.o obj-$(CONFIG_BLK_DEV_IDEDMA_PCI) += ide-dma.o
obj-$(CONFIG_BLK_DEV_IDE_TCQ) += ide-tcq.o
obj-$(CONFIG_BLK_DEV_ISAPNP) += ide-pnp.o obj-$(CONFIG_BLK_DEV_ISAPNP) += ide-pnp.o
ifeq ($(CONFIG_BLK_DEV_IDE),y) ifeq ($(CONFIG_BLK_DEV_IDE),y)
......
...@@ -352,6 +352,19 @@ static ide_startstop_t multwrite_intr (ide_drive_t *drive) ...@@ -352,6 +352,19 @@ static ide_startstop_t multwrite_intr (ide_drive_t *drive)
return DRIVER(drive)->error(drive, "multwrite_intr", stat); return DRIVER(drive)->error(drive, "multwrite_intr", stat);
} }
static int idedisk_start_tag(ide_drive_t *drive, struct request *rq)
{
unsigned long flags;
int ret = 1;
spin_lock_irqsave(&ide_lock, flags);
if (ata_pending_commands(drive) < drive->queue_depth)
ret = blk_queue_start_tag(&drive->queue, rq);
spin_unlock_irqrestore(&ide_lock, flags);
return ret;
}
/* /*
* do_rw_disk() issues READ and WRITE commands to a disk, * do_rw_disk() issues READ and WRITE commands to a disk,
...@@ -375,6 +388,13 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig ...@@ -375,6 +388,13 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
return promise_rw_disk(drive, rq, block); return promise_rw_disk(drive, rq, block);
#endif /* CONFIG_BLK_DEV_PDC4030 */ #endif /* CONFIG_BLK_DEV_PDC4030 */
if (drive->using_tcq && idedisk_start_tag(drive, rq)) {
if (!ata_pending_commands(drive))
BUG();
return ide_started;
}
if (IDE_CONTROL_REG) if (IDE_CONTROL_REG)
hwif->OUTB(drive->ctl, IDE_CONTROL_REG); hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
...@@ -382,10 +402,18 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig ...@@ -382,10 +402,18 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
if (drive->addressing == 1) { if (drive->addressing == 1) {
task_ioreg_t tasklets[10]; task_ioreg_t tasklets[10];
if (blk_rq_tagged(rq)) {
tasklets[0] = nsectors.b.low;
tasklets[1] = nsectors.b.high;
tasklets[2] = rq->tag << 3;
tasklets[3] = 0;
} else {
tasklets[0] = 0; tasklets[0] = 0;
tasklets[1] = 0; tasklets[1] = 0;
tasklets[2] = nsectors.b.low; tasklets[2] = nsectors.b.low;
tasklets[3] = nsectors.b.high; tasklets[3] = nsectors.b.high;
}
tasklets[4] = (task_ioreg_t) block; tasklets[4] = (task_ioreg_t) block;
tasklets[5] = (task_ioreg_t) (block>>8); tasklets[5] = (task_ioreg_t) (block>>8);
tasklets[6] = (task_ioreg_t) (block>>16); tasklets[6] = (task_ioreg_t) (block>>16);
...@@ -398,7 +426,7 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig ...@@ -398,7 +426,7 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
printk("%s: %sing: LBAsect=%lu, sectors=%ld, " printk("%s: %sing: LBAsect=%lu, sectors=%ld, "
"buffer=0x%08lx, LBAsect=0x%012lx\n", "buffer=0x%08lx, LBAsect=0x%012lx\n",
drive->name, drive->name,
(rq->cmd==READ)?"read":"writ", rq_data_dir(rq)==READ?"read":"writ",
block, block,
rq->nr_sectors, rq->nr_sectors,
(unsigned long) rq->buffer, (unsigned long) rq->buffer,
...@@ -422,14 +450,20 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig ...@@ -422,14 +450,20 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
hwif->OUTB(0x00|drive->select.all,IDE_SELECT_REG); hwif->OUTB(0x00|drive->select.all,IDE_SELECT_REG);
} else { } else {
#ifdef DEBUG #ifdef DEBUG
printk("%s: %sing: LBAsect=%ld, sectors=%ld, " printk("%s: %sing: LBAsect=%ld, sectors=%d, "
"buffer=0x%08lx\n", "buffer=0x%08lx\n",
drive->name, (rq->cmd==READ)?"read":"writ", drive->name,rq_data_dir(rq)==READ?"read":"writ",
block, rq->nr_sectors, block, nsectors.b.low,
(unsigned long) rq->buffer); (unsigned long) rq->buffer);
#endif #endif
if (blk_rq_tagged(rq)) {
hwif->OUTB(nsectors.b.low, IDE_FEATURE_REG);
hwif->OUTB(rq->tag << 3, IDE_NSECTOR_REG);
} else {
hwif->OUTB(0x00, IDE_FEATURE_REG); hwif->OUTB(0x00, IDE_FEATURE_REG);
hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG); hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG);
}
hwif->OUTB(block, IDE_SECTOR_REG); hwif->OUTB(block, IDE_SECTOR_REG);
hwif->OUTB(block>>=8, IDE_LCYL_REG); hwif->OUTB(block>>=8, IDE_LCYL_REG);
hwif->OUTB(block>>=8, IDE_HCYL_REG); hwif->OUTB(block>>=8, IDE_HCYL_REG);
...@@ -443,23 +477,31 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig ...@@ -443,23 +477,31 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
head = track % drive->head; head = track % drive->head;
cyl = track / drive->head; cyl = track / drive->head;
if (blk_rq_tagged(rq)) {
hwif->OUTB(nsectors.b.low, IDE_FEATURE_REG);
hwif->OUTB(rq->tag << 3, IDE_NSECTOR_REG);
} else {
hwif->OUTB(0x00, IDE_FEATURE_REG); hwif->OUTB(0x00, IDE_FEATURE_REG);
hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG); hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG);
}
hwif->OUTB(cyl, IDE_LCYL_REG); hwif->OUTB(cyl, IDE_LCYL_REG);
hwif->OUTB(cyl>>8, IDE_HCYL_REG); hwif->OUTB(cyl>>8, IDE_HCYL_REG);
hwif->OUTB(head|drive->select.all,IDE_SELECT_REG); hwif->OUTB(head|drive->select.all,IDE_SELECT_REG);
#ifdef DEBUG #ifdef DEBUG
printk("%s: %sing: CHS=%d/%d/%d, sectors=%ld, buffer=0x%08lx\n", printk("%s: %sing: CHS=%d/%d/%d, sectors=%ld, buffer=0x%08lx\n",
drive->name, (rq->cmd==READ)?"read":"writ", cyl, drive->name, rq_data_dir(rq)==READ?"read":"writ", cyl,
head, sect, rq->nr_sectors, (unsigned long) rq->buffer); head, sect, rq->nr_sectors, (unsigned long) rq->buffer);
#endif #endif
} }
if (rq_data_dir(rq) == READ) { if (rq_data_dir(rq) == READ) {
#ifdef CONFIG_BLK_DEV_IDEDMA if (blk_rq_tagged(rq))
return hwif->ide_dma_queued_read(drive);
if (drive->using_dma && !hwif->ide_dma_read(drive)) if (drive->using_dma && !hwif->ide_dma_read(drive))
return ide_started; return ide_started;
#endif /* CONFIG_BLK_DEV_IDEDMA */
if (HWGROUP(drive)->handler != NULL) if (HWGROUP(drive)->handler != NULL)
BUG(); BUG();
ide_set_handler(drive, &read_intr, WAIT_CMD, NULL); ide_set_handler(drive, &read_intr, WAIT_CMD, NULL);
...@@ -471,10 +513,12 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig ...@@ -471,10 +513,12 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
return ide_started; return ide_started;
} else if (rq_data_dir(rq) == WRITE) { } else if (rq_data_dir(rq) == WRITE) {
ide_startstop_t startstop; ide_startstop_t startstop;
#ifdef CONFIG_BLK_DEV_IDEDMA
if (blk_rq_tagged(rq))
return hwif->ide_dma_queued_write(drive);
if (drive->using_dma && !(HWIF(drive)->ide_dma_write(drive))) if (drive->using_dma && !(HWIF(drive)->ide_dma_write(drive)))
return ide_started; return ide_started;
#endif /* CONFIG_BLK_DEV_IDEDMA */
command = ((drive->mult_count) ? command = ((drive->mult_count) ?
((lba48) ? WIN_MULTWRITE_EXT : WIN_MULTWRITE) : ((lba48) ? WIN_MULTWRITE_EXT : WIN_MULTWRITE) :
...@@ -562,6 +606,13 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig ...@@ -562,6 +606,13 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
return promise_rw_disk(drive, rq, block); return promise_rw_disk(drive, rq, block);
#endif /* CONFIG_BLK_DEV_PDC4030 */ #endif /* CONFIG_BLK_DEV_PDC4030 */
if (drive->using_tcq && idedisk_start_tag(drive, rq)) {
if (!ata_pending_commands(drive))
BUG();
return ide_started;
}
if (drive->addressing == 1) /* 48-bit LBA */ if (drive->addressing == 1) /* 48-bit LBA */
return lba_48_rw_disk(drive, rq, (unsigned long long) block); return lba_48_rw_disk(drive, rq, (unsigned long long) block);
if (drive->select.b.lba) /* 28-bit LBA */ if (drive->select.b.lba) /* 28-bit LBA */
...@@ -579,12 +630,16 @@ static task_ioreg_t get_command (ide_drive_t *drive, int cmd) ...@@ -579,12 +630,16 @@ static task_ioreg_t get_command (ide_drive_t *drive, int cmd)
lba48bit = (drive->addressing == 1) ? 1 : 0; lba48bit = (drive->addressing == 1) ? 1 : 0;
#endif #endif
if ((cmd == READ) && drive->using_tcq)
return lba48bit ? WIN_READDMA_QUEUED_EXT : WIN_READDMA_QUEUED;
if ((cmd == READ) && (drive->using_dma)) if ((cmd == READ) && (drive->using_dma))
return (lba48bit) ? WIN_READDMA_EXT : WIN_READDMA; return (lba48bit) ? WIN_READDMA_EXT : WIN_READDMA;
else if ((cmd == READ) && (drive->mult_count)) else if ((cmd == READ) && (drive->mult_count))
return (lba48bit) ? WIN_MULTREAD_EXT : WIN_MULTREAD; return (lba48bit) ? WIN_MULTREAD_EXT : WIN_MULTREAD;
else if (cmd == READ) else if (cmd == READ)
return (lba48bit) ? WIN_READ_EXT : WIN_READ; return (lba48bit) ? WIN_READ_EXT : WIN_READ;
else if ((cmd == WRITE) && drive->using_tcq)
return lba48bit ? WIN_WRITEDMA_QUEUED_EXT : WIN_WRITEDMA_QUEUED;
else if ((cmd == WRITE) && (drive->using_dma)) else if ((cmd == WRITE) && (drive->using_dma))
return (lba48bit) ? WIN_WRITEDMA_EXT : WIN_WRITEDMA; return (lba48bit) ? WIN_WRITEDMA_EXT : WIN_WRITEDMA;
else if ((cmd == WRITE) && (drive->mult_count)) else if ((cmd == WRITE) && (drive->mult_count))
...@@ -618,7 +673,13 @@ static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct request *rq, unsi ...@@ -618,7 +673,13 @@ static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct request *rq, unsi
memset(&args, 0, sizeof(ide_task_t)); memset(&args, 0, sizeof(ide_task_t));
sectors = (rq->nr_sectors == 256) ? 0x00 : rq->nr_sectors; sectors = (rq->nr_sectors == 256) ? 0x00 : rq->nr_sectors;
if (blk_rq_tagged(rq)) {
args.tfRegister[IDE_FEATURE_OFFSET] = sectors;
args.tfRegister[IDE_NSECTOR_OFFSET] = rq->tag << 3;
} else
args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; args.tfRegister[IDE_NSECTOR_OFFSET] = sectors;
args.tfRegister[IDE_SECTOR_OFFSET] = sect; args.tfRegister[IDE_SECTOR_OFFSET] = sect;
args.tfRegister[IDE_LCYL_OFFSET] = cyl; args.tfRegister[IDE_LCYL_OFFSET] = cyl;
args.tfRegister[IDE_HCYL_OFFSET] = (cyl>>8); args.tfRegister[IDE_HCYL_OFFSET] = (cyl>>8);
...@@ -650,7 +711,13 @@ static ide_startstop_t lba_28_rw_disk (ide_drive_t *drive, struct request *rq, u ...@@ -650,7 +711,13 @@ static ide_startstop_t lba_28_rw_disk (ide_drive_t *drive, struct request *rq, u
memset(&args, 0, sizeof(ide_task_t)); memset(&args, 0, sizeof(ide_task_t));
sectors = (rq->nr_sectors == 256) ? 0x00 : rq->nr_sectors; sectors = (rq->nr_sectors == 256) ? 0x00 : rq->nr_sectors;
if (blk_rq_tagged(rq)) {
args.tfRegister[IDE_FEATURE_OFFSET] = sectors;
args.tfRegister[IDE_NSECTOR_OFFSET] = rq->tag << 3;
} else
args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; args.tfRegister[IDE_NSECTOR_OFFSET] = sectors;
args.tfRegister[IDE_SECTOR_OFFSET] = block; args.tfRegister[IDE_SECTOR_OFFSET] = block;
args.tfRegister[IDE_LCYL_OFFSET] = (block>>=8); args.tfRegister[IDE_LCYL_OFFSET] = (block>>=8);
args.tfRegister[IDE_HCYL_OFFSET] = (block>>=8); args.tfRegister[IDE_HCYL_OFFSET] = (block>>=8);
...@@ -688,13 +755,22 @@ static ide_startstop_t lba_48_rw_disk (ide_drive_t *drive, struct request *rq, u ...@@ -688,13 +755,22 @@ static ide_startstop_t lba_48_rw_disk (ide_drive_t *drive, struct request *rq, u
memset(&args, 0, sizeof(ide_task_t)); memset(&args, 0, sizeof(ide_task_t));
sectors = (rq->nr_sectors == 65536) ? 0 : rq->nr_sectors; sectors = (rq->nr_sectors == 65536) ? 0 : rq->nr_sectors;
if (blk_rq_tagged(rq)) {
args.tfRegister[IDE_FEATURE_OFFSET] = sectors;
args.tfRegister[IDE_NSECTOR_OFFSET] = rq->tag << 3;
args.hobRegister[IDE_FEATURE_OFFSET_HOB] = sectors >> 8;
args.hobRegister[IDE_NSECT_OFFSET_HOB] = 0;
} else {
args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; args.tfRegister[IDE_NSECTOR_OFFSET] = sectors;
args.hobRegister[IDE_NSECTOR_OFFSET_HOB] = sectors >> 8;
}
args.tfRegister[IDE_SECTOR_OFFSET] = block; /* low lba */ args.tfRegister[IDE_SECTOR_OFFSET] = block; /* low lba */
args.tfRegister[IDE_LCYL_OFFSET] = (block>>=8); /* mid lba */ args.tfRegister[IDE_LCYL_OFFSET] = (block>>=8); /* mid lba */
args.tfRegister[IDE_HCYL_OFFSET] = (block>>=8); /* hi lba */ args.tfRegister[IDE_HCYL_OFFSET] = (block>>=8); /* hi lba */
args.tfRegister[IDE_SELECT_OFFSET] = drive->select.all; args.tfRegister[IDE_SELECT_OFFSET] = drive->select.all;
args.tfRegister[IDE_COMMAND_OFFSET] = command; args.tfRegister[IDE_COMMAND_OFFSET] = command;
args.hobRegister[IDE_NSECTOR_OFFSET_HOB]= sectors >> 8;
args.hobRegister[IDE_SECTOR_OFFSET_HOB] = (block>>=8); /* low lba */ args.hobRegister[IDE_SECTOR_OFFSET_HOB] = (block>>=8); /* low lba */
args.hobRegister[IDE_LCYL_OFFSET_HOB] = (block>>=8); /* mid lba */ args.hobRegister[IDE_LCYL_OFFSET_HOB] = (block>>=8); /* mid lba */
args.hobRegister[IDE_HCYL_OFFSET_HOB] = (block>>=8); /* hi lba */ args.hobRegister[IDE_HCYL_OFFSET_HOB] = (block>>=8); /* hi lba */
...@@ -1460,6 +1536,37 @@ static int set_acoustic (ide_drive_t *drive, int arg) ...@@ -1460,6 +1536,37 @@ static int set_acoustic (ide_drive_t *drive, int arg)
return 0; return 0;
} }
#ifdef CONFIG_BLK_DEV_IDE_TCQ
static int set_using_tcq(ide_drive_t *drive, int arg)
{
ide_hwif_t *hwif = HWIF(drive);
int ret;
if (!drive->driver)
return -EPERM;
if (!hwif->ide_dma_queued_on || !hwif->ide_dma_queued_off)
return -ENXIO;
if (arg == drive->queue_depth && drive->using_tcq)
return 0;
/*
* set depth, but check also id for max supported depth
*/
drive->queue_depth = arg ? arg : 1;
if (drive->id) {
if (drive->queue_depth > drive->id->queue_depth + 1)
drive->queue_depth = drive->id->queue_depth + 1;
}
if (arg)
ret = HWIF(drive)->ide_dma_queued_on(drive);
else
ret = HWIF(drive)->ide_dma_queued_off(drive);
return ret ? -EIO : 0;
}
#endif
static int probe_lba_addressing (ide_drive_t *drive, int arg) static int probe_lba_addressing (ide_drive_t *drive, int arg)
{ {
drive->addressing = 0; drive->addressing = 0;
...@@ -1494,6 +1601,9 @@ static void idedisk_add_settings(ide_drive_t *drive) ...@@ -1494,6 +1601,9 @@ static void idedisk_add_settings(ide_drive_t *drive)
ide_add_setting(drive, "acoustic", SETTING_RW, HDIO_GET_ACOUSTIC, HDIO_SET_ACOUSTIC, TYPE_BYTE, 0, 254, 1, 1, &drive->acoustic, set_acoustic); ide_add_setting(drive, "acoustic", SETTING_RW, HDIO_GET_ACOUSTIC, HDIO_SET_ACOUSTIC, TYPE_BYTE, 0, 254, 1, 1, &drive->acoustic, set_acoustic);
ide_add_setting(drive, "failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->failures, NULL); ide_add_setting(drive, "failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->failures, NULL);
ide_add_setting(drive, "max_failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->max_failures, NULL); ide_add_setting(drive, "max_failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->max_failures, NULL);
#ifdef CONFIG_BLK_DEV_IDE_TCQ
ide_add_setting(drive, "using_tcq", SETTING_RW, HDIO_GET_QDMA, HDIO_SET_QDMA, TYPE_BYTE, 0, IDE_MAX_TAG, 1, 1, &drive->using_tcq, set_using_tcq);
#endif
} }
static int idedisk_suspend(struct device *dev, u32 state, u32 level) static int idedisk_suspend(struct device *dev, u32 state, u32 level)
......
...@@ -461,7 +461,14 @@ int __ide_dma_off_quietly (ide_drive_t *drive) ...@@ -461,7 +461,14 @@ int __ide_dma_off_quietly (ide_drive_t *drive)
{ {
drive->using_dma = 0; drive->using_dma = 0;
ide_toggle_bounce(drive, 0); ide_toggle_bounce(drive, 0);
return HWIF(drive)->ide_dma_host_off(drive);
if (HWIF(drive)->ide_dma_host_off(drive))
return 1;
if (drive->queue_setup)
HWIF(drive)->ide_dma_queued_off(drive);
return 0;
} }
EXPORT_SYMBOL(__ide_dma_off_quietly); EXPORT_SYMBOL(__ide_dma_off_quietly);
...@@ -493,7 +500,14 @@ int __ide_dma_on (ide_drive_t *drive) ...@@ -493,7 +500,14 @@ int __ide_dma_on (ide_drive_t *drive)
{ {
drive->using_dma = 1; drive->using_dma = 1;
ide_toggle_bounce(drive, 1); ide_toggle_bounce(drive, 1);
return HWIF(drive)->ide_dma_host_on(drive);
if (HWIF(drive)->ide_dma_host_on(drive))
return 1;
if (drive->queue_setup)
HWIF(drive)->ide_dma_queued_on(drive);
return 0;
} }
EXPORT_SYMBOL(__ide_dma_on); EXPORT_SYMBOL(__ide_dma_on);
...@@ -505,50 +519,58 @@ int __ide_dma_check (ide_drive_t *drive) ...@@ -505,50 +519,58 @@ int __ide_dma_check (ide_drive_t *drive)
EXPORT_SYMBOL(__ide_dma_check); EXPORT_SYMBOL(__ide_dma_check);
int __ide_dma_read (ide_drive_t *drive /*, struct request *rq */) int ide_start_dma(ide_hwif_t *hwif, ide_drive_t *drive, int reading)
{ {
ide_hwif_t *hwif = HWIF(drive);
struct request *rq = HWGROUP(drive)->rq; struct request *rq = HWGROUP(drive)->rq;
// ide_task_t *args = rq->special; u8 dma_stat;
unsigned int reading = 1 << 3;
unsigned int count = 0;
u8 dma_stat = 0, lba48 = (drive->addressing == 1) ? 1 : 0;
task_ioreg_t command = WIN_NOP;
if (!(count = ide_build_dmatable(drive, rq))) /* fall back to pio! */
/* try PIO instead of DMA */ if (!ide_build_dmatable(drive, rq))
return 1; return 1;
/* PRD table */ /* PRD table */
hwif->OUTL(hwif->dmatable_dma, hwif->dma_prdtable); hwif->OUTL(hwif->dmatable_dma, hwif->dma_prdtable);
/* specify r/w */ /* specify r/w */
hwif->OUTB(reading, hwif->dma_command); hwif->OUTB(reading, hwif->dma_command);
/* read dma_status for INTR & ERROR flags */ /* read dma_status for INTR & ERROR flags */
dma_stat = hwif->INB(hwif->dma_status); dma_stat = hwif->INB(hwif->dma_status);
/* clear INTR & ERROR flags */ /* clear INTR & ERROR flags */
hwif->OUTB(dma_stat|6, hwif->dma_status); hwif->OUTB(dma_stat|6, hwif->dma_status);
drive->waiting_for_dma = 1; drive->waiting_for_dma = 1;
return 0;
}
EXPORT_SYMBOL(ide_start_dma);
int __ide_dma_read (ide_drive_t *drive /*, struct request *rq */)
{
ide_hwif_t *hwif = HWIF(drive);
struct request *rq = HWGROUP(drive)->rq;
unsigned int reading = 1 << 3;
u8 lba48 = (drive->addressing == 1) ? 1 : 0;
task_ioreg_t command = WIN_NOP;
/* try pio */
if (ide_start_dma(hwif, drive, reading))
return 1;
if (drive->media != ide_disk) if (drive->media != ide_disk)
return 0; return 0;
/* paranoia check */ /* paranoia check */
if (HWGROUP(drive)->handler != NULL) if (HWGROUP(drive)->handler != NULL)
BUG(); BUG();
ide_set_handler(drive, &ide_dma_intr, 2*WAIT_CMD, dma_timer_expiry); ide_set_handler(drive, &ide_dma_intr, 2*WAIT_CMD, dma_timer_expiry);
/*
* FIX ME to use only ACB ide_task_t args Struct
*/
#if 0
{
ide_task_t *args = rq->special;
command = args->tfRegister[IDE_COMMAND_OFFSET];
}
#else
command = (lba48) ? WIN_READDMA_EXT : WIN_READDMA; command = (lba48) ? WIN_READDMA_EXT : WIN_READDMA;
if (rq->flags & REQ_DRIVE_TASKFILE) { if (rq->flags & REQ_DRIVE_TASKFILE) {
ide_task_t *args = rq->special; ide_task_t *args = rq->special;
command = args->tfRegister[IDE_COMMAND_OFFSET]; command = args->tfRegister[IDE_COMMAND_OFFSET];
} }
#endif
/* issue cmd to drive */ /* issue cmd to drive */
hwif->OUTB(command, IDE_COMMAND_REG); hwif->OUTB(command, IDE_COMMAND_REG);
...@@ -561,47 +583,31 @@ int __ide_dma_write (ide_drive_t *drive /*, struct request *rq */) ...@@ -561,47 +583,31 @@ int __ide_dma_write (ide_drive_t *drive /*, struct request *rq */)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
struct request *rq = HWGROUP(drive)->rq; struct request *rq = HWGROUP(drive)->rq;
// ide_task_t *args = rq->special;
unsigned int reading = 0; unsigned int reading = 0;
unsigned int count = 0; u8 lba48 = (drive->addressing == 1) ? 1 : 0;
u8 dma_stat = 0, lba48 = (drive->addressing == 1) ? 1 : 0;
task_ioreg_t command = WIN_NOP; task_ioreg_t command = WIN_NOP;
if (!(count = ide_build_dmatable(drive, rq)))
/* try PIO instead of DMA */ /* try PIO instead of DMA */
if (ide_start_dma(hwif, drive, reading))
return 1; return 1;
/* PRD table */
hwif->OUTL(hwif->dmatable_dma, hwif->dma_prdtable);
/* specify r/w */
hwif->OUTB(reading, hwif->dma_command);
/* read dma_status for INTR & ERROR flags */
dma_stat = hwif->INB(hwif->dma_status);
/* clear INTR & ERROR flags */
hwif->OUTB(dma_stat|6, hwif->dma_status);
drive->waiting_for_dma = 1;
if (drive->media != ide_disk) if (drive->media != ide_disk)
return 0; return 0;
/* paranoia check */ /* paranoia check */
if (HWGROUP(drive)->handler != NULL) if (HWGROUP(drive)->handler != NULL)
BUG(); BUG();
ide_set_handler(drive, &ide_dma_intr, 2*WAIT_CMD, dma_timer_expiry); ide_set_handler(drive, &ide_dma_intr, 2*WAIT_CMD, dma_timer_expiry);
/*
* FIX ME to use only ACB ide_task_t args Struct
*/
#if 0
{
ide_task_t *args = rq->special;
command = args->tfRegister[IDE_COMMAND_OFFSET];
}
#else
command = (lba48) ? WIN_WRITEDMA_EXT : WIN_WRITEDMA; command = (lba48) ? WIN_WRITEDMA_EXT : WIN_WRITEDMA;
if (rq->flags & REQ_DRIVE_TASKFILE) { if (rq->flags & REQ_DRIVE_TASKFILE) {
ide_task_t *args = rq->special; ide_task_t *args = rq->special;
command = args->tfRegister[IDE_COMMAND_OFFSET]; command = args->tfRegister[IDE_COMMAND_OFFSET];
} }
#endif
/* issue cmd to drive */ /* issue cmd to drive */
hwif->OUTB(command, IDE_COMMAND_REG); hwif->OUTB(command, IDE_COMMAND_REG);
return HWIF(drive)->ide_dma_count(drive); return HWIF(drive)->ide_dma_count(drive);
} }
...@@ -619,6 +625,8 @@ int __ide_dma_begin (ide_drive_t *drive) ...@@ -619,6 +625,8 @@ int __ide_dma_begin (ide_drive_t *drive)
*/ */
/* start DMA */ /* start DMA */
hwif->OUTB(dma_cmd|1, hwif->dma_command); hwif->OUTB(dma_cmd|1, hwif->dma_command);
hwif->dma = 1;
wmb();
return 0; return 0;
} }
...@@ -642,6 +650,8 @@ int __ide_dma_end (ide_drive_t *drive) ...@@ -642,6 +650,8 @@ int __ide_dma_end (ide_drive_t *drive)
/* purge DMA mappings */ /* purge DMA mappings */
ide_destroy_dmatable(drive); ide_destroy_dmatable(drive);
/* verify good DMA status */ /* verify good DMA status */
hwif->dma = 0;
wmb();
return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0;
} }
...@@ -999,6 +1009,23 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p ...@@ -999,6 +1009,23 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p
if (!hwif->ide_dma_lostirq) if (!hwif->ide_dma_lostirq)
hwif->ide_dma_lostirq = &__ide_dma_lostirq; hwif->ide_dma_lostirq = &__ide_dma_lostirq;
/*
* dma queued ops. if tcq isn't set, queued on and off are just
* dummy functions. cuts down on ifdef hell
*/
if (!hwif->ide_dma_queued_on)
hwif->ide_dma_queued_on = __ide_dma_queued_on;
if (!hwif->ide_dma_queued_off)
hwif->ide_dma_queued_off = __ide_dma_queued_off;
#ifdef CONFIG_BLK_DEV_IDE_TCQ
if (!hwif->ide_dma_queued_read)
hwif->ide_dma_queued_read = __ide_dma_queued_read;
if (!hwif->ide_dma_queued_write)
hwif->ide_dma_queued_write = __ide_dma_queued_write;
if (!hwif->ide_dma_queued_start)
hwif->ide_dma_queued_start = __ide_dma_queued_start;
#endif
if (hwif->chipset != ide_trm290) { if (hwif->chipset != ide_trm290) {
u8 dma_stat = hwif->INB(hwif->dma_status); u8 dma_stat = hwif->INB(hwif->dma_status);
printk(", BIOS settings: %s:%s, %s:%s", printk(", BIOS settings: %s:%s, %s:%s",
......
...@@ -221,6 +221,17 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd) ...@@ -221,6 +221,17 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
drive->media = ide_disk; drive->media = ide_disk;
printk("%s DISK drive\n", (drive->is_flash) ? "CFA" : "ATA" ); printk("%s DISK drive\n", (drive->is_flash) ? "CFA" : "ATA" );
QUIRK_LIST(drive); QUIRK_LIST(drive);
/* Initialize queue depth settings */
drive->queue_depth = 1;
#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEPTH
drive->queue_depth = CONFIG_BLK_DEV_IDE_TCQ_DEPTH;
#else
drive->queue_depth = drive->id->queue_depth + 1;
#endif
if (drive->queue_depth < 1 || drive->queue_depth > IDE_MAX_TAG)
drive->queue_depth = IDE_MAX_TAG;
return; return;
err_misc: err_misc:
...@@ -776,6 +787,7 @@ static void ide_init_queue(ide_drive_t *drive) ...@@ -776,6 +787,7 @@ static void ide_init_queue(ide_drive_t *drive)
q->queuedata = HWGROUP(drive); q->queuedata = HWGROUP(drive);
blk_init_queue(q, do_ide_request, &ide_lock); blk_init_queue(q, do_ide_request, &ide_lock);
drive->queue_setup = 1;
blk_queue_segment_boundary(q, 0xffff); blk_queue_segment_boundary(q, 0xffff);
#ifdef CONFIG_BLK_DEV_PDC4030 #ifdef CONFIG_BLK_DEV_PDC4030
...@@ -792,6 +804,10 @@ static void ide_init_queue(ide_drive_t *drive) ...@@ -792,6 +804,10 @@ static void ide_init_queue(ide_drive_t *drive)
blk_queue_max_phys_segments(q, PRD_ENTRIES); blk_queue_max_phys_segments(q, PRD_ENTRIES);
ide_toggle_bounce(drive, 1); ide_toggle_bounce(drive, 1);
#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
HWIF(drive)->ide_dma_queued_on(drive);
#endif
} }
/* /*
...@@ -917,8 +933,11 @@ int init_irq (ide_hwif_t *hwif) ...@@ -917,8 +933,11 @@ int init_irq (ide_hwif_t *hwif)
hwgroup->drive = drive; hwgroup->drive = drive;
drive->next = hwgroup->drive->next; drive->next = hwgroup->drive->next;
hwgroup->drive->next = drive; hwgroup->drive->next = drive;
spin_unlock_irqrestore(&ide_lock, flags);
ide_init_queue(drive); ide_init_queue(drive);
spin_lock_irqsave(&ide_lock, flags);
} }
if (!hwgroup->hwif) { if (!hwgroup->hwif) {
hwgroup->hwif = HWIF(hwgroup->drive); hwgroup->hwif = HWIF(hwgroup->drive);
#ifdef DEBUG #ifdef DEBUG
......
...@@ -201,6 +201,12 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) ...@@ -201,6 +201,12 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
if (hwif->ide_dma_read(drive)) if (hwif->ide_dma_read(drive))
return ide_stopped; return ide_stopped;
break; break;
case WIN_READDMA_QUEUED:
case WIN_READDMA_QUEUED_EXT:
return hwif->ide_dma_queued_read(drive);
case WIN_WRITEDMA_QUEUED:
case WIN_WRITEDMA_QUEUED_EXT:
return hwif->ide_dma_queued_write(drive);
default: default:
if (task->handler == NULL) if (task->handler == NULL)
return ide_stopped; return ide_stopped;
......
This diff is collapsed.
...@@ -407,7 +407,10 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) ...@@ -407,7 +407,10 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors)
if (!end_that_request_first(rq, uptodate, nr_sectors)) { if (!end_that_request_first(rq, uptodate, nr_sectors)) {
add_blkdev_randomness(major(rq->rq_dev)); add_blkdev_randomness(major(rq->rq_dev));
if (!blk_rq_tagged(rq))
blkdev_dequeue_request(rq); blkdev_dequeue_request(rq);
else
blk_queue_end_tag(&drive->queue, rq);
HWGROUP(drive)->rq = NULL; HWGROUP(drive)->rq = NULL;
end_that_request_last(rq); end_that_request_last(rq);
ret = 0; ret = 0;
...@@ -1117,9 +1120,30 @@ void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) ...@@ -1117,9 +1120,30 @@ void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
drive->sleep = 0; drive->sleep = 0;
drive->service_start = jiffies; drive->service_start = jiffies;
BUG_ON(blk_queue_plugged(&drive->queue)); queue_next:
if (!ata_can_queue(drive)) {
if (!ata_pending_commands(drive))
hwgroup->busy = 0;
break;
}
if (blk_queue_plugged(&drive->queue)) {
if (drive->using_tcq)
break;
printk("ide: huh? queue was plugged!\n");
break;
}
rq = elv_next_request(&drive->queue);
if (!rq)
break;
if (!rq->bio && ata_pending_commands(drive))
break;
rq = hwgroup->rq = elv_next_request(&drive->queue); hwgroup->rq = rq;
/* /*
* Some systems have trouble with IDE IRQs arriving while * Some systems have trouble with IDE IRQs arriving while
...@@ -1138,6 +1162,8 @@ void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) ...@@ -1138,6 +1162,8 @@ void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
spin_lock_irq(&ide_lock); spin_lock_irq(&ide_lock);
if (masked_irq && hwif->irq != masked_irq) if (masked_irq && hwif->irq != masked_irq)
enable_irq(hwif->irq); enable_irq(hwif->irq);
if (startstop == ide_released)
goto queue_next;
if (startstop == ide_stopped) if (startstop == ide_stopped)
hwgroup->busy = 0; hwgroup->busy = 0;
} }
......
...@@ -212,14 +212,6 @@ typedef unsigned char byte; /* used everywhere */ ...@@ -212,14 +212,6 @@ typedef unsigned char byte; /* used everywhere */
#define PRD_BYTES 8 #define PRD_BYTES 8
#define PRD_ENTRIES (PAGE_SIZE / (2 * PRD_BYTES)) #define PRD_ENTRIES (PAGE_SIZE / (2 * PRD_BYTES))
/*
* sector count bits
*/
#define NSEC_CD 0x01
#define NSEC_IO 0x02
#define NSEC_REL 0x04
/* /*
* Our Physical Region Descriptor (PRD) table should be large enough * Our Physical Region Descriptor (PRD) table should be large enough
* to handle the biggest I/O request we are likely to see. Since requests * to handle the biggest I/O request we are likely to see. Since requests
...@@ -689,6 +681,15 @@ typedef union { ...@@ -689,6 +681,15 @@ typedef union {
} b; } b;
} atapi_select_t; } atapi_select_t;
/*
* Status returned from various ide_ functions
*/
typedef enum {
ide_stopped, /* no drive operation was started */
ide_started, /* a drive operation was started, handler was set */
ide_released, /* as ide_started, but bus also released */
} ide_startstop_t;
struct ide_driver_s; struct ide_driver_s;
struct ide_settings_s; struct ide_settings_s;
...@@ -746,6 +747,7 @@ typedef struct ide_drive_s { ...@@ -746,6 +747,7 @@ typedef struct ide_drive_s {
unsigned remap_0_to_1 : 2; /* 0=remap if ezdrive, 1=remap, 2=noremap */ unsigned remap_0_to_1 : 2; /* 0=remap if ezdrive, 1=remap, 2=noremap */
unsigned ata_flash : 1; /* 1=present, 0=default */ unsigned ata_flash : 1; /* 1=present, 0=default */
unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */
unsigned queue_setup : 1;
unsigned addressing; /* : 3; unsigned addressing; /* : 3;
* 0=28-bit * 0=28-bit
* 1=48-bit * 1=48-bit
...@@ -775,6 +777,7 @@ typedef struct ide_drive_s { ...@@ -775,6 +777,7 @@ typedef struct ide_drive_s {
u8 sect; /* "real" sectors per track */ u8 sect; /* "real" sectors per track */
u8 bios_head; /* BIOS/fdisk/LILO number of heads */ u8 bios_head; /* BIOS/fdisk/LILO number of heads */
u8 bios_sect; /* BIOS/fdisk/LILO sectors per track */ u8 bios_sect; /* BIOS/fdisk/LILO sectors per track */
u8 queue_depth; /* max queue depth */
unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */
unsigned int cyl; /* "real" number of cyls */ unsigned int cyl; /* "real" number of cyls */
...@@ -822,6 +825,12 @@ typedef struct ide_dma_ops_s { ...@@ -822,6 +825,12 @@ typedef struct ide_dma_ops_s {
int (*ide_dma_retune)(ide_drive_t *drive); int (*ide_dma_retune)(ide_drive_t *drive);
int (*ide_dma_lostirq)(ide_drive_t *drive); int (*ide_dma_lostirq)(ide_drive_t *drive);
int (*ide_dma_timeout)(ide_drive_t *drive); int (*ide_dma_timeout)(ide_drive_t *drive);
/* dma queued operations */
int (*ide_dma_queued_on)(ide_drive_t *drive);
int (*ide_dma_queued_off)(ide_drive_t *drive);
ide_startstop_t (*ide_dma_queued_read)(ide_drive_t *drive);
ide_startstop_t (*ide_dma_queued_write)(ide_drive_t *drive);
ide_startstop_t (*ide_dma_queued_start)(ide_drive_t *drive);
} ide_dma_ops_t; } ide_dma_ops_t;
/* /*
...@@ -958,6 +967,13 @@ typedef struct hwif_s { ...@@ -958,6 +967,13 @@ typedef struct hwif_s {
int (*ide_dma_retune)(ide_drive_t *drive); int (*ide_dma_retune)(ide_drive_t *drive);
int (*ide_dma_lostirq)(ide_drive_t *drive); int (*ide_dma_lostirq)(ide_drive_t *drive);
int (*ide_dma_timeout)(ide_drive_t *drive); int (*ide_dma_timeout)(ide_drive_t *drive);
/* dma queued operations */
int (*ide_dma_queued_on)(ide_drive_t *drive);
int (*ide_dma_queued_off)(ide_drive_t *drive);
ide_startstop_t (*ide_dma_queued_read)(ide_drive_t *drive);
ide_startstop_t (*ide_dma_queued_write)(ide_drive_t *drive);
ide_startstop_t (*ide_dma_queued_start)(ide_drive_t *drive);
#endif #endif
#if 0 #if 0
...@@ -1016,21 +1032,15 @@ typedef struct hwif_s { ...@@ -1016,21 +1032,15 @@ typedef struct hwif_s {
unsigned reset : 1; /* reset after probe */ unsigned reset : 1; /* reset after probe */
unsigned autodma : 1; /* auto-attempt using DMA at boot */ unsigned autodma : 1; /* auto-attempt using DMA at boot */
unsigned udma_four : 1; /* 1=ATA-66 capable, 0=default */ unsigned udma_four : 1; /* 1=ATA-66 capable, 0=default */
unsigned highmem : 1; /* can do full 32-bit dma */
unsigned no_dsc : 1; /* 0 default, 1 dsc_overlap disabled */ unsigned no_dsc : 1; /* 0 default, 1 dsc_overlap disabled */
unsigned auto_poll : 1; /* supports nop auto-poll */
struct device gendev; struct device gendev;
void *hwif_data; /* extra hwif data */ void *hwif_data; /* extra hwif data */
} ide_hwif_t;
/* unsigned dma;
* Status returned from various ide_ functions } ide_hwif_t;
*/
typedef enum {
ide_stopped, /* no drive operation was started */
ide_started /* a drive operation was started, handler was set */
} ide_startstop_t;
/* /*
* internal ide interrupt handler type * internal ide interrupt handler type
...@@ -1071,6 +1081,8 @@ typedef struct hwgroup_s { ...@@ -1071,6 +1081,8 @@ typedef struct hwgroup_s {
int (*expiry)(ide_drive_t *); int (*expiry)(ide_drive_t *);
/* ide_system_bus_speed */ /* ide_system_bus_speed */
int pio_clock; int pio_clock;
unsigned char cmd_buf[4];
} ide_hwgroup_t; } ide_hwgroup_t;
/* structure attached to the request for IDE_TASK_CMDS */ /* structure attached to the request for IDE_TASK_CMDS */
...@@ -1661,6 +1673,7 @@ extern void ide_destroy_dmatable(ide_drive_t *); ...@@ -1661,6 +1673,7 @@ extern void ide_destroy_dmatable(ide_drive_t *);
extern ide_startstop_t ide_dma_intr(ide_drive_t *); extern ide_startstop_t ide_dma_intr(ide_drive_t *);
extern int ide_release_dma(ide_hwif_t *); extern int ide_release_dma(ide_hwif_t *);
extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int); extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int);
extern int ide_start_dma(ide_hwif_t *, ide_drive_t *, int);
extern int __ide_dma_host_off(ide_drive_t *); extern int __ide_dma_host_off(ide_drive_t *);
extern int __ide_dma_off_quietly(ide_drive_t *); extern int __ide_dma_off_quietly(ide_drive_t *);
...@@ -1681,6 +1694,24 @@ extern int __ide_dma_retune(ide_drive_t *); ...@@ -1681,6 +1694,24 @@ extern int __ide_dma_retune(ide_drive_t *);
extern int __ide_dma_lostirq(ide_drive_t *); extern int __ide_dma_lostirq(ide_drive_t *);
extern int __ide_dma_timeout(ide_drive_t *); extern int __ide_dma_timeout(ide_drive_t *);
#ifdef CONFIG_BLK_DEV_IDE_TCQ
extern int __ide_dma_queued_on(ide_drive_t *drive);
extern int __ide_dma_queued_off(ide_drive_t *drive);
extern ide_startstop_t __ide_dma_queued_read(ide_drive_t *drive);
extern ide_startstop_t __ide_dma_queued_write(ide_drive_t *drive);
extern ide_startstop_t __ide_dma_queued_start(ide_drive_t *drive);
#else
static inline int __ide_dma_queued_on(ide_drive_t *drive)
{
return 1;
}
static inline int __ide_dma_queued_off(ide_drive_t *drive)
{
return 1;
}
#endif
extern void hwif_unregister(ide_hwif_t *); extern void hwif_unregister(ide_hwif_t *);
extern void export_ide_init_queue(ide_drive_t *); extern void export_ide_init_queue(ide_drive_t *);
...@@ -1708,6 +1739,28 @@ extern spinlock_t ide_lock; ...@@ -1708,6 +1739,28 @@ extern spinlock_t ide_lock;
#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable(); } while (0) #define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable(); } while (0)
#define IDE_MAX_TAG 32
#ifdef CONFIG_BLK_DEV_IDE_TCQ
static inline int ata_pending_commands(ide_drive_t *drive)
{
if (drive->using_tcq)
return blk_queue_tag_depth(&drive->queue);
return 0;
}
static inline int ata_can_queue(ide_drive_t *drive)
{
if (drive->using_tcq)
return blk_queue_tag_queue(&drive->queue);
return 1;
}
#else
#define ata_pending_commands(drive) (0)
#define ata_can_queue(drive) (1)
#endif
extern struct bus_type ide_bus_type; extern struct bus_type ide_bus_type;
#endif /* _IDE_H */ #endif /* _IDE_H */
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