Commit Graph

1921 Commits

Author SHA1 Message Date
Tejun Heo 40ef1d8d48 [PATCH] sata_via: convert to new EH, take #3
Convert sata_via to new EH.  vt6420 used ATA_FLAG_SRST while vt6421
used ATA_FLAG_SATA_RESET.  This difference seems to be an accident
rather than intended.  This patch makes both flavors use
ata_bmdma_error_handler() which makes use of both SRST and SATA
hardreset.  This behavior change is intended and if it breaks
anything, it should be very easy to spot.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-20 05:12:15 -04:00
Jeff Garzik c5fa46e175 [libata] sata_nv: s/spin_lock_irqsave/spin_lock/ in irq handler
We don't need to use the heavier spin lock in the irq handler.

It's quite possible we can do this in nv_generic_interrupt() as well,
but I didn't take the time to pursue that train of thought.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-20 05:08:44 -04:00
Tejun Heo 5a44efff4f [PATCH] sata_nv: add hotplug support
Add hotplug support.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-20 04:59:22 -04:00
Tejun Heo 39f8758259 [PATCH] sata_nv: convert to new EH
Convert to new EH.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-20 04:59:22 -04:00
Tejun Heo ada364e884 [PATCH] sata_nv: better irq handlers
nf2/3 and ck804 have irq status register.  Implement better irq
handler for those flavors of nv.  This patch makes different flavors
of nv controllers use different irq handlers by using separate
port_info for each flavor.

This change also makes following EH and hotplug updates easier to
integrate.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-20 04:59:22 -04:00
Tejun Heo 27e4b27454 [PATCH] sata_nv: simplify constants
Simplify interrupt constants and make NFORCE3 equal to NFORCE2.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-20 04:59:22 -04:00
Tejun Heo e6faf082cd [PATCH] sata_nv: kill struct nv_host_desc and nv_host
nv_host_desc and nv_host are used to discern different generations of
nv controllers.  Kill those.  New EH/hotplug implementation will use
standard port_info/ata_port_operations for that.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-20 04:59:21 -04:00
Tejun Heo 638ebcc81f [PATCH] sata_nv: kill not-working hotplug code
sata_nv contained hotplug code which is mainly for demonstrating how
hotplug event is handled.  This patch kills the demo code in
prepration for real hotplug implementation.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-20 04:59:21 -04:00
Jeff Garzik bf717b11ae [libata] Update docs to reflect current driver API 2006-06-13 20:27:03 -04:00
Tejun Heo f0eb62b81d [PATCH] libata: add host_set->next for legacy two host_sets case, take #3
For a legacy ATA controller, libata registers two separate host sets.
There was no connection between the two hosts making it impossible to
traverse all ports related to the controller.  This patch adds
host_set->next which points to the second host_set and makes
ata_pci_remove_one() remove all associated host_sets.

* On device removal, all ports hanging off the device are properly
  detached.  Prior to this patch, ports on the first host_set weren't
  detached casuing oops on driver unloading.

* On device removal, both host_sets are properly freed

This will also be used by new power management code to suspend and
resume all ports of a controller.  host_set/port representation will
be improved to handle legacy controllers better and this host_set
linking will go away with it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-12 10:23:21 -04:00
Tejun Heo d01712698c [PATCH] libata: fix oops caused rescanning NULL sdev
Depending on timing, ata_scsi_dev_rescan() might encounter a device
which is enabled but not yet attached to sdev.  On such cases, the
original code caused oops.  This patch makes ata_scsi_dev_rescan()
rescan only device which are attached to sdevs.

While at it, properly indent leading comment and add description about
how it's synchronized with sdev attach/detach.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-12 10:23:21 -04:00
Tejun Heo d4c85325a8 [PATCH] sata_sil: update device hotplug handling, take #2
SIEN on some 3112 controllers doesn't mask SATA IRQ properly.  IRQ
stays asserted even after SIEN is masked and IRQ is acked.  Also, even
while frozen, any SATA PHY event including hardreset raises SATA IRQ.
Clearing SError seems to be the only way to deassert SATA IRQ.

