| Age | Commit message (Collapse) | Author |
|
|
|
|
|
Jens Axboe pointed out that the iounmap() call in libata was occurring
too early, and some drivers (ahci, probably others) were using ioremap'd
memory after it had been unmapped.
The patch should address that problem by way of improving the libata
driver API:
* move ->host_stop() call after all ->port_stop() calls have occurred.
* create default helper function ata_host_stop(), and move iounmap()
call there.
* add ->host_stop_prewalk() hook, use it in sata_qstor.c (hi Mark).
sata_qstor appears to require the host-stop-before-port-stop ordering
that existed prior to applying the attached patch.
|
|
Updated patch to fix erroneous flush of COMRESET set and missing flush
of COMRESET clear. Created a new routine scr_write_flush() to try to
prevent this in the future. Also, this patch is based on libata-2.6
instead of the previous libata-dev-2.6 based patch.
Signed-off-by: Brett Russ <russb@emc.com>
Index: libata-2.6/drivers/scsi/libata-core.c
===================================================================
|
|
Advanced SATA drivers should not (and cannot) use the basic
PCI IDE hooks for checking the Status and Error registers, as these
registers are either in non-standard locations, or simply don't
exist.
In the error handling path, libata was unconditionally calling some
PCI IDE hardware bitbanging functions, which would cause an oops
in the AHCI driver and any other advanced libata driver.
|
|
The timeout/error handling path was assuming that the hardware in
question was PCI IDE BMDMA-like, which is incorrect in a few cases.
Turn direct function calls into two new hooks.
|
|
The code previously alloced a 2-entry array, then freed each
entry individually, for users of "combined mode".
Convert code to use allocation function that only allocates
one object at a time.
Also, un-export ata_pci_init_legacy_mode(), as its only user is
libata-core.
|
|
After some testing, it seems that some PATA host adapter (ex. pdc20275) cannot
work reliably with specific request buffer sizes under ATAPI DMA mode.
Detailed test result:
4096, 2048, 1024, 512, 256: OK
384, 257, 255, 128, 96, 64, 32: failed (irq lost)
It seems multiple of 256 bytes are the safe ATAPI DMA buffer sizes to use.
Attached please find the patch to fix the pdc2027x ATAPI DMA problem.
Changes:
1. Add a callback function "check_atapi_dma()" to ata_port_operations such that libata core
can ask the driver: "Can this command be processed in ATAPI DMA mode safely? "
when the the command is received.
2. ATAPI DMA is off by default if the callback function is not provided by the driver
If the callback function is not provided by the driver, the ATAPI DMA should be as is.
The ATAPI DMA is already controlled by dev->flags.
BTW, the patch isolates the ATAPI DMA workaround to the pdc20275 driver itself,
not impacting libata core .
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
|
|
libata made the assumption that (for PIO commands in this case)
it could modify DMA memory at the kernel-virtual address, after
mapping this. This is incorrect, and fails on e.g. platforms that
copy DMA memory back and forth (swiotlb on Intel EM64T and IA64).
Remove this assumption by ensuring that we only call the DMA mapping
routines if we really are going to use DMA for data xfer.
Also: remove a bogus WARN_ON() in ata_sg_init_one() which caused
bug reports (but no problems).
|
|
Most of this work was done by "Mat Loikkanen" <Mat.Loikkanen@synopsys.com>.
* use struct device rather than struct pci_dev
* use generic DMA routines (dma_xxx) and generic struct device
routines (dev_xxx)
* isolate PCI-specific helpers inside CONFIG_PCI
|
|
|
|
into pobox.com:/spare/repo/libata-dev/export-simulator
|
|
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
|
|
This patch modifies libata-scsi for easier sharing of
the various ata_id_* functions and the ata_scsi_simulate()
function with non-libata drivers.
Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
|
|
In PCI IDE legacy mode ap->port_no is incorrectly set to zero for
the second port. Fix it by adding ->hard_port_no to struct ata_probe_ent
and struct ata_port (per Jeff's suggestion) and teaching ata_piix.c
to use it instead of ->port_no.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
|
|
* add dev_select hook, and default/noop implementations
* export ata_dev_classify
* fix a couple bugs that cropped up when building with
ATA_VERBOSE_DEBUG
* export __sata_phy_reset, a variant that does not call
ata_bus_reset
|
|
Eliminates duplicate code in sata_nv, sata_sis, and sata_via.
|
|
Prepare for use of new generic iomap API.
|
|
|
|
Mainly adding the infrastructure for various ATA ioctls. Currently
only supports two ATA-specific ioctls:
HDIO_GET_32BIT and HDIO_SET_32BIT (hdparm -c)
|
|
|
|
* new helper atapi_cdb_len() in linux/ata.h, use it after
IDENTIFY PACKET DEVICE command completes
* add new taskfile protocol ATA_PROT_ATAPI_NODATA
* store scsi cdb in ata_queued_cmd. This removes another dependence
on the scsi layer, and enables us to issue an internal REQUEST SENSE.
* store cdb len in ata_port
* new constant ATAPI_CDB_LEN for max cdb length
* move ATA taskfile and SCSI cdb near the top of ata_queued_cmd, for
better cacheline friendliness.
|
|
Remove unused/redundant flags ATA_DFLAG_{MASTER,WCACHE}
|
|
In the transfer-mode cleanup recently, the code that set flag
ATA_DFLAG_PIO disappeared. Resurrect it.
Remove ATA_QCFLAG_DMA, it isn't needed.
Always set polling in the ->qc_issue function, rather than force
the user to do it when setting up an ata_queued_cmd. This gives
maximum flexibility to the driver, letting the driver choose
whether or not to poll.
|
|
Fix two bugs that causes the recently-added transfer mode code
to break on 64-bit platforms. Make associated code more type-correct
in the process.
|
|
Add MWDMA support, and rework pio/mwdma/udma mode setup.
In the lone test case for PATA support, ata_piix, MWDMA mode setting
does not appear to work here. UDMA and PIO continue to work, so nobody
will really notice. But beware. Probably a driver problem, not
a bug in the core.
Also, doesn't bother writing to dummy timing registers on ICH5/6 SATA
anymore.
|
|
Move more SCSI-specific code out of libata core.
|
|
In part of the effort to remove SCSI specifics from the libata
internals, remove references to cmd->use_sg. cmd->use_sg
becomes ATA_QCFLAG_SG, and !cmd->use_sg becomes ATA_QCFLAG_SINGLE.
Convenience constant ATA_QCFLAG_DMAMAP is created when the programmer
wishes to refer collectively to ATA_QCFLAG_{SG,SINGLE}.
|
|
This is more conservative in general, and so applies to multiple
controllers. Specifically it attempts to address irq-related issues
on the Intel ICH5/6 hardware. On Intel ICH5/6, the BMDMA 'interrupt'
status bit will be set even on non-DMA commands, which software
(and I) did not expect.
This change clears pending interrupts once upon initialization,
and then each time ata_irq_on() is called.
|
|
|
|
This hook is used when an ATA controller wishes to use
hardware-specific methods of taskfile delivery, rather
than the standard method of bitbanging the ATA shadow
registers.
|
|
Certain early SATA drives have problems with write requests whose
length satisfy the equation "sectors % 15 == 1", on the SiI 3112.
Other drives, and other SiI controllers, are not affected.
The fix for this problem is to avoid such requests, in one of three
ways, for the affect drive+controller combos:
1) Limit all writes to 15 sectors
2) Use block layer features to avoid creating requests whose
length satisfies the above equation.
3) When a request satisfies the above equation, split the request
into two writes, neither of which satisfies the equation.
I chose fix #1, the most simple to implement. After discussion with
Silicon Image and others regarding the impact of this fix, I have
decided to remain with fix #1, and will not be implementing a
"better fix". This means that the affected SATA drives will see
decreased performance, but set of affected drives is small and will
never grow larger.
Further, the complexity of implementing solution #2 or
solution #3 is rather large.
When implementing lba48 'large request' support, I unintentionally
broke the fix for these affected drives. Kudos to Ricky Beam for
noticing this.
This change restores the fix, by adding a flag ATA_DFLAG_LOCK_SECTORS
to indicate that the max_sectors value set by the low-level driver
should never be changed.
|
|
|
|
Rename ->fill_sg hook to ->qc_prep, and call it unconditionally
(as opposed to ->fill_sg, which was called only when the
flag ATA_QCFLAG_SG was set).
|
|
PCI IDE DMA standard (or "bmdma") helper routines ata_bmdma_stop,
ata_bmdma_ack_irq, and ata_bmdma_status are added to linux/libata.h,
and used in libata-core.
There is a minor behavior change, such that, the Alt Status register
is read before acknowledging the bmdma interrupt. This should be ok,
and furthermore there will be more significant behavior changes
in this area coming soon.
|
|
Since we want the probe phase to call other workqueues, this is
required to eliminate future deadlocks.
Other methods would include starting a single-shot thread just for
probing, but overall, using a separate thread for probing is pointless
since we are already in process context when we probe.
So, we simply call ata_bus_probe directly.
|
|
Detection of an ATAPI taskfile is possible using a simple test
on existing information, so there is no need to cache this value
in a separate flag (ATA_QCFLAG_ATAPI). Instead, create and use
a new helper function is_atapi_taskfile().
|
|
The SCSI T10 committee is working on a document describing a standard
method for translating ATA<->SCSI, since it being done quite often
these days. Some of the recommendations are reasonable, and we implement
two here:
* Mirror that ATA 'removeable media' bit into INQUIRY output.
* Change behavior of INQUIRY output field 'product revision' from
the libata software version number to the first 4 bytes of the
ATA device's firmware revision number.
Rather than cache the firmware revision in struct ata_device, as was/is
done with two other strings, I took the opportunity to eliminate the
caching of the two other strings, 'vendor' and 'product'. These strings
are now retrieved as needed from the IDENTIFY [PACKET] DEVICE info page,
since we cache its entire contents.
Retrieving a string from the identify-device page is done via the
helper function ata_dev_id_string(), which is now exported.
This patch winds up making struct ata_device 40 bytes smaller, and
the libata core gets a bit smaller as well.
|
|
DMADIR bit is necessary for some PATA->SATA bridges. These
bridges require the OS driver to specify the data xfer direction,
for PACKET (a.k.a. scsi) commands.
A reliable DMADIR detection method hasn't yet been developed,
and ATAPI is still a WIP, so DMADIR is enabled with an ifdef for
now.
|
|
Remove unused 'done_late' arg to ata_qc_complete(), which was never
useful in 2.4, and never used at all in 2.6.
This allows us to eliminate the same arg from ata_dma_complete(),
and also make it more correct by passing the command rather than
the ATA port structure as arg0.
|
|
into redhat.com:/spare/repo/libata-2.6
|
|
Remove various private implementations of msecs_to_jiffies() and
jiffies_to_msecs().
There are various uppercase versions which should be consolidated.
|
|
The standard ATA bit nIEN in the Device Control register serves as
the indicator for whether we are polling or not. As it mirrors
ATA_QCFLAG_POLL completely, eliminate that in favor of testing
ATA_NIEN bit.
|
|
* Only call ata_sg_setup{_one} if ATA_QCFLAG_SG is set. Preparation
for future use, as currently ATA_QCFLAG_SG is always set when
ata_qc_issue is called.
This change in theory is incorrect for Promise TX/SX4 drivers,
since those drivers set up the Promise-specific packet in their
->fill_sg hook, which is now called conditionally.
A FIXME that doesn't affect anything, for now.
* ATA_PROT_ATAPI and ATA_PROT_ATAPI_DMA command issue need to be
differentiated.
* Create and use ata_qc_set_polling() to consistently set/clear the
flags associated with using polling instead of interrupts.
|
|
In order to support some new taskfile protocols, particularly ATAPI,
the setup-and-start-DMA hook needs to be split into its component
pieces, 'setup' and 'start'.
For PCI IDE-style controllers, most of the code is moved into the
'setup' portion, with the 'start' portion only flipping a single
bit in hardware.
|
|
|
|
The semaphore was initialized and up'd for each command, but nobody
was listening. Replace this with a completion, which may or may not
be present.
|
|
This allows us to kill the katad thread itself, and several
thread-related variables in struct ata_port.
|
|
|
|
libata creates one thread per ata_port structure. This is inadequate
for our needs, and also cumbersome to maintain, now that workqueues
and Rusty's thread work is available.
This patch begins to move libata away from doing its own per-port
thread, by moving the ATAPI command initiation code to work under
the workqueue system.
This patch also creates a private workqueue, global to all of libata.
|