Commit 4a58bd1a authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] 2.5.11 IDE 46

- Remove the specific CONFIG_IDEDMA_PCI_WIP in favor of using the generic
   CONFIG_EXPERIMENTAL tag. (Pointed out by Vojtech Pavlik).

- Change the signature of the IRQ handler to take the request directly as a
   parameter. This doesn't blow the code up but makes it much more obvious and
   finally it's reducing the number of side effects of the hwgroup->rq field.

- A second sharp look after the above change allowed us to remove the wrq field
   from the hwgroup struct. It's just not used at all.

- Change the signature of the end_request member of struct ata_operations to
   take the request as a second argument. Similar for __ide_end_request()
   and ide_end_request().

- Remove BUG_ON() items just before ide_set_handler(). The check in
   ide_set_handler is clever enough now.

- Remove the rq subfield from ide-scsi packet structure. We have now the
   request context always in place. Same for floppy.

- Let the timer expiry function take the request as a direct argument.

Yes I know those changes are extensive. But they are a necessary step
in between for the following purposes:

- Consolidate the whole ATA/ATAPI stuff on passing a single unified request
   handling object. Because after eliminating those side effects it's far easier
   to see what's passed where.

- Minimizing the amount of side effects in the overall code. That's a good
   thing anyway and it *doesn't* cost us neither performance nor space, since
   the stack depths are small anyway here.

- Minimizing the usage of hwgroup - which should go away if possible.
parent b960fa03
...@@ -252,7 +252,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y ...@@ -252,7 +252,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
CONFIG_IDEDMA_PCI_AUTO=y CONFIG_IDEDMA_PCI_AUTO=y
# CONFIG_IDEDMA_ONLYDISK is not set # CONFIG_IDEDMA_ONLYDISK is not set
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -409,7 +409,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y ...@@ -409,7 +409,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
CONFIG_BLK_DEV_OFFBOARD=y CONFIG_BLK_DEV_OFFBOARD=y
CONFIG_IDEDMA_PCI_AUTO=y CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -460,7 +460,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y ...@@ -460,7 +460,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_IDEDMA_PCI_AUTO=y CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -687,7 +687,7 @@ static int config_drive_for_dma (ide_drive_t *drive) ...@@ -687,7 +687,7 @@ static int config_drive_for_dma (ide_drive_t *drive)
/* /*
* etrax_dma_intr() is the handler for disk read/write DMA interrupts * 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; int i, dma_stat;
byte stat; byte stat;
...@@ -699,11 +699,9 @@ static ide_startstop_t etrax_dma_intr (ide_drive_t *drive) ...@@ -699,11 +699,9 @@ static ide_startstop_t etrax_dma_intr (ide_drive_t *drive)
stat = GET_STAT(); /* get drive status */ stat = GET_STAT(); /* get drive status */
if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) { if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
if (!dma_stat) { if (!dma_stat) {
struct request *rq;
rq = HWGROUP(drive)->rq;
for (i = rq->nr_sectors; i > 0;) { for (i = rq->nr_sectors; i > 0;) {
i -= rq->current_nr_sectors; i -= rq->current_nr_sectors;
ide_end_request(drive, 1); ide_end_request(drive, rq, 1);
} }
return ide_stopped; return ide_stopped;
} }
......
...@@ -263,7 +263,6 @@ CONFIG_IDEDMA_PCI_AUTO=y ...@@ -263,7 +263,6 @@ CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_BLK_DEV_IDE_TCQ is not set # CONFIG_BLK_DEV_IDE_TCQ is not set
# CONFIG_BLK_DEV_IDE_TCQ_DEFAULT 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_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -233,7 +233,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y ...@@ -233,7 +233,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_IDEDMA_PCI_AUTO is not set # CONFIG_IDEDMA_PCI_AUTO is not set
# CONFIG_IDEDMA_ONLYDISK is not set # CONFIG_IDEDMA_ONLYDISK is not set
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -212,7 +212,6 @@ CONFIG_BLK_DEV_ADMA=y ...@@ -212,7 +212,6 @@ CONFIG_BLK_DEV_ADMA=y
# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set # CONFIG_IDEDMA_PCI_AUTO is not set
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -212,7 +212,6 @@ CONFIG_BLK_DEV_ADMA=y ...@@ -212,7 +212,6 @@ CONFIG_BLK_DEV_ADMA=y
# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set # CONFIG_IDEDMA_PCI_AUTO is not set
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -227,7 +227,6 @@ CONFIG_BLK_DEV_IDEPCI=y ...@@ -227,7 +227,6 @@ CONFIG_BLK_DEV_IDEPCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set # CONFIG_IDEDMA_PCI_AUTO is not set
# CONFIG_BLK_DEV_IDEDMA 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_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -292,7 +292,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y ...@@ -292,7 +292,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_IDEDMA_PCI_AUTO=y CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -255,7 +255,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y ...@@ -255,7 +255,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_IDEDMA_PCI_AUTO=y CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -238,7 +238,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y ...@@ -238,7 +238,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set # CONFIG_IDEDMA_PCI_AUTO is not set
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -242,7 +242,6 @@ CONFIG_BLK_DEV_IDEPCI=y ...@@ -242,7 +242,6 @@ CONFIG_BLK_DEV_IDEPCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set # CONFIG_IDEDMA_PCI_AUTO is not set
# CONFIG_BLK_DEV_IDEDMA 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_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -236,7 +236,6 @@ CONFIG_BLK_DEV_IDEPCI=y ...@@ -236,7 +236,6 @@ CONFIG_BLK_DEV_IDEPCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set # CONFIG_IDEDMA_PCI_AUTO is not set
# CONFIG_BLK_DEV_IDEDMA 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_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -245,7 +245,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y ...@@ -245,7 +245,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_IDEDMA_PCI_AUTO=y CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -249,7 +249,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y ...@@ -249,7 +249,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set # CONFIG_IDEDMA_PCI_AUTO is not set
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -212,7 +212,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y ...@@ -212,7 +212,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEDMA_PCI_AUTO is not set # CONFIG_IDEDMA_PCI_AUTO is not set
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -255,7 +255,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y ...@@ -255,7 +255,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_IDEDMA_PCI_AUTO=y CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -289,7 +289,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y ...@@ -289,7 +289,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
CONFIG_IDEDMA_PCI_AUTO=y CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_IDEDMA_ONLYDISK=y CONFIG_IDEDMA_ONLYDISK=y
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -214,7 +214,6 @@ CONFIG_IDEDMA_PCI_AUTO=y ...@@ -214,7 +214,6 @@ CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_BLK_DEV_IDE_TCQ is not set # CONFIG_BLK_DEV_IDE_TCQ is not set
# CONFIG_BLK_DEV_IDE_TCQ_DEFAULT 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_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set # CONFIG_AEC62XX_TUNING is not set
......
...@@ -299,13 +299,6 @@ CONFIG_IDEDMA_IVB ...@@ -299,13 +299,6 @@ CONFIG_IDEDMA_IVB
It is normally safe to answer Y; however, the default is N. 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 CONFIG_BLK_DEV_PDC_ADMA
Please read the comments at the top of <file:drivers/ide/ide-pci.c>. Please read the comments at the top of <file:drivers/ide/ide-pci.c>.
......
...@@ -47,18 +47,17 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then ...@@ -47,18 +47,17 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then
dep_bool ' Use PCI DMA by default when available' CONFIG_IDEDMA_PCI_AUTO $CONFIG_BLK_DEV_IDEDMA_PCI dep_bool ' Use PCI DMA by default when available' CONFIG_IDEDMA_PCI_AUTO $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' Enable DMA only for disks ' CONFIG_IDEDMA_ONLYDISK $CONFIG_IDEDMA_PCI_AUTO 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 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 (EXPERIMENTAL)' CONFIG_IDEDMA_NEW_DRIVE_LISTINGS $CONFIG_EXPERIMENTAL
dep_bool ' Good-Bad DMA Model-Firmware (WIP)' CONFIG_IDEDMA_NEW_DRIVE_LISTINGS $CONFIG_IDEDMA_PCI_WIP
dep_bool ' AEC62XX chipset support' CONFIG_BLK_DEV_AEC62XX $CONFIG_BLK_DEV_IDEDMA_PCI 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_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_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 ' 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 ' 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 ' 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 ' 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_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 ' 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 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 if [ "$CONFIG_MIPS_ITE8172" = "y" -o "$CONFIG_MIPS_IVR" = "y" ]; then
...@@ -67,7 +66,7 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then ...@@ -67,7 +66,7 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then
fi fi
dep_bool ' NS87415 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_NS87415 $CONFIG_BLK_DEV_IDEDMA_PCI 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_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 ' 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 UDMA Feature' CONFIG_PDC202XX_BURST $CONFIG_BLK_DEV_PDC202XX
dep_bool ' Special FastTrak Feature' CONFIG_PDC202XX_FORCE $CONFIG_BLK_DEV_PDC202XX dep_bool ' Special FastTrak Feature' CONFIG_PDC202XX_FORCE $CONFIG_BLK_DEV_PDC202XX
......
...@@ -437,7 +437,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -437,7 +437,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
if (id && (id->capability & 1) && drive->channel->autodma) { if (id && (id->capability & 1) && drive->channel->autodma) {
/* Consult the list of known "bad" drives */ /* 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; dma_func = ide_dma_off;
goto fast_ata_pio; goto fast_ata_pio;
} }
...@@ -459,7 +459,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -459,7 +459,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
if (dma_func != ide_dma_on) if (dma_func != ide_dma_on)
goto no_dma_set; 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) { if (id->eide_dma_time > 150) {
goto no_dma_set; goto no_dma_set;
} }
...@@ -476,13 +476,13 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -476,13 +476,13 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
no_dma_set: no_dma_set:
aec62xx_tune_drive(drive, 5); 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. * 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) { switch (func) {
case ide_dma_check: case ide_dma_check:
...@@ -507,7 +507,7 @@ int aec62xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -507,7 +507,7 @@ int aec62xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
default: default:
break; 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_BLK_DEV_IDEDMA */
#endif /* CONFIG_AEC62XX_TUNING */ #endif /* CONFIG_AEC62XX_TUNING */
...@@ -542,17 +542,17 @@ unsigned int __init ata66_aec62xx(struct ata_channel *hwif) ...@@ -542,17 +542,17 @@ unsigned int __init ata66_aec62xx(struct ata_channel *hwif)
void __init ide_init_aec62xx(struct ata_channel *hwif) void __init ide_init_aec62xx(struct ata_channel *hwif)
{ {
#ifdef CONFIG_AEC62XX_TUNING #ifdef CONFIG_AEC62XX_TUNING
hwif->tuneproc = &aec62xx_tune_drive; hwif->tuneproc = aec62xx_tune_drive;
hwif->speedproc = &aec62xx_tune_chipset; hwif->speedproc = aec62xx_tune_chipset;
#ifdef CONFIG_BLK_DEV_IDEDMA # ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) if (hwif->dma_base)
hwif->dmaproc = &aec62xx_dmaproc; hwif->udma = aec62xx_dmaproc;
hwif->highmem = 1; hwif->highmem = 1;
#else /* !CONFIG_BLK_DEV_IDEDMA */ # else
hwif->drives[0].autotune = 1; hwif->drives[0].autotune = 1;
hwif->drives[1].autotune = 1; hwif->drives[1].autotune = 1;
#endif /* CONFIG_BLK_DEV_IDEDMA */ # endif
#endif /* CONFIG_AEC62XX_TUNING */ #endif
} }
void __init ide_dmacapable_aec62xx(struct ata_channel *hwif, unsigned long dmabase) void __init ide_dmacapable_aec62xx(struct ata_channel *hwif, unsigned long dmabase)
......
...@@ -437,11 +437,11 @@ static int ali15x3_config_drive_for_dma(ide_drive_t *drive) ...@@ -437,11 +437,11 @@ static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
byte can_ultra_dma = ali15x3_can_ultra(drive); byte can_ultra_dma = ali15x3_can_ultra(drive);
if ((m5229_revision<=0x20) && (drive->type != ATA_DISK)) 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) { if ((id != NULL) && ((id->capability & 1) != 0) && hwif->autodma) {
/* Consult the list of known "bad" drives */ /* 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; dma_func = ide_dma_off;
goto fast_ata_pio; goto fast_ata_pio;
} }
...@@ -463,7 +463,7 @@ static int ali15x3_config_drive_for_dma(ide_drive_t *drive) ...@@ -463,7 +463,7 @@ static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
if (dma_func != ide_dma_on) if (dma_func != ide_dma_on)
goto no_dma_set; 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) { if (id->eide_dma_time > 150) {
goto no_dma_set; goto no_dma_set;
} }
...@@ -480,10 +480,10 @@ static int ali15x3_config_drive_for_dma(ide_drive_t *drive) ...@@ -480,10 +480,10 @@ static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
no_dma_set: no_dma_set:
config_chipset_for_pio(drive); 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) { switch(func) {
case ide_dma_check: case ide_dma_check:
...@@ -495,7 +495,7 @@ static int ali15x3_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -495,7 +495,7 @@ static int ali15x3_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
default: default:
break; 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_BLK_DEV_IDEDMA */
...@@ -672,14 +672,14 @@ void __init ide_init_ali15x3(struct ata_channel *hwif) ...@@ -672,14 +672,14 @@ void __init ide_init_ali15x3(struct ata_channel *hwif)
hwif->tuneproc = &ali15x3_tune_drive; hwif->tuneproc = &ali15x3_tune_drive;
hwif->drives[0].autotune = 1; hwif->drives[0].autotune = 1;
hwif->drives[1].autotune = 1; hwif->drives[1].autotune = 1;
hwif->speedproc = &ali15x3_tune_chipset; hwif->speedproc = ali15x3_tune_chipset;
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if ((hwif->dma_base) && (m5229_revision >= 0x20)) { if ((hwif->dma_base) && (m5229_revision >= 0x20)) {
/* /*
* M1543C or newer for DMAing * M1543C or newer for DMAing
*/ */
hwif->dmaproc = &ali15x3_dmaproc; hwif->udma = ali15x3_dmaproc;
hwif->autodma = 1; hwif->autodma = 1;
} }
......
...@@ -282,7 +282,7 @@ static void amd74xx_tune_drive(ide_drive_t *drive, unsigned char pio) ...@@ -282,7 +282,7 @@ static void amd74xx_tune_drive(ide_drive_t *drive, unsigned char pio)
* else to the default ide_dmaproc(). * 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) { if (func == ide_dma_check) {
...@@ -301,7 +301,7 @@ int amd74xx_dmaproc(ide_dma_action_t func, ide_drive_t *drive) ...@@ -301,7 +301,7 @@ int amd74xx_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
? ide_dma_on : ide_dma_off_quietly; ? ide_dma_on : ide_dma_off_quietly;
} }
return ide_dmaproc(func, drive); return ide_dmaproc(func, drive, rq);
} }
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_BLK_DEV_IDEDMA */
...@@ -433,13 +433,13 @@ void __init ide_init_amd74xx(struct ata_channel *hwif) ...@@ -433,13 +433,13 @@ void __init ide_init_amd74xx(struct ata_channel *hwif)
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) { if (hwif->dma_base) {
hwif->highmem = 1; hwif->highmem = 1;
hwif->dmaproc = &amd74xx_dmaproc; hwif->udma = amd74xx_dmaproc;
#ifdef CONFIG_IDEDMA_AUTO # ifdef CONFIG_IDEDMA_AUTO
if (!noautodma) if (!noautodma)
hwif->autodma = 1; hwif->autodma = 1;
#endif # endif
} }
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif
} }
/* /*
......
...@@ -759,7 +759,7 @@ static int cmd64x_config_drive_for_dma (ide_drive_t *drive) ...@@ -759,7 +759,7 @@ static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
ide_dma_action_t dma_func = ide_dma_on; ide_dma_action_t dma_func = ide_dma_on;
pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
class_rev &= 0xff; class_rev &= 0xff;
switch(dev->device) { switch(dev->device) {
case PCI_DEVICE_ID_CMD_680: case PCI_DEVICE_ID_CMD_680:
...@@ -777,13 +777,13 @@ static int cmd64x_config_drive_for_dma (ide_drive_t *drive) ...@@ -777,13 +777,13 @@ static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
can_ultra_100 = 0; can_ultra_100 = 0;
break; break;
default: default:
return hwif->dmaproc(ide_dma_off, drive); return hwif->udma(ide_dma_off, drive, NULL);
} }
if ((id != NULL) && ((id->capability & 1) != 0) && if ((id != NULL) && ((id->capability & 1) != 0) &&
hwif->autodma && (drive->type == ATA_DISK)) { hwif->autodma && (drive->type == ATA_DISK)) {
/* Consult the list of known "bad" drives */ /* 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; dma_func = ide_dma_off;
goto fast_ata_pio; goto fast_ata_pio;
} }
...@@ -805,7 +805,7 @@ static int cmd64x_config_drive_for_dma (ide_drive_t *drive) ...@@ -805,7 +805,7 @@ static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
if (dma_func != ide_dma_on) if (dma_func != ide_dma_on)
goto no_dma_set; 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) { if (id->eide_dma_time > 150) {
goto no_dma_set; goto no_dma_set;
} }
...@@ -822,10 +822,10 @@ static int cmd64x_config_drive_for_dma (ide_drive_t *drive) ...@@ -822,10 +822,10 @@ static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
no_dma_set: no_dma_set:
config_chipset_for_pio(drive, 1); 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) { switch (func) {
case ide_dma_check: case ide_dma_check:
...@@ -834,10 +834,10 @@ static int cmd680_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -834,10 +834,10 @@ static int cmd680_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
break; break;
} }
/* Other cases are done by generic IDE-DMA code. */ /* 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_stat = 0;
byte dma_alt_stat = 0; byte dma_alt_stat = 0;
...@@ -882,14 +882,14 @@ static int cmd64x_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -882,14 +882,14 @@ static int cmd64x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
break; break;
} }
/* Other cases are done by generic IDE-DMA code. */ /* 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 * ASUS P55T2P4D with CMD646 chipset revision 0x01 requires the old
* event order for DMA transfers. * 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; struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base; unsigned long dma_base = hwif->dma_base;
...@@ -910,7 +910,7 @@ static int cmd646_1_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -910,7 +910,7 @@ static int cmd646_1_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
} }
/* Other cases are done by generic IDE-DMA code. */ /* 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 */ #endif /* CONFIG_BLK_DEV_IDEDMA */
...@@ -1125,7 +1125,7 @@ void __init ide_init_cmd64x(struct ata_channel *hwif) ...@@ -1125,7 +1125,7 @@ void __init ide_init_cmd64x(struct ata_channel *hwif)
switch(dev->device) { switch(dev->device) {
case PCI_DEVICE_ID_CMD_680: case PCI_DEVICE_ID_CMD_680:
hwif->busproc = &cmd680_busproc; hwif->busproc = &cmd680_busproc;
hwif->dmaproc = &cmd680_dmaproc; hwif->udma = &cmd680_dmaproc;
hwif->resetproc = &cmd680_reset; hwif->resetproc = &cmd680_reset;
hwif->speedproc = &cmd680_tune_chipset; hwif->speedproc = &cmd680_tune_chipset;
hwif->tuneproc = &cmd680_tuneproc; hwif->tuneproc = &cmd680_tuneproc;
...@@ -1133,16 +1133,16 @@ void __init ide_init_cmd64x(struct ata_channel *hwif) ...@@ -1133,16 +1133,16 @@ void __init ide_init_cmd64x(struct ata_channel *hwif)
case PCI_DEVICE_ID_CMD_649: case PCI_DEVICE_ID_CMD_649:
case PCI_DEVICE_ID_CMD_648: case PCI_DEVICE_ID_CMD_648:
case PCI_DEVICE_ID_CMD_643: case PCI_DEVICE_ID_CMD_643:
hwif->dmaproc = &cmd64x_dmaproc; hwif->udma = &cmd64x_dmaproc;
hwif->tuneproc = &cmd64x_tuneproc; hwif->tuneproc = &cmd64x_tuneproc;
hwif->speedproc = &cmd64x_tune_chipset; hwif->speedproc = &cmd64x_tune_chipset;
break; break;
case PCI_DEVICE_ID_CMD_646: case PCI_DEVICE_ID_CMD_646:
hwif->chipset = ide_cmd646; hwif->chipset = ide_cmd646;
if (class_rev == 0x01) { if (class_rev == 0x01) {
hwif->dmaproc = &cmd646_1_dmaproc; hwif->udma = &cmd646_1_dmaproc;
} else { } else {
hwif->dmaproc = &cmd64x_dmaproc; hwif->udma = &cmd64x_dmaproc;
} }
hwif->tuneproc = &cmd64x_tuneproc; hwif->tuneproc = &cmd64x_tuneproc;
hwif->speedproc = &cmd64x_tune_chipset; hwif->speedproc = &cmd64x_tune_chipset;
......
...@@ -144,7 +144,7 @@ static int cs5530_config_dma (ide_drive_t *drive) ...@@ -144,7 +144,7 @@ static int cs5530_config_dma (ide_drive_t *drive)
/* /*
* Default to DMA-off in case we run into trouble here. * 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 */ outb(inb(hwif->dma_base+2)&~(unit?0x40:0x20), hwif->dma_base+2); /* clear DMA_capable bit */
/* /*
...@@ -158,7 +158,7 @@ static int cs5530_config_dma (ide_drive_t *drive) ...@@ -158,7 +158,7 @@ static int cs5530_config_dma (ide_drive_t *drive)
*/ */
if (mate->present) { if (mate->present) {
struct hd_driveid *mateid = mate->id; 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)) if ((mateid->field_valid & 4) && (mateid->dma_ultra & 7))
udma_ok = 1; udma_ok = 1;
else if ((mateid->field_valid & 2) && (mateid->dma_mword & 7)) else if ((mateid->field_valid & 2) && (mateid->dma_mword & 7))
...@@ -172,7 +172,7 @@ static int cs5530_config_dma (ide_drive_t *drive) ...@@ -172,7 +172,7 @@ static int cs5530_config_dma (ide_drive_t *drive)
* Now see what the current drive is capable of, * Now see what the current drive is capable of,
* selecting UDMA only if the mate said it was ok. * 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 (udma_ok && (id->field_valid & 4) && (id->dma_ultra & 7)) {
if (id->dma_ultra & 4) if (id->dma_ultra & 4)
mode = XFER_UDMA_2; mode = XFER_UDMA_2;
...@@ -229,7 +229,7 @@ static int cs5530_config_dma (ide_drive_t *drive) ...@@ -229,7 +229,7 @@ static int cs5530_config_dma (ide_drive_t *drive)
/* /*
* Finally, turn DMA on in software, and exit. * 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 */
} }
/* /*
...@@ -237,7 +237,7 @@ static int cs5530_config_dma (ide_drive_t *drive) ...@@ -237,7 +237,7 @@ static int cs5530_config_dma (ide_drive_t *drive)
* We need it for our custom "ide_dma_check" function. * We need it for our custom "ide_dma_check" function.
* All other requests are forwarded to the standard ide_dmaproc(). * 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) { switch (func) {
case ide_dma_check: case ide_dma_check:
...@@ -246,7 +246,7 @@ int cs5530_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -246,7 +246,7 @@ int cs5530_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
break; break;
} }
/* Other cases are done by generic IDE-DMA code. */ /* 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 */ #endif /* CONFIG_BLK_DEV_IDEDMA */
...@@ -353,7 +353,7 @@ void __init ide_init_cs5530(struct ata_channel *hwif) ...@@ -353,7 +353,7 @@ void __init ide_init_cs5530(struct ata_channel *hwif)
unsigned int basereg, d0_timings; unsigned int basereg, d0_timings;
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
hwif->dmaproc = &cs5530_dmaproc; hwif->udma = cs5530_dmaproc;
hwif->highmem = 1; hwif->highmem = 1;
#else #else
hwif->autodma = 0; hwif->autodma = 0;
......
...@@ -234,7 +234,7 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single) ...@@ -234,7 +234,7 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single)
/* /*
* used to set DMA mode for CY82C693 (single and multi modes) * 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 * if the function is dma on, set dma mode for drive everything
...@@ -247,14 +247,14 @@ static int cy82c693_dmaproc(ide_dma_action_t func, ide_drive_t *drive) ...@@ -247,14 +247,14 @@ static int cy82c693_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
printk (KERN_INFO "dma_on: %s\n", drive->name); printk (KERN_INFO "dma_on: %s\n", drive->name);
#endif /* CY82C693_DEBUG_INFO */ #endif /* CY82C693_DEBUG_INFO */
if (id != NULL) { if (id != NULL) {
/* Enable DMA on any drive that has DMA (multi or single) enabled */ /* Enable DMA on any drive that has DMA (multi or single) enabled */
if (id->field_valid & 2) { /* regular DMA */ if (id->field_valid & 2) { /* regular DMA */
int mmode, smode; int mmode, smode;
mmode = id->dma_mword & (id->dma_mword >> 8); mmode = id->dma_mword & (id->dma_mword >> 8);
smode = id->dma_1word & (id->dma_1word >> 8); smode = id->dma_1word & (id->dma_1word >> 8);
if (mmode != 0) if (mmode != 0)
cy82c693_dma_enable(drive, (mmode >> 1), 0); /* enable multi */ cy82c693_dma_enable(drive, (mmode >> 1), 0); /* enable multi */
else if (smode != 0) else if (smode != 0)
...@@ -262,7 +262,7 @@ static int cy82c693_dmaproc(ide_dma_action_t func, ide_drive_t *drive) ...@@ -262,7 +262,7 @@ static int cy82c693_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
} }
} }
} }
return ide_dmaproc(func, drive); return ide_dmaproc(func, drive, rq);
} }
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_BLK_DEV_IDEDMA */
...@@ -442,7 +442,7 @@ void __init ide_init_cy82c693(struct ata_channel *hwif) ...@@ -442,7 +442,7 @@ void __init ide_init_cy82c693(struct ata_channel *hwif)
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) { if (hwif->dma_base) {
hwif->highmem = 1; hwif->highmem = 1;
hwif->dmaproc = cy82c693_dmaproc; hwif->udma = cy82c693_dmaproc;
if (!noautodma) if (!noautodma)
hwif->autodma = 1; hwif->autodma = 1;
} }
......
...@@ -334,7 +334,6 @@ int hpt34x_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -334,7 +334,6 @@ int hpt34x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
drive->waiting_for_dma = 1; drive->waiting_for_dma = 1;
if (drive->type != ATA_DISK) if (drive->type != ATA_DISK)
return 0; return 0;
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); /* issue cmd to drive */ 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); OUT_BYTE((reading == 9) ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
return 0; return 0;
......
...@@ -750,7 +750,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -750,7 +750,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
if (id && (id->capability & 1) && drive->channel->autodma) { if (id && (id->capability & 1) && drive->channel->autodma) {
/* Consult the list of known "bad" drives */ /* 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; dma_func = ide_dma_off;
goto fast_ata_pio; goto fast_ata_pio;
} }
...@@ -771,7 +771,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -771,7 +771,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
if (dma_func != ide_dma_on) if (dma_func != ide_dma_on)
goto no_dma_set; 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) { if (id->eide_dma_time > 150) {
goto no_dma_set; goto no_dma_set;
} }
...@@ -789,7 +789,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -789,7 +789,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
config_chipset_for_pio(drive); config_chipset_for_pio(drive);
} }
return drive->channel->dmaproc(dma_func, drive); return drive->channel->udma(dma_func, drive, NULL);
} }
/* /*
...@@ -798,7 +798,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -798,7 +798,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
* This is specific to the HPT366 UDMA bios chipset * This is specific to the HPT366 UDMA bios chipset
* by HighPoint|Triones Technologies, Inc. * 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; byte reg50h = 0, reg52h = 0, reg5ah = 0, dma_stat = 0;
unsigned long dma_base = drive->channel->dma_base; unsigned long dma_base = drive->channel->dma_base;
...@@ -829,10 +829,10 @@ int hpt366_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -829,10 +829,10 @@ int hpt366_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
default: default:
break; 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; struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base; unsigned long dma_base = hwif->dma_base;
...@@ -883,7 +883,7 @@ int hpt370_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -883,7 +883,7 @@ int hpt370_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
default: default:
break; 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_BLK_DEV_IDEDMA */
...@@ -1185,9 +1185,9 @@ void __init ide_init_hpt366(struct ata_channel *hwif) ...@@ -1185,9 +1185,9 @@ void __init ide_init_hpt366(struct ata_channel *hwif)
pci_read_config_byte(hwif->pci_dev, 0x5a, &reg5ah); pci_read_config_byte(hwif->pci_dev, 0x5a, &reg5ah);
if (reg5ah & 0x10) /* interrupt force enable */ if (reg5ah & 0x10) /* interrupt force enable */
pci_write_config_byte(hwif->pci_dev, 0x5a, reg5ah & ~0x10); pci_write_config_byte(hwif->pci_dev, 0x5a, reg5ah & ~0x10);
hwif->dmaproc = &hpt370_dmaproc; hwif->udma = hpt370_dmaproc;
} else { } else {
hwif->dmaproc = &hpt366_dmaproc; hwif->udma = hpt366_dmaproc;
} }
if (!noautodma) if (!noautodma)
hwif->autodma = 1; hwif->autodma = 1;
......
...@@ -327,7 +327,7 @@ icside_set_speed(ide_drive_t *drive, byte speed) ...@@ -327,7 +327,7 @@ icside_set_speed(ide_drive_t *drive, byte speed)
/* /*
* dma_intr() is the handler for disk read/write DMA interrupts * 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; int i;
byte stat, dma_stat; byte stat, dma_stat;
...@@ -336,15 +336,13 @@ static ide_startstop_t icside_dmaintr(ide_drive_t *drive) ...@@ -336,15 +336,13 @@ static ide_startstop_t icside_dmaintr(ide_drive_t *drive)
stat = GET_STAT(); /* get drive status */ stat = GET_STAT(); /* get drive status */
if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) { if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
if (!dma_stat) { if (!dma_stat) {
struct request *rq = HWGROUP(drive)->rq;
rq = HWGROUP(drive)->rq;
for (i = rq->nr_sectors; i > 0;) { for (i = rq->nr_sectors; i > 0;) {
i -= rq->current_nr_sectors; i -= rq->current_nr_sectors;
ide_end_request(drive, 1); ide_end_request(drive, 1);
} }
return ide_stopped; 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); drive->name, dma_stat);
} }
return ide_error(drive, "dma_intr", stat); return ide_error(drive, "dma_intr", stat);
...@@ -443,8 +441,7 @@ icside_dmaproc(ide_dma_action_t func, ide_drive_t *drive) ...@@ -443,8 +441,7 @@ icside_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
if (drive->type != ATA_DISK) if (drive->type != ATA_DISK)
return 0; 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, OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA,
IDE_COMMAND_REG); IDE_COMMAND_REG);
......
...@@ -548,26 +548,23 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, ...@@ -548,26 +548,23 @@ static void cdrom_queue_request_sense(ide_drive_t *drive,
} }
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) if ((rq->flags & REQ_SENSE) && uptodate)
cdrom_analyze_sense_data(drive, rq); cdrom_analyze_sense_data(drive, rq);
if ((rq->flags & REQ_CMD) && !rq->current_nr_sectors) if ((rq->flags & REQ_CMD) && !rq->current_nr_sectors)
uptodate = 1; uptodate = 1;
ide_end_request(drive, uptodate); ide_end_request(drive, rq, uptodate);
} }
/* Returns 0 if the request should be continued. /* Returns 0 if the request should be continued.
Returns 1 if the request was ended. */ 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) int good_stat, int *stat_ret)
{ {
struct request *rq = HWGROUP(drive)->rq;
int stat, err, sense_key; int stat, err, sense_key;
struct packet_command *pc; struct packet_command *pc;
...@@ -583,7 +580,7 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive, ...@@ -583,7 +580,7 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive,
sense_key = err >> 4; sense_key = err >> 4;
if (rq == NULL) { 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; *startstop = ide_stopped;
return 1; return 1;
} }
...@@ -596,7 +593,7 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive, ...@@ -596,7 +593,7 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive,
/* FIXME --mdcki */ /* FIXME --mdcki */
pc = (struct packet_command *) rq->special; pc = (struct packet_command *) rq->special;
pc->stat = 1; pc->stat = 1;
cdrom_end_request(drive, 1); cdrom_end_request(drive, rq, 1);
*startstop = ide_error (drive, "request sense failure", stat); *startstop = ide_error (drive, "request sense failure", stat);
return 1; return 1;
...@@ -634,7 +631,7 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive, ...@@ -634,7 +631,7 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive,
} }
pc->stat = 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. /* FIXME: this is the only place where pc->sense get's used.
* Think hard about how to get rid of it... * Think hard about how to get rid of it...
...@@ -651,7 +648,7 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive, ...@@ -651,7 +648,7 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive,
/* Fail the request. */ /* Fail the request. */
printk ("%s: tray open\n", drive->name); printk ("%s: tray open\n", drive->name);
cdrom_end_request(drive, 0); cdrom_end_request(drive, rq, 0);
} else if (sense_key == UNIT_ATTENTION) { } else if (sense_key == UNIT_ATTENTION) {
/* Media change. */ /* Media change. */
cdrom_saw_media_change (drive); cdrom_saw_media_change (drive);
...@@ -660,27 +657,27 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive, ...@@ -660,27 +657,27 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive,
But be sure to give up if we've retried But be sure to give up if we've retried
too many times. */ too many times. */
if (++rq->errors > ERROR_MAX) if (++rq->errors > ERROR_MAX)
cdrom_end_request(drive, 0); cdrom_end_request(drive, rq, 0);
} else if (sense_key == ILLEGAL_REQUEST || } else if (sense_key == ILLEGAL_REQUEST ||
sense_key == DATA_PROTECT) { sense_key == DATA_PROTECT) {
/* No point in retrying after an illegal /* No point in retrying after an illegal
request or data protect error.*/ request or data protect error.*/
ide_dump_status (drive, "command error", stat); ide_dump_status (drive, "command error", stat);
cdrom_end_request(drive, 0); cdrom_end_request(drive, rq, 0);
} else if (sense_key == MEDIUM_ERROR) { } else if (sense_key == MEDIUM_ERROR) {
/* No point in re-trying a zillion times on a bad /* No point in re-trying a zillion times on a bad
* sector. The error is not correctable at all. * sector. The error is not correctable at all.
*/ */
ide_dump_status (drive, "media error (bad sector)", stat); 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) { } else if ((err & ~ABRT_ERR) != 0) {
/* Go to the default handler /* Go to the default handler
for other errors. */ for other errors. */
*startstop = ide_error (drive, "cdrom_decode_status", stat); *startstop = ide_error (drive, __FUNCTION__, stat);
return 1; return 1;
} else if ((++rq->errors > ERROR_MAX)) { } else if ((++rq->errors > ERROR_MAX)) {
/* We've racked up too many retries. Abort. */ /* 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, /* If we got a CHECK_CONDITION status,
...@@ -695,9 +692,8 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive, ...@@ -695,9 +692,8 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive,
return 1; 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; unsigned long wait = 0;
/* /*
...@@ -727,9 +723,10 @@ static int cdrom_timer_expiry(ide_drive_t *drive) ...@@ -727,9 +723,10 @@ static int cdrom_timer_expiry(ide_drive_t *drive)
called when the interrupt from the drive arrives. Otherwise, HANDLER called when the interrupt from the drive arrives. Otherwise, HANDLER
will be called immediately after the drive is prepared for the transfer. */ 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, int xferlen,
ide_handler_t *handler) ata_handler_t handler)
{ {
ide_startstop_t startstop; ide_startstop_t startstop;
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
...@@ -740,9 +737,9 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive, ...@@ -740,9 +737,9 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
if (info->dma) { if (info->dma) {
if (info->cmd == READ) 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) 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 else
printk("ide-cd: DMA set, but not allowed\n"); printk("ide-cd: DMA set, but not allowed\n");
} }
...@@ -758,16 +755,15 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive, ...@@ -758,16 +755,15 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
OUT_BYTE (drive->ctl, IDE_CONTROL_REG); OUT_BYTE (drive->ctl, IDE_CONTROL_REG);
if (info->dma) 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) { 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 */ OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* packet command */
return ide_started; return ide_started;
} else { } else {
OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* packet command */ OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* packet command */
return (*handler) (drive); return handler(drive, rq);
} }
} }
...@@ -776,9 +772,10 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive, ...@@ -776,9 +772,10 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
* already been prepared by cdrom_start_packet_command. "handler" is the * already been prepared by cdrom_start_packet_command. "handler" is the
* interrupt handler to call when the command completes or there's data ready. * 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, unsigned char *cmd, unsigned long timeout,
ide_handler_t *handler) ata_handler_t handler)
{ {
ide_startstop_t startstop; ide_startstop_t startstop;
...@@ -788,7 +785,7 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive, ...@@ -788,7 +785,7 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive,
int stat_dum; int stat_dum;
/* Check for errors. */ /* 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; return startstop;
} else { } else {
/* Otherwise, we must wait for DRQ to get set. */ /* Otherwise, we must wait for DRQ to get set. */
...@@ -797,7 +794,6 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive, ...@@ -797,7 +794,6 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive,
} }
/* Arm the interrupt handler. */ /* Arm the interrupt handler. */
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, handler, timeout, cdrom_timer_expiry); ide_set_handler(drive, handler, timeout, cdrom_timer_expiry);
/* Send the command to the device. */ /* Send the command to the device. */
...@@ -861,7 +857,7 @@ static void cdrom_buffer_sectors (ide_drive_t *drive, unsigned long sector, ...@@ -861,7 +857,7 @@ static void cdrom_buffer_sectors (ide_drive_t *drive, unsigned long sector,
* ok; nonzero if the request has been terminated. * ok; nonzero if the request has been terminated.
*/ */
static inline 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; ireason &= 3;
if (ireason == 2) return 0; if (ireason == 2) return 0;
...@@ -891,14 +887,14 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason) ...@@ -891,14 +887,14 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
drive->name, ireason); drive->name, ireason);
} }
cdrom_end_request(drive, 0); cdrom_end_request(drive, rq, 0);
return -1; return -1;
} }
/* /*
* Interrupt routine. Called when a read request has completed. * 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 stat;
int ireason, len, sectors_to_transfer, nskip; int ireason, len, sectors_to_transfer, nskip;
...@@ -906,21 +902,19 @@ static ide_startstop_t cdrom_read_intr(ide_drive_t *drive) ...@@ -906,21 +902,19 @@ static ide_startstop_t cdrom_read_intr(ide_drive_t *drive)
int dma = info->dma, dma_error = 0; int dma = info->dma, dma_error = 0;
ide_startstop_t startstop; ide_startstop_t startstop;
struct request *rq = HWGROUP(drive)->rq;
/* Check for errors. */ /* Check for errors. */
if (dma) { if (dma) {
info->dma = 0; info->dma = 0;
if ((dma_error = drive->channel->dmaproc(ide_dma_end, drive))) if ((dma_error = drive->channel->udma(ide_dma_end, drive, NULL)))
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))
return startstop; return startstop;
if (dma) { if (dma) {
if (!dma_error) { if (!dma_error) {
__ide_end_request(drive, 1, rq->nr_sectors); __ide_end_request(drive, rq, 1, rq->nr_sectors);
return ide_stopped; return ide_stopped;
} else } else
return ide_error (drive, "dma error", stat); return ide_error (drive, "dma error", stat);
...@@ -937,14 +931,14 @@ static ide_startstop_t cdrom_read_intr(ide_drive_t *drive) ...@@ -937,14 +931,14 @@ static ide_startstop_t cdrom_read_intr(ide_drive_t *drive)
if (rq->current_nr_sectors > 0) { if (rq->current_nr_sectors > 0) {
printk ("%s: cdrom_read_intr: data underrun (%u blocks)\n", printk ("%s: cdrom_read_intr: data underrun (%u blocks)\n",
drive->name, rq->current_nr_sectors); drive->name, rq->current_nr_sectors);
cdrom_end_request(drive, 0); cdrom_end_request(drive, rq, 0);
} else } else
cdrom_end_request(drive, 1); cdrom_end_request(drive, rq, 1);
return ide_stopped; return ide_stopped;
} }
/* Check that the drive is expecting to do the same thing we are. */ /* 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; return ide_stopped;
/* Assume that the drive will always provide data in multiples /* Assume that the drive will always provide data in multiples
...@@ -959,7 +953,7 @@ static ide_startstop_t cdrom_read_intr(ide_drive_t *drive) ...@@ -959,7 +953,7 @@ static ide_startstop_t cdrom_read_intr(ide_drive_t *drive)
printk (" Trying to limit transfer sizes\n"); printk (" Trying to limit transfer sizes\n");
CDROM_CONFIG_FLAGS (drive)->limit_nframes = 1; CDROM_CONFIG_FLAGS (drive)->limit_nframes = 1;
} }
cdrom_end_request(drive, 0); cdrom_end_request(drive, rq, 0);
return ide_stopped; return ide_stopped;
} }
...@@ -987,7 +981,7 @@ static ide_startstop_t cdrom_read_intr(ide_drive_t *drive) ...@@ -987,7 +981,7 @@ static ide_startstop_t cdrom_read_intr(ide_drive_t *drive)
/* If we've filled the present buffer but there's another /* If we've filled the present buffer but there's another
chained buffer after it, move on. */ chained buffer after it, move on. */
if (rq->current_nr_sectors == 0 && rq->nr_sectors) 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 /* If the buffers are full, cache the rest of the data in our
internal buffer. */ internal buffer. */
...@@ -1015,10 +1009,8 @@ static ide_startstop_t cdrom_read_intr(ide_drive_t *drive) ...@@ -1015,10 +1009,8 @@ static ide_startstop_t cdrom_read_intr(ide_drive_t *drive)
} }
} }
/* Done moving data! /* Done moving data! Wait for another interrupt. */
Wait for another interrupt. */ ide_set_handler(drive, cdrom_read_intr, WAIT_CMD, NULL);
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &cdrom_read_intr, WAIT_CMD, NULL);
return ide_started; return ide_started;
} }
...@@ -1027,10 +1019,9 @@ static ide_startstop_t cdrom_read_intr(ide_drive_t *drive) ...@@ -1027,10 +1019,9 @@ static ide_startstop_t cdrom_read_intr(ide_drive_t *drive)
* Try to satisfy some of the current read request from our cached data. * Try to satisfy some of the current read request from our cached data.
* Returns nonzero if the request has been completed, zero otherwise. * 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 cdrom_info *info = drive->driver_data;
struct request *rq = HWGROUP(drive)->rq;
/* Can't do anything if there's no buffer. */ /* Can't do anything if there's no buffer. */
if (info->buffer == NULL) return 0; if (info->buffer == NULL) return 0;
...@@ -1041,7 +1032,7 @@ static int cdrom_read_from_buffer (ide_drive_t *drive) ...@@ -1041,7 +1032,7 @@ static int cdrom_read_from_buffer (ide_drive_t *drive)
rq->sector >= info->sector_buffered && rq->sector >= info->sector_buffered &&
rq->sector < info->sector_buffered + info->nsectors_buffered) { rq->sector < info->sector_buffered + info->nsectors_buffered) {
if (rq->current_nr_sectors == 0) if (rq->current_nr_sectors == 0)
cdrom_end_request(drive, 1); cdrom_end_request(drive, rq, 1);
memcpy (rq->buffer, memcpy (rq->buffer,
info->buffer + info->buffer +
...@@ -1056,13 +1047,13 @@ static int cdrom_read_from_buffer (ide_drive_t *drive) ...@@ -1056,13 +1047,13 @@ static int cdrom_read_from_buffer (ide_drive_t *drive)
/* If we've satisfied the current request, /* If we've satisfied the current request,
terminate it successfully. */ terminate it successfully. */
if (rq->nr_sectors == 0) { if (rq->nr_sectors == 0) {
cdrom_end_request(drive, 1); cdrom_end_request(drive, rq, 1);
return -1; return -1;
} }
/* Move on to the next buffer if needed. */ /* Move on to the next buffer if needed. */
if (rq->current_nr_sectors == 0) 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 /* 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 represent the number of sectors to skip at the start of a transfer
...@@ -1070,9 +1061,9 @@ static int cdrom_read_from_buffer (ide_drive_t *drive) ...@@ -1070,9 +1061,9 @@ static int cdrom_read_from_buffer (ide_drive_t *drive)
paranoid and check. */ paranoid and check. */
if (rq->current_nr_sectors < bio_sectors(rq->bio) && if (rq->current_nr_sectors < bio_sectors(rq->bio) &&
(rq->sector % SECTORS_PER_FRAME) != 0) { (rq->sector % SECTORS_PER_FRAME) != 0) {
printk ("%s: cdrom_read_from_buffer: buffer botch (%ld)\n", printk ("%s: %s: buffer botch (%ld)\n",
drive->name, rq->sector); drive->name, __FUNCTION__, rq->sector);
cdrom_end_request(drive, 0); cdrom_end_request(drive, rq, 0);
return -1; return -1;
} }
...@@ -1084,9 +1075,8 @@ static int cdrom_read_from_buffer (ide_drive_t *drive) ...@@ -1084,9 +1075,8 @@ static int cdrom_read_from_buffer (ide_drive_t *drive)
* directly from cdrom_start_read. However, for drq_interrupt devices, it is * 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. * 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; int nsect, sector, nframes, frame, nskip;
/* Number of sectors to transfer. */ /* Number of sectors to transfer. */
...@@ -1107,9 +1097,9 @@ static ide_startstop_t cdrom_start_read_continuation(ide_drive_t *drive) ...@@ -1107,9 +1097,9 @@ static ide_startstop_t cdrom_start_read_continuation(ide_drive_t *drive)
/* Sanity check... */ /* Sanity check... */
if (rq->current_nr_sectors != bio_sectors(rq->bio) && if (rq->current_nr_sectors != bio_sectors(rq->bio) &&
(rq->sector % CD_FRAMESIZE != 0)) { (rq->sector % CD_FRAMESIZE != 0)) {
printk ("%s: cdrom_start_read_continuation: buffer botch (%u)\n", printk ("%s: %s: buffer botch (%u)\n",
drive->name, rq->current_nr_sectors); drive->name, __FUNCTION__, rq->current_nr_sectors);
cdrom_end_request(drive, 0); cdrom_end_request(drive, rq, 0);
return ide_stopped; return ide_stopped;
} }
sector -= nskip; sector -= nskip;
...@@ -1128,7 +1118,7 @@ static ide_startstop_t cdrom_start_read_continuation(ide_drive_t *drive) ...@@ -1128,7 +1118,7 @@ static ide_startstop_t cdrom_start_read_continuation(ide_drive_t *drive)
(65534 / CD_FRAMESIZE) : 65535); (65534 / CD_FRAMESIZE) : 65535);
/* Send the command to the drive and return. */ /* 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);
} }
...@@ -1136,14 +1126,14 @@ static ide_startstop_t cdrom_start_read_continuation(ide_drive_t *drive) ...@@ -1136,14 +1126,14 @@ static ide_startstop_t cdrom_start_read_continuation(ide_drive_t *drive)
#define IDECD_SEEK_TIMER (5 * WAIT_MIN_SLEEP) /* 100 ms */ #define IDECD_SEEK_TIMER (5 * WAIT_MIN_SLEEP) /* 100 ms */
#define IDECD_SEEK_TIMEOUT WAIT_CMD /* 10 sec */ #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; struct cdrom_info *info = drive->driver_data;
int stat; int stat;
static int retry = 10; static int retry = 10;
ide_startstop_t startstop; ide_startstop_t startstop;
if (cdrom_decode_status (&startstop, drive, 0, &stat)) if (cdrom_decode_status (&startstop, drive, rq, 0, &stat))
return startstop; return startstop;
CDROM_CONFIG_FLAGS(drive)->seeking = 1; CDROM_CONFIG_FLAGS(drive)->seeking = 1;
...@@ -1162,10 +1152,9 @@ static ide_startstop_t cdrom_seek_intr (ide_drive_t *drive) ...@@ -1162,10 +1152,9 @@ static ide_startstop_t cdrom_seek_intr (ide_drive_t *drive)
return ide_stopped; 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]; unsigned char cmd[CDROM_PACKET_SIZE];
struct request *rq = HWGROUP(drive)->rq;
sector_t sector; sector_t sector;
int frame, nskip; int frame, nskip;
...@@ -1179,17 +1168,17 @@ static ide_startstop_t cdrom_start_seek_continuation(struct ata_device *drive) ...@@ -1179,17 +1168,17 @@ static ide_startstop_t cdrom_start_seek_continuation(struct ata_device *drive)
cmd[0] = GPCMD_SEEK; cmd[0] = GPCMD_SEEK;
put_unaligned(cpu_to_be32(frame), (unsigned int *) &cmd[2]); 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; struct cdrom_info *info = drive->driver_data;
info->dma = 0; info->dma = 0;
info->cmd = 0; info->cmd = 0;
info->start_seek = jiffies; 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);
} }
/* /*
...@@ -1214,15 +1203,14 @@ static void restore_request (struct request *rq) ...@@ -1214,15 +1203,14 @@ static void restore_request (struct request *rq)
/* /*
* Start a read request from the CD-ROM. * 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 cdrom_info *info = drive->driver_data;
struct request *rq = HWGROUP(drive)->rq;
restore_request(rq); restore_request(rq);
/* Satisfy whatever we can of this request from our cached sector. */ /* 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; return ide_stopped;
blk_attempt_remerge(&drive->queue, rq); blk_attempt_remerge(&drive->queue, rq);
...@@ -1239,7 +1227,7 @@ static ide_startstop_t cdrom_start_read(struct ata_device *drive, sector_t block ...@@ -1239,7 +1227,7 @@ static ide_startstop_t cdrom_start_read(struct ata_device *drive, sector_t block
info->cmd = READ; info->cmd = READ;
/* Start sending the read request to the drive. */ /* 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);
} }
/**************************************************************************** /****************************************************************************
...@@ -1247,17 +1235,16 @@ static ide_startstop_t cdrom_start_read(struct ata_device *drive, sector_t block ...@@ -1247,17 +1235,16 @@ static ide_startstop_t cdrom_start_read(struct ata_device *drive, sector_t block
*/ */
/* Interrupt routine for packet command completion. */ /* 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; int ireason, len, stat, thislen;
struct request *rq = HWGROUP(drive)->rq;
/* FIXME --mdcki */ /* FIXME --mdcki */
struct packet_command *pc = (struct packet_command *) rq->special; struct packet_command *pc = (struct packet_command *) rq->special;
ide_startstop_t startstop; ide_startstop_t startstop;
/* Check for errors. */ /* Check for errors. */
if (cdrom_decode_status (&startstop, drive, 0, &stat)) if (cdrom_decode_status (&startstop, drive, rq, 0, &stat))
return startstop; return startstop;
/* Read the interrupt reason and the transfer length. */ /* Read the interrupt reason and the transfer length. */
...@@ -1279,7 +1266,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) ...@@ -1279,7 +1266,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
} }
if (pc->buflen == 0) if (pc->buflen == 0)
cdrom_end_request(drive, 1); cdrom_end_request(drive, rq, 1);
else { else {
/* Comment this out, because this always happens /* Comment this out, because this always happens
right after a reset occurs, and it is annoying to right after a reset occurs, and it is annoying to
...@@ -1289,7 +1276,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) ...@@ -1289,7 +1276,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
drive->name, pc->buflen); drive->name, pc->buflen);
*/ */
pc->stat = 1; pc->stat = 1;
cdrom_end_request(drive, 1); cdrom_end_request(drive, rq, 1);
} }
return ide_stopped; return ide_stopped;
} }
...@@ -1341,15 +1328,13 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) ...@@ -1341,15 +1328,13 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
} }
/* Now we wait for another interrupt. */ /* 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; 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; unsigned long timeout;
/* FIXME --mdcki */ /* FIXME --mdcki */
...@@ -1361,13 +1346,12 @@ static ide_startstop_t cdrom_do_pc_continuation(ide_drive_t *drive) ...@@ -1361,13 +1346,12 @@ static ide_startstop_t cdrom_do_pc_continuation(ide_drive_t *drive)
timeout = WAIT_CMD; timeout = WAIT_CMD;
/* Send the command to the drive and return. */ /* 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; int len;
struct request *rq = HWGROUP(drive)->rq;
/* FIXME --mdcki */ /* FIXME --mdcki */
struct packet_command *pc = (struct packet_command *) rq->special; struct packet_command *pc = (struct packet_command *) rq->special;
...@@ -1379,7 +1363,7 @@ static ide_startstop_t cdrom_do_packet_command (ide_drive_t *drive) ...@@ -1379,7 +1363,7 @@ static ide_startstop_t cdrom_do_packet_command (ide_drive_t *drive)
len = pc->buflen; len = pc->buflen;
/* Start sending the command to the drive. */ /* 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);
} }
...@@ -1455,7 +1439,8 @@ int cdrom_queue_packet_command(ide_drive_t *drive, unsigned char *cmd, ...@@ -1455,7 +1439,8 @@ int cdrom_queue_packet_command(ide_drive_t *drive, unsigned char *cmd,
/* /*
* Write handling * 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 /* Two notes about IDE interrupt reason here - 0 means that
* the drive wants to receive data from us, 2 means that * the drive wants to receive data from us, 2 means that
...@@ -1481,29 +1466,27 @@ static inline int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ire ...@@ -1481,29 +1466,27 @@ static inline int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ire
drive->name, ireason); drive->name, ireason);
} }
cdrom_end_request(drive, 0); cdrom_end_request(drive, rq, 0);
return 1; 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; int stat, ireason, len, sectors_to_transfer, uptodate;
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
int dma_error = 0, dma = info->dma; int dma_error = 0, dma = info->dma;
ide_startstop_t startstop; ide_startstop_t startstop;
struct request *rq = HWGROUP(drive)->rq;
/* Check for errors. */ /* Check for errors. */
if (dma) { if (dma) {
info->dma = 0; 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"); 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"); printk("ide-cd: write_intr decode_status bad\n");
return startstop; return startstop;
} }
...@@ -1515,8 +1498,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive) ...@@ -1515,8 +1498,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
if (dma_error) if (dma_error)
return ide_error(drive, "dma error", stat); return ide_error(drive, "dma error", stat);
rq = HWGROUP(drive)->rq; __ide_end_request(drive, rq, 1, rq->nr_sectors);
__ide_end_request(drive, 1, rq->nr_sectors);
return ide_stopped; return ide_stopped;
} }
...@@ -1535,13 +1517,13 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive) ...@@ -1535,13 +1517,13 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
drive->name, rq->current_nr_sectors); drive->name, rq->current_nr_sectors);
uptodate = 0; uptodate = 0;
} }
cdrom_end_request(drive, uptodate); cdrom_end_request(drive, rq, uptodate);
return ide_stopped; return ide_stopped;
} }
/* Check that the drive is expecting to do the same thing we are. */ /* Check that the drive is expecting to do the same thing we are. */
if (ireason & 3) if (ireason & 3)
if (cdrom_write_check_ireason(drive, len, ireason)) if (cdrom_write_check_ireason(drive, rq, len, ireason))
return ide_stopped; return ide_stopped;
sectors_to_transfer = len / SECTOR_SIZE; sectors_to_transfer = len / SECTOR_SIZE;
...@@ -1576,23 +1558,21 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive) ...@@ -1576,23 +1558,21 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
* current buffer complete, move on * current buffer complete, move on
*/ */
if (rq->current_nr_sectors == 0 && rq->nr_sectors) if (rq->current_nr_sectors == 0 && rq->nr_sectors)
cdrom_end_request(drive, 1); cdrom_end_request(drive, rq, 1);
} }
/* re-arm handler */ /* 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; 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, rq->cmd, 2 * WAIT_CMD, cdrom_write_intr);
return cdrom_transfer_packet_command(drive, 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; struct cdrom_info *info = drive->driver_data;
...@@ -1600,7 +1580,7 @@ static ide_startstop_t cdrom_start_write(ide_drive_t *drive, struct request *rq) ...@@ -1600,7 +1580,7 @@ static ide_startstop_t cdrom_start_write(ide_drive_t *drive, struct request *rq)
* writes *must* be 2kB frame aligned * writes *must* be 2kB frame aligned
*/ */
if ((rq->nr_sectors & 3) || (rq->sector & 3)) { if ((rq->nr_sectors & 3) || (rq->sector & 3)) {
cdrom_end_request(drive, 0); cdrom_end_request(drive, rq, 0);
return ide_stopped; return ide_stopped;
} }
...@@ -1620,7 +1600,7 @@ static ide_startstop_t cdrom_start_write(ide_drive_t *drive, struct request *rq) ...@@ -1620,7 +1600,7 @@ static ide_startstop_t cdrom_start_write(ide_drive_t *drive, struct request *rq)
info->cmd = WRITE; info->cmd = WRITE;
/* Start sending the read request to the drive. */ /* 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))) #define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))
...@@ -1649,17 +1629,17 @@ ide_cdrom_do_request(struct ata_device *drive, struct request *rq, sector_t bloc ...@@ -1649,17 +1629,17 @@ ide_cdrom_do_request(struct ata_device *drive, struct request *rq, sector_t bloc
CDROM_CONFIG_FLAGS(drive)->seeking = 0; CDROM_CONFIG_FLAGS(drive)->seeking = 0;
} }
if (IDE_LARGE_SEEK(info->last_block, block, IDECD_SEEK_THRESHOLD) && drive->dsc_overlap) 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 { else {
if (rq_data_dir(rq) == READ) if (rq_data_dir(rq) == READ)
action = cdrom_start_read(drive, block); action = cdrom_start_read(drive, rq, block);
else else
action = cdrom_start_write(drive, rq); action = cdrom_start_write(drive, rq);
} }
info->last_block = block; info->last_block = block;
return action; return action;
} else if (rq->flags & (REQ_PC | REQ_SENSE)) { } 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) { } else if (rq->flags & REQ_SPECIAL) {
/* /*
* FIXME: Kill REQ_SEPCIAL and replace it with commands queued * FIXME: Kill REQ_SEPCIAL and replace it with commands queued
...@@ -1668,7 +1648,7 @@ ide_cdrom_do_request(struct ata_device *drive, struct request *rq, sector_t bloc ...@@ -1668,7 +1648,7 @@ ide_cdrom_do_request(struct ata_device *drive, struct request *rq, sector_t bloc
* right now this can only be a reset... * right now this can only be a reset...
*/ */
cdrom_end_request(drive, 1); cdrom_end_request(drive, rq, 1);
return ide_stopped; return ide_stopped;
} else if (rq->flags & REQ_BLOCK_PC) { } else if (rq->flags & REQ_BLOCK_PC) {
struct packet_command pc; struct packet_command pc;
...@@ -1681,7 +1661,7 @@ ide_cdrom_do_request(struct ata_device *drive, struct request *rq, sector_t bloc ...@@ -1681,7 +1661,7 @@ ide_cdrom_do_request(struct ata_device *drive, struct request *rq, sector_t bloc
/* FIXME --mdcki */ /* FIXME --mdcki */
rq->special = (char *) &pc; rq->special = (char *) &pc;
startstop = cdrom_do_packet_command(drive); startstop = cdrom_do_packet_command(drive, rq);
if (pc.stat) if (pc.stat)
++rq->errors; ++rq->errors;
...@@ -1689,7 +1669,7 @@ ide_cdrom_do_request(struct ata_device *drive, struct request *rq, sector_t bloc ...@@ -1689,7 +1669,7 @@ ide_cdrom_do_request(struct ata_device *drive, struct request *rq, sector_t bloc
} }
blk_dump_rq_flags(rq, "ide-cd bad flags"); blk_dump_rq_flags(rq, "ide-cd bad flags");
cdrom_end_request(drive, 0); cdrom_end_request(drive, rq, 0);
return ide_stopped; return ide_stopped;
} }
...@@ -2672,8 +2652,8 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) ...@@ -2672,8 +2652,8 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (drive->using_dma) if (drive->using_dma)
(void) drive->channel->dmaproc(ide_dma_verbose, drive); (void) drive->channel->udma(ide_dma_verbose, drive, NULL);
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif
printk("\n"); printk("\n");
return nslots; return nslots;
......
...@@ -275,7 +275,7 @@ static ide_startstop_t idedisk_do_request(struct ata_device *drive, struct reque ...@@ -275,7 +275,7 @@ static ide_startstop_t idedisk_do_request(struct ata_device *drive, struct reque
if (!(rq->flags & REQ_CMD)) { if (!(rq->flags & REQ_CMD)) {
blk_dump_rq_flags(rq, "idedisk_do_request - bad command"); blk_dump_rq_flags(rq, "idedisk_do_request - bad command");
ide_end_request(drive, 0); ide_end_request(drive, rq, 0);
return ide_stopped; return ide_stopped;
} }
...@@ -1050,7 +1050,7 @@ static void idedisk_setup(struct ata_device *drive) ...@@ -1050,7 +1050,7 @@ static void idedisk_setup(struct ata_device *drive)
drive->bios_cyl, drive->bios_head, drive->bios_sect); drive->bios_cyl, drive->bios_head, drive->bios_sect);
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (drive->using_dma) if (drive->using_dma)
(void) drive->channel->dmaproc(ide_dma_verbose, drive); (void) drive->channel->udma(ide_dma_verbose, drive, NULL);
#endif #endif
printk("\n"); printk("\n");
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* May be copied or modified under the terms of the GNU General Public License * May be copied or modified under the terms of the GNU General Public License
* *
* Special Thanks to Mark for his Six years of work. * Special Thanks to Mark for his Six years of work.
* *
* This module provides support for the bus-master IDE DMA functions * This module provides support for the bus-master IDE DMA functions
* of various PCI chipsets, including the Intel PIIX (i82371FB for * of various PCI chipsets, including the Intel PIIX (i82371FB for
* the 430 FX chipset), the PIIX3 (i82371SB for the 430 HX/VX and * the 430 FX chipset), the PIIX3 (i82371SB for the 430 HX/VX and
...@@ -194,17 +194,14 @@ const char *bad_dma_drives[] = {"WDC AC11000H", ...@@ -194,17 +194,14 @@ const char *bad_dma_drives[] = {"WDC AC11000H",
/* /*
* dma_intr() is the handler for disk read/write DMA interrupts * 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; byte stat, dma_stat;
dma_stat = drive->channel->dmaproc(ide_dma_end, drive); dma_stat = drive->channel->udma(ide_dma_end, drive, rq);
stat = GET_STAT(); /* get drive status */ if (OK_STAT(stat = GET_STAT(),DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
if (!dma_stat) { if (!dma_stat) {
struct request *rq = HWGROUP(drive)->rq; __ide_end_request(drive, rq, 1, rq->nr_sectors);
__ide_end_request(drive, 1, rq->nr_sectors);
return ide_stopped; 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",
...@@ -461,38 +458,39 @@ static int config_drive_for_dma (ide_drive_t *drive) ...@@ -461,38 +458,39 @@ static int config_drive_for_dma (ide_drive_t *drive)
if (id && (id->capability & 1) && hwif->autodma && config_allows_dma) { if (id && (id->capability & 1) && hwif->autodma && config_allows_dma) {
/* Consult the list of known "bad" drives */ /* Consult the list of known "bad" drives */
if (ide_dmaproc(ide_dma_bad_drive, drive)) if (ide_dmaproc(ide_dma_bad_drive, drive, NULL))
return hwif->dmaproc(ide_dma_off, drive); return hwif->udma(ide_dma_off, drive, NULL);
/* Enable DMA on any drive that has UltraDMA (mode 6/7/?) enabled */ /* Enable DMA on any drive that has UltraDMA (mode 6/7/?) enabled */
if ((id->field_valid & 4) && (eighty_ninty_three(drive))) if ((id->field_valid & 4) && (eighty_ninty_three(drive)))
if ((id->dma_ultra & (id->dma_ultra >> 14) & 2)) 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 */ /* Enable DMA on any drive that has UltraDMA (mode 3/4/5) enabled */
if ((id->field_valid & 4) && (eighty_ninty_three(drive))) if ((id->field_valid & 4) && (eighty_ninty_three(drive)))
if ((id->dma_ultra & (id->dma_ultra >> 11) & 7)) 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 */ /* Enable DMA on any drive that has UltraDMA (mode 0/1/2) enabled */
if (id->field_valid & 4) /* UltraDMA */ if (id->field_valid & 4) /* UltraDMA */
if ((id->dma_ultra & (id->dma_ultra >> 8) & 7)) 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 */ /* Enable DMA on any drive that has mode2 DMA (multi or single) enabled */
if (id->field_valid & 2) /* regular DMA */ if (id->field_valid & 2) /* regular DMA */
if ((id->dma_mword & 0x404) == 0x404 || (id->dma_1word & 0x404) == 0x404) 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 */ /* Consult the list of known "good" drives */
if (ide_dmaproc(ide_dma_good_drive, drive)) if (ide_dmaproc(ide_dma_good_drive, drive, NULL))
return hwif->dmaproc(ide_dma_on, drive); 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 * 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 #ifdef DEBUG
printk("%s: dma_timer_expiry: dma status == 0x%02x\n", drive->name, dma_stat); printk("%s: dma_timer_expiry: dma status == 0x%02x\n", drive->name, dma_stat);
...@@ -503,7 +501,7 @@ static int dma_timer_expiry(ide_drive_t *drive) ...@@ -503,7 +501,7 @@ static int dma_timer_expiry(ide_drive_t *drive)
#endif #endif
if (dma_stat & 2) { /* ERROR */ if (dma_stat & 2) { /* ERROR */
byte stat = GET_STAT(); u8 stat = GET_STAT();
return ide_error(drive, "dma_timer_expiry", stat); return ide_error(drive, "dma_timer_expiry", stat);
} }
if (dma_stat & 1) /* DMAing */ if (dma_stat & 1) /* DMAing */
...@@ -526,7 +524,7 @@ static void ide_toggle_bounce(ide_drive_t *drive, int on) ...@@ -526,7 +524,7 @@ static void ide_toggle_bounce(ide_drive_t *drive, int on)
} }
/* /*
* 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 * 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 * sector address using CHS or LBA. All that remains is to prepare for DMA
...@@ -541,7 +539,7 @@ static void ide_toggle_bounce(ide_drive_t *drive, int on) ...@@ -541,7 +539,7 @@ static void ide_toggle_bounce(ide_drive_t *drive, int on)
* the caller should revert to PIO for the current request. * the caller should revert to PIO for the current request.
* May also be invoked from trm290.c * 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; struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base; unsigned long dma_base = hwif->dma_base;
...@@ -579,11 +577,9 @@ int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -579,11 +577,9 @@ int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
if (drive->type != ATA_DISK) if (drive->type != ATA_DISK)
return 0; return 0;
BUG_ON(HWGROUP(drive)->handler); ide_set_handler(drive, ide_dma_intr, WAIT_CMD, dma_timer_expiry); /* issue cmd to drive */
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)) {
if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_ACB) && struct ata_taskfile *args = rq->special;
(drive->addressing == 1)) {
struct ata_taskfile *args = HWGROUP(drive)->rq->special;
OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG); OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
} else if (drive->addressing) { } else if (drive->addressing) {
...@@ -591,7 +587,7 @@ int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -591,7 +587,7 @@ int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
} else { } else {
OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG); 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: case ide_dma_begin:
/* Note that this is done *after* the cmd has /* Note that this is done *after* the cmd has
* been issued to the drive, as per the BM-IDE spec. * been issued to the drive, as per the BM-IDE spec.
...@@ -685,7 +681,7 @@ void ide_setup_dma(struct ata_channel *hwif, unsigned long dma_base, unsigned in ...@@ -685,7 +681,7 @@ void ide_setup_dma(struct ata_channel *hwif, unsigned long dma_base, unsigned in
goto dma_alloc_failure; goto dma_alloc_failure;
} }
hwif->dmaproc = &ide_dmaproc; hwif->udma = ide_dmaproc;
if (hwif->chipset != ide_trm290) { if (hwif->chipset != ide_trm290) {
byte dma_stat = inb(dma_base+2); byte dma_stat = inb(dma_base+2);
......
...@@ -152,10 +152,9 @@ typedef struct idefloppy_packet_command_s { ...@@ -152,10 +152,9 @@ typedef struct idefloppy_packet_command_s {
int buffer_size; /* Size of our data buffer */ int buffer_size; /* Size of our data buffer */
char *b_data; /* Pointer which runs on the buffers */ char *b_data; /* Pointer which runs on the buffers */
int b_count; /* Missing/Available data on the current buffer */ int b_count; /* Missing/Available data on the current buffer */
struct request *rq; /* The corresponding request */
byte *buffer; /* Data buffer */ byte *buffer; /* Data buffer */
byte *current_position; /* Pointer into the above 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 */ byte pc_buffer[IDEFLOPPY_PC_BUFFER_SIZE]; /* Temporary buffer */
unsigned long flags; /* Status/Action bit flags: long for set_bit */ unsigned long flags; /* Status/Action bit flags: long for set_bit */
} idefloppy_pc_t; } idefloppy_pc_t;
...@@ -669,10 +668,9 @@ static void idefloppy_write_zeros (ide_drive_t *drive, unsigned int bcount) ...@@ -669,10 +668,9 @@ static void idefloppy_write_zeros (ide_drive_t *drive, unsigned int bcount)
* For read/write requests, we will call ide_end_request to pass to the * For read/write requests, we will call ide_end_request to pass to the
* next buffer. * 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; idefloppy_floppy_t *floppy = drive->driver_data;
struct request *rq = HWGROUP(drive)->rq;
int error; int error;
#if IDEFLOPPY_DEBUG_LOG #if IDEFLOPPY_DEBUG_LOG
...@@ -690,7 +688,7 @@ static int idefloppy_end_request(ide_drive_t *drive, int uptodate) ...@@ -690,7 +688,7 @@ static int idefloppy_end_request(ide_drive_t *drive, int uptodate)
if (!rq) if (!rq)
return 0; return 0;
if (!(rq->flags & IDEFLOPPY_RQ)) { if (!(rq->flags & IDEFLOPPY_RQ)) {
ide_end_request(drive, uptodate); ide_end_request(drive, rq, uptodate);
return 0; return 0;
} }
rq->errors = error; rq->errors = error;
...@@ -699,9 +697,9 @@ static int idefloppy_end_request(ide_drive_t *drive, int uptodate) ...@@ -699,9 +697,9 @@ static int idefloppy_end_request(ide_drive_t *drive, int uptodate)
return 0; 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; struct bio *bio = rq->bio;
int count; int count;
...@@ -709,12 +707,12 @@ static void idefloppy_input_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, uns ...@@ -709,12 +707,12 @@ static void idefloppy_input_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, uns
if (pc->b_count == bio->bi_size) { if (pc->b_count == bio->bi_size) {
rq->sector += rq->current_nr_sectors; rq->sector += rq->current_nr_sectors;
rq->nr_sectors -= 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) if ((bio = rq->bio) != NULL)
pc->b_count = 0; pc->b_count = 0;
} }
if (bio == NULL) { 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); idefloppy_discard_data (drive, bcount);
return; return;
} }
...@@ -724,17 +722,17 @@ static void idefloppy_input_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, uns ...@@ -724,17 +722,17 @@ static void idefloppy_input_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, uns
} }
} }
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; struct bio *bio = rq->bio;
int count; int count;
while (bcount) { while (bcount) {
if (!pc->b_count) { if (!pc->b_count) {
rq->sector += rq->current_nr_sectors; rq->sector += rq->current_nr_sectors;
rq->nr_sectors -= 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) { if ((bio = rq->bio) != NULL) {
pc->b_data = bio_data(bio); pc->b_data = bio_data(bio);
pc->b_count = bio->bi_size; pc->b_count = bio->bi_size;
...@@ -752,13 +750,13 @@ static void idefloppy_output_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, un ...@@ -752,13 +750,13 @@ static void idefloppy_output_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, un
} }
#ifdef CONFIG_BLK_DEV_IDEDMA #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; struct bio *bio = rq->bio;
while ((bio = rq->bio) != NULL) while ((bio = rq->bio) != NULL)
idefloppy_end_request(drive, 1); idefloppy_end_request(drive, rq, 1);
} }
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_BLK_DEV_IDEDMA */
...@@ -812,7 +810,7 @@ static void idefloppy_analyze_error (ide_drive_t *drive,idefloppy_request_sense_ ...@@ -812,7 +810,7 @@ static void idefloppy_analyze_error (ide_drive_t *drive,idefloppy_request_sense_
#endif /* IDEFLOPPY_DEBUG_LOG */ #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; idefloppy_floppy_t *floppy = drive->driver_data;
...@@ -821,25 +819,25 @@ static void idefloppy_request_sense_callback (ide_drive_t *drive) ...@@ -821,25 +819,25 @@ static void idefloppy_request_sense_callback (ide_drive_t *drive)
#endif /* IDEFLOPPY_DEBUG_LOG */ #endif /* IDEFLOPPY_DEBUG_LOG */
if (!floppy->pc->error) { if (!floppy->pc->error) {
idefloppy_analyze_error (drive,(idefloppy_request_sense_result_t *) floppy->pc->buffer); idefloppy_analyze_error (drive,(idefloppy_request_sense_result_t *) floppy->pc->buffer);
idefloppy_end_request(drive, 1); idefloppy_end_request(drive, rq, 1);
} else { } else {
printk (KERN_ERR "Error in REQUEST SENSE itself - Aborting request!\n"); 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. * 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; idefloppy_floppy_t *floppy = drive->driver_data;
#if IDEFLOPPY_DEBUG_LOG #if IDEFLOPPY_DEBUG_LOG
printk (KERN_INFO "ide-floppy: Reached idefloppy_pc_callback\n"); printk (KERN_INFO "ide-floppy: Reached idefloppy_pc_callback\n");
#endif /* IDEFLOPPY_DEBUG_LOG */ #endif /* IDEFLOPPY_DEBUG_LOG */
idefloppy_end_request(drive, floppy->pc->error ? 0:1); idefloppy_end_request(drive, rq, floppy->pc->error ? 0:1);
} }
/* /*
...@@ -854,7 +852,7 @@ static void idefloppy_init_pc (idefloppy_pc_t *pc) ...@@ -854,7 +852,7 @@ static void idefloppy_init_pc (idefloppy_pc_t *pc)
pc->buffer = pc->pc_buffer; pc->buffer = pc->pc_buffer;
pc->buffer_size = IDEFLOPPY_PC_BUFFER_SIZE; pc->buffer_size = IDEFLOPPY_PC_BUFFER_SIZE;
pc->b_data = NULL; 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) static void idefloppy_create_request_sense_cmd (idefloppy_pc_t *pc)
...@@ -888,33 +886,32 @@ static void idefloppy_retry_pc (ide_drive_t *drive) ...@@ -888,33 +886,32 @@ static void idefloppy_retry_pc (ide_drive_t *drive)
* idefloppy_pc_intr is the usual interrupt handler which will be called * idefloppy_pc_intr is the usual interrupt handler which will be called
* during a packet command. * 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_floppy_t *floppy = drive->driver_data;
idefloppy_status_reg_t status; idefloppy_status_reg_t status;
idefloppy_bcount_reg_t bcount; idefloppy_bcount_reg_t bcount;
idefloppy_ireason_reg_t ireason; idefloppy_ireason_reg_t ireason;
idefloppy_pc_t *pc=floppy->pc; idefloppy_pc_t *pc=floppy->pc;
struct request *rq = pc->rq;
unsigned int temp; unsigned int temp;
#if IDEFLOPPY_DEBUG_LOG #if IDEFLOPPY_DEBUG_LOG
printk (KERN_INFO "ide-floppy: Reached idefloppy_pc_intr interrupt handler\n"); printk (KERN_INFO "ide-floppy: Reached idefloppy_pc_intr interrupt handler\n");
#endif /* IDEFLOPPY_DEBUG_LOG */ #endif
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (test_bit (PC_DMA_IN_PROGRESS, &pc->flags)) { 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); set_bit (PC_DMA_ERROR, &pc->flags);
} else { } else {
pc->actually_transferred=pc->request_transfer; 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"); 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 */ status.all = GET_STAT(); /* Clear the interrupt */
...@@ -941,13 +938,13 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) ...@@ -941,13 +938,13 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
pc->error = 0; pc->error = 0;
if (floppy->failed_pc == pc) if (floppy->failed_pc == pc)
floppy->failed_pc=NULL; 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; return ide_stopped;
} }
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) { 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"); 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; return ide_stopped;
} }
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_BLK_DEV_IDEDMA */
...@@ -970,8 +967,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) ...@@ -970,8 +967,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
if (temp > pc->buffer_size) { if (temp > pc->buffer_size) {
printk (KERN_ERR "ide-floppy: The floppy wants to send us more data than expected - discarding data\n"); printk (KERN_ERR "ide-floppy: The floppy wants to send us more data than expected - discarding data\n");
idefloppy_discard_data (drive,bcount.all); 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; return ide_started;
} }
#if IDEFLOPPY_DEBUG_LOG #if IDEFLOPPY_DEBUG_LOG
...@@ -983,18 +979,17 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) ...@@ -983,18 +979,17 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
if (pc->buffer != NULL) if (pc->buffer != NULL)
atapi_write(drive,pc->current_position,bcount.all); /* Write the current buffer */ atapi_write(drive,pc->current_position,bcount.all); /* Write the current buffer */
else else
idefloppy_output_buffers (drive, pc, bcount.all); idefloppy_output_buffers(drive, rq, pc, bcount.all);
} else { } else {
if (pc->buffer != NULL) if (pc->buffer != NULL)
atapi_read(drive,pc->current_position,bcount.all); /* Read the current buffer */ atapi_read(drive,pc->current_position,bcount.all); /* Read the current buffer */
else 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->actually_transferred+=bcount.all; /* Update the current position */
pc->current_position+=bcount.all; 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; return ide_started;
} }
...@@ -1004,7 +999,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) ...@@ -1004,7 +999,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
* It fails at high speeds on the Iomega ZIP drive, so there's a slower version * 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 * 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; ide_startstop_t startstop;
idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_floppy_t *floppy = drive->driver_data;
...@@ -1020,8 +1015,7 @@ static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive) ...@@ -1020,8 +1015,7 @@ static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive)
return ide_stopped; 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 */ atapi_write(drive, floppy->pc->c, 12); /* Send the actual packet */
return ide_started; return ide_started;
...@@ -1040,7 +1034,7 @@ static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive) ...@@ -1040,7 +1034,7 @@ static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive)
* packet, we schedule the packet transfer to occur about 2-3 ticks * packet, we schedule the packet transfer to occur about 2-3 ticks
* later in transfer_pc2. * 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; idefloppy_floppy_t *floppy = drive->driver_data;
...@@ -1048,7 +1042,7 @@ static int idefloppy_transfer_pc2 (ide_drive_t *drive) ...@@ -1048,7 +1042,7 @@ static int idefloppy_transfer_pc2 (ide_drive_t *drive)
return IDEFLOPPY_WAIT_CMD; /* Timeout for the packet command */ 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; idefloppy_floppy_t *floppy = drive->driver_data;
ide_startstop_t startstop; ide_startstop_t startstop;
...@@ -1070,11 +1064,10 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive) ...@@ -1070,11 +1064,10 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive)
* 25msec is too short, 40 and 50msec work well. idefloppy_pc_intr will * 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. * not be actually used until after the packet is moved in about 50 msec.
*/ */
BUG_ON(HWGROUP(drive)->handler); ide_set_handler(drive,
ide_set_handler (drive, idefloppy_pc_intr, /* service routine for packet command */
&idefloppy_pc_intr, /* service routine for packet command */
floppy->ticks, /* wait this long before "failing" */ floppy->ticks, /* wait this long before "failing" */
&idefloppy_transfer_pc2); /* fail == transfer_pc2 */ idefloppy_transfer_pc2); /* fail == transfer_pc2 */
return ide_started; return ide_started;
} }
...@@ -1082,12 +1075,12 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive) ...@@ -1082,12 +1075,12 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive)
/* /*
* Issue a packet command * 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_floppy_t *floppy = drive->driver_data;
idefloppy_bcount_reg_t bcount; idefloppy_bcount_reg_t bcount;
int dma_ok = 0; int dma_ok = 0;
ide_handler_t *pkt_xfer_routine; ata_handler_t *pkt_xfer_routine;
#if IDEFLOPPY_DEBUG_BUGS #if IDEFLOPPY_DEBUG_BUGS
if (floppy->pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD && pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD) { if (floppy->pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD && pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD) {
...@@ -1113,7 +1106,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p ...@@ -1113,7 +1106,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
pc->error = IDEFLOPPY_ERROR_GENERAL; /* Giving up */ pc->error = IDEFLOPPY_ERROR_GENERAL; /* Giving up */
} }
floppy->failed_pc=NULL; floppy->failed_pc=NULL;
pc->callback(drive); pc->callback(drive, rq);
return ide_stopped; return ide_stopped;
} }
#if IDEFLOPPY_DEBUG_LOG #if IDEFLOPPY_DEBUG_LOG
...@@ -1127,10 +1120,10 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p ...@@ -1127,10 +1120,10 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags)) { 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) 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 */ #endif /* CONFIG_BLK_DEV_IDEDMA */
if (IDE_CONTROL_REG) if (IDE_CONTROL_REG)
...@@ -1143,7 +1136,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p ...@@ -1143,7 +1136,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (dma_ok) { /* Begin DMA, if necessary */ if (dma_ok) { /* Begin DMA, if necessary */
set_bit (PC_DMA_IN_PROGRESS, &pc->flags); 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 */ #endif /* CONFIG_BLK_DEV_IDEDMA */
...@@ -1155,23 +1148,22 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p ...@@ -1155,23 +1148,22 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
} }
if (test_bit (IDEFLOPPY_DRQ_INTERRUPT, &floppy->flags)) { 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 */ OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* Issue the packet command */
return ide_started; return ide_started;
} else { } else {
OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); 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 #if IDEFLOPPY_DEBUG_LOG
printk (KERN_INFO "ide-floppy: Reached idefloppy_rw_callback\n"); printk (KERN_INFO "ide-floppy: Reached idefloppy_rw_callback\n");
#endif /* IDEFLOPPY_DEBUG_LOG */ #endif /* IDEFLOPPY_DEBUG_LOG */
idefloppy_end_request(drive, 1); idefloppy_end_request(drive, rq, 1);
return; return;
} }
...@@ -1266,7 +1258,7 @@ static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, idefloppy_pc_t * ...@@ -1266,7 +1258,7 @@ static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, idefloppy_pc_t *
2 * test_bit (IDEFLOPPY_USE_READ12, &floppy->flags), block, blocks); 2 * test_bit (IDEFLOPPY_USE_READ12, &floppy->flags), block, blocks);
#endif /* IDEFLOPPY_DEBUG_LOG */ #endif /* IDEFLOPPY_DEBUG_LOG */
idefloppy_init_pc (pc); idefloppy_init_pc(pc);
if (test_bit (IDEFLOPPY_USE_READ12, &floppy->flags)) { if (test_bit (IDEFLOPPY_USE_READ12, &floppy->flags)) {
pc->c[0] = cmd == READ ? IDEFLOPPY_READ12_CMD : IDEFLOPPY_WRITE12_CMD; pc->c[0] = cmd == READ ? IDEFLOPPY_READ12_CMD : IDEFLOPPY_WRITE12_CMD;
put_unaligned (htonl (blocks), (unsigned int *) &pc->c[6]); put_unaligned (htonl (blocks), (unsigned int *) &pc->c[6]);
...@@ -1275,8 +1267,7 @@ static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, idefloppy_pc_t * ...@@ -1275,8 +1267,7 @@ static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, idefloppy_pc_t *
put_unaligned (htons (blocks), (unsigned short *) &pc->c[7]); put_unaligned (htons (blocks), (unsigned short *) &pc->c[7]);
} }
put_unaligned (htonl (block), (unsigned int *) &pc->c[2]); put_unaligned (htonl (block), (unsigned int *) &pc->c[2]);
pc->callback = &idefloppy_rw_callback; pc->callback = idefloppy_rw_callback;
pc->rq = rq;
pc->b_data = rq->buffer; pc->b_data = rq->buffer;
pc->b_count = cmd == READ ? 0 : rq->bio->bi_size; pc->b_count = cmd == READ ? 0 : rq->bio->bi_size;
if (rq->flags & REQ_RW) if (rq->flags & REQ_RW)
...@@ -1305,13 +1296,13 @@ static ide_startstop_t idefloppy_do_request(struct ata_device *drive, struct req ...@@ -1305,13 +1296,13 @@ static ide_startstop_t idefloppy_do_request(struct ata_device *drive, struct req
drive->name, floppy->failed_pc->c[0], floppy->sense_key, floppy->asc, floppy->ascq); drive->name, floppy->failed_pc->c[0], floppy->sense_key, floppy->asc, floppy->ascq);
else else
printk (KERN_ERR "ide-floppy: %s: I/O error\n", drive->name); 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; return ide_stopped;
} }
if (rq->flags & REQ_CMD) { if (rq->flags & REQ_CMD) {
if (rq->sector % floppy->bs_factor || rq->nr_sectors % floppy->bs_factor) { if (rq->sector % floppy->bs_factor || rq->nr_sectors % floppy->bs_factor) {
printk ("%s: unsupported r/w request size\n", drive->name); printk ("%s: unsupported r/w request size\n", drive->name);
idefloppy_end_request(drive, 0); idefloppy_end_request(drive, rq, 0);
return ide_stopped; return ide_stopped;
} }
pc = idefloppy_next_pc_storage(drive); pc = idefloppy_next_pc_storage(drive);
...@@ -1320,11 +1311,11 @@ static ide_startstop_t idefloppy_do_request(struct ata_device *drive, struct req ...@@ -1320,11 +1311,11 @@ static ide_startstop_t idefloppy_do_request(struct ata_device *drive, struct req
pc = (idefloppy_pc_t *) rq->buffer; pc = (idefloppy_pc_t *) rq->buffer;
} else { } else {
blk_dump_rq_flags(rq, "ide-floppy: unsupported command in queue"); 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; return ide_stopped;
} }
pc->rq = rq;
return idefloppy_issue_pc (drive, pc); return idefloppy_issue_pc(drive, rq, pc);
} }
/* /*
......
...@@ -1384,8 +1384,7 @@ int pmac_ide_dmaproc(ide_dma_action_t func, ide_drive_t *drive) ...@@ -1384,8 +1384,7 @@ int pmac_ide_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
drive->waiting_for_dma = 1; drive->waiting_for_dma = 1;
if (drive->type != ATA_DISK) if (drive->type != ATA_DISK)
return 0; 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) && if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_ACB) &&
(drive->addressing == 1)) { (drive->addressing == 1)) {
struct ata_taskfile *args = HWGROUP(drive)->rq->special; struct ata_taskfile *args = HWGROUP(drive)->rq->special;
......
...@@ -726,7 +726,8 @@ typedef struct idetape_packet_command_s { ...@@ -726,7 +726,8 @@ typedef struct idetape_packet_command_s {
int b_count; int b_count;
byte *buffer; /* Data buffer */ byte *buffer; /* Data buffer */
byte *current_position; /* Pointer into the above 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 */ byte pc_buffer[IDETAPE_PC_BUFFER_SIZE]; /* Temporary buffer */
unsigned long flags; /* Status/Action bit flags: long for set_bit */ unsigned long flags; /* Status/Action bit flags: long for set_bit */
} idetape_pc_t; } idetape_pc_t;
...@@ -1835,9 +1836,8 @@ static void idetape_remove_stage_head (ide_drive_t *drive) ...@@ -1835,9 +1836,8 @@ static void idetape_remove_stage_head (ide_drive_t *drive)
* idetape_end_request is used to finish servicing a request, and to * idetape_end_request is used to finish servicing a request, and to
* insert a pending pipeline request into the main device queue. * 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; idetape_tape_t *tape = drive->driver_data;
unsigned long flags; unsigned long flags;
int error; int error;
...@@ -1935,7 +1935,7 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate) ...@@ -1935,7 +1935,7 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate)
return 0; 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; idetape_tape_t *tape = drive->driver_data;
...@@ -1945,17 +1945,17 @@ static ide_startstop_t idetape_request_sense_callback (ide_drive_t *drive) ...@@ -1945,17 +1945,17 @@ static ide_startstop_t idetape_request_sense_callback (ide_drive_t *drive)
#endif /* IDETAPE_DEBUG_LOG */ #endif /* IDETAPE_DEBUG_LOG */
if (!tape->pc->error) { if (!tape->pc->error) {
idetape_analyze_error (drive, (idetape_request_sense_result_t *) tape->pc->buffer); idetape_analyze_error (drive, (idetape_request_sense_result_t *) tape->pc->buffer);
idetape_end_request(drive, 1); idetape_end_request(drive, rq, 1);
} else { } else {
printk (KERN_ERR "ide-tape: Error in REQUEST SENSE itself - Aborting request!\n"); 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; return ide_stopped;
} }
static void idetape_create_request_sense_cmd (idetape_pc_t *pc) 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[0] = IDETAPE_REQUEST_SENSE_CMD;
pc->c[4] = 20; pc->c[4] = 20;
pc->request_transfer = 18; pc->request_transfer = 18;
...@@ -2015,7 +2015,7 @@ static ide_startstop_t idetape_retry_pc (ide_drive_t *drive) ...@@ -2015,7 +2015,7 @@ static ide_startstop_t idetape_retry_pc (ide_drive_t *drive)
* ide.c will be able to service requests from another device on * ide.c will be able to service requests from another device on
* the same interface while we are polling for DSC. * 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; idetape_tape_t *tape = drive->driver_data;
...@@ -2023,7 +2023,7 @@ static void idetape_postpone_request (ide_drive_t *drive) ...@@ -2023,7 +2023,7 @@ static void idetape_postpone_request (ide_drive_t *drive)
if (tape->debug_level >= 4) if (tape->debug_level >= 4)
printk(KERN_INFO "ide-tape: idetape_postpone_request\n"); printk(KERN_INFO "ide-tape: idetape_postpone_request\n");
#endif #endif
tape->postponed_rq = HWGROUP(drive)->rq; tape->postponed_rq = rq;
ide_stall_queue(drive, tape->dsc_polling_frequency); ide_stall_queue(drive, tape->dsc_polling_frequency);
} }
...@@ -2035,7 +2035,7 @@ static void idetape_postpone_request (ide_drive_t *drive) ...@@ -2035,7 +2035,7 @@ static void idetape_postpone_request (ide_drive_t *drive)
* algorithm described before idetape_issue_packet_command. * 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_tape_t *tape = drive->driver_data;
idetape_status_reg_t status; idetape_status_reg_t status;
...@@ -2058,7 +2058,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) ...@@ -2058,7 +2058,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (test_bit (PC_DMA_IN_PROGRESS, &pc->flags)) { 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, * A DMA error is sometimes expected. For example,
* if the tape is crossing a filemark during a * if the tape is crossing a filemark during a
...@@ -2121,18 +2121,18 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) ...@@ -2121,18 +2121,18 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
tape->dsc_polling_start = jiffies; tape->dsc_polling_start = jiffies;
tape->dsc_polling_frequency = IDETAPE_DSC_MA_FAST; tape->dsc_polling_frequency = IDETAPE_DSC_MA_FAST;
tape->dsc_timeout = jiffies + IDETAPE_DSC_MA_TIMEOUT; 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; return ide_stopped;
} }
if (tape->failed_pc == pc) if (tape->failed_pc == pc)
tape->failed_pc = NULL; 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 #ifdef CONFIG_BLK_DEV_IDEDMA
if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) { 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: The tape wants to issue more interrupts in DMA mode\n");
printk (KERN_ERR "ide-tape: DMA disabled, reverting to PIO\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; return ide_stopped;
} }
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_BLK_DEV_IDEDMA */
...@@ -2155,8 +2155,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) ...@@ -2155,8 +2155,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
if (temp > pc->buffer_size) { if (temp > pc->buffer_size) {
printk (KERN_ERR "ide-tape: The tape wants to send us more data than expected - discarding data\n"); printk (KERN_ERR "ide-tape: The tape wants to send us more data than expected - discarding data\n");
idetape_discard_data (drive, bcount.all); 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; return ide_started;
} }
#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
...@@ -2182,8 +2181,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) ...@@ -2182,8 +2181,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
if (tape->debug_level >= 2) if (tape->debug_level >= 2)
printk(KERN_INFO "ide-tape: [cmd %x] transferred %d bytes on that interrupt\n", pc->c[0], bcount.all); printk(KERN_INFO "ide-tape: [cmd %x] transferred %d bytes on that interrupt\n", pc->c[0], bcount.all);
#endif #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; return ide_started;
} }
...@@ -2229,7 +2227,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) ...@@ -2229,7 +2227,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
* we will handle the next request. * 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_tape_t *tape = drive->driver_data;
idetape_pc_t *pc = tape->pc; idetape_pc_t *pc = tape->pc;
...@@ -2257,13 +2255,12 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive) ...@@ -2257,13 +2255,12 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
return ide_stopped; return ide_stopped;
} }
tape->cmd_start_time = jiffies; 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 */ atapi_write(drive,pc->c,12); /* Send the actual packet */
return ide_started; 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_tape_t *tape = drive->driver_data;
idetape_bcount_reg_t bcount; idetape_bcount_reg_t bcount;
...@@ -2297,7 +2294,7 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape ...@@ -2297,7 +2294,7 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape
pc->error = IDETAPE_ERROR_GENERAL; /* Giving up */ pc->error = IDETAPE_ERROR_GENERAL; /* Giving up */
} }
tape->failed_pc = NULL; tape->failed_pc = NULL;
return pc->callback(drive); return pc->callback(drive, rq);
} }
#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 2) if (tape->debug_level >= 2)
...@@ -2312,10 +2309,10 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape ...@@ -2312,10 +2309,10 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags)) { if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags)) {
printk (KERN_WARNING "ide-tape: DMA disabled, reverting to PIO\n"); 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) 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 */ #endif /* CONFIG_BLK_DEV_IDEDMA */
if (IDE_CONTROL_REG) if (IDE_CONTROL_REG)
...@@ -2327,24 +2324,23 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape ...@@ -2327,24 +2324,23 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (dma_ok) { /* Begin DMA, if necessary */ if (dma_ok) { /* Begin DMA, if necessary */
set_bit (PC_DMA_IN_PROGRESS, &pc->flags); 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 */ #endif /* CONFIG_BLK_DEV_IDEDMA */
if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) { 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); OUT_BYTE(WIN_PACKETCMD, IDE_COMMAND_REG);
return ide_started; return ide_started;
} else { } else {
OUT_BYTE(WIN_PACKETCMD, IDE_COMMAND_REG); OUT_BYTE(WIN_PACKETCMD, IDE_COMMAND_REG);
return idetape_transfer_pc(drive); return idetape_transfer_pc(drive, rq);
} }
} }
/* /*
* General packet command callback function. * 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; idetape_tape_t *tape = drive->driver_data;
...@@ -2353,7 +2349,7 @@ static ide_startstop_t idetape_pc_callback (ide_drive_t *drive) ...@@ -2353,7 +2349,7 @@ static ide_startstop_t idetape_pc_callback (ide_drive_t *drive)
printk (KERN_INFO "ide-tape: Reached idetape_pc_callback\n"); printk (KERN_INFO "ide-tape: Reached idetape_pc_callback\n");
#endif /* IDETAPE_DEBUG_LOG */ #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; return ide_stopped;
} }
...@@ -2375,10 +2371,10 @@ static void idetape_create_mode_sense_cmd (idetape_pc_t *pc, byte page_code) ...@@ -2375,10 +2371,10 @@ static void idetape_create_mode_sense_cmd (idetape_pc_t *pc, byte page_code)
pc->request_transfer = 24; pc->request_transfer = 24;
else else
pc->request_transfer = 50; 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; idetape_tape_t *tape = drive->driver_data;
...@@ -2402,7 +2398,7 @@ static ide_startstop_t idetape_onstream_buffer_fill_callback (ide_drive_t *drive ...@@ -2402,7 +2398,7 @@ static ide_startstop_t idetape_onstream_buffer_fill_callback (ide_drive_t *drive
if (tape->debug_level >= 1) if (tape->debug_level >= 1)
printk(KERN_INFO "ide-tape: buffer fill callback, %d/%d\n", tape->cur_frames, tape->max_frames); printk(KERN_INFO "ide-tape: buffer fill callback, %d/%d\n", tape->cur_frames, tape->max_frames);
#endif #endif
idetape_end_request(drive, tape->pc->error ? 0 : 1); idetape_end_request(drive, rq, tape->pc->error ? 0 : 1);
return ide_stopped; return ide_stopped;
} }
...@@ -2466,7 +2462,7 @@ static void calculate_speeds(ide_drive_t *drive) ...@@ -2466,7 +2462,7 @@ static void calculate_speeds(ide_drive_t *drive)
tape->max_insert_speed = max(tape->max_insert_speed, 500); 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_tape_t *tape = drive->driver_data;
idetape_pc_t *pc = tape->pc; idetape_pc_t *pc = tape->pc;
...@@ -2487,13 +2483,12 @@ static ide_startstop_t idetape_media_access_finished (ide_drive_t *drive) ...@@ -2487,13 +2483,12 @@ static ide_startstop_t idetape_media_access_finished (ide_drive_t *drive)
pc->error = IDETAPE_ERROR_GENERAL; pc->error = IDETAPE_ERROR_GENERAL;
tape->failed_pc = NULL; 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; idetape_tape_t *tape = drive->driver_data;
struct request *rq = HWGROUP(drive)->rq;
int blocks = tape->pc->actually_transferred / tape->tape_block_size; int blocks = tape->pc->actually_transferred / tape->tape_block_size;
tape->avg_size += blocks * tape->tape_block_size; tape->avg_size += blocks * tape->tape_block_size;
...@@ -2522,9 +2517,9 @@ static ide_startstop_t idetape_rw_callback (ide_drive_t *drive) ...@@ -2522,9 +2517,9 @@ static ide_startstop_t idetape_rw_callback (ide_drive_t *drive)
rq->current_nr_sectors -= blocks; rq->current_nr_sectors -= blocks;
if (!tape->pc->error) if (!tape->pc->error)
idetape_end_request(drive, 1); idetape_end_request(drive, rq, 1);
else else
idetape_end_request(drive, tape->pc->error); idetape_end_request(drive, rq, tape->pc->error);
return ide_stopped; return ide_stopped;
} }
...@@ -2536,7 +2531,7 @@ static void idetape_create_read_cmd (idetape_tape_t *tape, idetape_pc_t *pc, uns ...@@ -2536,7 +2531,7 @@ static void idetape_create_read_cmd (idetape_tape_t *tape, idetape_pc_t *pc, uns
pc->c[0] = IDETAPE_READ_CMD; pc->c[0] = IDETAPE_READ_CMD;
put_unaligned (htonl (length), (unsigned int *) &pc->c[1]); put_unaligned (htonl (length), (unsigned int *) &pc->c[1]);
pc->c[1] = 1; pc->c[1] = 1;
pc->callback = &idetape_rw_callback; pc->callback = idetape_rw_callback;
pc->bio = bio; pc->bio = bio;
bv->bv_len = 0; bv->bv_len = 0;
pc->buffer = NULL; pc->buffer = NULL;
...@@ -2569,7 +2564,7 @@ static void idetape_create_read_buffer_cmd(idetape_tape_t *tape, idetape_pc_t *p ...@@ -2569,7 +2564,7 @@ static void idetape_create_read_buffer_cmd(idetape_tape_t *tape, idetape_pc_t *p
pc->c[1] = IDETAPE_RETRIEVE_FAULTY_BLOCK; pc->c[1] = IDETAPE_RETRIEVE_FAULTY_BLOCK;
pc->c[7] = size >> 8; pc->c[7] = size >> 8;
pc->c[8] = size & 0xff; pc->c[8] = size & 0xff;
pc->callback = &idetape_pc_callback; pc->callback = idetape_pc_callback;
pc->bio = bio; pc->bio = bio;
atomic_set(&bio->bi_cnt, 0); atomic_set(&bio->bi_cnt, 0);
pc->buffer = NULL; pc->buffer = NULL;
...@@ -2588,7 +2583,7 @@ static void idetape_create_write_cmd (idetape_tape_t *tape, idetape_pc_t *pc, un ...@@ -2588,7 +2583,7 @@ static void idetape_create_write_cmd (idetape_tape_t *tape, idetape_pc_t *pc, un
pc->c[0] = IDETAPE_WRITE_CMD; pc->c[0] = IDETAPE_WRITE_CMD;
put_unaligned (htonl (length), (unsigned int *) &pc->c[1]); put_unaligned (htonl (length), (unsigned int *) &pc->c[1]);
pc->c[1] = 1; pc->c[1] = 1;
pc->callback = &idetape_rw_callback; pc->callback = idetape_rw_callback;
set_bit (PC_WRITING, &pc->flags); set_bit (PC_WRITING, &pc->flags);
if (tape->onstream) { if (tape->onstream) {
while (p) { while (p) {
...@@ -2635,7 +2630,7 @@ static ide_startstop_t idetape_do_request(struct ata_device *drive, struct reque ...@@ -2635,7 +2630,7 @@ static ide_startstop_t idetape_do_request(struct ata_device *drive, struct reque
* We do not support buffer cache originated requests. * 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); 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; return ide_stopped;
} }
...@@ -2643,13 +2638,13 @@ static ide_startstop_t idetape_do_request(struct ata_device *drive, struct reque ...@@ -2643,13 +2638,13 @@ static ide_startstop_t idetape_do_request(struct ata_device *drive, struct reque
* Retry a failed packet command * Retry a failed packet command
*/ */
if (tape->failed_pc != NULL && tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) { 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 IDETAPE_DEBUG_BUGS
if (postponed_rq != NULL) if (postponed_rq != NULL)
if (rq != postponed_rq) { if (rq != postponed_rq) {
printk (KERN_ERR "ide-tape: ide-tape.c bug - Two DSC requests were queued\n"); 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; return ide_stopped;
} }
#endif /* IDETAPE_DEBUG_BUGS */ #endif /* IDETAPE_DEBUG_BUGS */
...@@ -2726,14 +2721,14 @@ static ide_startstop_t idetape_do_request(struct ata_device *drive, struct reque ...@@ -2726,14 +2721,14 @@ static ide_startstop_t idetape_do_request(struct ata_device *drive, struct reque
} else if ((signed long) (jiffies - tape->dsc_timeout) > 0) { } else if ((signed long) (jiffies - tape->dsc_timeout) > 0) {
printk (KERN_ERR "ide-tape: %s: DSC timeout\n", tape->name); printk (KERN_ERR "ide-tape: %s: DSC timeout\n", tape->name);
if (rq->flags == IDETAPE_PC_RQ2) { if (rq->flags == IDETAPE_PC_RQ2) {
idetape_media_access_finished (drive); idetape_media_access_finished(drive, rq);
return ide_stopped; return ide_stopped;
} else { } else {
return ide_stopped; return ide_stopped;
} }
} else if (jiffies - tape->dsc_polling_start > IDETAPE_DSC_MA_THRESHOLD) } else if (jiffies - tape->dsc_polling_start > IDETAPE_DSC_MA_THRESHOLD)
tape->dsc_polling_frequency = IDETAPE_DSC_MA_SLOW; tape->dsc_polling_frequency = IDETAPE_DSC_MA_SLOW;
idetape_postpone_request (drive); idetape_postpone_request(drive, rq);
return ide_stopped; return ide_stopped;
} }
switch (rq->flags) { switch (rq->flags) {
...@@ -2777,7 +2772,7 @@ static ide_startstop_t idetape_do_request(struct ata_device *drive, struct reque ...@@ -2777,7 +2772,7 @@ static ide_startstop_t idetape_do_request(struct ata_device *drive, struct reque
break; break;
case IDETAPE_ABORTED_WRITE_RQ: case IDETAPE_ABORTED_WRITE_RQ:
rq->flags = IDETAPE_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; return ide_stopped;
case IDETAPE_ABORTED_READ_RQ: case IDETAPE_ABORTED_READ_RQ:
#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
...@@ -2785,21 +2780,21 @@ static ide_startstop_t idetape_do_request(struct ata_device *drive, struct reque ...@@ -2785,21 +2780,21 @@ static ide_startstop_t idetape_do_request(struct ata_device *drive, struct reque
printk(KERN_INFO "ide-tape: %s: detected aborted read rq\n", tape->name); printk(KERN_INFO "ide-tape: %s: detected aborted read rq\n", tape->name);
#endif #endif
rq->flags = IDETAPE_READ_RQ; rq->flags = IDETAPE_READ_RQ;
idetape_end_request(drive, IDETAPE_ERROR_EOD); idetape_end_request(drive, rq, IDETAPE_ERROR_EOD);
return ide_stopped; return ide_stopped;
case IDETAPE_PC_RQ1: case IDETAPE_PC_RQ1:
pc = (idetape_pc_t *) rq->buffer; pc = (idetape_pc_t *) rq->buffer;
rq->flags = IDETAPE_PC_RQ2; rq->flags = IDETAPE_PC_RQ2;
break; break;
case IDETAPE_PC_RQ2: case IDETAPE_PC_RQ2:
idetape_media_access_finished (drive); idetape_media_access_finished(drive, rq);
return ide_stopped; return ide_stopped;
default: default:
printk (KERN_ERR "ide-tape: bug in IDETAPE_RQ_CMD macro\n"); 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 ide_stopped;
} }
return idetape_issue_packet_command (drive, pc); return idetape_issue_packet_command(drive, rq, pc);
} }
/* /*
...@@ -3102,7 +3097,7 @@ static void idetape_wait_for_request (ide_drive_t *drive, struct request *rq) ...@@ -3102,7 +3097,7 @@ static void idetape_wait_for_request (ide_drive_t *drive, struct request *rq)
spin_lock_irq(&tape->spinlock); 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_tape_t *tape = drive->driver_data;
idetape_read_position_result_t *result; idetape_read_position_result_t *result;
...@@ -3123,7 +3118,7 @@ static ide_startstop_t idetape_read_position_callback (ide_drive_t *drive) ...@@ -3123,7 +3118,7 @@ static ide_startstop_t idetape_read_position_callback (ide_drive_t *drive)
if (result->bpu) { if (result->bpu) {
printk (KERN_INFO "ide-tape: Block location is unknown to the tape\n"); printk (KERN_INFO "ide-tape: Block location is unknown to the tape\n");
clear_bit (IDETAPE_ADDRESS_VALID, &tape->flags); clear_bit (IDETAPE_ADDRESS_VALID, &tape->flags);
idetape_end_request(drive, 0); idetape_end_request(drive, rq, 0);
} else { } else {
#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 2) if (tape->debug_level >= 2)
...@@ -3134,10 +3129,10 @@ static ide_startstop_t idetape_read_position_callback (ide_drive_t *drive) ...@@ -3134,10 +3129,10 @@ static ide_startstop_t idetape_read_position_callback (ide_drive_t *drive)
tape->last_frame_position = ntohl (result->last_block); tape->last_frame_position = ntohl (result->last_block);
tape->blocks_in_buffer = result->blocks_in_buffer[2]; tape->blocks_in_buffer = result->blocks_in_buffer[2];
set_bit (IDETAPE_ADDRESS_VALID, &tape->flags); set_bit (IDETAPE_ADDRESS_VALID, &tape->flags);
idetape_end_request(drive, 1); idetape_end_request(drive, rq, 1);
} }
} else { } else {
idetape_end_request(drive, 0); idetape_end_request(drive, rq, 0);
} }
return ide_stopped; return ide_stopped;
} }
...@@ -3160,14 +3155,14 @@ static void idetape_create_write_filemark_cmd (ide_drive_t *drive, idetape_pc_t ...@@ -3160,14 +3155,14 @@ static void idetape_create_write_filemark_cmd (ide_drive_t *drive, idetape_pc_t
pc->c[1] = 1; /* Immed bit */ pc->c[1] = 1; /* Immed bit */
pc->c[4] = write_filemark; /* not used for OnStream ?? */ pc->c[4] = write_filemark; /* not used for OnStream ?? */
set_bit (PC_WAIT_FOR_DSC, &pc->flags); 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) static void idetape_create_test_unit_ready_cmd(idetape_pc_t *pc)
{ {
idetape_init_pc(pc); idetape_init_pc(pc);
pc->c[0] = IDETAPE_TEST_UNIT_READY_CMD; pc->c[0] = IDETAPE_TEST_UNIT_READY_CMD;
pc->callback = &idetape_pc_callback; pc->callback = idetape_pc_callback;
} }
/* /*
...@@ -3213,7 +3208,7 @@ static void idetape_create_load_unload_cmd (ide_drive_t *drive, idetape_pc_t *pc ...@@ -3213,7 +3208,7 @@ static void idetape_create_load_unload_cmd (ide_drive_t *drive, idetape_pc_t *pc
pc->c[4] = 4; pc->c[4] = 4;
} }
set_bit (PC_WAIT_FOR_DSC, &pc->flags); 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) static int idetape_wait_ready (ide_drive_t *drive, unsigned long long timeout)
...@@ -3275,7 +3270,7 @@ static void idetape_create_read_position_cmd (idetape_pc_t *pc) ...@@ -3275,7 +3270,7 @@ static void idetape_create_read_position_cmd (idetape_pc_t *pc)
idetape_init_pc (pc); idetape_init_pc (pc);
pc->c[0] = IDETAPE_READ_POSITION_CMD; pc->c[0] = IDETAPE_READ_POSITION_CMD;
pc->request_transfer = 20; 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) static int idetape_read_position (ide_drive_t *drive)
...@@ -3331,7 +3326,7 @@ static void idetape_create_locate_cmd (ide_drive_t *drive, idetape_pc_t *pc, uns ...@@ -3331,7 +3326,7 @@ static void idetape_create_locate_cmd (ide_drive_t *drive, idetape_pc_t *pc, uns
*/ */
pc->c[9] = skip << 7; pc->c[9] = skip << 7;
set_bit (PC_WAIT_FOR_DSC, &pc->flags); 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) static int idetape_create_prevent_cmd (ide_drive_t *drive, idetape_pc_t *pc, int prevent)
...@@ -3344,7 +3339,7 @@ static int idetape_create_prevent_cmd (ide_drive_t *drive, idetape_pc_t *pc, int ...@@ -3344,7 +3339,7 @@ static int idetape_create_prevent_cmd (ide_drive_t *drive, idetape_pc_t *pc, int
idetape_init_pc(pc); idetape_init_pc(pc);
pc->c[0] = IDETAPE_PREVENT_CMD; pc->c[0] = IDETAPE_PREVENT_CMD;
pc->c[4] = prevent; pc->c[4] = prevent;
pc->callback = &idetape_pc_callback; pc->callback = idetape_pc_callback;
return 1; return 1;
} }
...@@ -3603,7 +3598,7 @@ static void idetape_create_inquiry_cmd (idetape_pc_t *pc) ...@@ -3603,7 +3598,7 @@ static void idetape_create_inquiry_cmd (idetape_pc_t *pc)
idetape_init_pc(pc); idetape_init_pc(pc);
pc->c[0] = IDETAPE_INQUIRY_CMD; pc->c[0] = IDETAPE_INQUIRY_CMD;
pc->c[4] = pc->request_transfer = 254; 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) static void idetape_create_rewind_cmd (ide_drive_t *drive, idetape_pc_t *pc)
...@@ -3615,7 +3610,7 @@ static void idetape_create_rewind_cmd (ide_drive_t *drive, idetape_pc_t *pc) ...@@ -3615,7 +3610,7 @@ static void idetape_create_rewind_cmd (ide_drive_t *drive, idetape_pc_t *pc)
if (tape->onstream) if (tape->onstream)
pc->c[1] = 1; pc->c[1] = 1;
set_bit (PC_WAIT_FOR_DSC, &pc->flags); 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) static void idetape_create_mode_select_cmd (idetape_pc_t *pc, int length)
...@@ -3626,7 +3621,7 @@ static void idetape_create_mode_select_cmd (idetape_pc_t *pc, int length) ...@@ -3626,7 +3621,7 @@ static void idetape_create_mode_select_cmd (idetape_pc_t *pc, int length)
pc->c[1] = 0x10; pc->c[1] = 0x10;
put_unaligned (htons(length), (unsigned short *) &pc->c[3]); put_unaligned (htons(length), (unsigned short *) &pc->c[3]);
pc->request_transfer = 255; pc->request_transfer = 255;
pc->callback = &idetape_pc_callback; pc->callback = idetape_pc_callback;
} }
static void idetape_create_erase_cmd (idetape_pc_t *pc) static void idetape_create_erase_cmd (idetape_pc_t *pc)
...@@ -3635,7 +3630,7 @@ static void idetape_create_erase_cmd (idetape_pc_t *pc) ...@@ -3635,7 +3630,7 @@ static void idetape_create_erase_cmd (idetape_pc_t *pc)
pc->c[0] = IDETAPE_ERASE_CMD; pc->c[0] = IDETAPE_ERASE_CMD;
pc->c[1] = 1; pc->c[1] = 1;
set_bit (PC_WAIT_FOR_DSC, &pc->flags); 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) static void idetape_create_space_cmd (idetape_pc_t *pc,int count,byte cmd)
......
...@@ -260,7 +260,7 @@ int drive_is_ready(ide_drive_t *drive) ...@@ -260,7 +260,7 @@ int drive_is_ready(ide_drive_t *drive)
{ {
byte stat = 0; byte stat = 0;
if (drive->waiting_for_dma) 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 #if 0
/* need to guarantee 400ns since last command was issued */ /* need to guarantee 400ns since last command was issued */
udelay(1); udelay(1);
...@@ -294,7 +294,6 @@ void ata_poll_drive_ready(ide_drive_t *drive) ...@@ -294,7 +294,6 @@ void ata_poll_drive_ready(ide_drive_t *drive)
{ {
int i; int i;
if (drive_is_ready(drive)) if (drive_is_ready(drive))
return; return;
...@@ -306,30 +305,24 @@ void ata_poll_drive_ready(ide_drive_t *drive) ...@@ -306,30 +305,24 @@ void ata_poll_drive_ready(ide_drive_t *drive)
} }
} }
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; struct ata_taskfile *args = rq->special;
ide_startstop_t startstop; 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)) if (ide_wait_stat(&startstop, drive, DATA_READY, drive->bad_wstat, WAIT_DRQ))
return startstop; return startstop;
ata_poll_drive_ready(drive); 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(); u8 stat = GET_STAT();
struct request *rq = &HWGROUP(drive)->wrq; ide_hwgroup_t *hwgroup = HWGROUP(drive);
ide_hwgroup_t *hwgroup = HWGROUP(drive); int mcount = drive->mult_count;
int mcount = drive->mult_count;
ide_startstop_t startstop; ide_startstop_t startstop;
/* /*
...@@ -339,11 +332,11 @@ static ide_startstop_t task_mulout_intr (ide_drive_t *drive) ...@@ -339,11 +332,11 @@ static ide_startstop_t task_mulout_intr (ide_drive_t *drive)
if (!rq->nr_sectors) { if (!rq->nr_sectors) {
if (stat & (ERR_STAT|DRQ_STAT)) { if (stat & (ERR_STAT|DRQ_STAT)) {
startstop = ide_error(drive, "task_mulout_intr", stat); startstop = ide_error(drive, "task_mulout_intr", stat);
memcpy(rq, HWGROUP(drive)->rq, sizeof(struct request));
return startstop; return startstop;
} }
__ide_end_request(drive, 1, rq->hard_nr_sectors); __ide_end_request(drive, rq, 1, rq->hard_nr_sectors);
rq->bio = NULL; rq->bio = NULL;
return ide_stopped; return ide_stopped;
...@@ -352,7 +345,7 @@ static ide_startstop_t task_mulout_intr (ide_drive_t *drive) ...@@ -352,7 +345,7 @@ static ide_startstop_t task_mulout_intr (ide_drive_t *drive)
if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) { if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) {
if (stat & (ERR_STAT | DRQ_STAT)) { if (stat & (ERR_STAT | DRQ_STAT)) {
startstop = ide_error(drive, "task_mulout_intr", stat); startstop = ide_error(drive, "task_mulout_intr", stat);
memcpy(rq, HWGROUP(drive)->rq, sizeof(struct request));
return startstop; return startstop;
} }
...@@ -425,7 +418,7 @@ ide_startstop_t ata_taskfile(ide_drive_t *drive, ...@@ -425,7 +418,7 @@ ide_startstop_t ata_taskfile(ide_drive_t *drive,
else else
printk(" rq-> = null\n"); printk(" rq-> = null\n");
#endif #endif
/* (ks/hs): Moved to start, do not use for multiple out commands */ /* (ks/hs): Moved to start, do not use for multiple out commands */
if (args->handler != task_mulout_intr) { if (args->handler != task_mulout_intr) {
if (IDE_CONTROL_REG) if (IDE_CONTROL_REG)
...@@ -465,9 +458,9 @@ ide_startstop_t ata_taskfile(ide_drive_t *drive, ...@@ -465,9 +458,9 @@ ide_startstop_t ata_taskfile(ide_drive_t *drive,
} else { } else {
/* for dma commands we down set the handler */ /* for dma commands we down set the handler */
if (drive->using_dma && 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)) || (args->taskfile.command == WIN_WRITEDMA_EXT))
? ide_dma_write : ide_dma_read, drive))); ? ide_dma_write : ide_dma_read, drive, rq)));
} }
return ide_started; return ide_started;
...@@ -476,11 +469,11 @@ ide_startstop_t ata_taskfile(ide_drive_t *drive, ...@@ -476,11 +469,11 @@ ide_startstop_t ata_taskfile(ide_drive_t *drive,
/* /*
* This is invoked on completion of a WIN_SETMULT cmd. * 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; 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; drive->mult_count = drive->mult_req;
} else { } else {
drive->mult_req = drive->mult_count = 0; drive->mult_req = drive->mult_count = 0;
...@@ -493,9 +486,9 @@ ide_startstop_t set_multmode_intr(struct ata_device *drive) ...@@ -493,9 +486,9 @@ ide_startstop_t set_multmode_intr(struct ata_device *drive)
/* /*
* This is invoked on completion of a WIN_SPECIFY cmd. * 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)) if (OK_STAT(stat=GET_STAT(),READY_STAT,BAD_STAT))
return ide_stopped; return ide_stopped;
...@@ -503,18 +496,18 @@ ide_startstop_t set_geometry_intr (ide_drive_t *drive) ...@@ -503,18 +496,18 @@ ide_startstop_t set_geometry_intr (ide_drive_t *drive)
if (stat & (ERR_STAT|DRQ_STAT)) if (stat & (ERR_STAT|DRQ_STAT))
return ide_error(drive, "set_geometry_intr", 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; return ide_started;
} }
/* /*
* This is invoked on completion of a WIN_RESTORE (recalibrate) cmd. * 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_error(drive, "recal_intr", stat);
return ide_stopped; return ide_stopped;
} }
...@@ -522,14 +515,14 @@ ide_startstop_t recal_intr(ide_drive_t *drive) ...@@ -522,14 +515,14 @@ ide_startstop_t recal_intr(ide_drive_t *drive)
/* /*
* Handler for commands without a data phase * 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; u8 stat;
byte stat = GET_STAT(); struct ata_taskfile *args = rq->special;
ide__sti(); /* local CPU only */ 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); return ide_error(drive, "task_no_data_intr", stat);
/* calls ide_end_drive_cmd */ /* calls ide_end_drive_cmd */
if (args) if (args)
...@@ -541,11 +534,10 @@ ide_startstop_t task_no_data_intr (ide_drive_t *drive) ...@@ -541,11 +534,10 @@ ide_startstop_t task_no_data_intr (ide_drive_t *drive)
/* /*
* Handler for command with PIO data-in phase * 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(); u8 stat = GET_STAT();
struct request *rq = HWGROUP(drive)->rq; char *pBuf = NULL;
char *pBuf = NULL;
unsigned long flags; unsigned long flags;
if (!OK_STAT(stat,DATA_READY,BAD_R_STAT)) { if (!OK_STAT(stat,DATA_READY,BAD_R_STAT)) {
...@@ -554,7 +546,7 @@ static ide_startstop_t task_in_intr (ide_drive_t *drive) ...@@ -554,7 +546,7 @@ static ide_startstop_t task_in_intr (ide_drive_t *drive)
} }
if (!(stat & BUSY_STAT)) { if (!(stat & BUSY_STAT)) {
DTF("task_in_intr to Soon wait for next interrupt\n"); 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; return ide_started;
} }
} }
...@@ -572,18 +564,18 @@ static ide_startstop_t task_in_intr (ide_drive_t *drive) ...@@ -572,18 +564,18 @@ static ide_startstop_t task_in_intr (ide_drive_t *drive)
*/ */
if (--rq->current_nr_sectors <= 0) { if (--rq->current_nr_sectors <= 0) {
DTF("Request Ended stat: %02x\n", GET_STAT()); DTF("Request Ended stat: %02x\n", GET_STAT());
if (!ide_end_request(drive, 1)) if (!ide_end_request(drive, rq, 1))
return ide_stopped; return ide_stopped;
} }
/* /*
* still data left to transfer * 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; 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; struct ata_taskfile *args = rq->special;
ide_startstop_t startstop; ide_startstop_t startstop;
...@@ -604,7 +596,7 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq) ...@@ -604,7 +596,7 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq)
ide_unmap_rq(rq, buf, &flags); ide_unmap_rq(rq, buf, &flags);
} else { } else {
ata_poll_drive_ready(drive); ata_poll_drive_ready(drive);
return args->handler(drive); return args->handler(drive, rq);
} }
return ide_started; return ide_started;
} }
...@@ -612,22 +604,20 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq) ...@@ -612,22 +604,20 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq)
/* /*
* Handler for command with PIO data-out phase * 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(); u8 stat = GET_STAT();
struct request *rq = HWGROUP(drive)->rq; char *pBuf = NULL;
char *pBuf = NULL;
unsigned long flags; unsigned long flags;
if (!OK_STAT(stat,DRIVE_READY,drive->bad_wstat)) if (!OK_STAT(stat,DRIVE_READY,drive->bad_wstat))
return ide_error(drive, "task_out_intr", stat); return ide_error(drive, "task_out_intr", stat);
if (!rq->current_nr_sectors) if (!rq->current_nr_sectors)
if (!ide_end_request(drive, 1)) if (!ide_end_request(drive, rq, 1))
return ide_stopped; return ide_stopped;
if ((rq->current_nr_sectors==1) ^ (stat & DRQ_STAT)) { if ((rq->current_nr_sectors==1) ^ (stat & DRQ_STAT)) {
rq = HWGROUP(drive)->rq;
pBuf = ide_map_rq(rq, &flags); pBuf = ide_map_rq(rq, &flags);
DTF("write: %p, rq->current_nr_sectors: %d\n", pBuf, (int) rq->current_nr_sectors); DTF("write: %p, rq->current_nr_sectors: %d\n", pBuf, (int) rq->current_nr_sectors);
...@@ -644,15 +634,14 @@ static ide_startstop_t task_out_intr(ide_drive_t *drive) ...@@ -644,15 +634,14 @@ static ide_startstop_t task_out_intr(ide_drive_t *drive)
/* /*
* Handler for command with Read Multiple * 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; u8 stat;
byte stat = GET_STAT(); char *pBuf = NULL;
struct request *rq = HWGROUP(drive)->rq; unsigned int msect, nsect;
char *pBuf = NULL;
unsigned long flags; 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)) { if (stat & (ERR_STAT|DRQ_STAT)) {
return ide_error(drive, "task_mulin_intr", stat); return ide_error(drive, "task_mulin_intr", stat);
} }
...@@ -679,7 +668,7 @@ static ide_startstop_t task_mulin_intr(ide_drive_t *drive) ...@@ -679,7 +668,7 @@ static ide_startstop_t task_mulin_intr(ide_drive_t *drive)
rq->current_nr_sectors -= nsect; rq->current_nr_sectors -= nsect;
msect -= nsect; msect -= nsect;
if (!rq->current_nr_sectors) { if (!rq->current_nr_sectors) {
if (!ide_end_request(drive, 1)) if (!ide_end_request(drive, rq, 1))
return ide_stopped; return ide_stopped;
} }
} while (msect); } while (msect);
......
...@@ -369,14 +369,12 @@ int drive_is_flashcard (ide_drive_t *drive) ...@@ -369,14 +369,12 @@ int drive_is_flashcard (ide_drive_t *drive)
return 0; /* no, it is not a flash memory card */ 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; unsigned long flags;
int ret = 1; int ret = 1;
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
rq = HWGROUP(drive)->rq;
BUG_ON(!(rq->flags & REQ_STARTED)); BUG_ON(!(rq->flags & REQ_STARTED));
...@@ -394,7 +392,7 @@ int __ide_end_request(struct ata_device *drive, int uptodate, int nr_secs) ...@@ -394,7 +392,7 @@ int __ide_end_request(struct ata_device *drive, int uptodate, int nr_secs)
if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) { if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) {
drive->state = 0; 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)) { if (!end_that_request_first(rq, uptodate, nr_secs)) {
...@@ -416,8 +414,8 @@ int __ide_end_request(struct ata_device *drive, int uptodate, int nr_secs) ...@@ -416,8 +414,8 @@ int __ide_end_request(struct ata_device *drive, int uptodate, int nr_secs)
* timer is started to prevent us from waiting forever in case * timer is started to prevent us from waiting forever in case
* something goes wrong (see the ide_timer_expiry() handler later on). * something goes wrong (see the ide_timer_expiry() handler later on).
*/ */
void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, void ide_set_handler(struct ata_device *drive, ata_handler_t handler,
unsigned int timeout, ide_expiry_t *expiry) unsigned long timeout, ata_expiry_t expiry)
{ {
unsigned long flags; unsigned long flags;
ide_hwgroup_t *hwgroup = HWGROUP(drive); ide_hwgroup_t *hwgroup = HWGROUP(drive);
...@@ -434,7 +432,7 @@ void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, ...@@ -434,7 +432,7 @@ void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler,
spin_unlock_irqrestore(&ide_lock, flags); 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) if (ata_ops(drive) && ata_ops(drive)->pre_reset)
ata_ops(drive)->pre_reset(drive); ata_ops(drive)->pre_reset(drive);
...@@ -444,13 +442,13 @@ static void ata_pre_reset(ide_drive_t *drive) ...@@ -444,13 +442,13 @@ static void ata_pre_reset(ide_drive_t *drive)
/* check the DMA crc count */ /* check the DMA crc count */
if (drive->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) if ((drive->channel->speedproc) != NULL)
drive->channel->speedproc(drive, ide_auto_reduce_xfer(drive)); drive->channel->speedproc(drive, ide_auto_reduce_xfer(drive));
if (drive->current_speed >= XFER_SW_DMA_0) if (drive->current_speed >= XFER_SW_DMA_0)
drive->channel->dmaproc(ide_dma_on, drive); drive->channel->udma(ide_dma_on, drive, NULL);
} else } else
drive->channel->dmaproc(ide_dma_off, drive); drive->channel->udma(ide_dma_off, drive, NULL);
} }
/* /*
...@@ -536,7 +534,7 @@ static ide_startstop_t do_reset1(ide_drive_t *, int); /* needed below */ ...@@ -536,7 +534,7 @@ static ide_startstop_t do_reset1(ide_drive_t *, int); /* needed below */
* operation. If the drive has not yet responded, and we have not yet hit our * 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. * 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); ide_hwgroup_t *hwgroup = HWGROUP(drive);
byte stat; byte stat;
...@@ -548,8 +546,7 @@ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive) ...@@ -548,8 +546,7 @@ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive)
printk("%s: ATAPI reset complete\n", drive->name); printk("%s: ATAPI reset complete\n", drive->name);
} else { } else {
if (time_before(jiffies, hwgroup->poll_timeout)) { 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 */ return ide_started; /* continue polling */
} }
hwgroup->poll_timeout = 0; /* end of polling */ hwgroup->poll_timeout = 0; /* end of polling */
...@@ -557,6 +554,7 @@ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive) ...@@ -557,6 +554,7 @@ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive)
return do_reset1 (drive, 1); /* do it the old fashioned way */ return do_reset1 (drive, 1); /* do it the old fashioned way */
} }
hwgroup->poll_timeout = 0; /* done polling */ hwgroup->poll_timeout = 0; /* done polling */
return ide_stopped; return ide_stopped;
} }
...@@ -565,7 +563,7 @@ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive) ...@@ -565,7 +563,7 @@ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive)
* If the drives have not yet responded, and we have not yet hit our maximum * 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. * 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); ide_hwgroup_t *hwgroup = HWGROUP(drive);
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
...@@ -573,8 +571,7 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive) ...@@ -573,8 +571,7 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
if (!OK_STAT(stat=GET_STAT(), 0, BUSY_STAT)) { if (!OK_STAT(stat=GET_STAT(), 0, BUSY_STAT)) {
if (time_before(jiffies, hwgroup->poll_timeout)) { 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 */ return ide_started; /* continue polling */
} }
printk("%s: reset timed-out, status=0x%02x\n", hwif->name, stat); printk("%s: reset timed-out, status=0x%02x\n", hwif->name, stat);
...@@ -589,7 +586,7 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive) ...@@ -589,7 +586,7 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
#if FANCY_STATUS_DUMPS #if FANCY_STATUS_DUMPS
u8 val; u8 val;
static const char *messages[5] = { static char *messages[5] = {
" passed", " passed",
" formatter device", " formatter device",
" sector buffer", " sector buffer",
...@@ -645,11 +642,10 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) ...@@ -645,11 +642,10 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
ata_pre_reset(drive); ata_pre_reset(drive);
SELECT_DRIVE(hwif,drive); SELECT_DRIVE(hwif,drive);
udelay (20); udelay (20);
OUT_BYTE (WIN_SRST, IDE_COMMAND_REG); OUT_BYTE(WIN_SRST, IDE_COMMAND_REG);
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
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); __restore_flags(flags); /* local CPU only */
__restore_flags (flags); /* local CPU only */
return ide_started; return ide_started;
} }
...@@ -682,8 +678,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) ...@@ -682,8 +678,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
} }
udelay(10); /* more than enough time */ udelay(10); /* more than enough time */
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; 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 * Some weird controller like resetting themselves to a strange
...@@ -912,9 +907,9 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, byte stat) ...@@ -912,9 +907,9 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, byte stat)
if (rq->errors >= ERROR_MAX) { if (rq->errors >= ERROR_MAX) {
if (ata_ops(drive) && ata_ops(drive)->end_request) 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 else
ide_end_request(drive, 0); ide_end_request(drive, rq, 0);
} else { } else {
if ((rq->errors & ERROR_RESET) == ERROR_RESET) { if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
++rq->errors; ++rq->errors;
...@@ -930,9 +925,8 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, byte stat) ...@@ -930,9 +925,8 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, byte stat)
/* /*
* Issue a simple drive command. The drive must be selected beforehand. * 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); ide_set_handler (drive, handler, WAIT_CMD, NULL);
if (IDE_CONTROL_REG) if (IDE_CONTROL_REG)
OUT_BYTE(drive->ctl,IDE_CONTROL_REG); /* clear nIEN */ OUT_BYTE(drive->ctl,IDE_CONTROL_REG); /* clear nIEN */
...@@ -944,9 +938,8 @@ void ide_cmd(ide_drive_t *drive, byte cmd, byte nsect, ide_handler_t *handler) ...@@ -944,9 +938,8 @@ void ide_cmd(ide_drive_t *drive, byte cmd, byte nsect, ide_handler_t *handler)
/* /*
* Invoked on completion of a special DRIVE_CMD. * 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 *args = rq->buffer;
u8 stat = GET_STAT(); u8 stat = GET_STAT();
int retries = 10; int retries = 10;
...@@ -1135,7 +1128,7 @@ static ide_startstop_t start_request(ide_drive_t *drive, struct request *rq) ...@@ -1135,7 +1128,7 @@ static ide_startstop_t start_request(ide_drive_t *drive, struct request *rq)
if (ata_ops(drive)->do_request) if (ata_ops(drive)->do_request)
return ata_ops(drive)->do_request(drive, rq, block); return ata_ops(drive)->do_request(drive, rq, block);
else { else {
ide_end_request(drive, 0); ide_end_request(drive, rq, 0);
return ide_stopped; return ide_stopped;
} }
} }
...@@ -1149,9 +1142,9 @@ static ide_startstop_t start_request(ide_drive_t *drive, struct request *rq) ...@@ -1149,9 +1142,9 @@ static ide_startstop_t start_request(ide_drive_t *drive, struct request *rq)
kill_rq: kill_rq:
if (ata_ops(drive) && ata_ops(drive)->end_request) 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 else
ide_end_request(drive, 0); ide_end_request(drive, rq, 0);
return ide_stopped; return ide_stopped;
...@@ -1368,21 +1361,20 @@ void do_ide_request(request_queue_t *q) ...@@ -1368,21 +1361,20 @@ void do_ide_request(request_queue_t *q)
* retry the current request in PIO mode instead of risking tossing it * retry the current request in PIO mode instead of risking tossing it
* all away * 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 ata_channel *hwif = drive->channel;
struct request *rq;
/* /*
* end current dma transaction * 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 * complain a little, later we might remove some of this verbosity
*/ */
printk("%s: timeout waiting for DMA\n", drive->name); 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 * Disable dma for now, but remember that we did so because of
...@@ -1391,13 +1383,12 @@ void ide_dma_timeout_retry(ide_drive_t *drive) ...@@ -1391,13 +1383,12 @@ void ide_dma_timeout_retry(ide_drive_t *drive)
*/ */
drive->retry_pio++; drive->retry_pio++;
drive->state = DMA_PIO_RETRY; 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 * un-busy drive etc (hwgroup->busy is cleared on return) and
* make sure request is sane * make sure request is sane
*/ */
rq = HWGROUP(drive)->rq;
HWGROUP(drive)->rq = NULL; HWGROUP(drive)->rq = NULL;
rq->errors = 0; rq->errors = 0;
...@@ -1415,11 +1406,11 @@ void ide_dma_timeout_retry(ide_drive_t *drive) ...@@ -1415,11 +1406,11 @@ void ide_dma_timeout_retry(ide_drive_t *drive)
*/ */
void ide_timer_expiry(unsigned long data) void ide_timer_expiry(unsigned long data)
{ {
ide_hwgroup_t *hwgroup = (ide_hwgroup_t *) data; ide_hwgroup_t *hwgroup = (ide_hwgroup_t *) data;
ide_handler_t *handler; ata_handler_t *handler;
ide_expiry_t *expiry; ata_expiry_t *expiry;
unsigned long flags; unsigned long flags;
unsigned long wait; unsigned long wait;
/* /*
* A global lock protects timers etc -- shouldn't get contention * A global lock protects timers etc -- shouldn't get contention
...@@ -1454,7 +1445,7 @@ void ide_timer_expiry(unsigned long data) ...@@ -1454,7 +1445,7 @@ void ide_timer_expiry(unsigned long data)
printk("%s: ide_timer_expiry: hwgroup was not busy??\n", drive->name); printk("%s: ide_timer_expiry: hwgroup was not busy??\n", drive->name);
if ((expiry = hwgroup->expiry) != NULL) { if ((expiry = hwgroup->expiry) != NULL) {
/* continue */ /* continue */
if ((wait = expiry(drive)) != 0) { if ((wait = expiry(drive, HWGROUP(drive)->rq)) != 0) {
/* reengage timer */ /* reengage timer */
hwgroup->timer.expires = jiffies + wait; hwgroup->timer.expires = jiffies + wait;
add_timer(&hwgroup->timer); add_timer(&hwgroup->timer);
...@@ -1477,17 +1468,17 @@ void ide_timer_expiry(unsigned long data) ...@@ -1477,17 +1468,17 @@ void ide_timer_expiry(unsigned long data)
#endif #endif
__cli(); /* local CPU only, as if we were handling an interrupt */ __cli(); /* local CPU only, as if we were handling an interrupt */
if (hwgroup->poll_timeout != 0) { if (hwgroup->poll_timeout != 0) {
startstop = handler(drive); startstop = handler(drive, ch->hwgroup->rq);
} else if (drive_is_ready(drive)) { } else if (drive_is_ready(drive)) {
if (drive->waiting_for_dma) 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); (void) ide_ack_intr(ch);
printk("%s: lost interrupt\n", drive->name); printk("%s: lost interrupt\n", drive->name);
startstop = handler(drive); startstop = handler(drive, ch->hwgroup->rq);
} else { } else {
if (drive->waiting_for_dma) { if (drive->waiting_for_dma) {
startstop = ide_stopped; startstop = ide_stopped;
ide_dma_timeout_retry(drive); dma_timeout_retry(drive, ch->hwgroup->rq);
} else } else
startstop = ide_error(drive, "irq timeout", GET_STAT()); startstop = ide_error(drive, "irq timeout", GET_STAT());
} }
...@@ -1559,7 +1550,7 @@ static void unexpected_irq(int irq) ...@@ -1559,7 +1550,7 @@ static void unexpected_irq(int irq)
} }
/* /*
* 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) void ata_irq_request(int irq, void *data, struct pt_regs *regs)
{ {
...@@ -1568,7 +1559,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs) ...@@ -1568,7 +1559,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs)
unsigned long flags; unsigned long flags;
struct ata_device *drive; struct ata_device *drive;
ide_handler_t *handler; ata_handler_t *handler = hwgroup->handler;
ide_startstop_t startstop; ide_startstop_t startstop;
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
...@@ -1576,7 +1567,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs) ...@@ -1576,7 +1567,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs)
if (!ide_ack_intr(ch)) if (!ide_ack_intr(ch))
goto out_lock; goto out_lock;
if ((handler = hwgroup->handler) == NULL || hwgroup->poll_timeout != 0) { if (handler == NULL || hwgroup->poll_timeout != 0) {
#if 0 #if 0
printk(KERN_INFO "ide: unexpected interrupt %d %d\n", ch->unit, irq); printk(KERN_INFO "ide: unexpected interrupt %d %d\n", ch->unit, irq);
#endif #endif
...@@ -1636,7 +1627,9 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs) ...@@ -1636,7 +1627,9 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs)
if (ch->unmask) if (ch->unmask)
ide__sti(); /* local CPU only */ 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); spin_lock_irq(&ide_lock);
/* /*
...@@ -2123,7 +2116,7 @@ void ide_unregister(struct ata_channel *ch) ...@@ -2123,7 +2116,7 @@ void ide_unregister(struct ata_channel *ch)
ch->ata_write = old_hwif.ata_write; ch->ata_write = old_hwif.ata_write;
ch->atapi_read = old_hwif.atapi_read; ch->atapi_read = old_hwif.atapi_read;
ch->atapi_write = old_hwif.atapi_write; ch->atapi_write = old_hwif.atapi_write;
ch->dmaproc = old_hwif.dmaproc; ch->udma = old_hwif.udma;
ch->busproc = old_hwif.busproc; ch->busproc = old_hwif.busproc;
ch->bus_state = old_hwif.bus_state; ch->bus_state = old_hwif.bus_state;
ch->dma_base = old_hwif.dma_base; ch->dma_base = old_hwif.dma_base;
...@@ -2398,13 +2391,13 @@ static int set_io_32bit(struct ata_device *drive, int arg) ...@@ -2398,13 +2391,13 @@ static int set_io_32bit(struct ata_device *drive, int arg)
return 0; 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) if (!drive->driver)
return -EPERM; return -EPERM;
if (!drive->id || !(drive->id->capability & 1) || !drive->channel->dmaproc) if (!drive->id || !(drive->id->capability & 1) || !drive->channel->udma)
return -EPERM; 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 -EIO;
return 0; return 0;
} }
...@@ -3122,9 +3115,9 @@ int __init ide_setup (char *s) ...@@ -3122,9 +3115,9 @@ int __init ide_setup (char *s)
/****************************************************************************/ /****************************************************************************/
/* This is the default end request function as well */ /* 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);
} }
/* /*
...@@ -3173,7 +3166,7 @@ int ide_register_subdriver(ide_drive_t *drive, struct ata_operations *driver) ...@@ -3173,7 +3166,7 @@ int ide_register_subdriver(ide_drive_t *drive, struct ata_operations *driver)
restore_flags(flags); /* all CPUs */ restore_flags(flags); /* all CPUs */
/* FIXME: Check what this magic number is supposed to be about? */ /* FIXME: Check what this magic number is supposed to be about? */
if (drive->autotune != 2) { if (drive->autotune != 2) {
if (drive->channel->dmaproc != NULL) { if (drive->channel->udma) {
/* /*
* Force DMAing for the beginning of the check. Some * Force DMAing for the beginning of the check. Some
...@@ -3183,8 +3176,8 @@ int ide_register_subdriver(ide_drive_t *drive, struct ata_operations *driver) ...@@ -3183,8 +3176,8 @@ int ide_register_subdriver(ide_drive_t *drive, struct ata_operations *driver)
* PARANOIA!!! * PARANOIA!!!
*/ */
drive->channel->dmaproc(ide_dma_off_quietly, drive); drive->channel->udma(ide_dma_off_quietly, drive, NULL);
drive->channel->dmaproc(ide_dma_check, drive); drive->channel->udma(ide_dma_check, drive, NULL);
} }
/* Only CD-ROMs and tape drives support DSC overlap. */ /* Only CD-ROMs and tape drives support DSC overlap. */
drive->dsc_overlap = (drive->next != drive drive->dsc_overlap = (drive->next != drive
......
...@@ -82,7 +82,7 @@ static void ns87415_selectproc (ide_drive_t *drive) ...@@ -82,7 +82,7 @@ static void ns87415_selectproc (ide_drive_t *drive)
} }
#ifdef CONFIG_BLK_DEV_IDEDMA #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; struct ata_channel *hwif = drive->channel;
byte dma_stat; byte dma_stat;
...@@ -98,16 +98,16 @@ static int ns87415_dmaproc(ide_dma_action_t func, ide_drive_t *drive) ...@@ -98,16 +98,16 @@ static int ns87415_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
case ide_dma_write: case ide_dma_write:
case ide_dma_read: case ide_dma_read:
ns87415_prepare_drive(drive, 1); /* select DMA xfer */ 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; return 0;
ns87415_prepare_drive(drive, 0); /* DMA failed: select PIO xfer */ ns87415_prepare_drive(drive, 0); /* DMA failed: select PIO xfer */
return 1; return 1;
case ide_dma_check: case ide_dma_check:
if (drive->type != ATA_DISK) if (drive->type != ATA_DISK)
return ide_dmaproc(ide_dma_off_quietly, drive); return ide_dmaproc(ide_dma_off_quietly, drive, rq);
/* Fallthrough... */ /* Fallthrough... */
default: 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 */ #endif /* CONFIG_BLK_DEV_IDEDMA */
...@@ -206,7 +206,7 @@ void __init ide_init_ns87415(struct ata_channel *hwif) ...@@ -206,7 +206,7 @@ void __init ide_init_ns87415(struct ata_channel *hwif)
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) if (hwif->dma_base)
hwif->dmaproc = &ns87415_dmaproc; hwif->udma = ns87415_dmaproc;
#endif #endif
hwif->selectproc = &ns87415_selectproc; hwif->selectproc = &ns87415_selectproc;
......
...@@ -929,7 +929,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -929,7 +929,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
if (id && (id->capability & 1) && hwif->autodma) { if (id && (id->capability & 1) && hwif->autodma) {
/* Consult the list of known "bad" drives */ /* 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; dma_func = ide_dma_off;
goto fast_ata_pio; goto fast_ata_pio;
} }
...@@ -951,7 +951,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -951,7 +951,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
if (dma_func != ide_dma_on) if (dma_func != ide_dma_on)
goto no_dma_set; 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) { if (id->eide_dma_time > 150) {
goto no_dma_set; goto no_dma_set;
} }
...@@ -969,7 +969,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -969,7 +969,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
(void) config_chipset_for_pio(drive, 5); (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) int pdc202xx_quirkproc (ide_drive_t *drive)
...@@ -980,7 +980,7 @@ int pdc202xx_quirkproc (ide_drive_t *drive) ...@@ -980,7 +980,7 @@ int pdc202xx_quirkproc (ide_drive_t *drive)
/* /*
* pdc202xx_dmaproc() initiates/aborts (U)DMA read/write operations on a 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 dma_stat = 0;
byte sc1d = 0; byte sc1d = 0;
...@@ -1060,7 +1060,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -1060,7 +1060,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
default: default:
break; 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_BLK_DEV_IDEDMA */
...@@ -1268,7 +1268,7 @@ void __init ide_init_pdc202xx(struct ata_channel *hwif) ...@@ -1268,7 +1268,7 @@ void __init ide_init_pdc202xx(struct ata_channel *hwif)
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) { if (hwif->dma_base) {
hwif->dmaproc = &pdc202xx_dmaproc; hwif->udma = pdc202xx_dmaproc;
hwif->highmem = 1; hwif->highmem = 1;
if (!noautodma) if (!noautodma)
hwif->autodma = 1; hwif->autodma = 1;
......
...@@ -306,13 +306,12 @@ void __init ide_probe_for_pdc4030(void) ...@@ -306,13 +306,12 @@ void __init ide_probe_for_pdc4030(void)
/* /*
* promise_read_intr() is the handler for disk read/multread interrupts * 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; byte stat;
int total_remaining; int total_remaining;
unsigned int sectors_left, sectors_avail, nsect; unsigned int sectors_left, sectors_avail, nsect;
unsigned long flags; unsigned long flags;
struct request *rq;
char *to; char *to;
if (!OK_STAT(stat=GET_STAT(),DATA_READY,BAD_R_STAT)) { if (!OK_STAT(stat=GET_STAT(),DATA_READY,BAD_R_STAT)) {
...@@ -324,13 +323,11 @@ static ide_startstop_t promise_read_intr (ide_drive_t *drive) ...@@ -324,13 +323,11 @@ static ide_startstop_t promise_read_intr (ide_drive_t *drive)
sectors_left = IN_BYTE(IDE_NSECTOR_REG); sectors_left = IN_BYTE(IDE_NSECTOR_REG);
IN_BYTE(IDE_SECTOR_REG); IN_BYTE(IDE_SECTOR_REG);
} while (IN_BYTE(IDE_NSECTOR_REG) != sectors_left); } while (IN_BYTE(IDE_NSECTOR_REG) != sectors_left);
rq = HWGROUP(drive)->rq;
sectors_avail = rq->nr_sectors - sectors_left; sectors_avail = rq->nr_sectors - sectors_left;
if (!sectors_avail) if (!sectors_avail)
goto read_again; goto read_again;
read_next: read_next:
rq = HWGROUP(drive)->rq;
nsect = rq->current_nr_sectors; nsect = rq->current_nr_sectors;
if (nsect > sectors_avail) if (nsect > sectors_avail)
nsect = sectors_avail; nsect = sectors_avail;
...@@ -348,7 +345,7 @@ static ide_startstop_t promise_read_intr (ide_drive_t *drive) ...@@ -348,7 +345,7 @@ static ide_startstop_t promise_read_intr (ide_drive_t *drive)
rq->nr_sectors -= nsect; rq->nr_sectors -= nsect;
total_remaining = rq->nr_sectors; total_remaining = rq->nr_sectors;
if ((rq->current_nr_sectors -= nsect) <= 0) { 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: * Now the data has been read in, do the following:
...@@ -368,7 +365,7 @@ static ide_startstop_t promise_read_intr (ide_drive_t *drive) ...@@ -368,7 +365,7 @@ static ide_startstop_t promise_read_intr (ide_drive_t *drive)
if (stat & DRQ_STAT) if (stat & DRQ_STAT)
goto read_again; goto read_again;
if (stat & BUSY_STAT) { 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 #ifdef DEBUG_READ
printk(KERN_DEBUG "%s: promise_read: waiting for" printk(KERN_DEBUG "%s: promise_read: waiting for"
"interrupt\n", drive->name); "interrupt\n", drive->name);
...@@ -383,22 +380,19 @@ static ide_startstop_t promise_read_intr (ide_drive_t *drive) ...@@ -383,22 +380,19 @@ static ide_startstop_t promise_read_intr (ide_drive_t *drive)
} }
/* /*
* promise_complete_pollfunc()
* This is the polling function for waiting (nicely!) until drive stops * 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 * being busy. It is invoked at the end of a write, after the previous poll
* has finished. * has finished.
* *
* Once not busy, the end request is called. * 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); ide_hwgroup_t *hwgroup = HWGROUP(drive);
struct request *rq = hwgroup->rq;
if (GET_STAT() & BUSY_STAT) { if (GET_STAT() & BUSY_STAT) {
if (time_before(jiffies, hwgroup->poll_timeout)) { 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... */ return ide_started; /* continue polling... */
} }
hwgroup->poll_timeout = 0; hwgroup->poll_timeout = 0;
...@@ -411,7 +405,7 @@ static ide_startstop_t promise_complete_pollfunc(ide_drive_t *drive) ...@@ -411,7 +405,7 @@ static ide_startstop_t promise_complete_pollfunc(ide_drive_t *drive)
#ifdef DEBUG_WRITE #ifdef DEBUG_WRITE
printk(KERN_DEBUG "%s: Write complete - end_request\n", drive->name); printk(KERN_DEBUG "%s: Write complete - end_request\n", drive->name);
#endif #endif
__ide_end_request(drive, 1, rq->nr_sectors); __ide_end_request(drive, rq, 1, rq->nr_sectors);
return ide_stopped; return ide_stopped;
} }
...@@ -427,11 +421,8 @@ static ide_startstop_t promise_complete_pollfunc(ide_drive_t *drive) ...@@ -427,11 +421,8 @@ static ide_startstop_t promise_complete_pollfunc(ide_drive_t *drive)
* full "mcount" number of sectors, so we must make sure we update the * full "mcount" number of sectors, so we must make sure we update the
* state _before_ we output the final part of the data! * 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 { do {
char *buffer; char *buffer;
int nsect = rq->current_nr_sectors; int nsect = rq->current_nr_sectors;
...@@ -474,14 +465,13 @@ int promise_multwrite (ide_drive_t *drive, unsigned int mcount) ...@@ -474,14 +465,13 @@ int promise_multwrite (ide_drive_t *drive, unsigned int mcount)
/* /*
* promise_write_pollfunc() is the handler for disk write completion polling. * 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); ide_hwgroup_t *hwgroup = HWGROUP(drive);
if (IN_BYTE(IDE_NSECTOR_REG) != 0) { if (IN_BYTE(IDE_NSECTOR_REG) != 0) {
if (time_before(jiffies, hwgroup->poll_timeout)) { 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... */ return ide_started; /* continue polling... */
} }
hwgroup->poll_timeout = 0; hwgroup->poll_timeout = 0;
...@@ -492,10 +482,9 @@ static ide_startstop_t promise_write_pollfunc (ide_drive_t *drive) ...@@ -492,10 +482,9 @@ static ide_startstop_t promise_write_pollfunc (ide_drive_t *drive)
/* /*
* Now write out last 4 sectors and poll for not BUSY * 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; 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 #ifdef DEBUG_WRITE
printk(KERN_DEBUG "%s: Done last 4 sectors - status = %02x\n", printk(KERN_DEBUG "%s: Done last 4 sectors - status = %02x\n",
drive->name, GET_STAT()); drive->name, GET_STAT());
...@@ -510,10 +499,9 @@ static ide_startstop_t promise_write_pollfunc (ide_drive_t *drive) ...@@ -510,10 +499,9 @@ static ide_startstop_t promise_write_pollfunc (ide_drive_t *drive)
* before the final 4 sectors are transferred. There is no interrupt generated * 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. * 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); ide_hwgroup_t *hwgroup = HWGROUP(drive);
struct request *rq = &hwgroup->wrq;
#ifdef DEBUG_WRITE #ifdef DEBUG_WRITE
printk(KERN_DEBUG "%s: promise_write: sectors(%ld-%ld), " printk(KERN_DEBUG "%s: promise_write: sectors(%ld-%ld), "
...@@ -526,22 +514,20 @@ static ide_startstop_t promise_write (ide_drive_t *drive) ...@@ -526,22 +514,20 @@ static ide_startstop_t promise_write (ide_drive_t *drive)
* the polling strategy as defined above. * the polling strategy as defined above.
*/ */
if (rq->nr_sectors > 4) { 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; return ide_stopped;
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; 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; return ide_started;
} else { } else {
/* /*
* There are 4 or fewer sectors to transfer, do them all in one go * There are 4 or fewer sectors to transfer, do them all in one go
* and wait for NOT BUSY. * and wait for NOT BUSY.
*/ */
if (promise_multwrite(drive, rq->nr_sectors)) if (promise_multwrite(drive, rq, rq->nr_sectors))
return ide_stopped; return ide_stopped;
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; 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 #ifdef DEBUG_WRITE
printk(KERN_DEBUG "%s: promise_write: <= 4 sectors, " printk(KERN_DEBUG "%s: promise_write: <= 4 sectors, "
"status = %02x\n", drive->name, GET_STAT()); "status = %02x\n", drive->name, GET_STAT());
...@@ -555,9 +541,8 @@ static ide_startstop_t promise_write (ide_drive_t *drive) ...@@ -555,9 +541,8 @@ static ide_startstop_t promise_write (ide_drive_t *drive)
* already set up. It issues a READ or WRITE command to the Promise * 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. * 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; struct hd_drive_task_hdr *taskfile = &task->taskfile;
unsigned long timeout; unsigned long timeout;
byte stat; byte stat;
...@@ -565,7 +550,7 @@ ide_startstop_t do_pdc4030_io(ide_drive_t *drive, struct ata_taskfile *task) ...@@ -565,7 +550,7 @@ ide_startstop_t do_pdc4030_io(ide_drive_t *drive, struct ata_taskfile *task)
/* Check that it's a regular command. If not, bomb out early. */ /* Check that it's a regular command. If not, bomb out early. */
if (!(rq->flags & REQ_CMD)) { if (!(rq->flags & REQ_CMD)) {
blk_dump_rq_flags(rq, "pdc4030 bad flags"); blk_dump_rq_flags(rq, "pdc4030 bad flags");
ide_end_request(drive, 0); ide_end_request(drive, rq, 0);
return ide_stopped; return ide_stopped;
} }
...@@ -600,15 +585,14 @@ ide_startstop_t do_pdc4030_io(ide_drive_t *drive, struct ata_taskfile *task) ...@@ -600,15 +585,14 @@ ide_startstop_t do_pdc4030_io(ide_drive_t *drive, struct ata_taskfile *task)
stat=GET_STAT(); stat=GET_STAT();
if (stat & DRQ_STAT) { if (stat & DRQ_STAT) {
udelay(1); udelay(1);
return promise_read_intr(drive); return promise_read_intr(drive, rq);
} }
if (IN_BYTE(IDE_SELECT_REG) & 0x01) { if (IN_BYTE(IDE_SELECT_REG) & 0x01) {
#ifdef DEBUG_READ #ifdef DEBUG_READ
printk(KERN_DEBUG "%s: read: waiting for " printk(KERN_DEBUG "%s: read: waiting for "
"interrupt\n", drive->name); "interrupt\n", drive->name);
#endif #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; return ide_started;
} }
udelay(1); udelay(1);
...@@ -634,39 +618,34 @@ ide_startstop_t do_pdc4030_io(ide_drive_t *drive, struct ata_taskfile *task) ...@@ -634,39 +618,34 @@ ide_startstop_t do_pdc4030_io(ide_drive_t *drive, struct ata_taskfile *task)
} }
if (!drive->channel->unmask) if (!drive->channel->unmask)
__cli(); /* local CPU only */ __cli(); /* local CPU only */
HWGROUP(drive)->wrq = *rq; /* scratchpad */ return promise_write(drive, rq);
return promise_write(drive);
} }
default: default:
printk(KERN_ERR "pdc4030: command not READ or WRITE! Huh?\n"); 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; 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; 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 /* The four drives on the two logical (one physical) interfaces
are distinguished by writing the drive number (0-3) to the are distinguished by writing the drive number (0-3) to the
Feature register. Feature register.
FIXME: Is promise_selectproc now redundant?? FIXME: Is promise_selectproc now redundant??
*/ */
taskfile.feature = (drive->channel->unit << 1) + drive->select.b.unit; args.taskfile.feature = (drive->channel->unit << 1) + drive->select.b.unit;
taskfile.sector_count = rq->nr_sectors; args.taskfile.sector_count = rq->nr_sectors;
taskfile.sector_number = block; args.taskfile.sector_number = block;
taskfile.low_cylinder = (block>>=8); args.taskfile.low_cylinder = (block>>=8);
taskfile.high_cylinder = (block>>=8); args.taskfile.high_cylinder = (block>>=8);
taskfile.device_head = ((block>>8)&0x0f)|drive->select.all; args.taskfile.device_head = ((block>>8)&0x0f)|drive->select.all;
taskfile.command = (rq_data_dir(rq)==READ)?PROMISE_READ:PROMISE_WRITE; args.taskfile.command = (rq_data_dir(rq)==READ)?PROMISE_READ:PROMISE_WRITE;
args.taskfile = taskfile;
memset(&args.hobfile, 0, sizeof(struct hd_drive_hob_hdr));
ide_cmd_type_parser(&args); ide_cmd_type_parser(&args);
/* We don't use the generic inerrupt handlers here? */ /* We don't use the generic inerrupt handlers here? */
...@@ -674,6 +653,6 @@ ide_startstop_t promise_rw_disk (ide_drive_t *drive, struct request *rq, unsigne ...@@ -674,6 +653,6 @@ ide_startstop_t promise_rw_disk (ide_drive_t *drive, struct request *rq, unsigne
args.handler = NULL; args.handler = NULL;
rq->special = &args; rq->special = &args;
return do_pdc4030_io(drive, &args); return do_pdc4030_io(drive, &args, rq);
} }
...@@ -376,7 +376,7 @@ static void piix_tune_drive(ide_drive_t *drive, unsigned char pio) ...@@ -376,7 +376,7 @@ static void piix_tune_drive(ide_drive_t *drive, unsigned char pio)
* else to the default ide_dmaproc(). * 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) { if (func == ide_dma_check) {
...@@ -397,7 +397,7 @@ int piix_dmaproc(ide_dma_action_t func, ide_drive_t *drive) ...@@ -397,7 +397,7 @@ int piix_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
} }
return ide_dmaproc(func, drive); return ide_dmaproc(func, drive, rq);
} }
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_BLK_DEV_IDEDMA */
...@@ -555,7 +555,7 @@ void __init ide_init_piix(struct ata_channel *hwif) ...@@ -555,7 +555,7 @@ void __init ide_init_piix(struct ata_channel *hwif)
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) { if (hwif->dma_base) {
hwif->highmem = 1; hwif->highmem = 1;
hwif->dmaproc = &piix_dmaproc; hwif->udma = piix_dmaproc;
#ifdef CONFIG_IDEDMA_AUTO #ifdef CONFIG_IDEDMA_AUTO
if (!noautodma) if (!noautodma)
hwif->autodma = 1; hwif->autodma = 1;
......
...@@ -438,7 +438,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -438,7 +438,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
if (id && (id->capability & 1) && drive->channel->autodma) { if (id && (id->capability & 1) && drive->channel->autodma) {
/* Consult the list of known "bad" drives */ /* 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; dma_func = ide_dma_off;
goto fast_ata_pio; goto fast_ata_pio;
} }
...@@ -460,7 +460,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -460,7 +460,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
if (dma_func != ide_dma_on) if (dma_func != ide_dma_on)
goto no_dma_set; 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) { if (id->eide_dma_time > 150) {
goto no_dma_set; goto no_dma_set;
} }
...@@ -477,10 +477,10 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -477,10 +477,10 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
no_dma_set: no_dma_set:
config_chipset_for_pio(drive); 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) { switch (func) {
case ide_dma_check: case ide_dma_check:
...@@ -489,10 +489,10 @@ static int svwks_dmaproc(ide_dma_action_t func, ide_drive_t *drive) ...@@ -489,10 +489,10 @@ static int svwks_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
{ {
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base; unsigned long dma_base = hwif->dma_base;
if(inb(dma_base+0x02)&1) if(inb(dma_base+0x02)&1)
{ {
#if 0 #if 0
int i; int i;
printk(KERN_ERR "Curious - OSB4 thinks the DMA is still running.\n"); printk(KERN_ERR "Curious - OSB4 thinks the DMA is still running.\n");
for(i=0;i<10;i++) for(i=0;i<10;i++)
...@@ -504,18 +504,18 @@ static int svwks_dmaproc(ide_dma_action_t func, ide_drive_t *drive) ...@@ -504,18 +504,18 @@ static int svwks_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
} }
udelay(5); udelay(5);
} }
#endif #endif
printk(KERN_CRIT "Serverworks OSB4 in impossible state.\n"); 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 "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"); 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 might sys_sync -> death by corrupt disk */
panic("OSB4: continuing might cause disk corruption.\n"); panic("OSB4: continuing might cause disk corruption.\n");
#else #else
printk(KERN_CRIT "OSB4: continuing might cause disk corruption.\n"); printk(KERN_CRIT "OSB4: continuing might cause disk corruption.\n");
while(1) while(1)
cpu_relax(); cpu_relax();
#endif #endif
} }
/* and drop through */ /* and drop through */
} }
...@@ -523,7 +523,7 @@ static int svwks_dmaproc(ide_dma_action_t func, ide_drive_t *drive) ...@@ -523,7 +523,7 @@ static int svwks_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
break; break;
} }
/* Other cases are done by generic IDE-DMA code. */ /* 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 */ #endif /* CONFIG_BLK_DEV_IDEDMA */
...@@ -645,7 +645,7 @@ void __init ide_init_svwks(struct ata_channel *hwif) ...@@ -645,7 +645,7 @@ void __init ide_init_svwks(struct ata_channel *hwif)
if (!noautodma) if (!noautodma)
hwif->autodma = 1; hwif->autodma = 1;
#endif #endif
hwif->dmaproc = &svwks_dmaproc; hwif->udma = svwks_dmaproc;
hwif->highmem = 1; hwif->highmem = 1;
} else { } else {
hwif->autodma = 0; hwif->autodma = 0;
......
...@@ -685,7 +685,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -685,7 +685,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
if (id && (id->capability & 1) && drive->channel->autodma) { if (id && (id->capability & 1) && drive->channel->autodma) {
/* Consult the list of known "bad" drives */ /* 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; dma_func = ide_dma_off;
goto fast_ata_pio; goto fast_ata_pio;
} }
...@@ -707,7 +707,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -707,7 +707,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
if (dma_func != ide_dma_on) if (dma_func != ide_dma_on)
goto no_dma_set; 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)) { (id->eide_dma_time > 150)) {
/* Consult the list of known "good" drives */ /* Consult the list of known "good" drives */
dma_func = config_chipset_for_dma(drive, 0); dma_func = config_chipset_for_dma(drive, 0);
...@@ -723,11 +723,11 @@ static int config_drive_xfer_rate (ide_drive_t *drive) ...@@ -723,11 +723,11 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
(void) config_chipset_for_pio(drive, 5); (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. */ /* 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) { switch (func) {
case ide_dma_check: case ide_dma_check:
...@@ -737,7 +737,7 @@ int sis5513_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -737,7 +737,7 @@ int sis5513_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
default: default:
break; 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_BLK_DEV_IDEDMA */
...@@ -852,7 +852,7 @@ void __init ide_init_sis5513(struct ata_channel *hwif) ...@@ -852,7 +852,7 @@ void __init ide_init_sis5513(struct ata_channel *hwif)
if (chipset_family > ATA_16) { if (chipset_family > ATA_16) {
hwif->autodma = noautodma ? 0 : 1; hwif->autodma = noautodma ? 0 : 1;
hwif->highmem = 1; hwif->highmem = 1;
hwif->dmaproc = &sis5513_dmaproc; hwif->udma = sis5513_dmaproc;
} else { } else {
#endif #endif
hwif->autodma = 0; hwif->autodma = 0;
......
...@@ -194,7 +194,6 @@ static int trm290_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -194,7 +194,6 @@ static int trm290_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
outw((count * 2) - 1, hwif->dma_base+2); /* start DMA */ outw((count * 2) - 1, hwif->dma_base+2); /* start DMA */
if (drive->type != ATA_DISK) if (drive->type != ATA_DISK)
return 0; 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);
OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG); OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
return 0; return 0;
......
...@@ -363,7 +363,7 @@ static void via82cxxx_tune_drive(ide_drive_t *drive, unsigned char pio) ...@@ -363,7 +363,7 @@ static void via82cxxx_tune_drive(ide_drive_t *drive, unsigned char pio)
* else to the default ide_dmaproc(). * 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) { if (func == ide_dma_check) {
...@@ -383,7 +383,7 @@ int via82cxxx_dmaproc(ide_dma_action_t func, ide_drive_t *drive) ...@@ -383,7 +383,7 @@ int via82cxxx_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
? ide_dma_on : ide_dma_off_quietly; ? ide_dma_on : ide_dma_off_quietly;
} }
return ide_dmaproc(func, drive); return ide_dmaproc(func, drive, rq);
} }
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_BLK_DEV_IDEDMA */
...@@ -546,7 +546,7 @@ void __init ide_init_via82cxxx(struct ata_channel *hwif) ...@@ -546,7 +546,7 @@ void __init ide_init_via82cxxx(struct ata_channel *hwif)
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) { if (hwif->dma_base) {
hwif->highmem = 1; hwif->highmem = 1;
hwif->dmaproc = &via82cxxx_dmaproc; hwif->udma = &via82cxxx_dmaproc;
#ifdef CONFIG_IDEDMA_AUTO #ifdef CONFIG_IDEDMA_AUTO
if (!noautodma) if (!noautodma)
hwif->autodma = 1; hwif->autodma = 1;
......
...@@ -59,7 +59,6 @@ typedef struct idescsi_pc_s { ...@@ -59,7 +59,6 @@ typedef struct idescsi_pc_s {
int request_transfer; /* Bytes to transfer */ int request_transfer; /* Bytes to transfer */
int actually_transferred; /* Bytes actually transferred */ int actually_transferred; /* Bytes actually transferred */
int buffer_size; /* Size of our data buffer */ int buffer_size; /* Size of our data buffer */
struct request *rq; /* The corresponding request */
byte *buffer; /* Data buffer */ byte *buffer; /* Data buffer */
byte *current_position; /* Pointer into the above buffer */ byte *current_position; /* Pointer into the above buffer */
struct scatterlist *sg; /* Scatter gather table */ struct scatterlist *sg; /* Scatter gather table */
...@@ -259,10 +258,9 @@ static void hexdump(u8 *x, int len) ...@@ -259,10 +258,9 @@ static void hexdump(u8 *x, int len)
printk("]\n"); 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; idescsi_scsi_t *scsi = drive->driver_data;
struct request *rq = HWGROUP(drive)->rq;
idescsi_pc_t *pc = (idescsi_pc_t *) rq->special; idescsi_pc_t *pc = (idescsi_pc_t *) rq->special;
int log = test_bit(IDESCSI_LOG_CMD, &scsi->log); int log = test_bit(IDESCSI_LOG_CMD, &scsi->log);
struct Scsi_Host *host; struct Scsi_Host *host;
...@@ -270,7 +268,7 @@ static int idescsi_end_request(ide_drive_t *drive, int uptodate) ...@@ -270,7 +268,7 @@ static int idescsi_end_request(ide_drive_t *drive, int uptodate)
unsigned long flags; unsigned long flags;
if (!(rq->flags & REQ_SPECIAL)) { if (!(rq->flags & REQ_SPECIAL)) {
ide_end_request(drive, uptodate); ide_end_request(drive, rq, uptodate);
return 0; return 0;
} }
ide_end_drive_cmd (drive, 0, 0); ide_end_drive_cmd (drive, 0, 0);
...@@ -313,13 +311,12 @@ static inline unsigned long get_timeout(idescsi_pc_t *pc) ...@@ -313,13 +311,12 @@ static inline unsigned long get_timeout(idescsi_pc_t *pc)
/* /*
* Our interrupt handler. * 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; idescsi_scsi_t *scsi = drive->driver_data;
byte status, ireason; byte status, ireason;
int bcount; int bcount;
idescsi_pc_t *pc=scsi->pc; idescsi_pc_t *pc=scsi->pc;
struct request *rq = pc->rq;
unsigned int temp; unsigned int temp;
#if IDESCSI_DEBUG_LOG #if IDESCSI_DEBUG_LOG
...@@ -331,7 +328,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) ...@@ -331,7 +328,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
printk ("ide-scsi: %s: DMA complete\n", drive->name); printk ("ide-scsi: %s: DMA complete\n", drive->name);
#endif /* IDESCSI_DEBUG_LOG */ #endif /* IDESCSI_DEBUG_LOG */
pc->actually_transferred=pc->request_transfer; 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 */ status = GET_STAT(); /* Clear the interrupt */
...@@ -342,7 +339,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) ...@@ -342,7 +339,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
ide__sti(); ide__sti();
if (status & ERR_STAT) if (status & ERR_STAT)
rq->errors++; rq->errors++;
idescsi_end_request(drive, 1); idescsi_end_request(drive, rq, 1);
return ide_stopped; return ide_stopped;
} }
bcount = IN_BYTE (IDE_BCOUNTH_REG) << 8 | IN_BYTE (IDE_BCOUNTL_REG); bcount = IN_BYTE (IDE_BCOUNTH_REG) << 8 | IN_BYTE (IDE_BCOUNTL_REG);
...@@ -369,7 +366,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) ...@@ -369,7 +366,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
pc->actually_transferred += temp; pc->actually_transferred += temp;
pc->current_position += temp; pc->current_position += temp;
idescsi_discard_data (drive,bcount - 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; return ide_started;
} }
#if IDESCSI_DEBUG_LOG #if IDESCSI_DEBUG_LOG
...@@ -393,11 +390,11 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) ...@@ -393,11 +390,11 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
pc->actually_transferred+=bcount; /* Update the current position */ pc->actually_transferred+=bcount; /* Update the current position */
pc->current_position+=bcount; 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; 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_scsi_t *scsi = drive->driver_data;
idescsi_pc_t *pc = scsi->pc; idescsi_pc_t *pc = scsi->pc;
...@@ -413,7 +410,7 @@ static ide_startstop_t idescsi_transfer_pc (ide_drive_t *drive) ...@@ -413,7 +410,7 @@ static ide_startstop_t idescsi_transfer_pc (ide_drive_t *drive)
printk (KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while issuing a packet command\n"); printk (KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while issuing a packet command\n");
return ide_stopped; 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 */ atapi_write(drive, scsi->pc->c, 12); /* Send the actual packet */
return ide_started; return ide_started;
} }
...@@ -421,11 +418,10 @@ static ide_startstop_t idescsi_transfer_pc (ide_drive_t *drive) ...@@ -421,11 +418,10 @@ static ide_startstop_t idescsi_transfer_pc (ide_drive_t *drive)
/* /*
* Issue a packet command * 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; idescsi_scsi_t *scsi = drive->driver_data;
int bcount; int bcount;
struct request *rq = pc->rq;
int dma_ok = 0; int dma_ok = 0;
scsi->pc=pc; /* Set the current packet command */ scsi->pc=pc; /* Set the current packet command */
...@@ -434,7 +430,7 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc) ...@@ -434,7 +430,7 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
bcount = min(pc->request_transfer, 63 * 1024); /* Request to transfer the entire buffer at once */ bcount = min(pc->request_transfer, 63 * 1024); /* Request to transfer the entire buffer at once */
if (drive->using_dma && rq->bio) 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); SELECT_DRIVE(drive->channel, drive);
if (IDE_CONTROL_REG) if (IDE_CONTROL_REG)
...@@ -445,15 +441,15 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc) ...@@ -445,15 +441,15 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
if (dma_ok) { if (dma_ok) {
set_bit(PC_DMA_IN_PROGRESS, &pc->flags); 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)) { 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 */ OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* Issue the packet command */
return ide_started; return ide_started;
} else { } else {
OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG);
return idescsi_transfer_pc (drive); return idescsi_transfer_pc(drive, rq);
} }
} }
...@@ -468,10 +464,10 @@ static ide_startstop_t idescsi_do_request(struct ata_device *drive, struct reque ...@@ -468,10 +464,10 @@ static ide_startstop_t idescsi_do_request(struct ata_device *drive, struct reque
#endif /* IDESCSI_DEBUG_LOG */ #endif /* IDESCSI_DEBUG_LOG */
if (rq->flags & REQ_SPECIAL) { 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"); blk_dump_rq_flags(rq, "ide-scsi: unsup command");
idescsi_end_request(drive, 0); idescsi_end_request(drive, rq, 0);
return ide_stopped; return ide_stopped;
} }
...@@ -760,7 +756,6 @@ int idescsi_queue (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) ...@@ -760,7 +756,6 @@ int idescsi_queue (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
memset (pc->c, 0, 12); memset (pc->c, 0, 12);
pc->flags = 0; pc->flags = 0;
pc->rq = rq;
memcpy (pc->c, cmd->cmnd, cmd->cmd_len); memcpy (pc->c, cmd->cmnd, cmd->cmd_len);
if (cmd->use_sg) { if (cmd->use_sg) {
pc->buffer = NULL; pc->buffer = NULL;
......
...@@ -374,7 +374,7 @@ struct ata_device { ...@@ -374,7 +374,7 @@ struct ata_device {
} ide_drive_t; } 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 * 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 * sector address using CHS or LBA. All that remains is to prepare for DMA
...@@ -392,8 +392,6 @@ typedef enum { ide_dma_read, ide_dma_write, ide_dma_begin, ...@@ -392,8 +392,6 @@ typedef enum { ide_dma_read, ide_dma_write, ide_dma_begin,
ide_dma_lostirq, ide_dma_timeout ide_dma_lostirq, ide_dma_timeout
} ide_dma_action_t; } ide_dma_action_t;
typedef int (ide_dmaproc_t)(ide_dma_action_t, ide_drive_t *);
enum { enum {
ATA_PRIMARY = 0, ATA_PRIMARY = 0,
ATA_SECONDARY = 1 ATA_SECONDARY = 1
...@@ -446,7 +444,7 @@ struct ata_channel { ...@@ -446,7 +444,7 @@ struct ata_channel {
void (*atapi_read)(ide_drive_t *, void *, unsigned int); void (*atapi_read)(ide_drive_t *, void *, unsigned int);
void (*atapi_write)(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) */ unsigned int *dmatable_cpu; /* dma physical region descriptor table (cpu view) */
dma_addr_t dmatable_dma; /* dma physical region descriptor table (dma 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 */ struct scatterlist *sg_table; /* Scatter-gather list used to build the above */
...@@ -500,31 +498,25 @@ typedef enum { ...@@ -500,31 +498,25 @@ typedef enum {
} ide_startstop_t; } ide_startstop_t;
/* /*
* Interrupt handler types. * Interrupt and timeout handler type.
*/ */
struct ata_taskfile; typedef ide_startstop_t (ata_handler_t)(struct ata_device *, struct request *);
typedef ide_startstop_t (ide_pre_handler_t)(ide_drive_t *, struct request *); typedef int (ata_expiry_t)(struct ata_device *, struct request *);
typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
/* struct ata_taskfile;
* when ide_timer_expiry fires, invoke a handler of this type
* to decide what to do.
*/
typedef int (ide_expiry_t)(ide_drive_t *);
#define IDE_BUSY 0 /* awaiting an interrupt */ #define IDE_BUSY 0 /* awaiting an interrupt */
#define IDE_SLEEP 1 #define IDE_SLEEP 1
#define IDE_DMA 2 /* DMA in progress */ #define IDE_DMA 2 /* DMA in progress */
typedef struct hwgroup_s { 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 */ unsigned long flags; /* BUSY, SLEEPING */
struct ata_device *drive; /* current drive */ struct ata_device *drive; /* current drive */
struct request *rq; /* current request */ struct request *rq; /* current request */
struct timer_list timer; /* failsafe timer */ struct timer_list timer; /* failsafe timer */
struct request wrq; /* local copy of current write rq */
unsigned long poll_timeout; /* timeout value during long polls */ 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; } ide_hwgroup_t;
/* structure attached to the request for IDE_TASK_CMDS */ /* structure attached to the request for IDE_TASK_CMDS */
...@@ -616,7 +608,7 @@ struct ata_operations { ...@@ -616,7 +608,7 @@ struct ata_operations {
int (*cleanup)(struct ata_device *); int (*cleanup)(struct ata_device *);
int (*standby)(struct ata_device *); int (*standby)(struct ata_device *);
ide_startstop_t (*do_request)(struct ata_device *, struct request *, sector_t); 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 (*ioctl)(struct ata_device *, struct inode *, struct file *, unsigned int, unsigned long);
int (*open)(struct inode *, struct file *, struct ata_device *); int (*open)(struct inode *, struct file *, struct ata_device *);
...@@ -663,14 +655,15 @@ extern int noautodma; ...@@ -663,14 +655,15 @@ extern int noautodma;
#define LOCAL_END_REQUEST /* Don't generate end_request in blk.h */ #define LOCAL_END_REQUEST /* Don't generate end_request in blk.h */
#include <linux/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(struct ata_device *, struct request *, int, int);
extern int ide_end_request(ide_drive_t *drive, int uptodate); 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 * This is used on exit from the driver, to designate the next irq handler
* and also to start the safety timer. * 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). * Error reporting, in human readable form (luxurious, but a memory hog).
...@@ -687,7 +680,7 @@ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); ...@@ -687,7 +680,7 @@ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
* Issue a simple drive command * Issue a simple drive command
* The drive must be selected beforehand. * 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, * ide_fixstring() cleans up and (optionally) byte-swaps a text string,
...@@ -756,9 +749,9 @@ void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err); ...@@ -756,9 +749,9 @@ void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err);
struct ata_taskfile { struct ata_taskfile {
struct hd_drive_task_hdr taskfile; struct hd_drive_task_hdr taskfile;
struct hd_drive_hob_hdr hobfile; struct hd_drive_hob_hdr hobfile;
int command_type; int command_type;
ide_pre_handler_t *prehandler; ide_startstop_t (*prehandler)(struct ata_device *, struct request *);
ide_handler_t *handler; ide_startstop_t (*handler)(struct ata_device *, struct request *);
}; };
extern void ata_read(ide_drive_t *drive, void *buffer, unsigned int wcount); extern void ata_read(ide_drive_t *drive, void *buffer, unsigned int wcount);
...@@ -774,10 +767,10 @@ extern ide_startstop_t ata_taskfile(ide_drive_t *drive, ...@@ -774,10 +767,10 @@ extern ide_startstop_t ata_taskfile(ide_drive_t *drive,
* Special Flagged Register Validation Caller * Special Flagged Register Validation Caller
*/ */
extern ide_startstop_t recal_intr(ide_drive_t *drive); extern ide_startstop_t recal_intr(struct ata_device *, struct request *);
extern ide_startstop_t set_geometry_intr(ide_drive_t *drive); extern ide_startstop_t set_geometry_intr(struct ata_device *, struct request *);
extern ide_startstop_t set_multmode_intr(ide_drive_t *drive); extern ide_startstop_t set_multmode_intr(struct ata_device *, struct request *);
extern ide_startstop_t task_no_data_intr(ide_drive_t *drive); 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. /* This is setting up all fields in args, which depend upon the command type.
...@@ -871,9 +864,9 @@ void __init ide_scan_pcibus(int scan_direction); ...@@ -871,9 +864,9 @@ void __init ide_scan_pcibus(int scan_direction);
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func); int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func);
void ide_destroy_dmatable (ide_drive_t *drive); 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 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_release_dma(struct ata_channel *hwif);
extern void ide_setup_dma(struct ata_channel *hwif, extern void ide_setup_dma(struct ata_channel *hwif,
unsigned long dmabase, unsigned int num_ports) __init; unsigned long dmabase, unsigned int num_ports) __init;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment