ide: pass command to ide_map_sg()
* Set IDE_TFLAG_WRITE flag and ->rq also for ATA_CMD_PACKET commands. * Pass command to ->dma_setup method and update all its implementations accordingly. * Pass command instead of request to ide_build_sglist(), *_build_dmatable() and ide_map_sg(). While at it: * Fix scc_dma_setup() documentation + use ATA_DMA_WR define. * Rename sgiioc4_build_dma_table() to sgiioc4_build_dmatable(), change return value type to 'int' and drop unused 'ddir' argument. * Do some minor cleanups in [tx4939]ide_dma_setup(). There should be no functional changes caused by this patch. Acked-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
@@ -424,12 +424,11 @@ 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 = hwif->cmd.sg_nents;
|
||||
unsigned int count = 0, i = cmd->sg_nents;
|
||||
struct scatterlist *sg = hwif->sg_table;
|
||||
|
||||
while (i && sg_dma_len(sg)) {
|
||||
@@ -484,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
|
||||
|
Reference in New Issue
Block a user