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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
* 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
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.
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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().
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>
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()
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>
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>
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>
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>
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>
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>
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>
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>
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>
Tejun Heo [Mon, 6 Aug 2007 09:36:23 +0000 (18:36 +0900)]
libata-link: make two port flags HRST_TO_RESUME and SKIP_D2H_BSY link flags
HRST_TO_RESUME and SKIP_D2H_BSY are link attributes. Move them to
ata_link->flags. This will allow host and PMP links to have different
attributes. ata_port_info->link_flags is added and used by LLDs to
specify these flags during initialization.
Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Tejun Heo [Mon, 6 Aug 2007 09:36:23 +0000 (18:36 +0900)]
libata-link: linkify config/EH related functions
Make the following functions deal with ata_link instead of ata_port.
* ata_set_mode()
* ata_eh_autopsy() and related functions
* ata_eh_report() and related functions
* suspend/resume related functions
* ata_eh_recover() and related functions
Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Tejun Heo [Mon, 6 Aug 2007 09:36:23 +0000 (18:36 +0900)]
libata-link: implement and use link/device iterators
Multiple links and different number of devices per link should be
considered to iterate over links and devices. This patch implements
and uses link and device iterators - ata_port_for_each_link() and
ata_link_for_each_dev() - and ata_link_max_devices().
This change makes a lot of functions iterate over only possible
devices instead of from dev 0 to dev ATA_MAX_DEVICES. All such
changes have been examined and nothing should be broken.
While at it, add a separating comment before device helpers to
distinguish them better from link helpers and others.
Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Tejun Heo [Mon, 6 Aug 2007 09:36:22 +0000 (18:36 +0900)]
libata-link: introduce ata_link
Introduce ata_link. It abstracts PHY and sits between ata_port and
ata_device. This new level of abstraction is necessary to support
SATA Port Multiplier, which basically adds a bunch of links (PHYs) to
a ATA host port. Fields related to command execution, spd_limit and
EH are per-link and thus moved to ata_link.
This patch only defines the host link. Multiple link handling will be
added later. Also, a lot of ap->link derefences are added but many of
them will be removed as each part is converted to deal directly with
ata_link instead of ata_port.
This patch introduces no behavior change.
Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: James Bottomley <James.Bottomley@SteelEye.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>