firefly-linux-kernel-4.4.55.git
17 years agolibata: add ST9160821AS / 3.ALD to NCQ blacklist
Tejun Heo [Thu, 4 Oct 2007 23:54:39 +0000 (08:54 +0900)]
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>
17 years agopata_acpi: ACPI driver support
Alan Cox [Thu, 4 Oct 2007 20:32:58 +0000 (21:32 +0100)]
pata_acpi: ACPI driver support

On a cable there may be
eighty wires or perhaps forty
and we learn about its type
In the world of ACPI

So we call the GTM
And we find the the timing rate
And we look through it to see
If eighty wire it must be

Timing lives in ACPI routines
ACPI routines, ACPI routines
Timing lives in ACPI routines
ACPI routes ACPI routines

And the drivers last you see
Picking up unknown pci ids
and the code begins to work

Timing lives in ACPI routines
ACPI routines, ACPI routines
Timing lives in ACPI routines
ACPI routes ACPI routines

[Full speed ahead, Mr Hacker, full speed ahead]
 Full speed over here sir!
 Checking Cable, checking cable
 Aye aye, 80 wire,
 Heaven heaven]

If we use ACPI (ACPI)
Every box (every box) has all we need (has all we need)
Cable type (cable type) and mode timing (mode timing)
In our ATA (in our ATA) subroutines (subroutines, ha ha)

Timing lives in ACPI routines
ACPI routines, ACPI routines
Timing lives in ACPI routines
ACPI routes ACPI routines
Timing lives in ACPI routines
ACPI routines, ACPI routines
Timing lives in ACPI routines
ACPI routes ACPI routines

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-core: Expose gtm methods for driver use
Alan Cox [Thu, 4 Oct 2007 20:28:18 +0000 (21:28 +0100)]
libata-core: Expose gtm methods for driver use

Talk to the dark side our driver has to, yes. Much misleading is the
data. Store it in a structure we do so that it may be parsed.

Signed-off-by: Alan Cox <alan@redhat.com>
--
Whats small, old and shouts phrases out of order across mountains ?
Yodla..
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: add HDT722516DLA380 to NCQ blacklist
Tejun Heo [Thu, 4 Oct 2007 08:27:59 +0000 (17:27 +0900)]
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>
17 years agolibata: blacklist NCQ on Seagate Barracuda ST380817AS
Paolo Ornati [Thu, 4 Oct 2007 02:06:56 +0000 (11:06 +0900)]
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>
17 years ago[libata] Turn on ACPI by default
Jeff Garzik [Fri, 5 Oct 2007 20:28:36 +0000 (16:28 -0400)]
[libata] Turn on ACPI by default

Let's see what explodes.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
17 years agolibata_scsi: Fix ATAPI transfer lengths
Alan Cox [Tue, 2 Oct 2007 20:53:04 +0000 (13:53 -0700)]
libata_scsi: Fix ATAPI transfer lengths

Some controller variants snoop the ATAPI length value for Packet
transfers to do state machine and FIFO management. Thus we want to
set it properly, even for cases where it is otherwise meaningless.

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>
17 years agolibata: correct handling of SRST reset sequences
Alan Cox [Wed, 3 Oct 2007 12:23:18 +0000 (13:23 +0100)]
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>
17 years agolibata: Integrate ACPI-based PATA/SATA hotplug - version 5
Matthew Garrett [Wed, 3 Oct 2007 00:24:16 +0000 (01:24 +0100)]
libata: Integrate ACPI-based PATA/SATA hotplug - version 5

Modern laptops with hotswap bays still tend to utilise a PATA interface
on a SATA bridge, generally with the host controller in some legacy
emulation mode rather than AHCI. This means that the existing hotplug
code in libata is unable to work. The ACPI specification states that
these devices can send notifications when hotswapped, which avoids the
need to obtain notification from the controller. This patch uses the
existing libata-acpi code and simply registers a notification in order
to trigger a rescan whenever the firmware signals an event.

Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: Add a drivers/ide style DMA disable
Alan Cox [Tue, 2 Oct 2007 16:38:26 +0000 (12:38 -0400)]
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>
17 years agoahci: Add MCP79 support to AHCI driver
Peer Chen [Mon, 24 Sep 2007 02:16:25 +0000 (10:16 +0800)]
ahci: Add MCP79 support to AHCI driver

Signed-off-by: Peer Chen <peerchen@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: add human-readable error value decoding
Robert Hancock [Tue, 2 Oct 2007 15:22:02 +0000 (11:22 -0400)]
libata: add human-readable error value decoding

This adds human-readable decoding of the ATA status and error registers
(similar to what drivers/ide does) as well as the SATA Serror register
to libata error handling output.  This prevents the need to pore
through standards documents to figure out the meaning of the bits
in these registers when looking at error reports.  Some bits that
drivers/ide decoded are not decoded here, since the bits are either
command-dependent or obsolete, and properly parsing them would add
too much complexity.

