ide: core code housekeeping
cover ide: core code housekeeping
Some housekeeping for core IDE code... against pata-2.6 tree...
diffstat:
drivers/ide/Kconfig | 8 + drivers/ide/Makefile | 7 - drivers/ide/ide-atapi.c | 5 drivers/ide/ide-cd.c | 4 drivers/ide/ide-devsets.c | 190 +++++++++++++++++++++++++++++++++ drivers/ide/ide-dma.c | 57 ++++++++++ drivers/ide/ide-io.c | 245 +++++++++++-------------------------------- drivers/ide/ide-iops.c | 34 ------ drivers/ide/ide-lib.c | 240 ------------------------------------------ drivers/ide/ide-park.c | 25 ++++ drivers/ide/ide-xfer-mode.c | 246 ++++++++++++++++++++++++++++++++++++++++++++ drivers/ide/ide.c | 154 --------------------------- include/linux/ide.h | 21 ++- 13 files changed, 613 insertions(+), 623 deletions(-)
PATCH 1/9 ide: remove stale comments from drive_is_ready()
From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: remove stale comments from drive_is_ready()
--- drivers/ide/ide-iops.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/ide/ide-iops.c +0 -9
@@ -436,9 +436,6 @@ void ide_fixstring (u8 *s, const int bytEXPORT_SYMBOL (ide_fixstring); -/* -* Needed for PCI irq sharing -*/ int drive_is_ready (ide_drive_t *drive) {ide_hwif_t *hwif = drive->hwif;
@@ -447,12 +444,6 @@ int drive_is_ready (ide_drive_t *drive)if (drive->waiting_for_dma)return hwif->dma_ops->dma_test_irq (drive); -/* -* We do a passive status test under shared PCI interrupts on -* cards that truly share the ATA side interrupt, but may also share -* an interrupt with another pci card/device. We make no assumptions -* about possible isa-pnp and pci-pnp issues yet. -*/ if (hwif->io_ports.ctl_addr && (hwif->host_flags &IDE_HFLAG_BROKEN_ALTSTATUS ) ==0 ) stat = hwif->tp_ops->read_altstatus (hwif);
PATCH 2/9 ide: unexport ide_devset_execute()
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: unexport ide_devset_execute()
There are no modular ide_devset_execute() users left so unexport it.
--- drivers/ide/ide-io.c | 1 - 1 file changed, 1 deletion(-)
drivers/ide/ide-io.c +0 -1
@@ -510,7 +510,6 @@ int ide_devset_execute(ide_drive_t *drivreturn ret; } -EXPORT_SYMBOL_GPL (ide_devset_execute);static ide_startstop_t ide_special_rq (ide_drive_t *drive,struct request *rq) {
PATCH 3/9 ide: move drive_is_ready() to ide-io.c
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: move drive_is_ready() to ide-io.c
Move drive_is_ready() to ide-io.c, then make it static.
Also make some minor CodingStyle fixups while at it.
--- drivers/ide/ide-io.c | 23 +++++++++++++++++++++++ drivers/ide/ide-iops.c | 25 ------------------------- include/linux/ide.h | 2 -- 3 files changed, 23 insertions(+), 27 deletions(-)
drivers/ide/ide-io.c +23 -0
@@ -884,6 +884,29 @@ static void ide_plug_device(ide_drive_tspin_unlock_irqrestore (q->queue_lock, flags); } +static int drive_is_ready (ide_drive_t *drive) +{ +ide_hwif_t *hwif = drive->hwif; +u8 stat =0 ; + +if (drive->waiting_for_dma) +return hwif->dma_ops->dma_test_irq (drive); + +if (hwif->io_ports.ctl_addr && + (hwif->host_flags &IDE_HFLAG_BROKEN_ALTSTATUS ) ==0 ) + stat = hwif->tp_ops->read_altstatus (hwif); +else +/* Note: this may clear a pending IRQ!! */ + stat = hwif->tp_ops->read_status (hwif); + +if (stat &ATA_BUSY ) +/* drive busy: definitely not interrupting */ +return 0 ; + +/* drive ready: *might* be interrupting */ +return 1 ; +} +/** * ide_timer_expiry - handle lack of an IDE interrupt * @data: timer callback magic (hwif)
drivers/ide/ide-iops.c +0 -25
@@ -436,31 +436,6 @@ void ide_fixstring (u8 *s, const int bytEXPORT_SYMBOL (ide_fixstring); -int drive_is_ready (ide_drive_t *drive) -{ -ide_hwif_t *hwif = drive->hwif; -u8 stat =0 ; - -if (drive->waiting_for_dma) -return hwif->dma_ops->dma_test_irq (drive); - -if (hwif->io_ports.ctl_addr && - (hwif->host_flags &IDE_HFLAG_BROKEN_ALTSTATUS ) ==0 ) - stat = hwif->tp_ops->read_altstatus (hwif); -else -/* Note: this may clear a pending IRQ!! */ - stat = hwif->tp_ops->read_status (hwif); - -if (stat &ATA_BUSY ) -/* drive busy: definitely not interrupting */ -return 0 ; - -/* drive ready: *might* be interrupting */ -return 1 ; -} - -EXPORT_SYMBOL (drive_is_ready); -/* * This routine busy-waits for the drive status to be not "busy". * It then checks the status for all of the "good" bits and none
include/linux/ide.h +0 -2
@@ -1198,8 +1198,6 @@ void SELECT_MASK(ide_drive_t *, int);u8 ide_read_error (ide_drive_t *);void ide_read_bcount_and_ireason (ide_drive_t *,u16 *,u8 *); -extern int drive_is_ready (ide_drive_t *); -int ide_check_atapi_device (ide_drive_t *,const char *);void ide_init_pc (struct ide_atapi_pc *);
Re: [PATCH 3/9] ide: move drive_is_ready() to ide-io.c
Quoted 5 lines · Bartlomiej Zolnierkiewicz
Move
drive_is_ready()toide-io.c, then make it static.Also make some minor CodingStyle fixups while at it.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 4/9 ide: move ide_dma_timeout_retry() to ide-dma.c
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: move ide_dma_timeout_retry() to ide-dma.c
Move ide_dma_timeout_retry() to ide-dma.c and add static inline version for CONFIG_BLK_DEV_IDEDMA=n.
--- drivers/ide/ide-dma.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/ide/ide-io.c | 57 -------------------------------------------------- include/linux/ide.h | 2 + 3 files changed, 59 insertions(+), 57 deletions(-)
drivers/ide/ide-dma.c +57 -0
@@ -464,6 +464,63 @@ void ide_dma_timeout(ide_drive_t *drive) }EXPORT_SYMBOL_GPL (ide_dma_timeout); +/* +* un-busy the port etc, and clear any pending DMA status. we want to +* retry the current request in pio mode instead of risking tossing it +* all away +*/ +ide_startstop_t ide_dma_timeout_retry (ide_drive_t *drive,int error) +{ +ide_hwif_t *hwif = drive->hwif; +struct request *rq; +ide_startstop_t ret = ide_stopped; + +/* +* end current dma transaction +*/ + +if (error <0 ) { +printk (KERN_WARNING "%s: DMA timeout error\n" , drive->name); + (void )hwif->dma_ops->dma_end (drive); + ret =ide_error (drive,"dma timeout error" , + hwif->tp_ops->read_status (hwif)); + }else { +printk (KERN_WARNING "%s: DMA timeout retry\n" , drive->name); + hwif->dma_ops->dma_timeout (drive); + } + +/* +* disable dma for now, but remember that we did so because of +* a timeout -- we'll reenable after we finish this next request +* (or rather the first chunk of it) in pio. +*/ + drive->dev_flags |=IDE_DFLAG_DMA_PIO_RETRY ; + drive->retry_pio++; +ide_dma_off_quietly (drive); + +/* +* un-busy drive etc and make sure request is sane +*/ + + rq = hwif->rq; +if (!rq) + goto out; + + hwif->rq =NULL ; + + rq->errors =0 ; + +if (!rq->bio) + goto out; + + rq->sector = rq->bio->bi_sector; + rq->current_nr_sectors =bio_iovec (rq->bio)->bv_len >>9 ; + rq->hard_cur_sectors = rq->current_nr_sectors; + rq->buffer =bio_data (rq->bio); +out: +return ret; +} +void ide_release_dma_engine (ide_hwif_t *hwif) {if (hwif->dmatable_cpu) {
drivers/ide/ide-io.c +0 -57
63 lines not on this page · raw message
include/linux/ide.h +2 -0
@@ -1465,6 +1465,7 @@ static inline int config_drive_for_dma(ivoid ide_dma_lost_irq (ide_drive_t *);void ide_dma_timeout (ide_drive_t *); +ide_startstop_t ide_dma_timeout_retry (ide_drive_t *,int );#else static inline int ide_id_dma_bug (ide_drive_t *drive) {return 0 ; }
@@ -1476,6 +1477,7 @@ static inline void ide_dma_on(ide_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) { ; } +static inline ide_startstop_t ide_dma_timeout_retry (ide_drive_t *drive,int error) {return ide_stopped; }static inline void ide_release_dma_engine (ide_hwif_t *hwif) { ; }#endif /* CONFIG_BLK_DEV_IDEDMA */
Re: [PATCH 4/9] ide: move ide_dma_timeout_retry() to ide-dma.c
Quoted 5 lines · Bartlomiej Zolnierkiewicz
Move
ide_dma_timeout_retry()toide-dma.cand add static inline version forCONFIG_BLK_DEV_IDEDMA=n.Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 5/9 ide: remove ide_do_drive_cmd()
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: remove ide_do_drive_cmd()
* Use elv_add_request() instead of __elv_add_request() in ide_do_drive_cmd().
* ide_do_drive_cmd() is used only in ide-{atapi,cd}.c so inline it there.
There should be no functional changes caused by this patch.
--- drivers/ide/ide-atapi.c | 5 ++++- drivers/ide/ide-cd.c | 4 +++- drivers/ide/ide-io.c | 28 ---------------------------- include/linux/ide.h | 2 -- 4 files changed, 7 insertions(+), 32 deletions(-)
drivers/ide/ide-atapi.c +4 -1
@@ -143,7 +143,10 @@ static void ide_queue_pc_head(ide_drive_memcpy (rq->cmd, pc->c,12 );if (drive->media == ide_tape) rq->cmd[13 ] =REQ_IDETAPE_PC1 ; -ide_do_drive_cmd (drive, rq); + + drive->hwif->rq =NULL ; + +elv_add_request (drive->queue, rq,ELEVATOR_INSERT_FRONT ,0 ); }/*
drivers/ide/ide-cd.c +3 -1
@@ -234,7 +234,9 @@ static void cdrom_queue_request_sense(idide_debug_log (IDE_DBG_SENSE ,"failed_cmd: 0x%x\n" , failed_command->cmd[0 ]); -ide_do_drive_cmd (drive, rq); + drive->hwif->rq =NULL ; + +elv_add_request (drive->queue, rq,ELEVATOR_INSERT_FRONT ,0 ); }static void cdrom_end_request (ide_drive_t *drive,int uptodate)
drivers/ide/ide-io.c +0 -28
@@ -1125,34 +1125,6 @@ out_early:return irq_ret; } -/** -* ide_do_drive_cmd - issue IDE special command -* @drive: device to issue command -* @rq: request to issue -* -* This function issues a special IDE device request -* onto the request queue. -* -* the rq is queued at the head of the request queue, displacing -* the currently-being-processed request and this function -* returns immediately without waiting for the new rq to be -* completed. This is VERY DANGEROUS, and is intended for -* careful use by the ATAPI tape/cdrom driver code. -*/ - -void ide_do_drive_cmd (ide_drive_t *drive,struct request *rq) -{ -struct request_queue *q = drive->queue; -unsigned long flags; - - drive->hwif->rq =NULL ; - -spin_lock_irqsave (q->queue_lock, flags); -__elv_add_request (q, rq,ELEVATOR_INSERT_FRONT ,0 ); -spin_unlock_irqrestore (q->queue_lock, flags); -} -EXPORT_SYMBOL (ide_do_drive_cmd); -void ide_pad_transfer (ide_drive_t *drive,int write,int len) {ide_hwif_t *hwif = drive->hwif;
include/linux/ide.h +0 -2
@@ -1172,8 +1172,6 @@ extern ide_startstop_t ide_do_reset (ideextern int ide_devset_execute (ide_drive_t *drive,const struct ide_devset *setting,int arg); -extern void ide_do_drive_cmd (ide_drive_t *,struct request *); -extern void ide_end_drive_cmd (ide_drive_t *,u8 ,u8 );void ide_tf_dump (const char *,struct ide_taskfile *);
Re: [PATCH 5/9] ide: remove ide_do_drive_cmd()
Hello.
Quoted 8 lines · Bartlomiej Zolnierkiewicz
* Use
elv_add_request()instead of__elv_add_request()inide_do_drive_cmd().*
ide_do_drive_cmd()is used only in ide-{atapi,cd}.c so inline it there.There should be no functional changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 6/9 ide: factor out processing of special commands from ide_special_rq()
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: factor out processing of special commands from ide_special_rq()
Factor out processing of special commands from ide_special_rq() to ide_do_devset() and ide_do_park_unpark().
There should be no functional changes caused by this patch.
--- drivers/ide/ide-io.c | 75 +++++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 34 deletions(-)
drivers/ide/ide-io.c +41 -34
@@ -511,46 +511,53 @@ int ide_devset_execute(ide_drive_t *drivreturn ret; } +static ide_startstop_t ide_do_devset (ide_drive_t *drive,struct request *rq) +{ +int err, (*setfunc)(ide_drive_t *,int ) = rq->special; + + err =setfunc (drive, *(int *)&rq->cmd[1 ]); +if (err) + rq->errors = err; +else + err =1 ; +ide_end_request (drive, err,0 ); +return ide_stopped; +} + +static ide_startstop_t ide_do_park_unpark (ide_drive_t *drive,struct request *rq) +{ +ide_task_t task; +struct ide_taskfile *tf = &task.tf; + +memset (&task,0 ,sizeof (task)); +if (rq->cmd[0 ] ==REQ_PARK_HEADS ) { + drive->sleep = *(unsigned long *)rq->special; + drive->dev_flags |=IDE_DFLAG_SLEEPING ; + tf->command =ATA_CMD_IDLEIMMEDIATE ; + tf->feature =0x44 ; + tf->lbal =0x4c ; + tf->lbam =0x4e ; + tf->lbah =0x55 ; + task.tf_flags |=IDE_TFLAG_CUSTOM_HANDLER ; + }else /* cmd == REQ_UNPARK_HEADS */ + tf->command =ATA_CMD_CHK_POWER ; + + task.tf_flags |=IDE_TFLAG_TF |IDE_TFLAG_DEVICE ; + task.rq = rq; + drive->hwif->data_phase = task.data_phase =TASKFILE_NO_DATA ; +return do_rw_taskfile (drive, &task); +} +static ide_startstop_t ide_special_rq (ide_drive_t *drive,struct request *rq) {u8 cmd = rq->cmd[0 ]; -if (cmd ==REQ_PARK_HEADS || cmd ==REQ_UNPARK_HEADS ) { -ide_task_t task; -struct ide_taskfile *tf = &task.tf; - -memset (&task,0 ,sizeof (task)); -if (cmd ==REQ_PARK_HEADS ) { - drive->sleep = *(unsigned long *)rq->special; - drive->dev_flags |=IDE_DFLAG_SLEEPING ; - tf->command =ATA_CMD_IDLEIMMEDIATE ; - tf->feature =0x44 ; - tf->lbal =0x4c ; - tf->lbam =0x4e ; - tf->lbah =0x55 ; - task.tf_flags |=IDE_TFLAG_CUSTOM_HANDLER ; - }else /* cmd == REQ_UNPARK_HEADS */ - tf->command =ATA_CMD_CHK_POWER ; - - task.tf_flags |=IDE_TFLAG_TF |IDE_TFLAG_DEVICE ; - task.rq = rq; - drive->hwif->data_phase = task.data_phase =TASKFILE_NO_DATA ; -return do_rw_taskfile (drive, &task); - } -switch (cmd) { +case REQ_PARK_HEADS : +case REQ_UNPARK_HEADS : +return ide_do_park_unpark (drive, rq);case REQ_DEVSET_EXEC : - { -int err, (*setfunc)(ide_drive_t *,int ) = rq->special; - - err =setfunc (drive, *(int *)&rq->cmd[1 ]); -if (err) - rq->errors = err; -else - err =1 ; -ide_end_request (drive, err,0 ); -return ide_stopped; - } +return ide_do_devset (drive, rq);case REQ_DRIVE_RESET :return ide_do_reset (drive);default :
PATCH 7/9 ide: move ide_do_park_unpark() to ide-park.c
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: move ide_do_park_unpark() to ide-park.c
--- drivers/ide/ide-io.c | 24 ------------------------ drivers/ide/ide-park.c | 25 +++++++++++++++++++++++++ include/linux/ide.h | 2 ++ 3 files changed, 27 insertions(+), 24 deletions(-)
drivers/ide/ide-io.c +0 -24
@@ -524,30 +524,6 @@ static ide_startstop_t ide_do_devset(idereturn ide_stopped; } -static ide_startstop_t ide_do_park_unpark (ide_drive_t *drive,struct request *rq) -{ -ide_task_t task; -struct ide_taskfile *tf = &task.tf; - -memset (&task,0 ,sizeof (task)); -if (rq->cmd[0 ] ==REQ_PARK_HEADS ) { - drive->sleep = *(unsigned long *)rq->special; - drive->dev_flags |=IDE_DFLAG_SLEEPING ; - tf->command =ATA_CMD_IDLEIMMEDIATE ; - tf->feature =0x44 ; - tf->lbal =0x4c ; - tf->lbam =0x4e ; - tf->lbah =0x55 ; - task.tf_flags |=IDE_TFLAG_CUSTOM_HANDLER ; - }else /* cmd == REQ_UNPARK_HEADS */ - tf->command =ATA_CMD_CHK_POWER ; - - task.tf_flags |=IDE_TFLAG_TF |IDE_TFLAG_DEVICE ; - task.rq = rq; - drive->hwif->data_phase = task.data_phase =TASKFILE_NO_DATA ; -return do_rw_taskfile (drive, &task); -} -static ide_startstop_t ide_special_rq (ide_drive_t *drive,struct request *rq) {u8 cmd = rq->cmd[0 ];
drivers/ide/ide-park.c +25 -0
@@ -1,5 +1,6 @@#include <linux/kernel.h> #include <linux/ide.h> +#include <linux/hdreg.h> #include <linux/jiffies.h> #include <linux/blkdev.h>
@@ -60,6 +61,30 @@ out:return ; } +ide_startstop_t ide_do_park_unpark (ide_drive_t *drive,struct request *rq) +{ +ide_task_t task; +struct ide_taskfile *tf = &task.tf; + +memset (&task,0 ,sizeof (task)); +if (rq->cmd[0 ] ==REQ_PARK_HEADS ) { + drive->sleep = *(unsigned long *)rq->special; + drive->dev_flags |=IDE_DFLAG_SLEEPING ; + tf->command =ATA_CMD_IDLEIMMEDIATE ; + tf->feature =0x44 ; + tf->lbal =0x4c ; + tf->lbam =0x4e ; + tf->lbah =0x55 ; + task.tf_flags |=IDE_TFLAG_CUSTOM_HANDLER ; + }else /* cmd == REQ_UNPARK_HEADS */ + tf->command =ATA_CMD_CHK_POWER ; + + task.tf_flags |=IDE_TFLAG_TF |IDE_TFLAG_DEVICE ; + task.rq = rq; + drive->hwif->data_phase = task.data_phase =TASKFILE_NO_DATA ; +return do_rw_taskfile (drive, &task); +} +ssize_t ide_park_show (struct device *dev,struct device_attribute *attr,char *buf) {
include/linux/ide.h +2 -0
@@ -1167,6 +1167,8 @@ int ide_busy_sleep(ide_hwif_t *, unsigneint ide_wait_stat (ide_startstop_t *,ide_drive_t *,u8 ,u8 ,unsigned long ); +ide_startstop_t ide_do_park_unpark (ide_drive_t *,struct request *); +extern ide_startstop_t ide_do_reset (ide_drive_t *); extern int ide_devset_execute(ide_drive_t *drive,
Re: [PATCH 7/9] ide: move ide_do_park_unpark() to ide-park.c
Quoted 2 lines · Bartlomiej Zolnierkiewicz
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 8/9 ide: move device settings code to ide-devsets.c
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: move device settings code to ide-devsets.c
Remove stale comment from ide.c while at it.
--- drivers/ide/Makefile | 3 drivers/ide/ide-devsets.c | 190 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/ide/ide-io.c | 37 -------- drivers/ide/ide.c | 154 ------------------------------------- include/linux/ide.h | 1 5 files changed, 193 insertions(+), 192 deletions(-)
drivers/ide/Makefile +2 -1
@@ -5,7 +5,8 @@ EXTRA_CFLAGS += -Idrivers/ide ide-core-y += ide.o ide-ioctls.o ide-io.o ide-iops.o ide-lib.o ide-probe.o \ - ide-taskfile.o ide-pm.o ide-park.o ide-pio-blacklist.o ide-sysfs.o + ide-taskfile.o ide-pm.o ide-park.o ide-pio-blacklist.o \ + ide-sysfs.o ide-devsets.o # core IDE code ide-core-$(CONFIG_IDE_TIMINGS) += ide-timings.o
drivers/ide/ide-devsets.c new file +190 -0
190 lines not on this page · raw message
drivers/ide/ide-io.c +0 -37
@@ -487,43 +487,6 @@ static ide_startstop_t execute_drive_cmdreturn ide_stopped; } -int ide_devset_execute (ide_drive_t *drive,const struct ide_devset *setting, -int arg) -{ -struct request_queue *q = drive->queue; -struct request *rq; -int ret =0 ; - -if (!(setting->flags &DS_SYNC )) -return setting->set (drive, arg); - - rq =blk_get_request (q,READ , __GFP_WAIT); - rq->cmd_type =REQ_TYPE_SPECIAL ; - rq->cmd_len =5 ; - rq->cmd[0 ] =REQ_DEVSET_EXEC ; - *(int *)&rq->cmd[1 ] = arg; - rq->special = setting->set; - -if (blk_execute_rq (q,NULL , rq,0 )) - ret = rq->errors; -blk_put_request (rq); - -return ret; -} - -static ide_startstop_t ide_do_devset (ide_drive_t *drive,struct request *rq) -{ -int err, (*setfunc)(ide_drive_t *,int ) = rq->special; - - err =setfunc (drive, *(int *)&rq->cmd[1 ]); -if (err) - rq->errors = err; -else - err =1 ; -ide_end_request (drive, err,0 ); -return ide_stopped; -} -static ide_startstop_t ide_special_rq (ide_drive_t *drive,struct request *rq) {u8 cmd = rq->cmd[0 ];
drivers/ide/ide.c +0 -154
160 lines not on this page · raw message
include/linux/ide.h +1 -0
@@ -1168,6 +1168,7 @@ int ide_busy_sleep(ide_hwif_t *, unsigneint ide_wait_stat (ide_startstop_t *,ide_drive_t *,u8 ,u8 ,unsigned long );ide_startstop_t ide_do_park_unpark (ide_drive_t *,struct request *); +ide_startstop_t ide_do_devset (ide_drive_t *,struct request *);extern ide_startstop_t ide_do_reset (ide_drive_t *);
PATCH 9/9 ide: move xfer mode tuning code to ide-xfer-mode.c
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: move xfer mode tuning code to ide-xfer-mode.c
* Move xfer mode tuning code to ide-xfer-mode.c.
* Add CONFIG_IDE_XFER_MODE config option to be selected by host drivers that support xfer mode tuning.
* Add CONFIG_IDE_XFER_MODE=n static inline versions of ide_set_pio() and ide_set_xfer_rate().
* Make IDE_TIMINGS and BLK_DEV_IDEDMA config options select IDE_XFER_MODE, also add explicit selects for few host drivers that need it.
* Build/link ide-xfer-mode.o and ide-pio-blacklist.o (it is needed only by ide-xfer-mode.o) only if CONFIG_IDE_XFER_MODE=y.
--- drivers/ide/Kconfig | 8 + drivers/ide/Makefile | 4 drivers/ide/ide-lib.c | 240 ------------------------------------------ drivers/ide/ide-xfer-mode.c | 246 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/ide.h | 12 +- 5 files changed, 263 insertions(+), 247 deletions(-)
drivers/ide/Kconfig +8 -0
@@ -56,8 +56,12 @@ if IDE comment "Please see Documentation/ide/ide.txt for help/info on IDE drives" +config IDE_XFER_MODE + bool + config IDE_TIMINGS bool + select IDE_XFER_MODE config IDE_ATAPI bool
@@ -698,6 +702,7 @@ config BLK_DEV_IDE_PMAC_ATA100FIRST config BLK_DEV_IDE_AU1XXX bool "IDE for AMD Alchemy Au1200" depends on SOC_AU1200 + select IDE_XFER_MODE choice prompt "IDE Mode for AMD Alchemy Au1200" default CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA
@@ -866,6 +871,7 @@ config BLK_DEV_ALI14XX config BLK_DEV_DTC2278 tristate "DTC-2278 support" + select IDE_XFER_MODE select IDE_LEGACY help This driver is enabled at runtime using the "dtc2278.probe" kernel
@@ -897,6 +903,7 @@ config BLK_DEV_QD65XX config BLK_DEV_UMC8672 tristate "UMC-8672 support" + select IDE_XFER_MODE select IDE_LEGACY help This driver is enabled at runtime using the "umc8672.probe" kernel
@@ -910,5 +917,6 @@ endif config BLK_DEV_IDEDMA def_bool BLK_DEV_IDEDMA_SFF || \ BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA + select IDE_XFER_MODE endif # IDE
drivers/ide/Makefile +2 -2
@@ -5,10 +5,10 @@ EXTRA_CFLAGS += -Idrivers/ide ide-core-y += ide.o ide-ioctls.o ide-io.o ide-iops.o ide-lib.o ide-probe.o \ - ide-taskfile.o ide-pm.o ide-park.o ide-pio-blacklist.o \ - ide-sysfs.o ide-devsets.o + ide-taskfile.o ide-pm.o ide-park.o ide-sysfs.o ide-devsets.o # core IDE code +ide-core-$(CONFIG_IDE_XFER_MODE) += ide-pio-blacklist.o ide-xfer-mode.o ide-core-$(CONFIG_IDE_TIMINGS) += ide-timings.o ide-core-$(CONFIG_IDE_ATAPI) += ide-atapi.o ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o
drivers/ide/ide-lib.c +0 -240
252 lines not on this page · raw message
drivers/ide/ide-xfer-mode.c new file +246 -0
246 lines not on this page · raw message
include/linux/ide.h +7 -5
@@ -1529,9 +1529,7 @@ static inline void ide_set_hwifdata (ide hwif->hwif_data = data; } -const char *ide_xfer_verbose (u8 mode);extern void ide_toggle_bounce (ide_drive_t *drive,int on); -extern int ide_set_xfer_rate (ide_drive_t *drive,u8 rate);u64 ide_get_lba_addr (struct ide_taskfile *,int );u8 ide_dump_status (ide_drive_t *,const char *,u8 );
@@ -1570,14 +1568,18 @@ void ide_timing_merge(struct ide_timing struct ide_timing *, unsigned int);int ide_timing_compute (ide_drive_t *,u8 ,struct ide_timing *,int ,int ); +#ifdef CONFIG_IDE_XFER_MODE int ide_scan_pio_blacklist (char *); - +const char *ide_xfer_verbose (u8 );u8 ide_get_best_pio_mode (ide_drive_t *,u8 ,u8 ); -int ide_set_pio_mode (ide_drive_t *,u8 );int ide_set_dma_mode (ide_drive_t *,u8 ); -void ide_set_pio (ide_drive_t *,u8 ); +int ide_set_xfer_rate (ide_drive_t *,u8 ); +#else +static inline void ide_set_pio (ide_drive_t *drive,u8 pio) { ; } +static inline int ide_set_xfer_rate (ide_drive_t *drive,u8 rate) {return -1 ; } +#endif static inline void ide_set_max_pio (ide_drive_t *drive) {