Commit Graph

258 Commits (ab6fc95f609b372a19e18ea689986846ab1ba29c)

Author SHA1 Message Date
Tejun Heo 12850ffe71 libata: add MAXTOR 7V300F0/VA111900 to NCQ blacklist
MAXTOR 7V300F0/VA111900 does spurious NCQ completions.  Add it to
blacklist.  This problem is reported by Carsten Otto.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Carsten Otto <c-otto@gmx.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-29 06:21:33 -04:00
Tejun Heo cdeab11407 libata: relocate forcing PIO0 on reset
Forcing PIO0 on reset was done inside ata_bus_softreset(), which is a
bit out of place as it should be applied to all resets - hard, soft
and implementation which don't use ata_bus_softreset().  Relocate it
such that...

* For new EH, it's done in ata_eh_reset() before calling prereset.

* For old EH, it's done before calling ap->ops->phy_reset() in
  ata_bus_probe().

This makes PIO0 forced after all resets.  Another difference is that
reset itself is done after PIO0 is forced.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-29 06:21:33 -04:00
Tejun Heo 88ff6eafbb libata: implement ata_wait_after_reset()
On certain device/controller combination, 0xff status is asserted
after reset and doesn't get cleared during 150ms post-reset wait.  As
0xff status is interpreted as no device (for good reasons), this can
lead to misdetection on such cases.

This patch implements ata_wait_after_reset() which replaces the 150ms
sleep and waits upto ATA_TMOUT_FF_WAIT if status is 0xff.
ATA_TMOUT_FF_WAIT is currently 800ms which is enough for
HHD424020F7SV00 to get detected but not enough for Quantum GoVault
drive which is known to take upto 2s.

Without parallel probing, spending 2s on 0xff port would incur too
much delay on ata_piix's which use 0xff to indicate empty port and
doesn't have SCR register, so GoVault needs to wait till parallel
probing.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-29 06:15:27 -04:00
Tejun Heo 054a5fbace libata: track SLEEP state and issue SRST to wake it up
ATA devices in SLEEP mode don't respond to any commands.  SRST is
necessary to wake it up.  Till now, when a command is issued to a
device in SLEEP mode, the command times out, which makes EH reset the
device and retry the command after that, causing a long delay.

This patch makes libata track SLEEP state and issue SRST automatically
if a command is about to be issued to a device in SLEEP.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Bruce Allen <ballen@gravity.phys.uwm.edu>
Cc: Andrew Paprocki <andrew@ishiboo.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-29 06:15:25 -04:00
Tejun Heo 4dbfa39b6c libata: relocate and fix post-command processing
Some commands need post-processing after successful completion.  This
was done in ata_scsi_qc_complete() till now but this has the following
problems.

* Post-command processing gets executed when qc is completed from EH.
  Some qc's are retried from EH with zero err_mask and thus triggers
  unnecessary/incorrect post-command processing.

* Command post processing doesn't belong to SAT layer.

* Link-wide revalidation was scheduled where device revalidation
  suffices.

This patch moves post-command processing to success completion path of
ata_qc_complete() which is travelled iff the command is going to be
completed without passing through EH and updates post-command
processing such that device-specific action is used.  While at it,
restructure code a bit for readability.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-29 06:15:25 -04:00
Linus Torvalds 7f14957453 Merge branch 'sg' of git://git.kernel.dk/linux-2.6-block
* 'sg' of git://git.kernel.dk/linux-2.6-block:
  fix sg_phys to use dma_addr_t
  ub: add sg_init_table for sense and read capacity commands
  x86: pci-gart fix
  blackfin: fix sg fallout
  xtensa: dma-mapping.h is using linux/scatterlist.h functions, so include it
  SG: audit of drivers that use blk_rq_map_sg()
  arch/um/drivers/ubd_kern.c: fix a building error
  SG: Change sg_set_page() to take length and offset argument
  AVR32: Fix sg_page breakage
  mmc: sg fallout
  m68k: sg fallout
  More SG build fixes
  sg: add missing sg_init_table calls to zfcp
  SG build fix