Signed-off-by: Robert Hancock <hancockr@shaw.ca>
[edited slightly to make output a bit more symmetric]
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agoahci: implement AHCI_HFLAG_NO_PMP
Tejun Heo [Sun, 23 Sep 2007 04:19:55 +0000 (13:19 +0900)]
ahci: implement AHCI_HFLAG_NO_PMP

Of course some controllers lie about PMP support.  Black list them.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agoahci: move host flags over to pi.private_data
Tejun Heo [Sun, 23 Sep 2007 04:19:55 +0000 (13:19 +0900)]
ahci: move host flags over to pi.private_data

Private pi.flags area is full and we need more private flags.  Move
host private flags over to pi.private_data.  During initialization,
these flags are copied to hpriv->flags.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agoahci: implement PMP support
Tejun Heo [Sun, 23 Sep 2007 04:19:54 +0000 (13:19 +0900)]
ahci: implement PMP support

Implement AHCI PMP support.  ahci only supports command based
switching.  Also, for some reason, NCQ over PMP doesn't work now.
Other than that, everything works.

Tested on ICH9R, JMB360/363 + SIMG3726, 4726 and 5744.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Forrest Zhao <forrest.zhao@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agosata_sil24: implement PORT_RST
Tejun Heo [Sun, 23 Sep 2007 04:19:54 +0000 (13:19 +0900)]
sata_sil24: implement PORT_RST

As DEV_RST (hardreset) sometimes fail to recover the controller
(especially after PMP DMA CS errata).  In such cases, perform PORT_RST
prior to DEV_RST.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agosata_sil24: implement PMP support
Tejun Heo [Sun, 23 Sep 2007 04:19:54 +0000 (13:19 +0900)]
sata_sil24: implement PMP support

Implement PMP support.  sil24 supports full FIS-switching.  However,
it has a PMP DMA CS errata which requires port-wide resetting if
commands are outstanding to three or more devices when an error occurs
on one of them.

ATAPI commands often result in CHECK SENSE and it's crucial to not
reset them before fetching sense data.  Unfortunately, ATAPI CHECK
SENSE causes a lot of problem if command is outstanding to any other
device usually resulting in port-wide reset.  So, sata_sil24
implements sil24_qc_defer() which guarantees ATAPI command is run by
itself.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-pmp: implement qc_defer for command switching PMP support
Tejun Heo [Sun, 23 Sep 2007 04:19:54 +0000 (13:19 +0900)]
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>
17 years agolibata-pmp: extend ACPI support to cover PMP
Tejun Heo [Sun, 23 Sep 2007 04:19:54 +0000 (13:19 +0900)]
libata-pmp: extend ACPI support to cover PMP

Extend ata_acpi_associate_sata_port() such that it can handle PMP and
call it when PMP is attached and detached.

Build breakage when !CONFIG_ATA_ACPI was spotted and fixed by Petr
Vandrovec.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Petr Vandrovec <petr@vandrovec.name>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-pmp: hook PMP support and enable it
Tejun Heo [Sun, 23 Sep 2007 04:19:54 +0000 (13:19 +0900)]
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>
17 years agolibata-pmp: implement Port Multiplier support
Tejun Heo [Sun, 23 Sep 2007 04:19:54 +0000 (13:19 +0900)]
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>
17 years agolibata-pmp: update ata_eh_reset() for PMP
Tejun Heo [Sun, 23 Sep 2007 04:19:53 +0000 (13:19 +0900)]
libata-pmp: update ata_eh_reset() for PMP

PMP always requires SRST to be enabled.  Also, hardreset reports
classification code from the first device when PMP is attached, not
from the PMP.  Update ata_eh_reset() such that followup softreset is
performed if the controller is PMP capable and the host link is being
reset.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years ago[PATCH] libata: Fix HPA handling regression
Alan Cox [Sat, 29 Sep 2007 08:06:48 +0000 (04:06 -0400)]
[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>
17 years ago[libata] ata_piix: add HP compaq laptop to short cable list
Jeff Garzik [Sat, 29 Sep 2007 08:01:43 +0000 (04:01 -0400)]
[libata] ata_piix: add HP compaq laptop to short cable list

Reported by Andreas Messer.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agopata_ns87415: Initial cut at 87415/87560 IDE support
Alan Cox [Sat, 29 Sep 2007 06:35:10 +0000 (02:35 -0400)]
pata_ns87415: Initial cut at 87415/87560 IDE support

Signed-off-by: Alan Cox <alan@redhat.com>
[plus SuperIO fixes by Kyle McMartin]
[plus a cleanup from me]
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-core: blacklist HITACHI HDS drives using wildcard blacklist matching
David Milburn [Fri, 28 Sep 2007 19:29:06 +0000 (14:29 -0500)]
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>
17 years agolibata: update spurious NCQ completion blacklist
Tejun Heo [Fri, 28 Sep 2007 13:29:23 +0000 (06:29 -0700)]
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>
17 years agolibata: correct kernel parameter in documentation.
Dave Jones [Thu, 27 Sep 2007 15:50:13 +0000 (11:50 -0400)]
libata: correct kernel parameter in documentation.

'noacpi' isn't a standalone parameter, give it its prefix.

Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agopata_pdc202xx_old MWDMA fixes, and notes
Alan Cox [Wed, 26 Sep 2007 14:23:17 +0000 (15:23 +0100)]
pata_pdc202xx_old MWDMA fixes, and notes

I've been doing an audit of this driver to try and find out why we have
problems with some Clevo boxes that use it. Didn't get anywhere other
than to discover all the bug reporters I have use vmware, which may or
may not be chance.

In the process however I did find out our MWDMA2 performance was a bit
low and code review showed the MWDMA0/2 timings are reversed due to a
thinko in the table ordering

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agopata_atiixp: Audit notes on locking
Alan Cox [Wed, 26 Sep 2007 22:02:52 +0000 (23:02 +0100)]
pata_atiixp: Audit notes on locking

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years ago[libata] AHCI: enable AHCI mode, before using AHCI reset
Jeff Garzik [Wed, 26 Sep 2007 04:02:41 +0000 (00:02 -0400)]
[libata] AHCI: enable AHCI mode, before using AHCI reset

AHCI spec says host-reset bit may only be set when the ahci-enable bit
is also set.

Noticed by Peer Chen <peerchen@gmail.com>

Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: Fix build failure on ppc64 drivers/ata/pata_scc.c
Satyam Sharma [Sat, 22 Sep 2007 02:50:09 +0000 (08:20 +0530)]
libata: Fix build failure on ppc64 drivers/ata/pata_scc.c

Little fixlets, that the build started erroring / warning about:

drivers/ata/pata_scc.c: In function 'scc_bmdma_status':
drivers/ata/pata_scc.c:734: error: structure has no member named 'active_tag'
drivers/ata/pata_scc.c: In function 'scc_pata_prereset':
drivers/ata/pata_scc.c:866: warning: passing arg 1 of 'ata_std_prereset' from incompatible pointer type
drivers/ata/pata_scc.c: In function 'scc_error_handler':
drivers/ata/pata_scc.c:908: warning: passing arg 2 of 'ata_bmdma_drive_eh' from incompatible pointer type
drivers/ata/pata_scc.c:908: warning: passing arg 3 of 'ata_bmdma_drive_eh' from incompatible pointer type
drivers/ata/pata_scc.c:908: warning: passing arg 5 of 'ata_bmdma_drive_eh' from incompatible pointer type
make[2]: *** [drivers/ata/pata_scc.o] Error 1

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Cc: Alan Cox <alan@redhat.com>
Cc: Mel Gorman <mel@skynet.ie>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agosata_via: kill SATA_PATA_SHARING register handling
Tejun Heo [Fri, 21 Sep 2007 08:55:44 +0000 (17:55 +0900)]
sata_via: kill SATA_PATA_SHARING register handling

The SATA_PATA_SHARING register doesn't have anything to do with the
SATA part of the controller.  It indicates whether an extern SATA PHY
is attached to the PATA part of the controller and if so how it is
wired.  As the PATA part is driven by pata_via, sata_via has no reason
to care about that.  Also, pata_via should work fine under all
configurations.

This patch removes unnecessary attach failures.  It seems recent via
chipsets are defaulting to different values or are actually connected
to SATA PHY triggering this more often.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: fix ata_set_max_sectors()
Tejun Heo [Fri, 21 Sep 2007 11:07:14 +0000 (20:07 +0900)]
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>
17 years agolibata-pmp-prep: implement sata_async_notification()
Tejun Heo [Sun, 23 Sep 2007 04:14:13 +0000 (13:14 +0900)]
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>
17 years agolibata-pmp-prep: implement ATA_HORKAGE_SKIP_PM
Tejun Heo [Sun, 23 Sep 2007 04:14:13 +0000 (13:14 +0900)]
libata-pmp-prep: implement ATA_HORKAGE_SKIP_PM

Some pseudo devices fail PM commands unnecessarily aborting system
suspend.  Implement ATA_HORKAGE_SKIP_PM which makes libata skip PM
commands for these devices.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-pmp-prep: implement EH fast-fail path
Tejun Heo [Sun, 23 Sep 2007 04:14:13 +0000 (13:14 +0900)]
libata-pmp-prep: implement EH fast-fail path

If PMP itself becomes inaccessible while trying to link a downstream
link, spending time to recover the downstream link doesn't make any
sense.  Make EH skip retry and fail fast if -ERESTART is received.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-pmp-prep: implement ATA_LFLAG_DISABLED
Tejun Heo [Sun, 23 Sep 2007 04:14:13 +0000 (13:14 +0900)]
libata-pmp-prep: implement ATA_LFLAG_DISABLED

Implement ATA_LFLAG_DISABLED.  The flag indicates the link is disabled
due to EH recovery failure.  While a link is disabled, no EH action is
taken on the link and suspend/resume become noop too.

This will be used by PMP links to manage failed links.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-pmp-prep: implement ATA_LFLAG_NO_RETRY
Tejun Heo [Sun, 23 Sep 2007 04:14:12 +0000 (13:14 +0900)]
libata-pmp-prep: implement ATA_LFLAG_NO_RETRY

Some PMP links are connected to internal pseudo devices which may come
and go depending on situation.  There's no reason to try hard to
recover them.  ATA_LFLAG_NO_RETRY tells EH to not retry if the device
attached to the link fails.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-pmp-prep: implement ATA_LFLAG_NO_SRST, ASSUME_ATA and ASSUME_SEMB
Tejun Heo [Sun, 23 Sep 2007 04:14:12 +0000 (13:14 +0900)]
libata-pmp-prep: implement ATA_LFLAG_NO_SRST, ASSUME_ATA and ASSUME_SEMB

Some links on some PMPs locks up on SRST and/or report incorrect
device signature.  Implement ATA_LFLAG_NO_SRST, ASSUME_ATA and
ASSUME_SEMB to handle these quirky links.  NO_SRST makes EH avoid
SRST.  ASSUME_ATA and SEMB forces class code to ATA and SEMB_UNSUP
respectively.  Note that SEMB isn't currently supported yet so the
_UNSUP variant is used.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-pmp-prep: implement qc_defer helpers
Tejun Heo [Sun, 23 Sep 2007 04:14:12 +0000 (13:14 +0900)]
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>
17 years agolibata-pmp-prep: implement ops->qc_defer()
Tejun Heo [Sun, 23 Sep 2007 04:14:12 +0000 (13:14 +0900)]
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>
17 years agolibata-pmp-prep: make a number of functions global to libata
Tejun Heo [Sun, 23 Sep 2007 04:14:12 +0000 (13:14 +0900)]
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>
17 years agolibata-pmp-prep: add @new_class to ata_dev_revalidate()
Tejun Heo [Sun, 23 Sep 2007 04:14:12 +0000 (13:14 +0900)]
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>
17 years agolibata-pmp-prep: add PMP related constants, fields, ops and update helpers
Tejun Heo [Sun, 23 Sep 2007 04:14:12 +0000 (13:14 +0900)]
libata-pmp-prep: add PMP related constants, fields, ops and update helpers

Add PMP related constants, fields and ops.  Also, update
ata_class_enabled/disabled() such that PMP classes are considered.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: misc updates for AN
Tejun Heo [Sun, 23 Sep 2007 04:14:11 +0000 (13:14 +0900)]
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>
17 years ago[libata] SCSI: simulator version, not device version, belongs in VPD
Jeff Garzik [Sat, 22 Sep 2007 01:03:28 +0000 (21:03 -0400)]
[libata] SCSI: simulator version, not device version, belongs in VPD

Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years ago[libata] SCSI: clean up R/W recovery mode page
Jeff Garzik [Fri, 21 Sep 2007 11:54:49 +0000 (07:54 -0400)]
[libata] SCSI: clean up R/W recovery mode page

Clear ARRE, we don't do auto-reallocation on reads, just on writes.

Also, hardcode the size of the array using RW_RECOVERY_MPAGE_LEN,
following the style of the surrounding code.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years ago[libata] SCSI: improve FORMAT UNIT; minor code cleanups
Jeff Garzik [Fri, 21 Sep 2007 11:26:08 +0000 (07:26 -0400)]
[libata] SCSI: improve FORMAT UNIT; minor code cleanups

* SAT specifies that FORMAT UNIT should be translated into a series
  of READ and WRITE commands that zero the ATA device.  That is far too
  cumbersome to bother with.

  Since we don't actually format the device, the old behavior of
  always returning success was inaccurate.  Change FORMAT UNIT from
  returning success immediately (old behavior) to always returning
  an error (new behavior).

* Add some comments around SYNCHRONIZE CACHE

* Shuffle scsi command code around a bit, so that things are close
  to alphabetic order.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
17 years ago[libata] Slightly improved no-op REQUEST SENSE, SEND DIAGNOSTIC
Jeff Garzik [Fri, 21 Sep 2007 10:23:42 +0000 (06:23 -0400)]
[libata] Slightly improved no-op REQUEST SENSE, SEND DIAGNOSTIC

A few pedantic apps care about missing or lame "mandatory" SCSI
commands, so

REQUEST SENSE -- as we autosense, R.S. just returns zeroes

SEND DIAGNOSTIC -- our default (no-op) self-test succeeds, all
   other requests for testing fail.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years ago[libata] SCSI: support INQUIRY page 89h (ATA info page)
Jeff Garzik [Sat, 22 Sep 2007 00:38:03 +0000 (20:38 -0400)]
[libata] SCSI: support INQUIRY page 89h (ATA info page)

Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agoahci: RAID mode SATA patch for Intel Tolapai
Jason Gaston [Thu, 20 Sep 2007 21:35:00 +0000 (17:35 -0400)]
ahci: RAID mode SATA patch for Intel Tolapai

Signed-off-by: Jason Gaston <jason.d.gaston@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: assume ATA_DEV_ATA on diagnostic failure
Tejun Heo [Sun, 2 Sep 2007 14:24:48 +0000 (23:24 +0900)]
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>
17 years agolibata: update ata_dev_try_classify() arguments
Tejun Heo [Sun, 2 Sep 2007 14:23:57 +0000 (23:23 +0900)]
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>
17 years agoahci: reimplement port_map handling
Tejun Heo [Mon, 3 Sep 2007 03:44:57 +0000 (12:44 +0900)]
ahci: reimplement port_map handling

Reimplement port_map handling such that

1. Non-zero PORTS_IMPL value is always examined and used if consistent
   with cap.n_ports.

2. When PI and cat.n_ports are inconsistent, honor cap.n_ports and
   force port_map to be ((1 << cap.n_ports) - 1).

3. There were two separate places dealing with port_map.  Unify them
   to one.

As all newer ahci chips seem to get PI correct and older ones usually
have zero PI.  Controllers with holes in PI are very unlikely to screw
up PI, so #2 makes more sense than following inconsistent PI.

Without this change, not setting ATA_FLAG_HONOR_PI when it's needed
results in weird detection failure.  This changed logic should be able
to handle all known cases correctly automatically.

Verified on ICH6 (reports 0 PI), ICH8 (with holes in port_map), ICH9,
JMB360 and JMB363.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: remiplement ata_hpa_resize()
Tejun Heo [Mon, 3 Sep 2007 03:32:57 +0000 (12:32 +0900)]
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>
17 years agolibata: clean up read/set native_max address functions
Tejun Heo [Mon, 3 Sep 2007 03:32:30 +0000 (12:32 +0900)]
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>
17 years agolibata: move ata_id_n_sectors() upward
Tejun Heo [Mon, 3 Sep 2007 03:31:58 +0000 (12:31 +0900)]
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>
17 years agoata: increase allowed config flags
Kristen Carlson Accardi [Tue, 11 Sep 2007 18:41:59 +0000 (11:41 -0700)]
ata: increase allowed config flags

In anticipation of more features, increase number of config flags
allowed, and move the init flags.

Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Cc: Hugh Dickens <hugh@veritas.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agoata_piix: replace spaces with tabs
Jason Gaston [Sat, 8 Sep 2007 00:21:03 +0000 (17:21 -0700)]
ata_piix: replace spaces with tabs

This patch removes some incorrect formatting spaces and replaces them with tabs.

Signed-off-by: Jason Gaston <jason.d.gaston@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-scsi: convert to use the data buffer accessors
Boaz Harrosh [Tue, 18 Sep 2007 15:48:50 +0000 (17:48 +0200)]
libata-scsi: convert to use the data buffer accessors

  simple search-and-replace of direct scsi_cmnd access to
  use the data buffer accessors.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-scsi: Remove !use_sg code paths
Boaz Harrosh [Tue, 18 Sep 2007 15:46:12 +0000 (17:46 +0200)]
libata-scsi: Remove !use_sg code paths

     This is a minimal patch needed to remove use of !use_sg
     but it is not a complete clean up of the !use_sg paths.
     Libata-core still has the qc->flags & ATA_QCFLAG_SG
     and !qc->n_elem code paths. Perhaps an ata maintainer
     would have a go at it.

     - TODO: further cleanup of qc->flags & ATA_QCFLAG_SG
       and !qc->n_elem code paths in libata-core
     - TODO: Use scsi_dma_{map,unmap} where applicable.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agopdc2027x: Switch properly to ioread/iowrite
Alan Cox [Thu, 20 Sep 2007 14:07:12 +0000 (15:07 +0100)]
pdc2027x: Switch properly to ioread/iowrite

Some iomap functions were still using readl/writel and friends which
happens to work on most platforms but is not correct.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: Update experimental tags to reflect reality better
Alan Cox [Thu, 20 Sep 2007 13:58:48 +0000 (14:58 +0100)]
libata: Update experimental tags to reflect reality better

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years ago[libata] blacklist Maxtor*BANC* using new wildcard blacklist matching
Jeff Garzik [Thu, 20 Sep 2007 20:31:47 +0000 (16:31 -0400)]
[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>
17 years ago[libata] ata_piix: Use more-robust form of array initialization
Jeff Garzik [Sat, 1 Sep 2007 11:17:36 +0000 (07:17 -0400)]
[libata] ata_piix: Use more-robust form of array initialization

Use a form of array init that is less fragile, less sensitive to trivial
typos and ordering mismatches.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agoAVR32 PATA driver
Kristoffer Nyborg Gregertsen [Wed, 8 Aug 2007 14:57:08 +0000 (16:57 +0200)]
AVR32 PATA driver

Updated and simplified driver. Use only register transfer timing for both
data and register transfers. This gives poorer performance in PIO1 and 2,
but should not be a problem in PIO3 and 4, correct me if I'm wrong :)

The driver works very we'll but I still wonder about the interrupts. I have
an interrupt line, that works nicely when POLLING flag is not set. The
problem is the number of interrupts that eat away my CPU cycles.

When using the POLLING flag there seem to be some interrupts that dosen't get
cleared. Furthermore the device dosen't drive INTRQ high, it stays at 2.5 volts
and generates a lot of interrupts due to ripple / noise. What to do?

Signed-off-by: Kristoffer Nyborg Gregertsen <kngregertsen@norway.atmel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata driver for bf548 on chip ATAPI controller.
Sonic Zhang [Tue, 21 Aug 2007 05:12:31 +0000 (13:12 +0800)]
libata driver for bf548 on chip ATAPI controller.

Fix all issues pointed out in Jeff's email.

Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: move EH repeat reporting into ata_eh_report()
Tejun Heo [Sat, 18 Aug 2007 04:28:49 +0000 (13:28 +0900)]
libata: move EH repeat reporting into ata_eh_report()

EH is sometimes repeated without any error or action.  For example,
this happens when probing IDENTIFY fails because of a phantom device.
In these cases, all the repeated EH does is making sure there is no
unhandled error or pending action and return.  This repeation is
necessary to avoid losing any event which occurred while EH was in
progress.

Unfortunately, this dry run causes annonying "EH pending after
completion" message.  This patch moves the repeat reporting into
ata_eh_report() such that it's more compact and skipped on dry runs.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Mikael Pettersson <mikep@it.uu.se>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: implement and use ata_port_desc() to report port configuration
Tejun Heo [Sat, 18 Aug 2007 04:14:55 +0000 (13:14 +0900)]
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>
17 years agolibata: pata_pdc2027x PLL detection minor cleanup
Albert Lee [Mon, 20 Aug 2007 08:56:29 +0000 (16:56 +0800)]
libata: pata_pdc2027x PLL detection minor cleanup

Minor cleanup to remove the unneeded rmb()s per Jeff's advice. Also removed the
pll_clock < 0 check since pll_clock now guaranteed to be >= 0 after Mikael's patch.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: Strict checking for identify reporting
Alan Cox [Wed, 22 Aug 2007 22:31:43 +0000 (23:31 +0100)]
libata: Strict checking for identify reporting

The ATA specifications require checks on certain flags before assuming
the validity of other data. Go through the methods and correct those
needing extra checks. Also note limits on ata_id_major_version with
respect to ATA-1 and ATA-2. Correct the 32bit PIO check.

Wants to sit in -mm for a bit in case of a screwup on my part that I
didn't hit on the test drives and also in case someone, somewhere has
a drive that gets it wrong.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: Spot bridge chips
Alan Cox [Wed, 22 Aug 2007 22:22:45 +0000 (23:22 +0100)]
libata: Spot bridge chips

If we have a PATA cable with a SATA drive on it then we've found a
bridge and we can flip the cable type. This fixes some cable detect
problems with SATA bridges on chipsets and misdetected cable types.

In theory cable detection and mode limiting is needed if you put a
SATA/PATA bridge on a 40 wire cable, but I see no way to deal with
that other than to point out its not a good idea anyway.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-portmap: Remove unused definitions
Alan Cox [Wed, 22 Aug 2007 22:12:50 +0000 (23:12 +0100)]
libata-portmap: Remove unused definitions

With the PCI layer properly handling legacy IDE and the kernel now using
it these can go

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: Switch most of the remaining SFF drivers to ata_sff_port_start
Alan Cox [Wed, 22 Aug 2007 21:55:41 +0000 (22:55 +0100)]
libata: Switch most of the remaining SFF drivers to ata_sff_port_start

This avoids allocating DMA buffers if not needed but at the moment is
mostly just a neatness item.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years ago[libata] Remove ->port_disable() hook
Jeff Garzik [Thu, 16 Aug 2007 07:17:03 +0000 (03:17 -0400)]
[libata] Remove ->port_disable() hook

It was always set to ata_port_disable().  Removed the hook, and replaced
the very few ap->ops->port_disable() callsites with direct calls to
ata_port_disable().

Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata pata_via: ACPI checks for 80wire cable
Alan Cox [Thu, 26 Jul 2007 17:38:06 +0000 (18:38 +0100)]
libata pata_via: ACPI checks for 80wire cable

Testing this on the VIA boards fixes several problems with otherwise
undetectable SATA bridge chips

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata pata_amd: ACPI checks for 80wire cable
Alan Cox [Thu, 26 Jul 2007 17:37:28 +0000 (18:37 +0100)]
libata pata_amd: ACPI checks for 80wire cable

We can make use of this on the pata_amd driver as many Nvidia devices
don't have reliable cable detect.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years ago[libata] add ACPI cable detect API
Alan Cox [Thu, 16 Aug 2007 06:33:36 +0000 (02:33 -0400)]
[libata] add ACPI cable detect API

Combined from two Alan Cox patches:

1) libata: ACPI checks for 80wire cable

We can use the ACPI mode information with several drivers as a hint to
cable type. If the ACPI mode set by the BIOS is faster than UDMA33 then
we know the BIOS thinks there are 80wire cables. If it doesn't set such a
mode or it has no ACPI method then we get no further information and can
rely on existing approaches

Introduce the function headers needed. Null it out for non ACPI boxes

Signed-off-by: Alan Cox <alan@redhat.com>
2) libata: ACPI checks for 80wire cable

