aboutsummaryrefslogtreecommitdiff
path: root/drivers/ide/sgiioc4.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 10:05:43 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 10:05:43 -0700
commit83826dc505e6c6f432332dd45681be4bb71635ce (patch)
tree761f6321c3c5ef94e63344e948e684313d61b88a /drivers/ide/sgiioc4.c
parentffd14285142cb398b2b613e27f71be415d28072e (diff)
parentbf717c0a2e18dbe82eeb28e57b0abede3cdf45d6 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (70 commits) ide: keep track of number of bytes instead of sectors in struct ide_cmd ide: remove ide_execute_pkt_cmd() (v2) ide: add ->dma_timer_expiry method and remove ->dma_exec_cmd one (v2) ide: set hwif->expiry prior to calling [__]ide_set_handler() ide: use do_rw_taskfile() for ATA_CMD_PACKET commands ide: pass command to ide_map_sg() ide: remove ide_end_request() ide: use ide_end_rq() in ide_complete_rq() ide: pass number of bytes to complete to ide_complete_rq() ide: remove BUG() from ide_complete_rq() ide: move rq->errors quirk out from ide_end_request() ide: pass error value to ide_complete_rq() ide: sanitize ide_end_rq() ide: add ide_end_rq() (v2) ide: make ide_special_rq() BUG() on unknown requests ide: sanitize ide_finish_cmd() ide: use ide_complete_cmd() for REQ_UNPARK_HEADS ide: use ide_complete_cmd() for head unload commands ide: task_error() -> task_error_cmd() ide: unify exit paths in task_pio_intr() ...
Diffstat (limited to 'drivers/ide/sgiioc4.c')
-rw-r--r--drivers/ide/sgiioc4.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c
index fdb9d703769..b12de8346c7 100644
--- a/drivers/ide/sgiioc4.c
+++ b/drivers/ide/sgiioc4.c
@@ -424,20 +424,13 @@ sgiioc4_configure_for_dma(int dma_direction, ide_drive_t * drive)
/* | Upper 32 bits - Zero |EOL| 15 unused | 16 Bit Length| */
/* --------------------------------------------------------------------- */
/* Creates the scatter gather list, DMA Table */
-static unsigned int
-sgiioc4_build_dma_table(ide_drive_t * drive, struct request *rq, int ddir)
+static int sgiioc4_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
{
ide_hwif_t *hwif = drive->hwif;
unsigned int *table = hwif->dmatable_cpu;
- unsigned int count = 0, i = 1;
- struct scatterlist *sg;
+ unsigned int count = 0, i = cmd->sg_nents;
+ struct scatterlist *sg = hwif->sg_table;
- hwif->sg_nents = i = ide_build_sglist(drive, rq);
-
- if (!i)
- return 0; /* sglist of length Zero */
-
- sg = hwif->sg_table;
while (i && sg_dma_len(sg)) {
dma_addr_t cur_addr;
int cur_len;
@@ -490,24 +483,18 @@ use_pio_instead:
return 0; /* revert to PIO for this request */
}
-static int sgiioc4_dma_setup(ide_drive_t *drive)
+static int sgiioc4_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
{
- struct request *rq = drive->hwif->rq;
- unsigned int count = 0;
int ddir;
+ u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE);
- if (rq_data_dir(rq))
- ddir = PCI_DMA_TODEVICE;
- else
- ddir = PCI_DMA_FROMDEVICE;
-
- if (!(count = sgiioc4_build_dma_table(drive, rq, ddir))) {
+ if (sgiioc4_build_dmatable(drive, cmd) == 0) {
/* try PIO instead of DMA */
- ide_map_sg(drive, rq);
+ ide_map_sg(drive, cmd);
return 1;
}
- if (rq_data_dir(rq))
+ if (write)
/* Writes TO the IOC4 FROM Main Memory */
ddir = IOC4_DMA_READ;
else
@@ -557,6 +544,7 @@ static const struct ide_port_info sgiioc4_port_info __devinitconst = {
.port_ops = &sgiioc4_port_ops,
.dma_ops = &sgiioc4_dma_ops,
.host_flags = IDE_HFLAG_MMIO,
+ .irq_flags = IRQF_SHARED,
.mwdma_mask = ATA_MWDMA2_ONLY,
};