2007-10-25 15:44:54 -07:00
Alan Cox 3acaf94bb0 libata-core: Be a bit more relaxed about early DMA zero devices
I guess Windows didn't care about the command so neither did they

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-25 02:10:52 -04:00
Adrian Bunk 741b776335 libata-core.c: make 2 functions static
strn_pattern_cmp() and ata_port_detach() can become static.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-25 01:59:30 -04:00
Jeff Garzik 218f3d30e6 [libata] Create internal helper ata_dev_set_feature()
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2007-10-25 00:33:27 -04:00
Jens Axboe 642f149031 SG: Change sg_set_page() to take length and offset argument
Most drivers need to set length and offset as well, so may as well fold
those three lines into one.

Add sg_assign_page() for those two locations that only needed to set
the page, where the offset/length is set outside of the function context.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-24 11:20:47 +02:00
Tejun Heo 0c173174d0 libata: add HTS542525K9SA00 to NCQ blacklist
Another one doing spurious NCQ completions.  Blacklist it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Luca Tettamanti <kronos.it@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-23 21:20:02 -04:00
Alan Cox 150981b030 libata-core: auditting chk_status v check_status
Did a complete audit of these and found we have another error case.

ata_bus_softreset calls ata_check_status which means that it tries to do
an ioread8 on the port blindly and check versus 0xFF for an error.

It should of course be using the ap->ops method for this via chk_status,
and this bug causes a wrog status call on the NS87415 at least.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-23 21:20:02 -04:00
Jeff Garzik 2dcb407e61 [libata] checkpatch-inspired cleanups
Tackle the relatively sane complaints of checkpatch --file.

The vast majority is indentation and whitespace changes, the rest are

* #include fixes
* printk KERN_xxx prefix addition
* BSS/initializer cleanups

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2007-10-23 20:59:42 -04:00
Jens Axboe 45711f1af6 [SG] Update drivers to use sg helpers
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-22 21:19:53 +02:00
Randy Dunlap 5c1ad8b305 libata: fix kernel-doc param name
Fix libata kernel-doc parameter name.

Warning(linux-2.6.23-git13//drivers/ata/libata-core.c:1415): No description found for parameter 'sgl'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-19 22:55:02 -04:00
FUJITA Tomonori 0874ee76bc libata sg chaining support fix
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-16 11:21:01 +02:00
Jens Axboe 8726021626 libata: convert to using sg helpers
This converts libata to using the sg helpers for looking up sg
elements, instead of doing it manually.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-16 11:14:12 +02:00
Andrew Paprocki 317b50b8ad libata: prevent devices with blank model names from being DMA blacklisted
The strn_pattern_cmp routine does not handle a blank name parameter
properly. The only patterns which should match a blank name are "*"
and an explicit "". If the function is passed a blank name in current
code, it will always match against the patt parameter. The bug manifests
itself as the device with the empty model name always matching the first
device in the DMA blacklist, forcing it to revert to PIO mode.

Signed-off-by: Andrew Paprocki <andrew@ishiboo.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2007-10-15 15:44:22 -04:00
Tejun Heo 1358796008 libata: add ST9160821AS / 3.CCD to NCQ blacklist
ST9160821AS / 3.CCD does spurious completions too.  Blacklist it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-15 15:24:54 -04:00
Jeff Garzik 2855568b1e [libata] struct pci_dev related cleanups
* remove pointless pci_dev_to_dev() wrapper.  Just directly reference
  the embedded struct device like everyone else does.

* pata_cs5520: delete cs5520_remove_one(), it was a duplicate of
  ata_pci_remove_one()

* linux/libata.h: don't bother including linux/pci.h, we don't need it.
  Simply declare 'struct pci_dev' and assume interested parties will
  include the header, as they should be doing anyway.

* linux/libata.h: consolidate all CONFIG_PCI declarations into a
  single location in the header.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2007-10-12 14:55:47 -04:00
Tejun Heo b06ce3e51e libata: use ata_exec_internal() for PMP register access
PMP registers used to be accessed with dedicated accessors ->pmp_read
and ->pmp_write.  During reset, those callbacks are called with the
port frozen so they should be able to run without depending on
interrupt delivery.  To achieve this, they were implemented polling.

However, as resetting the host port makes the PMP to isolate fan-out
ports until SError.X is cleared, resetting fan-out ports while port is
frozen doesn't buy much additional safety.

This patch updates libata PMP support such that PMP registers are
accessed using regular ata_exec_internal() mechanism and kills
->pmp_read/write() callbacks.  The following changes are made.

* PMP access helpers - sata_pmp_read_init_tf(), sata_pmp_read_val(),
  sata_pmp_write_init_tf() are folded into sata_pmp_read/write() which
  are now standalone PMP register access functions.

* sata_pmp_read/write() returns err_mask instead of rc.  This is
  consistent with other functions which issue internal commands and
  allows more detailed error reporting.

* ahci interrupt handler is modified to ignore BAD_PMP and
  spurious/illegal completion IRQs while reset is in progress.  These
  conditions are expected during reset.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:47 -04:00
Tejun Heo 2b789108fc libata: add @timeout to ata_exec_internal[_sg]()
Add @timeout argument to ata_exec_internal[_sg]().  If 0, default
timeout ata_probe_timeout is used.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:47 -04:00
Tejun Heo abf6e8ed07 libata: clear ehi description after initial host report
ehi description field is used to carry LLD specific controller
description.  Sometimes, it's used without clearing before and LLD
description gets printed with exception information one more time.
Clear after printing.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:46 -04:00
Tejun Heo 954bb005c9 libata: add ST9160821AS / 3.ALD to NCQ blacklist
ST9160821AS / 3.ALD also does spurious NCQ completions.  Disable NCQ.

Signed-off-by: Tejun Heo <teheo@suse.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:46 -04:00
Tejun Heo 70edb185db libata: add HDT722516DLA380 to NCQ blacklist
HDT722516DLA380 does spurious completion of NCQ commands.  Blacklist
it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Frans Pop <elendil@planet.nl>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:46 -04:00
Paolo Ornati da6f0ec2d5 libata: blacklist NCQ on Seagate Barracuda ST380817AS
Seagate Barracuda ST380817AS has troubles with NCQ. For example,
unpacking a tarball on an XFS filesystem gives this:

ata1.00: exception Emask 0x0 SAct 0x1 SErr 0x0 action 0x2 frozen
ata1.00: cmd 61/40:00:29:a3:98/00:00:00:00:00/40 tag 0 cdb 0x0 data 32768 out
         res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)