Provide actual methods for checking if the ACPI support thinks the cable
is 80wire, or doesn't know

Signed-off-by: Alan Cox <alan@redhat.com>
Combined into a single changeset and
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years ago[libata] Remove ->irq_ack() hook, and ata_dummy_irq_on()
Jeff Garzik [Wed, 15 Aug 2007 09:38:46 +0000 (05:38 -0400)]
[libata] Remove ->irq_ack() hook, and ata_dummy_irq_on()

* ->irq_ack() is redundant to what the irq handler already
  performs... chk-status + irq-clear.  Furthermore, it is only
  called in one place, when screaming-irq-debugging is enabled,
  so we don't want to bother with a hook just for that.

* ata_dummy_irq_on() is only ever used in drivers that have
  no callpath reaching ->irq_on().  Remove .irq_on hook from
  those drivers, and the now-unused ata_dummy_irq_on()

Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: add printf format attribute to ehi desc functions
Tejun Heo [Mon, 30 Jul 2007 05:24:15 +0000 (14:24 +0900)]
libata: add printf format attribute to ehi desc functions

Tell the compiler that [__]ata_ehi_push_desc() functions take printf
style format string and arguments.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: use ata_port_printk() in ata_wait_idle()
Tejun Heo [Mon, 30 Jul 2007 05:23:03 +0000 (14:23 +0900)]
libata: use ata_port_printk() in ata_wait_idle()

ata_wait_idle() identified controller by printing out the address of
the Status register.  This is bogus because 1. it's iomapped address
2. some controllers don't have Status register and don't initialize
the field.  Use ata_port_printk() instead.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-add-irq_flags-to-struct-pata_platform_info-fix
Andrew Morton [Fri, 10 Aug 2007 20:59:33 +0000 (13:59 -0700)]
libata-add-irq_flags-to-struct-pata_platform_info-fix

Remove unneeded, undesirable cast of void*.

Cc: Jeff Garzik <jeff@garzik.org>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agoata_piix: disallow UDMA 133 on ICH5 & ICH7
Christian Lamparter [Fri, 10 Aug 2007 20:59:51 +0000 (13:59 -0700)]
ata_piix: disallow UDMA 133 on ICH5 & ICH7

There is another outstanding issue with ata_piix.c.  Intel has never
officially supported anything faster than PATA 100MB/s.

But, the ata_piix.c driver "define" the ICH5 & ICH7 as UDMA6 (aka 133MB/s)
capable.  [ Well, no one has probably noticed it before, because there is bug
in do_pata_set_dmamode...  Just look at
libata_atapiix_enable_real_udma133.patch and you'll see what wrong with it.  ]

Here are Intel's datasheets for the affected chipsets: ICH5 Datasheet:
http://www.intel.com/design/chipsets/datashts/252516.htm (See note on page
183: "...  the ICH5 supports reads at the maximum rate of 100MB/s.")