This patch makes sil_host_intr() clear SError on SATA IRQs and ignore
SATA IRQs reported while frozen so that hardreset doesn't trigger
hotplug event (which ends up hardresetting again).

In such cases, the port still gets re-frozen to minimize the danger of
screaming interrupts.  This results in one nil EH repeat on
controllers with broken SIEN but other than that does no harm.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-12 09:37:21 -04:00
Tejun Heo aeb2ecd609 [PATCH] libata: fast exit from EH while unloading
Make EH exit fast if the port is being unloaded.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-12 02:10:26 -04:00
Tejun Heo f9be7113b5 [PATCH] libata: fix ATA_EH_REVALIDATE clearing
ATA_EH_REVALIDATE should be cleared after all devices on the target
port have been revalidated.  Fix ata_eh_revalidate_and_attach()
accordingly.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-12 02:10:26 -04:00
Tejun Heo 551e888950 [PATCH] libata: fix comment above ata_exec_internal()
Add RETURNS comment above ata_exec_internal() and kill extra blank
line.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-12 02:10:26 -04:00
Tejun Heo 23fa961809 [PATCH] sata_sil: add controller unplug detection in sil_interrupt()
Short-circuit interrupt handling if BMDMA2 is reported as 0xffffffff
indicating device removal.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-12 02:10:26 -04:00
zhao, forrest 3057ac3c1a [PATCH] Snoop SET FEATURES - WRITE CACHE ENABLE/DISABLE command(v5)
This patch makes libata snoop 'SET FEATURES - WRITE CACHE
ENABLE/DISABLE' command, executing requisite revalidation processes
to update cached data.

Signed-off-by: Forrest Zhao <forrest.zhao@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-12 00:18:35 -04:00
Jeff Garzik 39b07ce6d9 libata: more verbose request_irq() failure
Suggested by Jarek P.
2006-06-11 23:59:44 -04:00
Brian King 233277cad6 [PATCH] libata: Setup nbytes in ata_sg_init_one
Setup nbytes in ata_sg_init_one to the total transfer length
of the command. This is needed by some HBAs that need to know
the total transfer length of each command.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-11 23:24:25 -04:00
Borislav Petkov bd5d825c94 libata: Adjust initial debugging levels through preprocessor defines.
Signed-off-by: <petkov@uni-muenster.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-11 23:17:01 -04:00
Alexey Dobriyan b47725743c [PATCH] sata_sil24: endian anotations
With help from Tejun Heo.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-11 23:07:19 -04:00
Jeff Garzik fec69a9748 Merge branch 'upstream-fixes' into upstream
Conflicts:

	drivers/scsi/sata_sil24.c
2006-06-11 23:04:37 -04:00
Mark Lord 2f9719b61e [PATCH] sata_mv: grab host lock inside eng_timeout
Bug fix:  mv_eng_timeout() calls mv_err_intr() without first grabbing the host lock,
which can lead to all sorts of interesting scenarios.

This whole error-handling portion of sata_mv is nasty (and will get fixed for
the new EH stuff), but for now this patch will help keep it on life-support.

Signed-off-by:  Mark Lord <liml@rtr.ca>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-11 23:03:18 -04:00
Tejun Heo 1049cb4787 [PATCH] libata: add missing ->data_xfer for pdc_adma
pdc_adma use libata-core PIO path but were left out
during ->data_xfer conversion.  Initialize with proper callbacks.

This patch is against the current libata-dev#ALL.  Controllers which
implement their own PIO HSM (ahci and sil24) don't need ->data_xfer, so the
above two are the only drivers which were left out during conversion.

From: "Barry K. Nathan" <barryn@pobox.com>

