ide: driver updates (phase 2)
Subsystems (2)
PATCH 1/1 ide: driver updates (phase 2)
This thread is repost of phase 2 ide driver updates. Sorry again.
Hello, Bartlomiej.
These are reordered/modified/(hopefully)appliable nine patches from
the previous series of patches. #01 is the only new one. It kills the unused pkt_task_t in ide.h. #02/#03 are moved upward and #04 is modified as you've requested. #05/#08 now directly use taskfile transport instead of calling ide_taskfile_ioctl(). #08 now also properly handles WIN_SMART case.
If these patches go in, I have eight patches left. One of them iside_explicit_TASKFILE_NO_DATA. As we've discussed, I'm going to add default initialization of task->[pre]handler. That patch wasn't included in this series because I didn't know if do_rw_taskfile() and flagged_taskfile() are going to be merged or not. So, please tell me what you think. :-)
I'll talk about other patches in their reply threads.
[ Start of patch descriptions ]
01_ide_kill_pkt_task_t.patch
: kill unused pkt_task_t
Remove unused pkt_task_t definition from ide.h.
02_ide_taskfile_init_drive_cmd.patch
: ide_init_drive_cmd() now defaults to REQ_DRIVE_TASKFILE ide_init_drive_cmd() now initializes rq->flags to REQ_DRIVE_TASKFILE.
03_ide_diag_taskfile_use_init_drive_cmd.patch
: ide_diag_taskfile() rq initialization fix
In ide_diag_taskfile(), when initializing taskfile rq, ref_count wasn't initialized properly. Modified to use ide_init_drive_cmd(). This doesn't really change any behavior as the request isn't managed via the block layer.
04_ide_taskfile_flush.patch
: convert REQ_DRIVE_TASK to REQ_DRIVE_TASKFILE
All REQ_DRIVE_TASK users except ide_task_ioctl() converted to use REQ_DRIVE_TASKFILE.
1. idedisk_issue_flush() converted to use REQ_DRIVE_TASKFILE. This and the changes in ide_get_error_location() remove a possible race condition between ide_get_error_location() and other requests.
2. ide_queue_flush_cmd() converted to use REQ_DRIVE_TASKFILE.
05_ide_taskfile_task_ioctl.patch
: map ide_task_ioctl() to ide_taskfile_ioctl()
ide_task_ioctl() modified to map to ide_taskfile_ioctl(). This is the last user of REQ_DRIVE_TASK.
06_ide_remove_task.patch
: remove REQ_DRIVE_TASK handling
Unused REQ_DRIVE_TASK handling removed.
07_ide_taskfile_cmd.patch
: convert REQ_DRIVE_CMD to REQ_DRIVE_TASKFILE
All in-kernel REQ_DRIVE_CMD users except for ide_cmd_ioctl() converted to use REQ_DRIVE_TASKFILE.
08_ide_taskfile_cmd_ioctl.patch
: map ide_cmd_ioctl() to ide_taskfile_ioctl()
ide_cmd_ioctl() converted to use ide_taskfile_ioctl(). This is the last user of REQ_DRIVE_CMD.
09_ide_remove_cmd.patch
: remove REQ_DRIVE_CMD handling
Removed unused REQ_DRIVE_CMD handling.
[ End of patch descriptions ]
Thanks.
Signature · 1 line
tejun
Re: [PATCH 2.6.11-rc2 02/09] ide: ide_init_drive_cmd() now defaults to REQ_DRIVE_TASKFILE
02_ide_taskfile_init_drive_cmd.patch
ide_init_drive_cmd() now initializes rq->flags to REQ_DRIVE_TASKFILE.
drivers/ide/ide-io.c +2 -2
@@ -64,7 +64,7 @@ static void ide_fill_flush_cmd(ide_drive*/ memset (buf,0 ,sizeof (rq->cmd)); - rq->flags |=REQ_DRIVE_TASK |REQ_STARTED ; + rq->flags =REQ_DRIVE_TASK |REQ_STARTED ; rq->buffer = buf; rq->buffer[0 ] =WIN_FLUSH_CACHE ;
@@ -1549,7 +1549,7 @@ irqreturn_t ide_intr (int irq, void *devvoid ide_init_drive_cmd (struct request *rq) {memset (rq,0 ,sizeof (*rq)); - rq->flags =REQ_DRIVE_CMD ; + rq->flags =REQ_DRIVE_TASKFILE ; rq->ref_count =1 ; }
drivers/ide/ide-taskfile.c +1 -0
@@ -670,6 +670,7 @@ int ide_wait_cmd (ide_drive_t *drive, u8 buf = buffer;memset (buf,0 ,4 +SECTOR_WORDS *4 * sectors);ide_init_drive_cmd (&rq); + rq.flags =REQ_DRIVE_CMD ; rq.buffer = buf; *buf++ = cmd; *buf++ = nsect;
Re: [PATCH 2.6.11-rc2 03/09] ide: ide_diag_taskfile() rq initialization fix
In reply to Tejun Heo03_ide_diag_taskfile_use_init_drive_cmd.patch
In ide_diag_taskfile(), when initializing taskfile rq, ref_count wasn't initialized properly. Modified to use ide_init_drive_cmd(). This doesn't really change any behavior as the request isn't managed via the block layer.
drivers/ide/ide-taskfile.c +1 -2
@@ -471,8 +471,7 @@ static int ide_diag_taskfile(ide_drive_t {struct request rq; -memset (&rq,0 ,sizeof (rq)); - rq.flags =REQ_DRIVE_TASKFILE ; +ide_init_drive_cmd (&rq); rq.buffer = buf;/*
Re: [PATCH 2.6.11-rc2 05/09] ide: map ide_task_ioctl() to ide_taskfile_ioctl()
In reply to Tejun Heo05_ide_taskfile_task_ioctl.patch
ide_task_ioctl() modified to map to ide_taskfile_ioctl(). This is the last user of REQ_DRIVE_TASK.
drivers/ide/ide-taskfile.c +34 -21
@@ -735,32 +735,45 @@ abort:return err; } -static int ide_wait_cmd_task (ide_drive_t *drive,u8 *buf) -{ -struct request rq; - -ide_init_drive_cmd (&rq); - rq.flags =REQ_DRIVE_TASK ; - rq.buffer = buf; -return ide_do_drive_cmd (drive, &rq, ide_wait); -} - -/* -* FIXME : this needs to map into at taskfile. <[email protected]> -*/ -int ide_task_ioctl (ide_drive_t *drive,unsigned int cmd,unsigned long arg) +int ide_task_ioctl (ide_drive_t *drive,unsigned int cmd,unsigned long arg) {void __user *p = (void __user *)arg; -int err =0 ; -u8 args[7 ], *argbuf = args; -int argsize =7 ; +u8 args[7 ]; +ide_task_t task; +task_ioreg_t *regs = task.tfRegister; +int ret;if (copy_from_user (args, p,7 ))return -EFAULT ; - err =ide_wait_cmd_task (drive, argbuf); -if (copy_to_user (p, argbuf, argsize)) - err = -EFAULT ; -return err; + +memset (&task,0 ,sizeof (task)); + + regs[IDE_COMMAND_OFFSET ] = args[0 ]; + regs[IDE_FEATURE_OFFSET ] = args[1 ]; + regs[IDE_NSECTOR_OFFSET ] = args[2 ]; + regs[IDE_SECTOR_OFFSET ] = args[3 ]; + regs[IDE_LCYL_OFFSET ] = args[4 ]; + regs[IDE_HCYL_OFFSET ] = args[5 ]; + regs[IDE_SELECT_OFFSET ] = args[6 ]; + + task.command_type =IDE_DRIVE_TASK_NO_DATA ; + task.data_phase =TASKFILE_NO_DATA ; + task.handler = &task_no_data_intr; + + ret =ide_diag_taskfile (drive, &task,0 ,NULL ); + + args[0 ] = regs[IDE_COMMAND_OFFSET ]; + args[1 ] = regs[IDE_FEATURE_OFFSET ]; + args[2 ] = regs[IDE_NSECTOR_OFFSET ]; + args[3 ] = regs[IDE_SECTOR_OFFSET ]; + args[4 ] = regs[IDE_LCYL_OFFSET ]; + args[5 ] = regs[IDE_HCYL_OFFSET ]; + args[6 ] = regs[IDE_SELECT_OFFSET ]; + +if (copy_to_user (p, args,7 )) + ret = -EFAULT ; + +return ret; }/*
Re: [PATCH 2.6.11-rc2 06/09] ide: remove REQ_DRIVE_TASK handling
In reply to Tejun Heo06_ide_remove_task.patch
Unused REQ_DRIVE_TASK handling removed.
drivers/ide/ide-io.c +4 -44
@@ -357,20 +357,6 @@ void ide_end_drive_cmd (ide_drive_t *dri args[1 ] = err; args[2 ] = hwif->INB (IDE_NSECTOR_REG ); } - }else if (rq->flags &REQ_DRIVE_TASK ) { -u8 *args = (u8 *) rq->buffer; -if (rq->errors ==0 ) - rq->errors = !OK_STAT (stat,READY_STAT ,BAD_STAT ); - -if (args) { - args[0 ] = stat; - args[1 ] = err; - args[2 ] = hwif->INB (IDE_NSECTOR_REG ); - args[3 ] = hwif->INB (IDE_SECTOR_REG ); - args[4 ] = hwif->INB (IDE_LCYL_REG ); - args[5 ] = hwif->INB (IDE_HCYL_REG ); - args[6 ] = hwif->INB (IDE_SELECT_REG ); - } }else if (rq->flags &REQ_DRIVE_TASKFILE ) {ide_task_t *args = (ide_task_t *) rq->special;if (rq->errors ==0 )
@@ -557,7 +543,7 @@ ide_startstop_t ide_error (ide_drive_t *return ide_stopped;/* retry only "normal" I/O: */ -if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASK |REQ_DRIVE_TASKFILE )) { +if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASKFILE )) { rq->errors =1 ;ide_end_drive_cmd (drive, stat, err);return ide_stopped;
@@ -599,7 +585,7 @@ ide_startstop_t ide_abort(ide_drive_t *dreturn ide_stopped;/* retry only "normal" I/O: */ -if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASK |REQ_DRIVE_TASKFILE )) { +if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASKFILE )) { rq->errors =1 ;ide_end_drive_cmd (drive,BUSY_STAT ,0 );return ide_stopped;
@@ -757,33 +743,7 @@ static ide_startstop_t execute_drive_cmdif (args->tf_out_flags.all !=0 )return flagged_taskfile (drive, args);return do_rw_taskfile (drive, args); - }else if (rq->flags &REQ_DRIVE_TASK ) { -u8 *args = rq->buffer; -u8 sel; - -if (!args) - goto done; -#ifdef DEBUG -printk ("%s: DRIVE_TASK_CMD " , drive->name); -printk ("cmd=0x%02x " , args[0 ]); -printk ("fr=0x%02x " , args[1 ]); -printk ("ns=0x%02x " , args[2 ]); -printk ("sc=0x%02x " , args[3 ]); -printk ("lcyl=0x%02x " , args[4 ]); -printk ("hcyl=0x%02x " , args[5 ]); -printk ("sel=0x%02x\n" , args[6 ]); -#endif - hwif->OUTB (args[1 ],IDE_FEATURE_REG ); - hwif->OUTB (args[3 ],IDE_SECTOR_REG ); - hwif->OUTB (args[4 ],IDE_LCYL_REG ); - hwif->OUTB (args[5 ],IDE_HCYL_REG ); - sel = (args[6 ] & ~0x10 ); -if (drive->select.b.unit) - sel |=0x10 ; - hwif->OUTB (sel,IDE_SELECT_REG ); -ide_cmd (drive, args[0 ], args[2 ], &drive_cmd_intr); -return ide_started; - }else if (rq->flags &REQ_DRIVE_CMD ) { + }else if (rq->flags &REQ_DRIVE_CMD ) {u8 *args = rq->buffer;if (!args)
@@ -894,7 +854,7 @@ static ide_startstop_t start_request (idreturn startstop; }if (!drive->special.all) { -if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASK )) +if (rq->flags &REQ_DRIVE_CMD )return execute_drive_cmd (drive, rq);else if (rq->flags &REQ_DRIVE_TASKFILE )return execute_drive_cmd (drive, rq);
drivers/ide/ide-lib.c +1 -1
@@ -458,7 +458,7 @@ static void ide_dump_opcode(ide_drive_tspin_unlock (&ide_lock);if (!rq)return ; -if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASK )) { +if (rq->flags &REQ_DRIVE_CMD ) {char *args = rq->buffer;if (args) { opcode = args[0 ];
include/linux/blkdev.h +1 -1
@@ -202,7 +202,7 @@ enum rq_flag_bits { __REQ_QUIET,/* don't worry about errors */ __REQ_SPECIAL,/* driver suplied command */ __REQ_DRIVE_CMD, - __REQ_DRIVE_TASK, + __REQ_DRIVE_TASK,/* obsolete, unused anymore - tj */ __REQ_DRIVE_TASKFILE, __REQ_PREEMPT,/* set for "ide_preempt" requests */ __REQ_PM_SUSPEND, /* suspend request */
Re: [PATCH 2.6.11-rc2 06/09] ide: remove REQ_DRIVE_TASK handling
include/linux/blkdev.h enum rq_flag_bits { · line 205
Quoted 3 lines
include/linux/blkdev.h +1
-1__REQ_DRIVE_CMD, - __REQ_DRIVE_TASK, + __REQ_DRIVE_TASK, /* obsolete, unused anymore - tj */
please kill it completely
Re: [PATCH 2.6.11-rc2 08/09] ide: map ide_cmd_ioctl() to ide_taskfile_ioctl()
In reply to Tejun Heo08_ide_taskfile_cmd_ioctl.patch
ide_cmd_ioctl() converted to use ide_taskfile_ioctl(). This is the last user of REQ_DRIVE_CMD.
drivers/ide/ide-iops.c +8 -8
@@ -648,11 +648,11 @@ u8 eighty_ninty_three (ide_drive_t *drivEXPORT_SYMBOL (eighty_ninty_three); -int ide_ata66_check (ide_drive_t *drive,ide_task_t *args) +int ide_ata66_check (ide_drive_t *drive,task_ioreg_t *regs) { -if ((args->tfRegister[IDE_COMMAND_OFFSET ] ==WIN_SETFEATURES ) && - (args->tfRegister[IDE_SECTOR_OFFSET ] >XFER_UDMA_2 ) && - (args->tfRegister[IDE_FEATURE_OFFSET ] ==SETFEATURES_XFER )) { +if (regs[IDE_COMMAND_OFFSET ] ==WIN_SETFEATURES && + regs[IDE_SECTOR_OFFSET ] >XFER_UDMA_2 && + regs[IDE_FEATURE_OFFSET ] ==SETFEATURES_XFER ) {#ifndef CONFIG_IDEDMA_IVB if ((drive->id->hw_config &0x6000 ) ==0 ) {#else /* !CONFIG_IDEDMA_IVB */
@@ -678,11 +678,11 @@ int ide_ata66_check (ide_drive_t *drive,* 1 : Safe to update drive->id DMA registers. * 0 : OOPs not allowed. */ -int set_transfer (ide_drive_t *drive,ide_task_t *args) +int set_transfer (ide_drive_t *drive,task_ioreg_t *regs) { -if ((args->tfRegister[IDE_COMMAND_OFFSET ] ==WIN_SETFEATURES ) && - (args->tfRegister[IDE_SECTOR_OFFSET ] >=XFER_SW_DMA_0 ) && - (args->tfRegister[IDE_FEATURE_OFFSET ] ==SETFEATURES_XFER ) && +if (regs[IDE_COMMAND_OFFSET ] ==WIN_SETFEATURES && + regs[IDE_SECTOR_OFFSET ] >=XFER_SW_DMA_0 && + regs[IDE_FEATURE_OFFSET ] ==SETFEATURES_XFER && (drive->id->dma_ultra || drive->id->dma_mword || drive->id->dma_1word))
drivers/ide/ide-taskfile.c +70 -56
149 lines not on this page · raw message
include/linux/ide.h +2 -10
@@ -1280,14 +1280,6 @@ extern int ide_do_drive_cmd(ide_drive_t*/ extern void ide_end_drive_cmd (ide_drive_t *,u8 ,u8 ); -/* -* Issue ATA command and wait for completion. -* Use for implementing commands in kernel -* -* (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) -*/ -extern int ide_wait_cmd (ide_drive_t *,u8 ,u8 ,u8 ,u8 ,u8 *); -extern u32 ide_read_24 (ide_drive_t *);extern void SELECT_DRIVE (ide_drive_t *);
@@ -1329,10 +1321,10 @@ int ide_task_ioctl(ide_drive_t *, unsignextern int system_bus_clock (void );extern int ide_driveid_update (ide_drive_t *); -extern int ide_ata66_check (ide_drive_t *,ide_task_t *); +int ide_ata66_check (ide_drive_t *,task_ioreg_t *);extern int ide_config_drive_speed (ide_drive_t *,u8 );extern u8 eighty_ninty_three (ide_drive_t *); -extern int set_transfer (ide_drive_t *,ide_task_t *); +int set_transfer (ide_drive_t *,task_ioreg_t *);extern int taskfile_lib_get_identify (ide_drive_t *drive,u8 *);extern int ide_wait_not_busy (ide_hwif_t *hwif,unsigned long timeout);
Re: [PATCH 2.6.11-rc2 09/09] ide: remove REQ_DRIVE_CMD handling
In reply to Tejun Heo09_ide_remove_cmd.patch
Removed unused REQ_DRIVE_CMD handling.
drivers/ide/ide-io.c +42 -139
@@ -347,17 +347,7 @@ void ide_end_drive_cmd (ide_drive_t *dri rq =HWGROUP (drive)->rq;spin_unlock_irqrestore (&ide_lock, flags); -if (rq->flags &REQ_DRIVE_CMD ) { -u8 *args = (u8 *) rq->buffer; -if (rq->errors ==0 ) - rq->errors = !OK_STAT (stat,READY_STAT ,BAD_STAT ); - -if (args) { - args[0 ] = stat; - args[1 ] = err; - args[2 ] = hwif->INB (IDE_NSECTOR_REG ); - } - }else if (rq->flags &REQ_DRIVE_TASKFILE ) { +if (rq->flags &REQ_DRIVE_TASKFILE ) {ide_task_t *args = (ide_task_t *) rq->special;if (rq->errors ==0 ) rq->errors = !OK_STAT (stat,READY_STAT ,BAD_STAT );
@@ -543,7 +533,7 @@ ide_startstop_t ide_error (ide_drive_t *return ide_stopped;/* retry only "normal" I/O: */ -if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASKFILE )) { +if (rq->flags &REQ_DRIVE_TASKFILE ) { rq->errors =1 ;ide_end_drive_cmd (drive, stat, err);return ide_stopped;
@@ -585,7 +575,7 @@ ide_startstop_t ide_abort(ide_drive_t *dreturn ide_stopped;/* retry only "normal" I/O: */ -if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASKFILE )) { +if (rq->flags &REQ_DRIVE_TASKFILE ) { rq->errors =1 ;ide_end_drive_cmd (drive,BUSY_STAT ,0 );return ide_stopped;
@@ -595,63 +585,6 @@ ide_startstop_t ide_abort(ide_drive_t *d }/** -* ide_cmd - issue a simple drive command -* @drive: drive the command is for -* @cmd: command byte -* @nsect: sector byte -* @handler: handler for the command completion -* -* Issue a simple drive command with interrupts. -* The drive must be selected beforehand. -*/ - -static void ide_cmd (ide_drive_t *drive,u8 cmd,u8 nsect, -ide_handler_t *handler) -{ -ide_hwif_t *hwif =HWIF (drive); -if (IDE_CONTROL_REG ) - hwif->OUTB (drive->ctl,IDE_CONTROL_REG );/* clear nIEN */ -SELECT_MASK (drive,0 ); - hwif->OUTB (nsect,IDE_NSECTOR_REG ); -ide_execute_command (drive, cmd, handler,WAIT_CMD ,NULL ); -} - -/** -* drive_cmd_intr - drive command completion interrupt -* @drive: drive the completion interrupt occurred on -* -* drive_cmd_intr() is invoked on completion of a special DRIVE_CMD. -* We do any necessary daya reading and then wait for the drive to -* go non busy. At that point we may read the error data and complete -* the request -*/ - -static ide_startstop_t drive_cmd_intr (ide_drive_t *drive) -{ -struct request *rq =HWGROUP (drive)->rq; -ide_hwif_t *hwif =HWIF (drive); -u8 *args = (u8 *) rq->buffer; -u8 stat = hwif->INB (IDE_STATUS_REG ); -int retries =10 ; - -local_irq_enable (); -if ((stat &DRQ_STAT ) && args && args[3 ]) { -u8 io_32bit = drive->io_32bit; - drive->io_32bit =0 ; - hwif->ata_input_data (drive, &args[4 ], args[3 ] *SECTOR_WORDS ); - drive->io_32bit = io_32bit; -while (((stat = hwif->INB (IDE_STATUS_REG )) &BUSY_STAT ) && retries--) -udelay (100 ); - } - -if (!OK_STAT (stat,READY_STAT ,BAD_STAT ) &&DRIVER (drive) !=NULL ) -return ide_error (drive,"drive_cmd" , stat); -/* calls ide_end_drive_cmd */ -ide_end_drive_cmd (drive, stat, hwif->INB (IDE_ERROR_REG )); -return ide_stopped; -} - -/** * do_special - issue some special commands * @drive: drive the command is for *
@@ -706,80 +639,52 @@ void ide_init_sg_cmd(ide_drive_t *drive,EXPORT_SYMBOL_GPL (ide_init_sg_cmd);/** -* execute_drive_command - issue special drive command +* execute_drive_taskfile - issue special drive command * @drive: the drive to issue th command on * @rq: the request structure holding the command * -* execute_drive_cmd() issues a special drive command, usually -* initiated by ioctl() from the external hdparm program. The -* command can be a drive command, drive task or taskfile -* operation. Weirdly you can call it with NULL to wait for -* all commands to finish. Don't do this as that is due to change +* execute_drive_taskfile() issues a special drive command, +* usually initiated by ioctl() from the external hdparm program. +* Weirdly you can call it with NULL to wait for all commands to +* finish. Don't do this as that is due to change */ -static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, -struct request *rq) +static ide_startstop_t execute_drive_taskfile (ide_drive_t *drive, +struct request *rq) {ide_hwif_t *hwif =HWIF (drive); -if (rq->flags &REQ_DRIVE_TASKFILE ) { -ide_task_t *args = rq->special; - -if (!args) - goto done; - - hwif->data_phase = args->data_phase; - -switch (hwif->data_phase) { -case TASKFILE_MULTI_OUT : -case TASKFILE_OUT : -case TASKFILE_MULTI_IN : -case TASKFILE_IN : -ide_init_sg_cmd (drive, rq); -ide_map_sg (drive, rq); -default : -break ; - } - -if (args->tf_out_flags.all !=0 ) -return flagged_taskfile (drive, args); -return do_rw_taskfile (drive, args); - }else if (rq->flags &REQ_DRIVE_CMD ) { -u8 *args = rq->buffer; - -if (!args) - goto done; -#ifdef DEBUG -printk ("%s: DRIVE_CMD " , drive->name); -printk ("cmd=0x%02x " , args[0 ]); -printk ("sc=0x%02x " , args[1 ]); -printk ("fr=0x%02x " , args[2 ]); -printk ("xx=0x%02x\n" , args[3 ]); -#endif -if (args[0 ] ==WIN_SMART ) { - hwif->OUTB (0x4f ,IDE_LCYL_REG ); - hwif->OUTB (0xc2 ,IDE_HCYL_REG ); - hwif->OUTB (args[2 ],IDE_FEATURE_REG ); - hwif->OUTB (args[1 ],IDE_SECTOR_REG ); -ide_cmd (drive, args[0 ], args[3 ], &drive_cmd_intr); -return ide_started; - } - hwif->OUTB (args[2 ],IDE_FEATURE_REG ); -ide_cmd (drive, args[0 ], args[1 ], &drive_cmd_intr); -return ide_started; - } - -done: -/* -* NULL is actually a valid way of waiting for -* all current requests to be flushed from the queue. - */ +ide_task_t *args = rq->special; + +if (!args) { +/* +* NULL is actually a valid way of waiting for +* all current requests to be flushed from the queue. +*/ #ifdef DEBUG -printk ("%s: DRIVE_CMD (null)\n" , drive->name); +printk ("%s: DRIVE_TASKFILE (null)\n" , drive->name);#endif -ide_end_drive_cmd (drive, - hwif->INB (IDE_STATUS_REG ), - hwif->INB (IDE_ERROR_REG )); -return ide_stopped; +ide_end_drive_cmd (drive, + hwif->INB (IDE_STATUS_REG ), + hwif->INB (IDE_ERROR_REG )); +return ide_stopped; + } + + hwif->data_phase = args->data_phase; + +switch (hwif->data_phase) { +case TASKFILE_MULTI_OUT : +case TASKFILE_OUT : +case TASKFILE_MULTI_IN : +case TASKFILE_IN : +ide_init_sg_cmd (drive, rq); +ide_map_sg (drive, rq); +default : +break ; + } + +if (args->tf_out_flags.all !=0 ) +return flagged_taskfile (drive, args); +return do_rw_taskfile (drive, args); }/**
@@ -854,10 +759,8 @@ static ide_startstop_t start_request (idreturn startstop; }if (!drive->special.all) { -if (rq->flags &REQ_DRIVE_CMD ) -return execute_drive_cmd (drive, rq); -else if (rq->flags &REQ_DRIVE_TASKFILE ) -return execute_drive_cmd (drive, rq); +if (rq->flags &REQ_DRIVE_TASKFILE ) +return execute_drive_taskfile (drive, rq);else if (blk_pm_request (rq)) {#ifdef DEBUG_PM printk("%s: start_power_step(step: %d)\n",
include/linux/blkdev.h +1 -1
@@ -201,7 +201,7 @@ enum rq_flag_bits { __REQ_FAILED,/* set if the request failed */ __REQ_QUIET,/* don't worry about errors */ __REQ_SPECIAL,/* driver suplied command */ - __REQ_DRIVE_CMD, + __REQ_DRIVE_CMD,/* obsolete, unused anymore - tj */ __REQ_DRIVE_TASK,/* obsolete, unused anymore - tj */ __REQ_DRIVE_TASKFILE, __REQ_PREEMPT, /* set for "ide_preempt" requests */
Re: [PATCH 2.6.11-rc2 09/09] ide: remove REQ_DRIVE_CMD handling
include/linux/blkdev.h enum rq_flag_bits { · line 204
Quoted 2 lines
include/linux/blkdev.h +1
-1- __REQ_DRIVE_CMD, + __REQ_DRIVE_CMD, /* obsolete, unused anymore - tj */
dito
Re: [PATCH 2.6.11-rc2 01/09] ide: kill unused pkt_task_t
In reply to Tejun Heo01_ide_kill_pkt_task_t.patch
Remove unused pkt_task_t definition from ide.h.
include/linux/ide.h +0 -14
@@ -1279,20 +1279,6 @@ typedef struct ide_task_s {void *special;/* valid_t generally */ } ide_task_t; -typedef struct pkt_task_s { -/* -* struct hd_drive_task_hdr pktf; -* task_struct_t pktf; -* u8 pkcdb[12]; -*/ -task_ioreg_t tfRegister[8 ]; -int data_phase; -int command_type; -ide_handler_t *handler; -struct request *rq;/* copy of request */ -void *special; -}pkt_task_t ; -extern u32 ide_read_24 (ide_drive_t *);extern void SELECT_DRIVE (ide_drive_t *);
Re: [PATCH 2.6.11-rc2 07/09] ide: convert REQ_DRIVE_CMD to REQ_DRIVE_TASKFILE
In reply to Tejun Heo07_ide_taskfile_cmd.patch
All in-kernel REQ_DRIVE_CMD users except for ide_cmd_ioctl() converted to use REQ_DRIVE_TASKFILE.
drivers/ide/ide-disk.c +0 -1
@@ -741,7 +741,6 @@ static int set_multcount(ide_drive_t *drif (drive->special.b.set_multmode)return -EBUSY ;ide_init_drive_cmd (&rq); - rq.flags =REQ_DRIVE_CMD ; drive->mult_req = arg; drive->special.b.set_multmode =1 ; (void )ide_do_drive_cmd (drive, &rq, ide_wait);
drivers/ide/ide.c +12 -3
@@ -1263,9 +1263,18 @@ static int set_pio_mode (ide_drive_t *drstatic int set_xfer_rate (ide_drive_t *drive,int arg) { -int err =ide_wait_cmd (drive, -WIN_SETFEATURES , (u8 ) arg, -SETFEATURES_XFER ,0 ,NULL ); +ide_task_t args; +int err; + +memset (&args,0 ,sizeof (args)); + args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_SETFEATURES ; + args.tfRegister[IDE_FEATURE_OFFSET ] =SETFEATURES_XFER ; + args.tfRegister[IDE_NSECTOR_OFFSET ] = arg; + args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; + args.handler = task_no_data_intr; + + err =ide_raw_taskfile (drive, &args,NULL );if (!err && arg) {ide_set_xfer_rate (drive, (u8 ) arg);
Re: [PATCH 2.6.11-rc2 04/09] ide: convert REQ_DRIVE_TASK to REQ_DRIVE_TASKFILE
In reply to Tejun Heo04_ide_taskfile_flush.patch
All REQ_DRIVE_TASK users except ide_task_ioctl() converted to use REQ_DRIVE_TASKFILE.
1. idedisk_issue_flush() converted to use REQ_DRIVE_TASKFILE. This and the changes in ide_get_error_location() remove a possible race condition between ide_get_error_location() and other requests.
2. ide_queue_flush_cmd() converted to use REQ_DRIVE_TASKFILE.
drivers/ide/ide-disk.c +7 -13
@@ -705,24 +705,17 @@ static int idedisk_issue_flush(request_q {ide_drive_t *drive = q->queuedata;struct request *rq; +ide_task_t args;int ret;if (!drive->wcache)return 0 ; - rq =blk_get_request (q,WRITE , __GFP_WAIT); - -memset (rq->cmd,0 ,sizeof (rq->cmd)); +ide_init_flush_task (drive, &args); -if (ide_id_has_flush_cache_ext (drive->id) && - (drive->capacity64 >= (1UL <<28 ))) - rq->cmd[0 ] =WIN_FLUSH_CACHE_EXT ; -else - rq->cmd[0 ] =WIN_FLUSH_CACHE ; - - - rq->flags |=REQ_DRIVE_TASK |REQ_SOFTBARRIER ; - rq->buffer = rq->cmd; + rq =blk_get_request (q,WRITE , __GFP_WAIT); + rq->flags |=REQ_DRIVE_TASKFILE |REQ_SOFTBARRIER ; + rq->special = &args; ret =blk_execute_rq (q, disk, rq);
@@ -730,8 +723,9 @@ static int idedisk_issue_flush(request_q* if we failed and caller wants error offset, get it */ if (ret && error_sector) - *error_sector =ide_get_error_location (drive, rq->cmd); + *error_sector =ide_get_error_location (drive, &args); + rq->special =NULL ;/* just in case */ blk_put_request (rq);return ret; }
drivers/ide/ide-io.c +42 -44
155 lines not on this page · raw message
include/linux/ide.h +31 -22
79 lines not on this page · raw message
Re: [PATCH 2.6.11-rc2 04/09] ide: convert REQ_DRIVE_TASK to REQ_DRIVE_TASKFILE
I forgot about this one...
Quoted 20 lines
drivers/ide/ide-io.c +2
-11@@ -55,22 +55,19 @@#include <asm/io.h> #include <asm/bitops.h> -static void ide_fill_flush_cmd (ide_drive_t *drive,struct request *rq) +void ide_init_flush_task (ide_drive_t *drive,ide_task_t *args) { -char *buf = rq->cmd; - -/* -* reuse cdb space for ata command -*/ -memset (buf,0 ,sizeof (rq->cmd)); - - rq->flags =REQ_DRIVE_TASK |REQ_STARTED ; - rq->buffer = buf; - rq->buffer[0 ] =WIN_FLUSH_CACHE ; +memset (args,0 ,sizeof (*args)); if (ide_id_has_flush_cache_ext(drive->id) &&
drivers/ide/ide-io.c line 71
Quoted 10 lines
drivers/ide/ide-io.c +7
-1(drive->capacity64 >= (1UL << 28))) - rq->buffer[0 ] =WIN_FLUSH_CACHE_EXT ; + args->tfRegister[IDE_COMMAND_OFFSET ] =WIN_FLUSH_CACHE_EXT ; + else + args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE; + + args->command_type =IDE_DRIVE_TASK_NO_DATA ; + args->data_phase =TASKFILE_NO_DATA ; + args->handler = task_no_data_intr; }
Isn't EXPORT_SYMBOL_{GPL} needed for ide_init_flush_task()?