ide-atapi: more leftovers
cover ide-atapi: more leftovers
Hi Bart,
here are the reworked patches of the first batch of ide-cd to generic conversion. They've been lightly tested with ide-floppy only since the ide-cd is still needs rewiring after all is moved to ide-atapi.
drivers/ide/ide-atapi.c | 94 +++++++++++++++++++++++++++++++++++++-------- drivers/ide/ide-cd.c | 42 ++------------------ drivers/ide/ide-cd.h | 1 - drivers/ide/ide-floppy.c | 2 +- drivers/ide/ide-tape.c | 2 +- drivers/scsi/ide-scsi.c | 2 +- include/linux/ide.h | 7 ++- 7 files changed, 90 insertions(+), 60 deletions(-)
Signature · 2 lines
Regards/Gruss,
Boris.PATCH 1/6 ide-atapi: add a dev_is_idecd-inline
There should be no functionality change resulting from this patch.
--- drivers/ide/ide-atapi.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/ide/ide-atapi.c +7 -1
@@ -14,6 +14,12 @@ #define debug_log(fmt, args...) do {} while (0)#endif +static inline int dev_is_idecd (ide_drive_t *drive) +{ +return (drive->media == ide_cdrom || drive->media == ide_optical) && + !(drive->dev_flags &IDE_DFLAG_SCSI ); +} +/* * Check whether we can support a device, * based on the ATAPI IDENTIFY command results.
@@ -577,7 +583,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,if (scsi) tf_flags =0 ; -else if (drive->media == ide_cdrom || drive->media == ide_optical) +else if (dev_is_idecd (drive)) tf_flags =IDE_TFLAG_OUT_NSECT |IDE_TFLAG_OUT_LBAL ;else tf_flags =IDE_TFLAG_OUT_DEVICE ;
Signature · 1 line
1.6.0.4
PATCH 2/6 ide-atapi: combine drive-specific assignments
In reply to Borislav PetkovThere should be no functionality change resulting from this patch.
--- drivers/ide/ide-atapi.c | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-)
drivers/ide/ide-atapi.c +11 -12
@@ -551,18 +551,24 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,struct ide_atapi_pc *pc = drive->pc;ide_hwif_t *hwif = drive->hwif;u32 tf_flags; -u16 bcount; +u16 bcount =0 ;u8 scsi = !!(drive->dev_flags &IDE_DFLAG_SCSI );/* We haven't transferred any data yet */ pc->xferred =0 ; pc->cur_pos = pc->buf; -/* Request to transfer the entire buffer at once */ -if (drive->media == ide_tape && scsi ==0 ) - bcount = pc->req_xfer; -else +if (dev_is_idecd (drive)) { + tf_flags =IDE_TFLAG_OUT_NSECT |IDE_TFLAG_OUT_LBAL ; + }else if (scsi) { + tf_flags =0 ; bcount =min (pc->req_xfer,63 *1024 ); + }else { + tf_flags =IDE_TFLAG_OUT_DEVICE ; + bcount = ((drive->media == ide_tape) ? + pc->req_xfer : +min (pc->req_xfer,63 *1024 )); + }if (pc->flags &PC_FLAG_DMA_ERROR ) { pc->flags &= ~PC_FLAG_DMA_ERROR ;
@@ -581,13 +587,6 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,if (!drive->dma) pc->flags &= ~PC_FLAG_DMA_OK ; -if (scsi) - tf_flags =0 ; -else if (dev_is_idecd (drive)) - tf_flags =IDE_TFLAG_OUT_NSECT |IDE_TFLAG_OUT_LBAL ; -else - tf_flags =IDE_TFLAG_OUT_DEVICE ; -ide_pktcmd_tf_load (drive, tf_flags, bcount, drive->dma);/* Issue the packet command */
Signature · 1 line
1.6.0.4
PATCH 3/6 ide-atapi: accomodate transfer length calculation for ide-cd
In reply to Borislav Petkov... by factoring it out of ide_cd_do_request() into a helper, as suggested by Bart.
There should be no functionality change resulting from this patch.
--- drivers/ide/ide-atapi.c | 15 ++++++++++++++- drivers/ide/ide-cd.c | 4 ++-- include/linux/ide.h | 2 ++ 3 files changed, 18 insertions(+), 3 deletions(-)
drivers/ide/ide-atapi.c +14 -1
@@ -252,6 +252,18 @@ int ide_scsi_expiry(ide_drive_t *drive) }EXPORT_SYMBOL_GPL (ide_scsi_expiry); +int ide_cd_get_xferlen (struct request *rq) +{ +if (blk_fs_request (rq)) +return 32768 ; +else if (blk_sense_request (rq) ||blk_pc_request (rq) || + rq->cmd_type ==REQ_TYPE_ATA_PC ) +return rq->data_len; +else +return 0 ; +} +EXPORT_SYMBOL_GPL (ide_cd_get_xferlen); +/* * This is the usual interrupt handler which will be called during a packet * command. We will transfer some of the data (as requested by the drive)
@@ -551,7 +563,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,struct ide_atapi_pc *pc = drive->pc;ide_hwif_t *hwif = drive->hwif;u32 tf_flags; -u16 bcount =0 ; +u16 bcount;u8 scsi = !!(drive->dev_flags &IDE_DFLAG_SCSI );/* We haven't transferred any data yet */
@@ -560,6 +572,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,if (dev_is_idecd (drive)) { tf_flags =IDE_TFLAG_OUT_NSECT |IDE_TFLAG_OUT_LBAL ; + bcount =ide_cd_get_xferlen (hwif->hwgroup->rq); }else if (scsi) { tf_flags =0 ; bcount =min (pc->req_xfer,63 *1024 );
drivers/ide/ide-cd.c +2 -2
@@ -1214,8 +1214,9 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, __func__, rq->cmd[0 ], rq->cmd_type, (unsigned long long)block); + xferlen =ide_cd_get_xferlen (rq); +if (blk_fs_request (rq)) { - xferlen =32768 ; fn = cdrom_start_rw_cont;if (cdrom_start_rw (drive, rq) == ide_stopped)
@@ -1225,7 +1226,6 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,return ide_stopped; }else if (blk_sense_request (rq) ||blk_pc_request (rq) || rq->cmd_type ==REQ_TYPE_ATA_PC ) { - xferlen = rq->data_len; fn = cdrom_do_newpc_cont;if (!rq->timeout)
include/linux/ide.h +2 -0
@@ -1254,6 +1254,8 @@ static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc)int ide_scsi_expiry (ide_drive_t *); +int ide_cd_get_xferlen (struct request *); +ide_startstop_t ide_issue_pc (ide_drive_t *,unsigned int ,ide_expiry_t *);ide_startstop_t do_rw_taskfile (ide_drive_t *,ide_task_t *);
Signature · 1 line
1.6.0.4
PATCH 4/6 ide-atapi: setup dma for ide-cd
In reply to Borislav PetkovThere should be no functional change resulting from this patch.
--- drivers/ide/ide-atapi.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/ide/ide-atapi.c +3 -2
@@ -588,8 +588,9 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,ide_dma_off (drive); } -if ((pc->flags &PC_FLAG_DMA_OK ) && - (drive->dev_flags &IDE_DFLAG_USING_DMA )) { +if (((pc->flags &PC_FLAG_DMA_OK ) && + (drive->dev_flags &IDE_DFLAG_USING_DMA )) || + drive->dma) {if (scsi) hwif->sg_mapped =1 ; drive->dma = !hwif->dma_ops->dma_setup (drive);
Signature · 1 line
1.6.0.4
PATCH 5/6 ide-cd: move cdrom_timer_expiry to ide-atapi.c
In reply to Borislav Petkov- cdrom_timer_expiry -> ide_cd_expiry
- remove expiry-arg to ide_issue_pc as it is redundant now
There should be no functionality change resulting from this patch.
--- drivers/ide/ide-atapi.c | 42 ++++++++++++++++++++++++++++++++++++++---- drivers/ide/ide-cd.c | 38 +++----------------------------------- drivers/ide/ide-cd.h | 1 - drivers/ide/ide-floppy.c | 2 +- drivers/ide/ide-tape.c | 2 +- drivers/scsi/ide-scsi.c | 2 +- include/linux/ide.h | 5 +++-- 7 files changed, 47 insertions(+), 45 deletions(-)
drivers/ide/ide-atapi.c +38 -4
@@ -3,6 +3,7 @@*/ #include <linux/kernel.h> +#include <linux/cdrom.h> #include <linux/delay.h> #include <linux/ide.h> #include <scsi/scsi.h>
@@ -250,7 +251,38 @@ int ide_scsi_expiry(ide_drive_t *drive)return 0 ;/* we do not want the IDE subsystem to retry */ } -EXPORT_SYMBOL_GPL (ide_scsi_expiry); + +int ide_cd_expiry (ide_drive_t *drive) +{ +struct request *rq =HWGROUP (drive)->rq; +unsigned long wait =0 ; + +debug_log ("%s: rq->cmd[0]: 0x%x\n" , __func__, rq->cmd[0 ]); + +/* +* Some commands are *slow* and normally take a long time to complete. +* Usually we can use the ATAPI "disconnect" to bypass this, but not all +* commands/drives support that. Let ide_timer_expiry keep polling us +* for these. +*/ +switch (rq->cmd[0 ]) { +case GPCMD_BLANK : +case GPCMD_FORMAT_UNIT : +case GPCMD_RESERVE_RZONE_TRACK : +case GPCMD_CLOSE_TRACK : +case GPCMD_FLUSH_CACHE : + wait =ATAPI_WAIT_PC ; +break ; +default : +if (!(rq->cmd_flags &REQ_QUIET )) +printk (KERN_INFO "cmd 0x%x timed out\n" , + rq->cmd[0 ]); + wait =0 ; +break ; + } +return wait; +} +EXPORT_SYMBOL_GPL (ide_cd_expiry);int ide_cd_get_xferlen (struct request *rq) {
@@ -557,11 +589,11 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive)return ide_started; } -ide_startstop_t ide_issue_pc (ide_drive_t *drive,unsigned int timeout, -ide_expiry_t *expiry) +ide_startstop_t ide_issue_pc (ide_drive_t *drive,unsigned int timeout) {struct ide_atapi_pc *pc = drive->pc;ide_hwif_t *hwif = drive->hwif; +ide_expiry_t *expiry =NULL ;u32 tf_flags;u16 bcount;u8 scsi = !!(drive->dev_flags &IDE_DFLAG_SCSI );
@@ -573,9 +605,11 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,if (dev_is_idecd (drive)) { tf_flags =IDE_TFLAG_OUT_NSECT |IDE_TFLAG_OUT_LBAL ; bcount =ide_cd_get_xferlen (hwif->hwgroup->rq); + expiry = ide_cd_expiry; }else if (scsi) { tf_flags =0 ; bcount =min (pc->req_xfer,63 *1024 ); + expiry = ide_scsi_expiry; }else { tf_flags =IDE_TFLAG_OUT_DEVICE ; bcount = ((drive->media == ide_tape) ?
@@ -606,7 +640,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,/* Issue the packet command */ if (drive->atapi_flags &IDE_AFLAG_DRQ_INTERRUPT ) {ide_execute_command (drive,ATA_CMD_PACKET , ide_transfer_pc, - timeout,NULL ); + timeout, expiry);return ide_started; }else {ide_execute_pkt_cmd (drive);
drivers/ide/ide-cd.c +3 -35
@@ -511,38 +511,6 @@ end_request:return 1 ; } -static int cdrom_timer_expiry (ide_drive_t *drive) -{ -struct request *rq =HWGROUP (drive)->rq; -unsigned long wait =0 ; - -ide_debug_log (IDE_DBG_RQ ,"Call %s: rq->cmd[0]: 0x%x\n" , __func__, - rq->cmd[0 ]); - -/* -* Some commands are *slow* and normally take a long time to complete. -* Usually we can use the ATAPI "disconnect" to bypass this, but not all -* commands/drives support that. Let ide_timer_expiry keep polling us -* for these. -*/ -switch (rq->cmd[0 ]) { -case GPCMD_BLANK : -case GPCMD_FORMAT_UNIT : -case GPCMD_RESERVE_RZONE_TRACK : -case GPCMD_CLOSE_TRACK : -case GPCMD_FLUSH_CACHE : - wait =ATAPI_WAIT_PC ; -break ; -default : -if (!(rq->cmd_flags &REQ_QUIET )) - printk(KERN_INFO PFX "cmd 0x%x timed out\n", - rq->cmd[0 ]); - wait =0 ; -break ; - } -return wait; -} -/* * Set up the device registers for transferring a packet command on DEV, * expecting to later transfer XFERLEN bytes. HANDLER is the routine
@@ -574,7 +542,7 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,/* packet command */ ide_execute_command (drive,ATA_CMD_PACKET , handler, -ATAPI_WAIT_PC , cdrom_timer_expiry); +ATAPI_WAIT_PC , ide_cd_expiry);return ide_started; }else {ide_execute_pkt_cmd (drive);
@@ -621,7 +589,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive, }/* arm the interrupt handler */ -ide_set_handler (drive, handler, rq->timeout, cdrom_timer_expiry); +ide_set_handler (drive, handler, rq->timeout, ide_cd_expiry);/* ATAPI commands get padded out to 12 bytes minimum */ cmd_len =COMMAND_SIZE (rq->cmd[0 ]);
@@ -1088,7 +1056,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) }else { timeout =ATAPI_WAIT_PC ;if (!blk_fs_request (rq)) - expiry = cdrom_timer_expiry; + expiry = ide_cd_expiry; }ide_set_handler (drive, cdrom_newpc_intr, timeout, expiry);
drivers/ide/ide-cd.h +0 -1
@@ -19,7 +19,6 @@/* * typical timeout for packet command */ -#define ATAPI_WAIT_PC (60 * HZ)#define ATAPI_WAIT_WRITE_BUSY (10 * HZ)/************************************************************************/
drivers/ide/ide-floppy.c +1 -1
@@ -197,7 +197,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, pc->retries++; -return ide_issue_pc (drive,WAIT_FLOPPY_CMD ,NULL ); +return ide_issue_pc (drive,WAIT_FLOPPY_CMD ); }void ide_floppy_create_read_capacity_cmd (struct ide_atapi_pc *pc)
drivers/ide/ide-tape.c +1 -1
@@ -694,7 +694,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, pc->retries++; -return ide_issue_pc (drive,WAIT_TAPE_CMD ,NULL ); +return ide_issue_pc (drive,WAIT_TAPE_CMD ); }/* A mode sense command is used to "sense" tape parameters. */
drivers/scsi/ide-scsi.c +1 -1
@@ -315,7 +315,7 @@ static ide_startstop_t idescsi_issue_pc(ide_drive_t *drive,/* Set the current packet command */ drive->pc = pc; -return ide_issue_pc (drive,ide_scsi_get_timeout (pc), ide_scsi_expiry); +return ide_issue_pc (drive,ide_scsi_get_timeout (pc)); }/*
include/linux/ide.h +3 -2
@@ -396,6 +396,7 @@ enum {* This is used for several packet commands (not for READ/WRITE commands). */ #define IDE_PC_BUFFER_SIZE 256 +#define ATAPI_WAIT_PC (60 * HZ)struct ide_atapi_pc {/* actual packet bytes */
@@ -1252,11 +1253,11 @@ static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc) return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies); } -int ide_scsi_expiry (ide_drive_t *); +int ide_cd_expiry (ide_drive_t *);int ide_cd_get_xferlen (struct request *); -ide_startstop_t ide_issue_pc (ide_drive_t *,unsigned int ,ide_expiry_t *); +ide_startstop_t ide_issue_pc (ide_drive_t *,unsigned int );ide_startstop_t do_rw_taskfile (ide_drive_t *,ide_task_t *);
Signature · 1 line
1.6.0.4
Re: [PATCH 5/6] ide-cd: move cdrom_timer_expiry to ide-atapi.c
Quoted 4 lines · Borislav Petkov
-
cdrom_timer_expiry->ide_cd_expiry
- remove expiry-arg toide_issue_pcas it is redundant nowThere should be no functionality change resulting from this patch.
Well, there is a minor change actually: ide_debug_log -> debug_log.
drivers/ide/ide-atapi.c int ide_scsi_expiry(ide_drive_t *drive) · line 253
Quoted 5 lines
drivers/ide/ide-atapi.c +0
-1@@ -250,7 +251,38 @@ int ide_scsi_expiry(ide_drive_t *drive)return 0 ;/* we do not want the IDE subsystem to retry */ } -EXPORT_SYMBOL_GPL (ide_scsi_expiry);
This seems to remove the symbol accidentally and although I've just applied patch doing scheduled ide-scsi removal it would be much better to take care of the core code's ide-scsi remnants in separate patch(es).
drivers/ide/ide-cd.h line 22
Quoted 6 lines
drivers/ide/ide-cd.h +0
-1@@ -19,7 +19,6 @@/* * typical timeout for packet command */ -#define ATAPI_WAIT_PC (60 * HZ)#define ATAPI_WAIT_WRITE_BUSY (10 * HZ)
The comment should be moved together with ATAPI_WAIT_PC define (or removed).
The rest of the patch is fine.
Re: [PATCH 5/6] ide-cd: move cdrom_timer_expiry to ide-atapi.c
Quoted 4 lines
This seems to remove the symbol accidentally and although I've just applied patch doing scheduled ide-scsi removal it would be much better to take care of the core code's ide-scsi remnants in separate patch(es).
... patches coming up...
Quoted 11 lines
Review line 22
Quoted 6 lines
(quoted diff) +0
-1@@ -19,7 +19,6 @@ /* * typical timeout for packet command */ -#define ATAPI_WAIT_PC (60 * HZ) #define ATAPI_WAIT_WRITE_BUSY (10 * HZ)The comment should be moved together with
ATAPI_WAIT_PCdefine (or removed).The rest of the patch is fine.
here is a v2:
---
From: Borislav Petkov <[email protected]>
Date: Sat, 6 Dec 2008 20:08:35 +0100
Subject: [PATCH] ide-cd: move cdrom_timer_expiry to ide-atapi.c
- cdrom_timer_expiry -> ide_cd_expiry
- remove expiry-arg to ide_issue_pc as it is redundant now
- ide_debug_log -> debug_log
--- drivers/ide/ide-atapi.c | 41 ++++++++++++++++++++++++++++++++++++++--- drivers/ide/ide-cd.c | 38 +++----------------------------------- drivers/ide/ide-cd.h | 4 ---- drivers/ide/ide-floppy.c | 2 +- drivers/ide/ide-tape.c | 2 +- include/linux/ide.h | 4 +++- 6 files changed, 46 insertions(+), 45 deletions(-)
drivers/ide/ide-atapi.c +38 -3
@@ -3,6 +3,7 @@*/ #include <linux/kernel.h> +#include <linux/cdrom.h> #include <linux/delay.h> #include <linux/ide.h> #include <scsi/scsi.h>
@@ -252,6 +253,38 @@ int ide_scsi_expiry(ide_drive_t *drive) }EXPORT_SYMBOL_GPL (ide_scsi_expiry); +int ide_cd_expiry (ide_drive_t *drive) +{ +struct request *rq =HWGROUP (drive)->rq; +unsigned long wait =0 ; + +debug_log ("%s: rq->cmd[0]: 0x%x\n" , __func__, rq->cmd[0 ]); + +/* +* Some commands are *slow* and normally take a long time to complete. +* Usually we can use the ATAPI "disconnect" to bypass this, but not all +* commands/drives support that. Let ide_timer_expiry keep polling us +* for these. +*/ +switch (rq->cmd[0 ]) { +case GPCMD_BLANK : +case GPCMD_FORMAT_UNIT : +case GPCMD_RESERVE_RZONE_TRACK : +case GPCMD_CLOSE_TRACK : +case GPCMD_FLUSH_CACHE : + wait =ATAPI_WAIT_PC ; +break ; +default : +if (!(rq->cmd_flags &REQ_QUIET )) +printk (KERN_INFO "cmd 0x%x timed out\n" , + rq->cmd[0 ]); + wait =0 ; +break ; + } +return wait; +} +EXPORT_SYMBOL_GPL (ide_cd_expiry); +int ide_cd_get_xferlen (struct request *rq) {if (blk_fs_request (rq))
@@ -562,11 +595,11 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive)return ide_started; } -ide_startstop_t ide_issue_pc (ide_drive_t *drive,unsigned int timeout, -ide_expiry_t *expiry) +ide_startstop_t ide_issue_pc (ide_drive_t *drive,unsigned int timeout) {struct ide_atapi_pc *pc = drive->pc;ide_hwif_t *hwif = drive->hwif; +ide_expiry_t *expiry =NULL ;u32 tf_flags;u16 bcount;u8 scsi = !!(drive->dev_flags &IDE_DFLAG_SCSI );
@@ -578,9 +611,11 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,if (dev_is_idecd (drive)) { tf_flags =IDE_TFLAG_OUT_NSECT |IDE_TFLAG_OUT_LBAL ; bcount =ide_cd_get_xferlen (hwif->hwgroup->rq); + expiry = ide_cd_expiry; }else if (scsi) { tf_flags =0 ; bcount =min (pc->req_xfer,63 *1024 ); + expiry = ide_scsi_expiry; }else { tf_flags =IDE_TFLAG_OUT_DEVICE ; bcount = ((drive->media == ide_tape) ?
@@ -613,7 +648,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,if (drive->dma) drive->waiting_for_dma =0 ;ide_execute_command (drive,ATA_CMD_PACKET , ide_transfer_pc, - timeout,NULL ); + timeout, expiry);return ide_started; }else {ide_execute_pkt_cmd (drive);
drivers/ide/ide-cd.c +3 -35
@@ -511,38 +511,6 @@ end_request:return 1 ; } -static int cdrom_timer_expiry (ide_drive_t *drive) -{ -struct request *rq =HWGROUP (drive)->rq; -unsigned long wait =0 ; - -ide_debug_log (IDE_DBG_RQ ,"Call %s: rq->cmd[0]: 0x%x\n" , __func__, - rq->cmd[0 ]); - -/* -* Some commands are *slow* and normally take a long time to complete. -* Usually we can use the ATAPI "disconnect" to bypass this, but not all -* commands/drives support that. Let ide_timer_expiry keep polling us -* for these. -*/ -switch (rq->cmd[0 ]) { -case GPCMD_BLANK : -case GPCMD_FORMAT_UNIT : -case GPCMD_RESERVE_RZONE_TRACK : -case GPCMD_CLOSE_TRACK : -case GPCMD_FLUSH_CACHE : - wait =ATAPI_WAIT_PC ; -break ; -default : -if (!(rq->cmd_flags &REQ_QUIET )) - printk(KERN_INFO PFX "cmd 0x%x timed out\n", - rq->cmd[0 ]); - wait =0 ; -break ; - } -return wait; -} -/* * Set up the device registers for transferring a packet command on DEV, * expecting to later transfer XFERLEN bytes. HANDLER is the routine
@@ -574,7 +542,7 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,/* packet command */ ide_execute_command (drive,ATA_CMD_PACKET , handler, -ATAPI_WAIT_PC , cdrom_timer_expiry); +ATAPI_WAIT_PC , ide_cd_expiry);return ide_started; }else {ide_execute_pkt_cmd (drive);
@@ -621,7 +589,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive, }/* arm the interrupt handler */ -ide_set_handler (drive, handler, rq->timeout, cdrom_timer_expiry); +ide_set_handler (drive, handler, rq->timeout, ide_cd_expiry);/* ATAPI commands get padded out to 12 bytes minimum */ cmd_len =COMMAND_SIZE (rq->cmd[0 ]);
@@ -1088,7 +1056,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) }else { timeout =ATAPI_WAIT_PC ;if (!blk_fs_request (rq)) - expiry = cdrom_timer_expiry; + expiry = ide_cd_expiry; }ide_set_handler (drive, cdrom_newpc_intr, timeout, expiry);
drivers/ide/ide-cd.h +0 -4
@@ -16,10 +16,6 @@ #define ide_debug_log(lvl, fmt, args...) do {} while (0)#endif -/* -* typical timeout for packet command -*/ -#define ATAPI_WAIT_PC (60 * HZ)#define ATAPI_WAIT_WRITE_BUSY (10 * HZ)/************************************************************************/
drivers/ide/ide-floppy.c +1 -1
@@ -197,7 +197,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, pc->retries++; -return ide_issue_pc (drive,WAIT_FLOPPY_CMD ,NULL ); +return ide_issue_pc (drive,WAIT_FLOPPY_CMD ); }void ide_floppy_create_read_capacity_cmd (struct ide_atapi_pc *pc)
drivers/ide/ide-tape.c +1 -1
@@ -694,7 +694,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, pc->retries++; -return ide_issue_pc (drive,WAIT_TAPE_CMD ,NULL ); +return ide_issue_pc (drive,WAIT_TAPE_CMD ); }/* A mode sense command is used to "sense" tape parameters. */
include/linux/ide.h +3 -1
@@ -396,6 +396,7 @@ enum {* This is used for several packet commands (not for READ/WRITE commands). */ #define IDE_PC_BUFFER_SIZE 256 +#define ATAPI_WAIT_PC (60 * HZ)struct ide_atapi_pc {/* actual packet bytes */
@@ -1253,10 +1254,11 @@ static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc) }int ide_scsi_expiry (ide_drive_t *); +int ide_cd_expiry (ide_drive_t *);int ide_cd_get_xferlen (struct request *); -ide_startstop_t ide_issue_pc (ide_drive_t *,unsigned int ,ide_expiry_t *); +ide_startstop_t ide_issue_pc (ide_drive_t *,unsigned int );ide_startstop_t do_rw_taskfile (ide_drive_t *,ide_task_t *);
Signature · 5 lines
1.6.0.4
--
Regards/Gruss,
Boris.Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH 5/6] ide-cd: move cdrom_timer_expiry to ide-atapi.c
Quoted 11 lines · Borislav Petkov
here is a v2:
---
From: Borislav Petkov <[email protected]>
Date: Sat, 6 Dec 2008 20:08:35 +0100
Subject: [PATCH] ide-cd: movecdrom_timer_expirytoide-atapi.c-
cdrom_timer_expiry->ide_cd_expiry
- remove expiry-arg toide_issue_pcas it is redundant now
-ide_debug_log->debug_logSigned-off-by Borislav Petkov <[email protected]>
applied, thanks
PATCH 6/6 ide-atapi: teach ide atapi about drive->waiting_for_dma
In reply to Borislav PetkovIn addition, we wait for DRQ to be asserted by repeatedly polling device status no matter what DRQ type each device implements.
--- drivers/ide/ide-atapi.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/ide/ide-atapi.c +7 -0
@@ -543,6 +543,11 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive)return startstop; } +if (drive->atapi_flags &IDE_AFLAG_DRQ_INTERRUPT ) { +if (drive->dma) + drive->waiting_for_dma =1 ; + } + ireason =ide_read_ireason (drive);if (drive->media == ide_tape && (drive->dev_flags &IDE_DFLAG_SCSI ) ==0 )
@@ -639,6 +644,8 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout)/* Issue the packet command */ if (drive->atapi_flags &IDE_AFLAG_DRQ_INTERRUPT ) { +if (drive->dma) + drive->waiting_for_dma =0 ;ide_execute_command (drive,ATA_CMD_PACKET , ide_transfer_pc, timeout, expiry);return ide_started;
Signature · 1 line
1.6.0.4
Quoted 5 lines · Borislav Petkov
Hi Bart,
here are the reworked patches of the first batch of ide-cd to generic conversion. They've been lightly tested with ide-floppy only since the ide-cd is still needs rewiring after all is moved to ide-atapi.
Thanks, I applied everything except patch #5 (which needs fixup because it goes too far into the future ;-).