ide: pass command instead of request to ide_pio_datablock()
* Add IDE_TFLAG_FS taskfile flag and set it for REQ_TYPE_FS requests.
* Convert ->{in,out}put_data methods to take command instead of request
  as an argument.  Then convert pre_task_out_intr(), task_end_request(),
  task_error(), task_in_unexpected(), ide_pio_sector(), ide_pio_multi()
  and ide_pio_datablock() in similar way.
* Rename task_end_request() to ide_finish_cmd().
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
	
	
This commit is contained in:
		
					parent
					
						
							
								22aa4b32a1
							
						
					
				
			
			
				commit
				
					
						adb1af9803
					
				
			
		
					 12 changed files with 76 additions and 75 deletions
				
			
		| 
						 | 
				
			
			@ -143,7 +143,7 @@ static void apply_timings(const u8 chipselect, const u8 pio,
 | 
			
		|||
	set_smc_timings(chipselect, cycle, setup, pulse, data_float, use_iordy);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void at91_ide_input_data(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void at91_ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
				void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	ide_hwif_t *hwif = drive->hwif;
 | 
			
		||||
| 
						 | 
				
			
			@ -160,7 +160,7 @@ static void at91_ide_input_data(ide_drive_t *drive, struct request *rq,
 | 
			
		|||
	leave_16bit(chipselect, mode);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void at91_ide_output_data(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void at91_ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
				 void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	ide_hwif_t *hwif = drive->hwif;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -86,13 +86,13 @@ void auide_outsw(unsigned long port, void *addr, u32 count)
 | 
			
		|||
	ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void au1xxx_input_data(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void au1xxx_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
			      void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	auide_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void au1xxx_output_data(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void au1xxx_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
			       void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	auide_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,23 +62,23 @@ static void falconide_get_lock(irq_handler_t handler, void *data)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void falconide_input_data(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void falconide_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
				 void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long data_addr = drive->hwif->io_ports.data_addr;
 | 
			
		||||
 | 
			
		||||
	if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
 | 
			
		||||
	if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS))
 | 
			
		||||
		return insw(data_addr, buf, (len + 1) / 2);
 | 
			
		||||
 | 
			
		||||
	raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void falconide_output_data(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void falconide_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
				  void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long data_addr = drive->hwif->io_ports.data_addr;
 | 
			
		||||
 | 
			
		||||
	if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
 | 
			
		||||
	if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS))
 | 
			
		||||
		return outsw(data_addr, buf, (len + 1) / 2);
 | 
			
		||||
 | 
			
		||||
	raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -156,6 +156,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
 | 
			
		|||
		tf->device = head;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cmd.tf_flags |= IDE_TFLAG_FS;
 | 
			
		||||
 | 
			
		||||
	if (rq_data_dir(rq))
 | 
			
		||||
		cmd.tf_flags |= IDE_TFLAG_WRITE;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -96,9 +96,9 @@ ide_startstop_t ide_dma_intr(ide_drive_t *drive)
 | 
			
		|||
 | 
			
		||||
	if (OK_STAT(stat, DRIVE_READY, drive->bad_wstat | ATA_DRQ)) {
 | 
			
		||||
		if (!dma_stat) {
 | 
			
		||||
			struct request *rq = hwif->rq;
 | 
			
		||||
			struct ide_cmd *cmd = &hwif->cmd;
 | 
			
		||||
 | 
			
		||||
			task_end_request(drive, rq, stat);
 | 
			
		||||
			ide_finish_cmd(drive, cmd, stat);
 | 
			
		||||
			return ide_stopped;
 | 
			
		||||
		}
 | 
			
		||||
		printk(KERN_ERR "%s: %s: bad DMA status (0x%02x)\n",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -143,13 +143,13 @@ static void mm_insw(unsigned long addr, void *buf, u32 len)
 | 
			
		|||
		*bp = bswap(*(volatile u16 *)addr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void h8300_input_data(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void h8300_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
			     void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	mm_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void h8300_output_data(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void h8300_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
			      void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	mm_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -219,7 +219,7 @@ static void ata_vlb_sync(unsigned long port)
 | 
			
		|||
 * so if an odd len is specified, be sure that there's at least one
 | 
			
		||||
 * extra byte allocated for the buffer.
 | 
			
		||||
 */
 | 
			
		||||
void ide_input_data(ide_drive_t *drive, struct request *rq, void *buf,
 | 
			
		||||
void ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf,
 | 
			
		||||
		    unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	ide_hwif_t *hwif = drive->hwif;
 | 
			
		||||
| 
						 | 
				
			
			@ -265,7 +265,7 @@ EXPORT_SYMBOL_GPL(ide_input_data);
 | 
			
		|||
/*
 | 
			
		||||
 * This is used for most PIO data transfers *to* the IDE interface
 | 
			
		||||
 */
 | 
			
		||||
void ide_output_data(ide_drive_t *drive, struct request *rq, void *buf,
 | 
			
		||||
void ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf,
 | 
			
		||||
		     unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	ide_hwif_t *hwif = drive->hwif;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,19 +54,20 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static ide_startstop_t task_no_data_intr(ide_drive_t *);
 | 
			
		||||
static ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *);
 | 
			
		||||
static ide_startstop_t pre_task_out_intr(ide_drive_t *, struct ide_cmd *);
 | 
			
		||||
static ide_startstop_t task_in_intr(ide_drive_t *);
 | 
			
		||||
 | 
			
		||||
ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd)
 | 
			
		||||
ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
 | 
			
		||||
{
 | 
			
		||||
	ide_hwif_t *hwif = drive->hwif;
 | 
			
		||||
	struct ide_cmd *cmd = &hwif->cmd;
 | 
			
		||||
	struct ide_taskfile *tf = &cmd->tf;
 | 
			
		||||
	ide_handler_t *handler = NULL;
 | 
			
		||||
	const struct ide_tp_ops *tp_ops = hwif->tp_ops;
 | 
			
		||||
	const struct ide_dma_ops *dma_ops = hwif->dma_ops;
 | 
			
		||||
 | 
			
		||||
	if (cmd->data_phase == TASKFILE_MULTI_IN ||
 | 
			
		||||
	    cmd->data_phase == TASKFILE_MULTI_OUT) {
 | 
			
		||||
	if (orig_cmd->data_phase == TASKFILE_MULTI_IN ||
 | 
			
		||||
	    orig_cmd->data_phase == TASKFILE_MULTI_OUT) {
 | 
			
		||||
		if (!drive->mult_count) {
 | 
			
		||||
			printk(KERN_ERR "%s: multimode not set!\n",
 | 
			
		||||
					drive->name);
 | 
			
		||||
| 
						 | 
				
			
			@ -74,10 +75,10 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd)
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
 | 
			
		||||
		cmd->ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS;
 | 
			
		||||
	if (orig_cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
 | 
			
		||||
		orig_cmd->ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS;
 | 
			
		||||
 | 
			
		||||
	memcpy(&hwif->cmd, cmd, sizeof(*cmd));
 | 
			
		||||
	memcpy(cmd, orig_cmd, sizeof(*cmd));
 | 
			
		||||
 | 
			
		||||
	if ((cmd->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) {
 | 
			
		||||
		ide_tf_dump(drive->name, tf);
 | 
			
		||||
| 
						 | 
				
			
			@ -91,7 +92,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd)
 | 
			
		|||
	case TASKFILE_OUT:
 | 
			
		||||
		tp_ops->exec_command(hwif, tf->command);
 | 
			
		||||
		ndelay(400);	/* FIXME */
 | 
			
		||||
		return pre_task_out_intr(drive, cmd->rq);
 | 
			
		||||
		return pre_task_out_intr(drive, cmd);
 | 
			
		||||
	case TASKFILE_MULTI_IN:
 | 
			
		||||
	case TASKFILE_IN:
 | 
			
		||||
		handler = task_in_intr;
 | 
			
		||||
| 
						 | 
				
			
			@ -203,7 +204,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
 | 
			
		|||
	return stat;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void ide_pio_sector(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
			   unsigned int write)
 | 
			
		||||
{
 | 
			
		||||
	ide_hwif_t *hwif = drive->hwif;
 | 
			
		||||
| 
						 | 
				
			
			@ -244,9 +245,9 @@ static void ide_pio_sector(ide_drive_t *drive, struct request *rq,
 | 
			
		|||
 | 
			
		||||
	/* do the actual data transfer */
 | 
			
		||||
	if (write)
 | 
			
		||||
		hwif->tp_ops->output_data(drive, rq, buf, SECTOR_SIZE);
 | 
			
		||||
		hwif->tp_ops->output_data(drive, cmd, buf, SECTOR_SIZE);
 | 
			
		||||
	else
 | 
			
		||||
		hwif->tp_ops->input_data(drive, rq, buf, SECTOR_SIZE);
 | 
			
		||||
		hwif->tp_ops->input_data(drive, cmd, buf, SECTOR_SIZE);
 | 
			
		||||
 | 
			
		||||
	kunmap_atomic(buf, KM_BIO_SRC_IRQ);
 | 
			
		||||
#ifdef CONFIG_HIGHMEM
 | 
			
		||||
| 
						 | 
				
			
			@ -254,24 +255,23 @@ static void ide_pio_sector(ide_drive_t *drive, struct request *rq,
 | 
			
		|||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void ide_pio_multi(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void ide_pio_multi(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
			  unsigned int write)
 | 
			
		||||
{
 | 
			
		||||
	unsigned int nsect;
 | 
			
		||||
 | 
			
		||||
	nsect = min_t(unsigned int, drive->hwif->nleft, drive->mult_count);
 | 
			
		||||
	while (nsect--)
 | 
			
		||||
		ide_pio_sector(drive, rq, write);
 | 
			
		||||
		ide_pio_sector(drive, cmd, write);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void ide_pio_datablock(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
				     unsigned int write)
 | 
			
		||||
static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
			      unsigned int write)
 | 
			
		||||
{
 | 
			
		||||
	struct ide_cmd *cmd = &drive->hwif->cmd;
 | 
			
		||||
	u8 saved_io_32bit = drive->io_32bit;
 | 
			
		||||
 | 
			
		||||
	if (blk_fs_request(rq))
 | 
			
		||||
		rq->errors = 0;
 | 
			
		||||
	if (cmd->tf_flags & IDE_TFLAG_FS)
 | 
			
		||||
		cmd->rq->errors = 0;
 | 
			
		||||
 | 
			
		||||
	if (cmd->tf_flags & IDE_TFLAG_IO_16BIT)
 | 
			
		||||
		drive->io_32bit = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -281,22 +281,21 @@ static void ide_pio_datablock(ide_drive_t *drive, struct request *rq,
 | 
			
		|||
	switch (cmd->data_phase) {
 | 
			
		||||
	case TASKFILE_MULTI_IN:
 | 
			
		||||
	case TASKFILE_MULTI_OUT:
 | 
			
		||||
		ide_pio_multi(drive, rq, write);
 | 
			
		||||
		ide_pio_multi(drive, cmd, write);
 | 
			
		||||
		break;
 | 
			
		||||
	default:
 | 
			
		||||
		ide_pio_sector(drive, rq, write);
 | 
			
		||||
		ide_pio_sector(drive, cmd, write);
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	drive->io_32bit = saved_io_32bit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static ide_startstop_t task_error(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
				  const char *s, u8 stat)
 | 
			
		||||
{
 | 
			
		||||
	if (blk_fs_request(rq)) {
 | 
			
		||||
	if (cmd->tf_flags & IDE_TFLAG_FS) {
 | 
			
		||||
		ide_hwif_t *hwif = drive->hwif;
 | 
			
		||||
		struct ide_cmd *cmd = &hwif->cmd;
 | 
			
		||||
		int sectors = hwif->nsect - hwif->nleft;
 | 
			
		||||
 | 
			
		||||
		switch (cmd->data_phase) {
 | 
			
		||||
| 
						 | 
				
			
			@ -323,19 +322,17 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq,
 | 
			
		|||
	return ide_error(drive, s, stat);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
 | 
			
		||||
void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat)
 | 
			
		||||
{
 | 
			
		||||
	if (blk_fs_request(rq) == 0) {
 | 
			
		||||
		struct ide_cmd *cmd = rq->special;
 | 
			
		||||
	if ((cmd->tf_flags & IDE_TFLAG_FS) == 0) {
 | 
			
		||||
		u8 err = ide_read_error(drive);
 | 
			
		||||
 | 
			
		||||
		if (cmd)
 | 
			
		||||
			ide_complete_cmd(drive, cmd, stat, err);
 | 
			
		||||
		ide_complete_cmd(drive, cmd, stat, err);
 | 
			
		||||
		ide_complete_rq(drive, err);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ide_end_request(drive, 1, rq->nr_sectors);
 | 
			
		||||
	ide_end_request(drive, 1, cmd->rq->nr_sectors);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			@ -344,11 +341,12 @@ void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
 | 
			
		|||
 * It might be a spurious irq (shared irq), but it might be a
 | 
			
		||||
 * command that had no output.
 | 
			
		||||
 */
 | 
			
		||||
static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq, u8 stat)
 | 
			
		||||
static ide_startstop_t task_in_unexpected(ide_drive_t *drive,
 | 
			
		||||
					  struct ide_cmd *cmd, u8 stat)
 | 
			
		||||
{
 | 
			
		||||
	/* Command all done? */
 | 
			
		||||
	if (OK_STAT(stat, ATA_DRDY, ATA_BUSY)) {
 | 
			
		||||
		task_end_request(drive, rq, stat);
 | 
			
		||||
		ide_finish_cmd(drive, cmd, stat);
 | 
			
		||||
		return ide_stopped;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -363,25 +361,25 @@ static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq
 | 
			
		|||
static ide_startstop_t task_in_intr(ide_drive_t *drive)
 | 
			
		||||
{
 | 
			
		||||
	ide_hwif_t *hwif = drive->hwif;
 | 
			
		||||
	struct request *rq = hwif->rq;
 | 
			
		||||
	struct ide_cmd *cmd = &drive->hwif->cmd;
 | 
			
		||||
	u8 stat = hwif->tp_ops->read_status(hwif);
 | 
			
		||||
 | 
			
		||||
	/* Error? */
 | 
			
		||||
	if (stat & ATA_ERR)
 | 
			
		||||
		return task_error(drive, rq, __func__, stat);
 | 
			
		||||
		return task_error(drive, cmd, __func__, stat);
 | 
			
		||||
 | 
			
		||||
	/* Didn't want any data? Odd. */
 | 
			
		||||
	if ((stat & ATA_DRQ) == 0)
 | 
			
		||||
		return task_in_unexpected(drive, rq, stat);
 | 
			
		||||
		return task_in_unexpected(drive, cmd, stat);
 | 
			
		||||
 | 
			
		||||
	ide_pio_datablock(drive, rq, 0);
 | 
			
		||||
	ide_pio_datablock(drive, cmd, 0);
 | 
			
		||||
 | 
			
		||||
	/* Are we done? Check status and finish transfer. */
 | 
			
		||||
	if (!hwif->nleft) {
 | 
			
		||||
		stat = wait_drive_not_busy(drive);
 | 
			
		||||
		if (!OK_STAT(stat, 0, BAD_STAT))
 | 
			
		||||
			return task_error(drive, rq, __func__, stat);
 | 
			
		||||
		task_end_request(drive, rq, stat);
 | 
			
		||||
			return task_error(drive, cmd, __func__, stat);
 | 
			
		||||
		ide_finish_cmd(drive, cmd, stat);
 | 
			
		||||
		return ide_stopped;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -397,31 +395,31 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive)
 | 
			
		|||
static ide_startstop_t task_out_intr (ide_drive_t *drive)
 | 
			
		||||
{
 | 
			
		||||
	ide_hwif_t *hwif = drive->hwif;
 | 
			
		||||
	struct request *rq = hwif->rq;
 | 
			
		||||
	struct ide_cmd *cmd = &drive->hwif->cmd;
 | 
			
		||||
	u8 stat = hwif->tp_ops->read_status(hwif);
 | 
			
		||||
 | 
			
		||||
	if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
 | 
			
		||||
		return task_error(drive, rq, __func__, stat);
 | 
			
		||||
		return task_error(drive, cmd, __func__, stat);
 | 
			
		||||
 | 
			
		||||
	/* Deal with unexpected ATA data phase. */
 | 
			
		||||
	if (((stat & ATA_DRQ) == 0) ^ !hwif->nleft)
 | 
			
		||||
		return task_error(drive, rq, __func__, stat);
 | 
			
		||||
		return task_error(drive, cmd, __func__, stat);
 | 
			
		||||
 | 
			
		||||
	if (!hwif->nleft) {
 | 
			
		||||
		task_end_request(drive, rq, stat);
 | 
			
		||||
		ide_finish_cmd(drive, cmd, stat);
 | 
			
		||||
		return ide_stopped;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Still data left to transfer. */
 | 
			
		||||
	ide_pio_datablock(drive, rq, 1);
 | 
			
		||||
	ide_pio_datablock(drive, cmd, 1);
 | 
			
		||||
	ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL);
 | 
			
		||||
 | 
			
		||||
	return ide_started;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq)
 | 
			
		||||
static ide_startstop_t pre_task_out_intr(ide_drive_t *drive,
 | 
			
		||||
					 struct ide_cmd *cmd)
 | 
			
		||||
{
 | 
			
		||||
	struct ide_cmd *cmd = &drive->hwif->cmd;
 | 
			
		||||
	ide_startstop_t startstop;
 | 
			
		||||
 | 
			
		||||
	if (ide_wait_stat(&startstop, drive, ATA_DRQ,
 | 
			
		||||
| 
						 | 
				
			
			@ -437,7 +435,7 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq)
 | 
			
		|||
		local_irq_disable();
 | 
			
		||||
 | 
			
		||||
	ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL);
 | 
			
		||||
	ide_pio_datablock(drive, rq, 1);
 | 
			
		||||
	ide_pio_datablock(drive, cmd, 1);
 | 
			
		||||
 | 
			
		||||
	return ide_started;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -72,23 +72,23 @@ static void q40_ide_setup_ports(hw_regs_t *hw, unsigned long base,
 | 
			
		|||
	hw->chipset = ide_generic;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void q40ide_input_data(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void q40ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
			      void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long data_addr = drive->hwif->io_ports.data_addr;
 | 
			
		||||
 | 
			
		||||
	if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
 | 
			
		||||
	if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS))
 | 
			
		||||
		return insw(data_addr, buf, (len + 1) / 2);
 | 
			
		||||
 | 
			
		||||
	raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void q40ide_output_data(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void q40ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
			       void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long data_addr = drive->hwif->io_ports.data_addr;
 | 
			
		||||
 | 
			
		||||
	if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
 | 
			
		||||
	if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS))
 | 
			
		||||
		return outsw(data_addr, buf, (len + 1) / 2);
 | 
			
		||||
 | 
			
		||||
	raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -750,7 +750,7 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void scc_input_data(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void scc_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
			   void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long data_addr = drive->hwif->io_ports.data_addr;
 | 
			
		||||
| 
						 | 
				
			
			@ -766,7 +766,7 @@ static void scc_input_data(ide_drive_t *drive, struct request *rq,
 | 
			
		|||
		scc_ide_insw(data_addr, buf, len / 2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void scc_output_data(ide_drive_t *drive,  struct request *rq,
 | 
			
		||||
static void scc_output_data(ide_drive_t *drive,  struct ide_cmd *cmd,
 | 
			
		||||
			    void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long data_addr = drive->hwif->io_ports.data_addr;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -174,7 +174,7 @@ static void tx4938ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void tx4938ide_input_data_swap(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void tx4938ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
				void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long port = drive->hwif->io_ports.data_addr;
 | 
			
		||||
| 
						 | 
				
			
			@ -186,7 +186,7 @@ static void tx4938ide_input_data_swap(ide_drive_t *drive, struct request *rq,
 | 
			
		|||
	__ide_flush_dcache_range((unsigned long)buf, roundup(len, 2));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void tx4938ide_output_data_swap(ide_drive_t *drive, struct request *rq,
 | 
			
		||||
static void tx4938ide_output_data_swap(ide_drive_t *drive, struct ide_cmd *cmd,
 | 
			
		||||
				void *buf, unsigned int len)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long port = drive->hwif->io_ports.data_addr;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -297,6 +297,7 @@ enum {
 | 
			
		|||
	IDE_TFLAG_IO_16BIT		= (1 << 26),
 | 
			
		||||
	/* struct ide_cmd was allocated using kmalloc() */
 | 
			
		||||
	IDE_TFLAG_DYN			= (1 << 27),
 | 
			
		||||
	IDE_TFLAG_FS			= (1 << 28),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
| 
						 | 
				
			
			@ -655,10 +656,10 @@ struct ide_tp_ops {
 | 
			
		|||
	void	(*tf_load)(ide_drive_t *, struct ide_cmd *);
 | 
			
		||||
	void	(*tf_read)(ide_drive_t *, struct ide_cmd *);
 | 
			
		||||
 | 
			
		||||
	void	(*input_data)(ide_drive_t *, struct request *, void *,
 | 
			
		||||
			      unsigned int);
 | 
			
		||||
	void	(*output_data)(ide_drive_t *, struct request *, void *,
 | 
			
		||||
			       unsigned int);
 | 
			
		||||
	void	(*input_data)(ide_drive_t *, struct ide_cmd *,
 | 
			
		||||
			      void *, unsigned int);
 | 
			
		||||
	void	(*output_data)(ide_drive_t *, struct ide_cmd *,
 | 
			
		||||
			       void *, unsigned int);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
extern const struct ide_tp_ops default_tp_ops;
 | 
			
		||||
| 
						 | 
				
			
			@ -866,7 +867,7 @@ typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
 | 
			
		|||
typedef int (ide_expiry_t)(ide_drive_t *);
 | 
			
		||||
 | 
			
		||||
/* used by ide-cd, ide-floppy, etc. */
 | 
			
		||||
typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned);
 | 
			
		||||
typedef void (xfer_func_t)(ide_drive_t *, struct ide_cmd *, void *, unsigned);
 | 
			
		||||
 | 
			
		||||
extern struct mutex ide_setting_mtx;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1175,8 +1176,8 @@ void ide_set_irq(ide_hwif_t *, int);
 | 
			
		|||
void ide_tf_load(ide_drive_t *, struct ide_cmd *);
 | 
			
		||||
void ide_tf_read(ide_drive_t *, struct ide_cmd *);
 | 
			
		||||
 | 
			
		||||
void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int);
 | 
			
		||||
void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int);
 | 
			
		||||
void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
 | 
			
		||||
void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
 | 
			
		||||
 | 
			
		||||
int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1226,7 +1227,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *);
 | 
			
		|||
 | 
			
		||||
ide_startstop_t do_rw_taskfile(ide_drive_t *, struct ide_cmd *);
 | 
			
		||||
 | 
			
		||||
void task_end_request(ide_drive_t *, struct request *, u8);
 | 
			
		||||
void ide_finish_cmd(ide_drive_t *, struct ide_cmd *, u8);
 | 
			
		||||
 | 
			
		||||
int ide_raw_taskfile(ide_drive_t *, struct ide_cmd *, u8 *, u16);
 | 
			
		||||
int ide_no_data_taskfile(ide_drive_t *, struct ide_cmd *);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue