1
0
Fork 0
Commit Graph

252 Commits (22d072f60884edaa68f1665576e8983118f59ead)

Author SHA1 Message Date
Bartlomiej Zolnierkiewicz a9587fd8c4 ide: remove BUG() from ide_complete_rq()
It is no longer needed so remove it, also while at it dequeue the request
only on blk_end_request() success and make ide_complete_rq() return an error
value.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:44 +01:00
Bartlomiej Zolnierkiewicz 89f78b3261 ide: move rq->errors quirk out from ide_end_request()
Move rq->errors quirk out from ide_end_request() to its call sites.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:43 +01:00
Bartlomiej Zolnierkiewicz 6902a53312 ide: pass error value to ide_complete_rq()
Set rq->errors at ide_complete_rq() call sites and then pass
error value to ide_complete_rq().

[ Some rq->errors assignments look really wrong but this patch
  leaves them alone to not introduce too many changes at once. ]

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:43 +01:00
Bartlomiej Zolnierkiewicz 37245aabfa ide: sanitize ide_end_rq()
* Move 'uptodate' quirk from ide_end_rq() to its users.

* Move quirks for blk_noretry_request() and !blk_fs_request()
  requests from ide_end_rq() to ide_end_request().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:43 +01:00
Bartlomiej Zolnierkiewicz 1caf236daf ide: add ide_end_rq() (v2)
* Move request dequeuing from __ide_end_request() to ide_end_request().

* Rename __ide_end_request() to ide_end_rq() and export it.

* Fix ide_end_rq() to pass original blk_end_request() return value.

* ide_end_dequeued_request() is used only in cdrom_end_request()
  so inline it there and then remove the function.

