Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0dfb991c authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz
Browse files

ide: use ata_tf_protocols enums



* Add IDE_TFLAG_MULTI_PIO taskfile flag and set it for commands
  using multi-PIO protocol.

* Use ata_tf_protocols enums instead of TASKFILE_* defines to
  denote command's protocol and then rename ->data_phase field
  to ->protocol.

* Remove no longer needed <linux/hdreg.h> includes.

There should be no functional changes caused by this patch.

Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 04d09b0e
Loading
Loading
Loading
Loading
+13 −21
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@
#include <linux/mutex.h>
#include <linux/leds.h>
#include <linux/ide.h>
#include <linux/hdreg.h>

#include <asm/byteorder.h>
#include <asm/irq.h>
@@ -53,15 +52,6 @@ static const u8 ide_rw_cmds[] = {
	ATA_CMD_WRITE_EXT,
};

static const u8 ide_data_phases[] = {
	TASKFILE_MULTI_IN,
	TASKFILE_MULTI_OUT,
	TASKFILE_IN,
	TASKFILE_OUT,
	TASKFILE_IN_DMA,
	TASKFILE_OUT_DMA,
};

static void ide_tf_set_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 dma)
{
	u8 index, lba48, write;
@@ -69,17 +59,19 @@ static void ide_tf_set_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 dma)
	lba48 = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 2 : 0;
	write = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0;

	if (dma)
	if (dma) {
		cmd->protocol = ATA_PROT_DMA;
		index = 8;
	else
		index = drive->mult_count ? 0 : 4;
	} else {
		cmd->protocol = ATA_PROT_PIO;
		if (drive->mult_count) {
			cmd->tf_flags |= IDE_TFLAG_MULTI_PIO;
			index = 0;
		} else
			index = 4;
	}

	cmd->tf.command = ide_rw_cmds[index + lba48 + write];

	if (dma)
		index = 8; /* fixup index */

	cmd->data_phase = ide_data_phases[index / 2 + write];
}

/*
@@ -403,7 +395,7 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
		cmd->tf.command = ATA_CMD_FLUSH;
	cmd->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE |
			IDE_TFLAG_DYN;
	cmd->data_phase = TASKFILE_NO_DATA;
	cmd->protocol = ATA_PROT_NODATA;

	rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
	rq->cmd_flags |= REQ_SOFTBARRIER;
+2 −3
Original line number Diff line number Diff line
#include <linux/kernel.h>
#include <linux/ide.h>
#include <linux/hdreg.h>

#include "ide-disk.h"

@@ -31,7 +30,7 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd)
	tf->lbah    = ATA_SMART_LBAH_PASS;
	tf->command = ATA_CMD_SMART;
	cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
	cmd.data_phase	= TASKFILE_IN;
	cmd.protocol = ATA_PROT_PIO;

	return ide_raw_taskfile(drive, &cmd, buf, 1);
}
+2 −9
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/ide.h>
#include <linux/hdreg.h>
#include <linux/completion.h>
#include <linux/reboot.h>
#include <linux/cdrom.h>
@@ -220,7 +219,7 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive)
	struct ide_cmd cmd;

	memset(&cmd, 0, sizeof(cmd));
	cmd.data_phase = TASKFILE_NO_DATA;
	cmd.protocol = ATA_PROT_NODATA;

	if (s->b.set_geometry) {
		s->b.set_geometry = 0;
@@ -314,15 +313,9 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
	struct ide_cmd *cmd = rq->special;

	if (cmd) {
		switch (cmd->data_phase) {
		case TASKFILE_MULTI_OUT:
		case TASKFILE_OUT:
		case TASKFILE_MULTI_IN:
		case TASKFILE_IN:
		if (cmd->protocol == ATA_PROT_PIO) {
			ide_init_sg_cmd(cmd, rq->nr_sectors);
			ide_map_sg(drive, rq);
		default:
			break;
		}

		return do_rw_taskfile(drive, cmd);
+1 −1
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
			       IDE_TFLAG_IN_NSECT;
	}
	tf->command = args[0];
	cmd.data_phase = args[3] ? TASKFILE_IN : TASKFILE_NO_DATA;
	cmd.protocol = args[3] ? ATA_PROT_PIO : ATA_PROT_NODATA;

	if (args[3]) {
		cmd.tf_flags |= IDE_TFLAG_IO_16BIT;
+2 −2
Original line number Diff line number Diff line
#include <linux/kernel.h>
#include <linux/ide.h>
#include <linux/hdreg.h>
#include <linux/jiffies.h>
#include <linux/blkdev.h>

@@ -80,8 +79,9 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq)
		tf->command = ATA_CMD_CHK_POWER;

	cmd.tf_flags |= IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
	cmd.protocol = ATA_PROT_NODATA;

	cmd.rq = rq;
	cmd.data_phase = TASKFILE_NO_DATA;

	return do_rw_taskfile(drive, &cmd);
}
Loading