The IDE driver used DMA for ATAPI commands if READ/WRITE command is
multiple of sector size or sg command is multiple of 16 bytes. For
libata, READ/WRITE sector alignment is guaranteed by the high level
driver (sr), so we only have to worry about the 16 byte alignment.
This patch makes ata_check_atapi_dma() always request PIO for all data
transfer commands which are not multiple of 16 bytes.
The following reports are related to this problem.
http://bugzilla.kernel.org/show_bug.cgi?id=8605 (confirmed)
http://thread.gmane.org/gmane.linux.kernel/476620 (confirmed)
https://bugzilla.novell.com/show_bug.cgi?id=229260 (probably)
Albert first pointed out the difference between IDE and libata. Kudos
to him.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
In atapi_xlat(), prepare qc better before calling
ata_check_atapi_dma() such that ata_check_atapi_dma() can use info
from qc. While at it, reformat weird looking if/else block in the
function.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
When EH gives up after repeated exceptions, it doesn't't clear the
PENDING bit on exit which leaves PENDING bit set without EH actually
scheduled. This makes ata_port_wait_eh() to wait forever makes rmmod
hang on such port. Fix it by clearing the flag.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Fix section mismatch when CONFIG_HOTPLUG=n (but functions are used
for resume):
WARNING: drivers/ata/pata_it821x.o(.text+0x3f): Section mismatch: reference to .init.text: (between 'it821x_reinit_one' and 'it821x_program_udma')
WARNING: drivers/ata/pata_it821x.o(.text+0x691): Section mismatch: reference to .init.text: (between 'it821x_init_one' and 'it821x_passthru_set_dmamode')
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
There's no reason to print out hpa related messages when HPA is not
active. Kill the unconditional message and add a warning message
which is printed if HPA size is smaller than the current size.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
prereset() is now allowed to set flag for unsupported reset method.
EH layer is responsible for selecting the fallback. Remove non-sense
warning message.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
The attached patch fixes a trivial
mistake in a MODULE_PARAM_DESC of pata_it821x
driver. The parameter name in MODULE_PARAM_DESC
should match the one in module_param_named.
Signed-off-by: Stas Sergeev <stsp@aknet.ru>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
If PORTS_IMPL register is zero, ahci initialize it to full mask
corresponding to nr_ports in the CAP register. hpriv->cap, which is
initialized at the end of the function, is incorrectly used as value
of CAP causing ahci to always override PORTS_IMPL to 0x1 if it's zero.
Fix it.
This fixes a bug where early ich6 ahci can only access the first port.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Fix parameter name from ata_dev_reread_id() in libata-core.c for kerneldoc.
Signed-off-by: Henrik Kretzschmar <henne@nachtwindheim.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
More for the NCQ blacklist. One hitachi and one raptor. Other
members of these families of drives are already on the list, so no
surprises.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Code intended to check DMA status was checking DMA command register.
Moreover firmware seems to "forget" to set DMA capable bit for the
slave device (at least in RAID mode but without ITE RAID volumes) so
check device ID for DMA capable bit when deciding whether to use DMA
and remove DMA status check completely.
Thanks to Pavol Simo for the bugreport and testing the initial fix.
This change unfortunately still doesn't fix DMA in RAID mode (which
works fine with IDE it821x) but Alan is working on the missing pieces
(pata_it821x vs libata EH issues).
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Alan Cox <alan@redhat.com>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Add the MCP73/MCP77 support to PATA driver.
The patch base on kernel 2.6.22-rc4
Signed-off-by: Peer Chen <peerchen@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
After SRST, libata used to wait for nsect/lbal to be set to 1/1 for
the slave device. However, some ATAPI devices don't set nsect/lbal
after SRST and the wait itself isn't too useful as we're gonna wait
for !BSY right after that anyway.
Before reset-seq update, nsect/lbal wait failure used to be ignored
and caused 30sec delay during detection. After reset-seq, all
timeouts are considered error conditions making libata fail to detect
such ATAPI devices.
This patch limits nsect/lbal wait to around 100ms. This should give
acceptable behavior to such ATAPI devices while not disturbing the
heavily used code path too much.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
IOMEGA ZIP 250 ATAPI claims MWDMA0 support but fails SETXFERMODE if
asked to configure itself to MWDMA0. Force PIO.
This fixes bugzilla bug#8497.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Calvin Walton <calvin.walton@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
INIT_DEV_PARAMS and SET_MULTI_MODE change the device parameters cached
by libata. Re-read IDENTIFY DEVICE info and update the cached device
paramters when seeing these commands.
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Always enforce correct DEV bit since we know which drive the command
is targeted. SAT demands to ignore the DEV bit, too.
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Update the ATA passthru protocol numbers according to the new spec.
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
The controller is not reporting an unlawful type, it is reporting an
invalid type. Illegal specifically means "prohibited by law"
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
The ata IRQ ack functions are only used when debugging. Unfortunately
almost every controller that calls them can cause crashes in some
configurations as there are missing checks for bmdma presence.
In addition ata_port_start insists of installing DMA buffers and pad
buffers for controllers regardless. The SFF controllers actually need to
make that decision dynamically at controller setup time and all need the
same helper - so we add ata_sff_port_start. Future patches will switch
the SFF drivers to use this.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
hw_sata_spd_limit used to be incorrectly initialized to zero instead
of UINT_MAX if SPD is zero in SControl register. This breaks PHY
speed down. Fix it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
For ATA/CFA devices, libata prints out the device model and firmware revision.
Do the same for ATAPI devices.
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Most drivers don't seem to fill out the host->irq field, resulting in the
wrong (no) irq being reported at probe time. For example, sil24 on my system:
ata1: SATA max UDMA/100 cmd 0xd00008009001f000 ctl 0x0000000000000000 bmdma 0x0000000000000000 irq 0
ata2: SATA max UDMA/100 cmd 0xd000080090021000 ctl 0x0000000000000000 bmdma 0x0000000000000000 irq 0
Since they're allocated and set up in ata_host_activate(), just save
them away there.
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This patch has removed unused variable in pata_ispnp.
Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
sata_promise uses two different command modes - packet and TF. Packet mode
is intelligent low-overhead mode while TF is the same old taskfile
interface. As with other advanced interface (ahci/sil24),
ATA_TFLAG_POLLING has no effect in packet mode. However, PIO commands are
issued using TF interface in polling mode, so pdc_interrupt() considers
interrupts spurious if ATA_TFLAG_POLLING is set.
This is broken for polling NODATA commands because command is issued using
packet mode but the interrupt handler ignores it due to ATA_TFLAG_POLLING.
Fix pdc_qc_issue_prot() such that ATA/ATAPI NODATA commands are issued
using TF interface if ATA_TFLAG_POLLING is set.
This patch fixes detection failure introduced by polling SETXFERMODE.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Mikael Pettersson <mikpe@it.uu.se>
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Several people have reported LITE-ON LTR-48246S detection failed
because SETXFER fails. It seems the device raises IRQ too early after
SETXFER. This is controller independent. The same problem has been
reported for different controllers.
So, now we have pata_via where the controller raises IRQ before it's
ready after SETXFER and a device which does similar thing. This patch
makes libata always execute SETXFER via polling. As this only happens
during EH, performance impact is nil. Setting ATA_TFLAG_POLLING is
also moved from issue hot path to ata_dev_set_xfermode() - the only
place where SETXFER can be issued.
Note that ATA_TFLAG_POLLING applies only to drivers which implement
SFF TF interface and use libata HSM. More advanced controllers ignore
the flag. This doesn't matter for this fix as SFF TF controllers are
the problematic ones.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Supplied by VIA.
Also, convert named constants to hex values in the pata_via
PCI ID table. (standard libata policy for PCI device IDs, which are
considered simply arbitrary hex numbers, without a need to create a
single-use constant in linux/pci_ids.h)
Signed-off-by: Jeff Garzik <jeff@garzik.org>
The sata_sis driver supports SATA and PATA ports. The broken support
of both types in one controller is fixed.
Signed-off-by: Uwe Koziolek <uwe.koziolek@gmx.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
The commit d4b2bab4f2 added deadline support
to prereset and reset methods to libbata the pata_scc driver wasn't
converted. This patch is a naive attempt to bring this driver up to
scratch.
Build failures are:
drivers/ata/pata_scc.c: In function 'scc_pata_prereset':
drivers/ata/pata_scc.c:870: error: too few arguments to function 'ata_std_prereset'
drivers/ata/pata_scc.c: In function 'scc_error_handler':
drivers/ata/pata_scc.c:916: warning: passing argument 2 of 'ata_bmdma_drive_eh' from incompatible pointer type
drivers/ata/pata_scc.c:916: warning: passing argument 3 of 'ata_bmdma_drive_eh' from incompatible pointer type
drivers/ata/pata_scc.c: In function 'scc_pata_prereset':
drivers/ata/pata_scc.c:871: warning: control reaches end of non-void function
On a releated note scc_bus_post_reset() is (AFACT) identical to
ata_bus_post_reset(), would a patch to make ata_bus_post_reset() assesable
to drivers be accepted?
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Acked-by: Tejun Heo <htejun@gmail.com>
Cc: Akira Iguchi <akira2.iguchi@toshiba.co.jp>
Cc: Jeff Garzik <jgarzik@pobox.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>
Oh the joy of saving a fraction of a cent using short 40 wire cables and
not faking 80wire
Teach the VIA driver that there are some systems we need to know are
magically wired for high speeds.
Signed-off-by: Alan Cox <alan@redhat.com>
Tested-by: Francis Russell <FrancisRussell@btinternet.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
During prereset, -ENODEV return from ata_wait_ready() is not an error.
This causes unnecessary bug message on controllers which uses 0xff to
indicate empty port. Fix it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Some SATA controllers (sata_sil) use 0xff to indicate port not ready
status, not port empty. As libata interprets 0xff as port empty, this
causes unnecessary reset failure and retry. Don't consider 0xff as
port empty if SStatus is available and indicates that port is online.
Signed-off-by: tejun Heo <htejun@gmail.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Indan Zupancic <indan@nul.nu>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Acer Aspire 2023WLMi uses short 40c cable. Add quirk for it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Steve H. <mail.pandor@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
- Rename sis_port_base to sis_old_port_base() so nobody uses it for new
generation controllers in error.
- Use byte size operations where it is cleaner for mode setup
- Fix a couple of masking errors on certai chip revs when setting speeds
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
We have a revision that isn't correctly claimed as two drivers both go
for it: Fix the test accordingly. Noticed originally by Bill Nottingham.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
With cable methods in place we don't need a custom error handler for SATA
so get rid of it
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Various people had problems with both old and new IDE when hpt366 enable
bits started getting honoured. It turns out they are not reliable so
don't rely on them
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
http://bugzilla.kernel.org/show_bug.cgi?id=1044 points out an
additional hard disk that doesn't handle DMA transfers correctly.
This patch is the libata variant of the earlier patch to drivers/ide/
Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
With STANDBYDOWN tracking added, libata.spindown_compat isn't
necessary anymore. If userspace shutdown(8) issues STANDBYNOW, libata
warns. If userspace shutdown(8) doesn't issue STANDBYNOW, libata does
the right thing. Userspace can tell whether kernel supports spindown
by testing whether sysfs node manage_start_stop exists as before.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
As with all other drivers, sata_nv's hpriv is allocated with
devm_kzalloc() and there's no need to free it explicitly. Kill
nv_remove_one() which incorrectly used kfree() instead of devm_kfree()
and use ata_pci_remove_one() directly.
Original fix is from Peer Chen.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Peer Chen <pchen@nvidia.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Because nvidia SATA controllers onward base on AHCI, so wildcard in sata_nv
driver is unnecessary. Also the wildcard sometimes cause sata_nv driver to
be loaded for AHCI controllers,which is not as expected.
Signed-off-by: Peer Chen <pchen@nvidia.com>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Our assumption that most distros issue STANDBYNOW seems wrong. The
upstream sysvinit and thus many distros including gentoo and opensuse
don't take any action for libata disks on spindown. We can skip
compat handling for these distros so that they don't need to update
anything to take advantage of kernel-side shutdown.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Unlocking ap->lock and ssleeping don't work because SCSI commands can
be issued from completion path without context. Reimplement delayed
completion by allowing translation functions to override
qc->scsidone(), storing the original completion function to
scmd->scsi_done() and overriding qc->scsidone() with a function which
schedules delayed invocation of scmd->scsi_done().
This isn't pretty at all but all the ugly parts are thankfully
contained in the stop translation path where the compat feature is
implemented.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Whether a controller needs IDE or SATA ACPI hierarchy is determined by
the programming interface of the controller not by whether the
controller is SATA or PATA, or it supports slave device or not. This
patch adds ATA_FLAG_ACPI_SATA port flags which tells libata-acpi that
the port needs SATA ACPI nodes, and sets the flag for ahci and
sata_sil24.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Device might be resized during ata_dev_configure() due to HPA or
(later) ACPI _GTF. Currently it's worked around by caching n_sectors
before turning off HPA. The cached original size is overwritten if
the device is reconfigured without being hardreset - which always
happens after configuring trasnfer mode. If the device gets hardreset
for some reason after that, revalidation fails with -ENODEV.
This patch makes size checking more robust by moving n_sectors check
from ata_dev_reread_id() to ata_dev_revalidate() after the device is
fully configured. No matter what happens during configuration, a
device must have the same n_sectors after fully configured to be
treated as the same device.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Separate out ata_dev_reread_id() from ata_dev_revalidate().
ata_dev_reread_id() reads IDENTIFY page and determines whether the
same device is still there. ata_dev_revalidate() reconfigures after
reread completes. This will be used by ACPI update.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
I have a system where I have a simple IDE controller that sits on a
local bus without bus master dma capability, and thus no dma_mapping
ops defined for the device/bus.
pata_platform works great for me, with the exception of using the generic
ata_port_start which tries to do a dmam_alloc_coherent.
Looks like it doesn't need to allocate a prd table at all, so replace it
with a dummy function instead.
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Use menuconfigs instead of menus, so the whole menu can be disabled at once
instead of going through all options.
Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Add the device ID to AHCI pci table for ATI SB700 SATA controller, the
subsequent chipset of SB600.
Signed-off-by: henry su<henry.su@amd.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This patch cleans up libata-acpi such that it looks similar to other
libata files. This patch doesn't introuce any behavior changes.
* make libata-acpi functions take ata_device instead of ata_port +
device index
* s/atadev/dev/
* de-indent local variable declarations
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
ACPI applies to both SATA and PATA. Drop the 'S' from the config
variable.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
After certain errors, some devices report complete garbage on
IDENTIFY. This can cause ata_dev_read_id() to fail with -EINVAL
resulting in immediate disabling of the device. Give the device one
last chance after -EINVAL to allow recovery from such situations. As
-EINVAL is triggered very rarely, this shouldn't cause any noticeable
affect on more common error paths.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Harald Dunkel <harald.dunkel@t-online.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
It seems the world isn't as frank as we thought and some devices lie
about who they are. Fallback to the other IDENTIFY if IDENTIFY is
aborted by the device. As this is the strategy used by IDE for a long
time, it shouldn't cause too much problem.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: William Thompson <wt@electro-mechanical.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
libata enables SCSI host during ATA host activation which happens
after IRQ handler is registered and IRQ is enabled. All ATA ports are
in frozen state when IRQ is enabled but frozen ports may raise limited
number of IRQs after being frozen - IOW, ->freeze() is not responsible
for clearing pending IRQs. During normal operation, the IRQ handler
is responsible for clearing spurious IRQs on frozen ports and it
usually doesn't require any extra code.
Unfortunately, during host initialization, the IRQ handler can end up
scheduling EH for a port whose SCSI host isn't initialized yet. This
results in OOPS in the SCSI midlayer. This is relatively short window
and scheduling EH for probing is the first thing libata does after
initialization, so ignoring EH scheduling until initialization is
complete solves the problem nicely.
This problem was spotted by Berck E. Nash in the following thread.
http://thread.gmane.org/gmane.linux.kernel/519412
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Berck E. Nash <flyboy@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
The intention of using port_mask in SFF init helpers was to eventually
support exoctic configurations such as combination of legacy and
native port on the same controller. This never became actually
necessary and the related code always has been subtly broken one way
or the other. Now that new init model is in place, there is no reason
to make common helpers capable of handling all corner cases. Exotic
cases can simply dealt within LLDs as necessary.
This patch removes port_mask handling in SFF init helpers. SFF init
helpers don't take n_ports argument and interpret it into port_mask
anymore. All information is carried via port_info. n_ports argument
is dropped and always two ports are allocated. LLD can tell SFF to
skip certain port by marking it dummy. Note that SFF code has been
treating unuvailable ports this way for a long time until recent
breakage fix from Linus and is consistent with how other drivers
handle with unavailable ports.
This fixes 1-port legacy host handling still broken after the recent
native mode fix and simplifies SFF init logic. The following changes
are made...
* ata_pci_init_native_host() and ata_init_legacy_host() both now try
to initialized whatever they can and mark failed ports dummy. They
return 0 if any port is successfully initialized.
* ata_pci_prepare_native_host() and ata_pci_init_one() now doesn't
take n_ports argument. All info should be specified via port_info
array. Always two ports are allocated.
* ata_pci_init_bmdma() exported to be used by LLDs in exotic cases.
* port_info handling in all LLDs are standardized - all port_info
arrays are const stack variable named ppi. Unless the second port
is different from the first, its port_info is specified as NULL
(tells libata that it's identical to the last non-NULL port_info).
* pata_hpt37x/hpt3x2n: don't modify static variable directly. Make an
on-stack copy instead as ata_piix does.
* pata_uli: It has 4 ports instead of 2. Don't use
ata_pci_prepare_native_host(). Allocate the host explicitly and use
init helpers. It's simple enough.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Now that libata uses sd->manage_start_stop, libata spins down disk on
shutdown. In an attempt to compensate libata's previous shortcoming,
some distros sync and spin down disks attached via libata in their
shutdown(8). Some disks spin back up just to spin down again on
STANDBYNOW1 if the command is issued when the disk is spun down, so
this double spinning down causes problem.
This patch implements module parameter libata.spindown_compat which,
when set to one (default value), prevents libata from spinning down
disks on shutdown thus avoiding double spinning down. Note that
libata spins down disks for suspend to mem and disk, so with
libata.spindown_compat set to one, disks should be properly spun down
in all cases without modifying shutdown(8).
shutdown(8) should be fixed eventually. Some drive do spin up on
SYNCHRONZE_CACHE even when their cache is clean. Those disks
currently spin up briefly when sd tries to shutdown the device and
then the machine powers off immediately, which can't be good for the
head. We can't skip SYNCHRONIZE_CACHE during shudown as it can be
dangerous data integrity-wise.
So, this spindown_compat parameter is already scheduled for removal by
the end of the next year and here's what shutdown(8) should do.
* Check whether /sys/modules/libata/parameters/spindown_compat
exists. If it does, write 0 to it.
* For each libata harddisk {
* Check whether /sys/class/scsi_disk/h:c:i:l/manage_start_stop
exists. Iff it doesn't, synchronize cache and spin the disk
down as before.
}
The above procedure will make shutdown(8) work properly with kernels
before this change, ones with this workaround and later ones without
it.
To accelerate shutdown(8) updates, if the compat mode is in use, this
patch prints BIG FAT warning for five seconds during shutdown (the
optimal interval to annoy the user just the right amount discovered by
hours of tireless usability testing).
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Reimplement suspend/resume support using sdev->manage_start_stop.
* Device suspend/resume is now SCSI layer's responsibility and the
code is simplified a lot.
* DPM is dropped. This also simplifies code a lot. Suspend/resume
status is port-wide now.
* ata_scsi_device_suspend/resume() and ata_dev_ready() removed.
* Resume now has to wait for disk to spin up before proceeding. I
couldn't find easy way out as libata is in EH waiting for the
disk to be ready and sd is waiting for EH to complete to issue
START_STOP.
* sdev->manage_start_stop is set to 1 in ata_scsi_slave_config().
This fixes spindown on shutdown and suspend-to-disk.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Building on the previous two ecard infrastructure changes, this patch
fixes the pata_icside build errors caused by the recent libata changes.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Add devres ecardm_iomap() and ecardm_iounmap() for Acorn expansion
cards. Convert all expansion card drivers to use them.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Rather than having every driver fiddle about setting its private
IRQ operations and data, provide a helper function to contain
this functionality in one place.
Arrange to remove the driver-private IRQ operations and data when
the device is removed from the driver, and remove the driver
private code to do this.
This fixes potential problems caused by drivers forgetting to
remove these hooks.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Add "depends on HAS_IOMEM" to a number of menus to make them
disappear for s390 which does not have I/O memory.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Warning(linux-2.6.21-git4//drivers/ata/libata-core.c:904): No description found for parameter 'new_sectors'
Warning(linux-2.6.21-git4//drivers/ata/libata-core.c:941): No description found for parameter 'new_sectors'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This patch fixes some problems with ADMA-capable controllers with
regard to freeze, thaw and irq_clear libata callbacks. Freeze and
thaw didn't switch the ADMA-specific interrupts on or off, and more
critically the irq_clear function didn't respect the restriction that
the notifier clear registers for both ports have to be written at
the same time even when only one port is being cleared. This could
result in timeouts on one port when error handling (i.e. as a result
of hotplug) occurred on the other port.
As well, this fixes some issues in the interrupt handler: we shouldn't
check any ADMA status if the port has ADMA switched off because of
an ATAPI device, and it also checks to see if any ADMA interrupt has
been raised even when we are in port-register mode.
Signed-off-by: Robert Hancock <hancockr@shaw.ca>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
There is a known problem with sata_promise on SATAII-150/300 TX4
controller cards: it enumerates drives in an order that differs
from the port numbers printed on the controller cards. However,
Promise's BIOS and Linux driver both get the order right.
I investigated Promise's Linux driver (v1.01.0.23), and found
that it explicitly changes the mapping from logical port number
to ATA engine MMIO address on the SATAII TX4 cards. It does this
on all SATAII TX4 cards, without inspecting revision etc. The
SATAII TX2plus cards continue to use the same mapping that was
used for the first-generation chips.
This patch updates sata_promise to use the new port number to
ATA engine mapping on SATAII TX4 cards, which fixes the drive
enumeration order problem on those cards. Tested on several
1st and 2nd generation TX2plus and TX4 chips.
Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
The sata_promise error decode update changed pdc_host_intr()
to return and not complete the qc after detecting an error.
Unfortunately not completing the qc:s causes them to always
time out on error, which is wrong and has nasty side-effects.
This patch updates pdc_error_intr() to call ata_port_abort(),
similar to ahci and sata_sil24. Doing this is important as it
makes EH see the original error and not a bogus timeout.
Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
_GTF command is never ATA_PROT_ATAPI_NODATA whether the device is
ATAPI or not. It's always ATA_PROT_NODATA.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
* git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial: (25 commits)
sound: convert "sound" subdirectory to UTF-8
MAINTAINERS: Add cxacru website/mailing list
include files: convert "include" subdirectory to UTF-8
general: convert "kernel" subdirectory to UTF-8
documentation: convert the Documentation directory to UTF-8
Convert the toplevel files CREDITS and MAINTAINERS to UTF-8.
remove broken URLs from net drivers' output
Magic number prefix consistency change to Documentation/magic-number.txt
trivial: s/i_sem /i_mutex/
fix file specification in comments
drivers/base/platform.c: fix small typo in doc
misc doc and kconfig typos
Remove obsolete fat_cvf help text
Fix occurrences of "the the "
Fix minor typoes in kernel/module.c
Kconfig: Remove reference to external mqueue library
Kconfig: A couple of grammatical fixes in arch/i386/Kconfig
Correct comments in genrtc.c to refer to correct /proc file.
Fix more "deprecated" spellos.
Fix "deprecated" typoes.
...
Fix trivial comment conflict in kernel/relay.c.
flush_work(wq, work) doesn't need the first parameter, we can use cwq->wq
(this was possible from the very beginnig, I missed this). So we can unify
flush_work_keventd and flush_work.
Also, rename flush_work() to cancel_work_sync() and fix all callers.
Perhaps this is not the best name, but "flush_work" is really bad.
(akpm: this is why the earlier patches bypassed maintainers)
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Auke Kok <auke-jan.h.kok@intel.com>,
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(akpm: bypassed maintainers, sorry. There are other patches which depend on
this)
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Add pata_platform device for RiscPC, thereby converting the primary
IDE channel on the machine to PATA.
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
These are all the remaining instances of get_property. Simple rename of
get_property to of_get_property.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
libata previously depended upon waits in prereset to get resets after
hotplug right for both spin up and device ready wait. This was
necessary both for reliablity and speed as reset was likely to fail if
initiated too early and each try usually took more than 30secs to
fail. Previous patches fixed the reliability part by fixing status
and SCR handling in resets. This patch remedies the speed part by
improving reset sequencing.
Prereset waiting timeout is adjusted to 10s because spinup wait is
replaced by reset sequencing and !BSY wait is not as important as
before. During boot or module loading where the drive is already
fully spun up, !BSY wait succeeds immediately, so 10s should be enough
in most cases. It matters after hotplugging or other error
conditions, but in those cases, !BSY wait in prereset simply can't be
relied upon due to the varied and weird behaviors ATA controllers and
devices show.
Reset is now driven by ata_eh_reset_timeouts[] table which contains
timeouts for each reset try. The first reset can be softreset but the
following ones are always hardreset if available. Each timeout
defines deadline for the reset try. If a reset try fails, reset is
retried with the next timeout till the end of the timeout table is
reached. If a reset try fails before the timeout with error, libata
waits till the deadline of the failed try before retrying.
IOW, the timeout table defines timetable of reset tries such that the
n'th try always begins at least after the sum of all previous timeouts
has passed. The current timetable defines 4 tries and takes around 1
minute.
@0 : First try. This should succeed most of the time during boot.
@10 : 10s is enough to spin up most consumer harddrives. Give it
another shot.
@20 : 20s should spin up > 99% of working drives. This has 30s
timeout for retarded devices needing long idleness post reset.
@55 : Final try with 5s timeout just in case.
The above timetable is trade off between not annoying the device too
much with frequent resets and taking reasonable amount of time in most
cases. Some controllers may do better with shorter timeouts while
others may fare better with longer but we just can't rely upon LLD
writers to test each controller with wide variety of devices using
various scenarios. We need default behavior which reasonably fits
most cases.
I've tested the above timetable on a dozen SATA controllers and a few
PATA controllers with about a dozen different drives from all major
vendors and 4 different ODDs from three different vendors for both
boot and hotplug (if available) cases.
Boot probing is not affected unless the device is broken in which
cases new code gives up on the port after a minute rather than five or
nine minutes. When hotplugging, most devices get detected on the
first or second try. Multi-platter drives with long spin up time
which sometimes took > 40 secs with the original code, now usually
comes up during the second try and at least right after the third try
@20.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This patch updates ata_std_prereset() as follows.
* Don't fail on phy resume failure. Just whine and continue. Failure
from prereset makes libata abort whole reset sequence and give up
the port, so prereset() should be best effort. This is more
important with the coming EH updates as prereset() will be called
with shorter timeout.
* If ata_wait_ready() fails, whine and request hardreset instead.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
For PATA, 0xff status indicates empty port. For SATA, it depends on
how the controller emulates status register. On some controllers,
0xff is used to represent broken link or certain stage during reset.
libata currently deals SATA the same. This hasn't caused any problem
because problematic situations usually only occur after hotplug or
other link disruption events and libata blindly waited for the device
to spin up and settle after hotplug giving the link and device
whatever time to go through those stages.
libata is going to replace unconditional spinup wait with generic
timed sequence of resets, so not only getting 0xff handling right for
SATA is, well, the right thing to do, it's much more important now.
This patch makes the following changes.
* Make ata_bus_softreset() return -ENODEV if any of its wait fails
due to 0xff status.
* Fail soft/hardreset if status wait returns -ENODEV indicating 0xff
status while SStatus says the link is online. e.g. Reset fails if
status is 0xff after reset when SStatus reports the linke is online.
If SCR registers are not available, everything is the same as
before.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Add @deadline to prereset and reset methods and make them honor it.
ata_wait_ready() which directly takes @deadline is implemented to be
used as the wait function. This patch is in preparation for EH timing
improvements.
* ata_wait_ready() never does busy sleep. It's only used from EH and
no wait in EH is that urgent. This function also prints 'be
patient' message automatically after 5 secs of waiting if more than
3 secs is remaining till deadline.
* ata_bus_post_reset() now fails with error code if any of its wait
fails. This is important because earlier reset tries will have
shorter timeout than the spec requires. If a device fails to
respond before the short timeout, reset should be retried with
longer timeout rather than silently ignoring the device.
There are three behavior differences.
1. Timeout is applied to both devices at once, not separately. This
is more consistent with what the spec says.
2. When a device passes devchk but fails to become ready before
deadline. Previouly, post_reset would just succeed and let
device classification remove the device. New code fails the
reset thus causing reset retry. After a few times, EH will give
up disabling the port.
3. When slave device passes devchk but fails to become accessible
(TF-wise) after reset. Original code disables dev1 after 30s
timeout and continues as if the device doesn't exist, while the
patched code fails reset. When this happens, new code fails
reset on whole port rather than proceeding with only the primary
device.
If the failing device is suffering transient problems, new code
retries reset which is a better behavior. If the failing device is
actually broken, the net effect is identical to it, but not to the
other device sharing the channel. In the previous code, reset would
have succeeded after 30s thus detecting the working one. In the new
code, reset fails and whole port gets disabled. IMO, it's a
pathological case anyway (broken device sharing bus with working
one) and doesn't really matter.
* ata_bus_softreset() is changed to return error code from
ata_bus_post_reset(). It used to return 0 unconditionally.
* Spin up waiting is to be removed and not converted to honor
deadline.
* To be on the safe side, deadline is set to 40s for the time being.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
The Marvell IDE interface on my machine would hit a BUG_ON() in
lib/iomem.c because it was calling ata_pci_init_one() specifying just a
single port on the host, but that would actually end up trying to
initialize two ports, the second one with bogus information.
This fixes "ata_pci_init_one()" so that it actually passes down the
n_ports variable that it got from the low-level driver to the host
allocation routine ("ata_host_alloc_pinfo()"), which results in the ATA
layer actually having the correct port number information.
And in order to make it all work, I also needed to fix a few places that
had incorrectly hard-coded the fact that a host always had exactly two
ports (both ata_pci_init_bmdma() and ata_request_legacy_irqs() would
just always iterate over both ports).
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This is grubby, but all the ata drivers do it this way.
Would it not be better to do
#define ata_scsi_device_resume NULL
in libata.h, remove all those ifdefs?
(updated version, ug, ug)
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Further HPT37x changes
- No 66MHz 370/370A
- Remove dead special case check now we use the DPLL (as per the IDE driver)
Pointed out by Sergei
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>
Yes its no longer 3x2n but 3xxn, I can rename it if you want Jeff
- Don't reset both ports each time (Sergei)
- If we can't get a DPLL then abort entirely
- Use ioport access for clock (from drivers/ide)
- Add HPT371N support (from drivers/ide)
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>
drivers/ata/libata-core.c: In function 'ata_hpa_resize':
drivers/ata/libata-core.c:986: warning: format '%lld' expects type 'long long int', but argument 5 has type 'u64'
drivers/ata/libata-core.c:986: warning: format '%lld' expects type 'long long int', but argument 6 has type 'u64'
drivers/ata/libata-core.c:990: warning: format '%lld' expects type 'long long int', but argument 4 has type 'u64'
drivers/ata/libata-core.c:990: warning: format '%lld' expects type 'long long int', but argument 5 has type 'u64'
drivers/ata/libata-core.c:1003: warning: format '%lld' expects type 'long long int', but argument 4 has type 'u64'
Also fix various 80-col bustage.
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Separate ATA_EHI_DID_RESET into ATA_EHI_DID_SOFTRESET and
ATA_EHI_DID_HARDRESET. ATA_EHI_DID_RESET is redefined as OR of the
two flags. This patch doesn't introduce any behavior change. This
will be used later to determine whether _SDD is necessary or not.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Russell King hit a case where quantisation errors accumulated such that
the cycle time was shorter than rather than equal to the active/recovery
time. The code already knows how to stretch times to fit the cycle time
but does not know about the reverse.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
->cable_detect() used to be called on by the old ata_bus_probe() path.
Add invocation to ata_eh_revalidate_and_attach() right after IDENTIFYs
are done.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This is added by added by cff63dfceb52c564fe1ba5394d50ab7d599a11b9
- pata: cable methods.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
(S)ATA drives can be configured for "power-up in standby",
a mode whereby a specific "spin up now!" command is required
before the first media access.
Currently, a drive with this feature enabled can not be used at all
with libata, and once in this mode, the drive becomes a doorstop.
The older drivers/ide subsystem at least enumerates the drive,
so that it can be woken up after the fact from a userspace HDIO_*
command, but not libata.
This patch adds support to libata for the "power-up in standby"
mode where a "spin up now!" command (SET_FEATURES) is needed.
With this, libata will recognize such drives, spin them up,
and then re-IDENTIFY them if necessary to get a full/complete
set of drive features data.
Drives in this state are determined by looking for
special values in id[2], as documented in the current ATA specs.
Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Add support for ignoring the BIOS HPA result (off by default) and setting
the disk to the full available size unless already frozen.
Tested with various platforms/disks and confirmed to work with the
Macintosh (which broke earlier) and ata_piix (breakage due to the LBA48
readback that Tejun fixed).
For normal users this brings us, I believe, to feature parity with old IDE
(and of course more featured in some areas too).
Signed-off-by: Jeff Garzik <jeff@garzik.org>
All drivers are converted to new init model. Kill probe_ent,
ata_device_add() and ata_pci_init_native_mode().
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Convert pdc_adma, pata_cs5520, pata_isapnp, pata_ixp4xx_cf,
pata_legacy, pata_mpc52xx, pata_mpiix, pata_pcmcia, pata_pdc2027x,
pata_platform, pata_qdi, pata_scc and pata_winbond to new init model.
* init_one()'s now follow more consistent init order
* cs5520 now registers one host with two ports, not two hosts. If any
of the two ports are disabled, it's made dummy as other drivers do.
Tested pdc_adma and pata_legacy. Both are as broken as before. The
rest are compile tested only.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Convert drivers which use ata_pci_init_native_mode() to new init
model. ata_pci_init_native_host() is used instead. sata_nv, sata_uli
and sata_sis are in this category.
Tested on nVidia Corporation CK804 Serial ATA Controller [10de:0054]
in both BMDMA and ADMA mode.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Convert sata_via and sata_promise to new init model. Both controllers
can have combined configuration (SATA + PATA) and used twisted
initialization method (modifying port in ->port_start) to overcome
probe_ent limitations.
This patch converts both drivers to new init model in which such
configuration is natively supported.
* promise: Combined pata port now uses separate port_info entry right
after the sata counterpart entry.
* promise: Controller configuration is discerned using ap->flags.
This simplifies init path and makes it look more like other LLDs.
* via: Both SATA and PATA ports in vt6421 are represented in their
own port_info structure.
Tested on PDC20375 (SATA150 TX2plus) [105a:3375] and PDC40775 (SATA
300 TX2plus) [105a:3d73]. Couldn't test via cuz my c3 won't boot the
current kernel.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
These will be used to convert LLDs to new init model.
* Add irq_handler field to port_info. In new init model, requesting
IRQ is LLD's responsibility and libata doesn't need to know about
irq_handler. Most LLDs can simply register their irq_handler but
some need different irq_handler depending on specific chip. The
added port_info->irq_handler field can be used by LLDs to select
the matching IRQ handler in such cases.
* Add ata_dummy_port_info.
* Implement ata_pci_prepare_native_host(), a helper to alloc ATA host,
acquire all resources and init the host in one go.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Convert native PCI host handling to alloc-init-register model. New
function ata_pci_init_native_host() follows the new init model and
replaces ata_pci_init_native_mode(). As there are remaining LLD
users, the old function isn't removed yet.
ata_pci_init_one() is reimplemented using the new function and now
fully converted to new init model.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Convert legacy PCI host handling to alloc-init-register model.
ata_init_legacy_host(), ata_request_legacy_irqs() and
ata_pci_init_bmdma() are separated out and follow the new init model.
The two legacy handling functions use separate ata_legacy_devres
instead of generic devm_* resources. This reduces devres overhead for
legacy hosts which was a bit high because it didn't use PCI/iomap
merged resoruces.
ata_pci_init_one() is rewritten in terms of the aboved functions but
native mode handling is still using the old method. Conversion will
be completed when native mode handling is updated.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Implement ata_host_alloc_pinfo() and ata_host_register(). These helpers
will be used in the following patches to adopt new init model.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Reorganize ata_host_alloc() and its subroutines into the following
three functions.
* ata_host_alloc() : allocates host and its ports. shost is not
registered automatically.
* ata_scsi_add_hosts() : allocates and adds shosts associated with an
ATA host. Used by ata_host_register().
* ata_host_register() : takes a fully initialized ata_host structure
and registers it to libata layer and probes it.
Only ata_host_alloc() and ata_host_register() are exported.
ata_device_add() is rewritten using the above functions. This patch
does not introduce any observable behavior change. Things worth
mentioning.
* print_id is assigned at registration time and LLDs are allowed to
overallocate ports and reduce host->n_ports during initialization.
ata_host_register() will throw away unused ports automatically.
* All SCSI host initialization stuff now resides in
ata_scsi_add_hosts() in libata-scsi.c, where it should be.
* ipr is now the only user of ata_host_init(). Either kill it by
converting ipr to use ata_host_alloc() and friends or rename and
move it to libata-scsi.c
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Separate out ata_host_start() from ata_device_add(). ata_host_start()
calls ->port_start on each port if available and freezes the port.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Don't embed ap inside shost. Allocate it separately and point it back
from shosts's hostdata. This makes port allocation more flexible and
allows regular ATA and SAS share host alloc/init paths.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Add PCI ID for new VIA chip. Original patch is from Maarten Vanraes.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Maarten Vanraes <maarten.vanraes@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
kill the following compile warning.
drivers/ata/libata-core.c:1786: warning: comparison of distinct pointer types lacks a cast
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
SB600 RAID and SB600 SATA is the same controller and share the
same PCI ID 0x4380. There is no such PCI ID 0x4381.
Signed-off-by: Conke Hu <conke.hu@gmail.com>
---------
Signed-off-by: Jeff Garzik <jeff@garzik.org>
->post_internal_cmd is simplified EH for internal commands. Its
primary mission is to stop the controller such that no rogue memory
access or other activities occur after the internal command is
released. It may provide error diagnostics by setting qc->err_mask
but this hasn't been a requirement.
To ignore SETXFER failure for CFA devices, libata needs to know
whether a command was failed by the device or for any other reason.
ie. internal command needs to get AC_ERR_DEV right.
This patch makes the following changes to AC_ERR_DEV handling and
->post_internal_cmd semantics to accomodate this need and simplify
callback implementation.
1. As long as the correct bits in the result TF registers are set,
there is no need to set AC_ERR_DEV explicitly. libata EH core
takes care of that for both normal and internal commands.
2. The only requirement for ->post_internal_cmd() is to put the
controller into quiescent state. It needs not to set any err_mask.
3. ata_exec_internal_sg() performs minimal error analysis such that
AC_ERR_DEV is automatically set as long as result_tf is filled
correctly.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Disabled port handling in ata_pci_init_native_mode() is slightly
broken in that it may end up using the wrong port_info. This patch
updates it such that disables ports are made dummy as done in the
legacy and other cases.
While at it, fix indentation in ata_resources_present().
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Move cross checking between port_map and cap.n_ports into
ahci_save_initial_config(). After save_initial_config is done,
hpriv->port_map is always setup properly.
Tested on JMB363, ICH7 and ICH8 (with dummy ports).
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
There are several registers which describe how the controller is
configured. These registers are sometimes implemented as r/w
registers which are configured by firmware and get cleared on
controller reset or after suspend/resume cycle. ahci saved and
restored those values inside ahci_reset_controller() which is a bit
messy and doesn't work over suspend/resume cycle.
This patch implements ahci_save/restore_initial_config(). The save
function is called during driver initialization and saves cap and
port_map to hpriv. The restore function is called after the
controller is reset to restore the initial values.
Sometimes the initial firmware values are inconsistent and need to be
fixed up. This is handled by ahci_save_initial_config(). For this,
there are two versions of saved registers. One to write back to the
hardware register, the other to use during driver operation. This is
necessary to keep ahci's behavior unchanged (write back fixed up
port_map while keeping cap as-is).
This patch makes ahci save the register values once before the first
controller reset, not after it's been reset. Also, the same stored
values are used written back after each reset, so the register values
are properly recovered after suspend/resume cycle.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Promise ATA ports should always be reset by pdc_reset_port()
when errors are detected, but the recent error reason decoding
update to sata_promise replaced that reset with a freeze.
This patch changes the error detection to do a reset again.
This makes the error decoding update safer, as it now only
adds error decoding without changing any other behaviour.
Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Correct missing modefilter (crash if BAR4 unassigned)
Use Cable Detect method
Wrap ->set_mode instead ready for ->post_set_mode removal
Maxtor errata as per Jeff Garzik report
Remove duplicated private udma_mask hacking
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Versus upstream as requested
Last of the trivial switches to cable_detect methods.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
The READ/WRITE LONG commands are theoretically obsolete,
but the majority of drives in existance still implement them.
The WRITE_LONG and WRITE_LONG_ONCE commands are of particular
interest for fault injection testing -- eg. creating "media errors"
at specific locations on a disk.
The fussy bit is that these commands require a non-standard
sector size, usually 520 bytes instead of 512.
This patch adds support to libata for READ/WRITE LONG commands
issued via SG_IO/ATA_16.
Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
The Asus W5F laptop uses a short cable instead of the 80-wire style, and thus
needs to be in the ich_laptop special cases for correct detection and support
of UDMA/100 for the hard drive. I noticed this because I have the W5F laptop,
and was tracing apparent slowness.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
A lot of noise because I had to rename the optidma_set_mode() method to
avoid confusion with the new ->set_mode() method that was added. Cable
detect side is pretty trivial.
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>