Signed-off-by: Barry K. Nathan <barryn@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-11 10:21:13 -04:00
Tejun Heo 0a1b622ef4 [PATCH] libata: add missing finish_wait() call in ata_port_wait_eh()
Add missing finish_wait() call after wait loop in ata_port_wait_eh().

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-06-11 11:01:38 +09:00
Rune Torgersen 67f672f61b [PATCH] sata_sil24: SII3124 sata driver endian problem
From: "Rune Torgersen" <runet@innovsys.com>

Fix an endian issue in the sil24 driver.

Signed-off-by: Rune Torgersen <runet@innovsys.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-05 12:29:17 -07:00
Linus Torvalds 672c6108a5 Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
  [SCSI] scsi_lib.c: properly count the number of pages in scsi_req_map_sg()
  [SCSI] scsi_transport_sas: make write attrs writeable
  [SCSI] scsi_transport_sas; fix user_scan
  [SCSI] ppa: fix for machines with highmem
  [SCSI] mptspi: reset handler shouldn't be called for other bus protocols
  [SCSI] Blacklist entry for HP dat changer
2006-06-03 09:12:50 -07:00
Bryan Holty f52359622f [SCSI] scsi_lib.c: properly count the number of pages in scsi_req_map_sg()
The calculation of nr_pages in scsi_req_map_sg() doesn't account for
the fact that the first page could have an offset that pushes the end
of the buffer onto a new page.

Signed-off-by: Bryan Holty <lgeek@frontiernet.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-06-01 09:16:55 -05:00
Tejun Heo d87fa38e70 [PATCH] libata-hp: move ata_do_reset() to libata-eh.c
With ops->probe_init() gone, no user is left in libata-core.c.  Move
ata_do_reset() to libata-eh.c and make it static.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:28:24 +09:00
Tejun Heo 52783c5dcc [PATCH] libata-hp: killl ops->probe_reset
Now that all drivers implementing new EH are converted to new probing
mechanism, ops->probe_reset doesn't have any user.  Kill it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:28:22 +09:00
Tejun Heo 0542925b25 [PATCH] sata_sil24: convert to new probing mechanism and add hotplug support
Convert to new probing mechanism and add hotplug support by enabling
PORT_IRQ_PHYRDY_CHG, marking ehi for hotplug and scheduling EH on
PORT_IRQ_PHYRDY_CHG or PORT_IRQ_DEV_XCHG.

Sil3124/32 family of controllers don't have any mechanism to wait for
the first D2H FIS after hotplug, so ATA_FLAG_SKIP_D2H_BSY is used.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:28:20 +09:00
Tejun Heo 4296971dd3 [PATCH] ahci: convert to new probing mechanism and add hotplug support
Convert to new probing mechanism and add hotplug support by enabling
PORT_IRQ_PHYRDY, marking ehi for hotplug and scheduling EH on
CONNECT/PHYRDY interrupts.

Unfortunately, ahci cannot reliably wait for the first D2H FIS after
hotplug.  It sometimes succeeds but times out more often than not, so
ATA_FLAG_SKIP_D2H_BSY is used.

This patch also fixes ahci_hardreset() such that D2H Register FIS RX
area is cleared before issuing COMRESET.  Without this,
ata_busy_sleep() after COMRESET might prematually finish if the
previous TF contains DRDY && !BSY.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:28:18 +09:00
Tejun Heo e573890b00 [PATCH] sata_sil: convert to new probing mechanism and add hotplug support
Convert to new probing mechanism and add hotplug support by enabling
SATA IRQ for SError.N, marking ehi for hotplug and scheduling EH on
SATA IRQs.

