2 * IDE DMA support (including IDE PCI BM-DMA).
4 * Copyright (C) 1995-1998 Mark Lord
5 * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org>
6 * Copyright (C) 2004, 2007 Bartlomiej Zolnierkiewicz
8 * May be copied or modified under the terms of the GNU General Public License
10 * DMA is supported for all IDE devices (disk drives, cdroms, tapes, floppies).
14 * Special Thanks to Mark for his Six years of work.
18 * Thanks to "Christopher J. Reimer" <reimer@doe.carleton.ca> for
19 * fixing the problem with the BIOS on some Acer motherboards.
21 * Thanks to "Benoit Poulot-Cazajous" <poulot@chorus.fr> for testing
22 * "TX" chipset compatibility and for providing patches for the "TX" chipset.
24 * Thanks to Christian Brunner <chb@muc.de> for taking a good first crack
25 * at generic DMA -- his patches were referred to when preparing this code.
27 * Most importantly, thanks to Robert Bringman <rob@mars.trion.com>
28 * for supplying a Promise UDMA board & WD UDMA drive for this work!
31 #include <linux/module.h>
32 #include <linux/types.h>
33 #include <linux/kernel.h>
34 #include <linux/timer.h>
36 #include <linux/interrupt.h>
37 #include <linux/pci.h>
38 #include <linux/init.h>
39 #include <linux/ide.h>
40 #include <linux/delay.h>
41 #include <linux/scatterlist.h>
42 #include <linux/dma-mapping.h>
47 static const struct drive_list_entry drive_whitelist [] = {
49 { "Micropolis 2112A" , NULL },
50 { "CONNER CTMA 4000" , NULL },
51 { "CONNER CTT8000-A" , NULL },
52 { "ST34342A" , NULL },
56 static const struct drive_list_entry drive_blacklist [] = {
58 { "WDC AC11000H" , NULL },
59 { "WDC AC22100H" , NULL },
60 { "WDC AC32500H" , NULL },
61 { "WDC AC33100H" , NULL },
62 { "WDC AC31600H" , NULL },
63 { "WDC AC32100H" , "24.09P07" },
64 { "WDC AC23200L" , "21.10N21" },
65 { "Compaq CRD-8241B" , NULL },
66 { "CRD-8400B" , NULL },
67 { "CRD-8480B", NULL },
68 { "CRD-8482B", NULL },
70 { "SanDisk SDP3B" , NULL },
71 { "SanDisk SDP3B-64" , NULL },
72 { "SANYO CD-ROM CRD" , NULL },
73 { "HITACHI CDR-8" , NULL },
74 { "HITACHI CDR-8335" , NULL },
75 { "HITACHI CDR-8435" , NULL },
76 { "Toshiba CD-ROM XM-6202B" , NULL },
77 { "TOSHIBA CD-ROM XM-1702BC", NULL },
78 { "CD-532E-A" , NULL },
79 { "E-IDE CD-ROM CR-840", NULL },
80 { "CD-ROM Drive/F5A", NULL },
81 { "WPI CDD-820", NULL },
82 { "SAMSUNG CD-ROM SC-148C", NULL },
83 { "SAMSUNG CD-ROM SC", NULL },
84 { "ATAPI CD-ROM DRIVE 40X MAXIMUM", NULL },
85 { "_NEC DV5800A", NULL },
86 { "SAMSUNG CD-ROM SN-124", "N001" },
87 { "Seagate STT20000A", NULL },
88 { "CD-ROM CDR_U200", "1.09" },
94 * ide_dma_intr - IDE DMA interrupt handler
95 * @drive: the drive the interrupt is for
97 * Handle an interrupt completing a read/write DMA transfer on an
101 ide_startstop_t ide_dma_intr (ide_drive_t *drive)
103 u8 stat = 0, dma_stat = 0;
105 dma_stat = drive->hwif->dma_ops->dma_end(drive);
106 stat = ide_read_status(drive);
108 if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
110 struct request *rq = HWGROUP(drive)->rq;
112 task_end_request(drive, rq, stat);
115 printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n",
116 drive->name, dma_stat);
118 return ide_error(drive, "dma_intr", stat);
121 EXPORT_SYMBOL_GPL(ide_dma_intr);
123 static int ide_dma_good_drive(ide_drive_t *drive)
125 return ide_in_drive_list(drive->id, drive_whitelist);
129 * ide_build_sglist - map IDE scatter gather for DMA I/O
130 * @drive: the drive to build the DMA table for
131 * @rq: the request holding the sg list
133 * Perform the DMA mapping magic necessary to access the source or
134 * target buffers of a request via DMA. The lower layers of the
135 * kernel provide the necessary cache management so that we can
136 * operate in a portable fashion.
139 int ide_build_sglist(ide_drive_t *drive, struct request *rq)
141 ide_hwif_t *hwif = HWIF(drive);
142 struct scatterlist *sg = hwif->sg_table;
144 ide_map_sg(drive, rq);
146 if (rq_data_dir(rq) == READ)
147 hwif->sg_dma_direction = DMA_FROM_DEVICE;
149 hwif->sg_dma_direction = DMA_TO_DEVICE;
151 return dma_map_sg(hwif->dev, sg, hwif->sg_nents,
152 hwif->sg_dma_direction);
155 EXPORT_SYMBOL_GPL(ide_build_sglist);
157 #ifdef CONFIG_BLK_DEV_IDEDMA_SFF
159 * ide_build_dmatable - build IDE DMA table
161 * ide_build_dmatable() prepares a dma request. We map the command
162 * to get the pci bus addresses of the buffers and then build up
163 * the PRD table that the IDE layer wants to be fed. The code
164 * knows about the 64K wrap bug in the CS5530.
166 * Returns the number of built PRD entries if all went okay,
167 * returns 0 otherwise.
169 * May also be invoked from trm290.c
172 int ide_build_dmatable (ide_drive_t *drive, struct request *rq)
174 ide_hwif_t *hwif = HWIF(drive);
175 unsigned int *table = hwif->dmatable_cpu;
176 unsigned int is_trm290 = (hwif->chipset == ide_trm290) ? 1 : 0;
177 unsigned int count = 0;
179 struct scatterlist *sg;
181 hwif->sg_nents = i = ide_build_sglist(drive, rq);
191 cur_addr = sg_dma_address(sg);
192 cur_len = sg_dma_len(sg);
195 * Fill in the dma table, without crossing any 64kB boundaries.
196 * Most hardware requires 16-bit alignment of all blocks,
197 * but the trm290 requires 32-bit alignment.
201 if (count++ >= PRD_ENTRIES) {
202 printk(KERN_ERR "%s: DMA table too small\n", drive->name);
203 goto use_pio_instead;
205 u32 xcount, bcount = 0x10000 - (cur_addr & 0xffff);
207 if (bcount > cur_len)
209 *table++ = cpu_to_le32(cur_addr);
210 xcount = bcount & 0xffff;
212 xcount = ((xcount >> 2) - 1) << 16;
213 if (xcount == 0x0000) {
215 * Most chipsets correctly interpret a length of 0x0000 as 64KB,
216 * but at least one (e.g. CS5530) misinterprets it as zero (!).
217 * So here we break the 64KB entry into two 32KB entries instead.
219 if (count++ >= PRD_ENTRIES) {
220 printk(KERN_ERR "%s: DMA table too small\n", drive->name);
221 goto use_pio_instead;
223 *table++ = cpu_to_le32(0x8000);
224 *table++ = cpu_to_le32(cur_addr + 0x8000);
227 *table++ = cpu_to_le32(xcount);
239 *--table |= cpu_to_le32(0x80000000);
243 printk(KERN_ERR "%s: empty DMA table?\n", drive->name);
246 ide_destroy_dmatable(drive);
248 return 0; /* revert to PIO for this request */
251 EXPORT_SYMBOL_GPL(ide_build_dmatable);
255 * ide_destroy_dmatable - clean up DMA mapping
256 * @drive: The drive to unmap
258 * Teardown mappings after DMA has completed. This must be called
259 * after the completion of each use of ide_build_dmatable and before
260 * the next use of ide_build_dmatable. Failure to do so will cause
261 * an oops as only one mapping can be live for each target at a given
265 void ide_destroy_dmatable (ide_drive_t *drive)
267 ide_hwif_t *hwif = drive->hwif;
269 dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->sg_nents,
270 hwif->sg_dma_direction);
273 EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
275 #ifdef CONFIG_BLK_DEV_IDEDMA_SFF
277 * config_drive_for_dma - attempt to activate IDE DMA
278 * @drive: the drive to place in DMA mode
280 * If the drive supports at least mode 2 DMA or UDMA of any kind
281 * then attempt to place it into DMA mode. Drives that are known to
282 * support DMA but predate the DMA properties or that are known
283 * to have DMA handling bugs are also set up appropriately based
284 * on the good/bad drive lists.
287 static int config_drive_for_dma (ide_drive_t *drive)
289 ide_hwif_t *hwif = drive->hwif;
290 struct hd_driveid *id = drive->id;
292 if (drive->media != ide_disk) {
293 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA)
298 * Enable DMA on any drive that has
299 * UltraDMA (mode 0/1/2/3/4/5/6) enabled
301 if ((id->field_valid & 4) && ((id->dma_ultra >> 8) & 0x7f))
305 * Enable DMA on any drive that has mode2 DMA
306 * (multi or single) enabled
308 if (id->field_valid & 2) /* regular DMA */
309 if ((id->dma_mword & 0x404) == 0x404 ||
310 (id->dma_1word & 0x404) == 0x404)
313 /* Consult the list of known "good" drives */
314 if (ide_dma_good_drive(drive))
321 * dma_timer_expiry - handle a DMA timeout
322 * @drive: Drive that timed out
324 * An IDE DMA transfer timed out. In the event of an error we ask
325 * the driver to resolve the problem, if a DMA transfer is still
326 * in progress we continue to wait (arguably we need to add a
327 * secondary 'I don't care what the drive thinks' timeout here)
328 * Finally if we have an interrupt we let it complete the I/O.
329 * But only one time - we clear expiry and if it's still not
330 * completed after WAIT_CMD, we error and retry in PIO.
331 * This can occur if an interrupt is lost or due to hang or bugs.
334 static int dma_timer_expiry (ide_drive_t *drive)
336 ide_hwif_t *hwif = HWIF(drive);
337 u8 dma_stat = hwif->INB(hwif->dma_status);
339 printk(KERN_WARNING "%s: dma_timer_expiry: dma status == 0x%02x\n",
340 drive->name, dma_stat);
342 if ((dma_stat & 0x18) == 0x18) /* BUSY Stupid Early Timer !! */
345 HWGROUP(drive)->expiry = NULL; /* one free ride for now */
347 /* 1 dmaing, 2 error, 4 intr */
348 if (dma_stat & 2) /* ERROR */
351 if (dma_stat & 1) /* DMAing */
354 if (dma_stat & 4) /* Got an Interrupt */
357 return 0; /* Status is unknown -- reset the bus */
361 * ide_dma_host_set - Enable/disable DMA on a host
362 * @drive: drive to control
364 * Enable/disable DMA on an IDE controller following generic
365 * bus-mastering IDE controller behaviour.
368 void ide_dma_host_set(ide_drive_t *drive, int on)
370 ide_hwif_t *hwif = HWIF(drive);
371 u8 unit = (drive->select.b.unit & 0x01);
372 u8 dma_stat = hwif->INB(hwif->dma_status);
375 dma_stat |= (1 << (5 + unit));
377 dma_stat &= ~(1 << (5 + unit));
379 hwif->OUTB(dma_stat, hwif->dma_status);
382 EXPORT_SYMBOL_GPL(ide_dma_host_set);
383 #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */
386 * ide_dma_off_quietly - Generic DMA kill
387 * @drive: drive to control
389 * Turn off the current DMA on this IDE controller.
392 void ide_dma_off_quietly(ide_drive_t *drive)
394 drive->using_dma = 0;
395 ide_toggle_bounce(drive, 0);
397 drive->hwif->dma_ops->dma_host_set(drive, 0);
400 EXPORT_SYMBOL(ide_dma_off_quietly);
403 * ide_dma_off - disable DMA on a device
404 * @drive: drive to disable DMA on
406 * Disable IDE DMA for a device on this IDE controller.
407 * Inform the user that DMA has been disabled.
410 void ide_dma_off(ide_drive_t *drive)
412 printk(KERN_INFO "%s: DMA disabled\n", drive->name);
413 ide_dma_off_quietly(drive);
416 EXPORT_SYMBOL(ide_dma_off);
419 * ide_dma_on - Enable DMA on a device
420 * @drive: drive to enable DMA on
422 * Enable IDE DMA for a device on this IDE controller.
425 void ide_dma_on(ide_drive_t *drive)
427 drive->using_dma = 1;
428 ide_toggle_bounce(drive, 1);
430 drive->hwif->dma_ops->dma_host_set(drive, 1);
433 #ifdef CONFIG_BLK_DEV_IDEDMA_SFF
435 * ide_dma_setup - begin a DMA phase
436 * @drive: target device
438 * Build an IDE DMA PRD (IDE speak for scatter gather table)
439 * and then set up the DMA transfer registers for a device
440 * that follows generic IDE PCI DMA behaviour. Controllers can
441 * override this function if they need to
443 * Returns 0 on success. If a PIO fallback is required then 1
447 int ide_dma_setup(ide_drive_t *drive)
449 ide_hwif_t *hwif = drive->hwif;
450 struct request *rq = HWGROUP(drive)->rq;
451 unsigned int reading;
459 /* fall back to pio! */
460 if (!ide_build_dmatable(drive, rq)) {
461 ide_map_sg(drive, rq);
467 writel(hwif->dmatable_dma, (void __iomem *)hwif->dma_prdtable);
469 outl(hwif->dmatable_dma, hwif->dma_prdtable);
472 hwif->OUTB(reading, hwif->dma_command);
474 /* read dma_status for INTR & ERROR flags */
475 dma_stat = hwif->INB(hwif->dma_status);
477 /* clear INTR & ERROR flags */
478 hwif->OUTB(dma_stat|6, hwif->dma_status);
479 drive->waiting_for_dma = 1;
483 EXPORT_SYMBOL_GPL(ide_dma_setup);
485 void ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
487 /* issue cmd to drive */
488 ide_execute_command(drive, command, &ide_dma_intr, 2*WAIT_CMD, dma_timer_expiry);
490 EXPORT_SYMBOL_GPL(ide_dma_exec_cmd);
492 void ide_dma_start(ide_drive_t *drive)
494 ide_hwif_t *hwif = HWIF(drive);
495 u8 dma_cmd = hwif->INB(hwif->dma_command);
497 /* Note that this is done *after* the cmd has
498 * been issued to the drive, as per the BM-IDE spec.
499 * The Promise Ultra33 doesn't work correctly when
500 * we do this part before issuing the drive cmd.
503 hwif->OUTB(dma_cmd|1, hwif->dma_command);
508 EXPORT_SYMBOL_GPL(ide_dma_start);
510 /* returns 1 on error, 0 otherwise */
511 int __ide_dma_end (ide_drive_t *drive)
513 ide_hwif_t *hwif = HWIF(drive);
514 u8 dma_stat = 0, dma_cmd = 0;
516 drive->waiting_for_dma = 0;
517 /* get dma_command mode */
518 dma_cmd = hwif->INB(hwif->dma_command);
520 hwif->OUTB(dma_cmd&~1, hwif->dma_command);
522 dma_stat = hwif->INB(hwif->dma_status);
523 /* clear the INTR & ERROR bits */
524 hwif->OUTB(dma_stat|6, hwif->dma_status);
525 /* purge DMA mappings */
526 ide_destroy_dmatable(drive);
527 /* verify good DMA status */
530 return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0;
533 EXPORT_SYMBOL(__ide_dma_end);
535 /* returns 1 if dma irq issued, 0 otherwise */
536 int ide_dma_test_irq(ide_drive_t *drive)
538 ide_hwif_t *hwif = HWIF(drive);
539 u8 dma_stat = hwif->INB(hwif->dma_status);
541 /* return 1 if INTR asserted */
542 if ((dma_stat & 4) == 4)
544 if (!drive->waiting_for_dma)
545 printk(KERN_WARNING "%s: (%s) called while not waiting\n",
546 drive->name, __func__);
549 EXPORT_SYMBOL_GPL(ide_dma_test_irq);
551 static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
552 #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */
554 int __ide_dma_bad_drive (ide_drive_t *drive)
556 struct hd_driveid *id = drive->id;
558 int blacklist = ide_in_drive_list(id, drive_blacklist);
560 printk(KERN_WARNING "%s: Disabling (U)DMA for %s (blacklisted)\n",
561 drive->name, id->model);
567 EXPORT_SYMBOL(__ide_dma_bad_drive);
569 static const u8 xfer_mode_bases[] = {
575 static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode)
577 struct hd_driveid *id = drive->id;
578 ide_hwif_t *hwif = drive->hwif;
579 const struct ide_port_ops *port_ops = hwif->port_ops;
580 unsigned int mask = 0;
584 if ((id->field_valid & 4) == 0)
587 if (port_ops && port_ops->udma_filter)
588 mask = port_ops->udma_filter(drive);
590 mask = hwif->ultra_mask;
591 mask &= id->dma_ultra;
594 * avoid false cable warning from eighty_ninty_three()
596 if (req_mode > XFER_UDMA_2) {
597 if ((mask & 0x78) && (eighty_ninty_three(drive) == 0))
602 if ((id->field_valid & 2) == 0)
604 if (port_ops && port_ops->mdma_filter)
605 mask = port_ops->mdma_filter(drive);
607 mask = hwif->mwdma_mask;
608 mask &= id->dma_mword;
611 if (id->field_valid & 2) {
612 mask = id->dma_1word & hwif->swdma_mask;
613 } else if (id->tDMA) {
615 * ide_fix_driveid() doesn't convert ->tDMA to the
616 * CPU endianness so we need to do it here
618 u8 mode = le16_to_cpu(id->tDMA);
621 * if the mode is valid convert it to the mask
622 * (the maximum allowed mode is XFER_SW_DMA_2)
625 mask = ((2 << mode) - 1) & hwif->swdma_mask;
637 * ide_find_dma_mode - compute DMA speed
639 * @req_mode: requested mode
641 * Checks the drive/host capabilities and finds the speed to use for
642 * the DMA transfer. The speed is then limited by the requested mode.
644 * Returns 0 if the drive/host combination is incapable of DMA transfers
645 * or if the requested mode is not a DMA mode.
648 u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode)
650 ide_hwif_t *hwif = drive->hwif;
655 if (drive->media != ide_disk) {
656 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA)
660 for (i = 0; i < ARRAY_SIZE(xfer_mode_bases); i++) {
661 if (req_mode < xfer_mode_bases[i])
663 mask = ide_get_mode_mask(drive, xfer_mode_bases[i], req_mode);
666 mode = xfer_mode_bases[i] + x;
671 if (hwif->chipset == ide_acorn && mode == 0) {
675 if (ide_dma_good_drive(drive) && drive->id->eide_dma_time < 150)
676 mode = XFER_MW_DMA_1;
679 mode = min(mode, req_mode);
681 printk(KERN_INFO "%s: %s mode selected\n", drive->name,
682 mode ? ide_xfer_verbose(mode) : "no DMA");
687 EXPORT_SYMBOL_GPL(ide_find_dma_mode);
689 static int ide_tune_dma(ide_drive_t *drive)
691 ide_hwif_t *hwif = drive->hwif;
694 if (noautodma || drive->nodma || (drive->id->capability & 1) == 0)
697 /* consult the list of known "bad" drives */
698 if (__ide_dma_bad_drive(drive))
701 if (ide_id_dma_bug(drive))
704 if (hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA)
705 return config_drive_for_dma(drive);
707 speed = ide_max_dma_mode(drive);
712 if (ide_set_dma_mode(drive, speed))
718 static int ide_dma_check(ide_drive_t *drive)
720 ide_hwif_t *hwif = drive->hwif;
721 int vdma = (hwif->host_flags & IDE_HFLAG_VDMA)? 1 : 0;
723 if (!vdma && ide_tune_dma(drive))
726 /* TODO: always do PIO fallback */
727 if (hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA)
730 ide_set_max_pio(drive);
732 return vdma ? 0 : -1;
735 int ide_id_dma_bug(ide_drive_t *drive)
737 struct hd_driveid *id = drive->id;
739 if (id->field_valid & 4) {
740 if ((id->dma_ultra >> 8) && (id->dma_mword >> 8))
742 } else if (id->field_valid & 2) {
743 if ((id->dma_mword >> 8) && (id->dma_1word >> 8))
748 printk(KERN_ERR "%s: bad DMA info in identify block\n", drive->name);
752 int ide_set_dma(ide_drive_t *drive)
757 * Force DMAing for the beginning of the check.
758 * Some chipsets appear to do interesting
759 * things, if not checked and cleared.
762 ide_dma_off_quietly(drive);
764 rc = ide_dma_check(drive);
773 void ide_check_dma_crc(ide_drive_t *drive)
777 ide_dma_off_quietly(drive);
778 drive->crc_count = 0;
779 mode = drive->current_speed;
781 * Don't try non Ultra-DMA modes without iCRC's. Force the
782 * device to PIO and make the user enable SWDMA/MWDMA modes.
784 if (mode > XFER_UDMA_0 && mode <= XFER_UDMA_7)
788 ide_set_xfer_rate(drive, mode);
789 if (drive->current_speed >= XFER_SW_DMA_0)
793 #ifdef CONFIG_BLK_DEV_IDEDMA_SFF
794 void ide_dma_lost_irq (ide_drive_t *drive)
796 printk("%s: DMA interrupt recovery\n", drive->name);
799 EXPORT_SYMBOL(ide_dma_lost_irq);
801 void ide_dma_timeout (ide_drive_t *drive)
803 ide_hwif_t *hwif = HWIF(drive);
805 printk(KERN_ERR "%s: timeout waiting for DMA\n", drive->name);
807 if (hwif->dma_ops->dma_test_irq(drive))
810 hwif->dma_ops->dma_end(drive);
813 EXPORT_SYMBOL(ide_dma_timeout);
815 void ide_release_dma_engine(ide_hwif_t *hwif)
817 if (hwif->dmatable_cpu) {
818 struct pci_dev *pdev = to_pci_dev(hwif->dev);
820 pci_free_consistent(pdev, PRD_ENTRIES * PRD_BYTES,
821 hwif->dmatable_cpu, hwif->dmatable_dma);
822 hwif->dmatable_cpu = NULL;
826 int ide_allocate_dma_engine(ide_hwif_t *hwif)
828 struct pci_dev *pdev = to_pci_dev(hwif->dev);
830 hwif->dmatable_cpu = pci_alloc_consistent(pdev,
831 PRD_ENTRIES * PRD_BYTES,
832 &hwif->dmatable_dma);
834 if (hwif->dmatable_cpu)
837 printk(KERN_ERR "%s: -- Error, unable to allocate DMA table.\n",
842 EXPORT_SYMBOL_GPL(ide_allocate_dma_engine);
844 static const struct ide_dma_ops sff_dma_ops = {
845 .dma_host_set = ide_dma_host_set,
846 .dma_setup = ide_dma_setup,
847 .dma_exec_cmd = ide_dma_exec_cmd,
848 .dma_start = ide_dma_start,
849 .dma_end = __ide_dma_end,
850 .dma_test_irq = ide_dma_test_irq,
851 .dma_timeout = ide_dma_timeout,
852 .dma_lost_irq = ide_dma_lost_irq,
855 void ide_setup_dma(ide_hwif_t *hwif, unsigned long base)
857 hwif->dma_base = base;
859 if (!hwif->dma_command)
860 hwif->dma_command = hwif->dma_base + 0;
861 if (!hwif->dma_vendor1)
862 hwif->dma_vendor1 = hwif->dma_base + 1;
863 if (!hwif->dma_status)
864 hwif->dma_status = hwif->dma_base + 2;
865 if (!hwif->dma_vendor3)
866 hwif->dma_vendor3 = hwif->dma_base + 3;
867 if (!hwif->dma_prdtable)
868 hwif->dma_prdtable = hwif->dma_base + 4;
870 hwif->dma_ops = &sff_dma_ops;
873 EXPORT_SYMBOL_GPL(ide_setup_dma);
874 #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */