History log of /drivers/ide/ide-disk.c
Revision Date Author Comments
b277da0a8a594308e17881f4926879bd5fca2a2d 04-Oct-2014 Mike Snitzer <snitzer@redhat.com> block: disable entropy contributions for nonrot devices

Clear QUEUE_FLAG_ADD_RANDOM in all block drivers that set
QUEUE_FLAG_NONROT.

Historically, all block devices have automatically made entropy
contributions. But as previously stated in commit e2e1a148 ("block: add
sysfs knob for turning off disk entropy contributions"):
- On SSD disks, the completion times aren't as random as they
are for rotational drives. So it's questionable whether they
should contribute to the random pool in the first place.
- Calling add_disk_randomness() has a lot of overhead.

There are more reliable sources for randomness than non-rotational block
devices. From a security perspective it is better to err on the side of
caution than to allow entropy contributions from unreliable "random"
sources.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
b4f42e2831ff9b9fa19252265d7c8985d47eefb9 10-Apr-2014 Jens Axboe <axboe@fb.com> block: remove struct request buffer member

This was used in the olden days, back when onions were proper
yellow. Basically it mapped to the current buffer to be
transferred. With highmem being added more than a decade ago,
most drivers map pages out of a bio, and rq->buffer isn't
pointing at anything valid.

Convert old style drivers to just use bio_data().

For the discard payload use case, just reference the page
in the bio.

Signed-off-by: Jens Axboe <axboe@fb.com>
2c8fc867602e385fd2abe76da0b6bda8ed907547 03-Oct-2011 Borislav Petkov <bp@alien8.de> ide-disk: Fix request requeuing

Simon Kirby reported that on his RAID setup with idedisk underneath
the box OOMs after a couple of days of runtime. Running with
CONFIG_DEBUG_KMEMLEAK pointed to idedisk_prep_fn() which unconditionally
allocates an ide_cmd struct. However, ide_requeue_and_plug() can be
called more than once per request, either from the request issue or the
IRQ handler path and do blk_peek_request() ends up in idedisk_prep_fn()
repeatedly, allocating a struct ide_cmd everytime and "forgetting" the
previous pointer.

Make sure the code reuses the old allocated chunk.

Reported-and-tested-by: Simon Kirby <sim@hostway.ca>
Cc: <stable@kernel.org> [ 39.x, 3.0.x ]
Link: http://marc.info/?l=linux-kernel&m=131667641517919
Link: http://lkml.kernel.org/r/20110922072643.GA27232@hostway.ca
Signed-off-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4913efe456c987057e5d36a3f0a55422a9072cae 03-Sep-2010 Tejun Heo <tj@kernel.org> block: deprecate barrier and replace blk_queue_ordered() with blk_queue_flush()

Barrier is deemed too heavy and will soon be replaced by FLUSH/FUA
requests. Deprecate barrier. All REQ_HARDBARRIERs are failed with
-EOPNOTSUPP and blk_queue_ordered() is replaced with simpler
blk_queue_flush().

blk_queue_flush() takes combinations of REQ_FLUSH and FUA. If a
device has write cache and can flush it, it should set REQ_FLUSH. If
the device can handle FUA writes, it should also set REQ_FUA.

All blk_queue_ordered() users are converted.

* ORDERED_DRAIN is mapped to 0 which is the default value.
* ORDERED_DRAIN_FLUSH is mapped to REQ_FLUSH.
* ORDERED_DRAIN_FLUSH_FUA is mapped to REQ_FLUSH | REQ_FUA.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Boaz Harrosh <bharrosh@panasas.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Alasdair G Kergon <agk@redhat.com>
Cc: Pierre Ossman <drzeus@drzeus.cx>
Cc: Stefan Weinhuber <wein@de.ibm.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
08ff45ca60e4bc1cc27a71a9fe06886e870aa7d8 18-Aug-2010 Tao Ma <tao.ma@oracle.com> Use kzalloc in idedisk_prep_fn.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Acked-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
00fff26539bfe3fad21c164fc4002d9ede056fb0 03-Jul-2010 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> block: remove q->prepare_flush_fn completely

This removes q->prepare_flush_fn completely (changes the
blk_queue_ordered API).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
afc23068103ccfbf1917eb2a007bc15ab5418cc9 03-Jul-2010 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> ide: stop using q->prepare_flush_fn

use REQ_FLUSH flag instead.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
33659ebbae262228eef4e0fe990f393d1f0ed941 07-Aug-2010 Christoph Hellwig <hch@lst.de> block: remove wrappers for request type/flags

Remove all the trivial wrappers for the cmd_type and cmd_flags fields in
struct requests. This allows much easier grepping for different request
types instead of unwinding through macros.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
c3e33e043f5e9c583aa59d5591a614b2a8243d3a 15-May-2010 Tejun Heo <tj@kernel.org> block,ide: simplify bdops->set_capacity() to ->unlock_native_capacity()

bdops->set_capacity() is unnecessarily generic. All that's required
is a simple one way notification to lower level driver telling it to
try to unlock native capacity. There's no reason to pass in target
capacity or return the new capacity. The former is always the
inherent native capacity and the latter can be handled via the usual
device resize / revalidation path. In fact, the current API is always
used that way.

Replace ->set_capacity() with ->unlock_native_capacity() which take
only @disk and doesn't return anything. IDE which is the only current
user of the API is converted accordingly.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
086fa5ff0854c676ec333760f4c0154b3b242616 26-Feb-2010 Martin K. Petersen <martin.petersen@oracle.com> block: Rename blk_queue_max_sectors to blk_queue_max_hw_sectors

The block layer calling convention is blk_queue_<limit name>.
blk_queue_max_sectors predates this practice, leading to some confusion.
Rename the function to appropriately reflect that its intended use is to
set max_hw_sectors.

Also introduce a temporary wrapper for backwards compability. This can
be removed after the merge window is closed.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
bc146d23d1358af43f03793c3ad8c9f16bbcffcb 16-Jul-2009 Maxime Bizon <mbizon@freebox.fr> ide: fix memory leak when flush command is issued

I'm using ide on 2.6.30.1 with xfs filesystem. I noticed a kernel memory
leak after writing lots of data, the kmalloc-96 slab cache keeps
growing. It seems the struct ide_cmd kmalloced by idedisk_prepare_flush
is never kfreed.

Commit a09485df9cda49fbde2766c86eb18a9cae585162 ("ide: move request
type specific code from ide_end_drive_cmd() to callers (v3)") and
f505d49ffd25ed062e76ffd17568d3937fcd338c ("ide: fix barriers support")
cause this regression, cmd->rq must now be set for ide_complete_cmd to
honor the IDE_TFLAG_DYN flag.

Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2c7eaa43c3bb7b3b9fe2051d17f308c1f0728c78 15-Jun-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: BUG() on unknown requests

Unsupported requests should be never handed down to device drivers
and the best thing we can do upon discovering such request inside
driver's ->do_request method is to just BUG().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
075affcbe01d4d7cefcd0e30a98df1253bcf8d92 07-Jun-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: preserve Host Protected Area by default (v2)

From the perspective of most users of recent systems, disabling Host
Protected Area (HPA) can break vendor RAID formats, GPT partitions and
risks corrupting firmware or overwriting vendor system recovery tools.

Unfortunately the original (kernels < 2.6.30) behavior (unconditionally
disabling HPA and using full disk capacity) was introduced at the time
when the main use of HPA was to make the drive look small enough for the
BIOS to allow the system to boot with large capacity drives.

Thus to allow the maximum compatibility with the existing setups (using
HPA and partitioned with HPA disabled) we automically disable HPA if
any partitions overlapping HPA are detected. Additionally HPA can also
be disabled using the "nohpa" module parameter (i.e. "ide_core.nohpa=0.0"
to disable HPA on /dev/hda).

v2:
Fix ->resume HPA support.

While at it:
- remove stale "idebus=" entry from Documentation/kernel-parameters.txt

Cc: Robert Hancock <hancockrwd@gmail.com>
Cc: Frans Pop <elendil@planet.nl>
Cc: "Andries E. Brouwer" <Andries.Brouwer@cwi.nl>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
[patch description was based on input from Alan Cox and Frans Pop]
Emphatically-Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
e957b60d1583022a0f7c03267d37fcae2ddb78b1 07-Jun-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-gd: implement block device ->set_capacity method (v2)

* Use ->probed_capacity to store native device capacity for ATA disks.

* Add ->set_capacity method to struct ide_disk_ops.

* Implement disk device ->set_capacity method for ATA disks.

* Implement block device ->set_capacity method.

v2:
* Check if LBA and HPA are supported in ide_disk_set_capacity().

* According to the spec the SET MAX ADDRESS command shall be
immediately preceded by a READ NATIVE MAX ADDRESS command.

* Add ide_disk_hpa_{get_native,set}_capacity() helpers.

Together with the previous patch adding ->set_capacity block device
method this allows automatic disabling of Host Protected Area (HPA)
if any partitions overlapping HPA are detected.

Cc: Robert Hancock <hancockrwd@gmail.com>
Cc: Frans Pop <elendil@planet.nl>
Cc: "Andries E. Brouwer" <Andries.Brouwer@cwi.nl>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Emphatically-Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
3b77f777b8f1c001b63e317c4ce317292ff0ff94 23-May-2009 Martin K. Petersen <martin.petersen@oracle.com> ide-disk: fix missing max_sectors accessor function

The recent move to accessor functions for querying queue limits
missed an entry in ide-disk.c:

drivers/ide/ide-disk.c: In function ‘ide_disk_setup’:
drivers/ide/ide-disk.c:642: error: ‘struct request_queue’ has no member named ‘max_sectors’

Fix it.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
ca1b96e00ab5d1b0838965834469a0284c81a517 17-May-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: replace special_t typedef by IDE_SFLAG_* flags

Replace:
- special_t typedef by IDE_SFLAG_* flags
- 'special_t special' ide_drive_t's field by 'u8 special_flags' one

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>
9780e2dd8254351f6cbe11304849126b51dbd561 07-May-2009 Tejun Heo <tj@kernel.org> ide: convert to rq pos and nr_sectors accessors

ide doesn't manipulate request fields anymore and thus all hard and
their soft equivalents are always equal. Convert all references to
accessors.

[ Impact: use pos and nr_sectors accessors ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Borislav Petkov <petkovbb@googlemail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
b2963ac1738542d30305d7e12c8c078a383a425c 19-Apr-2009 Tejun Heo <tj@kernel.org> ide: don't set REQ_SOFTBARRIER

ide doesn't have to worry about REQ_SOFTBARRIER. Don't set it.

Signed-off-by: Tejun Heo <tj@kernel.org>
55f3f399422a4a3f6cb84ea4096dfaddf8817399 19-Apr-2009 Tejun Heo <tj@kernel.org> ide: don't set REQ_SOFTBARRIER

ide doesn't have to worry about REQ_SOFTBARRIER. Don't set it.

Signed-off-by: Tejun Heo <tj@kernel.org>
745483f10c6cefb303007c6873e2bfce54efa8ed 08-Apr-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com> ide: simplify 'struct ide_taskfile'

Make 'struct ide_taskfile' cover only 8 register values and thus put two such
fields ('tf' and 'hob') into 'struct ide_cmd', dropping unnecessary 'tf_array'
field from it.

This required changing the prototype of ide_get_lba_addr() and ide_tf_dump().

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
[bart: fix setting of ATA_LBA bit for LBA48 commands in __ide_do_rw_disk()]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
60f85019c6c8c1aebf3485a313e0da094bc95d07 08-Apr-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com> ide: replace IDE_TFLAG_* flags by IDE_VALID_*

Replace IDE_TFLAG_{IN|OUT}_* flags meaning to the taskfile register validity on
input/output by the IDE_VALID_* flags and introduce 4 symmetric 8-bit register
validity indicator subfields, 'valid.{input/output}.{tf|hob}', into the 'struct
ide_cmd' instead of using the 'tf_flags' field for that purpose (this field can
then be turned from 32-bit into 8-bit one).

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
47ab834854d4639fedf2ed2f21b41297f2abe1a7 31-Mar-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com> ide-disk: use ATA_ERR

Make use of ATA_ERR instead of hard-coded value in idedisk_set_max_address()
and idedisk_read_native_max_address().

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
bf717c0a2e18dbe82eeb28e57b0abede3cdf45d6 27-Mar-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: keep track of number of bytes instead of sectors in struct ide_cmd

* Pass number of bytes instead of sectors to ide_init_sg_cmd().

* Pass number of bytes to process to ide_pio_sector() and rename
it to ide_pio_bytes().

* Rename ->nsect field to ->nbytes in struct ide_cmd and use
->nbytes, ->nleft and ->cursg_ofs to keep track of number of
bytes instead of sectors.

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>
2298169418f43ba5e0919762a4bab95a1227872a 27-Mar-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: pass command to ide_map_sg()

* Set IDE_TFLAG_WRITE flag and ->rq also for ATA_CMD_PACKET
commands.

* Pass command to ->dma_setup method and update all its
implementations accordingly.

* Pass command instead of request to ide_build_sglist(),
*_build_dmatable() and ide_map_sg().

While at it:

* Fix scc_dma_setup() documentation + use ATA_DMA_WR define.

* Rename sgiioc4_build_dma_table() to sgiioc4_build_dmatable(),
change return value type to 'int' and drop unused 'ddir'
argument.

* Do some minor cleanups in [tx4939]ide_dma_setup().

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>
130e886708d6e11f3d54e5d27c266578de56f343 27-Mar-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove ide_end_request()

* Add ide_rq_bytes() helper.

* Add blk_noretry_request() quirk to ide_complete_rq() (currently only fs
requests can be marked as "noretry" so there is no change in behavior).

* Switch current ide_end_request() users to use ide_complete_rq().

[ No need to check for rq->nr_sectors == 0 in {ide_dma,task_pio}_intr(),
nsectors == 0 in cdrom_end_request() and err == 0 in ide_do_devset(). ]

* Remove no longer needed ide_end_request().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
89f78b3261f7e331e41753ea2459fbb9b60a6f7a 27-Mar-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 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>
0dfb991c6943c810175376b58d1c29cfe532541b 27-Mar-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 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>
b6308ee0c55acd2e943d849773c9f0a49c516317 27-Mar-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 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>
adb1af9803d167091c2cb4de14014185054bfe2c 27-Mar-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: pass command instead of request to ide_pio_datablock()

* Add IDE_TFLAG_FS taskfile flag and set it for REQ_TYPE_FS requests.

* Convert ->{in,out}put_data methods to take command instead of request
as an argument. Then convert pre_task_out_intr(), task_end_request(),
task_error(), task_in_unexpected(), ide_pio_sector(), ide_pio_multi()
and ide_pio_datablock() in similar way.

* Rename task_end_request() to ide_finish_cmd().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
22aa4b32a19b1f231d4ce7e9af6354b577a22a35 27-Mar-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 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>
3ee38302ffc63da93eb0313053a990bb3466e275 27-Mar-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 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>
e3d9a73a83d98fc466dabdcfe4f4e7e4419e3f8e 27-Mar-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 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>
655772cc79c94ebf282e1df4d3c3375f05a565ae 14-Jan-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: can't use SSD/non-rotational queue flag for all CFA devices

Some rotating disks also present themselves as CFA devices.

Reported-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
898ec223fea2a2df88035e58dbf50f493577e225 06-Jan-2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove HWIF() macro

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
ccd32e221c3e3797ac56305c554ad8b07c13c815 02-Nov-2008 Alan Cox <alan@lxorguk.ukuu.org.uk> ide: Switch to a common address

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
c77380d4534c65cc9865a6b4efea44be4d039207 23-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: set non-rotational queue flag for SSD and CF devices

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
806f80a6fc203ad0bde84e5a9e94572617d2ae45 17-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: add generic ATA/ATAPI disk driver

* Add struct ide_disk_ops containing protocol specific methods.

* Add 'struct ide_disk_ops *' to ide_drive_t.

* Convert ide-{disk,floppy} drivers to use struct ide_disk_ops.

* Merge ide-{disk,floppy} drivers into generic ide-gd driver.

While at it:
- ide_disk_init_capacity() -> ide_disk_get_capacity()

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
5fef0e5c0283949f95a7891c9424a9f84448116b 17-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: factor out generic disk handling code to ide-gd.c

While at it:
- IDEDISK_VERSION -> IDE_GD_VERSION
- ide_cacheflush_p() -> ide_disk_flush()
- init_idedisk_capacity() -> ide_disk_init_capacity()
- idedisk_set_doorlock() -> ide_disk_set_doorlock()
- idedisk_setup() -> ide_disk_setup()

- ide_disk_capacity() -> ide_gd_capacity()
- ide_disk_remove() -> ide_gd_remove()
- ide_disk_probe() -> ide_gd_probe()
- ide_disk_resume() -> ide_gd_resume()
- ide_device_shutdown() -> ide_gd_shutdown()
- idedisk_driver -> ide_gd_driver
- idedisk_open() -> ide_gd_open()
- idedisk_release() -> ide_gd_release()
- idedisk_getgeo() -> ide_gd_getgeo()
- idedisk_media_changed() -> ide_gd_media_changed()
- idedisk_revalidate_disk() -> ide_gd_revalidate_disk()
- idedisk_ops -> ide_gd_ops
- idedisk_init() -> ide_gd_init()
- idedisk_exit() -> ide_gd_exit()

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>
ae9f9f073963c56dcc4601ed9a0921eda1e8fa9d 17-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-{disk,floppy}: set IDE_DFLAG_ATTACH in *_setup()

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>
81ee1bb51fff76aaa738668b92406b5117f125ed 17-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: move IDE_DFLAG_DOORLOCKING flag handling to idedisk_set_doorlock()

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>
d7e747596829c1c11833ca0a1f5e64f400d20bf2 17-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: use to_ide_drv() and ide_drv_g()

There should be no functional changes caused by this patch.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
099ed4c2f5d54a5e1e490250805fb9727d622c0c 17-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: lock media before checking for media change

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
0a70c7f67a24b45e105ad10ac1d7e73fe50ec765 17-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: fix IDE_DFLAG_LBA48 handling on resume

Some code in idedisk_setup() should be in idedisk_capacity() instead.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
06b89518fa69fb7243dc98c31f9a9cfa61bfe788 13-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: move /proc handling to ide-disk_proc.c (take 3)

While at it:
- idedisk_capacity() -> ide_disk_capacity()
- idedisk_proc[] -> ide_disk_proc[]
- idedisk_settings[] -> ide_disk_settings[]

v2/3:
Build fix for CONFIG_IDE_PROC_FS=n from Elias Oltmanns.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
f87904898e91923a91b925078ac933f05076c7fd 13-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: move all ioctl handling to ide-disk_ioctl.c

While at it:
- idedisk_ioctl() -> ide_disk_ioctl()

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
d1d76714e2f0c520b6c2a84ab5b050d0b3244949 13-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 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>
0ae4b3199ab1b6d511c6e0948e92049c272a346a 13-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove superfluous ->media field from ide_driver_t

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
97100fc816badbbc162644cfde7ad39ae9211fb4 13-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 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>
be3c096ebdbe3c828aacb5473751a22840753eff 13-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: add ide_do_setfeature() helper

Add ide_do_setfeature() helper and convert set_{wcache,acoustic}()
to use it.

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>
35c137531245118962eb40a550661afe317bec03 13-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: set_addressing() fixes

* Return -EIO if arg > 0 and LBA48 is unsupported.

* No need to reset ->addressing.

* Make ->addressing a single bit flag.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
92f1f8fd8040e7b50a67a850a935509bb01201bb 10-Oct-2008 Elias Oltmanns <eo@nebensachen.de> 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>
aa7687738af3332470e02ac1060f6c046d83c9a3 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: add ide_setting_ioctl() helper

* Add struct ide_ioctl_devset representing ioctl device setting.

* Add ide_setting_ioctl() helper for matching given ioctl
and its parameters against table of ioctl device settings.

* Convert ide_setting_ioctl() and idedisk_ioctl() to use
ide_setting_ioctl().

* Un-export ide_setting_mtx.

While at it:

* {get,set}_lba_addressing() -> {get,set}_addressing()

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
a02227c9774b3bff08c7f557d06247e0a03ac435 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: lba_capacity_is_ok() -> ata_id_is_lba_capacity_ok()

Rename lba_capacity_is_ok() to ata_id_is_lba_capacity_ok()
and move it to <linux/ata.h> (remove needless parens while at it).

Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
ff2779b568e70822e0ef2cc7afeeefbe7c607652 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 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>
4b58f17d7c45a8e5f4acda641bec388398b9c0fa 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 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>
942dcd85bf8edf38cdc3745306ca250684d99a61 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: idedisk_supports_lba48() -> ata_id_lba48_enabled()

* Add ata_id_lba48_enabled() inline helper to <linux/ata.h>.

* idedisk_supports_lba48() -> ata_id_lba48_enabled()

The latter one also checks validity of words 83 & 86.

Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
02d599a365d04658bc9ea71762ed17c895079927 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove ->supports_dsc_overlap field from ide_driver_t

* Use drive->media and drive->scsi to check if ->dsc_overlap
can be set by HDIO_SET_NICE ioctl in generic_ide_ioctl().

* Remove unused ->supports_dsc_overlap field from ide_driver_t.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
151a670186a0f8441798f90c8701647adb7a1589 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove SECTOR_WORDS define

Just use SECTOR_SIZE instead.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
8185d5aa93e0a5c111adc4952a5b87193a68ae5b 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: /proc/ide/hd*/settings rework

* Add struct ide_devset, S_* flags, *DEVSET() & ide*_devset_*() macros.

* Add 'const struct ide_devset **settings' to ide_driver_t.

* Use 'const struct ide_devset **settings' in ide_drive_t instead of
'struct ide_settings_s *settings'. Then convert core code and device
drivers to use struct ide_devset and co.:

- device settings are no longer allocated dynamically for each device
but instead there is an unique struct ide_devset instance per setting

- device driver keeps the pointer to the table of pointers to its
settings in ide_driver_t.settings

- generic settings are kept in ide_generic_setting[]

- ide_proc_[un]register_driver(), ide_find_setting_by_name(),
ide_{read,write}_setting() and proc_ide_{read,write}_settings()
are updated accordingly

- ide*_add_settings() are removed

* Remove no longer used __ide_add_setting(), ide_add_setting(),
__ide_remove_setting() and auto_remove_settings().

* Remove no longer used TYPE_*, SETTING_*, ide_procset_t
and ide_settings_t.

* ->keep_settings, ->using_dma, ->unmask, ->noflush, ->dsc_overlap,
->nice1, ->addressing, ->wcache and ->nowerr ide_drive_t fields
can now be bitfield flags.

While at it:

* Rename ide_find_setting_by_name() to ide_find_setting().

* Rename write_wcache() to set_wcache().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
263138a0ad6e38de7f6526b7de037ed4511308ef 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: preparations for /proc/ide/hd*/settings rework

After rework settings will be no longer created dynamically
for each device so we need to make some fixups first.

* Use set_[ksettings,unmaskirq]() as a set function for
["keepsettings","unmaskirq"] setting.

* Allow writes to ["io_32bit","unmaskirq"] settings also when
drive->no_[io_32bit,unmask] is set (this is checked later inside
set_[io_32bit,unmaskirq]() anywyay and keeps consistency with
the corresponding HDIO_SET_[32BIT,UNMASKINTR] ioctls).

* Use max possible multi sectors value (16) as an allowed max for
"multcount" setting. set_multcount() set function checks against
device's max possbile value anyway and it makes the proc setting
consistent with the corresponding HDIO_SET_MULTCOUNT ioctl.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
1e874f448365b80e69b8a60b8b575b17f00811f3 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: call ide_proc_register_driver() later

Call ide_proc_register_driver() in ide*_setup() (just before
ide*_add_settings() call) instead of in ->probe method.

Despite being basically a preparation for /proc/ide/hd*/settings
rework this is a nice cleanup in itself.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
3ceca727fe3a38dd8d7a3adf938fefda83eee8af 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 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>
2a924662b646fa25cb491d50aa1202a94aa4ac55 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove needless drive->present checks from device drivers

Remove needless drive->present checks from ->probe methods
(device model takes care of that).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
3cd5f1eae093a7d6ff8a63c746eba9d6f689ba91 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove unused _IDE_C and _IDE_DISK defines

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
3c619ffd48d7fdb3b17f0df67c4eb4b0bd80e253 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 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>
aaaade3f059fa1b57283d4a7c8351a42ec747bf0 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 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>
f41891c134ccdd07583ebd8d4af7fed883375672 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: use ata_id_hpa_enabled()

idedisk_supports_hpa() -> ata_id_hpa_enabled().

The latter one also checks validity of words 82 & 85.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
8a089c6679a9f1c0a00b7e08554e90b507ec527a 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: use ata_id_wcache_enabled()

Replace open-coded check by ata_id_wcache_enabled()
(which also checks validity of word 85).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
48fb2688aa67baba373531cc4ed2d9e695983c3f 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove drive->driveid

* Factor out HDIO_[OBSOLETE,GET]_IDENTITY ioctls handling
to ide_get_identity_ioctl().

* Use temporary buffer in ide_get_identity_ioctl() instead
of accessing drive->id directly.

* Add ide_id_to_hd_driveid() inline to convert raw id into
struct hd_driveid format (needed on big-endian).

* Use ide_id_to_hd_driveid() in ide_get_identity_ioctl(),
cleanup ide_fix_driveid() and switch ide to use use raw id.

* Remove no longer needed drive->driveid.

This leaves us with 3 users of struct hd_driveid in tree:
- arch/um/drivers/ubd_kern.c
- drivers/block/xsysace.c
- drivers/usb/storage/isd200.c

While at it:

* Use ata_id_u{32,64}() and ata_id_has_{dma,lba,iordy}() macros.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
4dde4492d850a4c9bcaa92e5bd7f4eebe3e2f5ab 10-Oct-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: make drive->id an union (take 2)

Make drive->id an unnamed union so id can be accessed either by using
'u16 *id' or 'struct hd_driveid *driveid'. Then convert all existing
drive->id users accordingly (using 'u16 *id' when possible).

This is an intermediate step to make ide 'struct hd_driveid'-free.

While at it:

- Add missing KERN_CONTs in it821x.c.

- Use ATA_ID_WORDS and ATA_ID_*_LEN defines.

- Remove unnecessary checks for drive->id.

- s/drive_table/table/ in ide_in_drive_list().

- Cleanup ide_config_drive_speed() a bit.

- s/drive1/dev1/ & s/drive0/dev0/ in ide_undecoded_slave().

v2:
Fix typo in drivers/ide/ppc/pmac.c. (From Stephen Rothwell)

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
3e1a7ff8a0a7b948f2684930166954f9e8e776fe 25-Aug-2008 Tejun Heo <tj@kernel.org> block: allow disk to have extended device number

Now that disk and partition handlings are mostly unified, it's easy to
allow disk to have extended device number. This patch makes
add_disk() use extended device number if disk->minors is zero. Both
sd and ide-disk are updated to use this.

* sd_format_disk_name() is implemented which can generically determine
the drive name. This removes disk number restriction stemming from
limited device names.

* If sd index goes over SD_MAX_DISKS (which can be increased now BTW),
sd simply doesn't initialize minors letting block layer choose
extended device number.

* If CONFIG_DEBUG_EXT_DEVT is set, both sd and ide-disk always set
minors to 0 and use extended device numbers.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
689d6fac40b41c7bf154f362deaf442548e4dc81 25-Aug-2008 Tejun Heo <tj@kernel.org> block: replace @ext_minors with GENHD_FL_EXT_DEVT

With previous changes, it's meaningless to limit the number of
partitions. Replace @ext_minors with GENHD_FL_EXT_DEVT such that
setting the flag allows the disk to have maximum number of allowed
partitions (only limited by the number of entries in parsed_partitions
as determined by MAX_PART constant).

This kills not-too-pretty alloc_disk_ext[_node]() functions and makes
@minors parameter to alloc_disk[_node]() unnecessary. The parameter
is left alone to avoid disturbing the users.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
870d6656126add8e383645732b03df2b7ccd4f94 25-Aug-2008 Tejun Heo <tj@kernel.org> block: implement CONFIG_DEBUG_BLOCK_EXT_DEVT

Extended devt introduces non-contiguos device numbers. This patch
implements a debug option which forces most devt allocations to be
from the extended area and spreads them out. This is enabled by
default if DEBUG_KERNEL is set and achieves...

1. Detects code paths in kernel or userland which expect predetermined
consecutive device numbers.

2. When something goes wrong, avoid corruption as adding to the minor
of earlier partition won't lead to the wrong but valid device.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
f615b48cc7df7cac3865ec76ac1a5bb04d3e07f4 25-Aug-2008 Tejun Heo <tj@kernel.org> sd/ide-disk: apply extended minors to sd and ide

Update sd and ide-disk such that they can take advantage of extended
minors.

ide-disk already has 64 minors per device and currently doesn't use
extended minors although after this patch it can be turned on by
simply tweaking constants.

sd only had 16 minors per device causing problems on certain peculiar
configurations. This patch lifts the restriction and enables it to
use upto 64 minors.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
ab1b67a6230648cf65b0342d9887fee890160ca8 02-Sep-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: remove stale init_idedisk_capacity() documentation

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
d3e33ff59facec005e48ba3360502b73a04e4b4e 05-Aug-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: fix regression caused by ide_device_{get,put}() addition (take 2)

On Monday 28 July 2008, Benjamin Herrenschmidt wrote:

[...]

> Vector: 300 (Data Access) at [c58b7b80]
> pc: c014f264: elv_may_queue+0x10/0x44
> lr: c0152750: get_request+0x2c/0x2c0
> sp: c58b7c30
> msr: 1032
> dar: c
> dsisr: 40000000
> current = 0xc58aaae0
> pid = 854, comm = media-bay
> enter ? for help
> mon> t
> [c58b7c40] c0152750 get_request+0x2c/0x2c0
> [c58b7c70] c0152a08 get_request_wait+0x24/0xec
> [c58b7cc0] c0225674 ide_cd_queue_pc+0x58/0x1a0
> [c58b7d40] c022672c ide_cdrom_packet+0x9c/0xdc
> [c58b7d70] c0261810 cdrom_get_disc_info+0x60/0xd0
> [c58b7dc0] c026208c cdrom_mrw_exit+0x1c/0x11c
> [c58b7e30] c0260f7c unregister_cdrom+0x84/0xe8
> [c58b7e50] c022395c ide_cd_release+0x80/0x84
> [c58b7e70] c0163650 kref_put+0x54/0x6c
> [c58b7e80] c0223884 ide_cd_put+0x40/0x5c
> [c58b7ea0] c0211100 generic_ide_remove+0x28/0x3c
> [c58b7eb0] c01e9d34 __device_release_driver+0x78/0xb4
> [c58b7ec0] c01e9e44 device_release_driver+0x28/0x44
> [c58b7ee0] c01e8f7c bus_remove_device+0xac/0xd8
> [c58b7f00] c01e7424 device_del+0x104/0x198
> [c58b7f20] c01e74d0 device_unregister+0x18/0x30
> [c58b7f40] c02121c4 __ide_port_unregister_devices+0x6c/0x88
> [c58b7f60] c0212398 ide_port_unregister_devices+0x38/0x80
> [c58b7f80] c0208ca4 media_bay_step+0x1cc/0x5c0
> [c58b7fb0] c0209124 media_bay_task+0x8c/0xcc
> [c58b7fd0] c00485c0 kthread+0x48/0x84
> [c58b7ff0] c0011b20 kernel_thread+0x44/0x60

The guilty commit turned out to be 08da591e14cf87247ec09b17c350235157a92fc3
("ide: add ide_device_{get,put}() helpers"). ide_device_put() is called
before kref_put() in ide_cd_put() so IDE device is already gone by the time
ide_cd_release() is reached.

Fix it by calling ide_device_get() before kref_get() and ide_device_put()
after kref_put() in all affected device drivers.

v2:
Brown paper bag time. In v1 cd->drive was referenced after dropping last
reference on cd object (which could result in OOPS in ide_device_put() as
reported/debugged by Mariusz Kozlowski). Fix it by caching cd->drive in
the local variable (fix other device drivers too).

Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reported-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Tested-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Tested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
08da591e14cf87247ec09b17c350235157a92fc3 24-Jul-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: add ide_device_{get,put}() helpers

* Add 'struct ide_host *host' field to ide_hwif_t and set it
in ide_host_alloc_all().

* Add ide_device_{get,put}() helpers loosely based on SCSI's
scsi_device_{get,put}() ones.

* Convert IDE device drivers to use ide_device_{get,put}().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
ba4b2e607e4e9eaa929935325dafd5c86d3b5262 23-Jul-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove dead Virtual DMA support

Lets remove dead Virtual DMA support for now so it doesn't clutter
core IDE code (it can be bring back when there is a need for it):

* Remove IDE_HFLAG_VDMA host flag.

* Remove ide_drive_t.vdma flag.

* cs5520.c: remove stale FIXMEs, cs5520_dma_host_set() and cs5520_dma_ops
(also there is no longer a need to set IDE_HFLAG_NO_ATAPI_DMA).

There should be no functional changes caused by this patch.

Cc: TAKADA Yoshihito <takada@mbf.nifty.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
3ef5eb424ebf0cd981192a416358fd707a9f959b 16-Jul-2008 Elias Oltmanns <eo@nebensachen.de> 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>
9a410e79b552bacb4481f85618aa7333b7776ed7 15-Jul-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove IDE_TFLAG_NO_SELECT_MASK taskfile flag

Always call SELECT_MASK(..., 0) in ide_tf_load() (needs to be done
to match ide_set_irq(..., 1)) and then remove IDE_TFLAG_NO_SELECT_MASK
taskfile flag.

This change should only affect hpt366 and icside host drivers since
->maskproc(..., 0) for sgiioc4 is equivalent to ide_set_irq(..., 1).

Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
dd47087bc173a84e8c42644b315d38b30dc02263 15-Jul-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> ide-disk: convert ide_do_drive_cmd path to use blk_execute_rq

This converts the ide_do_drive_cmd path using ide_wait to use
blk_execute_rq.

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>
9841654949f0a3f1289b6b95b2ab56cd99fb5360 26-Apr-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: fix issues found by checkpatch.pl

There are no changes to the resulting drivers/ide/ide-disk.o binary file
(md5sum-s after and before the patch match).

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
799ee57ac83f019f035024614d95067ce583bc2b 26-Apr-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: add proc_idedisk_read_smart() helper

* Factor out common code from proc_idedisk_read_smart_{thresholds,values}()
to proc_idedisk_read_smart() helper.

* Rename proc_idedisk_read_smart_thresholds() to proc_idedisk_read_st()
and proc_idedisk_read_smart_values() to proc_idedisk_read_sv().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
d12faa2736ebdee025a9aa07b2683c5fa8c86553 26-Feb-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: add missing printk() KERN_* levels

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
b152fcd34108d07a1e682786af583fd3e080cab3 19-Feb-2008 Mikko Rapeli <mikko.rapeli@teleca.com> ide/libata: ST310211A has buggy HPA too

Signed-off-by: Mikko Rapeli <mikko.rapeli@teleca.com>
Tested-by: Bart Champagne <bart@as35701.net>
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
395d8ef5bebe547a80737692f9789d2e36da16f2 11-Feb-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: fix flush requests (take 2)

commit 813a0eb233ee67d7166241a8b389b6a76f2247f9
Author: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Date: Fri Jan 25 22:17:10 2008 +0100

ide: switch idedisk_prepare_flush() to use REQ_TYPE_ATA_TASKFILE requests

...

broke flush requests.

Allocating IDE command structure on the stack for flush requests is not
a very brilliant idea:

- idedisk_prepare_flush() only prepares the request and it doesn't wait
for it to be completed

- there are can be multiple flush requests queued in the queue

Fix the problem (per hints from James Bottomley) by:
- dynamically allocating ide_task_t instance using kmalloc(..., GFP_ATOMIC)
- adding new taskfile flag (IDE_TFLAG_DYN)
- calling kfree() in ide_end_drive_command() if IDE_TFLAG_DYN is set
(while at it rename 'args' to 'task' and fix whitespace damage)

[ This will be fixed properly before 2.6.25 but this bug is rather
critical and the proper solution requires some more work + testing. ]

Thanks to Sebastian Siewior and Christoph Hellwig for reporting the
problem and testing patches (extra thanks to Sebastian for bisecting
it to the guilty commmit).

Tested-by: Sebastian Siewior <ide-bug@ml.breakpoint.cc>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
59bca8cc995428c34d8cdfadfa87c8e3f01c4340 01-Feb-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: update/add my Copyrights

The last years stuff and a trip down memory lane...

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
58f189fccc72bb8a91de1854e519b47d64fbdbaa 01-Feb-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: delete filenames/versions from comments

Delete filenames/versions from comments.

I'm leaving decisions about adding DRV_VERSION defines and MODULE_VERSION()-s
to maintainers of the respective drivers.

While at it:

* Remove unused VERSION define from ide.c.

* Remove unused/stale DRV_VERSION define from au1xxx-ide.c.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
852738f39258deafb3d89c187cb1a4050820d555 26-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: convert "empty" REQ_TYPE_ATA_CMD requests to use REQ_TYPE_ATA_TASKFILE

Based on the previous work by Tejun Heo.

There should be no functionality changes caused by this patch.

Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
657cc1a8f6cd6a9e2974cba3af9fccd8c25e06ad 26-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: set IDE_TFLAG_IN_* flags before queuing/executing command

* Add IDE_TFLAG_{HOB,TF,DEVICE} defines.

* Set IDE_TFLAG_IN_* flags in {do_rw,ide_no_data,ide_raw}_taskfile() users.

* Remove no longer needed ->tf_flags setup from ide_end_drive_cmd().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
9e47be0c97f7357b80e91dc0632e9cce2eb025e0 26-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove broken disk byte-swapping support

Remove broken disk byte-swapping support:
- it can cause a data corruption on SMP (or if using PREEMPT on UP)
- all data coming from disk are byte-swapped by taskfile_*_data() which
results in incorrect identify data being reported by /proc/ide/ and IOCTLs
- "hdx=bswap/byteswap" kernel parameter has been broken on m68k host drivers
(including Atari/Q40 ones) since 2.5.x days (because of 'hwif' zero-ing)
- byte-swapping is limited to PIO transfers (for working with TiVo disks on
x86 machines using user-space solutions or dm-byteswap should result in
much better performance because DMA can be used)

For previous discussions please see:

http://www.ussg.iu.edu/hypermail/linux/kernel/0201.0/0768.html
http://lkml.org/lkml/2004/2/28/111

[ I have dm-byteswap device mapper target if somebody is interested
(patch is for 2.6.4 though but I'll dust it off if needed). ]

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
6dd9b8376adbee95ddc321cc83c7f641577e01f6 26-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: dump taskfile HOB registers in ide_tf_load() (if DEBUG is defined)

* Dump taskfile HOB registers in ide_tf_load() (if DEBUG is defined).

* Remove no longer needed DEBUG code from __ide_do_rw_disk().

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
29ec683f019608ca0cb6cf69011426ecb5daa69e 26-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: add idedisk_set_doorlock() helper

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
a501633c7d44087e806597d3a213d735346edd51 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: use ide_get_lba_addr()

* Export ide_get_lba_addr().

* Convert idedisk_{read_native,set}_max_address() to use ide_get_lba_addr().

* Remove incorrect comment from idedisk_read_native_max_address()
(noticed by Sergei).

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
f6e29e35cc0f9facf2eb0b0454f9b09021b5aa6f 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: use do_rw_taskfile() (take 2)

* Add IDE_TFLAG_DMA_PIO_FALLBACK taskfile flag to indicate the need
to skip loading taskfile registers in do_rw_taskfile().

* Export do_rw_taskfile().

* Convert __ide_do_rw_disk() to use do_rw_taskfile().

* Unexport ide_tf_load().

* Unexport {pre_task_out,task_in}_intr() and make it static.

* Remove incorrect comment about do_rw_taskfile() from <linux/ide.h>.

There should be no functionality changes caused by this patch.

v2:
* Add missing blk_fs_request() check to task_dma_ok() (for VDMA).

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
ba76ae3883ad9faa32a6b35271c6a407d6c96ca9 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: add ide_tf_set_cmd() helper

* Add ide_tf_set_cmd() helper for selecting/setting command and data phase
(note: DMA data phases are there for completness, they are not required ATM).

* Set IDE_TFLAG_WRITE taskfile flag for write requests in __ide_do_rw_disk().

* Convert __ide_do_rw_disk() to use the new ide_tf_set_cmd() helper.

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
c52ea915d7fdc96819964b32eb124b5ccd22b9af 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: extend timeout for PIO-in commands

s/WAIT_CMD/WAIT_WORSTCASE/ to make the timeout the same as in do_rw_taskfile()

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
1192e528e064ebb9a578219731d2b0f78ca3c1ec 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: use ->data_phase to set ->handler in do_rw_taskfile()

* Use ->data_phase to set ->handler in do_rw_taskfile() instead of
setting ->handler in callers of ide_raw_taskfile()/do_rw_taskfile().

* Unexport task_no_data_intr() and make it static.

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
a7bbd20b50fb12b3a604c396b3d8a3449a43edcc 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: guarantee 400ns delay after writing command register

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
cf77249ee1a37aab37f39ea1dde9a53c23693655 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: fix __ide_do_rw_disk() to use ->OUTBSYNC

Fix __ide_do_rw_disk() to use ->OUTBSYNC instead of ->OUTB
(needed for pmac and scc_pata host drivers).

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
ac026ff254b32915bb14ba97a23b4019d137f181 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove 'command_type' field from ide_task_t

* Add 'data_buf' and 'nsect' variables in ide_taskfile_ioctl()
to cache data buffer pointer and number of sectors to transfer
(this allows us to have only one ide_diag_taskfile() call).

* Add IDE_TFLAG_WRITE taskfile flag and use it to check whether
the REQ_RW request flag should be set.

* Move ->command_type handling from ide_diag_taskfile() to
ide_taskfile_ioctl() and use ->req_cmd instead of ->command_type.

* Add 'nsect' parameter to ide_raw_taskfile().

* Merge ide_diag_taskfile() into ide_raw_taskfile().

* Initialize ->data_phase explicitly in idedisk_prepare_flush(),
ide_start_power_step() and ide_disk_special().

* Remove no longer needed 'command_type' field from ide_task_t.

* Add #ifndef/#endif __KERNEL__ to <linux/hdreg.h> around no
longer used by kernel IDE_DRIVE_TASK_* and TASKFILE_* defines.

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
790d1239898d4f893112280decd344d90f43ee96 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove ata_nsector_t, ata_data_t and atapi_bcount_t

Remove ata_nsector_t, ata_data_t (unused) and atapi_bcount_t.

While at it:
* replace 'HWIF(drive)' by 'hwif'

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
813a0eb233ee67d7166241a8b389b6a76f2247f9 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: switch idedisk_prepare_flush() to use REQ_TYPE_ATA_TASKFILE requests

Based on the earlier work by Tejun Heo.

There should be no functionality changes caused by this patch.

Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
a3bbb9d882dc94fe3a1361596ab9ce55d84059ea 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove unnecessary writes to HOB taskfile registers

* Set taskfile flags for REQ_TYPE_ATA_TASKFILE requests before
adding the request to the queue.

* Cleanup execute_drive_cmd().

* Remove unnecessary writes to HOB taskfile registers when using
LBA48 disk for the following cases:

- Power Management requests
(WIN_FLUSH_CACHE[_EXT], WIN_STANDBYNOW1, WIN_IDLEIMMEDIATE commands)

- special commands (WIN_SPECIFY, WIN_RESTORE, WIN_SETMULT)

- Host Protected Area support (WIN_READ_NATIVE_MAX, WIN_SET_MAX)

- /proc/ide/ SMART support (WIN_SMART with SMART_ENABLE,
SMART_READ_VALUES and SMART_READ_THRESHOLDS subcommands)

- write cache enabling/disabling in ide-disk
(WIN_SETFEATURES with SETFEATURES_{EN,DIS}_WCACHE)

- write cache flushing in ide-disk (WIN_FLUSH_CACHE[_EXT])

- acoustic management in ide-disk
(WIN_SETFEATURES with SETFEATURES_{EN,DIS}_AAM)

- door (un)locking in ide-disk (WIN_DOORLOCK, WIN_DOORUNLOCK)

- /proc/ide/hd?/identify support (WIN_IDENTIFY)

- ACPI _GTF taskfiles

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
807e35d695690011faa1ce3ad67dfc23c1e39bdc 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: use ide_tf_load() in execute_drive_cmd()

* Add IDE_TFLAG_OUT_DEVICE taskfile flag to indicate the need of writing
the Device register and handle it in ide_tf_load().

Update ide_tf_load() and {do_rw,flagged}_taskfile() users accordingly.

* Use struct ide_taskfile and ide_tf_load() in execute_drive_cmd().

* Make the debugging code dump all taskfile registers for both
REQ_ATA_TYPE_{CMD,TASK} requests and move it to ide_tf_load()
so it also covers REQ_ATA_TYPE_TASKFILE requests.

There should be no functionality changes caused by this patch
(unless DEBUG is defined).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
74095a91ed02f6727b62d4416be00a041f2d7436 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: use do_rw_taskfile() in flagged_taskfile()

Based on the earlier work by Tejun Heo.

* Move setting IDE_TFLAG_LBA48 taskfile flag from do_rw_taskfile()
function to the callers.

* Add IDE_TFLAG_FLAGGED taskfile flag for flagged taskfiles coming
from ide_taskfile_ioctl(). Check it instead of ->tf_out_flags.all.

* Add IDE_TFLAG_OUT_DATA taskfile flag to indicate the need to load
IDE data register in ide_tf_load().

* Add IDE_TFLAG_OUT_* taskfile flags to indicate the need to load
particular IDE taskfile registers in ide_tf_load().

* Update do_rw_taskfile() and ide_tf_load() users to set respective
IDE_TFLAG_OUT_* taksfile flags.

* Add task_dma_ok() helper.

* Use IDE_TFLAG_FLAGGED taskfile flag to select HIHI mask in ide_tf_load().

* Use do_rw_taskfile() in flagged_taskfile().

* Remove no longer needed 'tf_out_flags' field from ide_task_t.

There should be no functionality changes caused by this patch.

Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
9a3c49be5c5f7388eefb712be9a383904140532e 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: add ide_no_data_taskfile() helper

* Add ide_no_data_taskfile() helper and convert ide_raw_taskfile() w/ NO DATA
protocol users to use it instead.

* Set ->data_phase explicitly in ide_no_data_taskfile()
(TASKFILE_NO_DATA is defined as 0x0000).

* Unexport task_no_data_intr().

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
9e42237f26cf517a3f682505f03a3a8d89b3b35d 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: add ide_tf_load() helper

Based on the earlier work by Tejun Heo.

* Add 'tf_flags' field (for taskfile flags) to ide_task_t.

* Add IDE_TFLAG_LBA48 taskfile flag for LBA48 taskfiles.

* Add IDE_TFLAG_NO_SELECT_MASK taskfile flag for __ide_do_rw_disk()
which doesn't use SELECT_MASK() (looks like a bug but it requires
some more investigation).

* Split off ide_tf_load() helper from do_rw_taskfile().

* Convert __ide_do_rw_disk() to use ide_tf_load().

There should be no functionality changes caused by this patch.

Cc: Tejun Heo <htejun@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2bd06b23e2a099abbf550202f62cd433e01f83e7 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: use struct ide_taskfile in __ide_do_rw_disk()

Based on the earlier work by Tejun Heo.

There should be no functionality changes caused by this patch.

Cc: Tejun Heo <htejun@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
d00e42dd26bbda6a39aead6a47c59221e03a08f8 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: fix taskfile registers loading order in __ide_do_rw_disk()

Load IDE_SECTOR_REG after IDE_FEATURE_REG and IDE_NSECTOR_REG when using CHS.

This patch is basically a preparation for the next one which converts
__ide_do_rw_disk() to use struct ide_taskfile.

It shouldn't affect anything (just a usual paranoia to separate changes
which change the way in which hardware is accessed from code cleanups).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
7a3b7512d0d7e78353e99f4538eb6d3354019d92 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: merge LBA28 and LBA48 Host Protected Area support code (take 2)

* Merge idedisk_{read_native,set}_max_address_ext() into
idedisk_{read_native,set}_max_address().

v2:
* Remove LBA48 code leftover from idedisk_read_native_max_address()
('high' variable initialization). (Noticed by Sergei).

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
650d841d9e053a618dd8ce753422f91b493cf2f6 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: add struct ide_taskfile (take 2)

* Don't set write-only ide_task_t.hobRegister[6] and ide_task_t.hobRegister[7]
in idedisk_set_max_address_ext().

* Add struct ide_taskfile and use it in ide_task_t instead of tfRegister[]
and hobRegister[].

* Remove no longer needed IDE_CONTROL_OFFSET_HOB define.

* Add #ifndef/#endif __KERNEL__ around definitions of {task,hob}_struct_t.

While at it:

* Use ATA_LBA define for LBA bit (0x40) as suggested by Tejun Heo.

v2:
* Add missing newlines. (Noticed by Sergei)

* Use ~ATA_LBA instead of 0xBF. (Noticed by Sergei)

* Use unnamed unions for error/feature and status/command.
(Suggested by Sergei).

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
cd2a2d969761c26542095c01324201ca0b3ee896 25-Jan-2008 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove task_ioreg_t typedef (take 2)

Remove task_ioreg_t typedef from the kernel code (but leave it
in <linux/hdreg.h> for #ifndef/#endif __KERNEL__ case).

While at it also move sata_ioreg_t typedef under #ifndef/#endif __KERNEL__.

v2:
Remove name of the second parameter from ide_execute_command() declaration.
(Noticed by Sergei).

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
fedda1e13125153d502e84856a2640acdb4c38f0 12-Dec-2007 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove stale changelog from ide-disk.c

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
3ab7efe8e2cbcca2d401b43cfcc2fa9a7dac2299 12-Dec-2007 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: DMA reporting and validity checking fixes (take 3)

* ide_xfer_verbose() fixups:
- beautify returned mode names
- fix PIO5 reporting
- make it return 'const char *'

* Change printk() level from KERN_DEBUG to KERN_INFO in ide_find_dma_mode().

* Add ide_id_dma_bug() helper based on ide_dma_verbose() to check for invalid
DMA info in identify block.

* Use ide_id_dma_bug() in ide_tune_dma() and ide_driveid_update().

As a result DMA won't be tuned or will be disabled after tuning if device
reports inconsistent info about enabled DMA mode (ide_dma_verbose() does the
same checks while the IDE device is probed by ide-{cd,disk} device driver).

* Remove no longer needed ide_dma_verbose().

This patch should fix the following problem with out-of-sync IDE messages
reported by Nick Warne:

hdd: ATAPI 48X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache<7>hdd:
skipping word 93 validity check
, UDMA(66)

and later debugged by Mark Lord to be caused by:

ide_dma_verbose()
printk( ... "2048kB Cache");
eighty_ninty_three()
printk(KERN_DEBUG "%s: skipping word 93 validity check\n");
ide_dma_verbose()
printk(", UDMA(66)"

Please note that as a result ide-{cd,disk} device drivers won't report the
DMA speed used but this is intended since now DMA mode being used is always
reported by IDE core code.

v2:
* fixes suggested by Randy:
- use KERN_CONT for printk()-s in ide-{cd,disk}.c
- don't remove argument name from ide_xfer_verbose() declaration

v3:
* Remove incorrect check for (id->field_valid & 1) from ide_id_dma_bug()
(spotted by Sergei).

* "XFER SLOW" -> "PIO SLOW" in ide_xfer_verbose() (suggested by Sergei).

* Fix ide_find_dma_mode() to report the correct mode ('mode' after being
limited by 'req_mode').

Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Nick Warne <nick@ukfsn.org>
Cc: Mark Lord <lkml@rtr.ca>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
43e7c0c4bfdf750d956b4b5a617395d859f20353 20-Oct-2007 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: add get_smart_data() helper

Merge get_smart_values() and get_smart_thresholds()
into get_smart_data() helper.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
238e4f142c33bb34440cc64029dde7b9fbc4e65f 19-Oct-2007 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: add IDE_HFLAG_NO_LBA48 and IDE_HFLAG_NO_LBA48_DMA host flags

Add IDE_HFLAG_NO_LBA48[_DMA] host flags, use it instead of hwif->no_lba48[_dma]
and then remove no longer needed hwif->no_lba48[_dma]. As a side-effect
this change fixes hwif->no_lba48_dma not being restored by ide_hwif_restore().

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
fd5d806266935179deda1502101624832eacd01f 16-Oct-2007 Jens Axboe <jens.axboe@oracle.com> block: convert blkdev_issue_flush() to use empty barriers

Then we can get rid of ->issue_flush_fn() and all the driver private
implementations of that.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
7062cdc5edb3ba4b2eb906684cd19e103de1f920 17-Sep-2007 Jorge Juan Chico <jjchico@gmail.com> ide: ST320413A has the same problem as ST340823A

ST320413A has the same problem as ST340823A. Please see
https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.15/+bug/26119

From: "Jorge Juan Chico" <jjchico@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
b0244a00451c1ad64bf0a51f50679f7146786780 20-Aug-2007 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide-disk: workaround for buggy HPA support on ST340823A (take 3)

This disk reports total number of sectors instead of maximum sector address
in response to READ_NATIVE_MAX_ADDRESS command and also happily accepts
SET_MAX_ADDRESS command with the bogus value. This results in +1 sector
capacity being used and errors on attempts to use the last sector.

...
hdd: Host Protected Area detected.
        current capacity is 78165360 sectors (40020 MB)
        native  capacity is 78165361 sectors (40020 MB)
hdd: Host Protected Area disabled.
...
hdd: reading: block=78165360, sectors=1, buffer=0xc1e63000
hdd: dma_intr: status=0x51 { DriveReady SeekComplete Error }
hdd: dma_intr: error=0x10 { SectorIdNotFound }, LBAsect=78165360, sector=78165360
...

Add hpa_list[] table and workaround the issue in idedisk_check_hpa().

v2:
* Add missing export and improve patch description a bit.

v3:
* Add list termination. (From Mikko)

Fixes kernel bugzilla bug #8816.

Thanks to Mikko for investigating the issue and helping with this patch.

Cc: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
165125e1e480f9510a5ffcfbfee4e3ee38c05f23 24-Jul-2007 Jens Axboe <jens.axboe@oracle.com> [BLOCK] Get rid of request_queue_t typedef

Some of the code has been gradually transitioned to using the proper
struct request_queue, but there's lots left. So do a full sweet of
the kernel and get rid of this typedef and replace its uses with
the proper type.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
f9383c4269d264c3cf563bd2de365891f6592ebd 09-Jul-2007 Matthias Kaehlcke <matthias.kaehlcke@gmail.com> ide: use mutex instead of ide_setting_sem semaphore in IDE driver

The IDE driver uses a semaphore as mutex.
Use the mutex API instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

--
0d2157f78d17fcee17791f54959e67cc0af0da74 08-Jun-2007 Lee Trager <lt73@cs.drexel.edu> ide: HPA detect from resume

Currently when system which have HPA require HPA to be detected and
disabled upon resume from RAM or disk. The current IDE drivers do not do
this nor does libata (obviously it since it doesn't support HPA yet).

I have implemented this into the current IDE drivers and it has been
tested by many others since 7/15/2006 in bug number 6840:

http://bugzilla.kernel.org/show_bug.cgi?id=6840

and it has been confirmed to work fine with no problems.

bart: added drv != NULL check to generic_ide_suspend()

From: Lee Trager <lt73@cs.drexel.edu>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
7662d046df09e80680b77b68de896beab45e675e 10-May-2007 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: move IDE settings handling to ide-proc.c

* move
__ide_add_setting()
ide_add_setting()
__ide_remove_setting()
auto_remove_settings()
ide_find_setting_by_name()
ide_read_setting()
ide_write_setting()
set_xfer_rate()
ide_add_generic_settings()
ide_register_subdriver()
ide_unregister_subdriver()

from ide.c to ide-proc.c

* set_{io_32bit,pio_mode,using_dma}() cannot be marked static now, fix it

* rename ide_[un]register_subdriver() to ide_proc_[un]register_driver(),
update device drivers to use new names

* add CONFIG_IDE_PROC_FS=n versions of ide_proc_[un]register_driver()
and ide_add_generic_settings()

* make ide_find_setting_by_name(), ide_{read,write}_setting()
and ide_{add,remove}_proc_entries() static

* cover IDE settings code in device drivers with CONFIG_IDE_PROC_FS #ifdef,
also while at it cover with CONFIG_IDE_PROC_FS #ifdef ide_driver_t.proc

* remove bogus comment from ide.h

* cover with CONFIG_IDE_PROC_FS #ifdef .proc and .settings in ide_drive_t

Besides saner code this patch results in the IDE core smaller by ~2 kB
(on x86-32) and IDE disk driver by ~1 kB (ditto) when CONFIG_IDE_PROC_FS=n.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
1497943ee692aa7519fa972d0e3a339649bf3a96 10-May-2007 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: split off ioctl handling from IDE settings (v2)

* do write permission and min/max checks in ide_procset_t functions

* ide-disk.c: drive->id is always available so cleanup "multcount" setting
accordingly

* ide-disk.c: "address" setting was incorrectly defined as type TYPE_INTA,
fix it by using type TYPE_BYTE and updating ide_drive_t->adressing field,
the bug didn't trigger because this IDE setting uses custom ->set function

* ide.c: add set_ksettings() for handling HDIO_SET_KEEPSETTINGS ioctl

* ide.c: add set_unmaskirq() for handling HDIO_SET_UNMASKINTR ioctl

* handle ioctls directly in generic_ide_ioclt() and idedisk_ioctl()
instead of using IDE settings to deal with them

* remove no longer needed ide_find_setting_by_ioctl() and {read,write}_ioctl
fields from ide_settings_t, also remove now unused TYPE_INTA handling

v2:
* add missing EXPORT_SYMBOL_GPL(ide_setting_sem) needed now for ide-disk

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
ecfd80e4a514123070b4cfb674b817ba75055df2 10-May-2007 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: make /proc/ide/ optional

All important information/features should be already available through
sysfs and ioctl interfaces.

Add CONFIG_IDE_PROC_FS (CONFIG_SCSI_PROC_FS rip-off) config option,
disabling it makes IDE driver ~5 kB smaller (on x86-32).

While at it add CONFIG_PROC_FS=n versions of proc_ide_{create,destroy}()
and remove no longer needed #ifdefs.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
846c11abc7934a523a665a3b702358e6f2998e3e 03-Mar-2007 Alan Cox <alan@redhat.com> ide: remove a ton of pointless #undef REALLY_SLOW_IO

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
c94964a4555eb58be3f45edf2b63a2b3f549ef29 17-Feb-2007 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ide: remove ide_drive_t.usage

This field is no longer used by the core IDE code so fix ide-{disk,floppy}
drivers to keep openers count in the driver specific objects and remove
it from ide-{cd,scsi,tape} drivers (it was write-only).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
4aff5e2333c9a1609662f2091f55c3f6fffdad36 10-Aug-2006 Jens Axboe <axboe@suse.de> [PATCH] Split struct request ->flags into two parts

Right now ->flags is a bit of a mess: some are request types, and
others are just modifiers. Clean this up by splitting it into
->cmd_type and ->cmd_flags. This allows introduction of generic
Linux block message types, useful for sending generic Linux commands
to block devices.

Signed-off-by: Jens Axboe <axboe@suse.de>
361934849e9c0418950bedf667732f36337d88b9 28-Jul-2006 Jens Axboe <axboe@suse.de> [PATCH] ide: option to disable cache flushes for buggy drives

Some drives claim they support cache flushing, but get seriously
confused if you try. Add this option to be able to boot with
barriers enabled by default.

Signed-off-by: Jens Axboe <axboe@suse.de>
6ab3d5624e172c553004ecc862bfeac16d9d68b7 30-Jun-2006 Jörn Engel <joern@wohnheim.fh-wedel.de> Remove obsolete #include <linux/config.h>

Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
94f6c59dcf16f10a20fbe3d1f098b159433f94bd 21-Jun-2005 Greg Kroah-Hartman <gregkh@suse.de> [PATCH] devfs: Remove devfs support from the ide subsystem.

Also removes the ide drive devfs_name field as it's no longer needed

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
d6e05edc59ecd79e8badf440c0d295a979bdfa3e 26-Jun-2006 Andreas Mohr <andi@lisas.de> spelling fixes

acquired (aquired)
contiguous (contigious)
successful (succesful, succesfull)
surprise (suprise)
whether (weather)
some other misspellings

Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2bfb646cdf348cb77c572f06d5b9d17ea205c7e2 31-Mar-2006 Richard Purdie <rpurdie@rpsys.net> [PATCH] LED: Add IDE disk activity LED trigger

Add an LED trigger for IDE disk activity to the ide-disk driver.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Acked-by: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
208a08f7cc2a8932ed76162d9844f9ae7d7fc015 24-Mar-2006 Kumar Gala <galak@kernel.crashing.org> [PATCH] ide: Allow IDE interface to specify its not capable of 32-bit operations

In some embedded systems the IDE hardware interface may only support 16-bit
or smaller accesses. Allow the interface to specify if this is the case
and don't allow the drive or user to override the setting.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
cf8b8975c3c35d1269bf6f1c6f2ae4efb6909607 23-Mar-2006 Arjan van de Ven <arjan@infradead.org> [PATCH] sem2mutex: drivers/ide

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
c2f8311d3168ed7d391ba5df5b80f4af0a3457d0 07-Feb-2006 Michael Richardson <mcr@sandelman.ottawa.on.ca> [PATCH] ide: cast arguments to pr_debug() properly

This does not show up unless you #define DEBUG in the file, which most
people wouldn't do. On PPC405, at least, "sector_t" is unsigned long,
which doesn't match %llx/%llu. Since sector# may well be >32 bits, promote
the value to match the format.

Signed-off-by: Michael Richardson <mcr@xelerance.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
f7ad836c4442e1d146b11cf359432aa68c7ed95d 03-Feb-2006 Jean Delvare <khali@linux-fr.org> [PATCH] ide-disk: Restore missing space in log message

Restore a missing space in a log message, which was accidentally
removed by a previous change: 3e087b575496b8aa445192f58e7d996b1cdfa121

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Jens Axboe <axboe@suse.de>
Acked-by: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
9810933701a09f9c4dd0ad963d5ec2efb7df07b7 03-Feb-2006 Richard Purdie <rpurdie@rpsys.net> [PATCH] stop CompactFlash devices being marked as removable

This patch stops CompactFlash devices being marked as removable. They are
not removable (as defined by Linux) as the media and device are
inseparable. When a card is removed, the whole device is removed from the
system and never sits in a media-less state.

This stops some nasty udev device creation/destruction loops.

Further, once this change is made, there is no need for ide to can be
removed from ide_drive_t.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Acked-by: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
858119e159384308a5dde67776691a2ebf70df0f 14-Jan-2006 Arjan van de Ven <arjan@infradead.org> [PATCH] Unlinline a bunch of other functions

Remove the "inline" keyword from a bunch of big functions in the kernel with
the goal of shrinking it by 30kb to 40kb

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
4031bbe4bbec6c0fe50412ef7fb43a270b0f29f1 06-Jan-2006 Russell King <rmk@arm.linux.org.uk> [PATCH] Add ide_bus_type probe and remove methods

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
a885c8c4316e1c1d2d2c8755da3f3d14f852528d 08-Jan-2006 Christoph Hellwig <hch@lst.de> [PATCH] Add block_device_operations.getgeo block device method

HDIO_GETGEO is implemented in most block drivers, and all of them have to
duplicate the code to copy the structure to userspace, as well as getting
the start sector. This patch moves that to common code [1] and adds a
->getgeo method to fill out the raw kernel hd_geometry structure. For many
drivers this means ->ioctl can go away now.

[1] the s390 block drivers are odd in this respect. xpram sets ->start
to 4 always which seems more than odd, and the dasd driver shifts
the start offset around, probably because of it's non-standard
sector size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@suse.de>
Cc: <mike.miller@hp.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo Giarrusso <blaisorblade@yahoo.it>
Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
3e087b575496b8aa445192f58e7d996b1cdfa121 06-Jan-2006 Tejun Heo <htejun@gmail.com> [BLOCK] update IDE to use new blk_ordered for barriers

Update IDE to use new blk_ordered. This change makes the
following behavior changes.

* Partial completion of the barrier request is handled as
failure of the whole ordered sequence. No more partial
completion for barrier requests.

* Any failure of pre or post flush request results in failure
of the whole ordered sequence.

So, successfully completed ordered sequence guarantees that
all requests prior to the barrier made to physical medium and,
then, the while barrier request made to the physical medium.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jens Axboe <axboe@suse.de>
263756ec228f1cdd49fc50b1f87001a4cebdfe12 12-Dec-2005 Kay Sievers <kay.sievers@vrfy.org> [PATCH] ide: MODALIAS support for autoloading of ide-cd, ide-disk, ...

IDE: MODALIAS support for autoloading of ide-cd, ide-disk, ...

Add MODULE_ALIAS to IDE midlayer modules: ide-disk, ide-cd, ide-floppy and
ide-tape, to autoload these modules depending on the probed media type of
the IDE device.

It is used by udev and replaces the former agent shell script of the hotplug
package, which was required to lookup the media type in the proc filesystem.
Using proc was racy, cause the media file is created after the hotplug event
is sent out.

The module autoloading does not take any effect, until something like the
following udev rule is configured:
SUBSYSTEM=="ide", ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}"

The module ide-scsi will not be autoloaded, cause it requires manual
configuration. It can't be, and never was supported for automatic setup in
the hotplug package. Adding a MODULE_ALIAS to ide-scsi for all supported
media types, would just lead to a default blacklist entry anyway.

$ modinfo ide-disk
filename: /lib/modules/2.6.15-rc4-g1b0997f5/kernel/drivers/ide/ide-disk.ko
description: ATA DISK Driver
alias: ide:*m-disk*
license: GPL
...

$ modprobe -vn ide:m-disk
insmod /lib/modules/2.6.15-rc4-g1b0997f5/kernel/drivers/ide/ide-disk.ko

$ cat /sys/bus/ide/devices/0.0/modalias
ide:m-disk

It also adds attributes to the IDE device:
$ tree /sys/bus/ide/devices/0.0/
/sys/bus/ide/devices/0.0/
|-- bus -> ../../../../../../../bus/ide
|-- drivename
|-- media
|-- modalias
|-- power
| |-- state
| `-- wakeup
`-- uevent

$ cat /sys/bus/ide/devices/0.0/{modalias,drivename,media}
ide:m-disk
hda
disk

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
d36fef6f5aa4a6a1f44490455393a5b22137a6cd 15-Dec-2005 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> [PATCH] ide-disk: flush cache after calling del_gendisk()

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17514e8a6f1836a5c95b1f18d2bc0493ad732cf0 19-Nov-2005 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> [PATCH] ide: add missing __init tags to device drivers

Also remove bogus comments for idefloppy_init() and idetape_init().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
4ef3b8f4a5c056d5f784725974a530d1a7b4a811 18-Nov-2005 Laurent Riffard <laurent.riffard@free.fr> [PATCH] ide: remove ide_driver_t.owner field

The structure ide_driver_t have a .owner field which is a duplicate
of .gendriver.owner field (.gen_driver is a struct device_driver).

This patch removes ide_driver_t's owner field.

Signed-off-by: Laurent Riffard <laurent.riffard@free.fr>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
f5e3c2faa20615e900ab26bd957f898400435924 07-Nov-2005 Deepak Saxena <dsaxena@plexity.net> [PATCH] ide: kmalloc + memset -> kzalloc conversion

Signed-off-by: Deepak Saxena <dsaxena@plexity.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
86b3786078d63242d3194ffc58ae8dae1d1bbef3 10-Aug-2005 Christoph Lameter <christoph@lameter.com> [PATCH] Fix ide-disk.c oops caused by hwif == NULL

1. Move hwif_to_node to ide.h

2. Use hwif_to_node in ide-disk.c

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
6efd936046b123303ace4330fd2f26195ad7b1c4 28-Jun-2005 Alan Cox <alan@lxorguk.ukuu.org.uk> [PATCH] ide: fix ide-disk inability to handle LBA only devices.

Years old bug, has to be fixed for it8212 to work

Signed-off-by: Alan Cox <alan@redhat.com>
Acked-by: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1946089a109251655c5438d92c539bd2930e71ea 23-Jun-2005 Christoph Lameter <christoph@lameter.com> [PATCH] NUMA aware block device control structure allocation

Patch to allocate the control structures for for ide devices on the node of
the device itself (for NUMA systems). The patch depends on the Slab API
change patch by Manfred and me (in mm) and the pcidev_to_node patch that I
posted today.

Does some realignment too.

Signed-off-by: Justin M. Forbes <jmforbes@linuxtx.org>
Signed-off-by: Christoph Lameter <christoph@lameter.com>
Signed-off-by: Pravin Shelar <pravin@calsoftinc.com>
Signed-off-by: Shobhit Dayal <shobhit@calsoftinc.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
994ca9a19616f0d4161a9e825f0835925d522426 20-Jun-2005 James Bottomley <James.Bottomley@SteelEye.com> [PATCH] update blk_execute_rq to take an at_head parameter

Original From: Mike Christie <michaelc@cs.wisc.edu>

Modified to split out block changes (this patch) and SCSI pieces.

Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
8604affde9d4f52f04342d6a37c77d95fa167e7a 26-May-2005 Bartlomiej Zolnierkiewicz <bzolnier@elka.pw.edu.pl> [PATCH] convert IDE device drivers to driver-model

* add ide_bus_match() and export ide_bus_type
* split ide_remove_driver_from_hwgroup() out of ide_unregister()
* move device cleanup from ide_unregister() to drive_release_dev()
* convert ide_driver_t->name to driver->name
* convert ide_driver_t->{attach,cleanup} to driver->{probe,remove}
* remove ide_driver_t->busy as ide_bus_type->subsys.rwsem
protects against concurrent ->{probe,remove} calls
* make ide_{un}register_driver() void as it cannot fail now
* use driver_{un}register() directly, remove ide_{un}register_driver()
* use device_register() instead of ata_attach(), remove ata_attach()
* add proc_print_driver() and ide_drivers_show(), remove ide_drivers_op
* fix ide_replace_subdriver() and move it to ide-proc.c
* remove ide_driver_t->drives, ide_drives and drives_lock
* remove ide_driver_t->drivers, drivers and drivers_lock
* remove ide_drive_t->driver and DRIVER() macro

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@elka.pw.edu.pl>
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!