v2:
* Remove needless BUG_ON() while at it (start_request()'s one is enough).

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:42 +01:00
Bartlomiej Zolnierkiewicz 1713788ff8 ide: make ide_special_rq() BUG() on unknown requests
If unknown request reaches this function something is _seriously_ wrong.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:42 +01:00
Bartlomiej Zolnierkiewicz e7fedc3ca0 ide: use ide_complete_cmd() for head unload commands
Move handling of head unload commands from task_no_data_intr()
to ide_complete_cmd() and then use ide_complete_cmd() also for
head unload commands.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:41 +01:00
Bartlomiej Zolnierkiewicz 0dfb991c69 ide: use ata_tf_protocols enums
* Add IDE_TFLAG_MULTI_PIO taskfile flag and set it for commands
  using multi-PIO protocol.

* Use ata_tf_protocols enums instead of TASKFILE_* defines to
  denote command's protocol and then rename ->data_phase field
  to ->protocol.

* Remove no longer needed <linux/hdreg.h> includes.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:39 +01:00
Bartlomiej Zolnierkiewicz b6308ee0c5 ide: move command related fields from ide_hwif_t to struct ide_cmd
* Move command related fields from ide_hwif_t to struct ide_cmd.

* Make ide_init_sg_cmd() take command and sectors number as arguments.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:38 +01:00
Bartlomiej Zolnierkiewicz 22aa4b32a1 ide: remove ide_task_t typedef
While at it:
- rename struct ide_task_s to struct ide_cmd
- remove stale comments from idedisk_{read_native,set}_max_address()
- drop unused 'cmd' argument from ide_{cmd,task}_ioctl()
- drop unused 'task' argument from tx4939ide_tf_load_fixup()
- rename ide_complete_task() to ide_complete_cmd()
- use consistent naming for struct ide_cmd variables

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:37 +01:00
Bartlomiej Zolnierkiewicz 3ee38302ff ide: remove ->end_request method
* Handle completion of private driver requests explicitly
  for ide_floppy and ide_tape media in ide_kill_rq().

* Remove no longer needed ->end_request method.

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:36 +01:00
Bartlomiej Zolnierkiewicz c152cc1a90 ide: use ->end_request only for private device driver requests
* Move IDE{FLOPPY,TAPE}_ERROR_* defines to <linux/ide.h> and rename them
  to IDE_DRV_ERROR_*.

* Handle ->end_request special cases for floppy/tape media in ide_kill_rq().

* Call ->end_request only for private device driver requests.

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:34 +01:00
Bartlomiej Zolnierkiewicz e3d9a73a83 ide: remove ->data_phase field from ide_hwif_t
* Always use hwif->task->data_phase and remove ->data_phase
  field from ide_hwif_t.

* Remove superfluous REQ_TYPE_ATA_TASKFILE check from
  ide_pio_datablock() while at it.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:32 +01:00
Bartlomiej Zolnierkiewicz 5e76acd588 ide: no need to read Status and Error registers for "empty" taskfile requests
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:31 +01:00
Bartlomiej Zolnierkiewicz a09485df9c ide: move request type specific code from ide_end_drive_cmd() to callers (v3)
* Move request type specific code from ide_end_drive_cmd() to callers.

* Remove stale ide_end_drive_cmd() documentation and drop no longer
  used 'stat' argument.  Then rename the function to ide_complete_rq().

v2:
* Fix handling of blk_pm_request() requests in task_no_data_intr().

v3:
* Some ide_no_data_taskfile() users (HPA code and HDIO_DRIVE_* ioctls
  handlers) access original command later so we need to update it in
  ide_complete_task().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:31 +01:00
Bartlomiej Zolnierkiewicz e120237c0e ide: factor out completion of taskfile from ide_end_drive_cmd()
Factor out completion of taskfile from ide_end_drive_cmd()
to ide_complete_task().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:29 +01:00
Bartlomiej Zolnierkiewicz 3616b6536a ide: complete power step in ide_complete_pm_request()
* Complete power step in ide_complete_pm_request().

* Rename ide_complete_pm_request() to ide_complete_pm_rq().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:29 +01:00
Bartlomiej Zolnierkiewicz 255115fb35 ide: allow host drivers to specify IRQ flags
* Add ->irq_flags field to struct ide_port_info and struct ide_host.

* Update host drivers and IDE PCI code to use ->irq_flags field.

* Convert init_irq() and ide_intr() to use host->irq_flags.

This fixes handling of shared IRQs for non-PCI hosts
and removes ugly ifdeffery from core IDE code.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:27 +01:00
Bartlomiej Zolnierkiewicz e354c1d803 ide: remove IDE_ARCH_LOCK (v2)
* Add ->{get,release}_lock methods to struct ide_port_info
  and struct ide_host.

* Convert core IDE code, m68k IDE code and falconide support to use
  ->{get,release}_lock methods instead of ide_{get,release}_lock().

* Remove IDE_ARCH_LOCK.

v2:
* Build fix from Geert updating ide_{get,release}_lock() callers in
  falconide.c.

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Schmitz <schmitz@debian.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:22 +01:00
Bartlomiej Zolnierkiewicz d15a613ba0 ide: remove IDE_ARCH_INTR (v2)
This micro-optimization is not worth it.  Just always check for
existence of ->ack_intr method in ide_intr() and ide_timer_expiry().

v2:
Fix brown-paper-bag bug spotted by David D. Kilzer.

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Schmitz <schmitz@debian.org>
Cc: "David D. Kilzer" <ddkilzer@kilzer.net>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-27 12:46:21 +01:00
Bartlomiej Zolnierkiewicz 327fa1c294 ide: move error handling code to ide-eh.c (v2)
Do some CodingStyle fixups in <linux/ide.h> while at it.

v2:
Add missing <linux/delay.h> include (reported by Stephen Rothwell).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-24 23:22:47 +01:00
Bartlomiej Zolnierkiewicz 11938c9290 ide: move device settings code to ide-devsets.c
Remove stale comment from ide.c while at it.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-24 23:22:44 +01:00
Bartlomiej Zolnierkiewicz c4e66c36cc ide: move ide_do_park_unpark() to ide-park.c
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-24 23:22:44 +01:00
Bartlomiej Zolnierkiewicz 1bc6daae4a 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.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-24 23:22:44 +01:00
Bartlomiej Zolnierkiewicz 1866082339 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.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-24 23:22:44 +01:00
Bartlomiej Zolnierkiewicz 65ca537732 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.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-24 23:22:43 +01:00
Bartlomiej Zolnierkiewicz b6a45a0b1e 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.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-24 23:22:43 +01:00
Bartlomiej Zolnierkiewicz 75a0cff4e8 ide: unexport ide_devset_execute()
There are no modular ide_devset_execute() users left so unexport it.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-24 23:22:43 +01:00
Bartlomiej Zolnierkiewicz 7a254df007 ide: move ide_pktcmd_tf_load() to ide-atapi.c
Then make it static and remove 'dma' argument.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-24 23:22:39 +01:00
Stanislaw Gruszka 849d713000 ide: allow to wrap interrupt handler
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: Andrew Victor <linux@maxim.org.za>
[bart: minor checkpatch.pl / CodingStyle fixups]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-05 16:10:57 +01:00
Roel Kluin e0c6dcd8d4 ide: expiry() returns int, negative expiry() return values won't be noticed
bart:
It seems like the bug could cause insanely long timeouts for:
- ATA_DMA_ERR error in dma_timer_expiry()
- commands without ->expiry in tc86c001_timer_expiry()
  (TC86C001 IDE controller only)

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
[bart: port it to the current tree]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-03-05 16:10:55 +01:00
Borislav Petkov 9e772d0135 ide-cd: fix DMA for non bio-backed requests
This one fixes http://bugzilla.kernel.org/show_bug.cgi?id=12320.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-02-02 20:12:21 +01:00
Bartlomiej Zolnierkiewicz c38714ed44 ide: remove now redundant ->cur_dev checks
* ->cur_dev should now be always valid if ->handler is set so
  remove redundant checks from ide_intr() and ide_timer_expiry().

* Apply CodingStyle fixups in ide_timer_expiry() while at it.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-06 17:20:59 +01:00
Bartlomiej Zolnierkiewicz b1b1cd9a23 ide: remove superfluous hwif variable assignment from ide_timer_expiry()
There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-06 17:20:58 +01:00
Bartlomiej Zolnierkiewicz 9600dcf134 ide: make "paranoia" ->handler check in ide_intr() more strict
If ->handler is set while it shouldn't be it indicates deep problems
so BUG_ON()-ning and preventing further damage is much more appropriate
than merely printing an error message.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-06 17:20:58 +01:00
Bartlomiej Zolnierkiewicz 627e05daa1 ide: remove ->error method from struct ide_driver
* Remove (now superfluous) ->error method from struct ide_driver.

* Unexport __ide_error() and make it static.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-06 17:20:54 +01:00
Bartlomiej Zolnierkiewicz 7f3c868ba7 ide: remove ide_driver_t typedef
While at it:
- s/struct ide_driver_s/struct ide_driver/
- use to_ide_driver() macro in ide-proc.c

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-06 17:20:53 +01:00
Bartlomiej Zolnierkiewicz 898ec223fe ide: remove HWIF() macro
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-06 17:20:52 +01:00
Bartlomiej Zolnierkiewicz b65fac32cf ide: merge ide_hwgroup_t with ide_hwif_t (v2)
* Merge ide_hwgroup_t with ide_hwif_t.

* Cleanup init_irq() accordingly, then remove no longer needed
  ide_remove_port_from_hwgroup() and ide_ports[].

* Remove now unused HWGROUP() macro.

While at it:

* ide_dump_ata_error() fixups

v2:
* Fix ->quirk_list check in do_ide_request()
  (s/hwif->cur_dev/prev_port->cur_dev).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-06 17:20:50 +01:00
Bartlomiej Zolnierkiewicz 5b31f855f1 ide: use lock bitops for ports serialization (v2)
* Add ->host_busy field to struct ide_host and use it's first bit
  together with lock bitops to provide new ports serialization method.

* Convert core IDE code to use new ide_[un]lock_host() helpers.

  This removes the need for taking hwgroup->lock if host is already
  busy on serialized hosts and makes it possible to merge ide_hwgroup_t
  into ide_hwif_t (done in the later patch).

* Remove no longer needed ide_hwgroup_t.busy and ide_[un]lock_hwgroup().

* Update do_ide_request() documentation.

v2:
* ide_release_lock() should be called inside IDE_HFLAG_SERIALIZE check.

* Add ide_hwif_t.busy flag and ide_[un]lock_port() for serializing
  devices on a port.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-06 17:20:49 +01:00
Bartlomiej Zolnierkiewicz efe0397eef ide: remove hwgroup->hwif and {drive,hwif}->next
* Add 'int port_count' field to ide_hwgroup_t to keep the track
  of the number of ports in the hwgroup.  Then update init_irq()
  and ide_remove_port_from_hwgroup() to use it.

* Remove no longer needed hwgroup->hwif, {drive,hwif}->next,
  ide_add_drive_to_hwgroup() and ide_remove_drive_from_hwgroup()
  (hwgroup->drive now only denotes the currently active device
   in the hwgroup).

* Update locking documentation in <linux/ide.h>.

While at it:

* Rename ->drive field in ide_hwgroup_t to ->cur_dev.

* Use __func__ in ide_timer_expiry().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-06 17:20:49 +01:00
Bartlomiej Zolnierkiewicz ae86afaee6 ide: use per-port IRQ handlers
Use hwif instead of hwgroup as {request,free}_irq()'s cookie,
teach ide_intr() to return early for non-active serialized ports,
modify unexpected_intr() accordingly and then use per-port IRQ
handlers instead of per-hwgroup ones.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-06 17:20:48 +01:00
Bartlomiej Zolnierkiewicz bd53cbcce5 ide: add ->cur_port to struct ide_host and use it for serialized hosts
* Pass 'ide_hwif_t *' instead of 'ide_hwgroup_t *' to unexpected_intr().

* Cache pointer to the port currently being serviced in ->cur_port
  and use it instead of hwif->hwgroup on serialized hosts.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-06 17:20:48 +01:00
Bartlomiej Zolnierkiewicz 42cf2611b2 ide: fix setting nIEN on idle devices
Fix do_ide_request() to operate on previous device / port instead of
the current one.  The original code was wrong since at least Feb 2002
(2.4.0 timeframe).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-06 17:20:47 +01:00
Bartlomiej Zolnierkiewicz b46f205da6 ide: fix LOCKDEP warning
commit 295f00042a ("ide: don't execute
the next queued command from the hard-IRQ context") overlooked that
ide_do_drive_cmd() (used for REQUEST SENSE command handling) may still
invoke do_ide_request() (->request_fn) in the hard-IRQ context through
blk_start_queueing().  This resulted in a LOCKDEP warning after commit
b599bc7a1199419e122cb2e9ec6b0fa2cfbbc17b ("ide: use per-device request
queue locks (v2)").

Since calling blk_start_queuing() in ide_do_drive_cmd() doesn't make
much sense as the port is already marked as busy (so the execution of
the new command will be deferred anyway) then just remove it fixing
LOCKDEP warning and saving some CPU cycles at the same time.

Reported-and-tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Reported-by: Grissiom <chaos.proton@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-06 17:20:47 +01:00
Borislav Petkov 5317464dcc ide: remove the last ide-scsi remnants
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-02 16:12:54 +01:00
Bartlomiej Zolnierkiewicz 201bffa464 ide: use per-device request queue locks (v2)
* Move hack for flush requests from choose_drive() to do_ide_request().

* Add ide_plug_device() helper and convert core IDE code from using
  per-hwgroup lock as a request lock to use the ->queue_lock instead.

* Remove no longer needed:
  - choose_drive() function
  - WAKEUP() macro
  - 'sleeping' flag from ide_hwif_t
  - 'service_{start,time}' fields from ide_drive_t

This patch results in much simpler and more maintainable code
(besides being a scalability improvement).

v2:
* Fixes/improvements based on review from Elias:
  - take as many requests off the queue as possible
  - remove now redundant BUG_ON()

Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-02 16:12:50 +01:00
Bartlomiej Zolnierkiewicz 631de3708d ide: add ide_[un]lock_hwgroup() helpers
Add ide_[un]lock_hwgroup() inline helpers for obtaining exclusive
access to the given hwgroup and update the core code accordingly.

[ This change besides making code saner results in more efficient
  use of ide_{get,release}_lock(). ]

Cc: Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-02 16:12:50 +01:00
Bartlomiej Zolnierkiewicz b2cfb05a70 ide: remove "paranoia" checks for hwgroup->busy
Remove "paranoia" checks for hwgroup->busy from ide_timer_expiry()
and ide_intr().  This is a preparation for future changes.

Cc: Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-02 16:12:49 +01:00
Bartlomiej Zolnierkiewicz 2fb211502e ide: remove IDE PM hack from do_ide_request()
We now tell block layer that there is still work to do using
blk_plug_device() so hack for IDE Power Management can be removed
(it was buggy for hwgroups having more than 4 devices anyway).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-02 16:12:49 +01:00
Bartlomiej Zolnierkiewicz 295f00042a ide: don't execute the next queued command from the hard-IRQ context (v2)
* Tell the block layer that we are not done handling requests by using
  blk_plug_device() in ide_do_request() (request handling function)
  and ide_timer_expiry() (timeout handler) if the queue is not empty.

* Remove optimization which directly calls ide_do_request() for the next
  queued command from the ide_intr() (IRQ handler) and ide_timer_expiry().

* Remove no longer needed IRQ masking from ide_do_request() - in case of
  IDE ports needing serialization disable_irq_nosync()/enable_irq() was
  used for the (possibly shared) IRQ of the other IDE port.

* Put the misplaced comment in the right place in ide_do_request().

* Drop no longer needed 'int masked_irq' argument from ide_do_request().

* Merge ide_do_request() into do_ide_request().

* Remove no longer needed IDE_NO_IRQ define.

While at it:

* Don't use HWGROUP() macro in do_ide_request().

* Use __func__ in ide_intr().

This patch reduces IRQ hadling latency for IDE and improves the system-wide
handling of shared IRQs (which should result in more timeout resistant and
stable IDE systems).  It also makes it possible to do some further changes
later (i.e. replace some busy-waiting delays with sleeping equivalents).

v2:
Changes per review from Elias Oltmanns:
- fix wrong goto statement in 'if (startstop == ide_stopped)' block
- use spin_unlock_irq()
- don't use obsolete HWIF() macro

Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2009-01-02 16:12:48 +01:00
Bartlomiej Zolnierkiewicz e2984c628c ide: move Power Management support to ide-pm.c
There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-29 20:27:37 +01:00
Bartlomiej Zolnierkiewicz b002415012 ide: remove redundant code from ide_end_drive_cmd()
rq->errors is overwritten later in this function.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-29 20:27:36 +01:00
Bartlomiej Zolnierkiewicz f58c1ab8de ide: always set nIEN on idle devices
* Set nIEN for previous port/device in ide_do_request()
  also if port uses a non-shared IRQ.

* Remove no longer needed ide_hwif_t.sharing_irq.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-29 20:27:33 +01:00
Bartlomiej Zolnierkiewicz 46aa7af1d6 ide: fix ->quirk_list checking in ide_do_request()
Fix nIEN quirk check to also omit quirky devices using pdc202xx_{new,old}
host drivers for which ->quirk_list == 2.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-29 20:27:33 +01:00
Bartlomiej Zolnierkiewicz 08cd1dca00 ide: cleanup ide_do_request()
Both choose_drive() and PM handling code make sure that the queue
is unplugged so no need to check it again.

Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-29 20:27:32 +01:00
Bartlomiej Zolnierkiewicz 2a2ca6a961 ide: replace the global ide_lock spinlock by per-hwgroup spinlocks (v2)
Now that (almost) all host drivers have been fixed not to abuse ide_lock
and core code usage of ide_lock has been sanitized we may safely replace
ide_lock by per-hwgroup locks.

This patch is partially based on earlier patch from Ravikiran G Thirumalai.

While at it:
- don't use deprecated HWIF() and HWGROUP() macros
- update locking documentation in ide.h

v2:
Add missing spin_lock_init(&hwgroup->lock).  (Noticed by Elias Oltmanns)

Cc: Vaibhav V. Nivargi <vaibhav.nivargi@gmail.com>
Cc: Alok N. Kataria <alokk@calsoftinc.com>
Cc: Shai Fultheim <shai@scalex86.org>
Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-29 20:27:31 +01:00
Bartlomiej Zolnierkiewicz 6ea52226ca ide: use queue lock instead of ide_lock when possible
This is just a preparation for future changes and there should be no
functional changes caused by this patch since ide_lock is currently
also used as queue lock.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-29 20:27:31 +01:00
Bartlomiej Zolnierkiewicz 3c8a2cce47 ide: ide_lock + __blk_end_request() -> blk_end_request()
Use blk_end_request() instead of ide_lock + __blk_end_request()
in cdrom_end_request(), cdrom_newpc_intr(), __ide_end_request(),
ide_complete_pm_request() and ide_end_drive_cmd().

[ ide_lock is currently also used as queue lock ]

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-29 20:27:31 +01:00
Bartlomiej Zolnierkiewicz a72b2147ec ide: push ide_lock to __ide_end_request()
__ide_end_request() needs ide_lock only for __blk_end_request()
call so push ide_lock taking inside __ide_end_requests().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-29 20:27:30 +01:00
Bartlomiej Zolnierkiewicz 1d0bf587df ide: ide_hwgroup_t.rq doesn't need an ide_lock held
While at it:
- no need to check for hwgroup presence in ide_dump_opcode()

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-29 20:27:30 +01:00
Bartlomiej Zolnierkiewicz 3e0e29f737 ide: unify ide_intr()'s exit points
Just a preparation for future changes.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-29 20:27:29 +01:00
Bartlomiej Zolnierkiewicz 1a659880ee Revert "ide: respect current DMA setting during resume"
This reverts commit e9eb838830 since
it could break resume (thanks to Paul Collins for the report).

I'll look into sorting this out properly for 2.6.29
but for 2.6.28 it is the best to just revert my patch.

Reported-by: Paul Collins <paul@burly.ondioline.org>
Cc: rjw@sisk.pl
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-08 17:42:35 +01:00
Bartlomiej Zolnierkiewicz 6b7d8fc362 ide: fix build for DEBUG_PM
Also while at it:

* Drop unused arguments from ide_complete_power_step().

* Move DEBUG_PM printk() from ide_end_drive_cmd() to
  ide_complete_power_step().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-02 20:40:03 +01:00
Bartlomiej Zolnierkiewicz e9eb838830 ide: respect current DMA setting during resume
Respect current DMA setting during resume, otherwise PIO timings
may get destroyed if host uses shared PIO/MWDMA timings.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-02 20:40:03 +01:00
Michael Schmitz f9e3326dce ide: fix the ide_release_lock imbalance
ide_release_lock() spits out lots of:

	ide_release_lock: bug

warnings on Atari Falcon.

Fix the ide_release_lock imbalance.

Signed-off-by: Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-12-02 20:40:02 +01:00
Jens Axboe f73e2d13a1 block: remove __generic_unplug_device() from exports
The only out-of-core user is IDE, and that should be using
blk_start_queueing() instead.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2008-10-17 14:03:08 +02:00
Elias Oltmanns 4abdc6ee7c ide: Implement disk shock protection support (v4)
On user request (through sysfs), the IDLE IMMEDIATE command with UNLOAD
FEATURE as specified in ATA-7 is issued to the device and processing of
the request queue is stopped thereafter until the specified timeout
expires or user space asks to resume normal operation. This is supposed
to prevent the heads of a hard drive from accidentally crashing onto the
platter when a heavy shock is anticipated (like a falling laptop expected
to hit the floor). Port resets are deferred whenever a device on that
port is in the parked state.

v3:
Elias Oltmanns <eo@nebensachen.de> wrote:
[...]
> >> 1. Make sure that no negative value is being passed to
> >>    jiffies_to_msecs() in ide_park_show().
> >> 2. Drop the superfluous variable hwif in ide_special_rq().
> >> 3. Skip initialisation of task and tf in ide_special_rq() if we are not
> >>    handling a (un)park request.
> >
> > Well, #3 should have been done differently because we donn't want to
> > check for REQ_(UN)?PARK_HEADS more often than is necessary.
> 
> While preparing the backport to 2.6.27, it has just occurred to me that
> we need to clear the IDE_DFLAG_PARKED flag in ide_disk_pre_reset()
> because this flag must not be set after *any* sort of access to the
> device.

v4:
Fix a memory leak due to a missing blk_put_request() in
issue_park_cmd(). Additionally, we should plug the queue when enqueueing
the unpark request because there is no guarantee that the park timeout
has not expired by then. Even though the chance for that to happen is
very slim, the request might end up hanging in the queue until the next
I/O operation is queued up. While at it, clean up the code a little:
- make issue_park_cmd() a function of type void since nobody cares for
  the return value anyway;
- use blk_start_queueing() instead of __blk_run_queue() since we don't
  have to worry about recursion;
- remove a superfluous pointer deference in task_no_data_intr().

Signed-off-by: Elias Oltmanns <eo@nebensachen.de>
Cc: Jeff Garzik <jeff@garzik.org>,
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-13 21:39:50 +02:00
Elias Oltmanns e415e495f8 ide: Two fixes regarding memory allocation
In function ide_devset_execute() we should use __GFP_WAIT rather than
GFP_KERNEL. Also, the allocation cannot possibly fail at that point.
More importantly, there is a potential memory leak in the device probing
code. The infrastructure seems rather complex and I hope I haven't messed
anything up by trying to fix this.

Signed-off-by: Elias Oltmanns <eo@nebensachen.de>
[bart: remove superfluous ide_lock taking]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-13 21:39:45 +02:00
Bartlomiej Zolnierkiewicz bfa7d8e55f ide: ->ide_dma_clear_irq() -> ->clear_irq()
* Rename ->ide_dma_clear_irq method to ->clear_irq
  and move it from ide_hwif_t to struct ide_port_ops.

* Move ->waiting_for_dma check inside ->clear_irq method.

* Move ->dma_base check inside ->clear_irq method.

piix.c:
* Add ich_port_ops and remove init_hwif_ich() wrapper.

There should be no functional changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-13 21:39:42 +02:00
Bartlomiej Zolnierkiewicz 6982daf71c ide: convert 'pio_mode' device setting to use DS_SYNC flag
* Convert 'pio_mode' device setting to use DS_SYNC flag.

* Remove unused special_t.b.{set_tune,serviced} and ide_drive_t.tune_req.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-13 21:39:40 +02:00
Bartlomiej Zolnierkiewicz 7f612f272a ide: remove [ata_]select_t
* Use 'drive->dn & 1' in ide_init_disk().

* remove [ata_]select_t.

While at it:

* Use ATA_DEVICE_OBS define in ide_port_init_devices_data().

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-13 21:39:40 +02:00
Bartlomiej Zolnierkiewicz 0d346ba073 ide: sanitize ide*_pm_* enums
* Move ide*_pm_* enums from ide-io.c to <linux/ide.h>.

* idedisk_pm_* -> ide_pm_*

* ide_pm_state_* -> ide_pm_*

* No need to set ide_pm_* enums to the fixed values.

* Uppercase ide_pm_* enums.

* Fix/update comments.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-13 21:39:38 +02:00
Bartlomiej Zolnierkiewicz d1d76714e2 ide: fix HDIO_DRIVE_TASK[FILE] ioctls for CHS commands on LBA devices
Add IDE_DFLAG_LBA device flag and use it instead of ->select.b.lba.

Since ->tf_load uses ->select.all for ATA Device/Head register this
fixes HDIO_DRIVE_TASK[FILE] ioctls for CHS commands on LBA devices.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-13 21:39:38 +02:00
Bartlomiej Zolnierkiewicz c39220483e ide: DMA_PIO_RETRY -> IDE_DFLAG_DMA_PIO_RETRY
Add IDE_DFLAG_DMA_PIO_RETRY and use it instead of
ide_drive_t.state + DMA_PIO_RETRY.

There should be no functional changes cause by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-13 21:39:37 +02:00
Bartlomiej Zolnierkiewicz 97100fc816 ide: add device flags
Add 'unsigned long dev_flags' to ide_drive_t and convert bitfields
to IDE_DFLAG_* flags.

While at it:
- IDE_DFLAG_ADDRESSING -> IDE_DFLAG_LBA48
- fixup some comments
- remove needless g->flags zeroing from ide*_probe()

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-13 21:39:36 +02:00
Elias Oltmanns 92f1f8fd80 ide: Remove ide_spin_wait_hwgroup() and use special requests instead
Use a special request for serialisation purposes and get rid of the
awkward ide_spin_wait_hwgroup(). This also involves converting the
ide_devset structure so it can be shared by the /proc and the ioctl code.

Signed-off-by: Elias Oltmanns <eo@nebensachen.de>
[bart: use rq->cmd[] directly]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-10 22:39:40 +02:00
Bartlomiej Zolnierkiewicz ff2779b568 ide: ide_id_has_flush_cache_ext() -> ata_id_flush_ext_enabled()
* Add ata_id_flush_ext_enabled() inline helper to <linux/ata.h>.

* ide_id_has_flush_cache_ext() -> ata_id_flush_ext_enabled()

  The latter one also checks if the command is marked as
  supported in word 83 and validity of words 83 & 86.

Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-10 22:39:31 +02:00
Bartlomiej Zolnierkiewicz 4b58f17d7c ide: ide_id_has_flush_cache() -> ata_id_flush_enabled()
* Add ata_id_flush_enabled() inline helper to <linux/ata.h>.

* ide_id_has_flush_cache() -> ata_id_flush_enabled()

  The latter one also checks if the command is marked as
  supported in word 83 and validity of words 83 & 86.

Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-10 22:39:30 +02:00
Bartlomiej Zolnierkiewicz 3ceca727fe ide: include <linux/hdreg.h> only when needed
* Include <linux/ata.h> directly in <linux/ide.h>
  instead of through <linux/hdreg.h>.

* Include <linux/hdreg.h> only when needed.

Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-10 22:39:27 +02:00
Bartlomiej Zolnierkiewicz 3c619ffd48 ide: remove no longer needed ide_drive_t fields
Remove ->remap_0_to_1 and ->sect0 (they are always zero now).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-10 22:39:22 +02:00
Bartlomiej Zolnierkiewicz 3a7d24841a ide: use ATA_* defines instead of *_STAT and *_ERR ones
* ERR_STAT   -> ATA_ERR
* INDEX_STAT -> ATA_IDX
* ECC_STAT   -> ATA_CORR
* DRQ_STAT   -> ATA_DRQ
* SEEK_STAT  -> ATA_DSC
* WRERR_STAT -> ATA_DF
* READY_STAT -> ATA_DRDY
* BUSY_STAT  -> ATA_BUSY

* MARK_ERR   -> ATA_AMNF
* TRK0_ERR   -> ATA_TRK0NF
* ABRT_ERR   -> ATA_ABORTED
* MCR_ERR    -> ATA_MCR
* ID_ERR     -> ATA_IDNF
* MC_ERR     -> ATA_MC
* ECC_ERR    -> ATA_UNC
* ICRC_ERR   -> ATA_ICRC

* BBD_ERR    -> ATA_BBK

Also:

* ILI_ERR    -> ATAPI_ILI
* EOM_ERR    -> ATAPI_EOM
* LFS_ERR    -> ATAPI_LFS

* CD         -> ATAPI_COD
* IO         -> ATAPI_IO

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-10 22:39:21 +02:00
Bartlomiej Zolnierkiewicz aaaade3f05 ide: WIN_* -> ATA_CMD_*
* Use ATA_CMD_* defines instead of WIN_* ones.

While at it:

* EXABYTE_ENABLE_NEXT -> ATA_EXABYTE_ENABLE_NEST

* SETFEATURES_{EN,DIS}_WCACHE -> SETFEATURES_WC_{ON,OFF}

* SETFEATURES_{EN,DIS}_AAM -> SETFEATURES_AAM_{ON,OFF}

* SMART_* -> ATA_SMART_*

* Remove stale comment from ide-proc.c.

Partially based on earlier work by Chris Wedgwood.

Acked-by: Chris Wedgwood <cw@f00f.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-10 22:39:21 +02:00
Bartlomiej Zolnierkiewicz f8881000d7 ide: remove superfluous check from ide_disk_special()
This condition is checked by both ide_disk_init_mult_count()
and set_multcount() so no need to do it again in ide_disk_special().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-10-10 22:39:18 +02:00
Bartlomiej Zolnierkiewicz 374e042c3e ide: add struct ide_tp_ops (take 2)
* Add struct ide_tp_ops for transport methods.

* Add 'const struct ide_tp_ops *tp_ops' to struct ide_port_info
  and ide_hwif_t.

* Set the default hwif->tp_ops in ide_init_port_data().

* Set host driver specific hwif->tp_ops in ide_init_port().

* Export ide_exec_command(), ide_read_status(), ide_read_altstatus(),
  ide_read_sff_dma_status(), ide_set_irq(), ide_tf_{load,read}()
  and ata_{in,out}put_data().

* Convert host drivers and core code to use struct ide_tp_ops.

* Remove no longer needed default_hwif_transport().

* Cleanup ide_hwif_t from methods that are now in struct ide_tp_ops.

While at it:

* Use struct ide_port_info in falconide.c and q40ide.c.

* Rename ata_{in,out}put_data() to ide_{in,out}put_data().

v2:

* Fix missing convertion in ns87415.c.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-23 19:55:56 +02:00
Bartlomiej Zolnierkiewicz 6e6afb3b74 ide: add ->set_irq method
Add ->set_irq method for setting nIEN bit of ATA Device Control
register and use it instead of ide_set_irq().

While at it:

* Use ->set_irq in init_irq() and do_reset1().

* Don't use HWIF() macro in ide_check_pm_state().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-23 19:55:52 +02:00
Bartlomiej Zolnierkiewicz b73c7ee25d ide: add ->read_status method
* Remove ide_read_status() inline helper.

* Add ->read_status method for reading ATA Status register
  and use it instead of ->INB.

While at it:

* Don't use HWGROUP() macro.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-23 19:55:52 +02:00
Bartlomiej Zolnierkiewicz c6dfa867bb ide: add ->exec_command method
Add ->exec_command method for writing ATA Command register
and use it instead of ->OUTBSYNC.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-23 19:55:51 +02:00
Elias Oltmanns 3ef5eb424e IDE: Remove unused code
Remove some code which has been made obsolete and hasn't worked properly
before anyway.  Part of the infrastructure may be reintroduced in a
follow up patch to implement a working command aborting facility.

Signed-off-by: Elias Oltmanns <eo@nebensachen.de>
Cc: "Alan Cox" <alan@lxorguk.ukuu.org.uk>
Cc: "Randy Dunlap" <randy.dunlap@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-16 20:33:48 +02:00
Elias Oltmanns 79e36a9f54 IDE: Fix HDIO_DRIVE_RESET handling
Currently, the code path executing an HDIO_DRIVE_RESET ioctl is broken
in various ways.  Most importantly, it is treated as an out of band
request in an illegal way which may very likely lead to system lock ups.
Use the drive's request queue to avoid this problem (and fix a locking
issue for free along the way).

Signed-off-by: Elias Oltmanns <eo@nebensachen.de>
Cc: "Alan Cox" <alan@lxorguk.ukuu.org.uk>
Cc: "Randy Dunlap" <randy.dunlap@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-16 20:33:48 +02:00
FUJITA Tomonori 63f5abb095 ide: remove action argument in ide_do_drive_cmd
ide_do_drive_cmd is called only with ide_preempt action argument. So
we can remove the action argument in ide_do_drive_cmd and ide_action_t
typedef.

This patch also includes two minor cleanups: 1) ide_do_drive_cmd
always succeeds so we don't need the return value; 2) the callers use
blk_rq_init before ide_do_drive_cmd so there is no need to initialize
rq->errors.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-15 21:21:51 +02:00
Bartlomiej Zolnierkiewicz f8c4bd0ab2 ide: pass 'hwif *' instead of 'drive *' to ->OUTBSYNC method
There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-15 21:21:49 +02:00
Bartlomiej Zolnierkiewicz ed4af48fd6 ide: move IRQ unmasking out from ->tf_load method
Move IRQ unmasking out from ->tf_load method to its users.

There should be no functional changes caused by this patch
(SELECT_MASK() is NOP except for hpt366, icside and sgiioc4).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-15 21:21:48 +02:00
Bartlomiej Zolnierkiewicz 57279a7a40 ide: remove try_to_flush_leftover_data()
Just use the new & shiny ide_pad_transfer() helper instead.

Also remove the superfluous check for 'drive->media == ide_disk'
while at it (ide_ata_error() is used only for ide_disk devices).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-15 21:21:47 +02:00
FUJITA Tomonori 124cafc5eb ide: remove ide_init_drive_cmd
ide_init_drive_cmd just calls blk_rq_init. This converts the users of
ide_init_drive_cmd to use blk_rq_init directly and removes
ide_init_drive_cmd.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-15 21:21:44 +02:00
FUJITA Tomonori 5f2e1ceef4 ide: remove ide_wait/head_wait path in ide_do_drive_cmd
Now all the users of ide_do_drive_cmd using ide_wait/head_wait are
converted to use blk_execute_rq this removes the ide_wait/head_wait
path in ide_do_drive_cmd.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-15 21:21:44 +02:00
Bartlomiej Zolnierkiewicz c6866a6ff5 ide: use __generic_unplug_device() in ide_do_drive_cmd() (take 2)
* Call __elv_add_request() with 'plug' == 1 (so the device will be
  plugged) and then use __generic_unplug_device() instead of calling
  ide_do_request() directly.

v2:
* For blk_pm_resume_request() requests the queue is stopped so we
  need to call ->request_fn explicitly.

  Thanks to:
  - Rafael for reporting/bisecting the bug
  - Borislav/Rafael for testing the fix

This is a preparation for converting IDE to use blk_execute_rq().

Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-15 21:21:42 +02:00
Bartlomiej Zolnierkiewicz e8a96aa713 ide: set REQ_PREEMPT request flag in ide_do_drive_cmd() users
* Set REQ_PREEMPT request flag in ide_do_drive_cmd() users
  for ide_preempt and ide_head_wait action types.

* Remove setting REQ_PREEMPT from ide_do_drive_cmd().

While at it:

* Set 'where' variable outside ide_lock.

This is a preparation for converting IDE to use blk_execute_rq().

There should be no functional changes caused by this patch.

Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-07-15 21:21:41 +02:00
FUJITA Tomonori e7b241a771 ide: use blk_rq_init() to initialize the request
This converts ide to use blk_rq_init to initialize the request.

This is a preparation for large command support, which needs to
initialize the request in a proper way (that is, just doing a memset()
will not work).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2008-04-29 14:48:55 +02:00
Bartlomiej Zolnierkiewicz 9f87abe892 ide: add ide_pad_transfer() helper
* Add ide_pad_transfer() helper (which uses ->{in,out}put_data methods
  internally so the transfer is also padded to drive+host requirements)
  and use it instead of ide_atapi_{write_zeros,discard_data}().

* Remove no longer needed ide_atapi_{write_zeros,discard_data}().

Cc: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-04-28 23:44:41 +02:00