More info here:
http://lkml.org/lkml/2007/1/21/76

Blacklist it!

Signed-off-by: Paolo Ornati <ornati@fastwebnet.it>
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:45 -04:00
Jeff Garzik 6ebe9d8667 [libata] Turn on ACPI by default
Let's see what explodes.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2007-10-12 14:55:45 -04:00
Alan Cox 681c80b5d9 libata: correct handling of SRST reset sequences
Correct handling of SRST reset sequences.  After an SRST it is undefined
whether the drive has gone back to PIO0.  In order to talk safely we should
talk slowly and carefully until we know.

Thus when we do the reset if the controller has a pio setup method we call it
to flip back to PIO 0 and a known state.  After the reset completes the
identify will then be done at the safe speed and the drive/controller will
pick suitable faster modes and reconfigure the controller to these timings.

As a side effect it means we force the controller to PIO 0 as we bring it up
which fixes funnies on a few systems where the BIOS firmware leaves us in an
interesting choice of modes, or embedded boxes with no firmware which come up
in random states.

For smart controllers there is nothing to do - they know about this
internally.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:45 -04:00
Alan Cox b3a706014e libata: Add a drivers/ide style DMA disable
This is useful when debugging, handling problem systems, or for
distributions just to get the system installed so it can be sorted
out later.

This is a bit smarter than the old IDE one and lets you do

libata.dma=0	Disable all PATA DMA like old IDE
libata.dma=1	Disk DMA only
libata.dma=2	ATAPI DMA only
libata.dma=4	CF DMA only

(or combinations thereof - 0,1,3 being the useful ones I suspect)

(I've split CF as it seems to be a seperate case of pain and suffering
different to the others and caused by assorted PIO wired adapters etc)

Signed-off-by: Alan Cox <alan@redhat.com>

[edited to work on SATA too, changing name from 'pata_dma' to 'dma']
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2007-10-12 14:55:45 -04:00
Tejun Heo 31f8838444 libata-pmp: implement qc_defer for command switching PMP support
Implement sata_pmp_qc_defer_cmd_switch() - standard qc_defer for
command switching PMP support.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:44 -04:00
Tejun Heo 633273a3ed libata-pmp: hook PMP support and enable it
Hook PMP support into libata and enable it.  Connect SCR and probing
functions, and update ata_dev_classify() to detect PMP.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:44 -04:00
Tejun Heo 3af9a77af9 libata-pmp: implement Port Multiplier support
Implement Port Multiplier support.  To support PMP, a LLDD has to
supply ops->pmp_read() and pmp_write().  If non-null, ->pmp_attach and
->pmp_detach are called on PMP attach and detach, respectively.

->pmp_read/write() can be called while the port is frozen, so they
must be implemented by polling.  This patch supplies several helpers
to ease ->pmp_read/write() implementation.

Also, irq_handler and error_handler must be PMP aware.  Most of PMP
aware EH can be done by calling ata_pmp_do_eh() with appropriate
methods.  PMP EH uses separate set of reset methods and this patch
implements standard prereset, hardreset and postreset methods.

This patch only implements PMP support.  The next patch will integrate
PMP into the reset of libata and thus enable PMP support.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:44 -04:00
Alan Cox 93328e1145 [PATCH] libata: Fix HPA handling regression
Restore the support for handling drives that report one sector too many
(ie SCSI not ATA style). This worked before the HPA update but was
removed in that process.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:43 -04:00
David Milburn 0b0a43e04e libata-core: blacklist HITACHI HDS drives using wildcard blacklist matching
Blacklist HITACHI HDS7250SASUN500G and HITACHI HDS7225SBSUN250G
drives using wildcard matching.

Signed-off-by David Milburn <dmilburn@redhat.com>

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:43 -04:00
Tejun Heo 7f567620ed libata: update spurious NCQ completion blacklist
* The firmware version of ST3160812AS is "3.ADJ" no "3.AD".
* Add several entries from various sources.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:43 -04:00
Tejun Heo 1e582ba4ef libata: fix ata_set_max_sectors()
In ata_set_max_sectors(), the highest nibble in LBA28 mode was
missing.  This made drives sized between 8G and 128G with HPA turned
on to be resized to under 8G.  Fix it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:42 -04:00
Tejun Heo 7d77b24708 libata-pmp-prep: implement sata_async_notification()
AN serves multiple purposes.  For ATAPI, it's used for media change
notification.  For PMP, for downstream PHY status change notification.
Implement sata_async_notification() which demultiplexes AN.

To avoid unnecessary port events, ATAPI AN is not enabled if PMP is
attached but SNTF is not available.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Kriten Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:42 -04:00
Tejun Heo da917d69d0 libata-pmp-prep: implement qc_defer helpers
Implement ap->nr_active_links (the number of links with active qcs),
ap->excl_link (pointer to link which can be used by ->qc_defer and is
cleared when a qc with ATA_QCFLAG_CLEAR_EXCL completes), and
ata_link_active().

These can be used by ->qc_defer() to implement proper command
exclusion.  This set of helpers seem enough for both sil24 (ATAPI
exclusion needed) and cmd-switching PMP.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:41 -04:00
Tejun Heo 31cc23b349 libata-pmp-prep: implement ops->qc_defer()
Controllers which support PMP have various restrictions on which
combinations of commands are allowed to what number of devices
concurrently.  This patch implements ops->qc_defer() which determines
whether a qc can be issued at the moment or should be deferred.

If the function returns ATA_DEFER_LINK, the qc will be deferred until
a qc completes on the link.  If ATA_DEFER_PORT, until a qc completes
on any link.  The defer conditions are advisory and in general
ATA_DEFER_LINK can be considered as lower priority deferring than
ATA_DEFER_PORT.

ops->qc_defer() replaces fixed ata_scmd_need_defer().  For standard
NCQ/non-NCQ exclusion, ata_std_qc_defer() is implemented.  ahci and
sata_sil24 are converted to use ata_std_qc_defer().

ops->qc_defer() is heavier than the original mechanism because full qc
is prepped before determining to defer it, but various information is
needed to determine defer conditinos and fully translating a qc is the
only way to supply such information in generic manner.

IMHO, this shouldn't cause any noticeable performance issues as

* for most cases deferring occurs rarely (except for NCQ-aware
  cmd-switching PMP)
* translation itself isn't that expensive
* once deferred the command won't be repeated until another command
  completes which usually is a very long time cpu-wise.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:41 -04:00
Tejun Heo fb7fd61454 libata-pmp-prep: make a number of functions global to libata
Make a number of functions from libata-core.c and libata-eh.c global
to libata (drivers/ata/libata.h).  These will be used by PMP.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:41 -04:00
Tejun Heo 422c9daa8b libata-pmp-prep: add @new_class to ata_dev_revalidate()
Consider newly found class code while revalidating.  PMP resetting
always results in valid class code and issuing PMP commands to
ATA/ATAPI device isn't very attractive.  Add @new_class to
ata_dev_revalidate() and check class code for revalidation.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:40 -04:00
Tejun Heo 854c73a2f1 libata: misc updates for AN
Update AN support in preparation of PMP support.

* s/ata_id_has_AN/ata_id_has_atapi_AN/
* add AN enabled reporting during configuration
* add err_mask to AN configuration failure reporting
* update LOCKING comment for ata_scsi_media_change_notify()
* check whether ATA dev is attached to SCSI dev ata_scsi_media_change_notify()
* set ATA_FLAG_AN in ahci and sata_sil24

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Kriten Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:40 -04:00
Jeff Garzik c78968bb0f [libata] SCSI: simulator version, not device version, belongs in VPD
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:40 -04:00
Tejun Heo d7fbee0507 libata: assume ATA_DEV_ATA on diagnostic failure
Certain device which reports diagnostic failure also reports invalid
device signature.  Assume ATA_DEV_ATA on diagnostic failure if reset
indicates device presence.

This is fix for bugzilla bug 8784.

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

Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Edward Amsden <amsden_linux@earthlink.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:39 -04:00
Tejun Heo 3f19859ee9 libata: update ata_dev_try_classify() arguments
Make ata_dev_try_classify() take a pointer to ata_device instead of
ata_port/port_number combination for consistency and add @present
argument.  @present indicates whether the device seems present during
reset.  It's the result of TF access during softreset and link
onlineness during hardreset.  @present will be used to improve
diagnostic failure handling.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:39 -04:00
Tejun Heo 05027adccc libata: remiplement ata_hpa_resize()
This patch reimplement ata_hpa_resize() such that...

* All HPA related decisions are made inside ata_hpa_resize() proper.
  ata_hpa_resize() returns 0 if configuration can proceed, -errno if
  device needs to be reset and reconfigured.

* All errors are handled properly.  If HPA unlocking isn't requested,
  HPA handling is disabled automatically to avoid unnecessary device
  detection failure.

* Messages are trimmed.  HPA detection message is printed only during
  initial configuration.  HPA unlocked message is printed only during
  initial configuration or unlocking results in different size.

* Instead of using sectors returned in TF of SET_MAX, re-read IDENTIFY
  data as that's the value the device is going to use.

* It's called early during ata_dev_configure() as IDENTIFY data might
  change after resizing.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:39 -04:00
Tejun Heo c728a9149f libata: clean up read/set native_max address functions
Merge ata_read_native_max_addres_ext() into ata_read_native_max_address()
and combine ata_set_native_max_address_ext() and
ata_set_native_max_address() into ata_set_max_sectors().

* reduce duplicate code
* return 0 or -errno depending on error conditions
* report if command fails
* use ATA_LBA instead of 0x40

This is in preparation of ata_hpa_resize() update.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:39 -04:00
Tejun Heo db6f8759d0 libata: move ata_id_n_sectors() upward
Move ata_id_n_sectors() upward right below ata_id_c_string().  This is
to accomodate later changes.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:39 -04:00
Jeff Garzik 539cc7c70c [libata] blacklist Maxtor*BANC* using new wildcard blacklist matching
Support the use of '*' in model_num and model_rev entries
in ata_device_blacklist[].

Based largely on David Milburn's "libata-core: support wildcard matching
in ata_blacklist_entry" patch.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:38 -04:00
Tejun Heo cbcdd87593 libata: implement and use ata_port_desc() to report port configuration
Currently, port configuration reporting has the following problems.

* iomapped address is reported instead of raw address
* report contains irrelevant fields or lacks necessary fields for
  non-SFF controllers.
* host->irq/irq2 are there just for reporting and hacky.

This patch implements and uses ata_port_desc() and
ata_port_pbar_desc().  ata_port_desc() is almost identical to
ata_ehi_push_desc() except that it takes @ap instead of @ehi, has no
locking requirement, can only be used during host initialization and "
" is used as separator instead of ", ".  ata_port_pbar_desc() is a
helper to ease reporting of a PCI BAR or an offsetted address into it.

LLD pushes whatever description it wants using the above two
functions.  The accumulated description is printed on host
registration after "[S/P]ATA max MAX_XFERMODE ".

SFF init helpers and ata_host_activate() automatically add
descriptions for addresses and irq respectively, so only LLDs which
isn't standard SFF need to add custom descriptions.  In many cases,
such controllers need to report different things anyway.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12 14:55:37 -04:00