ide: various fixes/cleanups
cover ide: various fixes/cleanups
Easy stuff done as relax from more hard-core changes...
diffstat:
drivers/ide/cris/ide-cris.c | 6 - drivers/ide/ide-dma.c | 20 ++++++ drivers/ide/ide-iops.c | 145 ++++++++++---------------------------------- drivers/ide/ide-probe.c | 35 ++++++---- drivers/ide/ide-tape.c | 4 - drivers/ide/ide-taskfile.c | 11 ++- drivers/ide/ide.c | 5 - drivers/ide/pci/siimage.c | 25 ++++--- drivers/ide/pci/trm290.c | 5 - drivers/scsi/ide-scsi.c | 7 -- include/linux/hdreg.h | 4 - include/linux/ide.h | 15 ---- 12 files changed, 113 insertions(+), 169 deletions(-)
PATCH 1/16 ide-tape: use ide_execute_command()
--- drivers/ide/ide-tape.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ide/ide-tape.c +2 -2
@@ -2181,8 +2181,8 @@ static ide_startstop_t idetape_issue_pacif (dma_ok)/* Will begin DMA later */ set_bit (PC_DMA_IN_PROGRESS , &pc->flags);if (test_bit (IDETAPE_DRQ_INTERRUPT , &tape->flags)) { -ide_set_handler (drive, &idetape_transfer_pc,IDETAPE_WAIT_CMD ,NULL ); - hwif->OUTB (WIN_PACKETCMD ,IDE_COMMAND_REG ); +ide_execute_command (drive,WIN_PACKETCMD , &idetape_transfer_pc, +IDETAPE_WAIT_CMD ,NULL );return ide_started; }else { hwif->OUTB (WIN_PACKETCMD ,IDE_COMMAND_REG );
Re: [PATCH 01/16] ide-tape: use ide_execute_command()
Quoted 1 line · Bartlomiej Zolnierkiewicz
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 2/16 ide-scsi: use ide_execute_command()
In reply to Bartlomiej Zolnierkiewicz--- drivers/scsi/ide-scsi.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/scsi/ide-scsi.c +2 -5
@@ -596,11 +596,8 @@ static ide_startstop_t idescsi_issue_pcset_bit (PC_DMA_OK , &pc->flags);if (test_bit (IDESCSI_DRQ_INTERRUPT , &scsi->flags)) { -BUG_ON (HWGROUP (drive)->handler !=NULL ); -ide_set_handler (drive, &idescsi_transfer_pc, -get_timeout (pc), idescsi_expiry); -/* Issue the packet command */ -HWIF (drive)->OUTB (WIN_PACKETCMD ,IDE_COMMAND_REG ); +ide_execute_command (drive,WIN_PACKETCMD , &idescsi_transfer_pc, +get_timeout (pc), idescsi_expiry);return ide_started; }else {/* Issue the packet command */
Re: [PATCH 02/16] ide-scsi: use ide_execute_command()
Quoted 1 line · Bartlomiej Zolnierkiewicz
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 3/16 trm290: use ide_execute_command()
In reply to Bartlomiej Zolnierkiewicz--- drivers/ide/pci/trm290.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/ide/pci/trm290.c +1 -4
@@ -177,10 +177,7 @@ static void trm290_selectproc (ide_drivestatic void trm290_dma_exec_cmd (ide_drive_t *drive,u8 command) { -BUG_ON (HWGROUP (drive)->handler !=NULL );/* paranoia check */ -ide_set_handler (drive, &ide_dma_intr,WAIT_CMD ,NULL ); -/* issue cmd to drive */ -outb (command,IDE_COMMAND_REG ); +ide_execute_command (drive, command, &ide_dma_intr,WAIT_CMD ,NULL ); }static int trm290_dma_setup (ide_drive_t *drive)
Re: [PATCH 03/16] trm290: use ide_execute_command()
Quoted 1 line · Bartlomiej Zolnierkiewicz
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 4/16 ide-cris: use ide_execute_command()
In reply to Bartlomiej Zolnierkiewicz--- drivers/ide/cris/ide-cris.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/ide/cris/ide-cris.c +1 -5
@@ -1034,11 +1034,7 @@ static int cris_dma_setup(ide_drive_t *dstatic void cris_dma_exec_cmd (ide_drive_t *drive,u8 command) { -/* set the irq handler which will finish the request when DMA is done */ -ide_set_handler (drive, &cris_dma_intr,WAIT_CMD ,NULL ); - -/* issue cmd to drive */ -cris_ide_outb (command,IDE_COMMAND_REG ); +ide_execute_command (drive, command, &cris_dma_intr,WAIT_CMD ,NULL ); }static void cris_dma_start (ide_drive_t *drive)
Re: [PATCH 04/16] ide-cris: use ide_execute_command()
Quoted 1 line · Bartlomiej Zolnierkiewicz
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 5/16 ide-probe: remove needless Status register reads
In reply to Bartlomiej Zolnierkiewicz* Cache value read from the Status register in 'stat' variable in do_probe() and enable_nest(), then remove remove needless Status register reads.
While at it:
* Add proper KERN_* levels to printk() calls.
--- drivers/ide/ide-probe.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-)
drivers/ide/ide-probe.c +21 -14
@@ -423,8 +423,9 @@ static int ide_busy_sleep(ide_hwif_t *hwstatic int do_probe (ide_drive_t *drive,u8 cmd) { -int rc;ide_hwif_t *hwif =HWIF (drive); +int rc; +u8 stat;if (drive->present) {/* avoid waiting for inappropriate probes */
@@ -461,15 +462,17 @@ static int do_probe (ide_drive_t *drive,/* failed: try again */ rc =try_to_identify (drive,cmd); } -if (hwif->INB (IDE_STATUS_REG ) == (BUSY_STAT |READY_STAT )) + + stat = hwif->INB (IDE_STATUS_REG ); + +if (stat == (BUSY_STAT |READY_STAT ))return 4 ;if ((rc ==1 && cmd ==WIN_PIDENTIFY ) && ((drive->autotune ==IDE_TUNE_DEFAULT ) || (drive->autotune ==IDE_TUNE_AUTO ))) { -printk ("%s: no response (status = 0x%02x), " -"resetting drive\n" , drive->name, - hwif->INB (IDE_STATUS_REG )); +printk (KERN_ERR "%s: no response (status = 0x%02x), " +"resetting drive\n" , drive->name, stat);msleep (50 ); hwif->OUTB (drive->select.all,IDE_SELECT_REG );msleep (50 );
@@ -477,11 +480,13 @@ static int do_probe (ide_drive_t *drive, (void )ide_busy_sleep (hwif); rc =try_to_identify (drive, cmd); } + +/* ensure drive IRQ is clear */ + stat = hwif->INB (IDE_STATUS_REG ); +if (rc ==1 ) -printk ("%s: no response (status = 0x%02x)\n" , - drive->name, hwif->INB (IDE_STATUS_REG )); -/* ensure drive irq is clear */ - (void ) hwif->INB (IDE_STATUS_REG ); +printk (KERN_ERR "%s: no response (status = 0x%02x)\n" , + drive->name, stat); }else {/* not present or maybe ATAPI */ rc =3 ;
@@ -502,6 +507,7 @@ static int do_probe (ide_drive_t *drive,static void enable_nest (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); +u8 stat;printk ("%s: enabling %s -- " , hwif->name, drive->id->model);SELECT_DRIVE (drive);
@@ -515,11 +521,12 @@ static void enable_nest (ide_drive_t *drmsleep (50 ); -if (!OK_STAT ((hwif->INB (IDE_STATUS_REG )),0 ,BAD_STAT )) { -printk ("failed (status = 0x%02x)\n" , hwif->INB (IDE_STATUS_REG )); - }else { -printk ("success\n" ); - } + stat = hwif->INB (IDE_STATUS_REG ); + +if (!OK_STAT (stat,0 ,BAD_STAT )) +printk (KERN_CONT "failed (status = 0x%02x)\n" , stat); +else +printk (KERN_CONT "success\n" );/* if !(success||timed-out) */ if (do_probe (drive,WIN_IDENTIFY ) >=2 ) {
PATCH 6/16 ide: remove unused ->auto_poll field from ide_hwif_t
In reply to Bartlomiej Zolnierkiewicz--- include/linux/ide.h | 1 - 1 file changed, 1 deletion(-)
include/linux/ide.h +0 -1
@@ -607,7 +607,6 @@ typedef struct hwif_s { unsigned serialized : 1; /* serialized all channel operation */ unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ unsigned reset : 1; /* reset after probe */ - unsigned auto_poll : 1; /* supports nop auto-poll */ unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ unsigned mmio : 1; /* host uses MMIO */
Re: [PATCH 06/16] ide: remove unused ->auto_poll field from ide_hwif_t
Quoted 1 line · Bartlomiej Zolnierkiewicz
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 7/16 ide: convert ->straight8 field in ide_hwif_t to bit flag
In reply to Bartlomiej Zolnierkiewicz--- include/linux/ide.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/ide.h +1 -1
@@ -488,7 +488,6 @@ typedef struct hwif_s {u8 major;/* our major number */ u8 index;/* 0 for ide0; 1 for ide1; ... */ u8 channel;/* for dual-port chips: 0=primary, 1=secondary */ -u8 straight8;/* Alan's straight 8 check */ u8 bus_state;/* power state of the IDE bus */ u32 host_flags;
@@ -609,6 +608,7 @@ typedef struct hwif_s { unsigned reset : 1; /* reset after probe */ unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ unsigned mmio : 1; /* host uses MMIO */ + unsigned straight8 : 1; /* Alan's straight 8 check */struct device gendev;struct completion gendev_rel_comp;/* To deal with device release() */
Re: [PATCH 07/16] ide: convert ->straight8 field in ide_hwif_t to bit flag
Quoted 1 line · Bartlomiej Zolnierkiewicz
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 8/16 ide: remove ->nice0 and ->nice2 fields from ide_drive_t
In reply to Bartlomiej Zolnierkiewicz* ->nice0 and ->nice2 ide_drive_t fields are always zero so remove them.
* IDE_NICE_0 and IDE_NICE_2 defines from <linux/hdreg.h> are no longer used by any kernel code so cover them with #ifndef/#endif __KERNEL__.
--- drivers/ide/ide.c | 5 +---- include/linux/hdreg.h | 4 +++- include/linux/ide.h | 2 -- 3 files changed, 4 insertions(+), 7 deletions(-)
drivers/ide/ide.c +1 -4
@@ -1035,11 +1035,8 @@ int generic_ide_ioctl(ide_drive_t *drivecase HDIO_GET_NICE :return put_user (drive->dsc_overlap <<IDE_NICE_DSC_OVERLAP | drive->atapi_overlap <<IDE_NICE_ATAPI_OVERLAP | - drive->nice0 <<IDE_NICE_0 | - drive->nice1 <<IDE_NICE_1 | - drive->nice2 <<IDE_NICE_2 , + drive->nice1 <<IDE_NICE_1 , (long __user *) arg); -#ifdef CONFIG_IDE_TASK_IOCTL case HDIO_DRIVE_TASKFILE :if (!capable (CAP_SYS_ADMIN ) || !capable (CAP_SYS_RAWIO ))
include/linux/hdreg.h +3 -1
@@ -706,8 +706,10 @@ struct hd_driveid {*/ #define IDE_NICE_DSC_OVERLAP (0)/* per the DSC overlap protocol */ #define IDE_NICE_ATAPI_OVERLAP (1)/* not supported yet */ -#define IDE_NICE_0 (2)/* when sure that it won't affect us */ #define IDE_NICE_1 (3)/* when probably won't affect us much */ +#ifndef __KERNEL__ +#define IDE_NICE_0 (2)/* when sure that it won't affect us */ #define IDE_NICE_2 (4)/* when we know it's on our expense */ +#endif #endif /* _LINUX_HDREG_H */
include/linux/ide.h +0 -2
@@ -407,8 +407,6 @@ typedef struct ide_drive_s { unsigned no_unmask : 1; /* disallow setting unmask bit */ unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ - unsigned nice0 : 1; /* give obvious excess bandwidth */ - unsigned nice2 : 1; /* give a share in our own bandwidth */ unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ unsigned nodma : 1; /* disallow DMA */ unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */
Re: [PATCH 08/16] ide: remove ->nice0 and ->nice2 fields from ide_drive_t
Quoted 6 lines · Bartlomiej Zolnierkiewicz
* ->nice0 and ->nice2
ide_drive_tfields are always zero so remove them.*
IDE_NICE_0andIDE_NICE_2defines from <linux/hdreg.h> are no longer used by any kernel code so cover them with #ifndef/#endif__KERNEL__.Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 9/16 ide: remove SATA_*_REG macros
In reply to Bartlomiej Zolnierkiewicz* siimage.c: use hwif->sata_scr[SATA_{ERROR,STATUS}_OFFSET] instead of SATA_{ERROR,STATUS}_REG macros.
* Remove no longer needed SATA_*_REG macros.
While at it:
* Remove needless SATA Status register read from sil_sata_reset_poll().
--- drivers/ide/pci/siimage.c | 25 ++++++++++++++++--------- include/linux/ide.h | 6 ------ 2 files changed, 16 insertions(+), 15 deletions(-)
drivers/ide/pci/siimage.c +16 -9
@@ -331,15 +331,18 @@ static int siimage_mmio_ide_dma_test_irq {ide_hwif_t *hwif =HWIF (drive);unsigned long addr =siimage_selreg (hwif,0x1 ); +void __iomem *sata_error_addr + = (void __iomem *)hwif->sata_scr[SATA_ERROR_OFFSET ]; -if (SATA_ERROR_REG ) { +if (sata_error_addr) {unsigned long base = (unsigned long )hwif->hwif_data; -u32 ext_stat =readl ((void __iomem *)(base +0x10 ));u8 watchdog =0 ; +if (ext_stat & ((hwif->channel) ?0x40 :0x10 )) { -u32 sata_error =readl ((void __iomem *)SATA_ERROR_REG ); -writel (sata_error, (void __iomem *)SATA_ERROR_REG ); +u32 sata_error =readl (sata_error_addr); + +writel (sata_error, sata_error_addr); watchdog = (sata_error &0x00680000 ) ?1 :0 ; printk(KERN_WARNING "%s: sata_error = 0x%08x, " "watchdog = %d, %s\n",
@@ -418,13 +421,17 @@ static int sil_sata_busproc(ide_drive_tstatic int sil_sata_reset_poll (ide_drive_t *drive) { -if (SATA_STATUS_REG ) { -ide_hwif_t *hwif =HWIF (drive); +ide_hwif_t *hwif = drive->hwif; +void __iomem *sata_status_addr + = (void __iomem *)hwif->sata_scr[SATA_STATUS_OFFSET ]; + +if (sata_status_addr) { +/* SATA Status is available only when in MMIO mode */ +u32 sata_stat =readl (sata_status_addr); -/* SATA_STATUS_REG is valid only when in MMIO mode */ -if ((readl ((void __iomem *)SATA_STATUS_REG ) &0x03 ) !=0x03 ) { +if ((sata_stat &0x03 ) !=0x03 ) {printk (KERN_WARNING "%s: reset phy dead, status=0x%08x\n" , - hwif->name,readl ((void __iomem *)SATA_STATUS_REG )); + hwif->name, sata_stat);HWGROUP (drive)->polling =0 ;return ide_started; }
include/linux/ide.h +0 -6
@@ -112,18 +112,12 @@ typedef unsigned char byte; /* used ever#define SATA_NR_PORTS (3)/* 16 possible ?? */ #define SATA_STATUS_OFFSET (0) -#define SATA_STATUS_REG (HWIF(drive)->sata_scr[SATA_STATUS_OFFSET])#define SATA_ERROR_OFFSET (1) -#define SATA_ERROR_REG (HWIF(drive)->sata_scr[SATA_ERROR_OFFSET])#define SATA_CONTROL_OFFSET (2) -#define SATA_CONTROL_REG (HWIF(drive)->sata_scr[SATA_CONTROL_OFFSET])#define SATA_MISC_OFFSET (0) -#define SATA_MISC_REG (HWIF(drive)->sata_misc[SATA_MISC_OFFSET])#define SATA_PHY_OFFSET (1) -#define SATA_PHY_REG (HWIF(drive)->sata_misc[SATA_PHY_OFFSET])#define SATA_IEN_OFFSET (2) -#define SATA_IEN_REG (HWIF(drive)->sata_misc[SATA_IEN_OFFSET])/* * Our Physical Region Descriptor (PRD) table should be large enough
PATCH 10/16 ide: use __ide_set_handler() in ide_execute_command()
In reply to Bartlomiej Zolnierkiewicz* Use __ide_set_handler() in ide_execute_command().
While at it:
* Fix whitespace damage in ide_execute_command().
--- drivers/ide/ide-iops.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
drivers/ide/ide-iops.c +8 -13
@@ -882,22 +882,17 @@ void ide_execute_command(ide_drive_t *drunsigned long flags;ide_hwgroup_t *hwgroup =HWGROUP (drive);ide_hwif_t *hwif =HWIF (drive); - +spin_lock_irqsave (&ide_lock, flags); -BUG_ON (hwgroup->handler); - hwgroup->handler = handler; - hwgroup->expiry = expiry; - hwgroup->timer.expires = jiffies + timeout; - hwgroup->req_gen_timer = hwgroup->req_gen; -add_timer (&hwgroup->timer); +__ide_set_handler (drive, handler, timeout, expiry); hwif->OUTBSYNC (drive, cmd,IDE_COMMAND_REG ); -/* Drive takes 400nS to respond, we must avoid the IRQ being -serviced before that. -- FIXME: we could skip this delay with care on non shared -devices -*/ +/* +* Drive takes 400nS to respond, we must avoid the IRQ being +* serviced before that. +* +* FIXME: we could skip this delay with care on non shared devices +*/ ndelay (400 );spin_unlock_irqrestore (&ide_lock, flags); }
Re: [PATCH 10/16] ide: use __ide_set_handler() in ide_execute_command()
Quoted 7 lines · Bartlomiej Zolnierkiewicz
* Use
__ide_set_handler()inide_execute_command().While at it:
* Fix whitespace damage in
ide_execute_command().Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 11/16 ide: unexport SELECT_DRIVE()
In reply to Bartlomiej Zolnierkiewicz--- drivers/ide/ide-iops.c | 2 -- 1 file changed, 2 deletions(-)
drivers/ide/ide-iops.c +0 -2
@@ -163,8 +163,6 @@ void SELECT_DRIVE (ide_drive_t *drive)HWIF (drive)->OUTB (drive->select.all,IDE_SELECT_REG ); } -EXPORT_SYMBOL (SELECT_DRIVE ); -void SELECT_MASK (ide_drive_t *drive,int mask) {if (HWIF (drive)->maskproc)
Re: [PATCH 11/16] ide: unexport SELECT_DRIVE()
Quoted 1 line · Bartlomiej Zolnierkiewicz
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 12/16 ide: remove set_transfer()
In reply to Bartlomiej Zolnierkiewicz--- drivers/ide/ide-iops.c | 18 ------------------ drivers/ide/ide-taskfile.c | 6 +++++- include/linux/ide.h | 1 - 3 files changed, 5 insertions(+), 20 deletions(-)
drivers/ide/ide-iops.c +0 -18
@@ -627,24 +627,6 @@ int ide_ata66_check (ide_drive_t *drive,return 0 ; } -/* -* Backside of HDIO_DRIVE_CMD call of SETFEATURES_XFER. -* 1 : Safe to update drive->id DMA registers. -* 0 : OOPs not allowed. -*/ -int set_transfer (ide_drive_t *drive,ide_task_t *args) -{ -if (args->tf.command ==WIN_SETFEATURES && - args->tf.nsect >=XFER_SW_DMA_0 && - args->tf.feature ==SETFEATURES_XFER && - (drive->id->dma_ultra || - drive->id->dma_mword || - drive->id->dma_1word)) -return 1 ; - -return 0 ; -} -#ifdef CONFIG_BLK_DEV_IDEDMA static u8 ide_auto_reduce_xfer (ide_drive_t *drive) {
drivers/ide/ide-taskfile.c +5 -1
@@ -755,6 +755,7 @@ int ide_cmd_ioctl (ide_drive_t *drive, uu8 args[4 ], xfer_rate =0 ;ide_task_t tfargs;struct ide_taskfile *tf = &tfargs.tf; +struct hd_driveid *id = drive->id;if (NULL == (void *) arg) {struct request rq;
@@ -792,7 +793,10 @@ int ide_cmd_ioctl (ide_drive_t *drive, ureturn -ENOMEM ; } -if (set_transfer (drive, &tfargs)) { +if (tf->command ==WIN_SETFEATURES && + tf->feature ==SETFEATURES_XFER && + tf->nsect >=XFER_SW_DMA_0 && + (id->dma_ultra || id->dma_mword || id->dma_1word)) { xfer_rate = args[1 ];if (ide_ata66_check (drive, &tfargs)) goto abort;
include/linux/ide.h +0 -1
@@ -993,7 +993,6 @@ extern int ide_driveid_update(ide_drive_extern int ide_ata66_check (ide_drive_t *,ide_task_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 *);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 12/16] ide: remove set_transfer()
Quoted 1 line · Bartlomiej Zolnierkiewicz
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 13/16 ide: remove ide_ata66_check()
In reply to Bartlomiej Zolnierkiewicz--- drivers/ide/ide-iops.c | 15 --------------- drivers/ide/ide-taskfile.c | 5 ++++- include/linux/ide.h | 1 - 3 files changed, 4 insertions(+), 17 deletions(-)
drivers/ide/ide-iops.c +0 -15
@@ -612,21 +612,6 @@ no_80w:return 0 ; } -int ide_ata66_check (ide_drive_t *drive,ide_task_t *args) -{ -if (args->tf.command ==WIN_SETFEATURES && - args->tf.nsect >XFER_UDMA_2 && - args->tf.feature ==SETFEATURES_XFER ) { -if (eighty_ninty_three (drive) ==0 ) { -printk (KERN_WARNING "%s: UDMA speeds >UDMA33 cannot " -"be set\n" , drive->name); -return 1 ; - } - } - -return 0 ; -} -#ifdef CONFIG_BLK_DEV_IDEDMA static u8 ide_auto_reduce_xfer (ide_drive_t *drive) {
drivers/ide/ide-taskfile.c +4 -1
@@ -798,8 +798,11 @@ int ide_cmd_ioctl (ide_drive_t *drive, u tf->nsect >= XFER_SW_DMA_0 && (id->dma_ultra || id->dma_mword || id->dma_1word)) { xfer_rate = args[1 ]; -if (ide_ata66_check (drive, &tfargs)) +if (tf->nsect >XFER_UDMA_2 && !eighty_ninty_three (drive)) { +printk (KERN_WARNING "%s: UDMA speeds >UDMA33 cannot " +"be set\n" , drive->name); goto abort; + } } err =ide_raw_taskfile (drive, &tfargs, buf, args[3 ]);
include/linux/ide.h +0 -1
@@ -990,7 +990,6 @@ 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 *);extern int ide_config_drive_speed (ide_drive_t *,u8 );extern u8 eighty_ninty_three (ide_drive_t *);extern int taskfile_lib_get_identify (ide_drive_t *drive,u8 *);
Re: [PATCH 13/16] ide: remove ide_ata66_check()
Quoted 1 line · Bartlomiej Zolnierkiewicz
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 14/16 ide: move drive->crc_count check out from check_dma_crc()
In reply to Bartlomiej Zolnierkiewicz--- drivers/ide/ide-iops.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/ide/ide-iops.c +12 -12
@@ -968,13 +968,10 @@ static ide_startstop_t reset_pollfunc (istatic void check_dma_crc (ide_drive_t *drive) {#ifdef CONFIG_BLK_DEV_IDEDMA -if (drive->crc_count) { -ide_dma_off_quietly (drive); -ide_set_xfer_rate (drive,ide_auto_reduce_xfer (drive)); -if (drive->current_speed >=XFER_SW_DMA_0 ) -ide_dma_on (drive); - }else -ide_dma_off (drive); +ide_dma_off_quietly (drive); +ide_set_xfer_rate (drive,ide_auto_reduce_xfer (drive)); +if (drive->current_speed >=XFER_SW_DMA_0 ) +ide_dma_on (drive);#endif }
@@ -999,17 +996,20 @@ static void pre_reset(ide_drive_t *driveelse drive->post_reset =1 ; -if (!drive->keep_settings) { -if (drive->using_dma) { +if (drive->using_dma) { +if (drive->crc_count)check_dma_crc (drive); - }else { +else +ide_dma_off (drive); + } + +if (!drive->keep_settings) { +if (!drive->using_dma) { drive->unmask =0 ; drive->io_32bit =0 ; }return ; } -if (drive->using_dma) -check_dma_crc (drive);if (HWIF (drive)->pre_reset !=NULL )HWIF (drive)->pre_reset (drive);
Re: [PATCH 14/16] ide: move drive->crc_count check out from check_dma_crc()
Quoted 1 line · Bartlomiej Zolnierkiewicz
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 15/16 ide: remove ide_auto_reduce_xfer()
In reply to Bartlomiej ZolnierkiewiczWhile at it:
* Remove needless '!drive->crc_count' check.
--- drivers/ide/ide-iops.c | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-)
drivers/ide/ide-iops.c +13 -28
@@ -612,33 +612,6 @@ no_80w:return 0 ; } -#ifdef CONFIG_BLK_DEV_IDEDMA -static u8 ide_auto_reduce_xfer (ide_drive_t *drive) -{ -if (!drive->crc_count) -return drive->current_speed; - drive->crc_count =0 ; - -switch (drive->current_speed) { -case XFER_UDMA_7 :return XFER_UDMA_6 ; -case XFER_UDMA_6 :return XFER_UDMA_5 ; -case XFER_UDMA_5 :return XFER_UDMA_4 ; -case XFER_UDMA_4 :return XFER_UDMA_3 ; -case XFER_UDMA_3 :return XFER_UDMA_2 ; -case XFER_UDMA_2 :return XFER_UDMA_1 ; -case XFER_UDMA_1 :return XFER_UDMA_0 ; -/* -* OOPS we do not goto non Ultra DMA modes -* without iCRC's available we force -* the system to PIO and make the user -* invoke the ATA-1 ATA-2 DMA modes. -*/ -case XFER_UDMA_0 : -default :return XFER_PIO_4 ; - } -} -#endif /* CONFIG_BLK_DEV_IDEDMA */ -int ide_driveid_update (ide_drive_t *drive) {ide_hwif_t *hwif = drive->hwif;
@@ -968,8 +941,20 @@ static ide_startstop_t reset_pollfunc (istatic void check_dma_crc (ide_drive_t *drive) {#ifdef CONFIG_BLK_DEV_IDEDMA +u8 mode; +ide_dma_off_quietly (drive); -ide_set_xfer_rate (drive,ide_auto_reduce_xfer (drive)); + drive->crc_count =0 ; + mode = drive->current_speed; +/* +* Don't try non Ultra-DMA modes without iCRC's. Force the +* device to PIO and make the user enable SWDMA/MWDMA modes. +*/ +if (mode >XFER_UDMA_0 && mode <=XFER_UDMA_7 ) + mode--; +else + mode =XFER_PIO_4 ; +ide_set_xfer_rate (drive, mode);if (drive->current_speed >=XFER_SW_DMA_0 )ide_dma_on (drive);#endif
Re: [PATCH 15/16] ide: remove ide_auto_reduce_xfer()
Quoted 5 lines · Bartlomiej Zolnierkiewicz
While at it:
* Remove needless '!drive->crc_count' check.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 16/16 ide: move check_dma_crc() to ide-dma.c
In reply to Bartlomiej Zolnierkiewicz* Move check_dma_crc() to ide-dma.c and add inline version for CONFIG_BLK_DEV_IDEDMA=n case.
* Rename check_dma_crc() to ide_check_dma_crc().
--- drivers/ide/ide-dma.c | 20 ++++++++++++++++++++ drivers/ide/ide-iops.c | 24 +----------------------- include/linux/ide.h | 2 ++ 3 files changed, 23 insertions(+), 23 deletions(-)
drivers/ide/ide-dma.c +20 -0
@@ -821,6 +821,26 @@ int ide_set_dma(ide_drive_t *drive)return 0 ; } +void ide_check_dma_crc (ide_drive_t *drive) +{ +u8 mode; + +ide_dma_off_quietly (drive); + drive->crc_count =0 ; + mode = drive->current_speed; +/* +* Don't try non Ultra-DMA modes without iCRC's. Force the +* device to PIO and make the user enable SWDMA/MWDMA modes. +*/ +if (mode >XFER_UDMA_0 && mode <=XFER_UDMA_7 ) + mode--; +else + mode =XFER_PIO_4 ; +ide_set_xfer_rate (drive, mode); +if (drive->current_speed >=XFER_SW_DMA_0 ) +ide_dma_on (drive); +} +#ifdef CONFIG_BLK_DEV_IDEDMA_PCI void ide_dma_lost_irq (ide_drive_t *drive) {
drivers/ide/ide-iops.c +1 -23
@@ -938,28 +938,6 @@ static ide_startstop_t reset_pollfunc (ireturn ide_stopped; } -static void check_dma_crc (ide_drive_t *drive) -{ -#ifdef CONFIG_BLK_DEV_IDEDMA -u8 mode; - -ide_dma_off_quietly (drive); - drive->crc_count =0 ; - mode = drive->current_speed; -/* -* Don't try non Ultra-DMA modes without iCRC's. Force the -* device to PIO and make the user enable SWDMA/MWDMA modes. -*/ -if (mode >XFER_UDMA_0 && mode <=XFER_UDMA_7 ) - mode--; -else - mode =XFER_PIO_4 ; -ide_set_xfer_rate (drive, mode); -if (drive->current_speed >=XFER_SW_DMA_0 ) -ide_dma_on (drive); -#endif -} -static void ide_disk_pre_reset (ide_drive_t *drive) {int legacy = (drive->id->cfs_enable_2 &0x0400 ) ?0 :1 ;
@@ -983,7 +961,7 @@ static void pre_reset(ide_drive_t *driveif (drive->using_dma) {if (drive->crc_count) -check_dma_crc (drive); +ide_check_dma_crc (drive);else ide_dma_off (drive); }
include/linux/ide.h +2 -0
@@ -1158,6 +1158,7 @@ void ide_dma_off_quietly(ide_drive_t *);void ide_dma_off (ide_drive_t *);void ide_dma_on (ide_drive_t *);int ide_set_dma (ide_drive_t *); +void ide_check_dma_crc (ide_drive_t *);ide_startstop_t ide_dma_intr (ide_drive_t *);int ide_build_sglist (ide_drive_t *,struct request *);
@@ -1185,6 +1186,7 @@ static inline void ide_dma_off(ide_drivestatic inline void ide_dma_on (ide_drive_t *drive) { ; }static inline void ide_dma_verbose (ide_drive_t *drive) { ; }static inline int ide_set_dma (ide_drive_t *drive) {return 1 ; } +static inline void ide_check_dma_crc (ide_drive_t *drive) { ; }#endif /* CONFIG_BLK_DEV_IDEDMA */ #ifndef CONFIG_BLK_DEV_IDEDMA_PCI