CONFIG_IDEDMA_PCI_AUTO=y
# CONFIG_IDEDMA_ONLYDISK is not set
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
CONFIG_BLK_DEV_OFFBOARD=y
CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
/*
* etrax_dma_intr() is the handler for disk read/write DMA interrupts
*/
-static ide_startstop_t etrax_dma_intr (ide_drive_t *drive)
+static ide_startstop_t etrax_dma_intr (struct ata_device *drive, struct request *rq)
{
int i, dma_stat;
byte stat;
stat = GET_STAT(); /* get drive status */
if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
if (!dma_stat) {
- struct request *rq;
- rq = HWGROUP(drive)->rq;
for (i = rq->nr_sectors; i > 0;) {
i -= rq->current_nr_sectors;
- ide_end_request(drive, 1);
+ ide_end_request(drive, rq, 1);
}
return ide_stopped;
}
CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_BLK_DEV_IDE_TCQ is not set
# CONFIG_BLK_DEV_IDE_TCQ_DEFAULT is not set
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_IDEDMA_PCI_AUTO is not set
# CONFIG_IDEDMA_ONLYDISK is not set
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set
# CONFIG_BLK_DEV_IDEDMA is not set
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set
# CONFIG_BLK_DEV_IDEDMA is not set
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set
# CONFIG_BLK_DEV_IDEDMA is not set
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_IDEDMA_ONLYDISK=y
CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_BLK_DEV_IDE_TCQ is not set
# CONFIG_BLK_DEV_IDE_TCQ_DEFAULT is not set
-# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
It is normally safe to answer Y; however, the default is N.
-CONFIG_IDEDMA_PCI_WIP
- If you enable this you will be able to use and test highly
- developmental projects. If you say N, the configurator will
- simply skip those options.
-
- It is SAFEST to say N to this question.
-
CONFIG_BLK_DEV_PDC_ADMA
Please read the comments at the top of <file:drivers/ide/ide-pci.c>.
dep_bool ' Use PCI DMA by default when available' CONFIG_IDEDMA_PCI_AUTO $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' Enable DMA only for disks ' CONFIG_IDEDMA_ONLYDISK $CONFIG_IDEDMA_PCI_AUTO
define_bool CONFIG_BLK_DEV_IDEDMA $CONFIG_BLK_DEV_IDEDMA_PCI
- dep_bool ' ATA Work(s) In Progress (EXPERIMENTAL)' CONFIG_IDEDMA_PCI_WIP $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_EXPERIMENTAL
- dep_bool ' Good-Bad DMA Model-Firmware (WIP)' CONFIG_IDEDMA_NEW_DRIVE_LISTINGS $CONFIG_IDEDMA_PCI_WIP
+ dep_bool ' Good-Bad DMA Model-Firmware (EXPERIMENTAL)' CONFIG_IDEDMA_NEW_DRIVE_LISTINGS $CONFIG_EXPERIMENTAL
dep_bool ' AEC62XX chipset support' CONFIG_BLK_DEV_AEC62XX $CONFIG_BLK_DEV_IDEDMA_PCI
dep_mbool ' AEC62XX Tuning support' CONFIG_AEC62XX_TUNING $CONFIG_BLK_DEV_AEC62XX
dep_bool ' ALI M15x3 chipset support' CONFIG_BLK_DEV_ALI15X3 $CONFIG_BLK_DEV_IDEDMA_PCI
- dep_mbool ' ALI M15x3 WDC support (DANGEROUS)' CONFIG_WDC_ALI15X3 $CONFIG_BLK_DEV_ALI15X3
+ dep_mbool ' ALI M15x3 WDC support (DANGEROUS)' CONFIG_WDC_ALI15X3 $CONFIG_BLK_DEV_ALI15X3 $CONFIG_EXPERIMENTAL
dep_bool ' AMD and nVidia chipset support' CONFIG_BLK_DEV_AMD74XX $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' CMD64X chipset support' CONFIG_BLK_DEV_CMD64X $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' CY82C693 chipset support' CONFIG_BLK_DEV_CY82C693 $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' Cyrix CS5530 MediaGX chipset support' CONFIG_BLK_DEV_CS5530 $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' HPT34X chipset support' CONFIG_BLK_DEV_HPT34X $CONFIG_BLK_DEV_IDEDMA_PCI
- dep_mbool ' HPT34X AUTODMA support (WIP)' CONFIG_HPT34X_AUTODMA $CONFIG_BLK_DEV_HPT34X $CONFIG_IDEDMA_PCI_WIP
+ dep_mbool ' HPT34X AUTODMA support (EXPERMENTAL)' CONFIG_HPT34X_AUTODMA $CONFIG_BLK_DEV_HPT34X $CONFIG_EXPERIMENTAL
dep_bool ' HPT366 chipset support' CONFIG_BLK_DEV_HPT366 $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' Intel and Efar (SMsC) chipset support' CONFIG_BLK_DEV_PIIX $CONFIG_BLK_DEV_IDEDMA_PCI
if [ "$CONFIG_MIPS_ITE8172" = "y" -o "$CONFIG_MIPS_IVR" = "y" ]; then
fi
dep_bool ' NS87415 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_NS87415 $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' OPTi 82C621 chipset enhanced support (EXPERIMENTAL)' CONFIG_BLK_DEV_OPTI621 $CONFIG_EXPERIMENTAL
- dep_mbool ' Pacific Digital A-DMA support (EXPERIMENTAL)' CONFIG_BLK_DEV_PDC_ADMA $CONFIG_IDEDMA_PCI_WIP
+ dep_mbool ' Pacific Digital A-DMA support (EXPERIMENTAL)' CONFIG_BLK_DEV_PDC_ADMA $CONFIG_EXPERIMENTAL
dep_bool ' PROMISE PDC202{46|62|65|67|68|69|70} support' CONFIG_BLK_DEV_PDC202XX $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' Special UDMA Feature' CONFIG_PDC202XX_BURST $CONFIG_BLK_DEV_PDC202XX
dep_bool ' Special FastTrak Feature' CONFIG_PDC202XX_FORCE $CONFIG_BLK_DEV_PDC202XX
if (id && (id->capability & 1) && drive->channel->autodma) {
/* Consult the list of known "bad" drives */
- if (ide_dmaproc(ide_dma_bad_drive, drive)) {
+ if (ide_dmaproc(ide_dma_bad_drive, drive, NULL)) {
dma_func = ide_dma_off;
goto fast_ata_pio;
}
if (dma_func != ide_dma_on)
goto no_dma_set;
}
- } else if (ide_dmaproc(ide_dma_good_drive, drive)) {
+ } else if (ide_dmaproc(ide_dma_good_drive, drive, NULL)) {
if (id->eide_dma_time > 150) {
goto no_dma_set;
}
no_dma_set:
aec62xx_tune_drive(drive, 5);
}
- return drive->channel->dmaproc(dma_func, drive);
+ return drive->channel->udma(dma_func, drive, NULL);
}
/*
* aec62xx_dmaproc() initiates/aborts (U)DMA read/write operations on a drive.
*/
-int aec62xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
+int aec62xx_dmaproc (ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
switch (func) {
case ide_dma_check:
default:
break;
}
- return ide_dmaproc(func, drive); /* use standard DMA stuff */
+ return ide_dmaproc(func, drive, rq); /* use standard DMA stuff */
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
#endif /* CONFIG_AEC62XX_TUNING */
void __init ide_init_aec62xx(struct ata_channel *hwif)
{
#ifdef CONFIG_AEC62XX_TUNING
- hwif->tuneproc = &aec62xx_tune_drive;
- hwif->speedproc = &aec62xx_tune_chipset;
-#ifdef CONFIG_BLK_DEV_IDEDMA
+ hwif->tuneproc = aec62xx_tune_drive;
+ hwif->speedproc = aec62xx_tune_chipset;
+# ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base)
- hwif->dmaproc = &aec62xx_dmaproc;
+ hwif->udma = aec62xx_dmaproc;
hwif->highmem = 1;
-#else /* !CONFIG_BLK_DEV_IDEDMA */
+# else
hwif->drives[0].autotune = 1;
hwif->drives[1].autotune = 1;
-#endif /* CONFIG_BLK_DEV_IDEDMA */
-#endif /* CONFIG_AEC62XX_TUNING */
+# endif
+#endif
}
void __init ide_dmacapable_aec62xx(struct ata_channel *hwif, unsigned long dmabase)
byte can_ultra_dma = ali15x3_can_ultra(drive);
if ((m5229_revision<=0x20) && (drive->type != ATA_DISK))
- return hwif->dmaproc(ide_dma_off_quietly, drive);
+ return hwif->udma(ide_dma_off_quietly, drive, NULL);
if ((id != NULL) && ((id->capability & 1) != 0) && hwif->autodma) {
/* Consult the list of known "bad" drives */
- if (ide_dmaproc(ide_dma_bad_drive, drive)) {
+ if (ide_dmaproc(ide_dma_bad_drive, drive, NULL)) {
dma_func = ide_dma_off;
goto fast_ata_pio;
}
if (dma_func != ide_dma_on)
goto no_dma_set;
}
- } else if (ide_dmaproc(ide_dma_good_drive, drive)) {
+ } else if (ide_dmaproc(ide_dma_good_drive, drive, NULL)) {
if (id->eide_dma_time > 150) {
goto no_dma_set;
}
no_dma_set:
config_chipset_for_pio(drive);
}
- return hwif->dmaproc(dma_func, drive);
+ return hwif->udma(dma_func, drive, NULL);
}
-static int ali15x3_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
+static int ali15x3_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
switch(func) {
case ide_dma_check:
default:
break;
}
- return ide_dmaproc(func, drive); /* use standard DMA stuff */
+ return ide_dmaproc(func, drive, rq); /* use standard DMA stuff */
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
hwif->tuneproc = &ali15x3_tune_drive;
hwif->drives[0].autotune = 1;
hwif->drives[1].autotune = 1;
- hwif->speedproc = &ali15x3_tune_chipset;
+ hwif->speedproc = ali15x3_tune_chipset;
#ifdef CONFIG_BLK_DEV_IDEDMA
if ((hwif->dma_base) && (m5229_revision >= 0x20)) {
/*
* M1543C or newer for DMAing
*/
- hwif->dmaproc = &ali15x3_dmaproc;
+ hwif->udma = ali15x3_dmaproc;
hwif->autodma = 1;
}
* else to the default ide_dmaproc().
*/
-int amd74xx_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
+int amd74xx_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
if (func == ide_dma_check) {
? ide_dma_on : ide_dma_off_quietly;
}
- return ide_dmaproc(func, drive);
+ return ide_dmaproc(func, drive, rq);
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
hwif->highmem = 1;
- hwif->dmaproc = &amd74xx_dmaproc;
-#ifdef CONFIG_IDEDMA_AUTO
+ hwif->udma = amd74xx_dmaproc;
+# ifdef CONFIG_IDEDMA_AUTO
if (!noautodma)
hwif->autodma = 1;
-#endif
+# endif
}
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
}
/*
ide_dma_action_t dma_func = ide_dma_on;
pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
- class_rev &= 0xff;
+ class_rev &= 0xff;
switch(dev->device) {
case PCI_DEVICE_ID_CMD_680:
can_ultra_100 = 0;
break;
default:
- return hwif->dmaproc(ide_dma_off, drive);
+ return hwif->udma(ide_dma_off, drive, NULL);
}
if ((id != NULL) && ((id->capability & 1) != 0) &&
hwif->autodma && (drive->type == ATA_DISK)) {
/* Consult the list of known "bad" drives */
- if (ide_dmaproc(ide_dma_bad_drive, drive)) {
+ if (ide_dmaproc(ide_dma_bad_drive, drive, NULL)) {
dma_func = ide_dma_off;
goto fast_ata_pio;
}
if (dma_func != ide_dma_on)
goto no_dma_set;
}
- } else if (ide_dmaproc(ide_dma_good_drive, drive)) {
+ } else if (ide_dmaproc(ide_dma_good_drive, drive, NULL)) {
if (id->eide_dma_time > 150) {
goto no_dma_set;
}
no_dma_set:
config_chipset_for_pio(drive, 1);
}
- return drive->channel->dmaproc(dma_func, drive);
+ return drive->channel->udma(dma_func, drive, NULL);
}
-static int cmd680_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
+static int cmd680_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
switch (func) {
case ide_dma_check:
break;
}
/* Other cases are done by generic IDE-DMA code. */
- return ide_dmaproc(func, drive);
+ return ide_dmaproc(func, drive, rq);
}
-static int cmd64x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
+static int cmd64x_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
byte dma_stat = 0;
byte dma_alt_stat = 0;
break;
}
/* Other cases are done by generic IDE-DMA code. */
- return ide_dmaproc(func, drive);
+ return ide_dmaproc(func, drive, rq);
}
/*
* ASUS P55T2P4D with CMD646 chipset revision 0x01 requires the old
* event order for DMA transfers.
*/
-static int cmd646_1_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
+static int cmd646_1_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base;
}
/* Other cases are done by generic IDE-DMA code. */
- return ide_dmaproc(func, drive);
+ return ide_dmaproc(func, drive, rq);
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
switch(dev->device) {
case PCI_DEVICE_ID_CMD_680:
hwif->busproc = &cmd680_busproc;
- hwif->dmaproc = &cmd680_dmaproc;
+ hwif->udma = &cmd680_dmaproc;
hwif->resetproc = &cmd680_reset;
hwif->speedproc = &cmd680_tune_chipset;
hwif->tuneproc = &cmd680_tuneproc;
case PCI_DEVICE_ID_CMD_649:
case PCI_DEVICE_ID_CMD_648:
case PCI_DEVICE_ID_CMD_643:
- hwif->dmaproc = &cmd64x_dmaproc;
+ hwif->udma = &cmd64x_dmaproc;
hwif->tuneproc = &cmd64x_tuneproc;
hwif->speedproc = &cmd64x_tune_chipset;
break;
case PCI_DEVICE_ID_CMD_646:
hwif->chipset = ide_cmd646;
if (class_rev == 0x01) {
- hwif->dmaproc = &cmd646_1_dmaproc;
+ hwif->udma = &cmd646_1_dmaproc;
} else {
- hwif->dmaproc = &cmd64x_dmaproc;
+ hwif->udma = &cmd64x_dmaproc;
}
hwif->tuneproc = &cmd64x_tuneproc;
hwif->speedproc = &cmd64x_tune_chipset;
/*
* Default to DMA-off in case we run into trouble here.
*/
- (void)hwif->dmaproc(ide_dma_off_quietly, drive); /* turn off DMA while we fiddle */
+ hwif->udma(ide_dma_off_quietly, drive, NULL);
outb(inb(hwif->dma_base+2)&~(unit?0x40:0x20), hwif->dma_base+2); /* clear DMA_capable bit */
/*
*/
if (mate->present) {
struct hd_driveid *mateid = mate->id;
- if (mateid && (mateid->capability & 1) && !hwif->dmaproc(ide_dma_bad_drive, mate)) {
+ if (mateid && (mateid->capability & 1) && !hwif->udma(ide_dma_bad_drive, mate, NULL)) {
if ((mateid->field_valid & 4) && (mateid->dma_ultra & 7))
udma_ok = 1;
else if ((mateid->field_valid & 2) && (mateid->dma_mword & 7))
* Now see what the current drive is capable of,
* selecting UDMA only if the mate said it was ok.
*/
- if (id && (id->capability & 1) && hwif->autodma && !hwif->dmaproc(ide_dma_bad_drive, drive)) {
+ if (id && (id->capability & 1) && hwif->autodma && !hwif->udma(ide_dma_bad_drive, drive, NULL)) {
if (udma_ok && (id->field_valid & 4) && (id->dma_ultra & 7)) {
if (id->dma_ultra & 4)
mode = XFER_UDMA_2;
/*
* Finally, turn DMA on in software, and exit.
*/
- return hwif->dmaproc(ide_dma_on, drive); /* success */
+ return hwif->udma(ide_dma_on, drive, NULL); /* success */
}
/*
* We need it for our custom "ide_dma_check" function.
* All other requests are forwarded to the standard ide_dmaproc().
*/
-int cs5530_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
+int cs5530_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
switch (func) {
case ide_dma_check:
break;
}
/* Other cases are done by generic IDE-DMA code. */
- return ide_dmaproc(func, drive);
+ return ide_dmaproc(func, drive, rq);
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
unsigned int basereg, d0_timings;
#ifdef CONFIG_BLK_DEV_IDEDMA
- hwif->dmaproc = &cs5530_dmaproc;
+ hwif->udma = cs5530_dmaproc;
hwif->highmem = 1;
#else
hwif->autodma = 0;
/*
* used to set DMA mode for CY82C693 (single and multi modes)
*/
-static int cy82c693_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
+static int cy82c693_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
/*
* if the function is dma on, set dma mode for drive everything
printk (KERN_INFO "dma_on: %s\n", drive->name);
#endif /* CY82C693_DEBUG_INFO */
- if (id != NULL) {
+ if (id != NULL) {
/* Enable DMA on any drive that has DMA (multi or single) enabled */
if (id->field_valid & 2) { /* regular DMA */
int mmode, smode;
mmode = id->dma_mword & (id->dma_mword >> 8);
smode = id->dma_1word & (id->dma_1word >> 8);
-
+
if (mmode != 0)
cy82c693_dma_enable(drive, (mmode >> 1), 0); /* enable multi */
else if (smode != 0)
}
}
}
- return ide_dmaproc(func, drive);
+ return ide_dmaproc(func, drive, rq);
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
hwif->highmem = 1;
- hwif->dmaproc = cy82c693_dmaproc;
+ hwif->udma = cy82c693_dmaproc;
if (!noautodma)
hwif->autodma = 1;
}
drive->waiting_for_dma = 1;
if (drive->type != ATA_DISK)
return 0;
- BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); /* issue cmd to drive */
OUT_BYTE((reading == 9) ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
return 0;
if (id && (id->capability & 1) && drive->channel->autodma) {
/* Consult the list of known "bad" drives */
- if (ide_dmaproc(ide_dma_bad_drive, drive)) {
+ if (ide_dmaproc(ide_dma_bad_drive, drive, NULL)) {
dma_func = ide_dma_off;
goto fast_ata_pio;
}
if (dma_func != ide_dma_on)
goto no_dma_set;
}
- } else if (ide_dmaproc(ide_dma_good_drive, drive)) {
+ } else if (ide_dmaproc(ide_dma_good_drive, drive, NULL)) {
if (id->eide_dma_time > 150) {
goto no_dma_set;
}
config_chipset_for_pio(drive);
}
- return drive->channel->dmaproc(dma_func, drive);
+ return drive->channel->udma(dma_func, drive, NULL);
}
/*
* This is specific to the HPT366 UDMA bios chipset
* by HighPoint|Triones Technologies, Inc.
*/
-int hpt366_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
+int hpt366_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
byte reg50h = 0, reg52h = 0, reg5ah = 0, dma_stat = 0;
unsigned long dma_base = drive->channel->dma_base;
default:
break;
}
- return ide_dmaproc(func, drive); /* use standard DMA stuff */
+ return ide_dmaproc(func, drive, rq); /* use standard DMA stuff */
}
-int hpt370_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
+int hpt370_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base;
default:
break;
}
- return ide_dmaproc(func, drive); /* use standard DMA stuff */
+ return ide_dmaproc(func, drive, rq); /* use standard DMA stuff */
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
pci_read_config_byte(hwif->pci_dev, 0x5a, ®5ah);
if (reg5ah & 0x10) /* interrupt force enable */
pci_write_config_byte(hwif->pci_dev, 0x5a, reg5ah & ~0x10);
- hwif->dmaproc = &hpt370_dmaproc;
+ hwif->udma = hpt370_dmaproc;
} else {
- hwif->dmaproc = &hpt366_dmaproc;
+ hwif->udma = hpt366_dmaproc;
}
if (!noautodma)
hwif->autodma = 1;
/*
* dma_intr() is the handler for disk read/write DMA interrupts
*/
-static ide_startstop_t icside_dmaintr(ide_drive_t *drive)
+static ide_startstop_t icside_dmaintr(struct ata_device *drive, struct request *rq)
{
int i;
byte stat, dma_stat;
stat = GET_STAT(); /* get drive status */
if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
if (!dma_stat) {
- struct request *rq = HWGROUP(drive)->rq;
- rq = HWGROUP(drive)->rq;
for (i = rq->nr_sectors; i > 0;) {
i -= rq->current_nr_sectors;
ide_end_request(drive, 1);
}
return ide_stopped;
}
- printk("%s: dma_intr: bad DMA status (dma_stat=%x)\n",
+ printk("%s: dma_intr: bad DMA status (dma_stat=%x)\n",
drive->name, dma_stat);
}
return ide_error(drive, "dma_intr", stat);
if (drive->type != ATA_DISK)
return 0;
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &icside_dmaintr, WAIT_CMD, NULL);
+ ide_set_handler(drive, icside_dmaintr, WAIT_CMD, NULL);
OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA,
IDE_COMMAND_REG);
}
-static void cdrom_end_request(ide_drive_t *drive, int uptodate)
+static void cdrom_end_request(struct ata_device *drive, struct request *rq, int uptodate)
{
- struct request *rq = HWGROUP(drive)->rq;
-
if ((rq->flags & REQ_SENSE) && uptodate)
cdrom_analyze_sense_data(drive, rq);
if ((rq->flags & REQ_CMD) && !rq->current_nr_sectors)
uptodate = 1;
- ide_end_request(drive, uptodate);
+ ide_end_request(drive, rq, uptodate);
}
/* Returns 0 if the request should be continued.
Returns 1 if the request was ended. */
-static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive,
+static int cdrom_decode_status(ide_startstop_t *startstop, struct ata_device *drive, struct request *rq,
int good_stat, int *stat_ret)
{
- struct request *rq = HWGROUP(drive)->rq;
int stat, err, sense_key;
struct packet_command *pc;
sense_key = err >> 4;
if (rq == NULL) {
- printk("%s: missing rq in cdrom_decode_status\n", drive->name);
+ printk("%s: missing rq in %s\n", drive->name, __FUNCTION__);
*startstop = ide_stopped;
return 1;
}
/* FIXME --mdcki */
pc = (struct packet_command *) rq->special;
pc->stat = 1;
- cdrom_end_request(drive, 1);
+ cdrom_end_request(drive, rq, 1);
*startstop = ide_error (drive, "request sense failure", stat);
return 1;
}
pc->stat = 1;
- cdrom_end_request(drive, 1);
+ cdrom_end_request(drive, rq, 1);
/* FIXME: this is the only place where pc->sense get's used.
* Think hard about how to get rid of it...
/* Fail the request. */
printk ("%s: tray open\n", drive->name);
- cdrom_end_request(drive, 0);
+ cdrom_end_request(drive, rq, 0);
} else if (sense_key == UNIT_ATTENTION) {
/* Media change. */
cdrom_saw_media_change (drive);
But be sure to give up if we've retried
too many times. */
if (++rq->errors > ERROR_MAX)
- cdrom_end_request(drive, 0);
+ cdrom_end_request(drive, rq, 0);
} else if (sense_key == ILLEGAL_REQUEST ||
sense_key == DATA_PROTECT) {
/* No point in retrying after an illegal
request or data protect error.*/
ide_dump_status (drive, "command error", stat);
- cdrom_end_request(drive, 0);
+ cdrom_end_request(drive, rq, 0);
} else if (sense_key == MEDIUM_ERROR) {
/* No point in re-trying a zillion times on a bad
* sector. The error is not correctable at all.
*/
ide_dump_status (drive, "media error (bad sector)", stat);
- cdrom_end_request(drive, 0);
+ cdrom_end_request(drive, rq, 0);
} else if ((err & ~ABRT_ERR) != 0) {
/* Go to the default handler
for other errors. */
- *startstop = ide_error (drive, "cdrom_decode_status", stat);
+ *startstop = ide_error (drive, __FUNCTION__, stat);
return 1;
} else if ((++rq->errors > ERROR_MAX)) {
/* We've racked up too many retries. Abort. */
- cdrom_end_request(drive, 0);
+ cdrom_end_request(drive, rq, 0);
}
/* If we got a CHECK_CONDITION status,
return 1;
}
-static int cdrom_timer_expiry(ide_drive_t *drive)
+static int cdrom_timer_expiry(struct ata_device *drive, struct request *rq)
{
- struct request *rq = HWGROUP(drive)->rq;
unsigned long wait = 0;
/*
called when the interrupt from the drive arrives. Otherwise, HANDLER
will be called immediately after the drive is prepared for the transfer. */
-static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
+static ide_startstop_t cdrom_start_packet_command(struct ata_device *drive,
+ struct request *rq,
int xferlen,
- ide_handler_t *handler)
+ ata_handler_t handler)
{
ide_startstop_t startstop;
struct cdrom_info *info = drive->driver_data;
if (info->dma) {
if (info->cmd == READ)
- info->dma = !drive->channel->dmaproc(ide_dma_read, drive);
+ info->dma = !drive->channel->udma(ide_dma_read, drive, rq);
else if (info->cmd == WRITE)
- info->dma = !drive->channel->dmaproc(ide_dma_write, drive);
+ info->dma = !drive->channel->udma(ide_dma_write, drive, rq);
else
printk("ide-cd: DMA set, but not allowed\n");
}
OUT_BYTE (drive->ctl, IDE_CONTROL_REG);
if (info->dma)
- drive->channel->dmaproc(ide_dma_begin, drive);
+ drive->channel->udma(ide_dma_begin, drive, NULL);
if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler (drive, handler, WAIT_CMD, cdrom_timer_expiry);
+ ide_set_handler(drive, handler, WAIT_CMD, cdrom_timer_expiry);
OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* packet command */
return ide_started;
} else {
OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* packet command */
- return (*handler) (drive);
+ return handler(drive, rq);
}
}
* already been prepared by cdrom_start_packet_command. "handler" is the
* interrupt handler to call when the command completes or there's data ready.
*/
-static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive,
+static ide_startstop_t cdrom_transfer_packet_command(struct ata_device *drive,
+ struct request *rq,
unsigned char *cmd, unsigned long timeout,
- ide_handler_t *handler)
+ ata_handler_t handler)
{
ide_startstop_t startstop;
int stat_dum;
/* Check for errors. */
- if (cdrom_decode_status(&startstop, drive, DRQ_STAT, &stat_dum))
+ if (cdrom_decode_status(&startstop, drive, rq, DRQ_STAT, &stat_dum))
return startstop;
} else {
/* Otherwise, we must wait for DRQ to get set. */
}
/* Arm the interrupt handler. */
- BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, handler, timeout, cdrom_timer_expiry);
/* Send the command to the device. */
* ok; nonzero if the request has been terminated.
*/
static inline
-int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
+int cdrom_read_check_ireason(struct ata_device *drive, struct request *rq, int len, int ireason)
{
ireason &= 3;
if (ireason == 2) return 0;
drive->name, ireason);
}
- cdrom_end_request(drive, 0);
+ cdrom_end_request(drive, rq, 0);
return -1;
}
/*
* Interrupt routine. Called when a read request has completed.
*/
-static ide_startstop_t cdrom_read_intr(ide_drive_t *drive)
+static ide_startstop_t cdrom_read_intr(struct ata_device *drive, struct request *rq)
{
int stat;
int ireason, len, sectors_to_transfer, nskip;
int dma = info->dma, dma_error = 0;
ide_startstop_t startstop;
- struct request *rq = HWGROUP(drive)->rq;
-
/* Check for errors. */
if (dma) {
info->dma = 0;
- if ((dma_error = drive->channel->dmaproc(ide_dma_end, drive)))
- drive->channel->dmaproc(ide_dma_off, drive);
+ if ((dma_error = drive->channel->udma(ide_dma_end, drive, NULL)))
+ drive->channel->udma(ide_dma_off, drive, NULL);
}
- if (cdrom_decode_status (&startstop, drive, 0, &stat))
+ if (cdrom_decode_status(&startstop, drive, rq, 0, &stat))
return startstop;
if (dma) {
if (!dma_error) {
- __ide_end_request(drive, 1, rq->nr_sectors);
+ __ide_end_request(drive, rq, 1, rq->nr_sectors);
return ide_stopped;
} else
return ide_error (drive, "dma error", stat);
if (rq->current_nr_sectors > 0) {
printk ("%s: cdrom_read_intr: data underrun (%u blocks)\n",
drive->name, rq->current_nr_sectors);
- cdrom_end_request(drive, 0);
+ cdrom_end_request(drive, rq, 0);
} else
- cdrom_end_request(drive, 1);
+ cdrom_end_request(drive, rq, 1);
return ide_stopped;
}
/* Check that the drive is expecting to do the same thing we are. */
- if (cdrom_read_check_ireason (drive, len, ireason))
+ if (cdrom_read_check_ireason(drive, rq, len, ireason))
return ide_stopped;
/* Assume that the drive will always provide data in multiples
printk (" Trying to limit transfer sizes\n");
CDROM_CONFIG_FLAGS (drive)->limit_nframes = 1;
}
- cdrom_end_request(drive, 0);
+ cdrom_end_request(drive, rq, 0);
return ide_stopped;
}
/* If we've filled the present buffer but there's another
chained buffer after it, move on. */
if (rq->current_nr_sectors == 0 && rq->nr_sectors)
- cdrom_end_request(drive, 1);
+ cdrom_end_request(drive, rq, 1);
/* If the buffers are full, cache the rest of the data in our
internal buffer. */
}
}
- /* Done moving data!
- Wait for another interrupt. */
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &cdrom_read_intr, WAIT_CMD, NULL);
+ /* Done moving data! Wait for another interrupt. */
+ ide_set_handler(drive, cdrom_read_intr, WAIT_CMD, NULL);
return ide_started;
}
* Try to satisfy some of the current read request from our cached data.
* Returns nonzero if the request has been completed, zero otherwise.
*/
-static int cdrom_read_from_buffer (ide_drive_t *drive)
+static int cdrom_read_from_buffer(struct ata_device *drive, struct request *rq)
{
struct cdrom_info *info = drive->driver_data;
- struct request *rq = HWGROUP(drive)->rq;
/* Can't do anything if there's no buffer. */
if (info->buffer == NULL) return 0;
rq->sector >= info->sector_buffered &&
rq->sector < info->sector_buffered + info->nsectors_buffered) {
if (rq->current_nr_sectors == 0)
- cdrom_end_request(drive, 1);
+ cdrom_end_request(drive, rq, 1);
memcpy (rq->buffer,
info->buffer +
/* If we've satisfied the current request,
terminate it successfully. */
if (rq->nr_sectors == 0) {
- cdrom_end_request(drive, 1);
+ cdrom_end_request(drive, rq, 1);
return -1;
}
/* Move on to the next buffer if needed. */
if (rq->current_nr_sectors == 0)
- cdrom_end_request(drive, 1);
+ cdrom_end_request(drive, rq, 1);
/* If this condition does not hold, then the kluge i use to
represent the number of sectors to skip at the start of a transfer
paranoid and check. */
if (rq->current_nr_sectors < bio_sectors(rq->bio) &&
(rq->sector % SECTORS_PER_FRAME) != 0) {
- printk ("%s: cdrom_read_from_buffer: buffer botch (%ld)\n",
- drive->name, rq->sector);
- cdrom_end_request(drive, 0);
+ printk ("%s: %s: buffer botch (%ld)\n",
+ drive->name, __FUNCTION__, rq->sector);
+ cdrom_end_request(drive, rq, 0);
return -1;
}
* directly from cdrom_start_read. However, for drq_interrupt devices, it is
* called from an interrupt when the drive is ready to accept the command.
*/
-static ide_startstop_t cdrom_start_read_continuation(ide_drive_t *drive)
+static ide_startstop_t cdrom_start_read_continuation(struct ata_device *drive, struct request *rq)
{
- struct request *rq = HWGROUP(drive)->rq;
int nsect, sector, nframes, frame, nskip;
/* Number of sectors to transfer. */
/* Sanity check... */
if (rq->current_nr_sectors != bio_sectors(rq->bio) &&
(rq->sector % CD_FRAMESIZE != 0)) {
- printk ("%s: cdrom_start_read_continuation: buffer botch (%u)\n",
- drive->name, rq->current_nr_sectors);
- cdrom_end_request(drive, 0);
+ printk ("%s: %s: buffer botch (%u)\n",
+ drive->name, __FUNCTION__, rq->current_nr_sectors);
+ cdrom_end_request(drive, rq, 0);
return ide_stopped;
}
sector -= nskip;
(65534 / CD_FRAMESIZE) : 65535);
/* Send the command to the drive and return. */
- return cdrom_transfer_packet_command(drive, rq->cmd, WAIT_CMD, &cdrom_read_intr);
+ return cdrom_transfer_packet_command(drive, rq, rq->cmd, WAIT_CMD, &cdrom_read_intr);
}
#define IDECD_SEEK_TIMER (5 * WAIT_MIN_SLEEP) /* 100 ms */
#define IDECD_SEEK_TIMEOUT WAIT_CMD /* 10 sec */
-static ide_startstop_t cdrom_seek_intr (ide_drive_t *drive)
+static ide_startstop_t cdrom_seek_intr(struct ata_device *drive, struct request *rq)
{
struct cdrom_info *info = drive->driver_data;
int stat;
static int retry = 10;
ide_startstop_t startstop;
- if (cdrom_decode_status (&startstop, drive, 0, &stat))
+ if (cdrom_decode_status (&startstop, drive, rq, 0, &stat))
return startstop;
CDROM_CONFIG_FLAGS(drive)->seeking = 1;
return ide_stopped;
}
-static ide_startstop_t cdrom_start_seek_continuation(struct ata_device *drive)
+static ide_startstop_t cdrom_start_seek_continuation(struct ata_device *drive, struct request *rq)
{
unsigned char cmd[CDROM_PACKET_SIZE];
- struct request *rq = HWGROUP(drive)->rq;
sector_t sector;
int frame, nskip;
cmd[0] = GPCMD_SEEK;
put_unaligned(cpu_to_be32(frame), (unsigned int *) &cmd[2]);
- return cdrom_transfer_packet_command(drive, cmd, WAIT_CMD, &cdrom_seek_intr);
+ return cdrom_transfer_packet_command(drive, rq, cmd, WAIT_CMD, &cdrom_seek_intr);
}
-static ide_startstop_t cdrom_start_seek(struct ata_device *drive, sector_t block)
+static ide_startstop_t cdrom_start_seek(struct ata_device *drive, struct request *rq, sector_t block)
{
struct cdrom_info *info = drive->driver_data;
info->dma = 0;
info->cmd = 0;
info->start_seek = jiffies;
- return cdrom_start_packet_command(drive, 0, cdrom_start_seek_continuation);
+ return cdrom_start_packet_command(drive, rq, 0, cdrom_start_seek_continuation);
}
/*
/*
* Start a read request from the CD-ROM.
*/
-static ide_startstop_t cdrom_start_read(struct ata_device *drive, sector_t block)
+static ide_startstop_t cdrom_start_read(struct ata_device *drive, struct request *rq, sector_t block)
{
struct cdrom_info *info = drive->driver_data;
- struct request *rq = HWGROUP(drive)->rq;
restore_request(rq);
/* Satisfy whatever we can of this request from our cached sector. */
- if (cdrom_read_from_buffer(drive))
+ if (cdrom_read_from_buffer(drive, rq))
return ide_stopped;
blk_attempt_remerge(&drive->queue, rq);
info->cmd = READ;
/* Start sending the read request to the drive. */
- return cdrom_start_packet_command(drive, 32768, cdrom_start_read_continuation);
+ return cdrom_start_packet_command(drive, rq, 32768, cdrom_start_read_continuation);
}
/****************************************************************************
*/
/* Interrupt routine for packet command completion. */
-static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
+static ide_startstop_t cdrom_pc_intr(struct ata_device *drive, struct request *rq)
{
int ireason, len, stat, thislen;
- struct request *rq = HWGROUP(drive)->rq;
/* FIXME --mdcki */
struct packet_command *pc = (struct packet_command *) rq->special;
ide_startstop_t startstop;
/* Check for errors. */
- if (cdrom_decode_status (&startstop, drive, 0, &stat))
+ if (cdrom_decode_status (&startstop, drive, rq, 0, &stat))
return startstop;
/* Read the interrupt reason and the transfer length. */
}
if (pc->buflen == 0)
- cdrom_end_request(drive, 1);
+ cdrom_end_request(drive, rq, 1);
else {
/* Comment this out, because this always happens
right after a reset occurs, and it is annoying to
drive->name, pc->buflen);
*/
pc->stat = 1;
- cdrom_end_request(drive, 1);
+ cdrom_end_request(drive, rq, 1);
}
return ide_stopped;
}
}
/* Now we wait for another interrupt. */
+ ide_set_handler(drive, cdrom_pc_intr, WAIT_CMD, cdrom_timer_expiry);
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler (drive, &cdrom_pc_intr, WAIT_CMD, cdrom_timer_expiry);
return ide_started;
}
-static ide_startstop_t cdrom_do_pc_continuation(ide_drive_t *drive)
+static ide_startstop_t cdrom_do_pc_continuation(struct ata_device *drive, struct request *rq)
{
- struct request *rq = HWGROUP(drive)->rq;
unsigned long timeout;
/* FIXME --mdcki */
timeout = WAIT_CMD;
/* Send the command to the drive and return. */
- return cdrom_transfer_packet_command(drive, rq->cmd, timeout, &cdrom_pc_intr);
+ return cdrom_transfer_packet_command(drive, rq, rq->cmd, timeout, &cdrom_pc_intr);
}
-static ide_startstop_t cdrom_do_packet_command (ide_drive_t *drive)
+static ide_startstop_t cdrom_do_packet_command(struct ata_device *drive, struct request *rq)
{
int len;
- struct request *rq = HWGROUP(drive)->rq;
/* FIXME --mdcki */
struct packet_command *pc = (struct packet_command *) rq->special;
len = pc->buflen;
/* Start sending the command to the drive. */
- return cdrom_start_packet_command (drive, len, cdrom_do_pc_continuation);
+ return cdrom_start_packet_command (drive, rq, len, cdrom_do_pc_continuation);
}
/*
* Write handling
*/
-static inline int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
+static inline int cdrom_write_check_ireason(struct ata_device *drive, struct request *rq,
+ int len, int ireason)
{
/* Two notes about IDE interrupt reason here - 0 means that
* the drive wants to receive data from us, 2 means that
drive->name, ireason);
}
- cdrom_end_request(drive, 0);
+ cdrom_end_request(drive, rq, 0);
return 1;
}
-static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
+static ide_startstop_t cdrom_write_intr(struct ata_device *drive, struct request *rq)
{
int stat, ireason, len, sectors_to_transfer, uptodate;
struct cdrom_info *info = drive->driver_data;
int dma_error = 0, dma = info->dma;
ide_startstop_t startstop;
- struct request *rq = HWGROUP(drive)->rq;
-
/* Check for errors. */
if (dma) {
info->dma = 0;
- if ((dma_error = drive->channel->dmaproc(ide_dma_end, drive))) {
+ if ((dma_error = drive->channel->udma(ide_dma_end, drive, NULL))) {
printk("ide-cd: write dma error\n");
- drive->channel->dmaproc(ide_dma_off, drive);
+ drive->channel->udma(ide_dma_off, drive, NULL);
}
}
- if (cdrom_decode_status(&startstop, drive, 0, &stat)) {
+ if (cdrom_decode_status(&startstop, drive, rq, 0, &stat)) {
printk("ide-cd: write_intr decode_status bad\n");
return startstop;
}
if (dma_error)
return ide_error(drive, "dma error", stat);
- rq = HWGROUP(drive)->rq;
- __ide_end_request(drive, 1, rq->nr_sectors);
+ __ide_end_request(drive, rq, 1, rq->nr_sectors);
return ide_stopped;
}
drive->name, rq->current_nr_sectors);
uptodate = 0;
}
- cdrom_end_request(drive, uptodate);
+ cdrom_end_request(drive, rq, uptodate);
return ide_stopped;
}
/* Check that the drive is expecting to do the same thing we are. */
if (ireason & 3)
- if (cdrom_write_check_ireason(drive, len, ireason))
+ if (cdrom_write_check_ireason(drive, rq, len, ireason))
return ide_stopped;
sectors_to_transfer = len / SECTOR_SIZE;
* current buffer complete, move on
*/
if (rq->current_nr_sectors == 0 && rq->nr_sectors)
- cdrom_end_request(drive, 1);
+ cdrom_end_request(drive, rq, 1);
}
/* re-arm handler */
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &cdrom_write_intr, 5 * WAIT_CMD, NULL);
+ ide_set_handler(drive, cdrom_write_intr, 5 * WAIT_CMD, NULL);
+
return ide_started;
}
-static ide_startstop_t cdrom_start_write_cont(ide_drive_t *drive)
+static ide_startstop_t cdrom_start_write_cont(struct ata_device *drive, struct request *rq)
{
- struct request *rq = HWGROUP(drive)->rq;
-
- return cdrom_transfer_packet_command(drive, rq->cmd, 2 * WAIT_CMD, cdrom_write_intr);
+ return cdrom_transfer_packet_command(drive, rq, rq->cmd, 2 * WAIT_CMD, cdrom_write_intr);
}
-static ide_startstop_t cdrom_start_write(ide_drive_t *drive, struct request *rq)
+static ide_startstop_t cdrom_start_write(struct ata_device *drive, struct request *rq)
{
struct cdrom_info *info = drive->driver_data;
* writes *must* be 2kB frame aligned
*/
if ((rq->nr_sectors & 3) || (rq->sector & 3)) {
- cdrom_end_request(drive, 0);
+ cdrom_end_request(drive, rq, 0);
return ide_stopped;
}
info->cmd = WRITE;
/* Start sending the read request to the drive. */
- return cdrom_start_packet_command(drive, 32768, cdrom_start_write_cont);
+ return cdrom_start_packet_command(drive, rq, 32768, cdrom_start_write_cont);
}
#define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))
CDROM_CONFIG_FLAGS(drive)->seeking = 0;
}
if (IDE_LARGE_SEEK(info->last_block, block, IDECD_SEEK_THRESHOLD) && drive->dsc_overlap)
- action = cdrom_start_seek(drive, block);
+ action = cdrom_start_seek(drive, rq, block);
else {
if (rq_data_dir(rq) == READ)
- action = cdrom_start_read(drive, block);
+ action = cdrom_start_read(drive, rq, block);
else
action = cdrom_start_write(drive, rq);
}
info->last_block = block;
return action;
} else if (rq->flags & (REQ_PC | REQ_SENSE)) {
- return cdrom_do_packet_command(drive);
+ return cdrom_do_packet_command(drive, rq);
} else if (rq->flags & REQ_SPECIAL) {
/*
* FIXME: Kill REQ_SEPCIAL and replace it with commands queued
* right now this can only be a reset...
*/
- cdrom_end_request(drive, 1);
+ cdrom_end_request(drive, rq, 1);
return ide_stopped;
} else if (rq->flags & REQ_BLOCK_PC) {
struct packet_command pc;
/* FIXME --mdcki */
rq->special = (char *) &pc;
- startstop = cdrom_do_packet_command(drive);
+ startstop = cdrom_do_packet_command(drive, rq);
if (pc.stat)
++rq->errors;
}
blk_dump_rq_flags(rq, "ide-cd bad flags");
- cdrom_end_request(drive, 0);
+ cdrom_end_request(drive, rq, 0);
return ide_stopped;
}
#ifdef CONFIG_BLK_DEV_IDEDMA
if (drive->using_dma)
- (void) drive->channel->dmaproc(ide_dma_verbose, drive);
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+ (void) drive->channel->udma(ide_dma_verbose, drive, NULL);
+#endif
printk("\n");
return nslots;
if (!(rq->flags & REQ_CMD)) {
blk_dump_rq_flags(rq, "idedisk_do_request - bad command");
- ide_end_request(drive, 0);
+ ide_end_request(drive, rq, 0);
return ide_stopped;
}
drive->bios_cyl, drive->bios_head, drive->bios_sect);
#ifdef CONFIG_BLK_DEV_IDEDMA
if (drive->using_dma)
- (void) drive->channel->dmaproc(ide_dma_verbose, drive);
+ (void) drive->channel->udma(ide_dma_verbose, drive, NULL);
#endif
printk("\n");
* May be copied or modified under the terms of the GNU General Public License
*
* Special Thanks to Mark for his Six years of work.
-*
+ *
* This module provides support for the bus-master IDE DMA functions
* of various PCI chipsets, including the Intel PIIX (i82371FB for
* the 430 FX chipset), the PIIX3 (i82371SB for the 430 HX/VX and
/*
* dma_intr() is the handler for disk read/write DMA interrupts
*/
-ide_startstop_t ide_dma_intr (ide_drive_t *drive)
+ide_startstop_t ide_dma_intr(struct ata_device *drive, struct request *rq)
{
byte stat, dma_stat;
- dma_stat = drive->channel->dmaproc(ide_dma_end, drive);
- stat = GET_STAT(); /* get drive status */
- if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
+ dma_stat = drive->channel->udma(ide_dma_end, drive, rq);
+ if (OK_STAT(stat = GET_STAT(),DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
if (!dma_stat) {
- struct request *rq = HWGROUP(drive)->rq;
-
- __ide_end_request(drive, 1, rq->nr_sectors);
+ __ide_end_request(drive, rq, 1, rq->nr_sectors);
return ide_stopped;
}
printk("%s: dma_intr: bad DMA status (dma_stat=%x)\n",
if (id && (id->capability & 1) && hwif->autodma && config_allows_dma) {
/* Consult the list of known "bad" drives */
- if (ide_dmaproc(ide_dma_bad_drive, drive))
- return hwif->dmaproc(ide_dma_off, drive);
+ if (ide_dmaproc(ide_dma_bad_drive, drive, NULL))
+ return hwif->udma(ide_dma_off, drive, NULL);
/* Enable DMA on any drive that has UltraDMA (mode 6/7/?) enabled */
if ((id->field_valid & 4) && (eighty_ninty_three(drive)))
if ((id->dma_ultra & (id->dma_ultra >> 14) & 2))
- return hwif->dmaproc(ide_dma_on, drive);
+ return hwif->udma(ide_dma_on, drive, NULL);
/* Enable DMA on any drive that has UltraDMA (mode 3/4/5) enabled */
if ((id->field_valid & 4) && (eighty_ninty_three(drive)))
if ((id->dma_ultra & (id->dma_ultra >> 11) & 7))
- return hwif->dmaproc(ide_dma_on, drive);
+ return hwif->udma(ide_dma_on, drive, NULL);
/* Enable DMA on any drive that has UltraDMA (mode 0/1/2) enabled */
if (id->field_valid & 4) /* UltraDMA */
if ((id->dma_ultra & (id->dma_ultra >> 8) & 7))
- return hwif->dmaproc(ide_dma_on, drive);
+ return hwif->udma(ide_dma_on, drive, NULL);
/* Enable DMA on any drive that has mode2 DMA (multi or single) enabled */
if (id->field_valid & 2) /* regular DMA */
if ((id->dma_mword & 0x404) == 0x404 || (id->dma_1word & 0x404) == 0x404)
- return hwif->dmaproc(ide_dma_on, drive);
+ return hwif->udma(ide_dma_on, drive, NULL);
/* Consult the list of known "good" drives */
- if (ide_dmaproc(ide_dma_good_drive, drive))
- return hwif->dmaproc(ide_dma_on, drive);
+ if (ide_dmaproc(ide_dma_good_drive, drive, NULL))
+ return hwif->udma(ide_dma_on, drive, NULL);
}
- return hwif->dmaproc(ide_dma_off_quietly, drive);
+ return hwif->udma(ide_dma_off_quietly, drive, NULL);
}
/*
* 1 dma-ing, 2 error, 4 intr
*/
-static int dma_timer_expiry(ide_drive_t *drive)
+static int dma_timer_expiry(struct ata_device *drive, struct request *__rq)
{
- byte dma_stat = inb(drive->channel->dma_base+2);
+ /* FIXME: What's that? */
+ u8 dma_stat = inb(drive->channel->dma_base+2);
#ifdef DEBUG
printk("%s: dma_timer_expiry: dma status == 0x%02x\n", drive->name, dma_stat);
#endif
if (dma_stat & 2) { /* ERROR */
- byte stat = GET_STAT();
+ u8 stat = GET_STAT();
return ide_error(drive, "dma_timer_expiry", stat);
}
if (dma_stat & 1) /* DMAing */
}
/*
- * ide_dmaproc() initiates/aborts DMA read/write operations on a drive.
+ * This initiates/aborts DMA read/write operations on a drive.
*
* The caller is assumed to have selected the drive and programmed the drive's
* sector address using CHS or LBA. All that remains is to prepare for DMA
* the caller should revert to PIO for the current request.
* May also be invoked from trm290.c
*/
-int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
+int ide_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base;
if (drive->type != ATA_DISK)
return 0;
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, dma_timer_expiry); /* issue cmd to drive */
- if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_ACB) &&
- (drive->addressing == 1)) {
- struct ata_taskfile *args = HWGROUP(drive)->rq->special;
+ ide_set_handler(drive, ide_dma_intr, WAIT_CMD, dma_timer_expiry); /* issue cmd to drive */
+ if ((rq->flags & REQ_DRIVE_ACB) && (drive->addressing == 1)) {
+ struct ata_taskfile *args = rq->special;
OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
} else if (drive->addressing) {
} else {
OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
}
- return drive->channel->dmaproc(ide_dma_begin, drive);
+ return drive->channel->udma(ide_dma_begin, drive, NULL);
case ide_dma_begin:
/* Note that this is done *after* the cmd has
* been issued to the drive, as per the BM-IDE spec.
goto dma_alloc_failure;
}
- hwif->dmaproc = &ide_dmaproc;
+ hwif->udma = ide_dmaproc;
if (hwif->chipset != ide_trm290) {
byte dma_stat = inb(dma_base+2);
int buffer_size; /* Size of our data buffer */
char *b_data; /* Pointer which runs on the buffers */
int b_count; /* Missing/Available data on the current buffer */
- struct request *rq; /* The corresponding request */
byte *buffer; /* Data buffer */
byte *current_position; /* Pointer into the above buffer */
- void (*callback) (ide_drive_t *); /* Called when this packet command is completed */
+ void (*callback) (struct ata_device *, struct request *); /* Called when this packet command is completed */
byte pc_buffer[IDEFLOPPY_PC_BUFFER_SIZE]; /* Temporary buffer */
unsigned long flags; /* Status/Action bit flags: long for set_bit */
} idefloppy_pc_t;
* For read/write requests, we will call ide_end_request to pass to the
* next buffer.
*/
-static int idefloppy_end_request(ide_drive_t *drive, int uptodate)
+static int idefloppy_end_request(struct ata_device *drive, struct request *rq, int uptodate)
{
idefloppy_floppy_t *floppy = drive->driver_data;
- struct request *rq = HWGROUP(drive)->rq;
int error;
#if IDEFLOPPY_DEBUG_LOG
if (!rq)
return 0;
if (!(rq->flags & IDEFLOPPY_RQ)) {
- ide_end_request(drive, uptodate);
+ ide_end_request(drive, rq, uptodate);
return 0;
}
rq->errors = error;
return 0;
}
-static void idefloppy_input_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, unsigned int bcount)
+static void idefloppy_input_buffers(struct ata_device *drive, struct request *rq,
+ idefloppy_pc_t *pc, unsigned int bcount)
{
- struct request *rq = pc->rq;
struct bio *bio = rq->bio;
int count;
if (pc->b_count == bio->bi_size) {
rq->sector += rq->current_nr_sectors;
rq->nr_sectors -= rq->current_nr_sectors;
- idefloppy_end_request(drive, 1);
+ idefloppy_end_request(drive, rq, 1);
if ((bio = rq->bio) != NULL)
pc->b_count = 0;
}
if (bio == NULL) {
- printk (KERN_ERR "%s: bio == NULL in idefloppy_input_buffers, bcount == %d\n", drive->name, bcount);
+ printk (KERN_ERR "%s: bio == NULL in %s, bcount == %d\n", drive->name, __FUNCTION__, bcount);
idefloppy_discard_data (drive, bcount);
return;
}
}
}
-static void idefloppy_output_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, unsigned int bcount)
+static void idefloppy_output_buffers(struct ata_device *drive, struct request *rq,
+ idefloppy_pc_t *pc, unsigned int bcount)
{
- struct request *rq = pc->rq;
struct bio *bio = rq->bio;
int count;
-
+
while (bcount) {
if (!pc->b_count) {
rq->sector += rq->current_nr_sectors;
rq->nr_sectors -= rq->current_nr_sectors;
- idefloppy_end_request(drive, 1);
+ idefloppy_end_request(drive, rq, 1);
if ((bio = rq->bio) != NULL) {
pc->b_data = bio_data(bio);
pc->b_count = bio->bi_size;
}
#ifdef CONFIG_BLK_DEV_IDEDMA
-static void idefloppy_update_buffers (ide_drive_t *drive, idefloppy_pc_t *pc)
+static void idefloppy_update_buffers (struct ata_device *drive, struct request *rq,
+ idefloppy_pc_t *pc)
{
- struct request *rq = pc->rq;
struct bio *bio = rq->bio;
while ((bio = rq->bio) != NULL)
- idefloppy_end_request(drive, 1);
+ idefloppy_end_request(drive, rq, 1);
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
#endif /* IDEFLOPPY_DEBUG_LOG */
}
-static void idefloppy_request_sense_callback (ide_drive_t *drive)
+static void idefloppy_request_sense_callback(struct ata_device *drive, struct request *rq)
{
idefloppy_floppy_t *floppy = drive->driver_data;
#endif /* IDEFLOPPY_DEBUG_LOG */
if (!floppy->pc->error) {
idefloppy_analyze_error (drive,(idefloppy_request_sense_result_t *) floppy->pc->buffer);
- idefloppy_end_request(drive, 1);
+ idefloppy_end_request(drive, rq, 1);
} else {
printk (KERN_ERR "Error in REQUEST SENSE itself - Aborting request!\n");
- idefloppy_end_request(drive, 0);
+ idefloppy_end_request(drive, rq, 0);
}
}
/*
* General packet command callback function.
*/
-static void idefloppy_pc_callback (ide_drive_t *drive)
+static void idefloppy_pc_callback(struct ata_device *drive, struct request *rq)
{
idefloppy_floppy_t *floppy = drive->driver_data;
-
+
#if IDEFLOPPY_DEBUG_LOG
printk (KERN_INFO "ide-floppy: Reached idefloppy_pc_callback\n");
#endif /* IDEFLOPPY_DEBUG_LOG */
- idefloppy_end_request(drive, floppy->pc->error ? 0:1);
+ idefloppy_end_request(drive, rq, floppy->pc->error ? 0:1);
}
/*
pc->buffer = pc->pc_buffer;
pc->buffer_size = IDEFLOPPY_PC_BUFFER_SIZE;
pc->b_data = NULL;
- pc->callback = &idefloppy_pc_callback;
+ pc->callback = idefloppy_pc_callback;
}
static void idefloppy_create_request_sense_cmd (idefloppy_pc_t *pc)
* idefloppy_pc_intr is the usual interrupt handler which will be called
* during a packet command.
*/
-static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
+static ide_startstop_t idefloppy_pc_intr(struct ata_device *drive, struct request *rq)
{
idefloppy_floppy_t *floppy = drive->driver_data;
idefloppy_status_reg_t status;
idefloppy_bcount_reg_t bcount;
idefloppy_ireason_reg_t ireason;
idefloppy_pc_t *pc=floppy->pc;
- struct request *rq = pc->rq;
unsigned int temp;
#if IDEFLOPPY_DEBUG_LOG
printk (KERN_INFO "ide-floppy: Reached idefloppy_pc_intr interrupt handler\n");
-#endif /* IDEFLOPPY_DEBUG_LOG */
+#endif
#ifdef CONFIG_BLK_DEV_IDEDMA
if (test_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
- if (drive->channel->dmaproc(ide_dma_end, drive)) {
+ if (drive->channel->udma(ide_dma_end, drive, NULL)) {
set_bit (PC_DMA_ERROR, &pc->flags);
} else {
pc->actually_transferred=pc->request_transfer;
- idefloppy_update_buffers (drive, pc);
+ idefloppy_update_buffers(drive, rq, pc);
}
-#if IDEFLOPPY_DEBUG_LOG
+# if IDEFLOPPY_DEBUG_LOG
printk (KERN_INFO "ide-floppy: DMA finished\n");
-#endif /* IDEFLOPPY_DEBUG_LOG */
+# endif
}
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
status.all = GET_STAT(); /* Clear the interrupt */
pc->error = 0;
if (floppy->failed_pc == pc)
floppy->failed_pc=NULL;
- pc->callback(drive); /* Command finished - Call the callback function */
+ pc->callback(drive, rq); /* Command finished - Call the callback function */
return ide_stopped;
}
#ifdef CONFIG_BLK_DEV_IDEDMA
if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
printk (KERN_ERR "ide-floppy: The floppy wants to issue more interrupts in DMA mode\n");
- drive->channel->dmaproc(ide_dma_off, drive);
+ drive->channel->udma(ide_dma_off, drive, NULL);
return ide_stopped;
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
if (temp > pc->buffer_size) {
printk (KERN_ERR "ide-floppy: The floppy wants to send us more data than expected - discarding data\n");
idefloppy_discard_data (drive,bcount.all);
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler (drive,&idefloppy_pc_intr,IDEFLOPPY_WAIT_CMD, NULL);
+ ide_set_handler(drive, idefloppy_pc_intr,IDEFLOPPY_WAIT_CMD, NULL);
return ide_started;
}
#if IDEFLOPPY_DEBUG_LOG
if (pc->buffer != NULL)
atapi_write(drive,pc->current_position,bcount.all); /* Write the current buffer */
else
- idefloppy_output_buffers (drive, pc, bcount.all);
+ idefloppy_output_buffers(drive, rq, pc, bcount.all);
} else {
if (pc->buffer != NULL)
atapi_read(drive,pc->current_position,bcount.all); /* Read the current buffer */
else
- idefloppy_input_buffers (drive, pc, bcount.all);
+ idefloppy_input_buffers (drive, rq, pc, bcount.all);
}
pc->actually_transferred+=bcount.all; /* Update the current position */
pc->current_position+=bcount.all;
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive,&idefloppy_pc_intr,IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */
+ ide_set_handler(drive, idefloppy_pc_intr,IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */
return ide_started;
}
* It fails at high speeds on the Iomega ZIP drive, so there's a slower version
* for that drive below. The algorithm is chosen based on drive type
*/
-static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive)
+static ide_startstop_t idefloppy_transfer_pc(struct ata_device *drive, struct request *rq)
{
ide_startstop_t startstop;
idefloppy_floppy_t *floppy = drive->driver_data;
return ide_stopped;
}
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler (drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* Set the interrupt routine */
+ ide_set_handler (drive, idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* Set the interrupt routine */
atapi_write(drive, floppy->pc->c, 12); /* Send the actual packet */
return ide_started;
* packet, we schedule the packet transfer to occur about 2-3 ticks
* later in transfer_pc2.
*/
-static int idefloppy_transfer_pc2 (ide_drive_t *drive)
+static int idefloppy_transfer_pc2(struct ata_device *drive, struct request *__rq)
{
idefloppy_floppy_t *floppy = drive->driver_data;
return IDEFLOPPY_WAIT_CMD; /* Timeout for the packet command */
}
-static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive)
+static ide_startstop_t idefloppy_transfer_pc1(struct ata_device *drive, struct request *__rq)
{
idefloppy_floppy_t *floppy = drive->driver_data;
ide_startstop_t startstop;
* 25msec is too short, 40 and 50msec work well. idefloppy_pc_intr will
* not be actually used until after the packet is moved in about 50 msec.
*/
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler (drive,
- &idefloppy_pc_intr, /* service routine for packet command */
+ ide_set_handler(drive,
+ idefloppy_pc_intr, /* service routine for packet command */
floppy->ticks, /* wait this long before "failing" */
- &idefloppy_transfer_pc2); /* fail == transfer_pc2 */
+ idefloppy_transfer_pc2); /* fail == transfer_pc2 */
return ide_started;
}
/*
* Issue a packet command
*/
-static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *pc)
+static ide_startstop_t idefloppy_issue_pc(struct ata_device *drive, struct request *rq, idefloppy_pc_t *pc)
{
idefloppy_floppy_t *floppy = drive->driver_data;
idefloppy_bcount_reg_t bcount;
int dma_ok = 0;
- ide_handler_t *pkt_xfer_routine;
+ ata_handler_t *pkt_xfer_routine;
#if IDEFLOPPY_DEBUG_BUGS
if (floppy->pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD && pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD) {
pc->error = IDEFLOPPY_ERROR_GENERAL; /* Giving up */
}
floppy->failed_pc=NULL;
- pc->callback(drive);
+ pc->callback(drive, rq);
return ide_stopped;
}
#if IDEFLOPPY_DEBUG_LOG
#ifdef CONFIG_BLK_DEV_IDEDMA
if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags)) {
- (void) drive->channel->dmaproc(ide_dma_off, drive);
+ (void) drive->channel->udma(ide_dma_off, drive, NULL);
}
if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
- dma_ok=!drive->channel->dmaproc(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive);
+ dma_ok=!drive->channel->udma(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive, rq);
#endif /* CONFIG_BLK_DEV_IDEDMA */
if (IDE_CONTROL_REG)
#ifdef CONFIG_BLK_DEV_IDEDMA
if (dma_ok) { /* Begin DMA, if necessary */
set_bit (PC_DMA_IN_PROGRESS, &pc->flags);
- (void) drive->channel->dmaproc(ide_dma_begin, drive);
+ (void) drive->channel->udma(ide_dma_begin, drive, NULL);
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
}
if (test_bit (IDEFLOPPY_DRQ_INTERRUPT, &floppy->flags)) {
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler (drive, pkt_xfer_routine, IDEFLOPPY_WAIT_CMD, NULL);
+ ide_set_handler(drive, pkt_xfer_routine, IDEFLOPPY_WAIT_CMD, NULL);
OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* Issue the packet command */
return ide_started;
} else {
OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG);
- return (*pkt_xfer_routine) (drive);
+ return pkt_xfer_routine(drive, rq);
}
}
-static void idefloppy_rw_callback (ide_drive_t *drive)
+static void idefloppy_rw_callback(struct ata_device *drive, struct request *rq)
{
#if IDEFLOPPY_DEBUG_LOG
printk (KERN_INFO "ide-floppy: Reached idefloppy_rw_callback\n");
#endif /* IDEFLOPPY_DEBUG_LOG */
- idefloppy_end_request(drive, 1);
+ idefloppy_end_request(drive, rq, 1);
return;
}
2 * test_bit (IDEFLOPPY_USE_READ12, &floppy->flags), block, blocks);
#endif /* IDEFLOPPY_DEBUG_LOG */
- idefloppy_init_pc (pc);
+ idefloppy_init_pc(pc);
if (test_bit (IDEFLOPPY_USE_READ12, &floppy->flags)) {
pc->c[0] = cmd == READ ? IDEFLOPPY_READ12_CMD : IDEFLOPPY_WRITE12_CMD;
put_unaligned (htonl (blocks), (unsigned int *) &pc->c[6]);
put_unaligned (htons (blocks), (unsigned short *) &pc->c[7]);
}
put_unaligned (htonl (block), (unsigned int *) &pc->c[2]);
- pc->callback = &idefloppy_rw_callback;
- pc->rq = rq;
+ pc->callback = idefloppy_rw_callback;
pc->b_data = rq->buffer;
pc->b_count = cmd == READ ? 0 : rq->bio->bi_size;
if (rq->flags & REQ_RW)
drive->name, floppy->failed_pc->c[0], floppy->sense_key, floppy->asc, floppy->ascq);
else
printk (KERN_ERR "ide-floppy: %s: I/O error\n", drive->name);
- idefloppy_end_request(drive, 0);
+ idefloppy_end_request(drive, rq, 0);
return ide_stopped;
}
if (rq->flags & REQ_CMD) {
if (rq->sector % floppy->bs_factor || rq->nr_sectors % floppy->bs_factor) {
printk ("%s: unsupported r/w request size\n", drive->name);
- idefloppy_end_request(drive, 0);
+ idefloppy_end_request(drive, rq, 0);
return ide_stopped;
}
pc = idefloppy_next_pc_storage(drive);
pc = (idefloppy_pc_t *) rq->buffer;
} else {
blk_dump_rq_flags(rq, "ide-floppy: unsupported command in queue");
- idefloppy_end_request(drive, 0);
+ idefloppy_end_request(drive, rq, 0);
return ide_stopped;
}
- pc->rq = rq;
- return idefloppy_issue_pc (drive, pc);
+
+ return idefloppy_issue_pc(drive, rq, pc);
}
/*
drive->waiting_for_dma = 1;
if (drive->type != ATA_DISK)
return 0;
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
+ ide_set_handler(drive, ide_dma_intr, WAIT_CMD, NULL);
if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_ACB) &&
(drive->addressing == 1)) {
struct ata_taskfile *args = HWGROUP(drive)->rq->special;
int b_count;
byte *buffer; /* Data buffer */
byte *current_position; /* Pointer into the above buffer */
- ide_startstop_t (*callback) (ide_drive_t *); /* Called when this packet command is completed */
+ /* Called when this packet command is completed */
+ ide_startstop_t (*callback) (struct ata_device *, struct request *);
byte pc_buffer[IDETAPE_PC_BUFFER_SIZE]; /* Temporary buffer */
unsigned long flags; /* Status/Action bit flags: long for set_bit */
} idetape_pc_t;
* idetape_end_request is used to finish servicing a request, and to
* insert a pending pipeline request into the main device queue.
*/
-static int idetape_end_request(ide_drive_t *drive, int uptodate)
+static int idetape_end_request(struct ata_device *drive, struct request *rq, int uptodate)
{
- struct request *rq = HWGROUP(drive)->rq;
idetape_tape_t *tape = drive->driver_data;
unsigned long flags;
int error;
return 0;
}
-static ide_startstop_t idetape_request_sense_callback (ide_drive_t *drive)
+static ide_startstop_t idetape_request_sense_callback(struct ata_device *drive, struct request *rq)
{
idetape_tape_t *tape = drive->driver_data;
#endif /* IDETAPE_DEBUG_LOG */
if (!tape->pc->error) {
idetape_analyze_error (drive, (idetape_request_sense_result_t *) tape->pc->buffer);
- idetape_end_request(drive, 1);
+ idetape_end_request(drive, rq, 1);
} else {
printk (KERN_ERR "ide-tape: Error in REQUEST SENSE itself - Aborting request!\n");
- idetape_end_request(drive, 0);
+ idetape_end_request(drive, rq, 0);
}
return ide_stopped;
}
static void idetape_create_request_sense_cmd (idetape_pc_t *pc)
{
- idetape_init_pc (pc);
+ idetape_init_pc (pc);
pc->c[0] = IDETAPE_REQUEST_SENSE_CMD;
pc->c[4] = 20;
pc->request_transfer = 18;
* ide.c will be able to service requests from another device on
* the same interface while we are polling for DSC.
*/
-static void idetape_postpone_request (ide_drive_t *drive)
+static void idetape_postpone_request(struct ata_device *drive, struct request *rq)
{
idetape_tape_t *tape = drive->driver_data;
if (tape->debug_level >= 4)
printk(KERN_INFO "ide-tape: idetape_postpone_request\n");
#endif
- tape->postponed_rq = HWGROUP(drive)->rq;
+ tape->postponed_rq = rq;
ide_stall_queue(drive, tape->dsc_polling_frequency);
}
* algorithm described before idetape_issue_packet_command.
*
*/
-static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
+static ide_startstop_t idetape_pc_intr(struct ata_device *drive, struct request *rq)
{
idetape_tape_t *tape = drive->driver_data;
idetape_status_reg_t status;
#ifdef CONFIG_BLK_DEV_IDEDMA
if (test_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
- if (drive->channel->dmaproc(ide_dma_end, drive)) {
+ if (drive->channel->udma(ide_dma_end, drive, NULL)) {
/*
* A DMA error is sometimes expected. For example,
* if the tape is crossing a filemark during a
tape->dsc_polling_start = jiffies;
tape->dsc_polling_frequency = IDETAPE_DSC_MA_FAST;
tape->dsc_timeout = jiffies + IDETAPE_DSC_MA_TIMEOUT;
- idetape_postpone_request (drive); /* Allow ide.c to handle other requests */
+ idetape_postpone_request(drive, rq); /* Allow ide.c to handle other requests */
return ide_stopped;
}
if (tape->failed_pc == pc)
tape->failed_pc = NULL;
- return pc->callback(drive); /* Command finished - Call the callback function */
+ return pc->callback(drive, rq); /* Command finished - Call the callback function */
}
#ifdef CONFIG_BLK_DEV_IDEDMA
if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
printk (KERN_ERR "ide-tape: The tape wants to issue more interrupts in DMA mode\n");
printk (KERN_ERR "ide-tape: DMA disabled, reverting to PIO\n");
- drive->channel->dmaproc(ide_dma_off, drive);
+ drive->channel->udma(ide_dma_off, drive, NULL);
return ide_stopped;
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
if (temp > pc->buffer_size) {
printk (KERN_ERR "ide-tape: The tape wants to send us more data than expected - discarding data\n");
idetape_discard_data (drive, bcount.all);
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL);
+ ide_set_handler(drive, idetape_pc_intr, IDETAPE_WAIT_CMD, NULL);
return ide_started;
}
#if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 2)
printk(KERN_INFO "ide-tape: [cmd %x] transferred %d bytes on that interrupt\n", pc->c[0], bcount.all);
#endif
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); /* And set the interrupt handler again */
+ ide_set_handler(drive, idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); /* And set the interrupt handler again */
return ide_started;
}
* we will handle the next request.
*
*/
-static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
+static ide_startstop_t idetape_transfer_pc(struct ata_device *drive, struct request *__rq)
{
idetape_tape_t *tape = drive->driver_data;
idetape_pc_t *pc = tape->pc;
return ide_stopped;
}
tape->cmd_start_time = jiffies;
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); /* Set the interrupt routine */
+ ide_set_handler(drive, idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); /* Set the interrupt routine */
atapi_write(drive,pc->c,12); /* Send the actual packet */
return ide_started;
}
-static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape_pc_t *pc)
+static ide_startstop_t idetape_issue_packet_command(struct ata_device *drive, struct request *rq, idetape_pc_t *pc)
{
idetape_tape_t *tape = drive->driver_data;
idetape_bcount_reg_t bcount;
pc->error = IDETAPE_ERROR_GENERAL; /* Giving up */
}
tape->failed_pc = NULL;
- return pc->callback(drive);
+ return pc->callback(drive, rq);
}
#if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 2)
#ifdef CONFIG_BLK_DEV_IDEDMA
if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags)) {
printk (KERN_WARNING "ide-tape: DMA disabled, reverting to PIO\n");
- (void) drive->channel->dmaproc(ide_dma_off, drive);
+ (void) drive->channel->udma(ide_dma_off, drive, NULL);
}
if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
- dma_ok = !drive->channel->dmaproc(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive);
+ dma_ok = !drive->channel->udma(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive, rq);
#endif /* CONFIG_BLK_DEV_IDEDMA */
if (IDE_CONTROL_REG)
#ifdef CONFIG_BLK_DEV_IDEDMA
if (dma_ok) { /* Begin DMA, if necessary */
set_bit (PC_DMA_IN_PROGRESS, &pc->flags);
- (void) drive->channel->dmaproc(ide_dma_begin, drive);
+ (void) drive->channel->udma(ide_dma_begin, drive, NULL);
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) {
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &idetape_transfer_pc, IDETAPE_WAIT_CMD, NULL);
+ ide_set_handler(drive, idetape_transfer_pc, IDETAPE_WAIT_CMD, NULL);
OUT_BYTE(WIN_PACKETCMD, IDE_COMMAND_REG);
return ide_started;
} else {
OUT_BYTE(WIN_PACKETCMD, IDE_COMMAND_REG);
- return idetape_transfer_pc(drive);
+ return idetape_transfer_pc(drive, rq);
}
}
/*
* General packet command callback function.
*/
-static ide_startstop_t idetape_pc_callback (ide_drive_t *drive)
+static ide_startstop_t idetape_pc_callback(struct ata_device *drive, struct request *rq)
{
idetape_tape_t *tape = drive->driver_data;
printk (KERN_INFO "ide-tape: Reached idetape_pc_callback\n");
#endif /* IDETAPE_DEBUG_LOG */
- idetape_end_request(drive, tape->pc->error ? 0 : 1);
+ idetape_end_request(drive, rq, tape->pc->error ? 0 : 1);
return ide_stopped;
}
pc->request_transfer = 24;
else
pc->request_transfer = 50;
- pc->callback = &idetape_pc_callback;
+ pc->callback = idetape_pc_callback;
}
-static ide_startstop_t idetape_onstream_buffer_fill_callback (ide_drive_t *drive)
+static ide_startstop_t idetape_onstream_buffer_fill_callback (struct ata_device *drive, struct request *rq)
{
idetape_tape_t *tape = drive->driver_data;
if (tape->debug_level >= 1)
printk(KERN_INFO "ide-tape: buffer fill callback, %d/%d\n", tape->cur_frames, tape->max_frames);
#endif
- idetape_end_request(drive, tape->pc->error ? 0 : 1);
+ idetape_end_request(drive, rq, tape->pc->error ? 0 : 1);
return ide_stopped;
}
tape->max_insert_speed = max(tape->max_insert_speed, 500);
}
-static ide_startstop_t idetape_media_access_finished (ide_drive_t *drive)
+static ide_startstop_t idetape_media_access_finished(struct ata_device *drive, struct request *rq)
{
idetape_tape_t *tape = drive->driver_data;
idetape_pc_t *pc = tape->pc;
pc->error = IDETAPE_ERROR_GENERAL;
tape->failed_pc = NULL;
}
- return pc->callback (drive);
+ return pc->callback(drive, rq);
}
-static ide_startstop_t idetape_rw_callback (ide_drive_t *drive)
+static ide_startstop_t idetape_rw_callback(struct ata_device *drive, struct request *rq)
{
idetape_tape_t *tape = drive->driver_data;
- struct request *rq = HWGROUP(drive)->rq;
int blocks = tape->pc->actually_transferred / tape->tape_block_size;
tape->avg_size += blocks * tape->tape_block_size;
rq->current_nr_sectors -= blocks;
if (!tape->pc->error)
- idetape_end_request(drive, 1);
+ idetape_end_request(drive, rq, 1);
else
- idetape_end_request(drive, tape->pc->error);
+ idetape_end_request(drive, rq, tape->pc->error);
return ide_stopped;
}
pc->c[0] = IDETAPE_READ_CMD;
put_unaligned (htonl (length), (unsigned int *) &pc->c[1]);
pc->c[1] = 1;
- pc->callback = &idetape_rw_callback;
+ pc->callback = idetape_rw_callback;
pc->bio = bio;
bv->bv_len = 0;
pc->buffer = NULL;
pc->c[1] = IDETAPE_RETRIEVE_FAULTY_BLOCK;
pc->c[7] = size >> 8;
pc->c[8] = size & 0xff;
- pc->callback = &idetape_pc_callback;
+ pc->callback = idetape_pc_callback;
pc->bio = bio;
atomic_set(&bio->bi_cnt, 0);
pc->buffer = NULL;
pc->c[0] = IDETAPE_WRITE_CMD;
put_unaligned (htonl (length), (unsigned int *) &pc->c[1]);
pc->c[1] = 1;
- pc->callback = &idetape_rw_callback;
+ pc->callback = idetape_rw_callback;
set_bit (PC_WRITING, &pc->flags);
if (tape->onstream) {
while (p) {
* We do not support buffer cache originated requests.
*/
printk (KERN_NOTICE "ide-tape: %s: Unsupported command in request queue (%ld)\n", drive->name, rq->flags);
- ide_end_request(drive, 0); /* Let the common code handle it */
+ ide_end_request(drive, rq, 0); /* Let the common code handle it */
return ide_stopped;
}
* Retry a failed packet command
*/
if (tape->failed_pc != NULL && tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) {
- return idetape_issue_packet_command (drive, tape->failed_pc);
+ return idetape_issue_packet_command(drive, rq, tape->failed_pc);
}
#if IDETAPE_DEBUG_BUGS
if (postponed_rq != NULL)
if (rq != postponed_rq) {
printk (KERN_ERR "ide-tape: ide-tape.c bug - Two DSC requests were queued\n");
- idetape_end_request(drive, 0);
+ idetape_end_request(drive, rq, 0);
return ide_stopped;
}
#endif /* IDETAPE_DEBUG_BUGS */
} else if ((signed long) (jiffies - tape->dsc_timeout) > 0) {
printk (KERN_ERR "ide-tape: %s: DSC timeout\n", tape->name);
if (rq->flags == IDETAPE_PC_RQ2) {
- idetape_media_access_finished (drive);
+ idetape_media_access_finished(drive, rq);
return ide_stopped;
} else {
return ide_stopped;
}
} else if (jiffies - tape->dsc_polling_start > IDETAPE_DSC_MA_THRESHOLD)
tape->dsc_polling_frequency = IDETAPE_DSC_MA_SLOW;
- idetape_postpone_request (drive);
+ idetape_postpone_request(drive, rq);
return ide_stopped;
}
switch (rq->flags) {
break;
case IDETAPE_ABORTED_WRITE_RQ:
rq->flags = IDETAPE_WRITE_RQ;
- idetape_end_request(drive, IDETAPE_ERROR_EOD);
+ idetape_end_request(drive, rq, IDETAPE_ERROR_EOD);
return ide_stopped;
case IDETAPE_ABORTED_READ_RQ:
#if IDETAPE_DEBUG_LOG
printk(KERN_INFO "ide-tape: %s: detected aborted read rq\n", tape->name);
#endif
rq->flags = IDETAPE_READ_RQ;
- idetape_end_request(drive, IDETAPE_ERROR_EOD);
+ idetape_end_request(drive, rq, IDETAPE_ERROR_EOD);
return ide_stopped;
case IDETAPE_PC_RQ1:
pc = (idetape_pc_t *) rq->buffer;
rq->flags = IDETAPE_PC_RQ2;
break;
case IDETAPE_PC_RQ2:
- idetape_media_access_finished (drive);
+ idetape_media_access_finished(drive, rq);
return ide_stopped;
default:
printk (KERN_ERR "ide-tape: bug in IDETAPE_RQ_CMD macro\n");
- idetape_end_request(drive, 0);
+ idetape_end_request(drive, rq, 0);
return ide_stopped;
}
- return idetape_issue_packet_command (drive, pc);
+ return idetape_issue_packet_command(drive, rq, pc);
}
/*
spin_lock_irq(&tape->spinlock);
}
-static ide_startstop_t idetape_read_position_callback (ide_drive_t *drive)
+static ide_startstop_t idetape_read_position_callback(struct ata_device *drive, struct request *rq)
{
idetape_tape_t *tape = drive->driver_data;
idetape_read_position_result_t *result;
if (result->bpu) {
printk (KERN_INFO "ide-tape: Block location is unknown to the tape\n");
clear_bit (IDETAPE_ADDRESS_VALID, &tape->flags);
- idetape_end_request(drive, 0);
+ idetape_end_request(drive, rq, 0);
} else {
#if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 2)
tape->last_frame_position = ntohl (result->last_block);
tape->blocks_in_buffer = result->blocks_in_buffer[2];
set_bit (IDETAPE_ADDRESS_VALID, &tape->flags);
- idetape_end_request(drive, 1);
+ idetape_end_request(drive, rq, 1);
}
} else {
- idetape_end_request(drive, 0);
+ idetape_end_request(drive, rq, 0);
}
return ide_stopped;
}
pc->c[1] = 1; /* Immed bit */
pc->c[4] = write_filemark; /* not used for OnStream ?? */
set_bit (PC_WAIT_FOR_DSC, &pc->flags);
- pc->callback = &idetape_pc_callback;
+ pc->callback = idetape_pc_callback;
}
static void idetape_create_test_unit_ready_cmd(idetape_pc_t *pc)
{
idetape_init_pc(pc);
pc->c[0] = IDETAPE_TEST_UNIT_READY_CMD;
- pc->callback = &idetape_pc_callback;
+ pc->callback = idetape_pc_callback;
}
/*
pc->c[4] = 4;
}
set_bit (PC_WAIT_FOR_DSC, &pc->flags);
- pc->callback = &idetape_pc_callback;
+ pc->callback = idetape_pc_callback;
}
static int idetape_wait_ready (ide_drive_t *drive, unsigned long long timeout)
idetape_init_pc (pc);
pc->c[0] = IDETAPE_READ_POSITION_CMD;
pc->request_transfer = 20;
- pc->callback = &idetape_read_position_callback;
+ pc->callback = idetape_read_position_callback;
}
static int idetape_read_position (ide_drive_t *drive)
*/
pc->c[9] = skip << 7;
set_bit (PC_WAIT_FOR_DSC, &pc->flags);
- pc->callback = &idetape_pc_callback;
+ pc->callback = idetape_pc_callback;
}
static int idetape_create_prevent_cmd (ide_drive_t *drive, idetape_pc_t *pc, int prevent)
idetape_init_pc(pc);
pc->c[0] = IDETAPE_PREVENT_CMD;
pc->c[4] = prevent;
- pc->callback = &idetape_pc_callback;
+ pc->callback = idetape_pc_callback;
return 1;
}
idetape_init_pc(pc);
pc->c[0] = IDETAPE_INQUIRY_CMD;
pc->c[4] = pc->request_transfer = 254;
- pc->callback = &idetape_pc_callback;
+ pc->callback = idetape_pc_callback;
}
static void idetape_create_rewind_cmd (ide_drive_t *drive, idetape_pc_t *pc)
if (tape->onstream)
pc->c[1] = 1;
set_bit (PC_WAIT_FOR_DSC, &pc->flags);
- pc->callback = &idetape_pc_callback;
+ pc->callback = idetape_pc_callback;
}
static void idetape_create_mode_select_cmd (idetape_pc_t *pc, int length)
pc->c[1] = 0x10;
put_unaligned (htons(length), (unsigned short *) &pc->c[3]);
pc->request_transfer = 255;
- pc->callback = &idetape_pc_callback;
+ pc->callback = idetape_pc_callback;
}
static void idetape_create_erase_cmd (idetape_pc_t *pc)
pc->c[0] = IDETAPE_ERASE_CMD;
pc->c[1] = 1;
set_bit (PC_WAIT_FOR_DSC, &pc->flags);
- pc->callback = &idetape_pc_callback;
+ pc->callback = idetape_pc_callback;
}
static void idetape_create_space_cmd (idetape_pc_t *pc,int count,byte cmd)
{
byte stat = 0;
if (drive->waiting_for_dma)
- return drive->channel->dmaproc(ide_dma_test_irq, drive);
+ return drive->channel->udma(ide_dma_test_irq, drive, NULL);
#if 0
/* need to guarantee 400ns since last command was issued */
udelay(1);
{
int i;
-
if (drive_is_ready(drive))
return;
}
}
-static ide_startstop_t pre_task_mulout_intr(ide_drive_t *drive, struct request *rq)
+static ide_startstop_t pre_task_mulout_intr(struct ata_device *drive, struct request *rq)
{
struct ata_taskfile *args = rq->special;
ide_startstop_t startstop;
- /*
- * assign private copy for multi-write
- */
- memcpy(&HWGROUP(drive)->wrq, rq, sizeof(struct request));
-
if (ide_wait_stat(&startstop, drive, DATA_READY, drive->bad_wstat, WAIT_DRQ))
return startstop;
ata_poll_drive_ready(drive);
- return args->handler(drive);
+ return args->handler(drive, rq);
}
-static ide_startstop_t task_mulout_intr (ide_drive_t *drive)
+static ide_startstop_t task_mulout_intr(struct ata_device *drive, struct request *rq)
{
- byte stat = GET_STAT();
- struct request *rq = &HWGROUP(drive)->wrq;
- ide_hwgroup_t *hwgroup = HWGROUP(drive);
- int mcount = drive->mult_count;
+ u8 stat = GET_STAT();
+ ide_hwgroup_t *hwgroup = HWGROUP(drive);
+ int mcount = drive->mult_count;
ide_startstop_t startstop;
/*
if (!rq->nr_sectors) {
if (stat & (ERR_STAT|DRQ_STAT)) {
startstop = ide_error(drive, "task_mulout_intr", stat);
- memcpy(rq, HWGROUP(drive)->rq, sizeof(struct request));
+
return startstop;
}
- __ide_end_request(drive, 1, rq->hard_nr_sectors);
+ __ide_end_request(drive, rq, 1, rq->hard_nr_sectors);
rq->bio = NULL;
return ide_stopped;
if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) {
if (stat & (ERR_STAT | DRQ_STAT)) {
startstop = ide_error(drive, "task_mulout_intr", stat);
- memcpy(rq, HWGROUP(drive)->rq, sizeof(struct request));
+
return startstop;
}
else
printk(" rq-> = null\n");
#endif
-
+
/* (ks/hs): Moved to start, do not use for multiple out commands */
if (args->handler != task_mulout_intr) {
if (IDE_CONTROL_REG)
} else {
/* for dma commands we down set the handler */
if (drive->using_dma &&
- !(drive->channel->dmaproc(((args->taskfile.command == WIN_WRITEDMA)
+ !(drive->channel->udma(((args->taskfile.command == WIN_WRITEDMA)
|| (args->taskfile.command == WIN_WRITEDMA_EXT))
- ? ide_dma_write : ide_dma_read, drive)));
+ ? ide_dma_write : ide_dma_read, drive, rq)));
}
return ide_started;
/*
* This is invoked on completion of a WIN_SETMULT cmd.
*/
-ide_startstop_t set_multmode_intr(struct ata_device *drive)
+ide_startstop_t set_multmode_intr(struct ata_device *drive, struct request *__rq)
{
u8 stat;
- if (OK_STAT(stat=GET_STAT(),READY_STAT,BAD_STAT)) {
+ if (OK_STAT(stat = GET_STAT(),READY_STAT,BAD_STAT)) {
drive->mult_count = drive->mult_req;
} else {
drive->mult_req = drive->mult_count = 0;
/*
* This is invoked on completion of a WIN_SPECIFY cmd.
*/
-ide_startstop_t set_geometry_intr (ide_drive_t *drive)
+ide_startstop_t set_geometry_intr(struct ata_device *drive, struct request *__rq)
{
- byte stat;
+ u8 stat;
if (OK_STAT(stat=GET_STAT(),READY_STAT,BAD_STAT))
return ide_stopped;
if (stat & (ERR_STAT|DRQ_STAT))
return ide_error(drive, "set_geometry_intr", stat);
- ide_set_handler(drive, &set_geometry_intr, WAIT_CMD, NULL);
+ ide_set_handler(drive, set_geometry_intr, WAIT_CMD, NULL);
return ide_started;
}
/*
* This is invoked on completion of a WIN_RESTORE (recalibrate) cmd.
*/
-ide_startstop_t recal_intr(ide_drive_t *drive)
+ide_startstop_t recal_intr(struct ata_device *drive, struct request *__rq)
{
- byte stat = GET_STAT();
+ u8 stat;
- if (!OK_STAT(stat,READY_STAT,BAD_STAT))
+ if (!OK_STAT(stat = GET_STAT(),READY_STAT,BAD_STAT))
return ide_error(drive, "recal_intr", stat);
return ide_stopped;
}
/*
* Handler for commands without a data phase
*/
-ide_startstop_t task_no_data_intr (ide_drive_t *drive)
+ide_startstop_t task_no_data_intr(struct ata_device *drive, struct request *rq)
{
- struct ata_taskfile *args = HWGROUP(drive)->rq->special;
- byte stat = GET_STAT();
+ u8 stat;
+ struct ata_taskfile *args = rq->special;
ide__sti(); /* local CPU only */
- if (!OK_STAT(stat, READY_STAT, BAD_STAT))
+ if (!OK_STAT(stat = GET_STAT(), READY_STAT, BAD_STAT))
return ide_error(drive, "task_no_data_intr", stat);
/* calls ide_end_drive_cmd */
if (args)
/*
* Handler for command with PIO data-in phase
*/
-static ide_startstop_t task_in_intr (ide_drive_t *drive)
+static ide_startstop_t task_in_intr (struct ata_device *drive, struct request *rq)
{
- byte stat = GET_STAT();
- struct request *rq = HWGROUP(drive)->rq;
- char *pBuf = NULL;
+ u8 stat = GET_STAT();
+ char *pBuf = NULL;
unsigned long flags;
if (!OK_STAT(stat,DATA_READY,BAD_R_STAT)) {
}
if (!(stat & BUSY_STAT)) {
DTF("task_in_intr to Soon wait for next interrupt\n");
- ide_set_handler(drive, &task_in_intr, WAIT_CMD, NULL);
+ ide_set_handler(drive, task_in_intr, WAIT_CMD, NULL);
return ide_started;
}
}
*/
if (--rq->current_nr_sectors <= 0) {
DTF("Request Ended stat: %02x\n", GET_STAT());
- if (!ide_end_request(drive, 1))
+ if (!ide_end_request(drive, rq, 1))
return ide_stopped;
}
/*
* still data left to transfer
*/
- ide_set_handler(drive, &task_in_intr, WAIT_CMD, NULL);
+ ide_set_handler(drive, task_in_intr, WAIT_CMD, NULL);
return ide_started;
}
-static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq)
+static ide_startstop_t pre_task_out_intr(struct ata_device *drive, struct request *rq)
{
struct ata_taskfile *args = rq->special;
ide_startstop_t startstop;
ide_unmap_rq(rq, buf, &flags);
} else {
ata_poll_drive_ready(drive);
- return args->handler(drive);
+ return args->handler(drive, rq);
}
return ide_started;
}
/*
* Handler for command with PIO data-out phase
*/
-static ide_startstop_t task_out_intr(ide_drive_t *drive)
+static ide_startstop_t task_out_intr(struct ata_device *drive, struct request *rq)
{
- byte stat = GET_STAT();
- struct request *rq = HWGROUP(drive)->rq;
- char *pBuf = NULL;
+ u8 stat = GET_STAT();
+ char *pBuf = NULL;
unsigned long flags;
if (!OK_STAT(stat,DRIVE_READY,drive->bad_wstat))
return ide_error(drive, "task_out_intr", stat);
if (!rq->current_nr_sectors)
- if (!ide_end_request(drive, 1))
+ if (!ide_end_request(drive, rq, 1))
return ide_stopped;
if ((rq->current_nr_sectors==1) ^ (stat & DRQ_STAT)) {
- rq = HWGROUP(drive)->rq;
pBuf = ide_map_rq(rq, &flags);
DTF("write: %p, rq->current_nr_sectors: %d\n", pBuf, (int) rq->current_nr_sectors);
/*
* Handler for command with Read Multiple
*/
-static ide_startstop_t task_mulin_intr(ide_drive_t *drive)
+static ide_startstop_t task_mulin_intr(struct ata_device *drive, struct request *rq)
{
- unsigned int msect, nsect;
- byte stat = GET_STAT();
- struct request *rq = HWGROUP(drive)->rq;
- char *pBuf = NULL;
+ u8 stat;
+ char *pBuf = NULL;
+ unsigned int msect, nsect;
unsigned long flags;
- if (!OK_STAT(stat,DATA_READY,BAD_R_STAT)) {
+ if (!OK_STAT(stat = GET_STAT(),DATA_READY,BAD_R_STAT)) {
if (stat & (ERR_STAT|DRQ_STAT)) {
return ide_error(drive, "task_mulin_intr", stat);
}
rq->current_nr_sectors -= nsect;
msect -= nsect;
if (!rq->current_nr_sectors) {
- if (!ide_end_request(drive, 1))
+ if (!ide_end_request(drive, rq, 1))
return ide_stopped;
}
} while (msect);
return 0; /* no, it is not a flash memory card */
}
-int __ide_end_request(struct ata_device *drive, int uptodate, int nr_secs)
+int __ide_end_request(struct ata_device *drive, struct request *rq, int uptodate, int nr_secs)
{
- struct request *rq;
unsigned long flags;
int ret = 1;
spin_lock_irqsave(&ide_lock, flags);
- rq = HWGROUP(drive)->rq;
BUG_ON(!(rq->flags & REQ_STARTED));
if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) {
drive->state = 0;
- drive->channel->dmaproc(ide_dma_on, drive);
+ drive->channel->udma(ide_dma_on, drive, rq);
}
if (!end_that_request_first(rq, uptodate, nr_secs)) {
* timer is started to prevent us from waiting forever in case
* something goes wrong (see the ide_timer_expiry() handler later on).
*/
-void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler,
- unsigned int timeout, ide_expiry_t *expiry)
+void ide_set_handler(struct ata_device *drive, ata_handler_t handler,
+ unsigned long timeout, ata_expiry_t expiry)
{
unsigned long flags;
ide_hwgroup_t *hwgroup = HWGROUP(drive);
spin_unlock_irqrestore(&ide_lock, flags);
}
-static void ata_pre_reset(ide_drive_t *drive)
+static void ata_pre_reset(struct ata_device *drive)
{
if (ata_ops(drive) && ata_ops(drive)->pre_reset)
ata_ops(drive)->pre_reset(drive);
/* check the DMA crc count */
if (drive->crc_count) {
- drive->channel->dmaproc(ide_dma_off_quietly, drive);
+ drive->channel->udma(ide_dma_off_quietly, drive, NULL);
if ((drive->channel->speedproc) != NULL)
drive->channel->speedproc(drive, ide_auto_reduce_xfer(drive));
if (drive->current_speed >= XFER_SW_DMA_0)
- drive->channel->dmaproc(ide_dma_on, drive);
+ drive->channel->udma(ide_dma_on, drive, NULL);
} else
- drive->channel->dmaproc(ide_dma_off, drive);
+ drive->channel->udma(ide_dma_off, drive, NULL);
}
/*
* operation. If the drive has not yet responded, and we have not yet hit our
* maximum waiting time, then the timer is restarted for another 50ms.
*/
-static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive)
+static ide_startstop_t atapi_reset_pollfunc(struct ata_device *drive, struct request *__rq)
{
ide_hwgroup_t *hwgroup = HWGROUP(drive);
byte stat;
printk("%s: ATAPI reset complete\n", drive->name);
} else {
if (time_before(jiffies, hwgroup->poll_timeout)) {
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler (drive, &atapi_reset_pollfunc, HZ/20, NULL);
+ ide_set_handler (drive, atapi_reset_pollfunc, HZ/20, NULL);
return ide_started; /* continue polling */
}
hwgroup->poll_timeout = 0; /* end of polling */
return do_reset1 (drive, 1); /* do it the old fashioned way */
}
hwgroup->poll_timeout = 0; /* done polling */
+
return ide_stopped;
}
* If the drives have not yet responded, and we have not yet hit our maximum
* waiting time, then the timer is restarted for another 50ms.
*/
-static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
+static ide_startstop_t reset_pollfunc(struct ata_device *drive, struct request *__rq)
{
ide_hwgroup_t *hwgroup = HWGROUP(drive);
struct ata_channel *hwif = drive->channel;
if (!OK_STAT(stat=GET_STAT(), 0, BUSY_STAT)) {
if (time_before(jiffies, hwgroup->poll_timeout)) {
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler (drive, &reset_pollfunc, HZ/20, NULL);
+ ide_set_handler(drive, reset_pollfunc, HZ/20, NULL);
return ide_started; /* continue polling */
}
printk("%s: reset timed-out, status=0x%02x\n", hwif->name, stat);
#if FANCY_STATUS_DUMPS
u8 val;
- static const char *messages[5] = {
+ static char *messages[5] = {
" passed",
" formatter device",
" sector buffer",
ata_pre_reset(drive);
SELECT_DRIVE(hwif,drive);
udelay (20);
- OUT_BYTE (WIN_SRST, IDE_COMMAND_REG);
+ OUT_BYTE(WIN_SRST, IDE_COMMAND_REG);
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler (drive, &atapi_reset_pollfunc, HZ/20, NULL);
- __restore_flags (flags); /* local CPU only */
+ ide_set_handler(drive, atapi_reset_pollfunc, HZ/20, NULL);
+ __restore_flags(flags); /* local CPU only */
return ide_started;
}
}
udelay(10); /* more than enough time */
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL);
+ ide_set_handler(drive, reset_pollfunc, HZ/20, NULL);
/*
* Some weird controller like resetting themselves to a strange
if (rq->errors >= ERROR_MAX) {
if (ata_ops(drive) && ata_ops(drive)->end_request)
- ata_ops(drive)->end_request(drive, 0);
+ ata_ops(drive)->end_request(drive, rq, 0);
else
- ide_end_request(drive, 0);
+ ide_end_request(drive, rq, 0);
} else {
if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
++rq->errors;
/*
* Issue a simple drive command. The drive must be selected beforehand.
*/
-void ide_cmd(ide_drive_t *drive, byte cmd, byte nsect, ide_handler_t *handler)
+void ide_cmd(ide_drive_t *drive, byte cmd, byte nsect, ata_handler_t handler)
{
- BUG_ON(HWGROUP(drive)->handler);
ide_set_handler (drive, handler, WAIT_CMD, NULL);
if (IDE_CONTROL_REG)
OUT_BYTE(drive->ctl,IDE_CONTROL_REG); /* clear nIEN */
/*
* Invoked on completion of a special DRIVE_CMD.
*/
-static ide_startstop_t drive_cmd_intr(ide_drive_t *drive)
+static ide_startstop_t drive_cmd_intr(struct ata_device *drive, struct request *rq)
{
- struct request *rq = HWGROUP(drive)->rq;
u8 *args = rq->buffer;
u8 stat = GET_STAT();
int retries = 10;
if (ata_ops(drive)->do_request)
return ata_ops(drive)->do_request(drive, rq, block);
else {
- ide_end_request(drive, 0);
+ ide_end_request(drive, rq, 0);
return ide_stopped;
}
}
kill_rq:
if (ata_ops(drive) && ata_ops(drive)->end_request)
- ata_ops(drive)->end_request(drive, 0);
+ ata_ops(drive)->end_request(drive, rq, 0);
else
- ide_end_request(drive, 0);
+ ide_end_request(drive, rq, 0);
return ide_stopped;
* retry the current request in PIO mode instead of risking tossing it
* all away
*/
-void ide_dma_timeout_retry(ide_drive_t *drive)
+static void dma_timeout_retry(ide_drive_t *drive, struct request *rq)
{
struct ata_channel *hwif = drive->channel;
- struct request *rq;
/*
* end current dma transaction
*/
- hwif->dmaproc(ide_dma_end, drive);
+ hwif->udma(ide_dma_end, drive, rq);
/*
* complain a little, later we might remove some of this verbosity
*/
printk("%s: timeout waiting for DMA\n", drive->name);
- hwif->dmaproc(ide_dma_timeout, drive);
+ hwif->udma(ide_dma_timeout, drive, rq);
/*
* Disable dma for now, but remember that we did so because of
*/
drive->retry_pio++;
drive->state = DMA_PIO_RETRY;
- hwif->dmaproc(ide_dma_off_quietly, drive);
+ hwif->udma(ide_dma_off_quietly, drive, rq);
/*
* un-busy drive etc (hwgroup->busy is cleared on return) and
* make sure request is sane
*/
- rq = HWGROUP(drive)->rq;
HWGROUP(drive)->rq = NULL;
rq->errors = 0;
*/
void ide_timer_expiry(unsigned long data)
{
- ide_hwgroup_t *hwgroup = (ide_hwgroup_t *) data;
- ide_handler_t *handler;
- ide_expiry_t *expiry;
- unsigned long flags;
- unsigned long wait;
+ ide_hwgroup_t *hwgroup = (ide_hwgroup_t *) data;
+ ata_handler_t *handler;
+ ata_expiry_t *expiry;
+ unsigned long flags;
+ unsigned long wait;
/*
* A global lock protects timers etc -- shouldn't get contention
printk("%s: ide_timer_expiry: hwgroup was not busy??\n", drive->name);
if ((expiry = hwgroup->expiry) != NULL) {
/* continue */
- if ((wait = expiry(drive)) != 0) {
+ if ((wait = expiry(drive, HWGROUP(drive)->rq)) != 0) {
/* reengage timer */
hwgroup->timer.expires = jiffies + wait;
add_timer(&hwgroup->timer);
#endif
__cli(); /* local CPU only, as if we were handling an interrupt */
if (hwgroup->poll_timeout != 0) {
- startstop = handler(drive);
+ startstop = handler(drive, ch->hwgroup->rq);
} else if (drive_is_ready(drive)) {
if (drive->waiting_for_dma)
- ch->dmaproc(ide_dma_lostirq, drive);
+ ch->udma(ide_dma_lostirq, drive, ch->hwgroup->rq);
(void) ide_ack_intr(ch);
printk("%s: lost interrupt\n", drive->name);
- startstop = handler(drive);
+ startstop = handler(drive, ch->hwgroup->rq);
} else {
if (drive->waiting_for_dma) {
startstop = ide_stopped;
- ide_dma_timeout_retry(drive);
+ dma_timeout_retry(drive, ch->hwgroup->rq);
} else
startstop = ide_error(drive, "irq timeout", GET_STAT());
}
}
/*
- * entry point for all interrupts, caller does __cli() for us
+ * Entry point for all interrupts, caller does __cli() for us.
*/
void ata_irq_request(int irq, void *data, struct pt_regs *regs)
{
unsigned long flags;
struct ata_device *drive;
- ide_handler_t *handler;
+ ata_handler_t *handler = hwgroup->handler;
ide_startstop_t startstop;
spin_lock_irqsave(&ide_lock, flags);
if (!ide_ack_intr(ch))
goto out_lock;
- if ((handler = hwgroup->handler) == NULL || hwgroup->poll_timeout != 0) {
+ if (handler == NULL || hwgroup->poll_timeout != 0) {
#if 0
printk(KERN_INFO "ide: unexpected interrupt %d %d\n", ch->unit, irq);
#endif
if (ch->unmask)
ide__sti(); /* local CPU only */
- startstop = handler(drive); /* service this interrupt, may set handler for next interrupt */
+
+ /* service this interrupt, may set handler for next interrupt */
+ startstop = handler(drive, hwgroup->rq);
spin_lock_irq(&ide_lock);
/*
ch->ata_write = old_hwif.ata_write;
ch->atapi_read = old_hwif.atapi_read;
ch->atapi_write = old_hwif.atapi_write;
- ch->dmaproc = old_hwif.dmaproc;
+ ch->udma = old_hwif.udma;
ch->busproc = old_hwif.busproc;
ch->bus_state = old_hwif.bus_state;
ch->dma_base = old_hwif.dma_base;
return 0;
}
-static int set_using_dma (ide_drive_t *drive, int arg)
+static int set_using_dma(ide_drive_t *drive, int arg)
{
if (!drive->driver)
return -EPERM;
- if (!drive->id || !(drive->id->capability & 1) || !drive->channel->dmaproc)
+ if (!drive->id || !(drive->id->capability & 1) || !drive->channel->udma)
return -EPERM;
- if (drive->channel->dmaproc(arg ? ide_dma_on : ide_dma_off, drive))
+ if (drive->channel->udma(arg ? ide_dma_on : ide_dma_off, drive, NULL))
return -EIO;
return 0;
}
/****************************************************************************/
/* This is the default end request function as well */
-int ide_end_request(ide_drive_t *drive, int uptodate)
+int ide_end_request(struct ata_device *drive, struct request *rq, int uptodate)
{
- return __ide_end_request(drive, uptodate, 0);
+ return __ide_end_request(drive, rq, uptodate, 0);
}
/*
restore_flags(flags); /* all CPUs */
/* FIXME: Check what this magic number is supposed to be about? */
if (drive->autotune != 2) {
- if (drive->channel->dmaproc != NULL) {
+ if (drive->channel->udma) {
/*
* Force DMAing for the beginning of the check. Some
* PARANOIA!!!
*/
- drive->channel->dmaproc(ide_dma_off_quietly, drive);
- drive->channel->dmaproc(ide_dma_check, drive);
+ drive->channel->udma(ide_dma_off_quietly, drive, NULL);
+ drive->channel->udma(ide_dma_check, drive, NULL);
}
/* Only CD-ROMs and tape drives support DSC overlap. */
drive->dsc_overlap = (drive->next != drive
}
#ifdef CONFIG_BLK_DEV_IDEDMA
-static int ns87415_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
+static int ns87415_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
struct ata_channel *hwif = drive->channel;
byte dma_stat;
case ide_dma_write:
case ide_dma_read:
ns87415_prepare_drive(drive, 1); /* select DMA xfer */
- if (!ide_dmaproc(func, drive)) /* use standard DMA stuff */
+ if (!ide_dmaproc(func, drive, rq)) /* use standard DMA stuff */
return 0;
ns87415_prepare_drive(drive, 0); /* DMA failed: select PIO xfer */
return 1;
case ide_dma_check:
if (drive->type != ATA_DISK)
- return ide_dmaproc(ide_dma_off_quietly, drive);
+ return ide_dmaproc(ide_dma_off_quietly, drive, rq);
/* Fallthrough... */
default:
- return ide_dmaproc(func, drive); /* use standard DMA stuff */
+ return ide_dmaproc(func, drive, rq); /* use standard DMA stuff */
}
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base)
- hwif->dmaproc = &ns87415_dmaproc;
+ hwif->udma = ns87415_dmaproc;
#endif
hwif->selectproc = &ns87415_selectproc;
if (id && (id->capability & 1) && hwif->autodma) {
/* Consult the list of known "bad" drives */
- if (ide_dmaproc(ide_dma_bad_drive, drive)) {
+ if (ide_dmaproc(ide_dma_bad_drive, drive, NULL)) {
dma_func = ide_dma_off;
goto fast_ata_pio;
}
if (dma_func != ide_dma_on)
goto no_dma_set;
}
- } else if (ide_dmaproc(ide_dma_good_drive, drive)) {
+ } else if (ide_dmaproc(ide_dma_good_drive, drive, NULL)) {
if (id->eide_dma_time > 150) {
goto no_dma_set;
}
(void) config_chipset_for_pio(drive, 5);
}
- return drive->channel->dmaproc(dma_func, drive);
+ return drive->channel->udma(dma_func, drive, NULL);
}
int pdc202xx_quirkproc (ide_drive_t *drive)
/*
* pdc202xx_dmaproc() initiates/aborts (U)DMA read/write operations on a drive.
*/
-int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
+int pdc202xx_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
byte dma_stat = 0;
byte sc1d = 0;
default:
break;
}
- return ide_dmaproc(func, drive); /* use standard DMA stuff */
+ return ide_dmaproc(func, drive, rq); /* use standard DMA stuff */
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
- hwif->dmaproc = &pdc202xx_dmaproc;
+ hwif->udma = pdc202xx_dmaproc;
hwif->highmem = 1;
if (!noautodma)
hwif->autodma = 1;
/*
* promise_read_intr() is the handler for disk read/multread interrupts
*/
-static ide_startstop_t promise_read_intr (ide_drive_t *drive)
+static ide_startstop_t promise_read_intr(struct ata_device *drive, struct request *rq)
{
byte stat;
int total_remaining;
unsigned int sectors_left, sectors_avail, nsect;
unsigned long flags;
- struct request *rq;
char *to;
if (!OK_STAT(stat=GET_STAT(),DATA_READY,BAD_R_STAT)) {
sectors_left = IN_BYTE(IDE_NSECTOR_REG);
IN_BYTE(IDE_SECTOR_REG);
} while (IN_BYTE(IDE_NSECTOR_REG) != sectors_left);
- rq = HWGROUP(drive)->rq;
sectors_avail = rq->nr_sectors - sectors_left;
if (!sectors_avail)
goto read_again;
read_next:
- rq = HWGROUP(drive)->rq;
nsect = rq->current_nr_sectors;
if (nsect > sectors_avail)
nsect = sectors_avail;
rq->nr_sectors -= nsect;
total_remaining = rq->nr_sectors;
if ((rq->current_nr_sectors -= nsect) <= 0) {
- ide_end_request(drive, 1);
+ ide_end_request(drive, rq, 1);
}
/*
* Now the data has been read in, do the following:
if (stat & DRQ_STAT)
goto read_again;
if (stat & BUSY_STAT) {
- ide_set_handler (drive, &promise_read_intr, WAIT_CMD, NULL);
+ ide_set_handler(drive, promise_read_intr, WAIT_CMD, NULL);
#ifdef DEBUG_READ
printk(KERN_DEBUG "%s: promise_read: waiting for"
"interrupt\n", drive->name);
}
/*
- * promise_complete_pollfunc()
* This is the polling function for waiting (nicely!) until drive stops
* being busy. It is invoked at the end of a write, after the previous poll
* has finished.
*
* Once not busy, the end request is called.
*/
-static ide_startstop_t promise_complete_pollfunc(ide_drive_t *drive)
+static ide_startstop_t promise_complete_pollfunc(struct ata_device *drive, struct request *rq)
{
ide_hwgroup_t *hwgroup = HWGROUP(drive);
- struct request *rq = hwgroup->rq;
if (GET_STAT() & BUSY_STAT) {
if (time_before(jiffies, hwgroup->poll_timeout)) {
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &promise_complete_pollfunc, HZ/100, NULL);
+ ide_set_handler(drive, promise_complete_pollfunc, HZ/100, NULL);
return ide_started; /* continue polling... */
}
hwgroup->poll_timeout = 0;
#ifdef DEBUG_WRITE
printk(KERN_DEBUG "%s: Write complete - end_request\n", drive->name);
#endif
- __ide_end_request(drive, 1, rq->nr_sectors);
+ __ide_end_request(drive, rq, 1, rq->nr_sectors);
return ide_stopped;
}
* full "mcount" number of sectors, so we must make sure we update the
* state _before_ we output the final part of the data!
*/
-int promise_multwrite (ide_drive_t *drive, unsigned int mcount)
+int promise_multwrite(struct ata_device *drive, struct request *rq, unsigned int mcount)
{
- ide_hwgroup_t *hwgroup= HWGROUP(drive);
- struct request *rq = &hwgroup->wrq;
-
do {
char *buffer;
int nsect = rq->current_nr_sectors;
/*
* promise_write_pollfunc() is the handler for disk write completion polling.
*/
-static ide_startstop_t promise_write_pollfunc (ide_drive_t *drive)
+static ide_startstop_t promise_write_pollfunc(struct ata_device *drive, struct request *rq)
{
ide_hwgroup_t *hwgroup = HWGROUP(drive);
if (IN_BYTE(IDE_NSECTOR_REG) != 0) {
if (time_before(jiffies, hwgroup->poll_timeout)) {
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler (drive, &promise_write_pollfunc, HZ/100, NULL);
+ ide_set_handler(drive, promise_write_pollfunc, HZ/100, NULL);
return ide_started; /* continue polling... */
}
hwgroup->poll_timeout = 0;
/*
* Now write out last 4 sectors and poll for not BUSY
*/
- promise_multwrite(drive, 4);
+ promise_multwrite(drive, rq, 4);
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &promise_complete_pollfunc, HZ/100, NULL);
+ ide_set_handler(drive, promise_complete_pollfunc, HZ/100, NULL);
#ifdef DEBUG_WRITE
printk(KERN_DEBUG "%s: Done last 4 sectors - status = %02x\n",
drive->name, GET_STAT());
* before the final 4 sectors are transferred. There is no interrupt generated
* on writes (at least on the DC4030VL-2), we just have to poll for NOT BUSY.
*/
-static ide_startstop_t promise_write (ide_drive_t *drive)
+static ide_startstop_t promise_write(struct ata_device *drive, struct request *rq)
{
ide_hwgroup_t *hwgroup = HWGROUP(drive);
- struct request *rq = &hwgroup->wrq;
#ifdef DEBUG_WRITE
printk(KERN_DEBUG "%s: promise_write: sectors(%ld-%ld), "
* the polling strategy as defined above.
*/
if (rq->nr_sectors > 4) {
- if (promise_multwrite(drive, rq->nr_sectors - 4))
+ if (promise_multwrite(drive, rq, rq->nr_sectors - 4))
return ide_stopped;
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler (drive, &promise_write_pollfunc, HZ/100, NULL);
+ ide_set_handler(drive, promise_write_pollfunc, HZ/100, NULL);
return ide_started;
} else {
/*
* There are 4 or fewer sectors to transfer, do them all in one go
* and wait for NOT BUSY.
*/
- if (promise_multwrite(drive, rq->nr_sectors))
+ if (promise_multwrite(drive, rq, rq->nr_sectors))
return ide_stopped;
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &promise_complete_pollfunc, HZ/100, NULL);
+ ide_set_handler(drive, promise_complete_pollfunc, HZ/100, NULL);
#ifdef DEBUG_WRITE
printk(KERN_DEBUG "%s: promise_write: <= 4 sectors, "
"status = %02x\n", drive->name, GET_STAT());
* already set up. It issues a READ or WRITE command to the Promise
* controller, assuming LBA has been used to set up the block number.
*/
-ide_startstop_t do_pdc4030_io(ide_drive_t *drive, struct ata_taskfile *task)
+ide_startstop_t do_pdc4030_io(struct ata_device *drive, struct ata_taskfile *task, struct request *rq)
{
- struct request *rq = HWGROUP(drive)->rq;
struct hd_drive_task_hdr *taskfile = &task->taskfile;
unsigned long timeout;
byte stat;
/* Check that it's a regular command. If not, bomb out early. */
if (!(rq->flags & REQ_CMD)) {
blk_dump_rq_flags(rq, "pdc4030 bad flags");
- ide_end_request(drive, 0);
+ ide_end_request(drive, rq, 0);
return ide_stopped;
}
stat=GET_STAT();
if (stat & DRQ_STAT) {
udelay(1);
- return promise_read_intr(drive);
+ return promise_read_intr(drive, rq);
}
if (IN_BYTE(IDE_SELECT_REG) & 0x01) {
#ifdef DEBUG_READ
printk(KERN_DEBUG "%s: read: waiting for "
"interrupt\n", drive->name);
#endif
- BUG_ON(HWGROUP(drive)->handler);
- ide_set_handler(drive, &promise_read_intr, WAIT_CMD, NULL);
+ ide_set_handler(drive, promise_read_intr, WAIT_CMD, NULL);
return ide_started;
}
udelay(1);
}
if (!drive->channel->unmask)
__cli(); /* local CPU only */
- HWGROUP(drive)->wrq = *rq; /* scratchpad */
- return promise_write(drive);
+ return promise_write(drive, rq);
}
default:
printk(KERN_ERR "pdc4030: command not READ or WRITE! Huh?\n");
- ide_end_request(drive, 0);
+ ide_end_request(drive, rq, 0);
return ide_stopped;
}
}
-ide_startstop_t promise_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
+ide_startstop_t promise_rw_disk(struct ata_device *drive, struct request *rq, sector_t block)
{
- struct hd_drive_task_hdr taskfile;
struct ata_taskfile args;
- memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
+ memset(&args, 0, sizeof(args));
/* The four drives on the two logical (one physical) interfaces
are distinguished by writing the drive number (0-3) to the
Feature register.
FIXME: Is promise_selectproc now redundant??
*/
- taskfile.feature = (drive->channel->unit << 1) + drive->select.b.unit;
- taskfile.sector_count = rq->nr_sectors;
- taskfile.sector_number = block;
- taskfile.low_cylinder = (block>>=8);
- taskfile.high_cylinder = (block>>=8);
- taskfile.device_head = ((block>>8)&0x0f)|drive->select.all;
- taskfile.command = (rq_data_dir(rq)==READ)?PROMISE_READ:PROMISE_WRITE;
-
- args.taskfile = taskfile;
- memset(&args.hobfile, 0, sizeof(struct hd_drive_hob_hdr));
+ args.taskfile.feature = (drive->channel->unit << 1) + drive->select.b.unit;
+ args.taskfile.sector_count = rq->nr_sectors;
+ args.taskfile.sector_number = block;
+ args.taskfile.low_cylinder = (block>>=8);
+ args.taskfile.high_cylinder = (block>>=8);
+ args.taskfile.device_head = ((block>>8)&0x0f)|drive->select.all;
+ args.taskfile.command = (rq_data_dir(rq)==READ)?PROMISE_READ:PROMISE_WRITE;
ide_cmd_type_parser(&args);
/* We don't use the generic inerrupt handlers here? */
args.handler = NULL;
rq->special = &args;
- return do_pdc4030_io(drive, &args);
+ return do_pdc4030_io(drive, &args, rq);
}
* else to the default ide_dmaproc().
*/
-int piix_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
+int piix_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
if (func == ide_dma_check) {
}
- return ide_dmaproc(func, drive);
+ return ide_dmaproc(func, drive, rq);
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
hwif->highmem = 1;
- hwif->dmaproc = &piix_dmaproc;
+ hwif->udma = piix_dmaproc;
#ifdef CONFIG_IDEDMA_AUTO
if (!noautodma)
hwif->autodma = 1;
if (id && (id->capability & 1) && drive->channel->autodma) {
/* Consult the list of known "bad" drives */
- if (ide_dmaproc(ide_dma_bad_drive, drive)) {
+ if (ide_dmaproc(ide_dma_bad_drive, drive, NULL)) {
dma_func = ide_dma_off;
goto fast_ata_pio;
}
if (dma_func != ide_dma_on)
goto no_dma_set;
}
- } else if (ide_dmaproc(ide_dma_good_drive, drive)) {
+ } else if (ide_dmaproc(ide_dma_good_drive, drive, NULL)) {
if (id->eide_dma_time > 150) {
goto no_dma_set;
}
no_dma_set:
config_chipset_for_pio(drive);
}
- return drive->channel->dmaproc(dma_func, drive);
+ return drive->channel->udma(dma_func, drive, NULL);
}
-static int svwks_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
+static int svwks_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
switch (func) {
case ide_dma_check:
{
struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base;
-
+
if(inb(dma_base+0x02)&1)
{
-#if 0
+#if 0
int i;
printk(KERN_ERR "Curious - OSB4 thinks the DMA is still running.\n");
for(i=0;i<10;i++)
}
udelay(5);
}
-#endif
+#endif
printk(KERN_CRIT "Serverworks OSB4 in impossible state.\n");
printk(KERN_CRIT "Disable UDMA or if you are using Seagate then try switching disk types\n");
printk(KERN_CRIT "on this controller. Please report this event to osb4-bug@ide.cabal.tm\n");
-#if 0
+#if 0
/* Panic might sys_sync -> death by corrupt disk */
panic("OSB4: continuing might cause disk corruption.\n");
#else
printk(KERN_CRIT "OSB4: continuing might cause disk corruption.\n");
while(1)
cpu_relax();
-#endif
+#endif
}
/* and drop through */
}
break;
}
/* Other cases are done by generic IDE-DMA code. */
- return ide_dmaproc(func, drive);
+ return ide_dmaproc(func, drive, rq);
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
if (!noautodma)
hwif->autodma = 1;
#endif
- hwif->dmaproc = &svwks_dmaproc;
+ hwif->udma = svwks_dmaproc;
hwif->highmem = 1;
} else {
hwif->autodma = 0;
if (id && (id->capability & 1) && drive->channel->autodma) {
/* Consult the list of known "bad" drives */
- if (ide_dmaproc(ide_dma_bad_drive, drive)) {
+ if (ide_dmaproc(ide_dma_bad_drive, drive, NULL)) {
dma_func = ide_dma_off;
goto fast_ata_pio;
}
if (dma_func != ide_dma_on)
goto no_dma_set;
}
- } else if ((ide_dmaproc(ide_dma_good_drive, drive)) &&
+ } else if ((ide_dmaproc(ide_dma_good_drive, drive, NULL)) &&
(id->eide_dma_time > 150)) {
/* Consult the list of known "good" drives */
dma_func = config_chipset_for_dma(drive, 0);
(void) config_chipset_for_pio(drive, 5);
}
- return drive->channel->dmaproc(dma_func, drive);
+ return drive->channel->udma(dma_func, drive, NULL);
}
/* initiates/aborts (U)DMA read/write operations on a drive. */
-int sis5513_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
+int sis5513_dmaproc (ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
switch (func) {
case ide_dma_check:
default:
break;
}
- return ide_dmaproc(func, drive); /* use standard DMA stuff */
+ return ide_dmaproc(func, drive, rq); /* use standard DMA stuff */
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
if (chipset_family > ATA_16) {
hwif->autodma = noautodma ? 0 : 1;
hwif->highmem = 1;
- hwif->dmaproc = &sis5513_dmaproc;
+ hwif->udma = sis5513_dmaproc;
} else {
#endif
hwif->autodma = 0;
outw((count * 2) - 1, hwif->dma_base+2); /* start DMA */
if (drive->type != ATA_DISK)
return 0;
- BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
return 0;
* else to the default ide_dmaproc().
*/
-int via82cxxx_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
+int via82cxxx_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
if (func == ide_dma_check) {
? ide_dma_on : ide_dma_off_quietly;
}
- return ide_dmaproc(func, drive);
+ return ide_dmaproc(func, drive, rq);
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
hwif->highmem = 1;
- hwif->dmaproc = &via82cxxx_dmaproc;
+ hwif->udma = &via82cxxx_dmaproc;
#ifdef CONFIG_IDEDMA_AUTO
if (!noautodma)
hwif->autodma = 1;
int request_transfer; /* Bytes to transfer */
int actually_transferred; /* Bytes actually transferred */
int buffer_size; /* Size of our data buffer */
- struct request *rq; /* The corresponding request */
byte *buffer; /* Data buffer */
byte *current_position; /* Pointer into the above buffer */
struct scatterlist *sg; /* Scatter gather table */
printk("]\n");
}
-static int idescsi_end_request(ide_drive_t *drive, int uptodate)
+static int idescsi_end_request(struct ata_device *drive, struct request *rq, int uptodate)
{
idescsi_scsi_t *scsi = drive->driver_data;
- struct request *rq = HWGROUP(drive)->rq;
idescsi_pc_t *pc = (idescsi_pc_t *) rq->special;
int log = test_bit(IDESCSI_LOG_CMD, &scsi->log);
struct Scsi_Host *host;
unsigned long flags;
if (!(rq->flags & REQ_SPECIAL)) {
- ide_end_request(drive, uptodate);
+ ide_end_request(drive, rq, uptodate);
return 0;
}
ide_end_drive_cmd (drive, 0, 0);
/*
* Our interrupt handler.
*/
-static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
+static ide_startstop_t idescsi_pc_intr(struct ata_device *drive, struct request *rq)
{
idescsi_scsi_t *scsi = drive->driver_data;
byte status, ireason;
int bcount;
idescsi_pc_t *pc=scsi->pc;
- struct request *rq = pc->rq;
unsigned int temp;
#if IDESCSI_DEBUG_LOG
printk ("ide-scsi: %s: DMA complete\n", drive->name);
#endif /* IDESCSI_DEBUG_LOG */
pc->actually_transferred=pc->request_transfer;
- (void) drive->channel->dmaproc(ide_dma_end, drive);
+ (void) drive->channel->udma(ide_dma_end, drive, NULL);
}
status = GET_STAT(); /* Clear the interrupt */
ide__sti();
if (status & ERR_STAT)
rq->errors++;
- idescsi_end_request(drive, 1);
+ idescsi_end_request(drive, rq, 1);
return ide_stopped;
}
bcount = IN_BYTE (IDE_BCOUNTH_REG) << 8 | IN_BYTE (IDE_BCOUNTL_REG);
pc->actually_transferred += temp;
pc->current_position += temp;
idescsi_discard_data (drive,bcount - temp);
- ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), NULL);
+ ide_set_handler(drive, idescsi_pc_intr, get_timeout(pc), NULL);
return ide_started;
}
#if IDESCSI_DEBUG_LOG
pc->actually_transferred+=bcount; /* Update the current position */
pc->current_position+=bcount;
- ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), NULL); /* And set the interrupt handler again */
+ ide_set_handler(drive, idescsi_pc_intr, get_timeout(pc), NULL); /* And set the interrupt handler again */
return ide_started;
}
-static ide_startstop_t idescsi_transfer_pc (ide_drive_t *drive)
+static ide_startstop_t idescsi_transfer_pc(struct ata_device *drive, struct request *rq)
{
idescsi_scsi_t *scsi = drive->driver_data;
idescsi_pc_t *pc = scsi->pc;
printk (KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while issuing a packet command\n");
return ide_stopped;
}
- ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), NULL); /* Set the interrupt routine */
+ ide_set_handler(drive, idescsi_pc_intr, get_timeout(pc), NULL); /* Set the interrupt routine */
atapi_write(drive, scsi->pc->c, 12); /* Send the actual packet */
return ide_started;
}
/*
* Issue a packet command
*/
-static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
+static ide_startstop_t idescsi_issue_pc(struct ata_device *drive, struct request *rq, idescsi_pc_t *pc)
{
idescsi_scsi_t *scsi = drive->driver_data;
int bcount;
- struct request *rq = pc->rq;
int dma_ok = 0;
scsi->pc=pc; /* Set the current packet command */
bcount = min(pc->request_transfer, 63 * 1024); /* Request to transfer the entire buffer at once */
if (drive->using_dma && rq->bio)
- dma_ok = !drive->channel->dmaproc(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive);
+ dma_ok = !drive->channel->udma(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive, rq);
SELECT_DRIVE(drive->channel, drive);
if (IDE_CONTROL_REG)
if (dma_ok) {
set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
- (void) drive->channel->dmaproc(ide_dma_begin, drive);
+ (void) drive->channel->udma(ide_dma_begin, drive, NULL);
}
if (test_bit (IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
- ide_set_handler (drive, &idescsi_transfer_pc, get_timeout(pc), NULL);
+ ide_set_handler(drive, idescsi_transfer_pc, get_timeout(pc), NULL);
OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* Issue the packet command */
return ide_started;
} else {
OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG);
- return idescsi_transfer_pc (drive);
+ return idescsi_transfer_pc(drive, rq);
}
}
#endif /* IDESCSI_DEBUG_LOG */
if (rq->flags & REQ_SPECIAL) {
- return idescsi_issue_pc(drive, (idescsi_pc_t *) rq->special);
+ return idescsi_issue_pc(drive, rq, (idescsi_pc_t *) rq->special);
}
blk_dump_rq_flags(rq, "ide-scsi: unsup command");
- idescsi_end_request(drive, 0);
+ idescsi_end_request(drive, rq, 0);
return ide_stopped;
}
memset (pc->c, 0, 12);
pc->flags = 0;
- pc->rq = rq;
memcpy (pc->c, cmd->cmnd, cmd->cmd_len);
if (cmd->use_sg) {
pc->buffer = NULL;
} ide_drive_t;
/*
- * An ide_dmaproc_t() initiates/aborts DMA read/write operations on a drive.
+ * This initiates/aborts DMA read/write operations on a drive.
*
* The caller is assumed to have selected the drive and programmed the drive's
* sector address using CHS or LBA. All that remains is to prepare for DMA
ide_dma_lostirq, ide_dma_timeout
} ide_dma_action_t;
-typedef int (ide_dmaproc_t)(ide_dma_action_t, ide_drive_t *);
-
enum {
ATA_PRIMARY = 0,
ATA_SECONDARY = 1
void (*atapi_read)(ide_drive_t *, void *, unsigned int);
void (*atapi_write)(ide_drive_t *, void *, unsigned int);
- ide_dmaproc_t *dmaproc; /* dma read/write/abort routine */
+ int (*udma)(ide_dma_action_t, struct ata_device *, struct request *); /* dma read/write/abort routine */
unsigned int *dmatable_cpu; /* dma physical region descriptor table (cpu view) */
dma_addr_t dmatable_dma; /* dma physical region descriptor table (dma view) */
struct scatterlist *sg_table; /* Scatter-gather list used to build the above */
} ide_startstop_t;
/*
- * Interrupt handler types.
+ * Interrupt and timeout handler type.
*/
-struct ata_taskfile;
-typedef ide_startstop_t (ide_pre_handler_t)(ide_drive_t *, struct request *);
-typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
+typedef ide_startstop_t (ata_handler_t)(struct ata_device *, struct request *);
+typedef int (ata_expiry_t)(struct ata_device *, struct request *);
-/*
- * when ide_timer_expiry fires, invoke a handler of this type
- * to decide what to do.
- */
-typedef int (ide_expiry_t)(ide_drive_t *);
+struct ata_taskfile;
#define IDE_BUSY 0 /* awaiting an interrupt */
#define IDE_SLEEP 1
#define IDE_DMA 2 /* DMA in progress */
typedef struct hwgroup_s {
- ide_handler_t *handler; /* irq handler, if active */
+ ide_startstop_t (*handler)(struct ata_device *, struct request *); /* irq handler, if active */
unsigned long flags; /* BUSY, SLEEPING */
struct ata_device *drive; /* current drive */
struct request *rq; /* current request */
struct timer_list timer; /* failsafe timer */
- struct request wrq; /* local copy of current write rq */
unsigned long poll_timeout; /* timeout value during long polls */
- ide_expiry_t *expiry; /* queried upon timeouts */
+ int (*expiry)(struct ata_device *, struct request *); /* irq handler, if active */
} ide_hwgroup_t;
/* structure attached to the request for IDE_TASK_CMDS */
int (*cleanup)(struct ata_device *);
int (*standby)(struct ata_device *);
ide_startstop_t (*do_request)(struct ata_device *, struct request *, sector_t);
- int (*end_request)(struct ata_device *, int);
+ int (*end_request)(struct ata_device *, struct request *, int);
int (*ioctl)(struct ata_device *, struct inode *, struct file *, unsigned int, unsigned long);
int (*open)(struct inode *, struct file *, struct ata_device *);
#define LOCAL_END_REQUEST /* Don't generate end_request in blk.h */
#include <linux/blk.h>
-extern int __ide_end_request(ide_drive_t *drive, int uptodate, int nr_secs);
-extern int ide_end_request(ide_drive_t *drive, int uptodate);
+extern int __ide_end_request(struct ata_device *, struct request *, int, int);
+extern int ide_end_request(struct ata_device *drive, struct request *, int);
/*
* This is used on exit from the driver, to designate the next irq handler
* and also to start the safety timer.
*/
-void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry);
+extern void ide_set_handler(struct ata_device *drive, ata_handler_t handler,
+ unsigned long timeout, ata_expiry_t expiry);
/*
* Error reporting, in human readable form (luxurious, but a memory hog).
* Issue a simple drive command
* The drive must be selected beforehand.
*/
-void ide_cmd(ide_drive_t *drive, byte cmd, byte nsect, ide_handler_t *handler);
+void ide_cmd(ide_drive_t *drive, byte cmd, byte nsect, ata_handler_t handler);
/*
* ide_fixstring() cleans up and (optionally) byte-swaps a text string,
struct ata_taskfile {
struct hd_drive_task_hdr taskfile;
struct hd_drive_hob_hdr hobfile;
- int command_type;
- ide_pre_handler_t *prehandler;
- ide_handler_t *handler;
+ int command_type;
+ ide_startstop_t (*prehandler)(struct ata_device *, struct request *);
+ ide_startstop_t (*handler)(struct ata_device *, struct request *);
};
extern void ata_read(ide_drive_t *drive, void *buffer, unsigned int wcount);
* Special Flagged Register Validation Caller
*/
-extern ide_startstop_t recal_intr(ide_drive_t *drive);
-extern ide_startstop_t set_geometry_intr(ide_drive_t *drive);
-extern ide_startstop_t set_multmode_intr(ide_drive_t *drive);
-extern ide_startstop_t task_no_data_intr(ide_drive_t *drive);
+extern ide_startstop_t recal_intr(struct ata_device *, struct request *);
+extern ide_startstop_t set_geometry_intr(struct ata_device *, struct request *);
+extern ide_startstop_t set_multmode_intr(struct ata_device *, struct request *);
+extern ide_startstop_t task_no_data_intr(struct ata_device *, struct request *);
/* This is setting up all fields in args, which depend upon the command type.
#ifdef CONFIG_BLK_DEV_IDEDMA
int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func);
void ide_destroy_dmatable (ide_drive_t *drive);
-ide_startstop_t ide_dma_intr (ide_drive_t *drive);
+extern ide_startstop_t ide_dma_intr(struct ata_device *, struct request *);
int check_drive_lists (ide_drive_t *drive, int good_bad);
-int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive);
+int ide_dmaproc (ide_dma_action_t func, struct ata_device *drive, struct request *);
extern void ide_release_dma(struct ata_channel *hwif);
extern void ide_setup_dma(struct ata_channel *hwif,
unsigned long dmabase, unsigned int num_ports) __init;