Sil3112/3512/3114 family of controllers use COMRESET as TF clearing
point and can reliably wait for D2H FIS after COMRESET whether the FIS
is the first D2H FIS after POR or in response to the COMRESET.  Thus,
setting ATA_FLAG_HRST_TO_RESUME is enough for device detection after
hotplug.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:28:16 +09:00
Tejun Heo ccc4672aff [PATCH] ata_piix: convert ata_piix to new probing mechanism
Convert ata_piix to new probing mechanism.  Automatic hotplug is not
supported due to hardware limitation (no PHY event interrupt), but
warm plugging works.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:28:14 +09:00
Tejun Heo 720ba12620 [PATCH] libata-hp: update unload-unplug
Update unload unplug - driver unloading / PCI removal.  This is done
by ata_port_detach() which short-circuits EH, disables all devices and
freezes the port.  With this patch, EH and unloading/unplugging are
properly synchronized.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:28:13 +09:00
Tejun Heo 3e706399b0 [PATCH] libata-hp: implement bootplug
Implement bootplug - boot probing via hotplug path.  While loading,
ata_host_add() simply schedules probing and invokes EH.  After EH
completes, ata_host_add() scans and assicates them with SCSI devices.
EH path is slightly modified to handle this (e.g. no autopsy during
bootplug).  The SCSI part is left in ata_host_add() because it's
shared with legacy path and to keep probing order as before (ATA scan
all ports in host_set then attach all).

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:28:11 +09:00
Tejun Heo ccf68c3405 [PATCH] libata-hp: hook warmplug
Hook transportt->user_scan() and hostt->slave_destroy().

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:28:09 +09:00
Tejun Heo 83c47bcb3c [PATCH] libata-hp: implement warmplug
Implement warmplug.  User-initiated unplug can be detected by
hostt->slave_destroy() and plug by transportt->user_scan().  This
patch only implements the two callbacks.  The next function will hook
them.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:28:07 +09:00
Tejun Heo 580b210232 [PATCH] libata-hp: implement SCSI part of hotplug
Implement SCSI part of hotplug.

This must be done in a separate context as SCSI makes use of EH during
probing.  SCSI scan fails silently if EH is in progress.  In such
cases, libata pauses briefly and retries until every device is
attached.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:28:05 +09:00
Tejun Heo 084fe639b8 [PATCH] libata-hp: implement hotplug
Implement ATA part of hotplug.  To avoid probing broken devices over
and over again, disabled devices are not automatically detached.  They
are detached only if probing is requested for the device or the
associated port is offline.  Also, to avoid infinite probing loop,
Each device is probed only once per EH run.

As SATA PHY status is fragile, devices are detached only after it has
used up its recovery chances unless explicitly requested by LLDD or
user (LLDD may request direct detach if, for example, it supports cold
presence detection).

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:28:03 +09:00
Tejun Heo 0ea035a3d1 [PATCH] libata-hp: implement ata_eh_detach_dev()
Implement ata_eh_detach_dev().  This function is responsible for
detaching an ATA device and offlining the associated SCSI device
atomically so that the detached device is not accessed after ATA
detach is complete.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:28:01 +09:00
Tejun Heo e8e008e7b5 [PATCH] sata_sil24: update sil24_hardreset()
Use phy debouncing instead of unconditional wait after DEV_RST and
make sil24_hardreset() to request followup SRST as that's the only way
to wait for !BSY.  Note that the original implementation never worked
- if the cached status was !BSY, ata_busy_sleep() finished
immediately; otherwise, it timed out regardless of the actual device
status.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:27:59 +09:00
Tejun Heo 135da34573 [PATCH] sata_sil24: rename PORT_PRB to PORT_LRAM and add PORT_LRAM_SLOT_SZ
PORT_PRB is a misnomer as the area also contains other stuff.  Rename
it to PORT_LRAM and add PORT_LRAM_SLOT_SZ.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:27:57 +09:00
Tejun Heo cbe88fbc72 [PATCH] sata_sil: new interrupt handler
The DMA complete bit of these controllers reflects ATA IRQ status
while no DMA command is in progress.  So, we can tell whether the
controller is raising an interrupt or not in deterministic manner.
This patch gives sata_sil its own interrupt handler which behaves much
better than the original one in terms of error detection and handling.
This change is also necessary for later hotplug support.

Further improvements are possible, in both 2 and 4 ports versions, we
can get all status with only one readl and using custom bmdma
operations can further cut down register accesses.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:27:55 +09:00
Tejun Heo 20888d8368 [PATCH] sata_sil: add new constants in preparation for new interrupt handler
sata_sil is about to get a brand new interrupt handler.  Add relevant
constants.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:27:53 +09:00
Tejun Heo 9a1004d0c1 [PATCH] libata: export ata_hsm_move()
ata_hsm_move() will be used by LLDDs which depend on standard PIO HSM
but implement their own interrupt handlers.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:27:52 +09:00
Tejun Heo 664faf09a0 [PATCH] libata-hp-prep: implement followup softreset handling
In some cases, hardreset must be followed by SRST.

* some controllers can't classify with hardreset
* some controllers can't wait for !BSY after hardreset (LLDD should
  explicitly request followup softreset by returning -EAGAIN)
* (later) PM needs SRST w/ PMP==15 to operate after hardreset

To handle above cases, this patch implements follow-up softreset.
After a hardreset, ata_eh_reset() checks whether any of above
conditions are met and do a follow-up softreset if necessary.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:27:50 +09:00
Tejun Heo f5914a461e [PATCH] libata-hp-prep: add prereset() method and implement ata_std_prereset()
With hotplug, every reset might be a probing reset and thus something
similar to probe_init() is needed.  prereset() method is called before
a series of resets to a port and is the counterpart of postreset().
prereset() can tell EH to use different type of reset or skip reset by
modifying ehc->i.action.

This patch also implements ata_std_prereset().  Most controllers
should be able to use this function directly or with some wrapping.
After hotplug, different controllers need different actions to resume
the PHY and detect the newly attached device.  Controllers can be
categorized as follows.

* Controllers which can wait for the first D2H FIS after hotplug.
  Note that if the waiting is implemented by polling TF status, there
  needs to be a way to set BSY on PHY status change.  It can be
  implemented by hardware or with the help of the driver.

* Controllers which can wait for the first D2H FIS after sending
  COMRESET.  These controllers need to issue COMRESET to wait for the
  first FIS.  Note that the received D2H FIS could be the first D2H
  FIS after POR (power-on-reset) or D2H FIS in response to the
  COMRESET.  Some controllers use COMRESET as TF status
  synchronization point and clear TF automatically (sata_sil).

* Controllers which cannot wait for the first D2H FIS reliably.
  Blindly issuing SRST to spinning-up device often results in command
  issue failure or timeout, causing extended delay.  For these
  controllers, ata_std_prereset() explicitly waits ATA_SPINUP_WAIT
  (currently 8s) to give newly attached device time to spin up, then
  issues reset.  Note that failing to getting ready in ATA_SPINUP_WAIT
  is not critical.  libata will retry.  So, the timeout needs to be
  long enough to spin up most devices.

LLDDs can tell ata_std_prereset() which of above action is needed with
ATA_FLAG_HRST_TO_RESUME and ATA_FLAG_SKIP_D2H_BSY flags.  These flags
are PHY-specific property and will be moved to ata_link later.

While at it, this patch unifies function typedef's such that they all
have named arguments.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:27:48 +09:00
Tejun Heo d7bb4cc757 [PATCH] libata-hp-prep: implement sata_phy_debounce()
With hotplug, PHY always needs to be debounced before a reset as any
reset might find new devices.  Extract PHY waiting code from
sata_phy_resume() and extend it to include SStatus debouncing.  Note
that sata_phy_debounce() is superset of what used to be done inside
sata_phy_resume().

Three default debounce timing parameters are defined to be used by
hot/boot plug.  As resume failure during probing will be properly
handled as errors, timeout doesn't have to be long as before.
probeinit() uses the same timeout to retain the original behavior.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:27:46 +09:00
Tejun Heo a9beec9535 [PATCH] libata-hp-prep: make probing related functions global
Hotplug will be implemented in libata-eh.c.  Make ata_dev_read_id()
and ata_dev_configure() global.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31 18:27:44 +09:00