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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
It's best to run ATA hotplug from EH but attaching SCSI devices needs
working EH. ata_aux_wq is used to give SCSI hotplug operations a
separate context.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Add device persistent field dev->sdev and store the attached SCSI
device. With hotplug, libata needs to know the attached SCSI device
to offline and detach it, but scsi_device_lookup() cannot be used
because libata will reuse SCSI ID numbers - dead but not gone devices
(due to zombie opens, etc...) interfere with the lookup.
dev->sdev doesn't hold reference to the SCSI device. It's cleared
when the SCSI device goes away.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Add ap->hw_sata_spd_limit and initialize it once during the boot
initialization (or driver load initialization). ap->sata_spd_limit is
reset to ap->hw_sata_spd_limit on hotplug. This prevents spd limits
introduced by earlier devices from affecting new devices.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Separate out ata_find_dev() and __ata_scsi_find_dev() from
ata_scsi_find_dev(). These will be used by later hotplug
implementation.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Lifetimes of some fields span over device plugging/unplugging. This
patch moves such persistent fields to the top of ata_device and
separate them with ATA_DEVICE_CLEAR_OFFSET. Fields above the offset
are initialized once during host initializatino while all other fields
are cleared before hotplugging. Currently ->ap, devno and part of
flags are persistent.
Note that flags is partially cleared while holding host_set lock.
This is to synchronize with later warm plug implementation which will
record hotplug request in dev->flags.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Move initialization of struct ata_device into ata_dev_init() in
preparation for hotplug. This patch calls ata_dev_init() from
ata_host_init() and thus makes no functional difference.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Implement ata_eh_wait(). On return from this function, it's
guaranteed that the EH which was pending or in progress when the
function was called is complete - including the tailing part of SCSI
EH. This will be used by hotplug and others to synchronize with EH.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Set ata_device->pio_mode to XFER_PIO_0 after a successful reset. This
is to keep EH resets consistent with probe resets as updated by the
commit b6079ca409. Note that, with
soon-to-follow hotplug update, EH resets will include probe resets.
Signed-off-by: Tejun Heo <htejun@gmail.com>
This patch sets the prerequisites for the new debugging scheme that more or
less resembles Donald Becker's net driver example. This one liner doesn't
change any functionality beside setting the appropriate debug level for the
msg_enable control in the ata_port struct, which will be later used by the
ata_msg_* macros to control the amount of debug information sent to printk.
Signed-off-by: <petkov@uni-muenster.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
A typo crept in with commit ea1e847cc2
which defined TI_LOCAL_FLAGS to be the offset of the `flags' field
of struct thread_info, rather than the `local_flags' field. This
fixes it. The typo was pointed out by Guennadi Liakhovetski.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Okay, just to sum things up.
This forces libata to wait for up to 2 seconds for BUSY|DRQ to clear
on resume before continuing.
[jgarzik adds...] During testing we never saw DRQ asserted, but
nonetheless (a) this works and (b) testing for DRQ won't hurt.
Signed-off-by: Mark Lord <liml@rtr.ca>
Acked-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc:
[PATCH] powerpc: fix RTC/NVRAM accesses on Maple
[PATCH] ppc32 CPM_UART: various fixes for pq2 uart users
[PATCH] powerpc: linuxppc64.org no more
These IDs are also used by the drivers/ide/pci changes submitted by
VIA.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This is the second lcs driver patch containing the rest of lcs fixes.
Signed-off-by: Frank Pavlic <fpavlic@de.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Several problems occured with lcs device driver:
- device not operational anymore after cable pull/plug-in.
- unpredictable results occured, e.g. kernel panic
using cards of type QD8F.
- STOPLAN and delete multicast address command
were not proper recognized by OSA card under heavy network workload.
- channel/device error checks missing in interrupt handler.
To fix all problems at once recovery of lcs devices has been improved.
missing error checks in lcs interrupt handler has been added.
Once a hardware problem occurs lcs will recover the device now properly.
Signed-off-by: Frank Pavlic <fpavlic@de.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
From: Frank Blaschka <Frank.Blaschka@de.ibm.com>
From: Frank Pavlic <fpavlic@de.ibm.com>
- fix fake_ll during initial device bringup. fake_ll was
not active after first start of the device.
Problem only occured when qeth was built without IPV6 support.
- avoid skb usage after invocation of qeth_flush_buffers,
because skb might already be freed.
- remove yet another useless netif_wake_queue in
qeth_softsetup_ipv6 since this function is only called
when device is going online. In this case card->state will
never be in state UP. So let the net_device queue down .
Signed-off-by: Frank Pavlic <fpavlic@de.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
From: Frank Pavlic <fpavlic@de.ibm.com>
- correct checking of sscanf-%n value in qeth_string_to_ipaddr().
- don't use netif_stop_queue outside the hard_start_xmit routine.
Rather use netif_tx_disable.
- don't call qeth_netdev_init on a recovery.
Signed-off-by: Frank Pavlic <fpavlic@de.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
In case of a parse error for the cu3088 group attribute,
return -EINVAL instead of count.
Signed-off-by: Frank Pavlic <fpavlic@de.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>