ICH7 Datasheet: http://www.intel.com/design/chipsets/datashts/307013.htm (See
first note on page 190: "...  the ICH7 supports reads at the maximum rate of
100MB/s.")

They are two different ways to deal with it:

- Either -

1. replace all ich_pata_133 with ich_pata_100.
   (libata_atapiix_disable_udma6.diff - diff from 2.6.22 )

- Or -

2. keep all ich_pata_133 and fix the bug in "do_pata_set_dmamode".
   (libata_atapiix_enable_real_udma133.patch - diff from 2.6.22) If there are
   any concerns about the safety of the patch patch:
   http://lkml.org/lkml/2007/7/6/292 (It was already tested by an Intel
   employee, but I guess a bit more user input is necessary here...  )

This patch implements 1.

Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agoahci: Store interrupt value
Kristen Carlson Accardi [Thu, 9 Aug 2007 21:23:41 +0000 (14:23 -0700)]
ahci: Store interrupt value

Use a stored value for which interrupts to enable.  Changing this allows
us to selectively turn off certain interrupts later and have them
stay off.

Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years ago[libata] ahci: send event when AN received
Kristen Carlson Accardi [Wed, 15 Aug 2007 08:11:25 +0000 (04:11 -0400)]
[libata] ahci: send event when AN received

When we get an SDB FIS with the 'N' bit set, we should send
an event to user space to indicate that there has been a
media change.  This will be done via the scsi device.

Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years ago[libata] check for SATA async notify support
Kristen Carlson Accardi [Wed, 15 Aug 2007 07:57:11 +0000 (03:57 -0400)]
[libata] check for SATA async notify support

Check to see if an ATAPI device supports Asynchronous Notification.
If so, enable it, if the host controller supports AN.

Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agopata_cmd64x: Set up MWDMA modes properly
Alan Cox [Fri, 10 Aug 2007 20:59:49 +0000 (13:59 -0700)]
pata_cmd64x: Set up MWDMA modes properly

Set the MWDMA timing by updating the correct registers.  Split the PIO path as
this is mostly shared code.  Wants testing.

Signed-off-by: Alan Cox <alan@redhat.com>
Tested-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: Note that our cache flush code needs fixing up
Alan Cox [Wed, 8 Aug 2007 13:30:31 +0000 (14:30 +0100)]
libata: Note that our cache flush code needs fixing up

Remembered this while doing auditing and code review versus the specs

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-core: Document some limits/assumptions about ID_ATA
Alan Cox [Wed, 8 Aug 2007 13:27:00 +0000 (14:27 +0100)]
libata-core: Document some limits/assumptions about ID_ATA

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: add support for ATA_16 on ATAPI
Mark Lord [Tue, 7 Aug 2007 16:08:45 +0000 (01:08 +0900)]
libata: add support for ATA_16 on ATAPI

Add support for issuing ATA_16 passthru commands to ATAPI devices
managed by libata.  It requires the previous CDB length fix patch.

