Commit b6308ee0 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz
Browse files

ide: move command related fields from ide_hwif_t to struct ide_cmd



* Move command related fields from ide_hwif_t to struct ide_cmd.

* Make ide_init_sg_cmd() take command and sectors number as arguments.

There should be no functional changes caused by this patch.

Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent adb1af98
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -215,7 +215,7 @@ static int auide_build_dmatable(ide_drive_t *drive)
	struct request *rq = hwif->rq;
	_auide_hwif *ahwif = &auide_hwif;
	struct scatterlist *sg;
	int i = hwif->sg_nents, iswrite, count = 0;
	int i = hwif->cmd.sg_nents, iswrite, count = 0;

	iswrite = (rq_data_dir(rq) == WRITE);
	/* Save for interrupt context */
+1 −1
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ static int icside_dma_setup(ide_drive_t *drive)
	 * Tell the DMA engine about the SG table and
	 * data direction.
	 */
	set_dma_sg(ec->dma, hwif->sg_table, hwif->sg_nents);
	set_dma_sg(ec->dma, hwif->sg_table, hwif->cmd.sg_nents);
	set_dma_mode(ec->dma, dma_mode);

	drive->waiting_for_dma = 1;
+6 −6
Original line number Diff line number Diff line
@@ -104,14 +104,14 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
			lba48 = 0;
	}

	if (!dma) {
		ide_init_sg_cmd(drive, rq);
		ide_map_sg(drive, rq);
	}

	memset(&cmd, 0, sizeof(cmd));
	cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;

	if (dma == 0) {
		ide_init_sg_cmd(&cmd, nsectors);
		ide_map_sg(drive, rq);
	}

	if (drive->dev_flags & IDE_DFLAG_LBA) {
		if (lba48) {
			pr_debug("%s: LBA=0x%012llx\n", drive->name,
@@ -170,7 +170,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
		/* fallback to PIO */
		cmd.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK;
		ide_tf_set_cmd(drive, &cmd, 0);
		ide_init_sg_cmd(drive, rq);
		ide_init_sg_cmd(&cmd, nsectors);
		rc = do_rw_taskfile(drive, &cmd);
	}

+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ int ide_build_dmatable(ide_drive_t *drive, struct request *rq)
	struct scatterlist *sg;
	u8 is_trm290 = !!(hwif->host_flags & IDE_HFLAG_TRM290);

	for_each_sg(hwif->sg_table, sg, hwif->sg_nents, i) {
	for_each_sg(hwif->sg_table, sg, hwif->cmd.sg_nents, i) {
		u32 cur_addr, cur_len, xcount, bcount;

		cur_addr = sg_dma_address(sg);
+9 −7
Original line number Diff line number Diff line
@@ -128,21 +128,22 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq)
{
	ide_hwif_t *hwif = drive->hwif;
	struct scatterlist *sg = hwif->sg_table;
	struct ide_cmd *cmd = &hwif->cmd;
	int i;

	ide_map_sg(drive, rq);

	if (rq_data_dir(rq) == READ)
		hwif->sg_dma_direction = DMA_FROM_DEVICE;
		cmd->sg_dma_direction = DMA_FROM_DEVICE;
	else
		hwif->sg_dma_direction = DMA_TO_DEVICE;
		cmd->sg_dma_direction = DMA_TO_DEVICE;

	i = dma_map_sg(hwif->dev, sg, hwif->sg_nents, hwif->sg_dma_direction);
	i = dma_map_sg(hwif->dev, sg, cmd->sg_nents, cmd->sg_dma_direction);
	if (i == 0)
		ide_map_sg(drive, rq);
	else {
		hwif->orig_sg_nents = hwif->sg_nents;
		hwif->sg_nents = i;
		cmd->orig_sg_nents = cmd->sg_nents;
		cmd->sg_nents = i;
	}

	return i;
@@ -162,9 +163,10 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq)
void ide_destroy_dmatable(ide_drive_t *drive)
{
	ide_hwif_t *hwif = drive->hwif;
	struct ide_cmd *cmd = &hwif->cmd;

	dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->orig_sg_nents,
		     hwif->sg_dma_direction);
	dma_unmap_sg(hwif->dev, hwif->sg_table, cmd->orig_sg_nents,
		     cmd->sg_dma_direction);
}
EXPORT_SYMBOL_GPL(ide_destroy_dmatable);

Loading