A boot/module parameter, "atapi_passthru16=0" can be used to globally
disable this feature, if ever desired.

tj: restructured __ata_scsi_queuecmd() according to Jeff's suggestion.

Signed-off-by: Mark Lord <liml@rtr.ca>
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: move ata_altstatus() to pio data xfer functions
Albert Lee [Wed, 15 Aug 2007 07:19:45 +0000 (03:19 -0400)]
libata: move ata_altstatus() to pio data xfer functions

Move ata_altstatus() out from ata_hsm_move() to the pio data xfer
functions like ata_pio_sectors() and atapi_pio_bytes() where it makes
more sense.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata: Correct IORDY handling
Alan Cox [Tue, 31 Jul 2007 13:01:48 +0000 (14:01 +0100)]
libata: Correct IORDY handling

Debugging a report of a problem with an ancient solid state disk showed
up some problems in the IORDY handling

1. We check the wrong bit to see if the device has IORDY
2. Even then some ancient creaking piles of crap don't support
SETXFER at all.

The cases it fixes are obscure and the risk of side effects is slight
but possible. This also moves us slightly closer to supporting original
MFM/RLL disks with libata.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-link: update Power Management to handle PMP links
Tejun Heo [Mon, 6 Aug 2007 09:36:24 +0000 (18:36 +0900)]
libata-link: update Power Management to handle PMP links

Update Power Management to consider PMP links.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-link: update hotplug to handle PMP links
Tejun Heo [Mon, 6 Aug 2007 09:36:24 +0000 (18:36 +0900)]
libata-link: update hotplug to handle PMP links

Update hotplug to handle PMP links.  When PMP is attached, the PMP
number corresponds to C of SCSI H:C:I:L.  While at it, change argument
to ata_find_dev() to @devno from @id to avoid confusion with SCSI
device ID.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-link: update EH to deal with PMP links
Tejun Heo [Mon, 6 Aug 2007 09:36:24 +0000 (18:36 +0900)]
libata-link: update EH to deal with PMP links

Update ata_eh_autopsy(), ata_eh_report(),
ata_eh_revalidate_and_attach() and ata_eh_recover() to deal with PMP
links.  ata_eh_autopsy() and ata_eh_report() updates are
straightforward.  They just repeat the same operation over all
configured links.  The only change to ata_eh_revalidate_and_attach()
is avoiding calling ->cable_select() on non-host ports.

ata_eh_recover() update is more complex as it first processes all
resets and then performs the rest.  This is necessary as thawing with
some links in unknown state can be dangerous.  ehi->action is cleared
on successful recovery of a link to avoid repeating recovery due to
failures in other links.

ata_eh_recover() iterates over only PMP links if PMP is attached, and,
on failure, the failing link is returned in @failed_link instead of
disabling devices directly.  These are to integrate ata_eh_recover()
into PMP EH later.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-link: update ata_scsi_error() to handle PMP links
Tejun Heo [Mon, 6 Aug 2007 09:36:23 +0000 (18:36 +0900)]
libata-link: update ata_scsi_error() to handle PMP links

Update ata_scsi_error() to handle PMP links.  As error conditions can
occur on both host and PMP links, __ata_port_for_each_link() is used.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-link: add PMP links
Tejun Heo [Mon, 6 Aug 2007 09:36:23 +0000 (18:36 +0900)]
libata-link: add PMP links

Add link->pmp, ap->nr_pmp_links, ap->pmp_link[], and implement/update
link helpers.

printk helpers are updated such that port and link are identifed as
'ataP:' if no PMP is attached, while device is identified as
'ataP.DD:'.  If PMP is attached, they become 'ataP:', 'ataP.LL:' and
'ataP.LL' - ie. link and device are identified their PMP number.

If PPM is attached (ap->nr_pmp_links != 0), ata_for_each_link()
iterates over PMP links, while __ata_for_each_link() iterates over the
host link + PMP links.  If PMP is not attached (ap->nr_pmp_links ==
0), both iterate over only the host link.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-link: implement ata_link_abort()
Tejun Heo [Mon, 6 Aug 2007 09:36:23 +0000 (18:36 +0900)]
libata-link: implement ata_link_abort()

Implement ata_link_abort().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agolibata-link: separate out link initialization functions
Tejun Heo [Mon, 6 Aug 2007 09:36:23 +0000 (18:36 +0900)]
libata-link: separate out link initialization functions

Separate out link initialization into ata_link_init() and
ata_link_init_sata_spd().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>